From 9b0e09c6caa7b5f4127a4e8891d0c6b6dd20a425 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Fri, 13 Dec 2019 00:10:03 +0800 Subject: [PATCH] first commit --- .gitignore | 3 + .phalcon/.gitkeep | 0 README.en.md | 36 - app/Caches/Cache.php | 75 + app/Caches/Category.php | 57 + app/Caches/Config.php | 70 + app/Caches/Course.php | 57 + app/Caches/Nav.php | 53 + app/Caches/User.php | 57 + app/Console/Tasks/CleanLogTask.php | 149 ++ app/Console/Tasks/CloseOrderTask.php | 46 + app/Console/Tasks/CloseTradeTask.php | 94 + app/Console/Tasks/CourseCountTask.php | 44 + app/Console/Tasks/ImageSyncTask.php | 50 + app/Console/Tasks/LearningTask.php | 139 ++ app/Console/Tasks/MainTask.php | 24 + app/Console/Tasks/MaintainTask.php | 37 + app/Console/Tasks/RefundTask.php | 273 +++ app/Console/Tasks/SpiderTask.php | 282 +++ app/Console/Tasks/Task.php | 17 + app/Console/Tasks/UnlockUserTask.php | 45 + app/Console/Tasks/VodEventTask.php | 157 ++ app/Exceptions/BadRequest.php | 8 + app/Exceptions/Forbidden.php | 8 + app/Exceptions/NotFound.php | 8 + app/Exceptions/ServerError.php | 8 + app/Exceptions/Unauthorized.php | 8 + .../Admin/Controllers/AuditController.php | 45 + .../Admin/Controllers/CategoryController.php | 140 ++ .../Admin/Controllers/ChapterController.php | 215 ++ .../Admin/Controllers/ConfigController.php | 275 +++ app/Http/Admin/Controllers/Controller.php | 113 + .../Admin/Controllers/CourseController.php | 147 ++ .../Admin/Controllers/IndexController.php | 55 + app/Http/Admin/Controllers/NavController.php | 140 ++ .../Admin/Controllers/OrderController.php | 91 + .../Admin/Controllers/PackageController.php | 133 ++ app/Http/Admin/Controllers/PageController.php | 121 + .../Admin/Controllers/PublicController.php | 63 + .../Admin/Controllers/RefundController.php | 70 + .../Admin/Controllers/ReviewController.php | 108 + app/Http/Admin/Controllers/RoleController.php | 132 ++ .../Admin/Controllers/SessionController.php | 64 + .../Admin/Controllers/SlideController.php | 124 + .../Admin/Controllers/StorageController.php | 47 + .../Admin/Controllers/StudentController.php | 121 + app/Http/Admin/Controllers/TestController.php | 201 ++ .../Admin/Controllers/TradeController.php | 89 + app/Http/Admin/Controllers/UserController.php | 109 + app/Http/Admin/Controllers/VodController.php | 68 + .../Admin/Controllers/XmCourseController.php | 43 + app/Http/Admin/Module.php | 35 + app/Http/Admin/Services/AlipayTest.php | 61 + app/Http/Admin/Services/Audit.php | 37 + app/Http/Admin/Services/AuthMenu.php | 122 + app/Http/Admin/Services/AuthNode.php | 582 +++++ app/Http/Admin/Services/AuthUser.php | 91 + app/Http/Admin/Services/Category.php | 163 ++ app/Http/Admin/Services/Chapter.php | 248 ++ app/Http/Admin/Services/ChapterContent.php | 178 ++ app/Http/Admin/Services/Config.php | 116 + app/Http/Admin/Services/Course.php | 485 ++++ app/Http/Admin/Services/CourseStudent.php | 180 ++ app/Http/Admin/Services/Nav.php | 179 ++ app/Http/Admin/Services/Order.php | 103 + app/Http/Admin/Services/Package.php | 246 ++ app/Http/Admin/Services/Page.php | 124 + app/Http/Admin/Services/PaymentTest.php | 82 + app/Http/Admin/Services/Refund.php | 122 + app/Http/Admin/Services/Review.php | 140 ++ app/Http/Admin/Services/Role.php | 166 ++ app/Http/Admin/Services/Service.php | 8 + app/Http/Admin/Services/Session.php | 51 + app/Http/Admin/Services/Slide.php | 161 ++ app/Http/Admin/Services/Trade.php | 130 ++ app/Http/Admin/Services/User.php | 181 ++ app/Http/Admin/Services/WxpayTest.php | 41 + app/Http/Admin/Services/XmCourse.php | 50 + app/Http/Admin/Views/audit/list.volt | 76 + app/Http/Admin/Views/audit/search.volt | 72 + app/Http/Admin/Views/audit/show.volt | 12 + app/Http/Admin/Views/category/add.volt | 52 + app/Http/Admin/Views/category/edit.volt | 37 + app/Http/Admin/Views/category/list.volt | 125 + app/Http/Admin/Views/chapter/add_chapter.volt | 30 + app/Http/Admin/Views/chapter/add_lesson.volt | 50 + .../Admin/Views/chapter/edit_chapter.volt | 36 + app/Http/Admin/Views/chapter/edit_lesson.volt | 37 + .../Views/chapter/edit_lesson_article.volt | 17 + .../Views/chapter/edit_lesson_basic.volt | 40 + .../Admin/Views/chapter/edit_lesson_live.volt | 53 + .../Admin/Views/chapter/edit_lesson_vod.volt | 74 + app/Http/Admin/Views/chapter/lessons.volt | 97 + .../Admin/Views/chapter/lessons_article.volt | 46 + .../Admin/Views/chapter/lessons_live.volt | 54 + app/Http/Admin/Views/chapter/lessons_vod.volt | 63 + app/Http/Admin/Views/config/alipay_test.volt | 85 + app/Http/Admin/Views/config/captcha.volt | 99 + app/Http/Admin/Views/config/live.volt | 14 + app/Http/Admin/Views/config/live_pull.volt | 150 ++ .../Admin/Views/config/live_pull_test.volt | 0 app/Http/Admin/Views/config/live_push.volt | 93 + .../Admin/Views/config/live_push_test.volt | 60 + app/Http/Admin/Views/config/mailer.volt | 119 + app/Http/Admin/Views/config/payment.volt | 14 + .../Admin/Views/config/payment_alipay.volt | 102 + .../Admin/Views/config/payment_wxpay.volt | 101 + app/Http/Admin/Views/config/secret.volt | 36 + app/Http/Admin/Views/config/smser.volt | 114 + app/Http/Admin/Views/config/storage.volt | 86 + app/Http/Admin/Views/config/vip.volt | 47 + app/Http/Admin/Views/config/vod.volt | 219 ++ app/Http/Admin/Views/config/website.volt | 115 + app/Http/Admin/Views/config/wechat_test.volt | 85 + app/Http/Admin/Views/config/wxpay_test.volt | 85 + app/Http/Admin/Views/course/add.volt | 64 + app/Http/Admin/Views/course/chapters.volt | 89 + app/Http/Admin/Views/course/edit.volt | 29 + app/Http/Admin/Views/course/edit_basic.volt | 88 + app/Http/Admin/Views/course/edit_desc.volt | 34 + app/Http/Admin/Views/course/edit_related.volt | 24 + app/Http/Admin/Views/course/edit_sale.volt | 72 + app/Http/Admin/Views/course/expiry_macro.volt | 13 + app/Http/Admin/Views/course/list.volt | 140 ++ app/Http/Admin/Views/course/search.volt | 95 + app/Http/Admin/Views/index.volt | 18 + app/Http/Admin/Views/index/index.volt | 76 + app/Http/Admin/Views/index/main.volt | 0 app/Http/Admin/Views/nav/add.volt | 75 + app/Http/Admin/Views/nav/edit.volt | 60 + app/Http/Admin/Views/nav/list.volt | 144 ++ app/Http/Admin/Views/order/list.volt | 57 + app/Http/Admin/Views/order/macro.volt | 62 + app/Http/Admin/Views/order/search.volt | 79 + app/Http/Admin/Views/order/show.volt | 141 ++ app/Http/Admin/Views/package/add.volt | 29 + app/Http/Admin/Views/package/edit.volt | 91 + app/Http/Admin/Views/package/guiding.volt | 40 + app/Http/Admin/Views/package/list.volt | 95 + app/Http/Admin/Views/page/add.volt | 39 + app/Http/Admin/Views/page/edit.volt | 40 + app/Http/Admin/Views/page/list.volt | 94 + .../Admin/Views/partials/clipboard_tips.volt | 16 + .../Admin/Views/partials/cover_uploader.volt | 29 + app/Http/Admin/Views/partials/ip2region.volt | 22 + app/Http/Admin/Views/partials/layedit.volt | 19 + .../Admin/Views/partials/media_preview.volt | 25 + .../Admin/Views/partials/media_uploader.volt | 66 + app/Http/Admin/Views/partials/pager.volt | 8 + app/Http/Admin/Views/public/forbidden.volt | 12 + app/Http/Admin/Views/public/ip2region.volt | 14 + app/Http/Admin/Views/public/live_player.volt | 38 + app/Http/Admin/Views/public/login.volt | 71 + app/Http/Admin/Views/public/vod_player.volt | 85 + app/Http/Admin/Views/refund/list.volt | 58 + app/Http/Admin/Views/refund/macro.volt | 15 + app/Http/Admin/Views/refund/search.volt | 69 + app/Http/Admin/Views/refund/show.volt | 125 + app/Http/Admin/Views/review/edit.volt | 57 + app/Http/Admin/Views/review/list.volt | 111 + app/Http/Admin/Views/review/search.volt | 52 + app/Http/Admin/Views/role/add.volt | 29 + app/Http/Admin/Views/role/edit.volt | 52 + app/Http/Admin/Views/role/list.volt | 62 + app/Http/Admin/Views/slide/add.volt | 64 + app/Http/Admin/Views/slide/edit.volt | 112 + app/Http/Admin/Views/slide/list.volt | 129 ++ app/Http/Admin/Views/student/add.volt | 51 + app/Http/Admin/Views/student/edit.volt | 61 + app/Http/Admin/Views/student/learning.volt | 85 + app/Http/Admin/Views/student/list.volt | 122 + app/Http/Admin/Views/student/search.volt | 49 + app/Http/Admin/Views/trade/list.volt | 60 + app/Http/Admin/Views/trade/macro.volt | 19 + app/Http/Admin/Views/trade/search.volt | 76 + app/Http/Admin/Views/trade/show.volt | 162 ++ app/Http/Admin/Views/user/add.volt | 49 + app/Http/Admin/Views/user/edit.volt | 97 + app/Http/Admin/Views/user/list.volt | 81 + app/Http/Admin/Views/user/search.volt | 76 + app/Http/Api/Controllers/Controller.php | 13 + app/Http/Api/Controllers/IndexController.php | 40 + app/Http/Api/Module.php | 25 + app/Http/Api/Services/Service.php | 69 + .../Home/Controllers/AccountController.php | 101 + .../Home/Controllers/CategoryController.php | 49 + .../Home/Controllers/ChapterController.php | 85 + .../Home/Controllers/CommentController.php | 85 + .../Home/Controllers/ConsultController.php | 101 + app/Http/Home/Controllers/Controller.php | 26 + .../Home/Controllers/CourseController.php | 159 ++ app/Http/Home/Controllers/ErrorController.php | 65 + app/Http/Home/Controllers/IndexController.php | 24 + app/Http/Home/Controllers/MyController.php | 85 + .../Home/Controllers/NotifyController.php | 59 + app/Http/Home/Controllers/OrderController.php | 142 ++ .../Home/Controllers/PublicController.php | 30 + .../Home/Controllers/ReviewController.php | 101 + .../Home/Controllers/SearchController.php | 89 + app/Http/Home/Controllers/UserController.php | 67 + app/Http/Home/Module.php | 28 + app/Http/Home/Services/Account.php | 214 ++ app/Http/Home/Services/Category.php | 96 + app/Http/Home/Services/Chapter.php | 210 ++ app/Http/Home/Services/ChapterAdmin.php | 180 ++ .../Home/Services/ChapterContentAdmin.php | 234 ++ app/Http/Home/Services/Comment.php | 198 ++ app/Http/Home/Services/Consult.php | 174 ++ app/Http/Home/Services/Course.php | 374 +++ app/Http/Home/Services/CourseAdmin.php | 177 ++ app/Http/Home/Services/Danmaku.php | 87 + app/Http/Home/Services/My.php | 223 ++ app/Http/Home/Services/Order.php | 439 ++++ app/Http/Home/Services/Review.php | 239 ++ app/Http/Home/Services/Service.php | 68 + app/Http/Home/Views/error/show400.volt | 3 + app/Http/Home/Views/error/show401.volt | 3 + app/Http/Home/Views/error/show403.volt | 3 + app/Http/Home/Views/error/show404.volt | 3 + app/Http/Home/Views/error/show500.volt | 3 + app/Http/Home/Views/index.volt | 18 + app/Http/Home/Views/index/error404.volt | 5 + app/Http/Home/Views/index/index.volt | 0 app/Http/Home/Views/index/player.volt | 338 +++ app/Library/Cache/Backend/Redis.php | 264 +++ app/Library/Helper.php | 281 +++ app/Library/Logger.php | 33 + app/Library/OAuth.php | 52 + app/Library/OAuth/QQ.php | 112 + app/Library/OAuth/WeiBo.php | 86 + app/Library/OAuth/WeiXin.php | 87 + .../Paginator/Adapter/QueryBuilder.php | 61 + app/Library/Paginator/Query.php | 49 + app/Library/Security.php | 90 + app/Library/Util/Password.php | 27 + app/Library/Util/Verification.php | 42 + app/Library/Util/Word.php | 64 + app/Library/Validator/Common.php | 102 + app/Library/Validator/IdCard.php | 91 + app/Listeners/Listener.php | 41 + app/Listeners/Payment.php | 151 ++ app/Listeners/Profiler.php | 49 + app/Models/Audit.php | 80 + app/Models/Category.php | 114 + app/Models/Chapter.php | 247 ++ app/Models/ChapterArticle.php | 78 + app/Models/ChapterLive.php | 79 + app/Models/ChapterUser.php | 100 + app/Models/ChapterVod.php | 65 + app/Models/Config.php | 41 + app/Models/ContentImage.php | 39 + app/Models/Course.php | 284 +++ app/Models/CourseCategory.php | 46 + app/Models/CourseFavorite.php | 46 + app/Models/CoursePackage.php | 46 + app/Models/CourseRelated.php | 46 + app/Models/CourseTopic.php | 46 + app/Models/CourseUser.php | 150 ++ app/Models/Learning.php | 127 ++ app/Models/Model.php | 17 + app/Models/Nav.php | 160 ++ app/Models/Order.php | 214 ++ app/Models/Package.php | 107 + app/Models/Page.php | 79 + app/Models/Refund.php | 158 ++ app/Models/Review.php | 100 + app/Models/Role.php | 151 ++ app/Models/Slide.php | 146 ++ app/Models/Task.php | 124 + app/Models/Topic.php | 79 + app/Models/Trade.php | 168 ++ app/Models/User.php | 172 ++ app/Providers/AbstractProvider.php | 41 + app/Providers/Annotation.php | 31 + app/Providers/Cache.php | 33 + app/Providers/CliDispatcher.php | 24 + app/Providers/Config.php | 24 + app/Providers/Cookie.php | 17 + app/Providers/Crypt.php | 26 + app/Providers/Database.php | 37 + app/Providers/Escaper.php | 17 + app/Providers/EventsManager.php | 28 + app/Providers/Logger.php | 22 + app/Providers/MetaData.php | 31 + app/Providers/ProviderInterface.php | 27 + app/Providers/Redis.php | 37 + app/Providers/Router.php | 59 + app/Providers/Security.php | 22 + app/Providers/Session.php | 32 + app/Providers/Url.php | 28 + app/Providers/Volt.php | 53 + app/Repos/Audit.php | 79 + app/Repos/Category.php | 96 + app/Repos/Chapter.php | 142 ++ app/Repos/ChapterUser.php | 87 + app/Repos/Config.php | 46 + app/Repos/Course.php | 214 ++ app/Repos/CourseCategory.php | 40 + app/Repos/CourseFavorite.php | 54 + app/Repos/CoursePackage.php | 40 + app/Repos/CourseRelated.php | 40 + app/Repos/CourseUser.php | 125 + app/Repos/Learning.php | 59 + app/Repos/Nav.php | 64 + app/Repos/Order.php | 120 + app/Repos/Package.php | 94 + app/Repos/Page.php | 65 + app/Repos/Refund.php | 86 + app/Repos/Repository.php | 10 + app/Repos/Review.php | 102 + app/Repos/Role.php | 56 + app/Repos/Slide.php | 81 + app/Repos/Trade.php | 119 + app/Repos/User.php | 152 ++ app/Searchers/Course.php | 94 + app/Searchers/course.ini | 51 + app/Services/Alipay.php | 238 ++ app/Services/Captcha.php | 108 + app/Services/Category.php | 82 + app/Services/CourseStats.php | 133 ++ app/Services/Learning.php | 68 + app/Services/Live.php | 103 + app/Services/Mailer.php | 66 + app/Services/Order.php | 179 ++ app/Services/Refund.php | 128 ++ app/Services/Service.php | 41 + app/Services/Smser.php | 110 + app/Services/Storage.php | 281 +++ app/Services/Trade.php | 85 + app/Services/VipInfo.php | 67 + app/Services/Vod.php | 595 +++++ app/Services/Wxpay.php | 127 ++ app/Traits/Ajax.php | 38 + app/Traits/Client.php | 30 + app/Traits/Security.php | 38 + app/Transformers/ChapterList.php | 51 + app/Transformers/ChapterUserList.php | 67 + app/Transformers/CommentList.php | 100 + app/Transformers/CourseFavoriteList.php | 67 + app/Transformers/CourseList.php | 92 + app/Transformers/CourseUserList.php | 67 + app/Transformers/LearningList.php | 96 + app/Transformers/OrderList.php | 99 + app/Transformers/RefundList.php | 38 + app/Transformers/ReviewList.php | 67 + app/Transformers/TradeList.php | 38 + app/Transformers/Transformer.php | 17 + app/Transformers/UserList.php | 66 + app/Validators/Category.php | 82 + app/Validators/Chapter.php | 179 ++ app/Validators/ChapterArticle.php | 26 + app/Validators/ChapterAudio.php | 22 + app/Validators/ChapterLive.php | 51 + app/Validators/ChapterVod.php | 22 + app/Validators/Course.php | 178 ++ app/Validators/CourseQuery.php | 128 ++ app/Validators/CourseUser.php | 96 + app/Validators/Nav.php | 125 + app/Validators/Order.php | 163 ++ app/Validators/Package.php | 87 + app/Validators/Page.php | 75 + app/Validators/Refund.php | 56 + app/Validators/Review.php | 83 + app/Validators/Role.php | 63 + app/Validators/Slide.php | 170 ++ app/Validators/Trade.php | 56 + app/Validators/User.php | 273 +++ app/Validators/Validator.php | 37 + bootstrap/ConsoleErrorHandler.php | 47 + bootstrap/ConsoleKernel.php | 92 + bootstrap/Helper.php | 139 ++ bootstrap/HttpErrorHandler.php | 125 + bootstrap/HttpKernel.php | 95 + bootstrap/Kernel.php | 57 + common | 1 + composer.json | 24 + composer.lock | 2021 +++++++++++++++++ config/config.default.php | 45 + config/crossdomain.xml | 6 + config/errors.php | 206 ++ config/events.php | 10 + console.php | 13 + .../20190616155547_my_test_migration.php | 36 + docker/docker-compose.yml | 67 + docker/mysql/Dockerfile | 10 + docker/mysql/data/.gitignore | 2 + docker/mysql/log/.gitignore | 2 + docker/nginx/Dockerfile | 10 + docker/nginx/conf.d/default.conf | 29 + docker/nginx/log/.gitignore | 2 + docker/php/Dockerfile | 27 + docker/php/log/.gitignore | 2 + docker/redis/Dockerfile | 10 + docker/redis/data/.gitignore | 2 + docker/sources.list | 8 + docker/xunsearch/Dockerfile | 28 + docker/xunsearch/data/.gitignore | 2 + docker/xunsearch/xs-docker.sh | 17 + phinx.php | 42 + public/.htaccess | 8 + public/favicon.ico | Bin 0 -> 4286 bytes public/index.php | 10 + public/static/admin/css/style.css | 182 ++ public/static/admin/img/default_cover.png | Bin 0 -> 2692 bytes public/static/admin/img/pay_test_cover.png | Bin 0 -> 14852 bytes public/static/admin/img/vip_cover.png | Bin 0 -> 17587 bytes public/static/admin/js/common.js | 79 + public/static/admin/js/index.js | 41 + public/static/admin/js/xm-course.js | 107 + public/static/lib/clipboard.min.js | 7 + public/static/lib/cos-js-sdk-v5.min.js | 1 + public/static/lib/jquery.min.js | 6 + public/static/lib/jquery.qrcode.min.js | 28 + public/static/lib/layui/css/dropdown.css | 11 + public/static/lib/layui/css/layui.css | 2 + public/static/lib/layui/css/layui.mobile.css | 2 + public/static/lib/layui/css/modules/code.css | 2 + .../css/modules/laydate/default/laydate.css | 2 + .../css/modules/layer/default/icon-ext.png | Bin 0 -> 5911 bytes .../layui/css/modules/layer/default/icon.png | Bin 0 -> 11493 bytes .../layui/css/modules/layer/default/layer.css | 2 + .../css/modules/layer/default/loading-0.gif | Bin 0 -> 5793 bytes .../css/modules/layer/default/loading-1.gif | Bin 0 -> 701 bytes .../css/modules/layer/default/loading-2.gif | Bin 0 -> 1787 bytes public/static/lib/layui/extends/dropdown.js | 61 + public/static/lib/layui/font/iconfont.eot | Bin 0 -> 41712 bytes public/static/lib/layui/font/iconfont.svg | 485 ++++ public/static/lib/layui/font/iconfont.ttf | Bin 0 -> 41536 bytes public/static/lib/layui/font/iconfont.woff | Bin 0 -> 27256 bytes public/static/lib/layui/font/iconfont.woff2 | Bin 0 -> 23140 bytes public/static/lib/layui/images/face/0.gif | Bin 0 -> 2689 bytes public/static/lib/layui/images/face/1.gif | Bin 0 -> 5514 bytes public/static/lib/layui/images/face/10.gif | Bin 0 -> 2797 bytes public/static/lib/layui/images/face/11.gif | Bin 0 -> 4121 bytes public/static/lib/layui/images/face/12.gif | Bin 0 -> 3361 bytes public/static/lib/layui/images/face/13.gif | Bin 0 -> 7425 bytes public/static/lib/layui/images/face/14.gif | Bin 0 -> 2375 bytes public/static/lib/layui/images/face/15.gif | Bin 0 -> 1793 bytes public/static/lib/layui/images/face/16.gif | Bin 0 -> 6721 bytes public/static/lib/layui/images/face/17.gif | Bin 0 -> 4439 bytes public/static/lib/layui/images/face/18.gif | Bin 0 -> 3017 bytes public/static/lib/layui/images/face/19.gif | Bin 0 -> 3040 bytes public/static/lib/layui/images/face/2.gif | Bin 0 -> 3222 bytes public/static/lib/layui/images/face/20.gif | Bin 0 -> 5144 bytes public/static/lib/layui/images/face/21.gif | Bin 0 -> 5191 bytes public/static/lib/layui/images/face/22.gif | Bin 0 -> 9823 bytes public/static/lib/layui/images/face/23.gif | Bin 0 -> 3792 bytes public/static/lib/layui/images/face/24.gif | Bin 0 -> 8096 bytes public/static/lib/layui/images/face/25.gif | Bin 0 -> 3127 bytes public/static/lib/layui/images/face/26.gif | Bin 0 -> 3291 bytes public/static/lib/layui/images/face/27.gif | Bin 0 -> 4377 bytes public/static/lib/layui/images/face/28.gif | Bin 0 -> 2793 bytes public/static/lib/layui/images/face/29.gif | Bin 0 -> 4854 bytes public/static/lib/layui/images/face/3.gif | Bin 0 -> 4017 bytes public/static/lib/layui/images/face/30.gif | Bin 0 -> 2555 bytes public/static/lib/layui/images/face/31.gif | Bin 0 -> 2002 bytes public/static/lib/layui/images/face/32.gif | Bin 0 -> 3481 bytes public/static/lib/layui/images/face/33.gif | Bin 0 -> 2454 bytes public/static/lib/layui/images/face/34.gif | Bin 0 -> 3700 bytes public/static/lib/layui/images/face/35.gif | Bin 0 -> 1800 bytes public/static/lib/layui/images/face/36.gif | Bin 0 -> 2331 bytes public/static/lib/layui/images/face/37.gif | Bin 0 -> 1513 bytes public/static/lib/layui/images/face/38.gif | Bin 0 -> 3615 bytes public/static/lib/layui/images/face/39.gif | Bin 0 -> 6495 bytes public/static/lib/layui/images/face/4.gif | Bin 0 -> 5689 bytes public/static/lib/layui/images/face/40.gif | Bin 0 -> 3154 bytes public/static/lib/layui/images/face/41.gif | Bin 0 -> 3644 bytes public/static/lib/layui/images/face/42.gif | Bin 0 -> 5305 bytes public/static/lib/layui/images/face/43.gif | Bin 0 -> 2674 bytes public/static/lib/layui/images/face/44.gif | Bin 0 -> 4126 bytes public/static/lib/layui/images/face/45.gif | Bin 0 -> 3417 bytes public/static/lib/layui/images/face/46.gif | Bin 0 -> 3007 bytes public/static/lib/layui/images/face/47.gif | Bin 0 -> 2333 bytes public/static/lib/layui/images/face/48.gif | Bin 0 -> 2689 bytes public/static/lib/layui/images/face/49.gif | Bin 0 -> 2315 bytes public/static/lib/layui/images/face/5.gif | Bin 0 -> 4567 bytes public/static/lib/layui/images/face/50.gif | Bin 0 -> 5866 bytes public/static/lib/layui/images/face/51.gif | Bin 0 -> 2785 bytes public/static/lib/layui/images/face/52.gif | Bin 0 -> 777 bytes public/static/lib/layui/images/face/53.gif | Bin 0 -> 2127 bytes public/static/lib/layui/images/face/54.gif | Bin 0 -> 2196 bytes public/static/lib/layui/images/face/55.gif | Bin 0 -> 1971 bytes public/static/lib/layui/images/face/56.gif | Bin 0 -> 2034 bytes public/static/lib/layui/images/face/57.gif | Bin 0 -> 2705 bytes public/static/lib/layui/images/face/58.gif | Bin 0 -> 2258 bytes public/static/lib/layui/images/face/59.gif | Bin 0 -> 10311 bytes public/static/lib/layui/images/face/6.gif | Bin 0 -> 2213 bytes public/static/lib/layui/images/face/60.gif | Bin 0 -> 3245 bytes public/static/lib/layui/images/face/61.gif | Bin 0 -> 2495 bytes public/static/lib/layui/images/face/62.gif | Bin 0 -> 2017 bytes public/static/lib/layui/images/face/63.gif | Bin 0 -> 5871 bytes public/static/lib/layui/images/face/64.gif | Bin 0 -> 6448 bytes public/static/lib/layui/images/face/65.gif | Bin 0 -> 3576 bytes public/static/lib/layui/images/face/66.gif | Bin 0 -> 3029 bytes public/static/lib/layui/images/face/67.gif | Bin 0 -> 2701 bytes public/static/lib/layui/images/face/68.gif | Bin 0 -> 1424 bytes public/static/lib/layui/images/face/69.gif | Bin 0 -> 2431 bytes public/static/lib/layui/images/face/7.gif | Bin 0 -> 3398 bytes public/static/lib/layui/images/face/70.gif | Bin 0 -> 4590 bytes public/static/lib/layui/images/face/71.gif | Bin 0 -> 5304 bytes public/static/lib/layui/images/face/8.gif | Bin 0 -> 4050 bytes public/static/lib/layui/images/face/9.gif | Bin 0 -> 4221 bytes .../static/lib/layui/lay/modules/carousel.js | 2 + public/static/lib/layui/lay/modules/code.js | 2 + .../lib/layui/lay/modules/colorpicker.js | 2 + .../static/lib/layui/lay/modules/element.js | 2 + public/static/lib/layui/lay/modules/flow.js | 2 + public/static/lib/layui/lay/modules/form.js | 2 + public/static/lib/layui/lay/modules/jquery.js | 5 + .../static/lib/layui/lay/modules/laydate.js | 2 + .../static/lib/layui/lay/modules/layedit.js | 2 + public/static/lib/layui/lay/modules/layer.js | 2 + .../static/lib/layui/lay/modules/laypage.js | 2 + public/static/lib/layui/lay/modules/laytpl.js | 2 + public/static/lib/layui/lay/modules/mobile.js | 2 + public/static/lib/layui/lay/modules/rate.js | 2 + public/static/lib/layui/lay/modules/slider.js | 2 + public/static/lib/layui/lay/modules/table.js | 2 + .../static/lib/layui/lay/modules/transfer.js | 2 + public/static/lib/layui/lay/modules/tree.js | 2 + public/static/lib/layui/lay/modules/upload.js | 2 + public/static/lib/layui/lay/modules/util.js | 2 + public/static/lib/layui/layui.all.js | 5 + public/static/lib/layui/layui.js | 2 + public/static/lib/simplemde/simplemde.min.css | 7 + public/static/lib/simplemde/simplemde.min.js | 15 + public/static/lib/vod-js-sdk-v6.min.js | 26 + public/static/lib/xm-select.js | 8 + scheduler.php | 36 + storage/cache/annotations/.gitignore | 2 + storage/cache/metadata/.gitignore | 2 + storage/cache/volt/.gitignore | 2 + storage/log/.gitignore | 2 + storage/tmp/.gitignore | 2 + websocket/Events.php | 87 + websocket/start.php | 37 + websocket/start_business_worker.php | 38 + websocket/start_gateway.php | 70 + websocket/start_register.php | 29 + 539 files changed, 37684 insertions(+), 36 deletions(-) create mode 100644 .gitignore create mode 100644 .phalcon/.gitkeep delete mode 100644 README.en.md create mode 100644 app/Caches/Cache.php create mode 100644 app/Caches/Category.php create mode 100644 app/Caches/Config.php create mode 100644 app/Caches/Course.php create mode 100644 app/Caches/Nav.php create mode 100644 app/Caches/User.php create mode 100644 app/Console/Tasks/CleanLogTask.php create mode 100644 app/Console/Tasks/CloseOrderTask.php create mode 100644 app/Console/Tasks/CloseTradeTask.php create mode 100644 app/Console/Tasks/CourseCountTask.php create mode 100644 app/Console/Tasks/ImageSyncTask.php create mode 100644 app/Console/Tasks/LearningTask.php create mode 100644 app/Console/Tasks/MainTask.php create mode 100644 app/Console/Tasks/MaintainTask.php create mode 100644 app/Console/Tasks/RefundTask.php create mode 100644 app/Console/Tasks/SpiderTask.php create mode 100644 app/Console/Tasks/Task.php create mode 100644 app/Console/Tasks/UnlockUserTask.php create mode 100644 app/Console/Tasks/VodEventTask.php create mode 100644 app/Exceptions/BadRequest.php create mode 100644 app/Exceptions/Forbidden.php create mode 100644 app/Exceptions/NotFound.php create mode 100644 app/Exceptions/ServerError.php create mode 100644 app/Exceptions/Unauthorized.php create mode 100644 app/Http/Admin/Controllers/AuditController.php create mode 100644 app/Http/Admin/Controllers/CategoryController.php create mode 100644 app/Http/Admin/Controllers/ChapterController.php create mode 100644 app/Http/Admin/Controllers/ConfigController.php create mode 100644 app/Http/Admin/Controllers/Controller.php create mode 100644 app/Http/Admin/Controllers/CourseController.php create mode 100644 app/Http/Admin/Controllers/IndexController.php create mode 100644 app/Http/Admin/Controllers/NavController.php create mode 100644 app/Http/Admin/Controllers/OrderController.php create mode 100644 app/Http/Admin/Controllers/PackageController.php create mode 100644 app/Http/Admin/Controllers/PageController.php create mode 100644 app/Http/Admin/Controllers/PublicController.php create mode 100644 app/Http/Admin/Controllers/RefundController.php create mode 100644 app/Http/Admin/Controllers/ReviewController.php create mode 100644 app/Http/Admin/Controllers/RoleController.php create mode 100644 app/Http/Admin/Controllers/SessionController.php create mode 100644 app/Http/Admin/Controllers/SlideController.php create mode 100644 app/Http/Admin/Controllers/StorageController.php create mode 100644 app/Http/Admin/Controllers/StudentController.php create mode 100644 app/Http/Admin/Controllers/TestController.php create mode 100644 app/Http/Admin/Controllers/TradeController.php create mode 100644 app/Http/Admin/Controllers/UserController.php create mode 100644 app/Http/Admin/Controllers/VodController.php create mode 100644 app/Http/Admin/Controllers/XmCourseController.php create mode 100644 app/Http/Admin/Module.php create mode 100644 app/Http/Admin/Services/AlipayTest.php create mode 100644 app/Http/Admin/Services/Audit.php create mode 100644 app/Http/Admin/Services/AuthMenu.php create mode 100644 app/Http/Admin/Services/AuthNode.php create mode 100644 app/Http/Admin/Services/AuthUser.php create mode 100644 app/Http/Admin/Services/Category.php create mode 100644 app/Http/Admin/Services/Chapter.php create mode 100644 app/Http/Admin/Services/ChapterContent.php create mode 100644 app/Http/Admin/Services/Config.php create mode 100644 app/Http/Admin/Services/Course.php create mode 100644 app/Http/Admin/Services/CourseStudent.php create mode 100644 app/Http/Admin/Services/Nav.php create mode 100644 app/Http/Admin/Services/Order.php create mode 100644 app/Http/Admin/Services/Package.php create mode 100644 app/Http/Admin/Services/Page.php create mode 100644 app/Http/Admin/Services/PaymentTest.php create mode 100644 app/Http/Admin/Services/Refund.php create mode 100644 app/Http/Admin/Services/Review.php create mode 100644 app/Http/Admin/Services/Role.php create mode 100644 app/Http/Admin/Services/Service.php create mode 100644 app/Http/Admin/Services/Session.php create mode 100644 app/Http/Admin/Services/Slide.php create mode 100644 app/Http/Admin/Services/Trade.php create mode 100644 app/Http/Admin/Services/User.php create mode 100644 app/Http/Admin/Services/WxpayTest.php create mode 100644 app/Http/Admin/Services/XmCourse.php create mode 100644 app/Http/Admin/Views/audit/list.volt create mode 100644 app/Http/Admin/Views/audit/search.volt create mode 100644 app/Http/Admin/Views/audit/show.volt create mode 100644 app/Http/Admin/Views/category/add.volt create mode 100644 app/Http/Admin/Views/category/edit.volt create mode 100644 app/Http/Admin/Views/category/list.volt create mode 100644 app/Http/Admin/Views/chapter/add_chapter.volt create mode 100644 app/Http/Admin/Views/chapter/add_lesson.volt create mode 100644 app/Http/Admin/Views/chapter/edit_chapter.volt create mode 100644 app/Http/Admin/Views/chapter/edit_lesson.volt create mode 100644 app/Http/Admin/Views/chapter/edit_lesson_article.volt create mode 100644 app/Http/Admin/Views/chapter/edit_lesson_basic.volt create mode 100644 app/Http/Admin/Views/chapter/edit_lesson_live.volt create mode 100644 app/Http/Admin/Views/chapter/edit_lesson_vod.volt create mode 100644 app/Http/Admin/Views/chapter/lessons.volt create mode 100644 app/Http/Admin/Views/chapter/lessons_article.volt create mode 100644 app/Http/Admin/Views/chapter/lessons_live.volt create mode 100644 app/Http/Admin/Views/chapter/lessons_vod.volt create mode 100644 app/Http/Admin/Views/config/alipay_test.volt create mode 100644 app/Http/Admin/Views/config/captcha.volt create mode 100644 app/Http/Admin/Views/config/live.volt create mode 100644 app/Http/Admin/Views/config/live_pull.volt create mode 100644 app/Http/Admin/Views/config/live_pull_test.volt create mode 100644 app/Http/Admin/Views/config/live_push.volt create mode 100644 app/Http/Admin/Views/config/live_push_test.volt create mode 100644 app/Http/Admin/Views/config/mailer.volt create mode 100644 app/Http/Admin/Views/config/payment.volt create mode 100644 app/Http/Admin/Views/config/payment_alipay.volt create mode 100644 app/Http/Admin/Views/config/payment_wxpay.volt create mode 100644 app/Http/Admin/Views/config/secret.volt create mode 100644 app/Http/Admin/Views/config/smser.volt create mode 100644 app/Http/Admin/Views/config/storage.volt create mode 100644 app/Http/Admin/Views/config/vip.volt create mode 100644 app/Http/Admin/Views/config/vod.volt create mode 100644 app/Http/Admin/Views/config/website.volt create mode 100644 app/Http/Admin/Views/config/wechat_test.volt create mode 100644 app/Http/Admin/Views/config/wxpay_test.volt create mode 100644 app/Http/Admin/Views/course/add.volt create mode 100644 app/Http/Admin/Views/course/chapters.volt create mode 100644 app/Http/Admin/Views/course/edit.volt create mode 100644 app/Http/Admin/Views/course/edit_basic.volt create mode 100644 app/Http/Admin/Views/course/edit_desc.volt create mode 100644 app/Http/Admin/Views/course/edit_related.volt create mode 100644 app/Http/Admin/Views/course/edit_sale.volt create mode 100644 app/Http/Admin/Views/course/expiry_macro.volt create mode 100644 app/Http/Admin/Views/course/list.volt create mode 100644 app/Http/Admin/Views/course/search.volt create mode 100644 app/Http/Admin/Views/index.volt create mode 100644 app/Http/Admin/Views/index/index.volt create mode 100644 app/Http/Admin/Views/index/main.volt create mode 100644 app/Http/Admin/Views/nav/add.volt create mode 100644 app/Http/Admin/Views/nav/edit.volt create mode 100644 app/Http/Admin/Views/nav/list.volt create mode 100644 app/Http/Admin/Views/order/list.volt create mode 100644 app/Http/Admin/Views/order/macro.volt create mode 100644 app/Http/Admin/Views/order/search.volt create mode 100644 app/Http/Admin/Views/order/show.volt create mode 100644 app/Http/Admin/Views/package/add.volt create mode 100644 app/Http/Admin/Views/package/edit.volt create mode 100644 app/Http/Admin/Views/package/guiding.volt create mode 100644 app/Http/Admin/Views/package/list.volt create mode 100644 app/Http/Admin/Views/page/add.volt create mode 100644 app/Http/Admin/Views/page/edit.volt create mode 100644 app/Http/Admin/Views/page/list.volt create mode 100644 app/Http/Admin/Views/partials/clipboard_tips.volt create mode 100644 app/Http/Admin/Views/partials/cover_uploader.volt create mode 100644 app/Http/Admin/Views/partials/ip2region.volt create mode 100644 app/Http/Admin/Views/partials/layedit.volt create mode 100644 app/Http/Admin/Views/partials/media_preview.volt create mode 100644 app/Http/Admin/Views/partials/media_uploader.volt create mode 100644 app/Http/Admin/Views/partials/pager.volt create mode 100644 app/Http/Admin/Views/public/forbidden.volt create mode 100644 app/Http/Admin/Views/public/ip2region.volt create mode 100644 app/Http/Admin/Views/public/live_player.volt create mode 100644 app/Http/Admin/Views/public/login.volt create mode 100644 app/Http/Admin/Views/public/vod_player.volt create mode 100644 app/Http/Admin/Views/refund/list.volt create mode 100644 app/Http/Admin/Views/refund/macro.volt create mode 100644 app/Http/Admin/Views/refund/search.volt create mode 100644 app/Http/Admin/Views/refund/show.volt create mode 100644 app/Http/Admin/Views/review/edit.volt create mode 100644 app/Http/Admin/Views/review/list.volt create mode 100644 app/Http/Admin/Views/review/search.volt create mode 100644 app/Http/Admin/Views/role/add.volt create mode 100644 app/Http/Admin/Views/role/edit.volt create mode 100644 app/Http/Admin/Views/role/list.volt create mode 100644 app/Http/Admin/Views/slide/add.volt create mode 100644 app/Http/Admin/Views/slide/edit.volt create mode 100644 app/Http/Admin/Views/slide/list.volt create mode 100644 app/Http/Admin/Views/student/add.volt create mode 100644 app/Http/Admin/Views/student/edit.volt create mode 100644 app/Http/Admin/Views/student/learning.volt create mode 100644 app/Http/Admin/Views/student/list.volt create mode 100644 app/Http/Admin/Views/student/search.volt create mode 100644 app/Http/Admin/Views/trade/list.volt create mode 100644 app/Http/Admin/Views/trade/macro.volt create mode 100644 app/Http/Admin/Views/trade/search.volt create mode 100644 app/Http/Admin/Views/trade/show.volt create mode 100644 app/Http/Admin/Views/user/add.volt create mode 100644 app/Http/Admin/Views/user/edit.volt create mode 100644 app/Http/Admin/Views/user/list.volt create mode 100644 app/Http/Admin/Views/user/search.volt create mode 100644 app/Http/Api/Controllers/Controller.php create mode 100644 app/Http/Api/Controllers/IndexController.php create mode 100644 app/Http/Api/Module.php create mode 100644 app/Http/Api/Services/Service.php create mode 100644 app/Http/Home/Controllers/AccountController.php create mode 100644 app/Http/Home/Controllers/CategoryController.php create mode 100644 app/Http/Home/Controllers/ChapterController.php create mode 100644 app/Http/Home/Controllers/CommentController.php create mode 100644 app/Http/Home/Controllers/ConsultController.php create mode 100644 app/Http/Home/Controllers/Controller.php create mode 100644 app/Http/Home/Controllers/CourseController.php create mode 100644 app/Http/Home/Controllers/ErrorController.php create mode 100644 app/Http/Home/Controllers/IndexController.php create mode 100644 app/Http/Home/Controllers/MyController.php create mode 100644 app/Http/Home/Controllers/NotifyController.php create mode 100644 app/Http/Home/Controllers/OrderController.php create mode 100644 app/Http/Home/Controllers/PublicController.php create mode 100644 app/Http/Home/Controllers/ReviewController.php create mode 100644 app/Http/Home/Controllers/SearchController.php create mode 100644 app/Http/Home/Controllers/UserController.php create mode 100644 app/Http/Home/Module.php create mode 100644 app/Http/Home/Services/Account.php create mode 100644 app/Http/Home/Services/Category.php create mode 100644 app/Http/Home/Services/Chapter.php create mode 100644 app/Http/Home/Services/ChapterAdmin.php create mode 100644 app/Http/Home/Services/ChapterContentAdmin.php create mode 100644 app/Http/Home/Services/Comment.php create mode 100644 app/Http/Home/Services/Consult.php create mode 100644 app/Http/Home/Services/Course.php create mode 100644 app/Http/Home/Services/CourseAdmin.php create mode 100644 app/Http/Home/Services/Danmaku.php create mode 100644 app/Http/Home/Services/My.php create mode 100644 app/Http/Home/Services/Order.php create mode 100644 app/Http/Home/Services/Review.php create mode 100644 app/Http/Home/Services/Service.php create mode 100644 app/Http/Home/Views/error/show400.volt create mode 100644 app/Http/Home/Views/error/show401.volt create mode 100644 app/Http/Home/Views/error/show403.volt create mode 100644 app/Http/Home/Views/error/show404.volt create mode 100644 app/Http/Home/Views/error/show500.volt create mode 100644 app/Http/Home/Views/index.volt create mode 100644 app/Http/Home/Views/index/error404.volt create mode 100644 app/Http/Home/Views/index/index.volt create mode 100644 app/Http/Home/Views/index/player.volt create mode 100644 app/Library/Cache/Backend/Redis.php create mode 100644 app/Library/Helper.php create mode 100644 app/Library/Logger.php create mode 100644 app/Library/OAuth.php create mode 100644 app/Library/OAuth/QQ.php create mode 100644 app/Library/OAuth/WeiBo.php create mode 100644 app/Library/OAuth/WeiXin.php create mode 100644 app/Library/Paginator/Adapter/QueryBuilder.php create mode 100644 app/Library/Paginator/Query.php create mode 100644 app/Library/Security.php create mode 100644 app/Library/Util/Password.php create mode 100644 app/Library/Util/Verification.php create mode 100644 app/Library/Util/Word.php create mode 100644 app/Library/Validator/Common.php create mode 100644 app/Library/Validator/IdCard.php create mode 100644 app/Listeners/Listener.php create mode 100644 app/Listeners/Payment.php create mode 100644 app/Listeners/Profiler.php create mode 100644 app/Models/Audit.php create mode 100644 app/Models/Category.php create mode 100644 app/Models/Chapter.php create mode 100644 app/Models/ChapterArticle.php create mode 100644 app/Models/ChapterLive.php create mode 100644 app/Models/ChapterUser.php create mode 100644 app/Models/ChapterVod.php create mode 100644 app/Models/Config.php create mode 100644 app/Models/ContentImage.php create mode 100644 app/Models/Course.php create mode 100644 app/Models/CourseCategory.php create mode 100644 app/Models/CourseFavorite.php create mode 100644 app/Models/CoursePackage.php create mode 100644 app/Models/CourseRelated.php create mode 100644 app/Models/CourseTopic.php create mode 100644 app/Models/CourseUser.php create mode 100644 app/Models/Learning.php create mode 100644 app/Models/Model.php create mode 100644 app/Models/Nav.php create mode 100644 app/Models/Order.php create mode 100644 app/Models/Package.php create mode 100644 app/Models/Page.php create mode 100644 app/Models/Refund.php create mode 100644 app/Models/Review.php create mode 100644 app/Models/Role.php create mode 100644 app/Models/Slide.php create mode 100644 app/Models/Task.php create mode 100644 app/Models/Topic.php create mode 100644 app/Models/Trade.php create mode 100644 app/Models/User.php create mode 100644 app/Providers/AbstractProvider.php create mode 100644 app/Providers/Annotation.php create mode 100644 app/Providers/Cache.php create mode 100644 app/Providers/CliDispatcher.php create mode 100644 app/Providers/Config.php create mode 100644 app/Providers/Cookie.php create mode 100644 app/Providers/Crypt.php create mode 100644 app/Providers/Database.php create mode 100644 app/Providers/Escaper.php create mode 100644 app/Providers/EventsManager.php create mode 100644 app/Providers/Logger.php create mode 100644 app/Providers/MetaData.php create mode 100644 app/Providers/ProviderInterface.php create mode 100644 app/Providers/Redis.php create mode 100644 app/Providers/Router.php create mode 100644 app/Providers/Security.php create mode 100644 app/Providers/Session.php create mode 100644 app/Providers/Url.php create mode 100644 app/Providers/Volt.php create mode 100644 app/Repos/Audit.php create mode 100644 app/Repos/Category.php create mode 100644 app/Repos/Chapter.php create mode 100644 app/Repos/ChapterUser.php create mode 100644 app/Repos/Config.php create mode 100644 app/Repos/Course.php create mode 100644 app/Repos/CourseCategory.php create mode 100644 app/Repos/CourseFavorite.php create mode 100644 app/Repos/CoursePackage.php create mode 100644 app/Repos/CourseRelated.php create mode 100644 app/Repos/CourseUser.php create mode 100644 app/Repos/Learning.php create mode 100644 app/Repos/Nav.php create mode 100644 app/Repos/Order.php create mode 100644 app/Repos/Package.php create mode 100644 app/Repos/Page.php create mode 100644 app/Repos/Refund.php create mode 100644 app/Repos/Repository.php create mode 100644 app/Repos/Review.php create mode 100644 app/Repos/Role.php create mode 100644 app/Repos/Slide.php create mode 100644 app/Repos/Trade.php create mode 100644 app/Repos/User.php create mode 100644 app/Searchers/Course.php create mode 100644 app/Searchers/course.ini create mode 100644 app/Services/Alipay.php create mode 100644 app/Services/Captcha.php create mode 100644 app/Services/Category.php create mode 100644 app/Services/CourseStats.php create mode 100644 app/Services/Learning.php create mode 100644 app/Services/Live.php create mode 100644 app/Services/Mailer.php create mode 100644 app/Services/Order.php create mode 100644 app/Services/Refund.php create mode 100644 app/Services/Service.php create mode 100644 app/Services/Smser.php create mode 100644 app/Services/Storage.php create mode 100644 app/Services/Trade.php create mode 100644 app/Services/VipInfo.php create mode 100644 app/Services/Vod.php create mode 100644 app/Services/Wxpay.php create mode 100644 app/Traits/Ajax.php create mode 100644 app/Traits/Client.php create mode 100644 app/Traits/Security.php create mode 100644 app/Transformers/ChapterList.php create mode 100644 app/Transformers/ChapterUserList.php create mode 100644 app/Transformers/CommentList.php create mode 100644 app/Transformers/CourseFavoriteList.php create mode 100644 app/Transformers/CourseList.php create mode 100644 app/Transformers/CourseUserList.php create mode 100644 app/Transformers/LearningList.php create mode 100644 app/Transformers/OrderList.php create mode 100644 app/Transformers/RefundList.php create mode 100644 app/Transformers/ReviewList.php create mode 100644 app/Transformers/TradeList.php create mode 100644 app/Transformers/Transformer.php create mode 100644 app/Transformers/UserList.php create mode 100644 app/Validators/Category.php create mode 100644 app/Validators/Chapter.php create mode 100644 app/Validators/ChapterArticle.php create mode 100644 app/Validators/ChapterAudio.php create mode 100644 app/Validators/ChapterLive.php create mode 100644 app/Validators/ChapterVod.php create mode 100644 app/Validators/Course.php create mode 100644 app/Validators/CourseQuery.php create mode 100644 app/Validators/CourseUser.php create mode 100644 app/Validators/Nav.php create mode 100644 app/Validators/Order.php create mode 100644 app/Validators/Package.php create mode 100644 app/Validators/Page.php create mode 100644 app/Validators/Refund.php create mode 100644 app/Validators/Review.php create mode 100644 app/Validators/Role.php create mode 100644 app/Validators/Slide.php create mode 100644 app/Validators/Trade.php create mode 100644 app/Validators/User.php create mode 100644 app/Validators/Validator.php create mode 100644 bootstrap/ConsoleErrorHandler.php create mode 100644 bootstrap/ConsoleKernel.php create mode 100644 bootstrap/Helper.php create mode 100644 bootstrap/HttpErrorHandler.php create mode 100644 bootstrap/HttpKernel.php create mode 100644 bootstrap/Kernel.php create mode 100644 common create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 config/config.default.php create mode 100644 config/crossdomain.xml create mode 100644 config/errors.php create mode 100644 config/events.php create mode 100644 console.php create mode 100644 db/migrations/20190616155547_my_test_migration.php create mode 100644 docker/docker-compose.yml create mode 100644 docker/mysql/Dockerfile create mode 100644 docker/mysql/data/.gitignore create mode 100644 docker/mysql/log/.gitignore create mode 100644 docker/nginx/Dockerfile create mode 100644 docker/nginx/conf.d/default.conf create mode 100644 docker/nginx/log/.gitignore create mode 100644 docker/php/Dockerfile create mode 100644 docker/php/log/.gitignore create mode 100644 docker/redis/Dockerfile create mode 100644 docker/redis/data/.gitignore create mode 100644 docker/sources.list create mode 100644 docker/xunsearch/Dockerfile create mode 100644 docker/xunsearch/data/.gitignore create mode 100644 docker/xunsearch/xs-docker.sh create mode 100644 phinx.php create mode 100644 public/.htaccess create mode 100644 public/favicon.ico create mode 100644 public/index.php create mode 100644 public/static/admin/css/style.css create mode 100644 public/static/admin/img/default_cover.png create mode 100644 public/static/admin/img/pay_test_cover.png create mode 100644 public/static/admin/img/vip_cover.png create mode 100644 public/static/admin/js/common.js create mode 100644 public/static/admin/js/index.js create mode 100644 public/static/admin/js/xm-course.js create mode 100644 public/static/lib/clipboard.min.js create mode 100644 public/static/lib/cos-js-sdk-v5.min.js create mode 100644 public/static/lib/jquery.min.js create mode 100644 public/static/lib/jquery.qrcode.min.js create mode 100644 public/static/lib/layui/css/dropdown.css create mode 100644 public/static/lib/layui/css/layui.css create mode 100644 public/static/lib/layui/css/layui.mobile.css create mode 100644 public/static/lib/layui/css/modules/code.css create mode 100644 public/static/lib/layui/css/modules/laydate/default/laydate.css create mode 100644 public/static/lib/layui/css/modules/layer/default/icon-ext.png create mode 100644 public/static/lib/layui/css/modules/layer/default/icon.png create mode 100644 public/static/lib/layui/css/modules/layer/default/layer.css create mode 100644 public/static/lib/layui/css/modules/layer/default/loading-0.gif create mode 100644 public/static/lib/layui/css/modules/layer/default/loading-1.gif create mode 100644 public/static/lib/layui/css/modules/layer/default/loading-2.gif create mode 100644 public/static/lib/layui/extends/dropdown.js create mode 100644 public/static/lib/layui/font/iconfont.eot create mode 100644 public/static/lib/layui/font/iconfont.svg create mode 100644 public/static/lib/layui/font/iconfont.ttf create mode 100644 public/static/lib/layui/font/iconfont.woff create mode 100644 public/static/lib/layui/font/iconfont.woff2 create mode 100644 public/static/lib/layui/images/face/0.gif create mode 100644 public/static/lib/layui/images/face/1.gif create mode 100644 public/static/lib/layui/images/face/10.gif create mode 100644 public/static/lib/layui/images/face/11.gif create mode 100644 public/static/lib/layui/images/face/12.gif create mode 100644 public/static/lib/layui/images/face/13.gif create mode 100644 public/static/lib/layui/images/face/14.gif create mode 100644 public/static/lib/layui/images/face/15.gif create mode 100644 public/static/lib/layui/images/face/16.gif create mode 100644 public/static/lib/layui/images/face/17.gif create mode 100644 public/static/lib/layui/images/face/18.gif create mode 100644 public/static/lib/layui/images/face/19.gif create mode 100644 public/static/lib/layui/images/face/2.gif create mode 100644 public/static/lib/layui/images/face/20.gif create mode 100644 public/static/lib/layui/images/face/21.gif create mode 100644 public/static/lib/layui/images/face/22.gif create mode 100644 public/static/lib/layui/images/face/23.gif create mode 100644 public/static/lib/layui/images/face/24.gif create mode 100644 public/static/lib/layui/images/face/25.gif create mode 100644 public/static/lib/layui/images/face/26.gif create mode 100644 public/static/lib/layui/images/face/27.gif create mode 100644 public/static/lib/layui/images/face/28.gif create mode 100644 public/static/lib/layui/images/face/29.gif create mode 100644 public/static/lib/layui/images/face/3.gif create mode 100644 public/static/lib/layui/images/face/30.gif create mode 100644 public/static/lib/layui/images/face/31.gif create mode 100644 public/static/lib/layui/images/face/32.gif create mode 100644 public/static/lib/layui/images/face/33.gif create mode 100644 public/static/lib/layui/images/face/34.gif create mode 100644 public/static/lib/layui/images/face/35.gif create mode 100644 public/static/lib/layui/images/face/36.gif create mode 100644 public/static/lib/layui/images/face/37.gif create mode 100644 public/static/lib/layui/images/face/38.gif create mode 100644 public/static/lib/layui/images/face/39.gif create mode 100644 public/static/lib/layui/images/face/4.gif create mode 100644 public/static/lib/layui/images/face/40.gif create mode 100644 public/static/lib/layui/images/face/41.gif create mode 100644 public/static/lib/layui/images/face/42.gif create mode 100644 public/static/lib/layui/images/face/43.gif create mode 100644 public/static/lib/layui/images/face/44.gif create mode 100644 public/static/lib/layui/images/face/45.gif create mode 100644 public/static/lib/layui/images/face/46.gif create mode 100644 public/static/lib/layui/images/face/47.gif create mode 100644 public/static/lib/layui/images/face/48.gif create mode 100644 public/static/lib/layui/images/face/49.gif create mode 100644 public/static/lib/layui/images/face/5.gif create mode 100644 public/static/lib/layui/images/face/50.gif create mode 100644 public/static/lib/layui/images/face/51.gif create mode 100644 public/static/lib/layui/images/face/52.gif create mode 100644 public/static/lib/layui/images/face/53.gif create mode 100644 public/static/lib/layui/images/face/54.gif create mode 100644 public/static/lib/layui/images/face/55.gif create mode 100644 public/static/lib/layui/images/face/56.gif create mode 100644 public/static/lib/layui/images/face/57.gif create mode 100644 public/static/lib/layui/images/face/58.gif create mode 100644 public/static/lib/layui/images/face/59.gif create mode 100644 public/static/lib/layui/images/face/6.gif create mode 100644 public/static/lib/layui/images/face/60.gif create mode 100644 public/static/lib/layui/images/face/61.gif create mode 100644 public/static/lib/layui/images/face/62.gif create mode 100644 public/static/lib/layui/images/face/63.gif create mode 100644 public/static/lib/layui/images/face/64.gif create mode 100644 public/static/lib/layui/images/face/65.gif create mode 100644 public/static/lib/layui/images/face/66.gif create mode 100644 public/static/lib/layui/images/face/67.gif create mode 100644 public/static/lib/layui/images/face/68.gif create mode 100644 public/static/lib/layui/images/face/69.gif create mode 100644 public/static/lib/layui/images/face/7.gif create mode 100644 public/static/lib/layui/images/face/70.gif create mode 100644 public/static/lib/layui/images/face/71.gif create mode 100644 public/static/lib/layui/images/face/8.gif create mode 100644 public/static/lib/layui/images/face/9.gif create mode 100644 public/static/lib/layui/lay/modules/carousel.js create mode 100644 public/static/lib/layui/lay/modules/code.js create mode 100644 public/static/lib/layui/lay/modules/colorpicker.js create mode 100644 public/static/lib/layui/lay/modules/element.js create mode 100644 public/static/lib/layui/lay/modules/flow.js create mode 100644 public/static/lib/layui/lay/modules/form.js create mode 100644 public/static/lib/layui/lay/modules/jquery.js create mode 100644 public/static/lib/layui/lay/modules/laydate.js create mode 100644 public/static/lib/layui/lay/modules/layedit.js create mode 100644 public/static/lib/layui/lay/modules/layer.js create mode 100644 public/static/lib/layui/lay/modules/laypage.js create mode 100644 public/static/lib/layui/lay/modules/laytpl.js create mode 100644 public/static/lib/layui/lay/modules/mobile.js create mode 100644 public/static/lib/layui/lay/modules/rate.js create mode 100644 public/static/lib/layui/lay/modules/slider.js create mode 100644 public/static/lib/layui/lay/modules/table.js create mode 100644 public/static/lib/layui/lay/modules/transfer.js create mode 100644 public/static/lib/layui/lay/modules/tree.js create mode 100644 public/static/lib/layui/lay/modules/upload.js create mode 100644 public/static/lib/layui/lay/modules/util.js create mode 100644 public/static/lib/layui/layui.all.js create mode 100644 public/static/lib/layui/layui.js create mode 100644 public/static/lib/simplemde/simplemde.min.css create mode 100644 public/static/lib/simplemde/simplemde.min.js create mode 100644 public/static/lib/vod-js-sdk-v6.min.js create mode 100644 public/static/lib/xm-select.js create mode 100644 scheduler.php create mode 100644 storage/cache/annotations/.gitignore create mode 100644 storage/cache/metadata/.gitignore create mode 100644 storage/cache/volt/.gitignore create mode 100644 storage/log/.gitignore create mode 100644 storage/tmp/.gitignore create mode 100644 websocket/Events.php create mode 100644 websocket/start.php create mode 100644 websocket/start_business_worker.php create mode 100644 websocket/start_gateway.php create mode 100644 websocket/start_register.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..53c083b8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.idea +/config/config.php +/vendor \ No newline at end of file diff --git a/.phalcon/.gitkeep b/.phalcon/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 9f7e125c..00000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# course-tencent-cloud - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) \ No newline at end of file diff --git a/app/Caches/Cache.php b/app/Caches/Cache.php new file mode 100644 index 00000000..ed592a0f --- /dev/null +++ b/app/Caches/Cache.php @@ -0,0 +1,75 @@ +cache = $this->getDI()->get('cache'); + } + + /** + * 获取缓存内容 + * + * @param mixed $params + * @return mixed + */ + public function get($params = null) + { + $key = $this->getKey($params); + $content = $this->cache->get($key); + $lifetime = $this->getLifetime(); + + if (!$content) { + $content = $this->getContent($params); + $this->cache->save($key, $content, $lifetime); + $content = $this->cache->get($key); + } + + return $content; + } + + /** + * 删除缓存内容 + * + * @param mixed $params + */ + public function delete($params = null) + { + $key = $this->getKey($params); + $this->cache->delete($key); + } + + /** + * 获取缓存有效期 + * + * @return integer + */ + abstract protected function getLifetime(); + + /** + * 获取键值 + * + * @param mixed $params + * @return string + */ + abstract protected function getKey($params = null); + + /** + * 获取原始内容 + * + * @param mixed $params + * @return mixed + */ + abstract protected function getContent($params = null); + +} diff --git a/app/Caches/Category.php b/app/Caches/Category.php new file mode 100644 index 00000000..440b38d0 --- /dev/null +++ b/app/Caches/Category.php @@ -0,0 +1,57 @@ +getById($id); + + if (!$result) { + throw new ModelNotFoundException('category.not_found'); + } + + return $result; + } + + public function get($id) + { + $cacheOptions = [ + 'key' => $this->getKey($id), + 'lifetime' => $this->getLifetime(), + ]; + + $result = CategoryModel::query() + ->where('id = :id:', ['id' => $id]) + ->cache($cacheOptions) + ->execute() + ->getFirst(); + + return $result; + } + + public function delete($id) + { + $key = $this->getKey($id); + + $this->modelsCache->delete($key); + } + + public function getKey($id) + { + return "category:{$id}"; + } + + public function getLifetime() + { + return $this->lifetime; + } + +} diff --git a/app/Caches/Config.php b/app/Caches/Config.php new file mode 100644 index 00000000..d5c788ac --- /dev/null +++ b/app/Caches/Config.php @@ -0,0 +1,70 @@ +get(); + + if (!$items) return; + + $result = new \stdClass(); + + foreach ($items as $item) { + if ($item->section == $section) { + $result->{$item->item_key} = $item->item_value; + } + } + + return $result; + } + + /** + * 获取某个配置项的值 + * + * @param string $section + * @param string $key + * @return string|null + */ + public function getItemValue($section, $key) + { + $config = $this->getSectionConfig($section); + + $result = $config->{$key} ?? null; + + return $result; + } + + protected function getLifetime() + { + return $this->lifetime; + } + + protected function getKey($params = null) + { + return 'site_config'; + } + + protected function getContent($params = null) + { + $configRepo = new ConfigRepo(); + + $items = $configRepo->findAll(); + + return $items; + } + +} diff --git a/app/Caches/Course.php b/app/Caches/Course.php new file mode 100644 index 00000000..d02bfa98 --- /dev/null +++ b/app/Caches/Course.php @@ -0,0 +1,57 @@ +getById($id); + + if (!$result) { + throw new ModelNotFoundException('course.not_found'); + } + + return $result; + } + + public function get($id) + { + $cacheOptions = [ + 'key' => $this->getKey($id), + 'lifetime' => $this->getLifetime(), + ]; + + $result = CourseModel::query() + ->where('id = :id:', ['id' => $id]) + ->cache($cacheOptions) + ->execute() + ->getFirst(); + + return $result; + } + + public function delete($id) + { + $key = $this->getKey($id); + + $this->modelsCache->delete($key); + } + + public function getKey($id) + { + return "course:{$id}"; + } + + public function getLifetime() + { + return $this->lifetime; + } + +} diff --git a/app/Caches/Nav.php b/app/Caches/Nav.php new file mode 100644 index 00000000..1754b36f --- /dev/null +++ b/app/Caches/Nav.php @@ -0,0 +1,53 @@ +get(); + + if (!$items) return; + + $result = new \stdClass(); + + foreach ($items as $item) { + if ($item->position == 'top') { + $result->{$item->item_key} = $item->item_value; + } + } + + return $result; + } + + public function getBottomNav() + { + + } + + protected function getLifetime() + { + return $this->lifetime; + } + + protected function getKey($params = null) + { + return 'nav'; + } + + protected function getContent($params = null) + { + $navRepo = new NavRepo(); + + $items = $navRepo->findAll(); + + return $items; + } + +} diff --git a/app/Caches/User.php b/app/Caches/User.php new file mode 100644 index 00000000..5878f544 --- /dev/null +++ b/app/Caches/User.php @@ -0,0 +1,57 @@ +getById($id); + + if (!$result) { + throw new ModelNotFoundException('user.not_found'); + } + + return $result; + } + + public function get($id) + { + $cacheOptions = [ + 'key' => $this->getKey($id), + 'lifetime' => $this->getLifetime(), + ]; + + $result = UserModel::query() + ->where('id = :id:', ['id' => $id]) + ->cache($cacheOptions) + ->execute() + ->getFirst(); + + return $result; + } + + public function delete($id) + { + $key = $this->getKey($id); + + $this->modelsCache->delete($key); + } + + public function getKey($id) + { + return "user:{$id}"; + } + + public function getLifetime() + { + return $this->lifetime; + } + +} diff --git a/app/Console/Tasks/CleanLogTask.php b/app/Console/Tasks/CleanLogTask.php new file mode 100644 index 00000000..651980bf --- /dev/null +++ b/app/Console/Tasks/CleanLogTask.php @@ -0,0 +1,149 @@ +cleanCommonLog(); + $this->cleanConsoleLog(); + $this->cleanSqlLog(); + $this->cleanListenerLog(); + $this->cleanCaptchaLog(); + $this->cleanMailerLog(); + $this->cleanSmserLog(); + $this->cleanVodLog(); + $this->cleanStorageLog(); + $this->cleanAlipayLog(); + $this->cleanWxpayLog(); + $this->cleanRefundLog(); + } + + /** + * 清理通用日志 + */ + protected function cleanCommonLog() + { + $this->cleanLog('common', 7); + } + + /** + * 清理Console日志 + */ + protected function cleanConsoleLog() + { + $this->cleanLog('console', 7); + } + + /** + * 清理SQL日志 + */ + protected function cleanSqlLog() + { + $this->cleanLog('sql', 3); + } + + /** + * 清理监听者日志 + */ + protected function cleanListenerLog() + { + $this->cleanLog('listener', 7); + } + + /** + * 清理验证码服务日志 + */ + protected function cleanCaptchaLog() + { + $this->cleanLog('captcha', 7); + } + + /** + * 清理点播服务日志 + */ + protected function cleanVodLog() + { + $this->cleanLog('vod', 7); + } + + /** + * 清理存储服务日志 + */ + protected function cleanStorageLog() + { + $this->cleanLog('storage', 7); + } + + /** + * 清理短信服务日志 + */ + protected function cleanSmserLog() + { + $this->cleanLog('smser', 7); + } + + /** + * 清理邮件服务日志 + */ + protected function cleanMailerLog() + { + $this->cleanLog('mailer', 7); + } + + /** + * 清理阿里支付服务日志 + */ + protected function cleanAlipayLog() + { + $this->cleanLog('alipay', 30); + } + + /** + * 清理微信支付服务日志 + */ + protected function cleanWxpayLog() + { + $this->cleanLog('wxpay', 30); + } + + /** + * 清理退款日志 + */ + protected function cleanRefundLog() + { + $this->cleanLog('refund', 30); + } + + /** + * 清理日志文件 + * + * @param string $prefix + * @param integer $keepDays 保留天数 + * @return mixed + */ + protected function cleanLog($prefix, $keepDays) + { + $files = glob(log_path() . "/{$prefix}-*.log"); + + if (!$files) return false; + + foreach ($files as $file) { + $date = substr($file, -14, 10); + $today = date('Y-m-d'); + if (strtotime($today) - strtotime($date) >= $keepDays * 86400) { + $deleted = unlink($file); + if ($deleted) { + echo "Delete {$file} success" . PHP_EOL; + } else { + echo "Delete {$file} failed" . PHP_EOL; + } + } + } + } + +} diff --git a/app/Console/Tasks/CloseOrderTask.php b/app/Console/Tasks/CloseOrderTask.php new file mode 100644 index 00000000..711a2b4b --- /dev/null +++ b/app/Console/Tasks/CloseOrderTask.php @@ -0,0 +1,46 @@ +findOrders(); + + if ($orders->count() == 0) { + return; + } + + foreach ($orders as $order) { + $order->status = OrderModel::STATUS_CLOSED; + $order->update(); + } + } + + /** + * 查找待关闭订单 + * + * @param integer $limit + * @return \Phalcon\Mvc\Model\ResultsetInterface + */ + protected function findOrders($limit = 1000) + { + $status = OrderModel::STATUS_PENDING; + + $createdAt = time() - 12 * 3600; + + $orders = OrderModel::query() + ->where('status = :status:', ['status' => $status]) + ->andWhere('created_at < :created_at:', ['created_at' => $createdAt]) + ->limit($limit) + ->execute(); + + return $orders; + } + +} diff --git a/app/Console/Tasks/CloseTradeTask.php b/app/Console/Tasks/CloseTradeTask.php new file mode 100644 index 00000000..f87cda90 --- /dev/null +++ b/app/Console/Tasks/CloseTradeTask.php @@ -0,0 +1,94 @@ +findTrades(); + + if ($trades->count() == 0) { + return; + } + + foreach ($trades as $trade) { + if ($trade->channel == TradeModel::CHANNEL_ALIPAY) { + $this->closeAlipayTrade($trade); + } elseif ($trade->channel == TradeModel::CHANNEL_WXPAY) { + $this->closeWxpayTrade($trade); + } + } + } + + /** + * 关闭支付宝交易 + * + * @param TradeModel $trade + */ + protected function closeAlipayTrade($trade) + { + $service = new AlipayService(); + + $alyOrder = $service->findOrder($trade->sn); + + if ($alyOrder) { + if ($alyOrder->trade_status == 'WAIT_BUYER_PAY') { + $service->closeOrder($trade->sn); + } + } + + $trade->status = TradeModel::STATUS_CLOSED; + + $trade->update(); + } + + /** + * 关闭微信交易 + * + * @param TradeModel $trade + */ + protected function closeWxpayTrade($trade) + { + $service = new WxpayService(); + + $wxOrder = $service->findOrder($trade->sn); + + if ($wxOrder) { + if ($wxOrder->trade_state == 'NOTPAY') { + $service->closeOrder($trade->sn); + } + } + + $trade->status = TradeModel::STATUS_CLOSED; + + $trade->update(); + } + + /** + * 查找待关闭交易 + * + * @param integer $limit + * @return \Phalcon\Mvc\Model\ResultsetInterface + */ + protected function findTrades($limit = 5) + { + $status = TradeModel::STATUS_PENDING; + + $createdAt = time() - 15 * 60; + + $trades = TradeModel::query() + ->where('status = :status:', ['status' => $status]) + ->andWhere('created_at < :created_at:', ['created_at' => $createdAt]) + ->limit($limit) + ->execute(); + + return $trades; + } + +} diff --git a/app/Console/Tasks/CourseCountTask.php b/app/Console/Tasks/CourseCountTask.php new file mode 100644 index 00000000..f522cdc3 --- /dev/null +++ b/app/Console/Tasks/CourseCountTask.php @@ -0,0 +1,44 @@ +findAll(['level' => 2, 'deleted' => 0]); + + foreach ($subCategories as $category) { + + $courseCount = $repo->countCourses($category->id); + $category->course_count = $courseCount; + $category->update(); + + $parentId = $category->parent_id; + + if (isset($mapping[$parentId])) { + $mapping[$parentId] += $courseCount; + } else { + $mapping[$parentId] = $courseCount; + } + } + + $topCategories = $repo->findAll(['level' => 1, 'deleted' => 0]); + + foreach ($topCategories as $category) { + if (isset($mapping[$category->id])) { + $category->course_count = $mapping[$category->id]; + $category->update(); + } + } + } + +} diff --git a/app/Console/Tasks/ImageSyncTask.php b/app/Console/Tasks/ImageSyncTask.php new file mode 100644 index 00000000..8aac31b0 --- /dev/null +++ b/app/Console/Tasks/ImageSyncTask.php @@ -0,0 +1,50 @@ +where('id = 42') + ->execute(); + + $storage = new Storage(); + + foreach ($courses as $course) { + $cover = $course->cover; + if (Text::startsWith($cover, '//')) { + $cover = 'http:' . $cover; + } + $url = str_replace('-240-135', '', $cover); + + $fileName = parse_url($url, PHP_URL_PATH); + $filePath = tmp_path() . $fileName; + $content = file_get_contents($url); + file_put_contents($filePath, $content); + $keyName = $this->getKeyName($filePath); + $remoteUrl = $storage->putFile($keyName, $filePath); + if ($remoteUrl) { + $course->cover = $keyName; + $course->update(); + echo "upload cover of course {$course->id} success" . PHP_EOL; + } else { + echo "upload cover of course {$course->id} failed" . PHP_EOL; + } + } + } + + protected function getKeyName($filePath) + { + $ext = pathinfo($filePath, PATHINFO_EXTENSION); + return '/img/cover/' . date('YmdHis') . rand(1000, 9999) . '.' . $ext; + } + +} diff --git a/app/Console/Tasks/LearningTask.php b/app/Console/Tasks/LearningTask.php new file mode 100644 index 00000000..ce874343 --- /dev/null +++ b/app/Console/Tasks/LearningTask.php @@ -0,0 +1,139 @@ +cache = $this->getDI()->get('cache'); + + $keys = $this->cache->queryKeys('learning:'); + + if (empty($keys)) return; + + $keys = array_slice($keys, 0, 500); + + $prefix = $this->cache->getPrefix(); + + foreach ($keys as $key) { + /** + * 去掉前缀,避免重复加前缀导致找不到缓存 + */ + if ($prefix) { + $key = str_replace($prefix, '', $key); + } + $this->handleLearning($key); + } + } + + protected function handleLearning($key) + { + $content = $this->cache->get($key); + + if (empty($content->user_id)) { + return false; + } + + if (!empty($content->client_ip)) { + $region = kg_ip2region($content->client_ip); + $content->country = $region->country; + $content->province = $region->province; + $content->city = $region->city; + } + + $learningRepo = new LearningRepo(); + + $learning = $learningRepo->findByRequestId($content->request_id); + + if (!$learning) { + $learning = new LearningModel(); + $data = kg_object_array($content); + $learning->create($data); + } else { + $learning->duration += $content->duration; + $learning->update(); + } + + $this->updateChapterUser($content->chapter_id, $content->user_id, $content->duration, $content->position); + $this->updateCourseUser($content->course_id, $content->user_id, $content->duration); + + $this->cache->delete($key); + } + + protected function updateChapterUser($chapterId, $userId, $duration = 0, $position = 0) + { + $chapterUserRepo = new ChapterUserRepo(); + + $chapterUser = $chapterUserRepo->findChapterUser($chapterId, $userId); + + if (!$chapterUser) return false; + + $chapterRepo = new ChapterRepo(); + + $chapter = $chapterRepo->findById($chapterId); + + if (!$chapter) return false; + + $chapter->duration = $chapter->attrs['duration'] ?: 0; + + $chapterUser->duration += $duration; + $chapterUser->position = floor($position); + + /** + * 观看时长超过视频时长80%标记完成学习 + */ + if ($chapterUser->duration > $chapter->duration * 0.8) { + if ($chapterUser->finished == 0) { + $chapterUser->finished = 1; + $this->updateCourseProgress($chapterUser->course_id, $chapterUser->user_id); + } + } + + $chapterUser->update(); + } + + protected function updateCourseUser($courseId, $userId, $duration) + { + $courseUserRepo = new CourseUserRepo(); + + $courseUser = $courseUserRepo->findCourseUser($courseId, $userId); + + if ($courseUser) { + $courseUser->duration += $duration; + $courseUser->update(); + } + } + + protected function updateCourseProgress($courseId, $userId) + { + $courseUserRepo = new CourseUserRepo(); + + $courseUser = $courseUserRepo->findCourseUser($courseId, $userId); + + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($courseId); + + if ($courseUser) { + $count = $courseUserRepo->countFinishedChapters($courseId, $userId); + $courseUser->progress = intval(100 * $count / $course->lesson_count); + $courseUser->update(); + } + } + +} diff --git a/app/Console/Tasks/MainTask.php b/app/Console/Tasks/MainTask.php new file mode 100644 index 00000000..6523cfe8 --- /dev/null +++ b/app/Console/Tasks/MainTask.php @@ -0,0 +1,24 @@ +duration = 123; + + echo $chapter->duration; + } + +} diff --git a/app/Console/Tasks/MaintainTask.php b/app/Console/Tasks/MaintainTask.php new file mode 100644 index 00000000..ec641854 --- /dev/null +++ b/app/Console/Tasks/MaintainTask.php @@ -0,0 +1,37 @@ +getLogger('refund'); + + $tasks = $this->findTasks(); + + if ($tasks->count() == 0) { + return; + } + + $tradeRepo = new TradeRepo(); + $orderRepo = new OrderRepo(); + $refundRepo = new RefundRepo(); + + foreach ($tasks as $task) { + + $refund = $refundRepo->findBySn($task->item_info['refund']['sn']); + $trade = $tradeRepo->findBySn($task->item_info['refund']['trade_sn']); + $order = $orderRepo->findBySn($task->item_info['refund']['order_sn']); + + try { + + $this->db->begin(); + + $this->handleTradeRefund($trade, $refund); + $this->handleOrderRefund($order); + + $refund->status = RefundModel::STATUS_FINISHED; + + if ($refund->update() === false) { + throw new \RuntimeException('Update Refund Status Failed'); + } + + $trade->status = TradeModel::STATUS_REFUNDED; + + if ($trade->update() === false) { + throw new \RuntimeException('Update Trade Status Failed'); + } + + $order->status = OrderModel::STATUS_REFUNDED; + + if ($order->update() === false) { + throw new \RuntimeException('Update Order Status Failed'); + } + + $task->status = TaskModel::STATUS_FINISHED; + + if ($task->update() === false) { + throw new \RuntimeException('Update Task Status Failed'); + } + + $this->db->commit(); + + } catch (\Exception $e) { + + $this->db->rollback(); + + $task->try_count += 1; + + if ($task->try_count > self::TRY_COUNT) { + $task->status = TaskModel::STATUS_FAILED; + $refund->status = RefundModel::STATUS_FAILED; + $refund->update(); + } + + $task->update(); + + $logger->info('Refund Task Exception ' . kg_json_encode([ + 'message' => $e->getMessage(), + 'task' => $task->toArray(), + ])); + } + } + } + + /** + * 处理交易退款 + * + * @param TradeModel $trade + * @param RefundModel $refund + */ + protected function handleTradeRefund(TradeModel $trade, RefundModel $refund) + { + $response = false; + + if ($trade->channel == TradeModel::CHANNEL_ALIPAY) { + $alipay = new AlipayService(); + $response = $alipay->refundOrder([ + 'out_trade_no' => $trade->sn, + 'out_request_no' => $refund->sn, + 'refund_amount' => $refund->amount, + ]); + } elseif ($trade->channel == TradeModel::CHANNEL_WXPAY) { + $wxpay = new WxpayService(); + $response = $wxpay->refundOrder([ + 'out_trade_no' => $trade->sn, + 'out_refund_no' => $refund->sn, + 'total_fee' => 100 * $trade->order_amount, + 'refund_fee' => 100 * $refund->amount, + ]); + } + + if (!$response) { + throw new \RuntimeException('Payment Refund Failed'); + } + } + + /** + * 处理订单退款 + * + * @param OrderModel $order + */ + protected function handleOrderRefund(OrderModel $order) + { + switch ($order->item_type) { + case OrderModel::TYPE_COURSE: + $this->handleCourseOrderRefund($order); + break; + case OrderModel::TYPE_PACKAGE: + $this->handlePackageOrderRefund($order); + break; + case OrderModel::TYPE_REWARD: + $this->handleRewardOrderRefund($order); + break; + case OrderModel::TYPE_VIP: + $this->handleVipOrderRefund($order); + break; + case OrderModel::TYPE_TEST: + $this->handleTestOrderRefund($order); + break; + } + } + + /** + * 处理课程订单退款 + * + * @param OrderModel $order + */ + protected function handleCourseOrderRefund(OrderModel $order) + { + $courseUserRepo = new CourseUserRepo(); + + $courseUser = $courseUserRepo->findCourseStudent($order->item_id, $order->user_id); + + if ($courseUser) { + $courseUser->deleted = 1; + if ($courseUser->update() === false) { + throw new \RuntimeException('Delete Course User Failed'); + } + } + } + + /** + * 处理套餐订单退款 + * + * @param OrderModel $order + */ + protected function handlePackageOrderRefund(OrderModel $order) + { + $courseUserRepo = new CourseUserRepo(); + + foreach ($order->item_info['courses'] as $course) { + $courseUser = $courseUserRepo->findCourseStudent($course['id'], $order->user_id); + if ($courseUser) { + $courseUser->deleted = 1; + if ($courseUser->update() === false) { + throw new \RuntimeException('Delete Course User Failed'); + } + } + } + } + + /** + * 处理会员订单退款 + * + * @param OrderModel $order + */ + protected function handleVipOrderRefund(OrderModel $order) + { + $userRepo = new UserRepo(); + + $user = $userRepo->findById($order->user_id); + + $baseTime = $user->vip_expiry; + + switch ($order->item_info['vip']['duration']) { + case 'one_month': + $user->vip_expiry = strtotime('-1 months', $baseTime); + break; + case 'three_month': + $user->vip_expiry = strtotime('-3 months', $baseTime); + break; + case 'six_month': + $user->vip_expiry = strtotime('-6 months', $baseTime); + break; + case 'twelve_month': + $user->vip_expiry = strtotime('-12 months', $baseTime); + break; + } + + if ($user->vip_expiry < time()) { + $user->vip = 0; + } + + if ($user->update() === false) { + throw new \RuntimeException('Update User Vip Failed'); + } + } + + /** + * 处理打赏订单退款 + * + * @param OrderModel $order + */ + protected function handleRewardOrderRefund(OrderModel $order) + { + + } + + /** + * 处理测试订单退款 + * + * @param OrderModel $order + */ + protected function handleTestOrderRefund(OrderModel $order) + { + + } + + /** + * 查找退款任务 + * + * @param integer $limit + * @return \Phalcon\Mvc\Model\ResultsetInterface + */ + protected function findTasks($limit = 5) + { + $itemType = TaskModel::TYPE_REFUND; + $status = TaskModel::STATUS_PENDING; + $tryCount = self::TRY_COUNT; + + $tasks = TaskModel::query() + ->where('item_type = :item_type:', ['item_type' => $itemType]) + ->andWhere('status = :status:', ['status' => $status]) + ->andWhere('try_count < :try_count:', ['try_count' => $tryCount]) + ->orderBy('priority ASC,try_count DESC') + ->limit($limit) + ->execute(); + + return $tasks; + } + +} diff --git a/app/Console/Tasks/SpiderTask.php b/app/Console/Tasks/SpiderTask.php new file mode 100644 index 00000000..ac1f67ee --- /dev/null +++ b/app/Console/Tasks/SpiderTask.php @@ -0,0 +1,282 @@ +getCategoryId($category); + + if (empty($categoryId)) { + throw new \Exception('invalid category'); + } + + $url = "http://www.imooc.com/course/list?c={$category}&page={$page}"; + + $data = QueryList::get($url)->rules([ + 'link' => ['a.course-card', 'href'], + 'title' => ['h3.course-card-name', 'text'], + 'cover' => ['img.course-banner', 'data-original'], + 'summary' => ['p.course-card-desc', 'text'], + 'level' => ['.course-card-info>span:even', 'text'], + 'user_count' => ['.course-card-info>span:odd', 'text'], + ])->query()->getData(); + + if ($data->count() == 0) { + return false; + } + + foreach ($data->all() as $item) { + $course = [ + 'id' => substr($item['link'], 7), + 'category_id' => $categoryId, + 'title' => $item['title'], + 'cover' => $item['cover'], + 'summary' => $item['summary'], + 'user_count' => $item['user_count'], + 'level' => $this->getLevel($item['level']), + ]; + $model = new CourseModel(); + $model->save($course); + } + + echo sprintf("saved: %d course", $data->count()); + } + + public function courseAction() + { + $courses = CourseModel::query() + ->where('1 = 1') + ->andWhere('id > :id:', ['id' => 1128]) + ->orderBy('id asc') + ->execute(); + + $baseUrl = 'http://www.imooc.com/learn'; + + $instance = QueryList::getInstance(); + + foreach ($courses as $course) { + $url = $baseUrl . '/' . $course->id; + $ql = $instance->get($url); + $result = $this->handleCourseInfo($course, $ql); + if (!$result) { + continue; + } + $this->handleCourseChapters($course, $ql); + echo "finished course " . $course->id . PHP_EOL; + sleep(1); + } + } + + public function teacherAction() + { + $courses = CourseModel::query() + ->where('1 = 1') + ->groupBy('user_id') + ->execute(); + + foreach ($courses as $course) { + $this->handleTeacherInfo($course->user_id); + echo "finished teacher: {$course->user_id}" . PHP_EOL; + sleep(1); + } + } + + public function userAction() + { + $users = UserModel::query() + ->where('1 = 1') + ->andWhere('name = :name:', ['name' => '']) + ->execute(); + + foreach ($users as $user) { + $this->handleUserInfo($user->id); + echo "finished user: {$user->id}" . PHP_EOL; + sleep(1); + } + } + + protected function handleUserInfo($id) + { + $url = 'http://www.imooc.com/u/'. $id; + + $ql = QueryList::getInstance()->get($url); + + $data = []; + + $data['id'] = $id; + $data['avatar'] = $ql->find('.user-pic-bg>img')->attr('src'); + $data['name'] = $ql->find('h3.user-name>span')->text(); + $data['about'] = $ql->find('p.user-desc')->text(); + + $user = new UserModel(); + + $user->save($data); + } + + protected function handleTeacherInfo($id) + { + $url = 'http://www.imooc.com/t/'. $id; + + $ql = QueryList::getInstance()->get($url); + + $data = []; + + $data['id'] = $id; + $data['avatar'] = $ql->find('img.tea-header')->attr('src'); + $data['name'] = $ql->find('p.tea-nickname')->text(); + $data['title'] = $ql->find('p.tea-professional')->text(); + $data['about'] = $ql->find('p.tea-desc')->text(); + + $user = new UserModel(); + + $user->create($data); + } + + protected function handleCourseInfo(CourseModel $course, QueryList $ql) + { + $data = []; + + $data['user_id'] = $ql->find('img.js-usercard-dialog')->attr('data-userid'); + $data['description'] = $ql->find('.course-description')->text(); + $data['duration'] = $ql->find('.static-item:eq(1)>.meta-value')->text(); + $data['score'] = $ql->find('.score-btn>.meta-value')->text(); + + if (empty($data['user_id'])) { + return false; + } + + $data['duration'] = $this->getCourseDuration($data['duration']); + + return $course->update($data); + } + + protected function handleCourseChapters(CourseModel $course, QueryList $ql) + { + $topChapters = $ql->rules([ + 'title' => ['.chapter>h3', 'text'], + 'sub_chapter_html' => ['.chapter>.video', 'html'], + ])->query()->getData(); + + if ($topChapters->count() == 0) { + return false; + } + + foreach ($topChapters->all() as $item) { + $data = [ + 'course_id' => $course->id, + 'title' => $item['title'], + ]; + + // create top chapter + $chapter = new ChapterModel(); + $chapter->create($data); + + // create sub chapter + if (!empty($item['sub_chapter_html'])) { + $this->handleSubChapters($chapter, $item['sub_chapter_html']); + } + } + } + + protected function handleSubChapters(ChapterModel $topChapter, $subChapterHtml) + { + $ql = QueryList::html($subChapterHtml); + + $chapters = $ql->find('li')->texts(); + + if ($chapters->count() == 0) { + return false; + } + + foreach ($chapters->all() as $item) { + preg_match('/(\d{1,}-\d{1,})\s{1,}(.*?)\((.*?)\)/s', $item, $matches); + if (!isset($matches[3]) || empty($matches[3])) { + continue; + } + $data = [ + 'course_id' => $topChapter->course_id, + 'parent_id' => $topChapter->id, + 'title' => $matches[2], + 'duration' => $this->getChapterDuration($matches[3]), + ]; + $model = new ChapterModel(); + $model->create($data); + } + } + + protected function getCourseDuration($duration) + { + $hours = 0; + $minutes = 0; + + if (preg_match('/(.*?)小时(.*?)分/s', $duration, $matches)) { + $hours = trim($matches[1]); + $minutes = trim($matches[2]); + } elseif (preg_match('/(.*?)分/s', $duration, $matches)) { + $minutes = trim($matches[1]); + } + + return 3600 * $hours + 60 * $minutes; + } + + protected function getChapterDuration($duration) + { + if (strpos($duration, ':') === false) { + return 0; + } + + list($minutes, $seconds) = explode(':', trim($duration)); + + return 60 * $minutes + $seconds; + } + + protected function getLevel($type) + { + $mapping = [ + '入门' => CourseModel::LEVEL_ENTRY, + '初级' => CourseModel::LEVEL_JUNIOR, + '中级' => CourseModel::LEVEL_MIDDLE, + '高级' => CourseModel::LEVEL_SENIOR, + ]; + + return $mapping[$type] ?? CourseModel::LEVEL_ENTRY; + } + + protected function getCategoryId($type) + { + $mapping = [ + 'html' => 1, 'javascript' => 2, 'vuejs' => 10, 'reactjs' => 19, + 'angular' => 18, 'nodejs' => 16, 'jquery' => 15, + 'bootstrap' => 17, 'sassless' => 21, 'webapp' => 22, 'fetool' => 23, + 'html5' => 13, 'css3' => 14, + 'php' => 24, 'java' => 25, 'python' => 26, 'c' => 27, 'cplusplus' => 28, 'ruby' => 29, 'go' => 30, 'csharp' => 31, + 'android' => 32, 'ios' => 33, + 'mysql' => 36, 'mongodb' => 37, 'redis' => 38, 'oracle' => 39, 'pgsql' => 40, + 'cloudcomputing' => 42, 'bigdata' => 43, + 'unity3d' => 34, 'cocos2dx' => 35, + 'dxdh' => 46, 'uitool' => 47, 'uijc' => 48, + ]; + + return $mapping[$type] ?? 0; + } + +} diff --git a/app/Console/Tasks/Task.php b/app/Console/Tasks/Task.php new file mode 100644 index 00000000..dc875cd1 --- /dev/null +++ b/app/Console/Tasks/Task.php @@ -0,0 +1,17 @@ +getInstance($channel); + } + +} diff --git a/app/Console/Tasks/UnlockUserTask.php b/app/Console/Tasks/UnlockUserTask.php new file mode 100644 index 00000000..e1319a0a --- /dev/null +++ b/app/Console/Tasks/UnlockUserTask.php @@ -0,0 +1,45 @@ +findUsers(); + + if ($users->count() == 0) { + return; + } + + foreach ($users as $user) { + $user->locked = 0; + $user->locked_expiry = 0; + $user->update(); + } + } + + /** + * 查找待解锁用户 + * + * @param integer $limit + * @return \Phalcon\Mvc\Model\ResultsetInterface + */ + protected function findUsers($limit = 1000) + { + $time = time() - 6 * 3600; + + $users = UserModel::query() + ->where('locked = 1') + ->andWhere('locked_expiry < :time:', ['time' => $time]) + ->limit($limit) + ->execute(); + + return $users; + } + +} diff --git a/app/Console/Tasks/VodEventTask.php b/app/Console/Tasks/VodEventTask.php new file mode 100644 index 00000000..b0514f60 --- /dev/null +++ b/app/Console/Tasks/VodEventTask.php @@ -0,0 +1,157 @@ +pullEvents(); + + if (!$events) { + return; + } + + $handles = []; + + $count = 0; + + foreach ($events as $event) { + $handles[] = $event['EventHandle']; + if ($event['EventType'] == 'NewFileUpload') { + $this->handleNewFileUploadEvent($event); + } elseif ($event['EventType'] == 'ProcedureStateChanged') { + $this->handleProcedureStateChangedEvent($event); + } + $count++; + if ($count >= 12) { + break; + } + } + + $this->confirmEvents($handles); + } + + protected function handleNewFileUploadEvent($event) + { + $fileId = $event['FileUploadEvent']['FileId']; + $format = $event['FileUploadEvent']['MediaBasicInfo']['Type']; + $duration = $event['FileUploadEvent']['MetaData']['Duration']; + + $chapterRepo = new ChapterRepo(); + + $chapter = $chapterRepo->findByFileId($fileId); + + if (!$chapter) { + return; + } + + $vodService = new VodService(); + + if ($this->isAudioFile($format)) { + $vodService->createTransAudioTask($fileId); + } else { + $vodService->createTransVideoTask($fileId); + } + + /** + * @var \stdClass $attrs + */ + $attrs = $chapter->attrs; + $attrs->file_status = ChapterModel::FS_TRANSLATING; + $attrs->duration = $duration; + $chapter->update(['attrs' => $attrs]); + + $this->updateCourseDuration($chapter->course_id); + } + + protected function handleProcedureStateChangedEvent($event) + { + $fileId = $event['ProcedureStateChangeEvent']['FileId']; + $processResult = $event['ProcedureStateChangeEvent']['MediaProcessResultSet']; + + $chapterRepo = new ChapterRepo(); + + $chapter = $chapterRepo->findByFileId($fileId); + + if (!$chapter) { + return; + } + + $failCount = $successCount = 0; + + foreach ($processResult as $item) { + if ($item['Type'] == 'Transcode') { + if ($item['TranscodeTask']['Status'] == 'SUCCESS') { + $successCount++; + } elseif ($item['TranscodeTask']['Status'] == 'FAIL') { + $failCount++; + } + } + } + + $status = ChapterModel::FS_TRANSLATING; + + /** + * 当有一个成功标记为成功 + */ + if ($successCount > 0) { + $status = ChapterModel::FS_TRANSLATED; + } elseif ($failCount > 0) { + $status = ChapterModel::FS_FAILED; + } + + if ($status == ChapterModel::FS_TRANSLATING) { + return; + } + + /** + * @var \stdClass $attrs + */ + $attrs = $chapter->attrs; + $attrs->file_status = $status; + $chapter->update(['attrs' => $attrs]); + } + + protected function pullEvents() + { + $vodService = new VodService(); + + $result = $vodService->pullEvents(); + + return $result; + } + + protected function confirmEvents($handles) + { + $vodService = new VodService(); + + $result = $vodService->confirmEvents($handles); + + return $result; + } + + protected function isAudioFile($format) + { + $formats = ['mp3', 'm4a', 'wav', 'flac', 'ogg']; + + $result = in_array(strtolower($format), $formats); + + return $result; + } + + protected function updateCourseDuration($courseId) + { + $courseStats = new CourseStatsService(); + + $courseStats->updateVodDuration($courseId); + } + +} diff --git a/app/Exceptions/BadRequest.php b/app/Exceptions/BadRequest.php new file mode 100644 index 00000000..cf863209 --- /dev/null +++ b/app/Exceptions/BadRequest.php @@ -0,0 +1,8 @@ +getAudits(); + + $this->view->setVar('pager', $pager); + } + + /** + * @Get("/{id}/show", name="admin.audit.show") + */ + public function showAction($id) + { + $auditService = new AuditService(); + + $audit = $auditService->getAudit($id); + + $this->view->setVar('audit', $audit); + } + +} diff --git a/app/Http/Admin/Controllers/CategoryController.php b/app/Http/Admin/Controllers/CategoryController.php new file mode 100644 index 00000000..8e0482dc --- /dev/null +++ b/app/Http/Admin/Controllers/CategoryController.php @@ -0,0 +1,140 @@ +request->get('parent_id', 'int', 0); + + $service = new CategoryService(); + + $parent = $service->getParentCategory($parentId); + $categories = $service->getChildCategories($parentId); + + $this->view->setVar('parent', $parent); + $this->view->setVar('categories', $categories); + } + + /** + * @Get("/add", name="admin.category.add") + */ + public function addAction() + { + $parentId = $this->request->get('parent_id', 'int', 0); + + $service = new CategoryService(); + + $topCategories = $service->getTopCategories(); + + $this->view->setVar('parent_id', $parentId); + $this->view->setVar('top_categories', $topCategories); + } + + /** + * @Post("/create", name="admin.category.create") + */ + public function createAction() + { + $service = new CategoryService(); + + $category = $service->createCategory(); + + $location = $this->url->get( + ['for' => 'admin.category.list'], + ['parent_id' => $category->parent_id] + ); + + $content = [ + 'location' => $location, + 'msg' => '创建分类成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/{id}/edit", name="admin.category.edit") + */ + public function editAction($id) + { + $service = new CategoryService(); + + $category = $service->getCategory($id); + + $this->view->setVar('category', $category); + } + + /** + * @Post("/{id}/update", name="admin.category.update") + */ + public function updateAction($id) + { + $service = new CategoryService(); + + $category = $service->getCategory($id); + + $service->updateCategory($id); + + $location = $this->url->get( + ['for' => 'admin.category.list'], + ['parent_id' => $category->parent_id] + ); + + $content = [ + 'location' => $location, + 'msg' => '更新分类成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/delete", name="admin.category.delete") + */ + public function deleteAction($id) + { + $service = new CategoryService(); + + $service->deleteCategory($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '删除分类成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/restore", name="admin.category.restore") + */ + public function restoreAction($id) + { + $service = new CategoryService(); + + $service->restoreCategory($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '还原分类成功', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/ChapterController.php b/app/Http/Admin/Controllers/ChapterController.php new file mode 100644 index 00000000..1279cb1f --- /dev/null +++ b/app/Http/Admin/Controllers/ChapterController.php @@ -0,0 +1,215 @@ +getChapter($id); + $course = $courseService->getCourse($chapter->course_id); + $lessons = $chapterService->getLessons($chapter->id); + + $this->view->setVar('lessons', $lessons); + $this->view->setVar('chapter', $chapter); + $this->view->setVar('course', $course); + } + + /** + * @Get("/add", name="admin.chapter.add") + */ + public function addAction() + { + $courseId = $this->request->getQuery('course_id'); + $parentId = $this->request->getQuery('parent_id'); + $type = $this->request->getQuery('type'); + + $chapterService = new ChapterService(); + + $course = $chapterService->getCourse($courseId); + $courseChapters = $chapterService->getCourseChapters($courseId); + + $this->view->setVar('course', $course); + $this->view->setVar('parent_id', $parentId); + $this->view->setVar('course_chapters', $courseChapters); + + if ($type == 'chapter') { + $this->view->pick('chapter/add_chapter'); + } else { + $this->view->pick('chapter/add_lesson'); + } + } + + /** + * @Post("/create", name="admin.chapter.create") + */ + public function createAction() + { + $service = new ChapterService(); + + $chapter = $service->createChapter(); + + $location = $this->url->get([ + 'for' => 'admin.course.chapters', + 'id' => $chapter->course_id, + ]); + + $content = [ + 'location' => $location, + 'msg' => '创建章节成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/{id}/edit", name="admin.chapter.edit") + */ + public function editAction($id) + { + $contentService = new ChapterContentService(); + $chapterService = new ChapterService(); + $configService = new ConfigService(); + + $chapter = $chapterService->getChapter($id); + $course = $chapterService->getCourse($chapter->course_id); + $storage = $configService->getSectionConfig('storage'); + + switch ($course->model) { + case CourseModel::MODEL_VOD: + $vod = $contentService->getChapterVod($chapter->id); + $translatedFiles = $contentService->getTranslatedFiles($vod->file_id); + $this->view->setVar('vod', $vod); + $this->view->setVar('translated_files', $translatedFiles); + break; + case CourseModel::MODEL_LIVE: + $live = $contentService->getChapterLive($chapter->id); + $this->view->setVar('live', $live); + break; + case CourseModel::MODEL_ARTICLE: + $article = $contentService->getChapterArticle($chapter->id); + $this->view->setVar('article', $article); + break; + } + + $this->view->setVar('storage', $storage); + $this->view->setVar('chapter', $chapter); + $this->view->setVar('course', $course); + + if ($chapter->parent_id > 0) { + $this->view->pick('chapter/edit_lesson'); + } else { + $this->view->pick('chapter/edit_chapter'); + } + } + + /** + * @Post("/{id}/update", name="admin.chapter.update") + */ + public function updateAction($id) + { + $service = new ChapterService(); + + $chapter = $service->updateChapter($id); + + if ($chapter->parent_id > 0) { + $location = $this->url->get([ + 'for' => 'admin.chapter.lessons', + 'id' => $chapter->parent_id, + ]); + } else { + $location = $this->url->get([ + 'for' => 'admin.course.chapters', + 'id' => $chapter->course_id, + ]); + } + + $content = [ + 'location' => $location, + 'msg' => '更新章节成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/delete", name="admin.chapter.delete") + */ + public function deleteAction($id) + { + $service = new ChapterService(); + + $service->deleteChapter($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '删除章节成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/restore", name="admin.chapter.restore") + */ + public function restoreAction($id) + { + $service = new ChapterService(); + + $service->restoreChapter($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '删除章节成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/content", name="admin.chapter.content") + */ + public function contentAction($id) + { + $contentService = new ChapterContentService(); + + $contentService->updateChapterContent($id); + + $chapterService = new ChapterService(); + + $chapter = $chapterService->getChapter($id); + + $location = $this->url->get([ + 'for' => 'admin.chapter.lessons', + 'id' => $chapter->parent_id, + ]); + + $content = [ + 'location' => $location, + 'msg' => '更新课时内容成功', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/ConfigController.php b/app/Http/Admin/Controllers/ConfigController.php new file mode 100644 index 00000000..91d338ab --- /dev/null +++ b/app/Http/Admin/Controllers/ConfigController.php @@ -0,0 +1,275 @@ +request->isPost()) { + + $data = $this->request->getPost(); + + $service->updateSectionConfig($section, $data); + + return $this->ajaxSuccess(['msg' => '更新配置成功']); + + } else { + + $website = $service->getSectionConfig($section); + + $this->view->setVar('website', $website); + } + } + + /** + * @Route("/secret", name="admin.config.secret") + */ + public function secretAction() + { + $section = 'secret'; + + $service = new ConfigService(); + + if ($this->request->isPost()) { + + $data = $this->request->getPost(); + + $service->updateStorageConfig($section, $data); + + return $this->ajaxSuccess(['msg' => '更新配置成功']); + + } else { + + $secret = $service->getSectionConfig($section); + + $this->view->setVar('secret', $secret); + } + } + + /** + * @Route("/storage", name="admin.config.storage") + */ + public function storageAction() + { + $section = 'storage'; + + $service = new ConfigService(); + + if ($this->request->isPost()) { + + $data = $this->request->getPost(); + + $service->updateStorageConfig($section, $data); + + return $this->ajaxSuccess(['msg' => '更新配置成功']); + + } else { + + $storage = $service->getSectionConfig($section); + + $this->view->setVar('storage', $storage); + } + } + + /** + * @Route("/vod", name="admin.config.vod") + */ + public function vodAction() + { + $section = 'vod'; + + $service = new ConfigService(); + + if ($this->request->isPost()) { + + $data = $this->request->getPost(); + + $service->updateVodConfig($section, $data); + + return $this->ajaxSuccess(['msg' => '更新配置成功']); + + } else { + + $vod = $service->getSectionConfig($section); + + $this->view->setVar('vod', $vod); + } + } + + /** + * @Route("/live", name="admin.config.live") + */ + public function liveAction() + { + $section = 'live'; + + $service = new ConfigService(); + + if ($this->request->isPost()) { + + $data = $this->request->getPost(); + + $service->updateLiveConfig($section, $data); + + return $this->ajaxSuccess(['msg' => '更新配置成功']); + + } else { + + $live = $service->getSectionConfig($section); + + $ptt = json_decode($live->pull_trans_template); + + $this->view->setVar('live', $live); + $this->view->setVar('ptt', $ptt); + } + } + + /** + * @Route("/payment", name="admin.config.payment") + */ + public function paymentAction() + { + $service = new ConfigService(); + + if ($this->request->isPost()) { + + $section = $this->request->getPost('section'); + $data = $this->request->getPost(); + + $service->updateSectionConfig($section, $data); + + return $this->ajaxSuccess(['msg' => '更新配置成功']); + + } else { + + $alipay = $service->getSectionConfig('payment.alipay'); + $wxpay = $service->getSectionConfig('payment.wxpay'); + + $this->view->setVar('alipay', $alipay); + $this->view->setVar('wxpay', $wxpay); + } + } + + /** + * @Route("/smser", name="admin.config.smser") + */ + public function smserAction() + { + $section = 'smser'; + + $service = new ConfigService(); + + if ($this->request->isPost()) { + + $data = $this->request->getPost(); + + $service->updateSmserConfig($section, $data); + + return $this->ajaxSuccess(['msg' => '更新配置成功']); + + } else { + + $smser = $service->getSectionConfig($section); + + $template = json_decode($smser->template); + + $this->view->setVar('smser', $smser); + $this->view->setVar('template', $template); + } + } + + /** + * @Route("/mailer", name="admin.config.mailer") + */ + public function mailerAction() + { + $section = 'mailer'; + + $service = new ConfigService(); + + if ($this->request->isPost()) { + + $data = $this->request->getPost(); + + $service->updateSectionConfig($section, $data); + + return $this->ajaxSuccess(['msg' => '更新配置成功']); + + } else { + + $mailer = $service->getSectionConfig($section); + + $this->view->setVar('mailer', $mailer); + } + } + + /** + * @Route("/captcha", name="admin.config.captcha") + */ + public function captchaAction() + { + $section = 'captcha'; + + $service = new ConfigService(); + + if ($this->request->isPost()) { + + $data = $this->request->getPost(); + + $service->updateSectionConfig($section, $data); + + $content = [ + 'location' => $this->request->getHTTPReferer(), + 'msg' => '更新配置成功', + ]; + + return $this->ajaxSuccess($content); + + } else { + + $captcha = $service->getSectionConfig($section); + + $this->view->setVar('captcha', $captcha); + } + } + + /** + * @Route("/vip", name="admin.config.vip") + */ + public function vipAction() + { + $section = 'vip'; + + $service = new ConfigService(); + + if ($this->request->isPost()) { + + $data = $this->request->getPost(); + + $service->updateSectionConfig($section, $data); + + return $this->ajaxSuccess(['msg' => '更新配置成功']); + + } else { + + $vip = $service->getSectionConfig($section); + + $this->view->setVar('vip', $vip); + } + } + +} diff --git a/app/Http/Admin/Controllers/Controller.php b/app/Http/Admin/Controllers/Controller.php new file mode 100644 index 00000000..72a5e1dc --- /dev/null +++ b/app/Http/Admin/Controllers/Controller.php @@ -0,0 +1,113 @@ +notSafeRequest()) { + if (!$this->checkHttpReferer() || !$this->checkCsrfToken()) { + $dispatcher->forward([ + 'controller' => 'public', + 'action' => 'csrf', + ]); + return false; + } + } + + $this->authUser = $this->getDI()->get('auth')->getAuthUser(); + + if (!$this->authUser) { + $dispatcher->forward([ + 'controller' => 'public', + 'action' => 'auth', + ]); + return false; + } + + $controller = $dispatcher->getControllerName(); + + $route = $this->router->getMatchedRoute(); + + /** + * 管理员忽略权限检查 + */ + if ($this->authUser->admin) { + return true; + } + + /** + * 特例白名单 + */ + $whitelist = [ + 'controller' => [ + 'public', 'index', 'storage', 'vod', 'test', + 'xm_course', + ], + 'route' => [ + 'admin.package.guiding', + ], + ]; + + /** + * 特定控制器忽略权限检查 + */ + if (in_array($controller, $whitelist['controller'])) { + return true; + } + + /** + * 特定路由忽略权限检查 + */ + if (in_array($route->getName(), $whitelist['route'])) { + return true; + } + + /** + * 执行路由权限检查 + */ + if (!in_array($route->getName(), $this->authUser->routes)) { + $dispatcher->forward([ + 'controller' => 'public', + 'action' => 'forbidden', + ]); + return false; + } + + return true; + } + + public function initialize() + { + $this->view->setVar('auth_user', $this->authUser); + } + + public function afterExecuteRoute(Dispatcher $dispatcher) + { + if ($this->request->isPost()) { + + $audit = new AuditModel(); + + $audit->user_id = $this->authUser->id; + $audit->user_name = $this->authUser->name; + $audit->user_ip = $this->request->getClientAddress(); + $audit->req_route = $this->router->getMatchedRoute()->getName(); + $audit->req_path = $this->request->getServer('REQUEST_URI'); + $audit->req_data = $this->request->getPost(); + + $audit->create(); + } + } + +} diff --git a/app/Http/Admin/Controllers/CourseController.php b/app/Http/Admin/Controllers/CourseController.php new file mode 100644 index 00000000..705512dd --- /dev/null +++ b/app/Http/Admin/Controllers/CourseController.php @@ -0,0 +1,147 @@ +getXmCategories(0); + + $this->view->setVar('xm_categories', $xmCategories); + } + + /** + * @Get("/list", name="admin.course.list") + */ + public function listAction() + { + $courseService = new CourseService(); + + $pager = $courseService->getCourses(); + + $this->view->setVar('pager', $pager); + } + + /** + * @Get("/add", name="admin.course.add") + */ + public function addAction() + { + + } + + /** + * @Post("/create", name="admin.course.create") + */ + public function createAction() + { + $courseService = new CourseService(); + + $course = $courseService->createCourse(); + + $location = $this->url->get([ + 'for' => 'admin.course.edit', + 'id' => $course->id, + ]); + + $content = [ + 'location' => $location, + 'msg' => '创建课程成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/{id}/edit", name="admin.course.edit") + */ + public function editAction($id) + { + $courseService = new CourseService(); + + $course = $courseService->getCourse($id); + $xmTeachers = $courseService->getXmTeachers($id); + $xmCategories = $courseService->getXmCategories($id); + $xmCourses = $courseService->getXmCourses($id); + + $this->view->setVar('course', $course); + $this->view->setVar('xm_teachers', $xmTeachers); + $this->view->setVar('xm_categories', $xmCategories); + $this->view->setVar('xm_courses', $xmCourses); + } + + /** + * @Post("/{id}/update", name="admin.course.update") + */ + public function updateAction($id) + { + $courseService = new CourseService(); + + $courseService->updateCourse($id); + + $content = ['msg' => '更新课程成功']; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/delete", name="admin.course.delete") + */ + public function deleteAction($id) + { + $courseService = new CourseService(); + + $courseService->deleteCourse($id); + + $content = [ + 'location' => $this->request->getHTTPReferer(), + 'msg' => '删除课程成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/restore", name="admin.course.restore") + */ + public function restoreAction($id) + { + $courseService = new CourseService(); + + $courseService->restoreCourse($id); + + $content = [ + 'location' => $this->request->getHTTPReferer(), + 'msg' => '还原课程成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/{id}/chapters", name="admin.course.chapters") + */ + public function chaptersAction($id) + { + $courseService = new CourseService(); + + $course = $courseService->getCourse($id); + $chapters = $courseService->getChapters($id); + + $this->view->setVar('course', $course); + $this->view->setVar('chapters', $chapters); + } + +} diff --git a/app/Http/Admin/Controllers/IndexController.php b/app/Http/Admin/Controllers/IndexController.php new file mode 100644 index 00000000..3e642706 --- /dev/null +++ b/app/Http/Admin/Controllers/IndexController.php @@ -0,0 +1,55 @@ +getTopMenus(); + $leftMenus = $authMenu->getLeftMenus(); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + + $this->view->setVar('top_menus', $topMenus); + $this->view->setVar('left_menus', $leftMenus); + } + + /** + * @Get("/main", name="admin.main") + */ + public function mainAction() + { + /* + $service = new \App\Services\Order(); + $course = \App\Models\Course::findFirstById(1152); + $service->createCourseOrder($course); + */ + + /* + $service = new \App\Services\Order(); + $package = \App\Models\Package::findFirstById(5); + $service->createPackageOrder($package); + */ + + $refund = new \App\Services\Refund(); + $order = \App\Models\Order::findFirstById(131); + $amount = $refund->getRefundAmount($order); + + dd($amount); + + } + +} diff --git a/app/Http/Admin/Controllers/NavController.php b/app/Http/Admin/Controllers/NavController.php new file mode 100644 index 00000000..9fbac3d3 --- /dev/null +++ b/app/Http/Admin/Controllers/NavController.php @@ -0,0 +1,140 @@ +request->get('parent_id', 'int', 0); + + $navService = new NavService(); + + $parent = $navService->getParentNav($parentId); + $navs = $navService->getChildNavs($parentId); + + $this->view->setVar('parent', $parent); + $this->view->setVar('navs', $navs); + } + + /** + * @Get("/add", name="admin.nav.add") + */ + public function addAction() + { + $parentId = $this->request->get('parent_id', 'int', 0); + + $navService = new NavService(); + + $topNavs = $navService->getTopNavs(); + + $this->view->setVar('parent_id', $parentId); + $this->view->setVar('top_navs', $topNavs); + } + + /** + * @Post("/create", name="admin.nav.create") + */ + public function createAction() + { + $navService = new NavService(); + + $nav = $navService->createNav(); + + $location = $this->url->get( + ['for' => 'admin.nav.list'], + ['parent_id' => $nav->parent_id] + ); + + $content = [ + 'location' => $location, + 'msg' => '创建导航成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/{id}/edit", name="admin.nav.edit") + */ + public function editAction($id) + { + $navService = new NavService(); + + $nav = $navService->getNav($id); + + $this->view->setVar('nav', $nav); + } + + /** + * @Post("/{id}/update", name="admin.nav.update") + */ + public function updateAction($id) + { + $navService = new NavService(); + + $nav = $navService->getNav($id); + + $navService->updateNav($id); + + $location = $this->url->get( + ['for' => 'admin.nav.list'], + ['parent_id' => $nav->parent_id] + ); + + $content = [ + 'location' => $location, + 'msg' => '更新导航成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/delete", name="admin.nav.delete") + */ + public function deleteAction($id) + { + $navService = new NavService(); + + $navService->deleteNav($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '删除导航成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/restore", name="admin.nav.restore") + */ + public function restoreAction($id) + { + $navService = new NavService(); + + $navService->restoreNav($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '还原导航成功', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/OrderController.php b/app/Http/Admin/Controllers/OrderController.php new file mode 100644 index 00000000..d5be7bb9 --- /dev/null +++ b/app/Http/Admin/Controllers/OrderController.php @@ -0,0 +1,91 @@ +getOrders(); + + $this->view->setVar('pager', $pager); + } + + /** + * @Get("/{id}/show", name="admin.order.show") + */ + public function showAction($id) + { + $orderService = new OrderService(); + + $order = $orderService->getOrder($id); + $trades = $orderService->getTrades($order->sn); + $refunds = $orderService->getRefunds($order->sn); + $user = $orderService->getUser($order->user_id); + + $this->view->setVar('order', $order); + $this->view->setVar('trades', $trades); + $this->view->setVar('refunds', $refunds); + $this->view->setVar('user', $user); + } + + /** + * @Post("/{id}/close", name="admin.order.close") + */ + public function closeAction($id) + { + $orderService = new OrderService(); + + $orderService->closeOrder($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '关闭订单成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/refund", name="admin.order.refund") + */ + public function refundAction() + { + $tradeId = $this->request->getPost('trade_id', 'int'); + + $orderService = new OrderService; + + $orderService->refundTrade($tradeId); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '订单退款成功', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/PackageController.php b/app/Http/Admin/Controllers/PackageController.php new file mode 100644 index 00000000..84041618 --- /dev/null +++ b/app/Http/Admin/Controllers/PackageController.php @@ -0,0 +1,133 @@ +request->getQuery('xm_course_ids'); + + $packageService = new PackageService(); + + $courses = $packageService->getGuidingCourses($xmCourseIds); + $guidingPrice = $packageService->getGuidingPrice($courses); + + $this->view->setVar('courses', $courses); + $this->view->setVar('guiding_price', $guidingPrice); + } + + /** + * @Get("/list", name="admin.package.list") + */ + public function listAction() + { + $packageService = new PackageService(); + + $pager = $packageService->getPackages(); + + $this->view->setVar('pager', $pager); + } + + /** + * @Get("/add", name="admin.package.add") + */ + public function addAction() + { + + } + + /** + * @Post("/create", name="admin.package.create") + */ + public function createAction() + { + $packageService = new PackageService(); + + $package = $packageService->createPackage(); + + $location = $this->url->get([ + 'for' => 'admin.package.edit', + 'id' => $package->id, + ]); + + $content = [ + 'location' => $location, + 'msg' => '创建套餐成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/{id}/edit", name="admin.package.edit") + */ + public function editAction($id) + { + $packageService = new PackageService(); + + $package = $packageService->getPackage($id); + $xmCourses = $packageService->getXmCourses($id); + + $this->view->setVar('package', $package); + $this->view->setVar('xm_courses', $xmCourses); + } + + /** + * @Post("/{id}/update", name="admin.package.update") + */ + public function updateAction($id) + { + $packageService = new PackageService(); + + $packageService->updatePackage($id); + + $content = ['msg' => '更新套餐成功']; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/delete", name="admin.package.delete") + */ + public function deleteAction($id) + { + $packageService = new PackageService(); + + $packageService->deletePackage($id); + + $content = [ + 'location' => $this->request->getHTTPReferer(), + 'msg' => '删除套餐成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/restore", name="admin.package.restore") + */ + public function restoreAction($id) + { + $packageService = new PackageService(); + + $packageService->restorePackage($id); + + $content = [ + 'location' => $this->request->getHTTPReferer(), + 'msg' => '还原套餐成功', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/PageController.php b/app/Http/Admin/Controllers/PageController.php new file mode 100644 index 00000000..047a0dc7 --- /dev/null +++ b/app/Http/Admin/Controllers/PageController.php @@ -0,0 +1,121 @@ +getPages(); + + $this->view->setVar('pager', $pager); + } + + /** + * @Get("/add", name="admin.page.add") + */ + public function addAction() + { + + } + + /** + * @Post("/create", name="admin.page.create") + */ + public function createAction() + { + $service = new PageService(); + + $service->createPage(); + + $location = $this->url->get(['for' => 'admin.page.list']); + + $content = [ + 'location' => $location, + 'msg' => '创建单页成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/{id}/edit", name="admin.page.edit") + */ + public function editAction($id) + { + $service = new PageService; + + $page = $service->getPage($id); + + $this->view->setVar('page', $page); + } + + /** + * @Post("/{id}/update", name="admin.page.update") + */ + public function updateAction($id) + { + $service = new PageService(); + + $service->updatePage($id); + + $location = $this->url->get(['for' => 'admin.page.list']); + + $content = [ + 'location' => $location, + 'msg' => '更新单页成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/delete", name="admin.page.delete") + */ + public function deleteAction($id) + { + $service = new PageService(); + + $service->deletePage($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '删除单页成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/restore", name="admin.page.restore") + */ + public function restoreAction($id) + { + $service = new PageService(); + + $service->restorePage($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '还原单页成功', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/PublicController.php b/app/Http/Admin/Controllers/PublicController.php new file mode 100644 index 00000000..4f6793ec --- /dev/null +++ b/app/Http/Admin/Controllers/PublicController.php @@ -0,0 +1,63 @@ +request->isAjax()) { + return $this->ajaxError(['msg' => '会话已过期,请重新登录']); + } + + $this->response->redirect(['for' => 'admin.login']); + } + + /** + * @Route("/csrf", name="admin.csrf") + */ + public function csrfAction() + { + if ($this->request->isAjax()) { + return $this->ajaxError(['msg' => 'CSRF令牌验证失败']); + } + + $this->view->pick('public/csrf'); + } + + /** + * @Route("/forbidden", name="admin.forbidden") + */ + public function forbiddenAction() + { + if ($this->request->isAjax()) { + return $this->ajaxError(['msg' => '无相关操作权限']); + } + + $this->view->pick('public/forbidden'); + } + + /** + * @Route("/ip2region", name="admin.ip2region") + */ + public function ip2regionAction() + { + $ip = $this->request->getQuery('ip', 'trim'); + + $region = kg_ip2region($ip); + + $this->view->setVar('region', $region); + } + +} diff --git a/app/Http/Admin/Controllers/RefundController.php b/app/Http/Admin/Controllers/RefundController.php new file mode 100644 index 00000000..ab15c55f --- /dev/null +++ b/app/Http/Admin/Controllers/RefundController.php @@ -0,0 +1,70 @@ +getRefunds(); + + $this->view->setVar('pager', $pager); + } + + /** + * @Get("/{id}/show", name="admin.refund.show") + */ + public function showAction($id) + { + $refundService = new RefundService(); + + $refund = $refundService->getRefund($id); + $order = $refundService->getOrder($refund->order_sn); + $trade = $refundService->getTrade($refund->trade_sn); + $user = $refundService->getUser($trade->user_id); + + $this->view->setVar('refund', $refund); + $this->view->setVar('order', $order); + $this->view->setVar('trade', $trade); + $this->view->setVar('user', $user); + } + + /** + * @Post("/{id}/review", name="admin.refund.review") + */ + public function reviewAction($id) + { + $refundService = new RefundService; + + $refundService->reviewRefund($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '审核退款成功', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/ReviewController.php b/app/Http/Admin/Controllers/ReviewController.php new file mode 100644 index 00000000..aa1a5a79 --- /dev/null +++ b/app/Http/Admin/Controllers/ReviewController.php @@ -0,0 +1,108 @@ +getReviews(); + + $courseId = $this->request->getQuery('course_id', 'int', 0); + + $course = null; + + if ($courseId > 0) { + $course = $service->getCourse($courseId); + } + + $this->view->setVar('pager', $pager); + $this->view->setVar('course', $course); + } + + /** + * @Get("/{id}/edit", name="admin.review.edit") + */ + public function editAction($id) + { + $service = new ReviewService(); + + $review = $service->getReview($id); + + $this->view->setVar('review', $review); + } + + /** + * @Post("/{id}/update", name="admin.review.update") + */ + public function updateAction($id) + { + $service = new ReviewService(); + + $service->updateReview($id); + + $content = [ + 'msg' => '更新评价成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/delete", name="admin.review.delete") + */ + public function deleteAction($id) + { + $service = new ReviewService(); + + $service->deleteReview($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '删除评价成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/restore", name="admin.review.restore") + */ + public function restoreAction($id) + { + $service = new ReviewService(); + + $service->restoreReview($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '还原评价成功', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/RoleController.php b/app/Http/Admin/Controllers/RoleController.php new file mode 100644 index 00000000..31462d35 --- /dev/null +++ b/app/Http/Admin/Controllers/RoleController.php @@ -0,0 +1,132 @@ +getRoles(); + + $this->view->setVar('roles', $roles); + } + + /** + * @Get("/add", name="admin.role.add") + */ + public function addAction() + { + + } + + /** + * @Post("/create", name="admin.role.create") + */ + public function createAction() + { + $roleService = new RoleService(); + + $role = $roleService->createRole(); + + $location = $this->url->get([ + 'for' => 'admin.role.edit', + 'id' => $role->id, + ]); + + $content = [ + 'location' => $location, + 'msg' => '创建角色成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/{id}/edit", name="admin.role.edit") + */ + public function editAction($id) + { + $roleService = new RoleService(); + + $role = $roleService->getRole($id); + + //dd($role->routes); + + $adminNode = new AuthNode(); + + $nodes = $adminNode->getAllNodes(); + + $this->view->setVar('role', $role); + $this->view->setVar('nodes', kg_array_object($nodes)); + } + + /** + * @Post("/{id}/update", name="admin.role.update") + */ + public function updateAction($id) + { + $roleService = new RoleService(); + + $roleService->updateRole($id); + + $location = $this->url->get(['for' => 'admin.role.list']); + + $content = [ + 'location' => $location, + 'msg' => '更新角色成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/delete", name="admin.role.delete") + */ + public function deleteAction($id) + { + $roleService = new RoleService(); + + $roleService->deleteRole($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '删除角色成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/restore", name="admin.role.restore") + */ + public function restoreAction($id) + { + $roleService = new RoleService(); + + $roleService->restoreRole($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '还原角色成功', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/SessionController.php b/app/Http/Admin/Controllers/SessionController.php new file mode 100644 index 00000000..efbe80e0 --- /dev/null +++ b/app/Http/Admin/Controllers/SessionController.php @@ -0,0 +1,64 @@ +request->isPost()) { + + if (!$this->checkHttpReferer() || !$this->checkCsrfToken()) { + $this->dispatcher->forward([ + 'controller' => 'public', + 'action' => 'forbidden', + ]); + return false; + } + + $sessionService = new SessionService(); + + $sessionService->login(); + + $location = $this->url->get(['for' => 'admin.index']); + + return $this->ajaxSuccess(['location' => $location]); + } + + $configService = new ConfigService(); + + $captcha = $configService->getSectionConfig('captcha'); + + $this->view->pick('public/login'); + + $this->view->setVar('captcha', $captcha); + } + + /** + * @Get("/logout", name="admin.logout") + */ + public function logoutAction() + { + $service = new SessionService(); + + $service->logout(); + + $this->response->redirect(['for' => 'admin.login']); + } + +} diff --git a/app/Http/Admin/Controllers/SlideController.php b/app/Http/Admin/Controllers/SlideController.php new file mode 100644 index 00000000..754d2db3 --- /dev/null +++ b/app/Http/Admin/Controllers/SlideController.php @@ -0,0 +1,124 @@ +getSlides(); + + $this->view->setVar('pager', $pager); + } + + /** + * @Get("/add", name="admin.slide.add") + */ + public function addAction() + { + + } + + /** + * @Post("/create", name="admin.slide.create") + */ + public function createAction() + { + $service = new SlideService(); + + $slide = $service->createSlide(); + + $location = $this->url->get([ + 'for' => 'admin.slide.edit', + 'id' => $slide->id, + ]); + + $content = [ + 'location' => $location, + 'msg' => '创建轮播成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/{id}/edit", name="admin.slide.edit") + */ + public function editAction($id) + { + $service = new SlideService(); + + $slide = $service->getSlide($id); + + $this->view->setVar('slide', $slide); + } + + /** + * @Post("/{id}/update", name="admin.slide.update") + */ + public function updateAction($id) + { + $service = new SlideService(); + + $service->updateSlide($id); + + $location = $this->url->get(['for' => 'admin.slide.list']); + + $content = [ + 'location' => $location, + 'msg' => '更新轮播成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/delete", name="admin.slide.delete") + */ + public function deleteAction($id) + { + $service = new SlideService(); + + $service->deleteSlide($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '删除轮播成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/restore", name="admin.slide.restore") + */ + public function restoreAction($id) + { + $service = new SlideService(); + + $service->restoreSlide($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '还原轮播成功', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/StorageController.php b/app/Http/Admin/Controllers/StorageController.php new file mode 100644 index 00000000..48294581 --- /dev/null +++ b/app/Http/Admin/Controllers/StorageController.php @@ -0,0 +1,47 @@ +uploadCoverImage(); + + $url = $storageService->getCiImageUrl($key); + + if ($url) { + return $this->ajaxSuccess(['data' => ['src' => $url, 'title' => '']]); + } else { + return $this->ajaxError(['msg' => '上传文件失败']); + } + } + + /** + * @Post("/content/img/upload", name="admin.content.img.upload") + */ + public function uploadContentImageAction() + { + $storageService = new StorageService(); + + $url = $storageService->uploadContentImage(); + + if ($url) { + return $this->ajaxSuccess(['data' => ['src' => $url, 'title' => '']]); + } else { + return $this->ajaxError(['msg' => '上传文件失败']); + } + } + +} diff --git a/app/Http/Admin/Controllers/StudentController.php b/app/Http/Admin/Controllers/StudentController.php new file mode 100644 index 00000000..6ceb4e22 --- /dev/null +++ b/app/Http/Admin/Controllers/StudentController.php @@ -0,0 +1,121 @@ +request->getQuery('course_id', 'int', ''); + + $service = new CourseStudentService(); + + $pager = $service->getCourseStudents(); + + $this->view->setVar('pager', $pager); + $this->view->setVar('course_id', $courseId); + } + + /** + * @Get("/add", name="admin.student.add") + */ + public function addAction() + { + $courseId = $this->request->getQuery('course_id', 'int', ''); + + $this->view->setVar('course_id', $courseId); + } + + /** + * @Post("/create", name="admin.student.create") + */ + public function createAction() + { + $service = new CourseStudentService(); + + $student = $service->createCourseStudent(); + + $location = $this->url->get( + ['for' => 'admin.student.list'], + ['course_id' => $student->course_id] + ); + + $content = [ + 'location' => $location, + 'msg' => '添加学员成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/edit", name="admin.student.edit") + */ + public function editAction() + { + $courseId = $this->request->getQuery('course_id', 'int'); + $userId = $this->request->getQuery('user_id', 'int'); + + $service = new CourseStudentService(); + + $courseStudent = $service->getCourseStudent($courseId, $userId); + $course = $service->getCourse($courseId); + $student = $service->getStudent($userId); + + $this->view->setVar('course_student', $courseStudent); + $this->view->setVar('course', $course); + $this->view->setVar('student', $student); + } + + /** + * @Post("/update", name="admin.student.update") + */ + public function updateAction() + { + $service = new CourseStudentService(); + + $student = $service->updateCourseStudent(); + + $location = $this->url->get( + ['for' => 'admin.student.list'], + ['course_id' => $student->course_id] + ); + + $content = [ + 'location' => $location, + 'msg' => '更新学员成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/learning", name="admin.student.learning") + */ + public function learningAction() + { + $service = new CourseStudentService(); + + $pager = $service->getCourseLearnings(); + + $this->view->setVar('pager', $pager); + } + +} diff --git a/app/Http/Admin/Controllers/TestController.php b/app/Http/Admin/Controllers/TestController.php new file mode 100644 index 00000000..92e376e8 --- /dev/null +++ b/app/Http/Admin/Controllers/TestController.php @@ -0,0 +1,201 @@ +uploadTestFile(); + + if ($result) { + return $this->ajaxSuccess(['msg' => '上传文件成功,请到控制台确认']); + } else { + return $this->ajaxError(['msg' => '上传文件失败,请检查相关配置']); + } + } + + /** + * @Post("/vod", name="admin.test.vod") + */ + public function vodTestAction() + { + $vodService = new VodService(); + + $result = $vodService->test(); + + if ($result) { + return $this->ajaxSuccess(['msg' => '接口返回成功']); + } else { + return $this->ajaxError(['msg' => '接口返回失败,请检查相关配置']); + } + } + + /** + * @Get("/live/push", name="admin.test.live.push") + */ + public function livePushTestAction() + { + $liveService = new LiveService(); + + $pushUrl = $liveService->getPushUrl('test'); + + $obs = new \stdClass(); + + $position = strrpos($pushUrl, '/'); + $obs->fms_url = substr($pushUrl, 0, $position + 1); + $obs->stream_code = substr($pushUrl, $position + 1); + + $this->view->pick('config/live_push_test'); + $this->view->setVar('push_url', $pushUrl); + $this->view->setVar('obs', $obs); + } + + /** + * @Get("/live/pull", name="admin.test.live.pull") + */ + public function livePullTestAction() + { + $liveService = new LiveService(); + + $m3u8PullUrls = $liveService->getPullUrls('test', 'm3u8'); + $flvPullUrls = $liveService->getPullUrls('test', 'flv'); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + $this->view->pick('public/live_player'); + $this->view->setVar('m3u8_pull_urls', $m3u8PullUrls); + $this->view->setVar('flv_pull_urls', $flvPullUrls); + } + + /** + * @Post("/smser", name="admin.test.smser") + */ + public function smserTestAction() + { + $phone = $this->request->getPost('phone'); + + $smserService = new SmserService(); + + $response = $smserService->sendTestMessage($phone); + + if ($response) { + return $this->ajaxSuccess(['msg' => '发送短信成功,请到收件箱确认']); + } else { + return $this->ajaxError(['msg' => '发送短信失败,请查看短信日志']); + } + } + + /** + * @Post("/mailer", name="admin.test.mailer") + */ + public function mailerTestAction() + { + $email = $this->request->getPost('email'); + + $mailerService = new MailerService(); + + $result = $mailerService->sendTestMail($email); + + if ($result) { + return $this->ajaxSuccess(['msg' => '发送邮件成功,请到收件箱确认']); + } else { + return $this->ajaxError(['msg' => '发送邮件失败,请检查配置']); + } + } + + /** + * @Post("/captcha", name="admin.test.captcha") + */ + public function captchaTestAction() + { + $post = $this->request->getPost(); + + $captchaService = new CaptchaService(); + + $result = $captchaService->verify($post['ticket'], $post['rand']); + + if ($result) { + + $configService = new ConfigService(); + + $configService->updateSectionConfig('captcha', ['enabled' => 1]); + + return $this->ajaxSuccess(['msg' => '后台验证成功']); + + } else { + return $this->ajaxError(['msg' => '后台验证失败']); + } + } + + /** + * @Get("/alipay", name="admin.test.alipay") + */ + public function alipayTestAction() + { + $alipayTestService = new AlipayTestService(); + + $this->db->begin(); + + $order = $alipayTestService->createTestOrder(); + $trade = $alipayTestService->createTestTrade($order); + $qrcode = $alipayTestService->getTestQrCode($trade); + + if ($order->id > 0 && $trade->id > 0 && $qrcode) { + $this->db->commit(); + } else { + $this->db->rollback(); + } + + $this->view->pick('config/alipay_test'); + $this->view->setVar('trade', $trade); + $this->view->setVar('qrcode', $qrcode); + } + + /** + * @Post("/alipay/status", name="admin.test.alipay.status") + */ + public function alipayTestStatusAction() + { + $sn = $this->request->getPost('sn'); + + $alipayTestService = new AlipayTestService(); + + $status = $alipayTestService->getTestStatus($sn); + + return $this->ajaxSuccess(['status' => $status]); + } + + /** + * @Post("/alipay/cancel", name="admin.test.alipay.cancel") + */ + public function alipayTestCancelAction() + { + $sn = $this->request->getPost('sn'); + + $alipayTestService = new AlipayTestService(); + + $alipayTestService->cancelTestOrder($sn); + + return $this->ajaxSuccess(['msg' => '取消订单成功']); + } + +} diff --git a/app/Http/Admin/Controllers/TradeController.php b/app/Http/Admin/Controllers/TradeController.php new file mode 100644 index 00000000..f5869b41 --- /dev/null +++ b/app/Http/Admin/Controllers/TradeController.php @@ -0,0 +1,89 @@ +getTrades(); + + $this->view->setVar('pager', $pager); + } + + /** + * @Get("/{id}/show", name="admin.trade.show") + */ + public function showAction($id) + { + $tradeService = new TradeService(); + + $trade = $tradeService->getTrade($id); + $refunds = $tradeService->getRefunds($trade->sn); + $order = $tradeService->getOrder($trade->order_sn); + $user = $tradeService->getUser($trade->user_id); + + $this->view->setVar('refunds', $refunds); + $this->view->setVar('trade', $trade); + $this->view->setVar('order', $order); + $this->view->setVar('user', $user); + } + + /** + * @Post("/{id}/close", name="admin.trade.close") + */ + public function closeAction($id) + { + $tradeService = new TradeService(); + + $tradeService->closeTrade($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '关闭交易成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Post("/{id}/refund", name="admin.trade.refund") + */ + public function refundAction($id) + { + $tradeService = new TradeService(); + + $tradeService->refundTrade($id); + + $location = $this->request->getHTTPReferer(); + + $content = [ + 'location' => $location, + 'msg' => '申请退款成功,请到退款管理中审核确认', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/UserController.php b/app/Http/Admin/Controllers/UserController.php new file mode 100644 index 00000000..b60b9bea --- /dev/null +++ b/app/Http/Admin/Controllers/UserController.php @@ -0,0 +1,109 @@ +getRoles(); + + $this->view->setVar('roles', $roles); + } + + /** + * @Get("/list", name="admin.user.list") + */ + public function listAction() + { + $userService = new UserService(); + + $pager = $userService->getUsers(); + + $this->view->setVar('pager', $pager); + } + + /** + * @Get("/{id}/show", name="admin.user.show") + */ + public function showAction($id) + { + + } + + /** + * @Get("/add", name="admin.user.add") + */ + public function addAction() + { + $userService = new UserService(); + + $roles = $userService->getRoles(); + + $this->view->setVar('roles', $roles); + } + + /** + * @Post("/create", name="admin.user.create") + */ + public function createAction() + { + $userService = new UserService(); + + $userService->createUser(); + + $location = $this->url->get(['for' => 'admin.user.list']); + + $content = [ + 'location' => $location, + 'msg' => '新增用户成功', + ]; + + return $this->ajaxSuccess($content); + } + + /** + * @Get("/{id}/edit", name="admin.user.edit") + */ + public function editAction($id) + { + $userService = new UserService(); + + $user = $userService->getUser($id); + $roles = $userService->getRoles(); + + $this->view->setVar('user', $user); + $this->view->setVar('roles', $roles); + } + + /** + * @Post("/{id}/update", name="admin.user.update") + */ + public function updateAction($id) + { + $userService = new UserService(); + + $userService->updateUser($id); + + $location = $this->url->get(['for' => 'admin.user.list']); + + $content = [ + 'location' => $location, + 'msg' => '更新用户成功', + ]; + + return $this->ajaxSuccess($content); + } + +} diff --git a/app/Http/Admin/Controllers/VodController.php b/app/Http/Admin/Controllers/VodController.php new file mode 100644 index 00000000..f84d7745 --- /dev/null +++ b/app/Http/Admin/Controllers/VodController.php @@ -0,0 +1,68 @@ +getUploadSignature(); + + return $this->ajaxSuccess(['signature' => $signature]); + } + + /** + * @Get("/player", name="admin.vod.player") + */ + public function playerAction() + { + $courseId = $this->request->getQuery('course_id'); + $chapterId = $this->request->getQuery('chapter_id'); + $playUrl = $this->request->getQuery('play_url'); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + + $this->view->pick('public/vod_player'); + + $this->view->setVar('course_id', $courseId); + $this->view->setVar('chapter_id', $chapterId); + $this->view->setVar('play_url', urldecode($playUrl)); + } + + /** + * @Get("/learning", name="admin.vod.learning") + */ + public function learningAction() + { + $query = $this->request->getQuery(); + + $learning = new LearningModel(); + + $learning->user_id = $this->authUser->id; + $learning->request_id = $query['request_id']; + $learning->course_id = $query['course_id']; + $learning->chapter_id = $query['chapter_id']; + $learning->position = $query['position']; + + $learningService = new LearningService(); + + $learningService->save($learning, $query['timeout']); + + return $this->ajaxSuccess(); + } + +} diff --git a/app/Http/Admin/Controllers/XmCourseController.php b/app/Http/Admin/Controllers/XmCourseController.php new file mode 100644 index 00000000..d470bb0e --- /dev/null +++ b/app/Http/Admin/Controllers/XmCourseController.php @@ -0,0 +1,43 @@ +getAllCourses(); + + return $this->ajaxSuccess([ + 'count' => $pager->total_items, + 'data' => $pager->items, + ]); + } + + /** + * @Get("/paid", name="admin.xm.course.paid") + */ + public function paidAction() + { + $xmCourseService = new XmCourseService(); + + $pager = $xmCourseService->getPaidCourses(); + + return $this->ajaxSuccess([ + 'count' => $pager->total_items, + 'data' => $pager->items, + ]); + } + +} diff --git a/app/Http/Admin/Module.php b/app/Http/Admin/Module.php new file mode 100644 index 00000000..9ae9f52e --- /dev/null +++ b/app/Http/Admin/Module.php @@ -0,0 +1,35 @@ +set('view', function () { + $view = new View(); + $view->setViewsDir(__DIR__ . '/Views'); + $view->registerEngines([ + '.volt' => 'volt', + ]); + return $view; + }); + + $di->setShared('auth', function () { + $authUser = new AuthUser(); + return $authUser; + }); + } + +} diff --git a/app/Http/Admin/Services/AlipayTest.php b/app/Http/Admin/Services/AlipayTest.php new file mode 100644 index 00000000..c61ea9bf --- /dev/null +++ b/app/Http/Admin/Services/AlipayTest.php @@ -0,0 +1,61 @@ + $trade->sn, + 'total_amount' => $trade->amount, + 'subject' => $trade->subject, + ]; + + $alipayService = new AlipayService(); + $qrcode = $alipayService->getQrCode($outOrder); + $result = $qrcode ?: false; + + return $result; + } + + /** + * 取消测试订单 + * + * @param string $sn + */ + public function cancelTestOrder($sn) + { + $tradeRepo = new TradeRepo(); + $trade = $tradeRepo->findBySn($sn); + + $orderRepo = new OrderRepo(); + $order = $orderRepo->findBySn($trade->order_sn); + + $alipayService = new AlipayService(); + $response = $alipayService->cancelOrder($trade->sn); + + if ($response) { + $trade->status = TradeModel::STATUS_CLOSED; + $trade->update(); + if ($order->status != OrderModel::STATUS_PENDING) { + $order->status = OrderModel::STATUS_PENDING; + $order->update(); + } + } + } + +} diff --git a/app/Http/Admin/Services/Audit.php b/app/Http/Admin/Services/Audit.php new file mode 100644 index 00000000..f62e5365 --- /dev/null +++ b/app/Http/Admin/Services/Audit.php @@ -0,0 +1,37 @@ +getParams(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $auditRepo = new AuditRepo(); + + $pager = $auditRepo->paginate($params, $sort, $page, $limit); + + return $pager; + } + + public function getAudit($id) + { + $auditRepo = new AuditRepo(); + + $audit = $auditRepo->findById($id); + + return $audit; + } + +} diff --git a/app/Http/Admin/Services/AuthMenu.php b/app/Http/Admin/Services/AuthMenu.php new file mode 100644 index 00000000..7f23b0b4 --- /dev/null +++ b/app/Http/Admin/Services/AuthMenu.php @@ -0,0 +1,122 @@ +authUser = $this->getAuthUser(); + $this->nodes = $this->getAllNodes(); + $this->setOwnedLevelIds(); + } + + public function getTopMenus() + { + $menus = []; + + foreach ($this->nodes as $node) { + if ($this->authUser->admin || in_array($node['id'], $this->owned1stLevelIds)) { + $menus[] = [ + 'id' => $node['id'], + 'label' => $node['label'], + ]; + } + } + + return kg_array_object($menus); + } + + public function getLeftMenus() + { + $menus = []; + + foreach ($this->nodes as $key => $level) { + foreach ($level['child'] as $key2 => $level2) { + foreach ($level2['child'] as $key3 => $level3) { + $hasRight = $this->authUser->admin || in_array($level3['id'], $this->owned3rdLevelIds); + if ($level3['type'] == 'menu' && $hasRight) { + $menus[$key]['id'] = $level['id']; + $menus[$key]['label'] = $level['label']; + $menus[$key]['child'][$key2]['id'] = $level2['id']; + $menus[$key]['child'][$key2]['label'] = $level2['label']; + $menus[$key]['child'][$key2]['child'][$key3] = [ + 'id' => $level3['id'], + 'label' => $level3['label'], + 'url' => $this->url->get(['for' => $level3['route']]), + ]; + } + } + } + } + + return kg_array_object($menus); + } + + protected function setOwnedLevelIds() + { + $routeIdMapping = $this->getRouteIdMapping(); + + if (!$routeIdMapping) return; + + $owned1stLevelIds = []; + $owned2ndLevelIds = []; + $owned3rdLevelIds = []; + + foreach ($routeIdMapping as $key => $value) { + $ids = explode('-', $value); + if (in_array($key, $this->authUser->routes)) { + $owned1stLevelIds[] = $ids[0]; + $owned2ndLevelIds[] = $ids[0] . '-' . $ids[1]; + $owned3rdLevelIds[] = $value; + } + } + + $this->owned1stLevelIds = array_unique($owned1stLevelIds); + $this->owned2ndLevelIds = array_unique($owned2ndLevelIds); + $this->owned3rdLevelIds = array_unique($owned3rdLevelIds); + } + + protected function getRouteIdMapping() + { + $mapping = []; + + foreach ($this->nodes as $level) { + foreach ($level['child'] as $level2) { + foreach ($level2['child'] as $level3) { + if ($level3['type'] == 'menu') { + $mapping[$level3['route']] = $level3['id']; + } + } + } + } + + return $mapping; + } + + protected function getAllNodes() + { + $authNode = new AuthNode(); + + return $authNode->getAllNodes(); + } + + protected function getAuthUser() + { + $auth = $this->getDI()->get('auth'); + + return $auth->getAuthUser(); + } + +} diff --git a/app/Http/Admin/Services/AuthNode.php b/app/Http/Admin/Services/AuthNode.php new file mode 100644 index 00000000..800d3b6d --- /dev/null +++ b/app/Http/Admin/Services/AuthNode.php @@ -0,0 +1,582 @@ +getContentNodes(); + $nodes[] = $this->getOperationNodes(); + $nodes[] = $this->getFinanceNodes(); + $nodes[] = $this->getUserNodes(); + $nodes[] = $this->getConfigNodes(); + + return $nodes; + } + + protected function getContentNodes() + { + $nodes = [ + 'id' => '1', + 'label' => '内容管理', + 'child' => [ + [ + 'id' => '1-1', + 'label' => '课程管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '1-1-1', + 'label' => '课程列表', + 'type' => 'menu', + 'route' => 'admin.course.list', + ], + [ + 'id' => '1-1-2', + 'label' => '搜索课程', + 'type' => 'menu', + 'route' => 'admin.course.search', + ], + [ + 'id' => '1-1-3', + 'label' => '添加课程', + 'type' => 'menu', + 'route' => 'admin.course.add', + ], + [ + 'id' => '1-1-4', + 'label' => '编辑课程', + 'type' => 'button', + 'route' => 'admin.course.edit', + ], + [ + 'id' => '1-1-5', + 'label' => '删除课程', + 'type' => 'button', + 'route' => 'admin.course.edit', + ], + ], + ], + [ + 'id' => '1-2', + 'label' => '分类管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '1-2-1', + 'label' => '分类列表', + 'type' => 'menu', + 'route' => 'admin.category.list', + ], + [ + 'id' => '1-2-2', + 'label' => '添加分类', + 'type' => 'menu', + 'route' => 'admin.category.add', + ], + [ + 'id' => '1-2-3', + 'label' => '编辑分类', + 'type' => 'button', + 'route' => 'admin.category.edit', + ], + [ + 'id' => '1-2-4', + 'label' => '删除分类', + 'type' => 'button', + 'route' => 'admin.category.delete', + ], + ], + ], + [ + 'id' => '1-3', + 'label' => '套餐管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '1-3-1', + 'label' => '套餐列表', + 'type' => 'menu', + 'route' => 'admin.package.list', + ], + [ + 'id' => '1-3-2', + 'label' => '添加套餐', + 'type' => 'menu', + 'route' => 'admin.package.add', + ], + [ + 'id' => '1-3-3', + 'label' => '编辑套餐', + 'type' => 'button', + 'route' => 'admin.package.edit', + ], + [ + 'id' => '1-3-4', + 'label' => '删除套餐', + 'type' => 'button', + 'route' => 'admin.package.delete', + ], + ], + ], + ], + ]; + + return $nodes; + } + + protected function getOperationNodes() + { + $nodes = [ + 'id' => '2', + 'label' => '运营管理', + 'child' => [ + [ + 'id' => '2-5', + 'label' => '学员管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '2-5-1', + 'label' => '学员列表', + 'type' => 'menu', + 'route' => 'admin.student.list', + ], + [ + 'id' => '2-5-2', + 'label' => '搜索学员', + 'type' => 'menu', + 'route' => 'admin.student.search', + ], + [ + 'id' => '2-5-3', + 'label' => '添加学员', + 'type' => 'menu', + 'route' => 'admin.student.add', + ], + [ + 'id' => '2-5-4', + 'label' => '编辑学员', + 'type' => 'button', + 'route' => 'admin.student.edit', + ], + ], + ], + [ + 'id' => '2-1', + 'label' => '评价管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '2-1-1', + 'label' => '评价列表', + 'type' => 'menu', + 'route' => 'admin.review.list', + ], + [ + 'id' => '2-1-2', + 'label' => '搜索评价', + 'type' => 'menu', + 'route' => 'admin.review.search', + ], + [ + 'id' => '2-1-3', + 'label' => '编辑评价', + 'type' => 'button', + 'route' => 'admin.review.edit', + ], + [ + 'id' => '2-1-4', + 'label' => '删除评价', + 'type' => 'button', + 'route' => 'admin.review.delete', + ], + ], + ], + [ + 'id' => '2-3', + 'label' => '轮播管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '2-3-1', + 'label' => '轮播列表', + 'type' => 'menu', + 'route' => 'admin.slide.list', + ], + [ + 'id' => '2-3-2', + 'label' => '添加轮播', + 'type' => 'menu', + 'route' => 'admin.slide.add', + ], + [ + 'id' => '2-3-3', + 'label' => '编辑轮播', + 'type' => 'button', + 'route' => 'admin.slide.edit', + ], + [ + 'id' => '2-3-4', + 'label' => '删除轮播', + 'type' => 'button', + 'route' => 'admin.slide.delete', + ], + ], + ], + [ + 'id' => '2-4', + 'label' => '单页管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '2-4-1', + 'label' => '单页列表', + 'type' => 'menu', + 'route' => 'admin.page.list', + ], + [ + 'id' => '2-4-2', + 'label' => '添加单页', + 'type' => 'menu', + 'route' => 'admin.page.add', + ], + [ + 'id' => '2-4-3', + 'label' => '编辑单页', + 'type' => 'button', + 'route' => 'admin.page.edit', + ], + [ + 'id' => '2-4-4', + 'label' => '删除单页', + 'type' => 'button', + 'route' => 'admin.page.delete', + ], + ], + ], + [ + 'id' => '2-6', + 'label' => '导航管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '2-6-1', + 'label' => '导航列表', + 'type' => 'menu', + 'route' => 'admin.nav.list', + ], + [ + 'id' => '2-6-2', + 'label' => '添加导航', + 'type' => 'menu', + 'route' => 'admin.nav.add', + ], + [ + 'id' => '2-6-3', + 'label' => '编辑导航', + 'type' => 'button', + 'route' => 'admin.nav.edit', + ], + [ + 'id' => '2-6-4', + 'label' => '删除导航', + 'type' => 'button', + 'route' => 'admin.nav.delete', + ], + ], + ], + ], + ]; + + return $nodes; + } + + protected function getFinanceNodes() + { + $nodes = [ + 'id' => '3', + 'label' => '财务管理', + 'child' => [ + [ + 'id' => '3-1', + 'label' => '订单管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '3-1-1', + 'label' => '订单列表', + 'type' => 'menu', + 'route' => 'admin.order.list', + ], + [ + 'id' => '3-1-2', + 'label' => '搜索订单', + 'type' => 'menu', + 'route' => 'admin.order.search', + ], + [ + 'id' => '3-1-3', + 'label' => '订单详情', + 'type' => 'button', + 'route' => 'admin.order.show', + ], + [ + 'id' => '3-1-4', + 'label' => '关闭订单', + 'type' => 'button', + 'route' => 'admin.order.close', + ], + ], + ], + [ + 'id' => '3-2', + 'label' => '交易管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '3-2-1', + 'label' => '交易记录', + 'type' => 'menu', + 'route' => 'admin.trade.list', + ], + [ + 'id' => '3-2-2', + 'label' => '搜索交易', + 'type' => 'menu', + 'route' => 'admin.trade.search', + ], + [ + 'id' => '3-2-3', + 'label' => '关闭交易', + 'type' => 'button', + 'route' => 'admin.trade.close', + ], + [ + 'id' => '3-2-4', + 'label' => '交易退款', + 'type' => 'button', + 'route' => 'admin.trade.refund', + ], + ], + ], + [ + 'id' => '3-3', + 'label' => '退款管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '3-3-1', + 'label' => '退款列表', + 'type' => 'menu', + 'route' => 'admin.refund.list', + ], + [ + 'id' => '3-3-2', + 'label' => '搜索退款', + 'type' => 'menu', + 'route' => 'admin.refund.search', + ], + [ + 'id' => '3-3-3', + 'label' => '退款详情', + 'type' => 'button', + 'route' => 'admin.refund.show', + ], + [ + 'id' => '3-3-4', + 'label' => '审核退款', + 'type' => 'button', + 'route' => 'admin.refund.review', + ], + ], + ], + ], + ]; + + return $nodes; + } + + protected function getUserNodes() + { + $nodes = [ + 'id' => '4', + 'label' => '用户管理', + 'child' => [ + [ + 'id' => '4-1', + 'label' => '用户管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '4-1-1', + 'label' => '用户列表', + 'type' => 'menu', + 'route' => 'admin.user.list', + ], + [ + 'id' => '4-1-2', + 'label' => '搜索用户', + 'type' => 'menu', + 'route' => 'admin.user.search', + ], + [ + 'id' => '4-1-3', + 'label' => '添加用户', + 'type' => 'menu', + 'route' => 'admin.user.add', + ], + [ + 'id' => '4-1-4', + 'label' => '编辑用户', + 'type' => 'button', + 'route' => 'admin.user.edit', + ] + ], + ], + [ + 'id' => '4-2', + 'label' => '角色管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '4-2-1', + 'label' => '角色列表', + 'type' => 'menu', + 'route' => 'admin.role.list', + ], + [ + 'id' => '4-2-2', + 'label' => '添加角色', + 'type' => 'menu', + 'route' => 'admin.role.add', + ], + [ + 'id' => '4-2-3', + 'label' => '编辑角色', + 'type' => 'button', + 'route' => 'admin.role.edit', + ], + [ + 'id' => '4-2-4', + 'label' => '删除角色', + 'type' => 'button', + 'route' => 'admin.role.delete', + ] + ], + ], + [ + 'id' => '4-3', + 'label' => '操作记录', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '4-3-1', + 'label' => '记录列表', + 'type' => 'menu', + 'route' => 'admin.audit.list', + ], + [ + 'id' => '4-3-2', + 'label' => '搜索记录', + 'type' => 'menu', + 'route' => 'admin.audit.search', + ], + [ + 'id' => '4-3-3', + 'label' => '浏览记录', + 'type' => 'button', + 'route' => 'admin.audit.show', + ], + ], + ], + ], + ]; + + return $nodes; + } + + protected function getConfigNodes() + { + $nodes = [ + 'id' => '5', + 'label' => '系统配置', + 'child' => [ + [ + 'id' => '5-1', + 'label' => '配置管理', + 'type' => 'menu', + 'child' => [ + [ + 'id' => '5-1-1', + 'label' => '网站设置', + 'type' => 'menu', + 'route' => 'admin.config.website', + ], + [ + 'id' => '5-1-2', + 'label' => '密钥设置', + 'type' => 'menu', + 'route' => 'admin.config.secret', + ], + [ + 'id' => '5-1-3', + 'label' => '存储设置', + 'type' => 'menu', + 'route' => 'admin.config.storage', + ], + [ + 'id' => '5-1-4', + 'label' => '点播设置', + 'type' => 'menu', + 'route' => 'admin.config.vod', + ], + [ + 'id' => '5-1-5', + 'label' => '直播设置', + 'type' => 'menu', + 'route' => 'admin.config.live', + ], + [ + 'id' => '5-1-6', + 'label' => '短信设置', + 'type' => 'menu', + 'route' => 'admin.config.smser', + ], + [ + 'id' => '5-1-7', + 'label' => '邮件设置', + 'type' => 'menu', + 'route' => 'admin.config.mailer', + ], + [ + 'id' => '5-1-8', + 'label' => '验证码设置', + 'type' => 'menu', + 'route' => 'admin.config.captcha', + ], + [ + 'id' => '5-1-9', + 'label' => '支付设置', + 'type' => 'menu', + 'route' => 'admin.config.payment', + ], + [ + 'id' => '5-1-10', + 'label' => '会员设置', + 'type' => 'menu', + 'route' => 'admin.config.vip', + ] + ], + ], + ], + ]; + + return $nodes; + } + +} diff --git a/app/Http/Admin/Services/AuthUser.php b/app/Http/Admin/Services/AuthUser.php new file mode 100644 index 00000000..7bd1b3b8 --- /dev/null +++ b/app/Http/Admin/Services/AuthUser.php @@ -0,0 +1,91 @@ +getAuthUser(); + + if ($authUser->admin) return true; + + if (in_array($route, $authUser->routes)) return true; + + return false; + } + + /** + * 写入会话 + * + * @param UserModel $user + */ + public function setAuthUser(UserModel $user) + { + $role = RoleModel::findFirstById($user->admin_role); + + if ($role->id == RoleModel::ROLE_ADMIN) { + $admin = 1; + $routes = []; + } else { + $admin = 0; + $routes = $role->routes; + } + + $authKey = $this->getAuthKey(); + + $authUser = new \stdClass(); + + $authUser->id = $user->id; + $authUser->name = $user->name; + $authUser->avatar = $user->avatar; + $authUser->admin = $admin; + $authUser->routes = $routes; + + $this->session->set($authKey, $authUser); + } + + /** + * 清除会话 + */ + public function removeAuthUser() + { + $authKey = $this->getAuthKey(); + + $this->session->remove($authKey); + } + + /** + * 读取会话 + * + * @return mixed + */ + public function getAuthUser() + { + $authKey = $this->getAuthKey(); + + return $this->session->get($authKey); + } + + /** + * 获取会话键值 + * + * @return string + */ + public function getAuthKey() + { + return 'admin'; + } + +} diff --git a/app/Http/Admin/Services/Category.php b/app/Http/Admin/Services/Category.php new file mode 100644 index 00000000..814c8561 --- /dev/null +++ b/app/Http/Admin/Services/Category.php @@ -0,0 +1,163 @@ +findOrFail($id); + + return $category; + } + + public function getParentCategory($id) + { + if ($id > 0) { + $parent = CategoryModel::findFirst($id); + } else { + $parent = new CategoryModel(); + $parent->id = 0; + $parent->level = 0; + } + + return $parent; + } + + public function getTopCategories() + { + $categoryRepo = new CategoryRepo(); + + $categories = $categoryRepo->findAll([ + 'parent_id' => 0, + 'deleted' => 0, + ]); + + return $categories; + } + + public function getChildCategories($parentId) + { + $deleted = $this->request->getQuery('deleted', 'int', 0); + + $categoryRepo = new CategoryRepo(); + + $categories = $categoryRepo->findAll([ + 'parent_id' => $parentId, + 'deleted' => $deleted, + ]); + + return $categories; + } + + public function createCategory() + { + $post = $this->request->getPost(); + + $validator = new CategoryValidator(); + + $data = [ + 'parent_id' => 0, + 'published' => 1, + ]; + + $parent = null; + + if ($post['parent_id'] > 0) { + $parent = $validator->checkParent($post['parent_id']); + $data['parent_id'] = $parent->id; + } + + $data['name'] = $validator->checkName($post['name']); + $data['priority'] = $validator->checkPriority($post['priority']); + $data['published'] = $validator->checkPublishStatus($post['published']); + + $category = new CategoryModel(); + + $category->create($data); + + if ($parent) { + $category->path = $parent->path . $category->id . ','; + $category->level = $parent->level + 1; + } else { + $category->path = ',' . $category->id . ','; + $category->level = 1; + } + + $category->update(); + + return $category; + } + + public function updateCategory($id) + { + $category = $this->findOrFail($id); + + $post = $this->request->getPost(); + + $validator = new CategoryValidator(); + + $data = []; + + if (isset($post['name'])) { + $data['name'] = $validator->checkName($post['name']); + } + + if (isset($post['priority'])) { + $data['priority'] = $validator->checkPriority($post['priority']); + } + + if (isset($post['published'])) { + $data['published'] = $validator->checkPublishStatus($post['published']); + } + + $category->update($data); + + return $category; + } + + public function deleteCategory($id) + { + $category = $this->findOrFail($id); + + if ($category->deleted == 1) { + return false; + } + + $category->deleted = 1; + + $category->update(); + + return $category; + } + + public function restoreCategory($id) + { + $category = $this->findOrFail($id); + + if ($category->deleted == 0) { + return false; + } + + $category->deleted = 0; + + $category->update(); + + return $category; + } + + protected function findOrFail($id) + { + $validator = new CategoryValidator(); + + $result = $validator->checkCategory($id); + + return $result; + } + +} diff --git a/app/Http/Admin/Services/Chapter.php b/app/Http/Admin/Services/Chapter.php new file mode 100644 index 00000000..5aee88a0 --- /dev/null +++ b/app/Http/Admin/Services/Chapter.php @@ -0,0 +1,248 @@ +findById($courseId); + + return $result; + } + + public function getCourseChapters($courseId) + { + $chapterRepo = new ChapterRepo(); + + $result = $chapterRepo->findAll([ + 'course_id' => $courseId, + 'parent_id' => 0, + 'deleted' => 0, + ]); + + return $result; + } + + public function getLessons($parentId) + { + $deleted = $this->request->getQuery('deleted', 'int', 0); + + $chapterRepo = new ChapterRepo(); + + $result = $chapterRepo->findAll([ + 'parent_id' => $parentId, + 'deleted' => $deleted, + ]); + + return $result; + } + + public function getChapter($id) + { + $chapter = $this->findOrFail($id); + + return $chapter; + } + + public function createChapter() + { + $post = $this->request->getPost(); + + $validator = new ChapterValidator(); + + $data = []; + + $data['course_id'] = $validator->checkCourseId($post['course_id']); + $data['title'] = $validator->checkTitle($post['title']); + $data['summary'] = $validator->checkSummary($post['summary']); + $data['free'] = $validator->checkFreeStatus($post['free']); + + $chapterRepo = new ChapterRepo(); + + if (isset($post['parent_id'])) { + $data['parent_id'] = $validator->checkParentId($post['parent_id']); + $data['priority'] = $chapterRepo->maxLessonPriority($post['parent_id']); + } else { + $data['priority'] = $chapterRepo->maxChapterPriority($post['course_id']); + } + + $data['priority'] += 1; + + $chapter = new ChapterModel(); + + $chapter->create($data); + + $this->updateChapterStats($chapter); + $this->updateCourseStats($chapter); + + return $chapter; + } + + public function updateChapter($id) + { + $chapter = $this->findOrFail($id); + + $post = $this->request->getPost(); + + $validator = new ChapterValidator(); + + $data = []; + + if (isset($post['title'])) { + $data['title'] = $validator->checkTitle($post['title']); + } + + if (isset($post['summary'])) { + $data['summary'] = $validator->checkSummary($post['summary']); + } + + if (isset($post['priority'])) { + $data['priority'] = $validator->checkPriority($post['priority']); + } + + if (isset($post['free'])) { + $data['free'] = $validator->checkFreeStatus($post['free']); + } + + if (isset($post['published'])) { + $data['published'] = $validator->checkPublishStatus($post['published']); + if ($post['published'] == 1) { + $validator->checkPublishAbility($chapter); + } + } + + $chapter->update($data); + + $this->updateChapterStats($chapter); + $this->updateCourseStats($chapter); + + return $chapter; + } + + public function deleteChapter($id) + { + $chapter = $this->findOrFail($id); + + if ($chapter->deleted == 1) { + return false; + } + + $chapter->deleted = 1; + + $chapter->update(); + + if ($chapter->parent_id == 0) { + $this->deleteChildChapters($chapter->id); + } + + return $chapter; + } + + public function restoreChapter($id) + { + $chapter = $this->findOrFail($id); + + if ($chapter->deleted == 0) { + return false; + } + + $chapter->deleted = 0; + + $chapter->update(); + + if ($chapter->parent_id == 0) { + $this->restoreChildChapters($chapter->id); + } + + $this->updateChapterStats($chapter); + $this->updateCourseStats($chapter); + + return $chapter; + } + + protected function deleteChildChapters($parentId) + { + $chapterRepo = new ChapterRepo(); + + $chapters = $chapterRepo->findAll(['parent_id' => $parentId]); + + if ($chapters->count() == 0) { + return; + } + + foreach ($chapters as $chapter) { + $chapter->deleted = 1; + $chapter->update(); + } + } + + protected function restoreChildChapters($parentId) + { + $chapterRepo = new ChapterRepo(); + + $chapters = $chapterRepo->findAll(['parent_id' => $parentId]); + + if ($chapters->count() == 0) { + return; + } + + foreach ($chapters as $chapter) { + $chapter->deleted = 0; + $chapter->update(); + } + } + + protected function updateChapterStats($chapter) + { + $chapterRepo = new ChapterRepo(); + + if ($chapter->parent_id > 0) { + $chapter = $chapterRepo->findById($chapter->parent_id); + } + + $lessonCount = $chapterRepo->countLessons($chapter->id); + $chapter->lesson_count = $lessonCount; + $chapter->update(); + + } + + protected function updateCourseStats($chapter) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($chapter->course_id); + + $courseStats = new CourseStatsService(); + + $courseStats->updateLessonCount($course->id); + + if ($course->model == CourseModel::MODEL_VOD) { + $courseStats->updateVodDuration($course->id); + } elseif ($course->model == CourseModel::MODEL_LIVE) { + $courseStats->updateLiveDateRange($course->id); + } elseif ($course->model == CourseModel::MODEL_ARTICLE) { + $courseStats->updateArticleWordCount($course->id); + } + } + + protected function findOrFail($id) + { + $validator = new ChapterValidator(); + + $result = $validator->checkChapter($id); + + return $result; + } + +} diff --git a/app/Http/Admin/Services/ChapterContent.php b/app/Http/Admin/Services/ChapterContent.php new file mode 100644 index 00000000..a91328a8 --- /dev/null +++ b/app/Http/Admin/Services/ChapterContent.php @@ -0,0 +1,178 @@ +findChapterVod($chapterId); + + return $result; + } + + public function getChapterLive($chapterId) + { + $chapterRepo = new ChapterRepo(); + + $result = $chapterRepo->findChapterLive($chapterId); + + return $result; + } + + public function getChapterArticle($chapterId) + { + $chapterRepo = new ChapterRepo(); + + $result = $chapterRepo->findChapterArticle($chapterId); + + return $result; + } + + public function getTranslatedFiles($fileId) + { + if (!$fileId) return; + + $vodService = new VodService(); + + $mediaInfo = $vodService->getMediaInfo($fileId); + + if (!$mediaInfo) return; + + $result = []; + + $files = $mediaInfo['MediaInfoSet'][0]['TranscodeInfo']['TranscodeSet']; + + foreach ($files as $file) { + + if ($file['Definition'] == 0) { + continue; + } + + $result[] = [ + 'play_url' => $vodService->getPlayUrl($file['Url']), + 'width' => $file['Width'], + 'height' => $file['Height'], + 'definition' => $file['Definition'], + 'duration' => kg_play_duration($file['Duration']), + 'format' => pathinfo($file['Url'], PATHINFO_EXTENSION), + 'size' => sprintf('%0.2f', $file['Size'] / 1024 / 1024), + 'bit_rate' => intval($file['Bitrate'] / 1024), + ]; + } + + return kg_array_object($result); + } + + public function updateChapterContent($chapterId) + { + $chapterRepo = new ChapterRepo(); + $chapter = $chapterRepo->findById($chapterId); + + $courseRepo = new CourseRepo(); + $course = $courseRepo->findById($chapter->course_id); + + switch ($course->model) { + case CourseModel::MODEL_VOD: + $this->updateChapterVod($chapter); + break; + case CourseModel::MODEL_LIVE: + $this->updateChapterLive($chapter); + break; + case CourseModel::MODEL_ARTICLE: + $this->updateChapterArticle($chapter); + break; + } + } + + protected function updateChapterVod($chapter) + { + $post = $this->request->getPost(); + + $validator = new ChapterVodValidator(); + + $fileId = $validator->checkFileId($post['file_id']); + + $chapterRepo = new ChapterRepo(); + + $vod = $chapterRepo->findChapterVod($chapter->id); + + if ($fileId == $vod->file_id) { + return; + } + + $vod->update(['file_id' => $fileId]); + + $attrs = $chapter->attrs; + $attrs->file_id = $fileId; + $attrs->file_status = ChapterModel::FS_UPLOADED; + $chapter->update(['attrs' => $attrs]); + } + + protected function updateChapterLive($chapter) + { + $post = $this->request->getPost(); + + $chapterRepo = new ChapterRepo(); + + $live = $chapterRepo->findChapterLive($chapter->id); + + $validator = new ChapterLiveValidator(); + + $data = []; + + $data['start_time'] = $validator->checkStartTime($post['start_time']); + $data['end_time'] = $validator->checkEndTime($post['end_time']); + + $validator->checkTimeRange($post['start_time'], $post['end_time']); + + $live->update($data); + + $attrs = $chapter->attrs; + $attrs->start_time = $data['start_time']; + $attrs->end_time = $data['end_time']; + $chapter->update(['attrs' => $attrs]); + + $courseStats = new CourseStatsService(); + $courseStats->updateLiveDateRange($chapter->course_id); + } + + protected function updateChapterArticle($chapter) + { + $post = $this->request->getPost(); + + $chapterRepo = new ChapterRepo(); + + $article = $chapterRepo->findChapterArticle($chapter->id); + + $validator = new ChapterArticleValidator(); + + $data = []; + + $data['content'] = $validator->checkContent($post['content']); + + $article->update($data); + + $attrs = $chapter->attrs; + $attrs->word_count = WordUtil::getWordCount($article->content); + $chapter->update(['attrs' => $attrs]); + + $courseStats = new CourseStatsService(); + $courseStats->updateArticleWordCount($chapter->course_id); + } + +} diff --git a/app/Http/Admin/Services/Config.php b/app/Http/Admin/Services/Config.php new file mode 100644 index 00000000..c79ccbdf --- /dev/null +++ b/app/Http/Admin/Services/Config.php @@ -0,0 +1,116 @@ +findBySection($section); + + $result = new \stdClass(); + + if ($items->count() > 0) { + foreach ($items as $item) { + $result->{$item->item_key} = $item->item_value; + } + } + + return $result; + } + + public function updateSectionConfig($section, $config) + { + $configRepo = new ConfigRepo(); + + foreach ($config as $key => $value) { + $item = $configRepo->findItem($section, $key); + if ($item) { + $item->item_value = trim($value); + $item->update(); + } + } + + $configCache = new ConfigCache(); + + $configCache->delete(); + } + + public function updateStorageConfig($section, $config) + { + $protocol = ['http://', 'https://']; + + if (isset($config['bucket_domain'])) { + $config['bucket_domain'] = str_replace($protocol, '', $config['bucket_domain']); + } + + if (isset($config['ci_domain'])) { + $config['ci_domain'] = str_replace($protocol, '', $config['ci_domain']); + } + + $this->updateSectionConfig($section, $config); + } + + public function updateVodConfig($section, $config) + { + $this->updateSectionConfig($section, $config); + } + + public function updateLiveConfig($section, $config) + { + $protocol = ['http://', 'https://']; + + if (isset($config['push_domain'])) { + $config['push_domain'] = str_replace($protocol, '', $config['push_domain']); + } + + if (isset($config['pull_domain'])) { + $config['pull_domain'] = str_replace($protocol, '', $config['pull_domain']); + } + + if (isset($config['ptt'])) { + + $ptt = $config['ptt']; + $keys = array_keys($ptt['id']); + $myPtt = []; + + foreach ($keys as $key) { + $myPtt[$key] = [ + 'id' => $ptt['id'][$key], + 'bit_rate' => $ptt['bit_rate'][$key], + 'summary' => $ptt['summary'][$key], + 'height' => $ptt['height'][$key], + ]; + } + + $config['pull_trans_template'] = kg_json_encode($myPtt); + } + + $this->updateSectionConfig($section, $config); + } + + public function updateSmserConfig($section, $config) + { + $template = $config['template']; + $keys = array_keys($template['id']); + $myTemplate = []; + + foreach ($keys as $key) { + $myTemplate[$key] = [ + 'id' => $template['id'][$key], + 'content' => $template['content'][$key], + ]; + } + + $config['template'] = kg_json_encode($myTemplate); + + $this->updateSectionConfig($section, $config); + } + +} diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php new file mode 100644 index 00000000..ec28f24f --- /dev/null +++ b/app/Http/Admin/Services/Course.php @@ -0,0 +1,485 @@ +getParams(); + + if (isset($params['xm_category_ids'])) { + $params['id'] = $this->getCategoryCourseIds($params['xm_category_ids']); + } + + $params['deleted'] = $params['deleted'] ?? 0; + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $courseRepo = new CourseRepo(); + + $pager = $courseRepo->paginate($params, $sort, $page, $limit); + + return $this->handleCourses($pager); + } + + public function getCourse($id) + { + $course = $this->findOrFail($id); + + return $course; + } + + public function createCourse() + { + $post = $this->request->getPost(); + + $validator = new CourseValidator(); + + $data = []; + + $data['model'] = $validator->checkModel($post['model']); + $data['title'] = $validator->checkTitle($post['title']); + $data['published'] = 0; + + $course = new CourseModel(); + + $course->create($data); + + return $course; + } + + public function updateCourse($id) + { + $course = $this->findOrFail($id); + + $post = $this->request->getPost(); + + $validator = new CourseValidator(); + + $data = []; + + if (isset($post['title'])) { + $data['title'] = $validator->checkTitle($post['title']); + } + + if (isset($post['cover'])) { + $data['cover'] = $validator->checkCover($post['cover']); + } + + if (isset($post['keywords'])) { + $data['keywords'] = $validator->checkKeywords($post['keywords']); + } + + if (isset($post['summary'])) { + $data['summary'] = $validator->checkSummary($post['summary']); + } + + if (isset($post['details'])) { + $data['details'] = $validator->checkDetails($post['details']); + } + + if (isset($post['level'])) { + $data['level'] = $validator->checkLevel($post['level']); + } + + if (isset($post['price_mode'])) { + if ($post['price_mode'] == 'free') { + $data['market_price'] = 0; + $data['vip_price'] = 0; + } else { + $data['market_price'] = $validator->checkMarketPrice($post['market_price']); + $data['vip_price'] = $validator->checkVipPrice($post['vip_price']); + $data['expiry'] = $validator->checkExpiry($post['expiry']); + } + } + + if (isset($post['published'])) { + $data['published'] = $validator->checkPublishStatus($post['published']); + if ($post['published'] == 1) { + $validator->checkPublishAbility($course); + } + } + + if (isset($post['xm_category_ids'])) { + $this->saveCategories($course, $post['xm_category_ids']); + } + + if (isset($post['xm_teacher_ids'])) { + $this->saveTeachers($course, $post['xm_teacher_ids']); + } + + if (isset($post['xm_course_ids'])) { + $this->saveRelatedCourses($course, $post['xm_course_ids']); + } + + $course->update($data); + + return $course; + } + + public function deleteCourse($id) + { + $course = $this->findOrFail($id); + + if ($course->deleted == 1) { + return false; + } + + $course->deleted = 1; + + $course->update(); + + return $course; + } + + public function restoreCourse($id) + { + $course = $this->findOrFail($id); + + if ($course->deleted == 0) { + return false; + } + + $course->deleted = 0; + + $course->update(); + + return $course; + } + + public function getXmCategories($id) + { + $categoryRepo = new CategoryRepo(); + + $allCategories = $categoryRepo->findAll(['deleted' => 0]); + + if ($allCategories->count() == 0) { + return []; + } + + $courseCategoryIds = []; + + if ($id > 0) { + $courseRepo = new CourseRepo(); + $courseCategories = $courseRepo->findCategories($id); + if ($courseCategories->count() > 0) { + foreach ($courseCategories as $category) { + $courseCategoryIds[] = $category->id; + } + } + } + + $list = []; + + foreach ($allCategories as $category) { + if ($category->level == 1) { + $list[$category->id] = [ + 'name' => $category->name, + 'value' => $category->id, + 'children' => [], + ]; + } + } + + foreach ($allCategories as $category) { + $selected = in_array($category->id, $courseCategoryIds); + $parentId = $category->parent_id; + if ($category->level == 2) { + $list[$parentId]['children'][] = [ + 'id' => $category->id, + 'name' => $category->name, + 'selected' => $selected, + ]; + } + } + + return array_values($list); + } + + public function getXmTeachers($id) + { + $userRepo = new UserRepo(); + + $allTeachers = $userRepo->findTeachers(); + + if ($allTeachers->count() == 0) { + return []; + } + + $courseTeacherIds = []; + + if ($id > 0) { + $courseRepo = new CourseRepo(); + $courseTeachers = $courseRepo->findTeachers($id); + if ($courseTeachers->count() > 0) { + foreach ($courseTeachers as $teacher) { + $courseTeacherIds[] = $teacher->id; + } + } + } + + $list = []; + + foreach ($allTeachers as $teacher) { + $selected = in_array($teacher->id, $courseTeacherIds); + $list[] = [ + 'id' => $teacher->id, + 'name' => $teacher->name, + 'selected' => $selected, + ]; + } + + return $list; + } + + public function getXmCourses($id) + { + $courseRepo = new CourseRepo(); + + $courses = $courseRepo->findRelatedCourses($id); + + $list = []; + + if ($courses->count() > 0) { + foreach ($courses as $course) { + $list[] = [ + 'id' => $course->id, + 'title' => $course->title, + 'selected' => true, + ]; + } + } + + return $list; + } + + public function getChapters($id) + { + $course = $this->findOrFail($id); + + $deleted = $this->request->getQuery('deleted', 'int', 0); + + $chapterRepo = new ChapterRepo(); + + $chapters = $chapterRepo->findAll([ + 'parent_id' => 0, + 'course_id' => $course->id, + 'deleted' => $deleted, + ]); + + return $chapters; + } + + protected function findOrFail($id) + { + $validator = new CourseValidator(); + + $result = $validator->checkCourse($id); + + return $result; + } + + protected function saveTeachers($course, $teacherIds) + { + $courseRepo = new CourseRepo(); + + $courseTeachers = $courseRepo->findTeachers($course->id); + + $originTeacherIds = []; + + if ($courseTeachers->count() > 0) { + foreach ($courseTeachers as $teacher) { + $originTeacherIds[] = $teacher->id; + } + } + + $newTeacherIds = explode(',', $teacherIds); + $addedTeacherIds = array_diff($newTeacherIds, $originTeacherIds); + + if ($addedTeacherIds) { + foreach ($addedTeacherIds as $teacherId) { + $courseTeacher = new CourseUserModel(); + $courseTeacher->create([ + 'course_id' => $course->id, + 'user_id' => $teacherId, + 'role_type' => CourseUserModel::ROLE_TEACHER, + 'source_type' => CourseUserModel::SOURCE_IMPORT, + 'expire_time' => strtotime('+10 years'), + ]); + } + } + + $deletedTeacherIds = array_diff($originTeacherIds, $newTeacherIds); + + if ($deletedTeacherIds) { + $courseUserRepo = new CourseUserRepo(); + foreach ($deletedTeacherIds as $teacherId) { + $courseTeacher = $courseUserRepo->findCourseTeacher($course->id, $teacherId); + if ($courseTeacher) { + $courseTeacher->delete(); + } + } + } + } + + protected function saveCategories($course, $categoryIds) + { + $courseRepo = new CourseRepo(); + + $courseCategories = $courseRepo->findCategories($course->id); + + $originCategoryIds = []; + + if ($courseCategories->count() > 0) { + foreach ($courseCategories as $category) { + $originCategoryIds[] = $category->id; + } + } + + $newCategoryIds = explode(',', $categoryIds); + $addedCategoryIds = array_diff($newCategoryIds, $originCategoryIds); + + if ($addedCategoryIds) { + foreach ($addedCategoryIds as $categoryId) { + $courseCategory = new CourseCategoryModel(); + $courseCategory->create([ + 'course_id' => $course->id, + 'category_id' => $categoryId, + ]); + } + } + + $deletedCategoryIds = array_diff($originCategoryIds, $newCategoryIds); + + if ($deletedCategoryIds) { + $courseCategoryRepo = new CourseCategoryRepo(); + foreach ($deletedCategoryIds as $categoryId) { + $courseCategory = $courseCategoryRepo->findCourseCategory($course->id, $categoryId); + if ($courseCategory) { + $courseCategory->delete(); + } + } + } + } + + protected function saveRelatedCourses($course, $courseIds) + { + $courseRepo = new CourseRepo(); + + $relatedCourses = $courseRepo->findRelatedCourses($course->id); + + $originRelatedIds = []; + + if ($relatedCourses->count() > 0) { + foreach ($relatedCourses as $relatedCourse) { + $originRelatedIds[] = $relatedCourse->id; + } + } + + $newRelatedIds = explode(',', $courseIds); + $addedRelatedIds = array_diff($newRelatedIds, $originRelatedIds); + + $courseRelatedRepo = new CourseRelatedRepo(); + + /** + * 双向关联 + */ + if ($addedRelatedIds) { + foreach ($addedRelatedIds as $relatedId) { + if ($relatedId != $course->id) { + $record = $courseRelatedRepo->findCourseRelated($course->id, $relatedId); + if (!$record) { + $courseRelated = new CourseRelatedModel(); + $courseRelated->create([ + 'course_id' => $course->id, + 'related_id' => $relatedId, + ]); + } + $record = $courseRelatedRepo->findCourseRelated($relatedId, $course->id); + if (!$record) { + $courseRelated = new CourseRelatedModel(); + $courseRelated->create([ + 'course_id' => $relatedId, + 'related_id' => $course->id, + ]); + } + } + } + } + + $deletedRelatedIds = array_diff($originRelatedIds, $newRelatedIds); + + /** + * 单向删除 + */ + if ($deletedRelatedIds) { + $courseRelatedRepo = new CourseRelatedRepo(); + foreach ($deletedRelatedIds as $relatedId) { + $courseRelated = $courseRelatedRepo->findCourseRelated($course->id, $relatedId); + if ($courseRelated) { + $courseRelated->delete(); + } + } + } + } + + protected function getCategoryCourseIds($categoryIds) + { + if (empty($categoryIds)) return []; + + $courseCategoryRepo = new CourseCategoryRepo(); + + $categoryIds = explode(',', $categoryIds); + + $relations = $courseCategoryRepo->findByCategoryIds($categoryIds); + + $result = []; + + if ($relations->count() > 0) { + foreach ($relations as $relation) { + $result[] = $relation->course_id; + } + } + + return $result; + } + + protected function handleCourses($pager) + { + if ($pager->total_items > 0) { + + $transformer = new CourseListTransformer(); + + $pipeA = $pager->items->toArray(); + $pipeB = $transformer->handleCourses($pipeA); + $pipeC = $transformer->handleCategories($pipeB); + $pipeD = $transformer->arrayToObject($pipeC); + + $pager->items = $pipeD; + } + + return $pager; + } + +} diff --git a/app/Http/Admin/Services/CourseStudent.php b/app/Http/Admin/Services/CourseStudent.php new file mode 100644 index 00000000..84c7160e --- /dev/null +++ b/app/Http/Admin/Services/CourseStudent.php @@ -0,0 +1,180 @@ +findById($courseId); + } + + public function getStudent($userId) + { + $repo = new UserRepo(); + + return $repo->findById($userId); + } + + public function getCourseStudents() + { + $pagerQuery = new PagerQuery(); + + $params = $pagerQuery->getParams(); + + $params['role_type'] = CourseUserModel::ROLE_STUDENT; + $params['deleted'] = $params['deleted'] ?? 0; + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $courseUserRepo = new CourseUserRepo(); + + $pager = $courseUserRepo->paginate($params, $sort, $page, $limit); + + return $this->handleCourseStudents($pager); + } + + public function getCourseLearnings() + { + $pagerQuery = new PagerQuery(); + + $params = $pagerQuery->getParams(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $learningRepo = new LearningRepo(); + + $pager = $learningRepo->paginate($params, $sort, $page, $limit); + + return $this->handleCourseLearnings($pager); + } + + public function getCourseStudent($courseId, $userId) + { + $result = $this->findOrFail($courseId, $userId); + + return $result; + } + + public function createCourseStudent() + { + $post = $this->request->getPost(); + + $validator = new CourseUserValidator(); + + $data = [ + 'role_type' => CourseUserModel::ROLE_STUDENT, + 'source_type' => CourseUserModel::SOURCE_IMPORT, + ]; + + $data['course_id'] = $validator->checkCourseId($post['course_id']); + $data['user_id'] = $validator->checkUserId($post['user_id']); + $data['expire_time'] = $validator->checkExpireTime($post['expire_time']); + + $validator->checkIfJoined($post['course_id'], $post['user_id']); + + $courseUser = new CourseUserModel(); + + $courseUser->create($data); + + $this->updateStudentCount($data['course_id']); + + return $courseUser; + } + + public function updateCourseStudent() + { + $post = $this->request->getPost(); + + $courseStudent = $this->findOrFail($post['course_id'], $post['user_id']); + + $validator = new CourseUserValidator(); + + $data = []; + + if (isset($post['expire_time'])) { + $data['expire_time'] = $validator->checkExpireTime($post['expire_time']); + } + + if (isset($post['locked'])) { + $data['locked'] = $validator->checkLockStatus($post['locked']); + } + + $courseStudent->update($data); + + return $courseStudent; + } + + protected function updateStudentCount($courseId) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($courseId); + + $updater = new CourseStatsUpdater(); + + $updater->updateStudentCount($course); + } + + protected function findOrFail($courseId, $userId) + { + $validator = new CourseUserValidator(); + + $result = $validator->checkCourseStudent($courseId, $userId); + + return $result; + } + + protected function handleCourseStudents($pager) + { + if ($pager->total_items > 0) { + + $transformer = new CourseUserListTransformer(); + + $pipeA = $pager->items->toArray(); + $pipeB = $transformer->handleCourses($pipeA); + $pipeC = $transformer->handleUsers($pipeB); + $pipeD = $transformer->arrayToObject($pipeC); + + $pager->items = $pipeD; + } + + return $pager; + } + + protected function handleCourseLearnings($pager) + { + if ($pager->total_items > 0) { + + $transformer = new LearningListTransformer(); + + $pipeA = $pager->items->toArray(); + $pipeB = $transformer->handleCourses($pipeA); + $pipeC = $transformer->handleChapters($pipeB); + $pipeD = $transformer->handleUsers($pipeC); + $pipeE = $transformer->arrayToObject($pipeD); + + $pager->items = $pipeE; + } + + return $pager; + } + +} diff --git a/app/Http/Admin/Services/Nav.php b/app/Http/Admin/Services/Nav.php new file mode 100644 index 00000000..5d3c16d8 --- /dev/null +++ b/app/Http/Admin/Services/Nav.php @@ -0,0 +1,179 @@ +findOrFail($id); + + return $nav; + } + + public function getParentNav($id) + { + if ($id > 0) { + $parent = NavModel::findFirst($id); + } else { + $parent = new NavModel(); + $parent->id = 0; + $parent->level = 0; + } + + return $parent; + } + + public function getTopNavs() + { + $navRepo = new NavRepo(); + + $navs = $navRepo->findAll([ + 'parent_id' => 0, + 'position' => 'top', + 'deleted' => 0, + ]); + + return $navs; + } + + public function getChildNavs($parentId) + { + $deleted = $this->request->getQuery('deleted', 'int', 0); + + $navRepo = new NavRepo(); + + $navs = $navRepo->findAll([ + 'parent_id' => $parentId, + 'deleted' => $deleted, + ]); + + return $navs; + } + + public function createNav() + { + $post = $this->request->getPost(); + + $validator = new NavValidator(); + + $data = [ + 'parent_id' => 0, + 'published' => 1, + ]; + + $parent = null; + + if ($post['parent_id'] > 0) { + $parent = $validator->checkParent($post['parent_id']); + $data['parent_id'] = $parent->id; + } + + $data['name'] = $validator->checkName($post['name']); + $data['priority'] = $validator->checkPriority($post['priority']); + $data['url'] = $validator->checkUrl($post['url']); + $data['target'] = $validator->checkTarget($post['target']); + $data['position'] = $validator->checkPosition($post['position']); + $data['published'] = $validator->checkPublishStatus($post['published']); + + $nav = new NavModel(); + + $nav->create($data); + + if ($parent) { + $nav->path = $parent->path . $nav->id . ','; + $nav->level = $parent->level + 1; + } else { + $nav->path = ',' . $nav->id . ','; + $nav->level = 1; + } + + $nav->update(); + + return $nav; + } + + public function updateNav($id) + { + $nav = $this->findOrFail($id); + + $post = $this->request->getPost(); + + $validator = new NavValidator(); + + $data = []; + + if (isset($post['name'])) { + $data['name'] = $validator->checkName($post['name']); + } + + if (isset($post['position'])) { + $data['position'] = $validator->checkPosition($post['position']); + } + + if (isset($post['url'])) { + $data['url'] = $validator->checkUrl($post['url']); + } + + if (isset($post['target'])) { + $data['target'] = $validator->checkTarget($post['target']); + } + + if (isset($post['priority'])) { + $data['priority'] = $validator->checkPriority($post['priority']); + } + + if (isset($post['published'])) { + $data['published'] = $validator->checkPublishStatus($post['published']); + } + + $nav->update($data); + + return $nav; + } + + public function deleteNav($id) + { + $nav = $this->findOrFail($id); + + if ($nav->deleted == 1) { + return false; + } + + $nav->deleted = 1; + + $nav->update(); + + return $nav; + } + + public function restoreNav($id) + { + $nav = $this->findOrFail($id); + + if ($nav->deleted == 0) { + return false; + } + + $nav->deleted = 0; + + $nav->update(); + + return $nav; + } + + protected function findOrFail($id) + { + $validator = new NavValidator(); + + $result = $validator->checkNav($id); + + return $result; + } + +} diff --git a/app/Http/Admin/Services/Order.php b/app/Http/Admin/Services/Order.php new file mode 100644 index 00000000..78e065eb --- /dev/null +++ b/app/Http/Admin/Services/Order.php @@ -0,0 +1,103 @@ +getParams(); + $sort = $pageQuery->getSort(); + $page = $pageQuery->getPage(); + $limit = $pageQuery->getLimit(); + + $orderRepo = new OrderRepo(); + + $pager = $orderRepo->paginate($params, $sort, $page, $limit); + + return $this->handleOrders($pager); + } + + public function getTrades($sn) + { + $orderRepo = new OrderRepo(); + + $trades = $orderRepo->findTrades($sn); + + return $trades; + } + + public function getRefunds($sn) + { + $orderRepo = new OrderRepo(); + + $trades = $orderRepo->findRefunds($sn); + + return $trades; + } + + public function getUser($userId) + { + $userRepo = new UserRepo(); + + $user = $userRepo->findById($userId); + + return $user; + } + + public function getOrder($id) + { + $order = $this->findOrFail($id); + + return $order; + } + + public function closeOrder($id) + { + $order = $this->findOrFail($id); + + if ($order->status == OrderModel::STATUS_PENDING) { + $order->status = OrderModel::STATUS_CLOSED; + $order->update(); + } + + return $order; + } + + protected function findOrFail($id) + { + $validator = new OrderValidator(); + + $result = $validator->checkOrder($id); + + return $result; + } + + protected function handleOrders($pager) + { + if ($pager->total_items > 0) { + + $transformer = new OrderListTransformer(); + + $pipeA = $pager->items->toArray(); + $pipeB = $transformer->handleItems($pipeA); + $pipeC = $transformer->handleUsers($pipeB); + $pipeD = $transformer->arrayToObject($pipeC); + + $pager->items = $pipeD; + } + + return $pager; + } + +} diff --git a/app/Http/Admin/Services/Package.php b/app/Http/Admin/Services/Package.php new file mode 100644 index 00000000..f9a05388 --- /dev/null +++ b/app/Http/Admin/Services/Package.php @@ -0,0 +1,246 @@ +getParams(); + + $params['deleted'] = $params['deleted'] ?? 0; + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $pageRepo = new PackageRepo(); + + $pager = $pageRepo->paginate($params, $sort, $page, $limit); + + return $pager; + } + + public function getPackage($id) + { + $package = $this->findOrFail($id); + + return $package; + } + + public function createPackage() + { + $post = $this->request->getPost(); + + $validator = new PackageValidator(); + + $data = []; + + $data['title'] = $validator->checkTitle($post['title']); + $data['summary'] = $validator->checkSummary($post['summary']); + + $package = new PackageModel(); + + $package->create($data); + + return $package; + } + + public function updatePackage($id) + { + $package = $this->findOrFail($id); + + $post = $this->request->getPost(); + + $validator = new PackageValidator(); + + $data = []; + + if (isset($post['title'])) { + $data['title'] = $validator->checkTitle($post['title']); + } + + if (isset($post['summary'])) { + $data['summary'] = $validator->checkSummary($post['summary']); + } + + if (isset($post['market_price'])) { + $data['market_price'] = $validator->checkMarketPrice($post['market_price']); + } + + if (isset($post['vip_price'])) { + $data['vip_price'] = $validator->checkVipPrice($post['vip_price']); + } + + if (isset($post['published'])) { + $data['published'] = $validator->checkPublishStatus($post['published']); + } + + if (isset($post['xm_course_ids'])) { + $this->saveCourses($package, $post['xm_course_ids']); + } + + $package->update($data); + + $this->updateCourseCount($package); + + return $package; + } + + public function deletePackage($id) + { + $package = $this->findOrFail($id); + + if ($package->deleted == 1) { + return false; + } + + $package->deleted = 1; + + $package->update(); + + return $package; + } + + public function restorePackage($id) + { + $package = $this->findOrFail($id); + + if ($package->deleted == 0) { + return false; + } + + $package->deleted = 0; + + $package->update(); + + return $package; + } + + public function getGuidingCourses($courseIds) + { + if (!$courseIds) return []; + + $courseRepo = new CourseRepo(); + + $ids = explode(',', $courseIds); + + $courses = $courseRepo->findByIds($ids); + + return $courses; + } + + public function getGuidingPrice($courses) + { + $totalMarketPrice = $totalVipPrice = 0; + + if ($courses) { + foreach ($courses as $course) { + $totalMarketPrice += $course->market_price; + $totalVipPrice += $course->vip_price; + } + } + + $sgtMarketPrice = sprintf('%0.2f', intval($totalMarketPrice * 0.9)); + $sgtVipPrice = sprintf('%0.2f', intval($totalVipPrice * 0.8)); + + $price = new \stdClass(); + $price->market_price = $sgtMarketPrice; + $price->vip_price = $sgtVipPrice; + + return $price; + } + + public function getXmCourses($id) + { + $packageRepo = new PackageRepo(); + + $courses = $packageRepo->findCourses($id); + + $list = []; + + if ($courses->count() > 0) { + foreach ($courses as $course) { + $list[] = [ + 'id' => $course->id, + 'title' => $course->title, + 'selected' => true, + ]; + } + } + + return $list; + } + + protected function saveCourses($package, $courseIds) + { + $packageRepo = new PackageRepo(); + + $courses = $packageRepo->findCourses($package->id); + + $originCourseIds = []; + + if ($courses->count() > 0) { + foreach ($courses as $course) { + $originCourseIds[] = $course->id; + } + } + + $newCourseIds = explode(',', $courseIds); + $addedCourseIds = array_diff($newCourseIds, $originCourseIds); + + if ($addedCourseIds) { + foreach ($addedCourseIds as $courseId) { + $coursePackage = new CoursePackageModel(); + $coursePackage->create([ + 'course_id' => $courseId, + 'package_id' => $package->id, + ]); + } + } + + $deletedCourseIds = array_diff($originCourseIds, $newCourseIds); + + if ($deletedCourseIds) { + $coursePackageRepo = new CoursePackageRepo(); + foreach ($deletedCourseIds as $courseId) { + $coursePackage = $coursePackageRepo->findCoursePackage($courseId, $package->id); + if ($coursePackage) { + $coursePackage->delete(); + } + } + } + } + + protected function updateCourseCount($package) + { + $packageRepo = new PackageRepo(); + + $courseCount = $packageRepo->countCourses($package->id); + + $package->course_count = $courseCount; + + $package->update(); + } + + protected function findOrFail($id) + { + $validator = new PackageValidator(); + + $result = $validator->checkPackage($id); + + return $result; + } + +} diff --git a/app/Http/Admin/Services/Page.php b/app/Http/Admin/Services/Page.php new file mode 100644 index 00000000..023a863c --- /dev/null +++ b/app/Http/Admin/Services/Page.php @@ -0,0 +1,124 @@ +getParams(); + + $params['deleted'] = $params['deleted'] ?? 0; + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $pageRepo = new PageRepo(); + + $pager = $pageRepo->paginate($params, $sort, $page, $limit); + + return $pager; + } + + public function getPage($id) + { + $page = $this->findOrFail($id); + + return $page; + } + + public function createPage() + { + $post = $this->request->getPost(); + + $validator = new PageValidator(); + + $data = []; + + $data['title'] = $validator->checkTitle($post['title']); + $data['content'] = $validator->checkContent($post['content']); + $data['published'] = $validator->checkPublishStatus($post['published']); + + $page = new PageModel(); + + $page->create($data); + + return $page; + } + + public function updatePage($id) + { + $page = $this->findOrFail($id); + + $post = $this->request->getPost(); + + $validator = new PageValidator(); + + $data = []; + + if (isset($post['title'])) { + $data['title'] = $validator->checkTitle($post['title']); + } + + if (isset($post['content'])) { + $data['content'] = $validator->checkContent($post['content']); + } + + if (isset($post['published'])) { + $data['published'] = $validator->checkPublishStatus($post['published']); + } + + $page->update($data); + + return $page; + } + + public function deletePage($id) + { + $page = $this->findOrFail($id); + + if ($page->deleted == 1) { + return false; + } + + $page->deleted = 1; + + $page->update(); + + return $page; + } + + public function restorePage($id) + { + $page = $this->findOrFail($id); + + if ($page->deleted == 0) { + return false; + } + + $page->deleted = 0; + + $page->update(); + + return $page; + } + + protected function findOrFail($id) + { + $validator = new PageValidator(); + + $result = $validator->checkPage($id); + + return $result; + } + +} diff --git a/app/Http/Admin/Services/PaymentTest.php b/app/Http/Admin/Services/PaymentTest.php new file mode 100644 index 00000000..388ef269 --- /dev/null +++ b/app/Http/Admin/Services/PaymentTest.php @@ -0,0 +1,82 @@ +getDI()->get('auth')->getAuthUser(); + + $order = new OrderModel(); + + $order->subject = '测试 - 支付测试0.01元'; + $order->amount = 0.01; + $order->user_id = $authUser->id; + $order->item_type = OrderModel::TYPE_TEST; + $order->create(); + + return $order; + } + + /** + * 创建交易 + * + * @param OrderModel $order + * @return TradeModel $trade + */ + public function createTestTrade($order) + { + $trade = new TradeModel(); + + $trade->user_id = $order->user_id; + $trade->order_sn = $order->sn; + $trade->subject = $order->subject; + $trade->amount = $order->amount; + $trade->channel = TradeModel::CHANNEL_ALIPAY; + $trade->create(); + + return $trade; + } + + /** + * 获取订单状态 + * + * @param string $sn + * @return string + */ + public function getTestStatus($sn) + { + $tradeRepo = new TradeRepo(); + + $trade = $tradeRepo->findBySn($sn); + + return $trade->status; + } + + /** + * 获取测试二维码 + * + * @param TradeModel $trade + * @return mixed + */ + abstract public function getTestQrCode($trade); + + /** + * 取消测试订单 + * + * @param string $sn + */ + abstract public function cancelTestOrder($sn); + +} diff --git a/app/Http/Admin/Services/Refund.php b/app/Http/Admin/Services/Refund.php new file mode 100644 index 00000000..a4af36f5 --- /dev/null +++ b/app/Http/Admin/Services/Refund.php @@ -0,0 +1,122 @@ +getParams(); + $sort = $pageQuery->getSort(); + $page = $pageQuery->getPage(); + $limit = $pageQuery->getLimit(); + + $refundRepo = new RefundRepo(); + + $pager = $refundRepo->paginate($params, $sort, $page, $limit); + + return $this->handleRefunds($pager); + } + + public function getRefund($id) + { + $refund = $this->findOrFail($id); + + return $refund; + } + + public function getTrade($sn) + { + $tradeRepo = new TradeRepo(); + + $trade = $tradeRepo->findBySn($sn); + + return $trade; + } + + public function getOrder($sn) + { + $orderRepo = new OrderRepo(); + + $order = $orderRepo->findBySn($sn); + + return $order; + } + + public function getUser($id) + { + $userRepo = new UserRepo(); + + $user = $userRepo->findById($id); + + return $user; + } + + public function reviewRefund($id) + { + $refund = $this->findOrFail($id); + + $post = $this->request->getPost(); + + $validator = new RefundValidator(); + + $data = []; + + $validator->checkIfAllowReview($refund); + + $data['status'] = $validator->checkReviewStatus($post['status']); + $data['review_note'] = $validator->checkReviewNote($post['review_note']); + + $refund->update($data); + + $task = new TaskModel(); + + $task->item_id = $refund->id; + $task->item_type = TaskModel::TYPE_REFUND; + $task->item_info = ['refund' => $refund->toArray()]; + $task->priority = TaskModel::PRIORITY_HIGH; + $task->status = TaskModel::STATUS_PENDING; + + $task->create(); + + return $refund; + } + + protected function findOrFail($id) + { + $validator = new RefundValidator(); + + $result = $validator->checkRefund($id); + + return $result; + } + + protected function handleRefunds($pager) + { + if ($pager->total_items > 0) { + + $transformer = new RefundListTransformer(); + + $pipeA = $pager->items->toArray(); + $pipeB = $transformer->handleUsers($pipeA); + $pipeC = $transformer->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + +} diff --git a/app/Http/Admin/Services/Review.php b/app/Http/Admin/Services/Review.php new file mode 100644 index 00000000..88594afe --- /dev/null +++ b/app/Http/Admin/Services/Review.php @@ -0,0 +1,140 @@ +getParams(); + + $params['deleted'] = $params['deleted'] ?? 0; + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $reviewRepo = new ReviewRepo(); + + $pager = $reviewRepo->paginate($params, $sort, $page, $limit); + + return $this->handleReviews($pager); + } + + public function getCourse($courseId) + { + $courseRepo = new CourseRepo(); + + $result = $courseRepo->findById($courseId); + + return $result; + } + + public function getReview($id) + { + $result = $this->findOrFail($id); + + return $result; + } + + public function updateReview($id) + { + $review = $this->findOrFail($id); + + $post = $this->request->getPost(); + + $validator = new ReviewValidator(); + + $data = []; + + if (isset($post['content'])) { + $data['content'] = $validator->checkContent($post['content']); + } + + if (isset($post['rating'])) { + $data['rating'] = $validator->checkRating($post['rating']); + } + + if (isset($post['published'])) { + $data['published'] = $validator->checkPublishStatus($post['published']); + } + + $review->update($data); + + return $review; + } + + public function deleteReview($id) + { + $review = $this->findOrFail($id); + + if ($review->deleted == 1) return false; + + $review->deleted = 1; + + $review->update(); + + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($review->course_id); + + $course->review_count -= 1; + + $course->update(); + } + + public function restoreReview($id) + { + $review = $this->findOrFail($id); + + if ($review->deleted == 0) return false; + + $review->deleted = 0; + + $review->update(); + + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($review->course_id); + + $course->review_count += 1; + + $course->update(); + } + + protected function findOrFail($id) + { + $validator = new ReviewValidator(); + + $result = $validator->checkReview($id); + + return $result; + } + + protected function handleReviews($pager) + { + if ($pager->total_items > 0) { + + $transformer = new ReviewListTransformer(); + + $pipeA = $pager->items->toArray(); + $pipeB = $transformer->handleCourses($pipeA); + $pipeC = $transformer->handleUsers($pipeB); + $pipeD = $transformer->arrayToObject($pipeC); + + $pager->items = $pipeD; + } + + return $pager; + } + +} diff --git a/app/Http/Admin/Services/Role.php b/app/Http/Admin/Services/Role.php new file mode 100644 index 00000000..ced78b5a --- /dev/null +++ b/app/Http/Admin/Services/Role.php @@ -0,0 +1,166 @@ +request->getQuery('deleted', 'int', 0); + + $roleRepo = new RoleRepo(); + + $roles = $roleRepo->findAll(['deleted' => $deleted]); + + return $roles; + } + + public function getRole($id) + { + $role = $this->findOrFail($id); + + return $role; + } + + public function createRole() + { + $post = $this->request->getPost(); + + $validator = new RoleValidator(); + + $data = []; + + $data['name'] = $validator->checkName($post['name']); + $data['summary'] = $validator->checkSummary($post['summary']); + $data['type'] = RoleModel::TYPE_CUSTOM; + + $role = new RoleModel(); + + $role->create($data); + + return $role; + } + + public function updateRole($id) + { + $role = $this->findOrFail($id); + + $post = $this->request->getPost(); + + $validator = new RoleValidator(); + + $data = []; + + $data['name'] = $validator->checkName($post['name']); + $data['summary'] = $validator->checkSummary($post['summary']); + $data['routes'] = $validator->checkRoutes($post['routes']); + $data['routes'] = $this->handleRoutes($data['routes']); + + $role->update($data); + + return $role; + } + + public function deleteRole($id) + { + $role = $this->findOrFail($id); + + if ($role->deleted == 1) { + return false; + } + + if ($role->type == RoleModel::TYPE_SYSTEM) { + return false; + } + + $role->deleted = 1; + + $role->update(); + + return $role; + } + + public function restoreRole($id) + { + $role = $this->findOrFail($id); + + if ($role->deleted == 0) { + return false; + } + + $role->deleted = 0; + + $role->update(); + + return $role; + } + + protected function findOrFail($id) + { + $validator = new RoleValidator(); + + $result = $validator->checkRole($id); + + return $result; + } + + /** + * 处理路由权限(补充关联权限) + * + * 新增操作 => 补充列表权限 + * 修改操作 => 补充列表权限 + * 删除操作 => 补充还原权限 + * 课程操作 => 补充章节权限 + * 搜索操作 => 补充列表权限 + * + * @param array $routes + * @return array + */ + protected function handleRoutes($routes) + { + if (!$routes) return []; + + $list = []; + + foreach ($routes as $route) { + $list [] = $route; + if (strpos($route, '.add')) { + $list[] = str_replace('.add', '.create', $route); + $list[] = str_replace('.add', '.list', $route); + } elseif (strpos($route, '.edit')) { + $list[] = str_replace('.edit', '.update', $route); + $list[] = str_replace('.edit', '.list', $route); + } elseif (strpos($route, '.delete')) { + $list[] = str_replace('.delete', '.restore', $route); + } elseif (strpos($route, '.search')) { + $list[] = str_replace('.search', '.list', $route); + } + } + + if (in_array('admin.course.list', $routes)) { + $list[] = 'admin.course.chapters'; + $list[] = 'admin.chapter.sections'; + } + + if (array_intersect(['admin.course.add', 'admin.course.edit'], $routes)) { + $list[] = 'admin.chapter.add'; + $list[] = 'admin.chapter.edit'; + $list[] = 'admin.chapter.content'; + } + + if (in_array('admin.course.delete', $routes)) { + $list[] = 'admin.chapter.delete'; + $list[] = 'admin.chapter.restore'; + } + + $result = array_values(array_unique($list)); + + return $result; + } + +} diff --git a/app/Http/Admin/Services/Service.php b/app/Http/Admin/Services/Service.php new file mode 100644 index 00000000..11c6b75a --- /dev/null +++ b/app/Http/Admin/Services/Service.php @@ -0,0 +1,8 @@ +auth = $this->getDI()->get('auth'); + } + + public function login() + { + $post = $this->request->getPost(); + + $validator = new UserValidator(); + + $user = $validator->checkLoginAccount($post['account']); + + $validator->checkLoginPassword($user, $post['password']); + + $validator->checkAdminLogin($user); + + $config = new Config(); + + $captcha = $config->getSectionConfig('captcha'); + + /** + * 验证码是一次性的,放到最后检查,减少第三方调用 + */ + if ($captcha->enabled) { + $validator->checkCaptchaCode($post['ticket'], $post['rand']); + } + + $this->auth->setAuthUser($user); + } + + public function logout() + { + $this->auth->removeAuthUser(); + } + +} diff --git a/app/Http/Admin/Services/Slide.php b/app/Http/Admin/Services/Slide.php new file mode 100644 index 00000000..f7dd7840 --- /dev/null +++ b/app/Http/Admin/Services/Slide.php @@ -0,0 +1,161 @@ +getParams(); + + $params['deleted'] = $params['deleted'] ?? 0; + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $slideRepo = new SlideRepo(); + + $pager = $slideRepo->paginate($params, $sort, $page, $limit); + + return $pager; + } + + public function getSlide($id) + { + $slide = $this->findOrFail($id); + + return $slide; + } + + public function createSlide() + { + $post = $this->request->getPost(); + + $validator = new SlideValidator(); + + $data['title'] = $validator->checkTitle($post['title']); + $data['target'] = $validator->checkTarget($post['target']); + + if ($post['target'] == SlideModel::TARGET_COURSE) { + $course = $validator->checkCourse($post['content']); + $data['content'] = $course->id; + $data['cover'] = $course->cover; + $data['summary'] = $course->summary; + } elseif ($post['target'] == SlideModel::TARGET_PAGE) { + $page = $validator->checkPage($post['content']); + $data['content'] = $page->id; + } elseif ($post['target'] == SlideModel::TARGET_LINK) { + $data['content'] = $validator->checkLink($post['content']); + } + + $data['start_time'] = strtotime(date('Y-m-d')); + $data['end_time'] = strtotime('+15 days', $data['start_time']); + $data['priority'] = 10; + $data['published'] = 0; + + $slide = new SlideModel(); + + $slide->create($data); + + return $slide; + } + + public function updateSlide($id) + { + $slide = $this->findOrFail($id); + + $post = $this->request->getPost(); + + $validator = new SlideValidator(); + + $data = []; + + if (isset($post['title'])) { + $data['title'] = $validator->checkTitle($post['title']); + } + + if (isset($post['summary'])) { + $data['summary'] = $validator->checkSummary($post['summary']); + } + + if (isset($post['cover'])) { + $data['cover'] = $validator->checkCover($post['cover']); + } + + if (isset($post['content'])) { + if ($slide->target == SlideModel::TARGET_COURSE) { + $course = $validator->checkCourse($post['content']); + $data['content'] = $course->id; + } elseif ($slide->target == SlideModel::TARGET_PAGE) { + $page = $validator->checkPage($post['content']); + $data['content'] = $page->id; + } elseif ($slide->target == SlideModel::TARGET_LINK) { + $data['content'] = $validator->checkLink($post['content']); + } + } + + if (isset($post['priority'])) { + $data['priority'] = $validator->checkPriority($post['priority']); + } + + if (isset($post['start_time']) || isset($post['end_time'])) { + $data['start_time'] = $validator->checkStartTime($post['start_time']); + $data['end_time'] = $validator->checkEndTime($post['end_time']); + $validator->checkTimeRange($post['start_time'], $post['end_time']); + } + + if (isset($post['published'])) { + $data['published'] = $validator->checkPublishStatus($post['published']); + } + + $slide->update($data); + + return $slide; + } + + public function deleteSlide($id) + { + $slide = $this->findOrFail($id); + + if ($slide->deleted == 1) return false; + + $slide->deleted = 1; + + $slide->update(); + + return $slide; + } + + public function restoreSlide($id) + { + $slide = $this->findOrFail($id); + + if ($slide->deleted == 0) return false; + + $slide->deleted = 0; + + $slide->update(); + + return $slide; + } + + protected function findOrFail($id) + { + $validator = new SlideValidator(); + + $result = $validator->checkSlide($id); + + return $result; + } + +} diff --git a/app/Http/Admin/Services/Trade.php b/app/Http/Admin/Services/Trade.php new file mode 100644 index 00000000..1b88d152 --- /dev/null +++ b/app/Http/Admin/Services/Trade.php @@ -0,0 +1,130 @@ +getParams(); + $sort = $pageQuery->getSort(); + $page = $pageQuery->getPage(); + $limit = $pageQuery->getLimit(); + + $tradeRepo = new TradeRepo(); + + $pager = $tradeRepo->paginate($params, $sort, $page, $limit); + + return $this->handleTrades($pager); + } + + public function getTrade($id) + { + $tradeRepo = new TradeRepo(); + + $trade = $tradeRepo->findById($id); + + return $trade; + } + + public function getOrder($sn) + { + $orderRepo = new OrderRepo(); + + $order = $orderRepo->findBySn($sn); + + return $order; + } + + public function getRefunds($sn) + { + $tradeRepo = new TradeRepo(); + + $refunds = $tradeRepo->findRefunds($sn); + + return $refunds; + } + + public function getUser($id) + { + $userRepo = new UserRepo(); + + $user = $userRepo->findById($id); + + return $user; + } + + public function closeTrade($id) + { + $trade = $this->findOrFail($id); + + $validator = new TradeValidator(); + + $validator->checkIfAllowClose($trade); + + $trade->status = TradeModel::STATUS_CLOSED; + $trade->update(); + + return $trade; + } + + public function refundTrade($id) + { + $trade = $this->findOrFail($id); + + $validator = new TradeValidator(); + + $validator->checkIfAllowRefund($trade); + + $refund = new RefundModel(); + + $refund->subject = $trade->subject; + $refund->amount = $trade->amount; + $refund->user_id = $trade->user_id; + $refund->order_sn = $trade->order_sn; + $refund->trade_sn = $trade->sn; + $refund->apply_reason = '后台人工申请退款'; + + $refund->create(); + + return $trade; + } + + protected function findOrFail($id) + { + $validator = new TradeValidator(); + + $result = $validator->checkTrade($id); + + return $result; + } + + protected function handleTrades($pager) + { + if ($pager->total_items > 0) { + + $transformer = new TradeListTransformer(); + + $pipeA = $pager->items->toArray(); + $pipeB = $transformer->handleUsers($pipeA); + $pipeC = $transformer->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + +} diff --git a/app/Http/Admin/Services/User.php b/app/Http/Admin/Services/User.php new file mode 100644 index 00000000..d11ca290 --- /dev/null +++ b/app/Http/Admin/Services/User.php @@ -0,0 +1,181 @@ +findAll(['deleted' => 0]); + + return $roles; + } + + public function getUsers() + { + $pageQuery = new PaginateQuery(); + + $params = $pageQuery->getParams(); + $sort = $pageQuery->getSort(); + $page = $pageQuery->getPage(); + $limit = $pageQuery->getLimit(); + + $userRepo = new UserRepo(); + + $pager = $userRepo->paginate($params, $sort, $page, $limit); + + $result = $this->handleUsers($pager); + + return $result; + } + + public function getUser($id) + { + $user = $this->findOrFail($id); + + return $user; + } + + public function createUser() + { + $post = $this->request->getPost(); + + $validator = new UserValidator(); + + $name = $validator->checkName($post['name']); + $password = $validator->checkPassword($post['password']); + $eduRole = $validator->checkEduRole($post['edu_role']); + $adminRole = $validator->checkAdminRole($post['admin_role']); + + $validator->checkIfNameTaken($name); + + $data = []; + + $data['name'] = $name; + $data['salt'] = PasswordUtil::salt(); + $data['password'] = PasswordUtil::hash($password, $data['salt']); + $data['edu_role'] = $eduRole; + $data['admin_role'] = $adminRole; + + $user = new UserModel(); + + $user->create($data); + + if ($user->admin_role > 0) { + $this->updateAdminUserCount($user->admin_role); + } + + return $user; + } + + public function updateUser($id) + { + $user = $this->findOrFail($id); + + $post = $this->request->getPost(); + + $validator = new UserValidator(); + + $data = []; + + if (isset($post['title'])) { + $data['title'] = $validator->checkTitle($post['title']); + } + + if (isset($post['about'])) { + $data['about'] = $validator->checkAbout($post['about']); + } + + if (isset($post['edu_role'])) { + $data['edu_role'] = $validator->checkEduRole($post['edu_role']); + } + + if (isset($post['admin_role'])) { + $data['admin_role'] = $validator->checkAdminRole($post['admin_role']); + } + + if (isset($post['locked'])) { + $data['locked'] = $validator->checkLockStatus($post['locked']); + } + + if (isset($post['locked_expiry'])) { + $data['locked_expiry'] = $validator->checkLockExpiry($post['locked_expiry']); + if ($data['locked_expiry'] < time()) { + $data['locked'] = 0; + } + } + + $oldAdminRole = $user->admin_role; + + $user->update($data); + + if ($oldAdminRole > 0) { + $this->updateAdminUserCount($oldAdminRole); + } + + if ($user->admin_role > 0) { + $this->updateAdminUserCount($user->admin_role); + } + + return $user; + } + + protected function findOrFail($id) + { + $validator = new UserValidator(); + + $result = $validator->checkUser($id); + + return $result; + } + + protected function updateAdminUserCount($roleId) + { + if (!$roleId) { + return false; + } + + $roleRepo = new RoleRepo(); + + $role = $roleRepo->findById($roleId); + + if (!$role) { + return false; + } + + $userCount = $roleRepo->countUsers($roleId); + + $role->user_count = $userCount; + + $role->update(); + } + + protected function handleUsers($pager) + { + if ($pager->total_items > 0) { + + $transformer = new UserListTransformer(); + + $pipeA = $pager->items->toArray(); + $pipeB = $transformer->handleAdminRoles($pipeA); + $pipeC = $transformer->handleEduRoles($pipeB); + $pipeD = $transformer->arrayToObject($pipeC); + + $pager->items = $pipeD; + } + + return $pager; + } + +} diff --git a/app/Http/Admin/Services/WxpayTest.php b/app/Http/Admin/Services/WxpayTest.php new file mode 100644 index 00000000..eb71c586 --- /dev/null +++ b/app/Http/Admin/Services/WxpayTest.php @@ -0,0 +1,41 @@ + $trade->sn, + 'total_fee' => 100 * $trade->amount, + 'body' => $trade->subject, + ]; + + $wxpayService = new WxpayService(); + $qrcode = $wxpayService->qrcode($outOrder); + $result = $qrcode ?: false; + + return $result; + } + + /** + * 取消测试订单 + * + * @param string $sn + */ + public function cancelTestOrder($sn) + { + + } + +} diff --git a/app/Http/Admin/Services/XmCourse.php b/app/Http/Admin/Services/XmCourse.php new file mode 100644 index 00000000..dcc20efa --- /dev/null +++ b/app/Http/Admin/Services/XmCourse.php @@ -0,0 +1,50 @@ +getParams(); + + $params['deleted'] = 0; + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $courseRepo = new CourseRepo(); + + $pager = $courseRepo->paginate($params, $sort, $page, $limit); + + return $pager; + } + + public function getPaidCourses() + { + $pagerQuery = new PagerQuery(); + + $params = $pagerQuery->getParams(); + + $params['free'] = 0; + $params['deleted'] = 0; + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $courseRepo = new CourseRepo(); + + $pager = $courseRepo->paginate($params, $sort, $page, $limit); + + return $pager; + } + +} diff --git a/app/Http/Admin/Views/audit/list.volt b/app/Http/Admin/Views/audit/list.volt new file mode 100644 index 00000000..f4e8277b --- /dev/null +++ b/app/Http/Admin/Views/audit/list.volt @@ -0,0 +1,76 @@ +
+
+ + 操作记录 + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + + + {% endfor %} + +
用户编号用户名称用户IP请求路由请求路径请求时间请求内容
{{ item.user_id }}{{ item.user_name }}{{ item.user_ip }}{{ item.req_route }}{{ item.req_path }}{{ date('Y-m-d H:i:s',item.created_at) }} + +
+ +{{ partial('partials/pager') }} +{{ partial('partials/ip2region') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/audit/search.volt b/app/Http/Admin/Views/audit/search.volt new file mode 100644 index 00000000..a27fa54d --- /dev/null +++ b/app/Http/Admin/Views/audit/search.volt @@ -0,0 +1,72 @@ +
+ +
+ 搜索记录 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
-
+
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/audit/show.volt b/app/Http/Admin/Views/audit/show.volt new file mode 100644 index 00000000..ebdf1603 --- /dev/null +++ b/app/Http/Admin/Views/audit/show.volt @@ -0,0 +1,12 @@ +

+
+
diff --git a/app/Http/Admin/Views/category/add.volt b/app/Http/Admin/Views/category/add.volt
new file mode 100644
index 00000000..425c0eb4
--- /dev/null
+++ b/app/Http/Admin/Views/category/add.volt
@@ -0,0 +1,52 @@
+
+ +
+ 添加分类 +
+ + {% if parent_id > 0 %} +
+ +
+ +
+
+ {% endif %} + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/category/edit.volt b/app/Http/Admin/Views/category/edit.volt new file mode 100644 index 00000000..d023e176 --- /dev/null +++ b/app/Http/Admin/Views/category/edit.volt @@ -0,0 +1,37 @@ +
+ +
+ 编辑分类 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/category/list.volt b/app/Http/Admin/Views/category/list.volt new file mode 100644 index 00000000..05e3948f --- /dev/null +++ b/app/Http/Admin/Views/category/list.volt @@ -0,0 +1,125 @@ +
+
+ + {% if parent.id > 0 %} + + 返回 + + {{ parent.name }} + {% endif %} + 分类管理 + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + {% for item in categories %} + + + {% if item.level < 2 %} + + {% else %} + + {% endif %} + + + + + + + {% endfor %} + +
编号名称层级课程数排序发布操作
{{ item.id }}{{ item.name }}{{ item.name }}{{ item.level }}{{ item.course_count }} +
+ + +
+
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/chapter/add_chapter.volt b/app/Http/Admin/Views/chapter/add_chapter.volt new file mode 100644 index 00000000..89884c6e --- /dev/null +++ b/app/Http/Admin/Views/chapter/add_chapter.volt @@ -0,0 +1,30 @@ +
+ +
+ 添加章节 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/chapter/add_lesson.volt b/app/Http/Admin/Views/chapter/add_lesson.volt new file mode 100644 index 00000000..d2b9e806 --- /dev/null +++ b/app/Http/Admin/Views/chapter/add_lesson.volt @@ -0,0 +1,50 @@ +
+ +
+ 添加课时 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/chapter/edit_chapter.volt b/app/Http/Admin/Views/chapter/edit_chapter.volt new file mode 100644 index 00000000..a684889c --- /dev/null +++ b/app/Http/Admin/Views/chapter/edit_chapter.volt @@ -0,0 +1,36 @@ +
+ +
+ 编辑章节 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/chapter/edit_lesson.volt b/app/Http/Admin/Views/chapter/edit_lesson.volt new file mode 100644 index 00000000..cc6044c4 --- /dev/null +++ b/app/Http/Admin/Views/chapter/edit_lesson.volt @@ -0,0 +1,37 @@ +{%- macro content_title(model) %} + {% if model == 'vod' %} + 点播信息 + {% elseif model == 'live' %} + 直播信息 + {% elseif model == 'article' %} + 文章信息 + {% endif %} +{%- endmacro %} + +
+ 编辑课时 +
+ +
+ + + +
+
+ {{ partial('chapter/edit_lesson_basic') }} +
+
+ {% if course.model == 'vod' %} + {{ partial('chapter/edit_lesson_vod') }} + {% elseif course.model == 'live' %} + {{ partial('chapter/edit_lesson_live') }} + {% elseif course.model == 'article' %} + {{ partial('chapter/edit_lesson_article') }} + {% endif %} +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/chapter/edit_lesson_article.volt b/app/Http/Admin/Views/chapter/edit_lesson_article.volt new file mode 100644 index 00000000..192a170e --- /dev/null +++ b/app/Http/Admin/Views/chapter/edit_lesson_article.volt @@ -0,0 +1,17 @@ +
+ +
+ +
+ +
+ +
+ + +
+
+ +
+ +{{ partial('partials/layedit') }} \ No newline at end of file diff --git a/app/Http/Admin/Views/chapter/edit_lesson_basic.volt b/app/Http/Admin/Views/chapter/edit_lesson_basic.volt new file mode 100644 index 00000000..8819d6e1 --- /dev/null +++ b/app/Http/Admin/Views/chapter/edit_lesson_basic.volt @@ -0,0 +1,40 @@ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/chapter/edit_lesson_live.volt b/app/Http/Admin/Views/chapter/edit_lesson_live.volt new file mode 100644 index 00000000..4454817b --- /dev/null +++ b/app/Http/Admin/Views/chapter/edit_lesson_live.volt @@ -0,0 +1,53 @@ +
+ +
+ +
+ {% if live.start_time > 0 %} + + {% else %} + + {% endif %} +
+
+ +
+ +
+ {% if live.end_time > 0 %} + + {% else %} + + {% endif %} +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/chapter/edit_lesson_vod.volt b/app/Http/Admin/Views/chapter/edit_lesson_vod.volt new file mode 100644 index 00000000..146c5050 --- /dev/null +++ b/app/Http/Admin/Views/chapter/edit_lesson_vod.volt @@ -0,0 +1,74 @@ +{% if translated_files %} +
+ 视频信息 +
+ + + + + + + + + + {% for item in translated_files %} + + + + + + + + + {% endfor %} +
格式时长分辨率码率大小操作
{{ item.format }}{{ item.duration }}{{ item.width }} x {{ item.height }}{{ item.bit_rate }}kbps{{ item.size }}M + 预览 + 复制 +
+
+{% endif %} + +
+ 上传视频 +
+ +
+ +
+ +
+ 选择视频 + +
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ + + +
+
+ +
+ +{{ partial('partials/media_uploader') }} +{{ partial('partials/media_preview') }} +{{ partial('partials/clipboard_tips') }} \ No newline at end of file diff --git a/app/Http/Admin/Views/chapter/lessons.volt b/app/Http/Admin/Views/chapter/lessons.volt new file mode 100644 index 00000000..3f7726d5 --- /dev/null +++ b/app/Http/Admin/Views/chapter/lessons.volt @@ -0,0 +1,97 @@ +
+ + +
+ +{% if course.model == 'vod' %} + {{ partial('chapter/lessons_vod') }} +{% elseif course.model == 'live' %} + {{ partial('chapter/lessons_live') }} +{% elseif course.model == 'article' %} + {{ partial('chapter/lessons_article') }} +{% endif %} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/chapter/lessons_article.volt b/app/Http/Admin/Views/chapter/lessons_article.volt new file mode 100644 index 00000000..0d19419f --- /dev/null +++ b/app/Http/Admin/Views/chapter/lessons_article.volt @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + {% for item in lessons %} + + + + + + + + + + {% endfor %} + +
编号名称字数排序免费发布操作
{{ item.id }} + {{ item.title }} + + {{ item.attrs.word_count }} +
+ + +
+
diff --git a/app/Http/Admin/Views/chapter/lessons_live.volt b/app/Http/Admin/Views/chapter/lessons_live.volt new file mode 100644 index 00000000..6a70f9e5 --- /dev/null +++ b/app/Http/Admin/Views/chapter/lessons_live.volt @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + {% for item in lessons %} + + + + + + + + + + {% endfor %} + +
编号名称直播时间排序免费发布操作
{{ item.id }} + {{ item.title }} + + + {% if item.attrs.start_time > 0 %} +

开始:{{ date('Y-m-d H:i',item.attrs.start_time) }}

+

结束:{{ date('Y-m-d H:i',item.attrs.end_time) }}

+ {% else %} + N/A + {% endif %} +
+
+ + +
+
diff --git a/app/Http/Admin/Views/chapter/lessons_vod.volt b/app/Http/Admin/Views/chapter/lessons_vod.volt new file mode 100644 index 00000000..4f6a68d8 --- /dev/null +++ b/app/Http/Admin/Views/chapter/lessons_vod.volt @@ -0,0 +1,63 @@ +{%- macro file_status(value) %} + {% if value == 'pending' %} + 待上传 + {% elseif value == 'uploaded' %} + 已上传 + {% elseif value == 'translating' %} + 转码中 + {% elseif value == 'translated' %} + 已转码 + {% elseif value == 'failed' %} + 已失败 + {% endif %} +{%- endmacro %} + + + + + + + + + + + + + + + + + + + + + + + + + + {% for item in lessons %} + + + + + + + + + + + {% endfor %} + +
编号名称视频状态视频时长排序免费发布操作
{{ item.id }} + {{ item.title }} + + {{ file_status(item.attrs.file_status) }}{{ item.attrs.duration|play_duration }} +
+ + +
+
diff --git a/app/Http/Admin/Views/config/alipay_test.volt b/app/Http/Admin/Views/config/alipay_test.volt new file mode 100644 index 00000000..41093a04 --- /dev/null +++ b/app/Http/Admin/Views/config/alipay_test.volt @@ -0,0 +1,85 @@ +
+ + {% if qrcode %} + +
+ + + +
+ 支付成功 +
+ +
+ 支付失败 +
+ + {% else %} + +
+ 生成二维码失败 +
+ + {% endif %} + +
+ +{% if qrcode %} + + {{ javascript_include('lib/jquery.min.js') }} + {{ javascript_include('lib/jquery.qrcode.min.js') }} + + + +{% endif %} \ No newline at end of file diff --git a/app/Http/Admin/Views/config/captcha.volt b/app/Http/Admin/Views/config/captcha.volt new file mode 100644 index 00000000..5e1d8675 --- /dev/null +++ b/app/Http/Admin/Views/config/captcha.volt @@ -0,0 +1,99 @@ +
+ +
+ 验证码配置 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+ 验证码测试 +
+ +
+ +
+ 前台验证 + 前台验证成功 +
+
+ +
+ +
+ 后台验证 + 后台验证成功 + + +
+
+ +
+ + + + \ No newline at end of file diff --git a/app/Http/Admin/Views/config/live.volt b/app/Http/Admin/Views/config/live.volt new file mode 100644 index 00000000..5b8c1a00 --- /dev/null +++ b/app/Http/Admin/Views/config/live.volt @@ -0,0 +1,14 @@ +
+ +
+
+ {{ partial('config/live_push') }} +
+
+ {{ partial('config/live_pull') }} +
+
+
\ No newline at end of file diff --git a/app/Http/Admin/Views/config/live_pull.volt b/app/Http/Admin/Views/config/live_pull.volt new file mode 100644 index 00000000..1070fa4f --- /dev/null +++ b/app/Http/Admin/Views/config/live_pull.volt @@ -0,0 +1,150 @@ +
+ +
+ 基础配置 +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ 鉴权配置 +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ 转码配置 +
+ +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
模板名称模板描述视频码率(kbps)视频高度(px)
+ +
+ +
+ + +
+
+ +
+ +
+ +
+ 拉流测试 +
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/config/live_pull_test.volt b/app/Http/Admin/Views/config/live_pull_test.volt new file mode 100644 index 00000000..e69de29b diff --git a/app/Http/Admin/Views/config/live_push.volt b/app/Http/Admin/Views/config/live_push.volt new file mode 100644 index 00000000..5dddb607 --- /dev/null +++ b/app/Http/Admin/Views/config/live_push.volt @@ -0,0 +1,93 @@ +
+ +
+ 基础配置 +
+ +
+ +
+ +
+
+ +
+ 鉴权配置 +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+ 推流测试 +
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/config/live_push_test.volt b/app/Http/Admin/Views/config/live_push_test.volt new file mode 100644 index 00000000..73f7df7a --- /dev/null +++ b/app/Http/Admin/Views/config/live_push_test.volt @@ -0,0 +1,60 @@ +
+ +
+ +
+
+
+
+ +
+ +
+ +
+
+ 复制 +
+
+ +
+ +
+ +
+
+ 复制 +
+
+ +
+ + +
+ +
+ +{{ partial('partials/clipboard_tips') }} + +{{ javascript_include('lib/jquery.min.js') }} +{{ javascript_include('lib/jquery.qrcode.min.js') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/config/mailer.volt b/app/Http/Admin/Views/config/mailer.volt new file mode 100644 index 00000000..8f137664 --- /dev/null +++ b/app/Http/Admin/Views/config/mailer.volt @@ -0,0 +1,119 @@ +
+ +
+ 邮件配置 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + +
+
+ +
+ +
+ + +
+
+ +
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+ 邮件测试 +
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/config/payment.volt b/app/Http/Admin/Views/config/payment.volt new file mode 100644 index 00000000..0dbe13fa --- /dev/null +++ b/app/Http/Admin/Views/config/payment.volt @@ -0,0 +1,14 @@ +
+ +
+
+ {{ partial('config/payment_alipay') }} +
+
+ {{ partial('config/payment_wxpay') }} +
+
+
\ No newline at end of file diff --git a/app/Http/Admin/Views/config/payment_alipay.volt b/app/Http/Admin/Views/config/payment_alipay.volt new file mode 100644 index 00000000..d7ab9705 --- /dev/null +++ b/app/Http/Admin/Views/config/payment_alipay.volt @@ -0,0 +1,102 @@ +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + +
+
+ +
+ +
+ +
+ 支付测试 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/config/payment_wxpay.volt b/app/Http/Admin/Views/config/payment_wxpay.volt new file mode 100644 index 00000000..dc1651f3 --- /dev/null +++ b/app/Http/Admin/Views/config/payment_wxpay.volt @@ -0,0 +1,101 @@ +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + +
+
+ +
+ +
+ +
+ 支付测试 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/config/secret.volt b/app/Http/Admin/Views/config/secret.volt new file mode 100644 index 00000000..bd154a6c --- /dev/null +++ b/app/Http/Admin/Views/config/secret.volt @@ -0,0 +1,36 @@ +
+ +
+ 密钥配置 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/config/smser.volt b/app/Http/Admin/Views/config/smser.volt new file mode 100644 index 00000000..18499fc4 --- /dev/null +++ b/app/Http/Admin/Views/config/smser.volt @@ -0,0 +1,114 @@ +
+ +
+ 基础配置 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ 模板配置 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称类型模板编号模板内容操作
注册帐号验证码复制
重置密码验证码复制
购买课程通知复制
购买会员通知复制
+ +
+ +
+ + +
+
+ +
+ +
+ +
+ 短信测试 +
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +{{ partial('partials/clipboard_tips') }} \ No newline at end of file diff --git a/app/Http/Admin/Views/config/storage.volt b/app/Http/Admin/Views/config/storage.volt new file mode 100644 index 00000000..296a858d --- /dev/null +++ b/app/Http/Admin/Views/config/storage.volt @@ -0,0 +1,86 @@ +
+ +
+ 存储桶配置 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ 数据万象 +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+ 上传测试 +
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/config/vip.volt b/app/Http/Admin/Views/config/vip.volt new file mode 100644 index 00000000..a45a2a5a --- /dev/null +++ b/app/Http/Admin/Views/config/vip.volt @@ -0,0 +1,47 @@ +
+ +
+ 会员设置 +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/config/vod.volt b/app/Http/Admin/Views/config/vod.volt new file mode 100644 index 00000000..10a3d9f8 --- /dev/null +++ b/app/Http/Admin/Views/config/vod.volt @@ -0,0 +1,219 @@ +
+ +
+ 存储配置 +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ + +
+ 转码配置 +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ 主分发配置 +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ Key防盗链 +
+ +
+ +
+ + +
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+ 接口测试 +
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/config/website.volt b/app/Http/Admin/Views/config/website.volt new file mode 100644 index 00000000..c84e1343 --- /dev/null +++ b/app/Http/Admin/Views/config/website.volt @@ -0,0 +1,115 @@ +
+ +
+ 站点配置 +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/config/wechat_test.volt b/app/Http/Admin/Views/config/wechat_test.volt new file mode 100644 index 00000000..7e1a3e1b --- /dev/null +++ b/app/Http/Admin/Views/config/wechat_test.volt @@ -0,0 +1,85 @@ +
+ + {% if qrcode %} + +
+ + + +
+ 支付成功 +
+ +
+ 支付失败 +
+ + {% else %} + +
+ 生成二维码失败 +
+ + {% endif %} + +
+ +{% if qrcode %} + + {{ javascript_include('lib/jquery.min.js') }} + {{ javascript_include('lib/jquery.qrcode.min.js') }} + + + +{% endif %} \ No newline at end of file diff --git a/app/Http/Admin/Views/config/wxpay_test.volt b/app/Http/Admin/Views/config/wxpay_test.volt new file mode 100644 index 00000000..5a32e29b --- /dev/null +++ b/app/Http/Admin/Views/config/wxpay_test.volt @@ -0,0 +1,85 @@ +
+ + {% if qrcode %} + +
+ + + +
+ 支付成功 +
+ +
+ 支付失败 +
+ + {% else %} + +
+ 生成二维码失败 +
+ + {% endif %} + +
+ +{% if qrcode %} + + {{ javascript_include('lib/jquery.min.js') }} + {{ javascript_include('lib/jquery.qrcode.min.js') }} + + + +{% endif %} \ No newline at end of file diff --git a/app/Http/Admin/Views/course/add.volt b/app/Http/Admin/Views/course/add.volt new file mode 100644 index 00000000..18283d1e --- /dev/null +++ b/app/Http/Admin/Views/course/add.volt @@ -0,0 +1,64 @@ +
+ +
+ 添加课程 +
+ +
+ +
+ + + +
+
+ +
+ +
+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + diff --git a/app/Http/Admin/Views/course/chapters.volt b/app/Http/Admin/Views/course/chapters.volt new file mode 100644 index 00000000..bcccbf98 --- /dev/null +++ b/app/Http/Admin/Views/course/chapters.volt @@ -0,0 +1,89 @@ +
+ + +
+ + + + + + + + + + + + + + + + + + + + {% for item in chapters %} + + + + + + + + {% endfor %} + +
编号名称课时数排序操作
{{ item.id }} + {{ item.title }} + + + + {{ item.lesson_count }} + + +
+ + +
+
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/course/edit.volt b/app/Http/Admin/Views/course/edit.volt new file mode 100644 index 00000000..4eb8713f --- /dev/null +++ b/app/Http/Admin/Views/course/edit.volt @@ -0,0 +1,29 @@ +
+ 编辑课程 +
+ +
+ + + +
+
+ {{ partial('course/edit_basic') }} +
+
+ {{ partial('course/edit_desc') }} +
+
+ {{ partial('course/edit_sale') }} +
+
+ {{ partial('course/edit_related') }} +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/course/edit_basic.volt b/app/Http/Admin/Views/course/edit_basic.volt new file mode 100644 index 00000000..b4f8c06a --- /dev/null +++ b/app/Http/Admin/Views/course/edit_basic.volt @@ -0,0 +1,88 @@ +
+ +
+ +
+ +
+
+ +
+ +
+ {% if course.cover %} + + {% else %} + + {% endif %} + +
+
+ 编辑 +
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+ + + + +
+
+ +
+ +
+ + +
+
+ +
+ +{{ partial('partials/cover_uploader') }} + +{{ javascript_include('lib/xm-select.js') }} + + diff --git a/app/Http/Admin/Views/course/edit_desc.volt b/app/Http/Admin/Views/course/edit_desc.volt new file mode 100644 index 00000000..13696586 --- /dev/null +++ b/app/Http/Admin/Views/course/edit_desc.volt @@ -0,0 +1,34 @@ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +{{ partial('partials/layedit') }} \ No newline at end of file diff --git a/app/Http/Admin/Views/course/edit_related.volt b/app/Http/Admin/Views/course/edit_related.volt new file mode 100644 index 00000000..efe9bffd --- /dev/null +++ b/app/Http/Admin/Views/course/edit_related.volt @@ -0,0 +1,24 @@ +
+ +
+ +
+
+
+
+ +
+ +
+ + +
+
+ +
+ +{{ javascript_include('admin/js/xm-course.js') }} + + diff --git a/app/Http/Admin/Views/course/edit_sale.volt b/app/Http/Admin/Views/course/edit_sale.volt new file mode 100644 index 00000000..c3b14a0a --- /dev/null +++ b/app/Http/Admin/Views/course/edit_sale.volt @@ -0,0 +1,72 @@ +{% set free = course.market_price == 0 %} + +{% set expiry_options = ['30':'一个月','90':'三个月','180':'半年','365':'一年','1095':'三年'] %} + +
+ +
+ +
+ + +
+
+ +
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ {% for key,value in expiry_options %} + + {% endfor %} +
+
+
+ +
+ +
+ + +
+
+ +
+ + diff --git a/app/Http/Admin/Views/course/expiry_macro.volt b/app/Http/Admin/Views/course/expiry_macro.volt new file mode 100644 index 00000000..db25c3ef --- /dev/null +++ b/app/Http/Admin/Views/course/expiry_macro.volt @@ -0,0 +1,13 @@ +{%- macro expiry_info(value) %} + {% if value == 30 %} + 一个月 + {% elseif value == 90 %} + 三个月 + {% elseif value == 180 %} + 半年 + {% elseif value == 365 %} + 一年 + {% elseif value == 1095 %} + 三年 + {% endif %} +{%- endmacro %} \ No newline at end of file diff --git a/app/Http/Admin/Views/course/list.volt b/app/Http/Admin/Views/course/list.volt new file mode 100644 index 00000000..9d14d803 --- /dev/null +++ b/app/Http/Admin/Views/course/list.volt @@ -0,0 +1,140 @@ +{{ partial('course/expiry_macro') }} + +{%- macro model_info(value) %} + {% if value == 'vod' %} + 点播 + {% elseif value == 'live' %} + 直播 + {% elseif value == 'article' %} + 图文 + {% endif %} +{%- endmacro %} + +{%- macro category_info(items) %} + {% for item in items %} + {{ item.name }} + {% endfor %} +{%- endmacro %} + +
+
+ + 课程管理 + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + + + {% endfor %} + +
课程课时数学员数有效期价格发布操作
+

标题:{{ item.title }} {{ model_info(item.model) }}

+

分类:{{ category_info(item.categories) }}

+
+ + {{ item.lesson_count }} + + + + {{ item.student_count }} + + {{ expiry_info(item.expiry) }} +

市场:¥{{ item.market_price }}

+

会员:¥{{ item.vip_price }}

+
+
+ + +
+
+ +{{ partial('partials/pager') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/course/search.volt b/app/Http/Admin/Views/course/search.volt new file mode 100644 index 00000000..68f1e5a0 --- /dev/null +++ b/app/Http/Admin/Views/course/search.volt @@ -0,0 +1,95 @@ +
+ +
+ 搜索课程 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+
+ +
+ +
+ + + +
+
+ +
+ +
+ + + + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +{{ javascript_include('lib/xm-select.js') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/index.volt b/app/Http/Admin/Views/index.volt new file mode 100644 index 00000000..ca9ace40 --- /dev/null +++ b/app/Http/Admin/Views/index.volt @@ -0,0 +1,18 @@ + + + + + + + + 管理后台 + {{ stylesheet_link('lib/layui/css/layui.css') }} + {{ stylesheet_link('lib/layui/css/dropdown.css') }} + {{ stylesheet_link('admin/css/style.css') }} + {{ javascript_include('lib/layui/layui.js') }} + {{ javascript_include('admin/js/common.js') }} + + +{{ content() }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/index/index.volt b/app/Http/Admin/Views/index/index.volt new file mode 100644 index 00000000..84faf615 --- /dev/null +++ b/app/Http/Admin/Views/index/index.volt @@ -0,0 +1,76 @@ + + + + + + + 管理后台 + {{ stylesheet_link('lib/layui/css/layui.css') }} + {{ stylesheet_link('admin/css/style.css') }} + {{ javascript_include('lib/layui/layui.js') }} + {{ javascript_include('admin/js/index.js') }} + + + + +
+ +
+ +
+ +
+ + +
+ +
+
+ {% for key,level in left_menus %} + + {% endfor %} +
+
+ +
+ +
+ + + +
+ + + + \ No newline at end of file diff --git a/app/Http/Admin/Views/index/main.volt b/app/Http/Admin/Views/index/main.volt new file mode 100644 index 00000000..e69de29b diff --git a/app/Http/Admin/Views/nav/add.volt b/app/Http/Admin/Views/nav/add.volt new file mode 100644 index 00000000..80c1cc87 --- /dev/null +++ b/app/Http/Admin/Views/nav/add.volt @@ -0,0 +1,75 @@ +
+ +
+ 添加导航 +
+ + {% if parent_id > 0 %} +
+ +
+ +
+
+ {% endif %} + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/nav/edit.volt b/app/Http/Admin/Views/nav/edit.volt new file mode 100644 index 00000000..ffa4bb3e --- /dev/null +++ b/app/Http/Admin/Views/nav/edit.volt @@ -0,0 +1,60 @@ +
+ +
+ 编辑导航 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/nav/list.volt b/app/Http/Admin/Views/nav/list.volt new file mode 100644 index 00000000..5f313862 --- /dev/null +++ b/app/Http/Admin/Views/nav/list.volt @@ -0,0 +1,144 @@ +{%- macro position_info(value) %} + {% if value == 'top' %} + 顶部 + {% elseif value == 'bottom' %} + 底部 + {% endif %} +{%- endmacro %} + +{%- macro target_info(value) %} + {% if value == '_blank' %} + 新窗口 + {% elseif value == '_self' %} + 原窗口 + {% endif %} +{%- endmacro %} + +
+
+ + {% if parent.id > 0 %} + + 返回 + + {{ parent.name }} + {% endif %} + 导航管理 + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + {% for item in navs %} + + + {% if item.position == 'top' and item.level < 2 %} + + {% else %} + + {% endif %} + + + + + + + + {% endfor %} + +
编号名称层级位置目标排序发布操作
{{ item.id }}{{ item.name }}{{ item.name }}{{ item.level }}{{ position_info(item.position) }}{{ target_info(item.target) }} +
+ + +
+
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/order/list.volt b/app/Http/Admin/Views/order/list.volt new file mode 100644 index 00000000..846fc1a5 --- /dev/null +++ b/app/Http/Admin/Views/order/list.volt @@ -0,0 +1,57 @@ +{{ partial('order/macro') }} + +
+
+ + 订单管理 + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + + {% endfor %} + +
商品信息买家信息订单金额订单状态创建时间操作
+

商品:{{ item.subject }} {{ item_type(item.item_type) }}

+

单号:{{ item.sn }}

+
+

名称:{{ item.user.name }}

+

编号:{{ item.user.id }}

+
¥{{ item.amount }}{{ order_status(item.status) }}{{ date('Y-m-d H:i:s',item.created_at) }} + 详情 +
+ +{{ partial('partials/pager') }} \ No newline at end of file diff --git a/app/Http/Admin/Views/order/macro.volt b/app/Http/Admin/Views/order/macro.volt new file mode 100644 index 00000000..4240b799 --- /dev/null +++ b/app/Http/Admin/Views/order/macro.volt @@ -0,0 +1,62 @@ +{%- macro item_info(order) %} + {% if order.item_type == 'course' %} + {% set course = order.item_info['course'] %} +
+

课程名称:{{ course['title'] }}

+

市场价格:¥{{ course['market_price'] }}

+

有效期限:{{ date('Y-m-d', course['expire_time']) }}

+
+ {% elseif order.item_type == 'package' %} + {% set courses = order.item_info['courses'] %} + {% for course in courses %} +
+

课程名称:{{ course['title'] }}

+

市场价格:¥{{ course['market_price'] }}

+

有效期限:{{ date('Y-m-d', course['expire_time']) }}

+
+ {% endfor %} + {% elseif order.item_type == 'reward' %} + {% set course = order.item_info['course'] %} +
+

课程名称:{{ course['title'] }}

+

赞赏金额:¥{{ order.amount }}

+
+ {% elseif order.item_type == 'vip' %} + {% set vip = order.item_info['vip'] %} +
+

商品名称:{{ order.subject }}

+

商品价格:¥{{ order.amount }}

+
+ {% elseif order.item_type == 'test' %} +
+

商品名称:{{ order.subject }}

+

商品价格:¥{{ order.amount }}

+
+ {% endif %} +{%- endmacro %} + +{%- macro item_type(value) %} + {% if value == 'course' %} + 课程 + {% elseif value == 'package' %} + 套餐 + {% elseif value == 'reward' %} + 打赏 + {% elseif value == 'vip' %} + 会员 + {% elseif value == 'test' %} + 测试 + {% endif %} +{%- endmacro %} + +{%- macro order_status(value) %} + {% if value == 'pending' %} + 待支付 + {% elseif value == 'finished' %} + 已完成 + {% elseif value == 'closed' %} + 已关闭 + {% elseif value == 'refunded' %} + 已退款 + {% endif %} +{%- endmacro %} \ No newline at end of file diff --git a/app/Http/Admin/Views/order/search.volt b/app/Http/Admin/Views/order/search.volt new file mode 100644 index 00000000..b637425d --- /dev/null +++ b/app/Http/Admin/Views/order/search.volt @@ -0,0 +1,79 @@ +
+ +
+ 搜索订单 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + + + +
+
+ +
+ +
+ + + + +
+
+ +
+ +
+ +
+
-
+
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/order/show.volt b/app/Http/Admin/Views/order/show.volt new file mode 100644 index 00000000..6183559f --- /dev/null +++ b/app/Http/Admin/Views/order/show.volt @@ -0,0 +1,141 @@ +{{ partial('order/macro') }} +{{ partial('trade/macro') }} +{{ partial('refund/macro') }} + +
+ 订单信息 +
+ + + + + + + + + + + + + + + + +
+ 订单编号:{{ order.sn }} + 订单金额订单类型订单状态创建时间
{{ item_info(order) }}¥{{ order.amount }}{{ item_type(order.item_type) }}{{ order_status(order.status) }}{{ date('Y-m-d H:i:s',order.created_at) }}
+ +
+ +
+ {% if order.status == 'pending' %} + + {% endif %} + +
+ +{% if refunds.count() > 0 %} +
+ 退款信息 +
+ + + + + + + + + {% for item in refunds %} + + + + + + + + {% endfor %} +
退款序号退款金额退款原因退款状态创建时间
{{ item.sn }}¥{{ item.amount }}{{ substr(item.apply_reason,0,15) }}{{ refund_status(item) }}{{ date('Y-m-d H:i:s',item.created_at) }}
+{% endif %} + +
+ +{% if trades.count() > 0 %} +
+ 交易信息 +
+ + + + + + + + + {% for item in trades %} + + + + + + + + {% endfor %} +
交易号交易金额交易平台交易状态创建时间
{{ item.sn }}¥{{ item.amount }}{{ channel_type(item.channel) }}{{ trade_status(item.status) }}{{ date('Y-m-d H:i:s',item.created_at) }}
+{% endif %} + +
+ +
+ 买家信息 +
+ + + + + + + + + + + + + + + + +
编号用户名邮箱手机号注册时间
{{ user.id }}{{ user.name }}{{ user.email }}{{ user.phone }}{{ date('Y-m-d H:i:s',user.created_at) }}
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/package/add.volt b/app/Http/Admin/Views/package/add.volt new file mode 100644 index 00000000..172c9089 --- /dev/null +++ b/app/Http/Admin/Views/package/add.volt @@ -0,0 +1,29 @@ +
+ +
+ 添加套餐 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/package/edit.volt b/app/Http/Admin/Views/package/edit.volt new file mode 100644 index 00000000..79717bcf --- /dev/null +++ b/app/Http/Admin/Views/package/edit.volt @@ -0,0 +1,91 @@ +
+ +
+ 编辑套餐 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+
+ +
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+
+ +
+ +
+ + +
+
+ +
+ +{{ javascript_include('lib/xm-select.js') }} +{{ javascript_include('admin/js/xm-course.js') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/package/guiding.volt b/app/Http/Admin/Views/package/guiding.volt new file mode 100644 index 00000000..ec20d922 --- /dev/null +++ b/app/Http/Admin/Views/package/guiding.volt @@ -0,0 +1,40 @@ +{{ partial('course/expiry_macro') }} + + + + + + + + + + + + + + + + + + {% for item in courses %} + + + + + + + {% endfor %} + +
标题课时数有效期价格
{{ item.title }}{{ item.lesson_count }}{{ expiry_info(item.expiry) }} +

市场价:¥{{ item.market_price }}

+

会员价:¥{{ item.vip_price }}

+
+ +
+ +
+ 建议市场价:¥{{ guiding_price.market_price }} +    + 建议会员价:¥{{ guiding_price.vip_price }} +
+
\ No newline at end of file diff --git a/app/Http/Admin/Views/package/list.volt b/app/Http/Admin/Views/package/list.volt new file mode 100644 index 00000000..b282acc1 --- /dev/null +++ b/app/Http/Admin/Views/package/list.volt @@ -0,0 +1,95 @@ +
+
+ + 套餐管理 + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + + + {% endfor %} + +
编号标题课程数市场价会员价发布操作
{{ item.id }}{{ item.title }}{{ item.course_count }}¥{{ item.market_price }}¥{{ item.vip_price }} +
+ + +
+
+ +{{ partial('partials/pager') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/page/add.volt b/app/Http/Admin/Views/page/add.volt new file mode 100644 index 00000000..807e78d4 --- /dev/null +++ b/app/Http/Admin/Views/page/add.volt @@ -0,0 +1,39 @@ +
+ +
+ 添加单页 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +{{ partial('partials/layedit') }} \ No newline at end of file diff --git a/app/Http/Admin/Views/page/edit.volt b/app/Http/Admin/Views/page/edit.volt new file mode 100644 index 00000000..a276f144 --- /dev/null +++ b/app/Http/Admin/Views/page/edit.volt @@ -0,0 +1,40 @@ +
+ +
+ 编辑单页 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +{{ partial('partials/layedit') }} + diff --git a/app/Http/Admin/Views/page/list.volt b/app/Http/Admin/Views/page/list.volt new file mode 100644 index 00000000..69ac93b2 --- /dev/null +++ b/app/Http/Admin/Views/page/list.volt @@ -0,0 +1,94 @@ +
+
+ + 单页管理 + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + + {% endfor %} + +
编号标题创建时间更新时间发布操作
{{ item.id }}{{ item.title }}{{ date('Y-m-d H:i',item.created_at) }}{{ date('Y-m-d H:i',item.updated_at) }} + +
+ + +
+
+ +{{ partial('partials/pager') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/partials/clipboard_tips.volt b/app/Http/Admin/Views/partials/clipboard_tips.volt new file mode 100644 index 00000000..96c38c0f --- /dev/null +++ b/app/Http/Admin/Views/partials/clipboard_tips.volt @@ -0,0 +1,16 @@ +{{ javascript_include('lib/clipboard.min.js') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/partials/cover_uploader.volt b/app/Http/Admin/Views/partials/cover_uploader.volt new file mode 100644 index 00000000..e8b7580d --- /dev/null +++ b/app/Http/Admin/Views/partials/cover_uploader.volt @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/app/Http/Admin/Views/partials/ip2region.volt b/app/Http/Admin/Views/partials/ip2region.volt new file mode 100644 index 00000000..404c162f --- /dev/null +++ b/app/Http/Admin/Views/partials/ip2region.volt @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/app/Http/Admin/Views/partials/layedit.volt b/app/Http/Admin/Views/partials/layedit.volt new file mode 100644 index 00000000..099e2a97 --- /dev/null +++ b/app/Http/Admin/Views/partials/layedit.volt @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/app/Http/Admin/Views/partials/media_preview.volt b/app/Http/Admin/Views/partials/media_preview.volt new file mode 100644 index 00000000..d5742e35 --- /dev/null +++ b/app/Http/Admin/Views/partials/media_preview.volt @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/app/Http/Admin/Views/partials/media_uploader.volt b/app/Http/Admin/Views/partials/media_uploader.volt new file mode 100644 index 00000000..e539054d --- /dev/null +++ b/app/Http/Admin/Views/partials/media_uploader.volt @@ -0,0 +1,66 @@ +{{ javascript_include('lib/vod-js-sdk-v6.min.js') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/partials/pager.volt b/app/Http/Admin/Views/partials/pager.volt new file mode 100644 index 00000000..bf9bfb15 --- /dev/null +++ b/app/Http/Admin/Views/partials/pager.volt @@ -0,0 +1,8 @@ +{% if pager.total_pages > 1 %} +
+ 首页 + 上页 + 下页 + 尾页 +
+{% endif %} \ No newline at end of file diff --git a/app/Http/Admin/Views/public/forbidden.volt b/app/Http/Admin/Views/public/forbidden.volt new file mode 100644 index 00000000..e9077d92 --- /dev/null +++ b/app/Http/Admin/Views/public/forbidden.volt @@ -0,0 +1,12 @@ +
+
+ +
+

+ 4 + 0 + 3 +

+
+
+
\ No newline at end of file diff --git a/app/Http/Admin/Views/public/ip2region.volt b/app/Http/Admin/Views/public/ip2region.volt new file mode 100644 index 00000000..f4de7db5 --- /dev/null +++ b/app/Http/Admin/Views/public/ip2region.volt @@ -0,0 +1,14 @@ + + + + + + + + + + + + + +
国家省份城市运营商
{{ region.country }}{{ region.province }}{{ region.city }}{{ region.isp }}
\ No newline at end of file diff --git a/app/Http/Admin/Views/public/live_player.volt b/app/Http/Admin/Views/public/live_player.volt new file mode 100644 index 00000000..cbd37f4f --- /dev/null +++ b/app/Http/Admin/Views/public/live_player.volt @@ -0,0 +1,38 @@ + + + + + + 视频直播 + + + + +
+ + + + diff --git a/app/Http/Admin/Views/public/login.volt b/app/Http/Admin/Views/public/login.volt new file mode 100644 index 00000000..aa3bcc94 --- /dev/null +++ b/app/Http/Admin/Views/public/login.volt @@ -0,0 +1,71 @@ +
+ +
+ 后台登录 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + {% if captcha.enabled == 1 %} +
+ +
+ 点击完成验证 + 验证成功 +
+
+ {% endif %} + +
+ +
+ + + +
+
+ +
+ + + +{% if captcha.enabled == 1 %} + + + + + +{% endif %} \ No newline at end of file diff --git a/app/Http/Admin/Views/public/vod_player.volt b/app/Http/Admin/Views/public/vod_player.volt new file mode 100644 index 00000000..2ddcd79a --- /dev/null +++ b/app/Http/Admin/Views/public/vod_player.volt @@ -0,0 +1,85 @@ + + + + + + 视频点播 + + + + +
+ + + +{{ javascript_include('lib/jquery.min.js') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/refund/list.volt b/app/Http/Admin/Views/refund/list.volt new file mode 100644 index 00000000..94f66675 --- /dev/null +++ b/app/Http/Admin/Views/refund/list.volt @@ -0,0 +1,58 @@ +{{ partial('refund/macro') }} + +
+
+ + 退款管理 + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + + {% endfor %} + +
商品信息买家信息退款金额退款状态创建时间操作
+

商品:{{ item.subject }}

+

单号:{{ item.order_sn }}

+
+

名称:{{ item.user.name }}

+

编号:{{ item.user.id }}

+
¥{{ item.amount }}{{ refund_status(item) }}{{ date('Y-m-d H:i:s',item.created_at) }} + 详情 +
+ +{{ partial('partials/pager') }} \ No newline at end of file diff --git a/app/Http/Admin/Views/refund/macro.volt b/app/Http/Admin/Views/refund/macro.volt new file mode 100644 index 00000000..4225544d --- /dev/null +++ b/app/Http/Admin/Views/refund/macro.volt @@ -0,0 +1,15 @@ +{%- macro refund_status(refund) %} + {% if refund.status == 'pending' %} + 待处理 + {% elseif refund.status == 'canceled' %} + 已取消 + {% elseif refund.status == 'approved' %} + 已审核 + {% elseif refund.status == 'refused' %} + 已拒绝 + {% elseif refund.status == 'finished' %} + 已完成 + {% elseif refund.status == 'failed' %} + 已失败 + {% endif %} +{%- endmacro %} \ No newline at end of file diff --git a/app/Http/Admin/Views/refund/search.volt b/app/Http/Admin/Views/refund/search.volt new file mode 100644 index 00000000..6318aab6 --- /dev/null +++ b/app/Http/Admin/Views/refund/search.volt @@ -0,0 +1,69 @@ +
+ +
+ 搜索退款 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + + + +
+
+ +
+ +
+ +
+
-
+
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/refund/show.volt b/app/Http/Admin/Views/refund/show.volt new file mode 100644 index 00000000..dfee19eb --- /dev/null +++ b/app/Http/Admin/Views/refund/show.volt @@ -0,0 +1,125 @@ +{{ partial('order/macro') }} +{{ partial('trade/macro') }} +{{ partial('refund/macro') }} + +
+ 退款信息 +
+ + + + + + + + + + + + + + + + +
退款序号退款金额退款原因退款状态创建时间
{{ refund.sn }}¥{{ refund.amount }}{{ substr(refund.apply_reason,0,15) }}{{ refund_status(refund) }}{{ date('Y-m-d H:i:s',refund.created_at) }}
+ +
+ +{% if refund.status == 'pending' %} +
+
+ 审核退款 +
+
+ +
+ + +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+{% else %} +
+ +
+{% endif %} + +
+ 交易信息 +
+ + + + + + + + + + + + + + + + +
交易序号交易金额交易平台交易状态创建时间
{{ trade.sn }}¥{{ trade.amount }}{{ channel_type(trade.channel) }}{{ trade_status(trade.status) }}{{ date('Y-m-d H:i:s',trade.created_at) }}
+ +
+ +
+ 订单信息 +
+ + + + + + + + + + + + + + + + +
订单序号商品名称订单金额订单状态创建时间
{{ order.sn }}{{ order.subject }}¥{{ order.amount }}{{ order_status(order.status) }}{{ date('Y-m-d H:i:s',order.created_at) }}
+ +
+ +
+ 用户信息 +
+ + + + + + + + + + + + + + + + +
编号用户名邮箱手机号注册时间
{{ user.id }}{{ user.name }}{{ user.email }}{{ user.phone }}{{ date('Y-m-d H:i:s',user.created_at) }}
\ No newline at end of file diff --git a/app/Http/Admin/Views/review/edit.volt b/app/Http/Admin/Views/review/edit.volt new file mode 100644 index 00000000..944cc70a --- /dev/null +++ b/app/Http/Admin/Views/review/edit.volt @@ -0,0 +1,57 @@ +
+ +
+ 编辑评价 +
+ +
+ +
+
{{ review.rating }}
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/review/list.volt b/app/Http/Admin/Views/review/list.volt new file mode 100644 index 00000000..cf883b29 --- /dev/null +++ b/app/Http/Admin/Views/review/list.volt @@ -0,0 +1,111 @@ +
+
+ + 返回 + {% if course %} + {{ course.title }} + {% endif %} + 评价管理 + +
+ +
+ + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + {% endfor %} + +
內容时间发布操作
+

评分:{{ item.rating }}

+

课程:{{ item.course.title }}

+

用户:{{ item.user.name }}

+
{{ item.content }}{{ date('Y-m-d', item.created_at) }} +
+ + +
+
+ +{{ partial('partials/pager') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/review/search.volt b/app/Http/Admin/Views/review/search.volt new file mode 100644 index 00000000..f20f197f --- /dev/null +++ b/app/Http/Admin/Views/review/search.volt @@ -0,0 +1,52 @@ +
+ +
+ 搜索评价 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/role/add.volt b/app/Http/Admin/Views/role/add.volt new file mode 100644 index 00000000..83bbd61e --- /dev/null +++ b/app/Http/Admin/Views/role/add.volt @@ -0,0 +1,29 @@ +
+ +
+ 添加角色 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/role/edit.volt b/app/Http/Admin/Views/role/edit.volt new file mode 100644 index 00000000..3c83c308 --- /dev/null +++ b/app/Http/Admin/Views/role/edit.volt @@ -0,0 +1,52 @@ +
+ +
+ 编辑角色 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ {% for key,level in nodes %} + + {% for key2,level2 in level.child %} + + {% if key2 == 0 %} + + {% endif %} + + + + {% endfor %} +
{{ level.label }}{{ level2.label }} + {% for level3 in level2.child %} + + {% endfor %} +
+ {% endfor %} +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/role/list.volt b/app/Http/Admin/Views/role/list.volt new file mode 100644 index 00000000..85466d5e --- /dev/null +++ b/app/Http/Admin/Views/role/list.volt @@ -0,0 +1,62 @@ +{%- macro type_info(value) %} + {% if value == 'system' %} + 内置 + {% elseif value == 'custom' %} + 自定 + {% endif %} +{%- endmacro %} + +
+
+ + 角色管理 + +
+ +
+ + + + + + + + + + + + + + + + + + + + {% for item in roles %} + + + + + + + + {% endfor %} + +
编号名称类型成员数操作
{{ item.id }}{{ item.name }}{{ type_info(item.type) }} + + {{ item.user_count }} + + +
+ + +
+
\ No newline at end of file diff --git a/app/Http/Admin/Views/slide/add.volt b/app/Http/Admin/Views/slide/add.volt new file mode 100644 index 00000000..fc521952 --- /dev/null +++ b/app/Http/Admin/Views/slide/add.volt @@ -0,0 +1,64 @@ +
+ +
+ 添加轮播 +
+ +
+ +
+ +
+
+ +
+ +
+ + + +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/slide/edit.volt b/app/Http/Admin/Views/slide/edit.volt new file mode 100644 index 00000000..7445fccc --- /dev/null +++ b/app/Http/Admin/Views/slide/edit.volt @@ -0,0 +1,112 @@ +{%- macro content_label(target) %} + {% if target == 'course' %} + 课程编号 + {% elseif target == 'page' %} + 单页编号 + {% elseif target == 'link' %} + 链接地址 + {% endif %} +{%- endmacro %} + +
+ +
+ 编辑轮播 +
+ +
+ +
+ {% if slide.cover %} + + {% else %} + + {% endif %} + +
+
+ 编辑 +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +{{ partial('partials/cover_uploader') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/slide/list.volt b/app/Http/Admin/Views/slide/list.volt new file mode 100644 index 00000000..c98a7b56 --- /dev/null +++ b/app/Http/Admin/Views/slide/list.volt @@ -0,0 +1,129 @@ +{%- macro target_info(value) %} + {% if value == 'course' %} + 课程 + {% elseif value == 'page' %} + 单页 + {% elseif value == 'link' %} + 链接 + {% endif %} +{%- endmacro %} + +
+
+ + 轮播管理 + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + + + {% endfor %} + +
编号标题目标类型有效期限排序发布操作
{{ item.id }}{{ item.title }}{{ target_info(item.target) }} +

开始:{{ date('Y-m-d H:i',item.start_time) }}

+

结束:{{ date('Y-m-d H:i',item.end_time) }}

+
+
+ + +
+
+ +{{ partial('partials/pager') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/student/add.volt b/app/Http/Admin/Views/student/add.volt new file mode 100644 index 00000000..4c7a5057 --- /dev/null +++ b/app/Http/Admin/Views/student/add.volt @@ -0,0 +1,51 @@ +
+ +
+ 添加学员 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/student/edit.volt b/app/Http/Admin/Views/student/edit.volt new file mode 100644 index 00000000..5ba6d356 --- /dev/null +++ b/app/Http/Admin/Views/student/edit.volt @@ -0,0 +1,61 @@ +
+ +
+ 编辑学员 +
+ +
+ +
+
{{ course.title }}
+
+
+ +
+ +
+
{{ student.name }}
+
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/student/learning.volt b/app/Http/Admin/Views/student/learning.volt new file mode 100644 index 00000000..284ea502 --- /dev/null +++ b/app/Http/Admin/Views/student/learning.volt @@ -0,0 +1,85 @@ +{%- macro client_type(value) %} + {% if value == 'desktop' %} + 桌面端 + {% elseif value == 'mobile' %} + 手机端 + {% endif %} +{%- endmacro %} + + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + {% endfor %} + +
课时信息学习时长客户端类型客户端地址创建时间
+

课程:{{ item.course.title }}

+

章节:{{ item.chapter.title }}

+
{{ item.duration|play_duration }}{{ client_type(item.client_type) }}{{ item.client_ip }}{{ date('Y-m-d H:i',item.created_at) }}
+ +{{ partial('partials/pager') }} +{{ partial('partials/ip2region') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/student/list.volt b/app/Http/Admin/Views/student/list.volt new file mode 100644 index 00000000..8880e9d4 --- /dev/null +++ b/app/Http/Admin/Views/student/list.volt @@ -0,0 +1,122 @@ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + + {% endfor %} + +
基本信息学习情况加入时间过期时间锁定操作
+

课程:{{ item.course.title }}

+

学员:{{ item.user.name }}

+
+
+
+
+
+
+

时长:{{ item.duration|total_duration }}

+
{{ date('Y-m-d',item.created_at) }}{{ date('Y-m-d',item.expire_time) }} +
+ + +
+
+ +{{ partial('partials/pager') }} + + \ No newline at end of file diff --git a/app/Http/Admin/Views/student/search.volt b/app/Http/Admin/Views/student/search.volt new file mode 100644 index 00000000..c707b74a --- /dev/null +++ b/app/Http/Admin/Views/student/search.volt @@ -0,0 +1,49 @@ +{% set course_id = request.getQuery('course_id', 'int', '') %} + +
+ +
+ 搜索学员 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/trade/list.volt b/app/Http/Admin/Views/trade/list.volt new file mode 100644 index 00000000..16031878 --- /dev/null +++ b/app/Http/Admin/Views/trade/list.volt @@ -0,0 +1,60 @@ +{{ partial('trade/macro') }} + +
+
+ + 交易管理 + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + + + {% endfor %} + +
商品信息买家信息交易金额交易平台交易状态创建时间操作
+

商品:{{ item.subject }}

+

单号:{{ item.order_sn }}

+
+

名称:{{ item.user.name }}

+

编号:{{ item.user.id }}

+
¥{{ item.amount }}{{ channel_type(item.channel) }}{{ trade_status(item.status) }}{{ date('Y-m-d H:i:s',item.created_at) }} + 详情 +
+ +{{ partial('partials/pager') }} \ No newline at end of file diff --git a/app/Http/Admin/Views/trade/macro.volt b/app/Http/Admin/Views/trade/macro.volt new file mode 100644 index 00000000..65b269f5 --- /dev/null +++ b/app/Http/Admin/Views/trade/macro.volt @@ -0,0 +1,19 @@ +{%- macro trade_status(value) %} + {% if value == 'pending' %} + 待支付 + {% elseif value == 'finished' %} + 已完成 + {% elseif value == 'closed' %} + 已关闭 + {% elseif value == 'refunded' %} + 已退款 + {% endif %} +{%- endmacro %} + +{%- macro channel_type(value) %} + {% if value == 'alipay' %} + 支付宝 + {% elseif value == 'wxpay' %} + 微信 + {% endif %} +{%- endmacro %} \ No newline at end of file diff --git a/app/Http/Admin/Views/trade/search.volt b/app/Http/Admin/Views/trade/search.volt new file mode 100644 index 00000000..d5f73660 --- /dev/null +++ b/app/Http/Admin/Views/trade/search.volt @@ -0,0 +1,76 @@ +
+ +
+ 搜索交易 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + + + +
+
+ +
+ +
+ +
+
-
+
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/trade/show.volt b/app/Http/Admin/Views/trade/show.volt new file mode 100644 index 00000000..5f6a934a --- /dev/null +++ b/app/Http/Admin/Views/trade/show.volt @@ -0,0 +1,162 @@ +{{ partial('order/macro') }} +{{ partial('trade/macro') }} +{{ partial('refund/macro') }} + +
+ 交易信息 +
+ + + + + + + + + + + + + + + + +
交易序号交易金额交易平台交易状态创建时间
{{ trade.sn }}¥{{ trade.amount }}{{ channel_type(trade.channel) }}{{ trade_status(trade.status) }}{{ date('Y-m-d H:i:s',trade.created_at) }}
+ +
+ +
+ {% if trade.status == 'pending' %} + + {% endif %} + {% if trade.status == 'finished' %} + + {% endif %} + +
+ +{% if refunds.count() > 0 %} +
+ 退款信息 +
+ + + + + + + + + {% for item in refunds %} + + + + + + + + {% endfor %} +
退款序号退款金额退款原因退款状态创建时间
{{ item.sn }}¥{{ item.amount }}{{ substr(item.apply_reason,0,15) }}{{ refund_status(item) }}{{ date('Y-m-d H:i:s',item.created_at) }}
+{% endif %} + +
+ +
+ 订单信息 +
+ + + + + + + + + + + + + + + + +
订单序号商品名称订单金额订单状态创建时间
{{ order.sn }}{{ order.subject }}¥{{ order.amount }}{{ order_status(order.status) }}{{ date('Y-m-d H:i:s',order.created_at) }}
+ +
+ +
+ 用户信息 +
+ + + + + + + + + + + + + + + + +
编号用户名邮箱手机号注册时间
{{ user.id }}{{ user.name }}{{ user.email }}{{ user.phone }}{{ date('Y-m-d H:i:s',user.created_at) }}
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/user/add.volt b/app/Http/Admin/Views/user/add.volt new file mode 100644 index 00000000..25c57197 --- /dev/null +++ b/app/Http/Admin/Views/user/add.volt @@ -0,0 +1,49 @@ +
+ +
+ 添加用户 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ + {% if auth_user.admin == 1 %} +
+ +
+ + {% for item in roles %} + + {% endfor %} +
+
+ {% endif %} + +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Admin/Views/user/edit.volt b/app/Http/Admin/Views/user/edit.volt new file mode 100644 index 00000000..8ed64f6b --- /dev/null +++ b/app/Http/Admin/Views/user/edit.volt @@ -0,0 +1,97 @@ +
+ +
+ 编辑用户 +
+ +
+ +
+
{{ user.name }}
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ + {% if auth_user.admin == 1 %} +
+ +
+ + {% for item in roles %} + + {% endfor %} +
+
+ {% endif %} + +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + \ No newline at end of file diff --git a/app/Http/Admin/Views/user/list.volt b/app/Http/Admin/Views/user/list.volt new file mode 100644 index 00000000..53c6eff7 --- /dev/null +++ b/app/Http/Admin/Views/user/list.volt @@ -0,0 +1,81 @@ +{%- macro role_info(user) %} + {% if user.edu_role.id > 0 %} + {{ user.edu_role.name }} + {% endif %} + {% if user.admin_role.id > 0 %} + {{ user.admin_role.name }} + {% endif %} +{%- endmacro %} + +{%- macro status_info(user) %} + {% if user.locked == 0 %} + 正常 + {% else %} + 锁定 + {% endif %} +{%- endmacro %} + +{%- macro vip_info(user) %} + {% if user.vip == 1 %} + vip + {% endif %} +{%- endmacro %} + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + {% for item in pager.items %} + + + + + + + + + {% endfor %} + +
编号用户角色注册日期状态操作
{{ item.id }}{{ item.name }}{{ vip_info(item) }}{{ role_info(item) }}{{ date('Y-m-d',item.created_at) }}{{ status_info(item) }} +
+ + +
+
+ +{{ partial('partials/pager') }} \ No newline at end of file diff --git a/app/Http/Admin/Views/user/search.volt b/app/Http/Admin/Views/user/search.volt new file mode 100644 index 00000000..a8046b21 --- /dev/null +++ b/app/Http/Admin/Views/user/search.volt @@ -0,0 +1,76 @@ +
+ +
+ 搜索用户 +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ {% for item in roles %} + + {% endfor %} +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
\ No newline at end of file diff --git a/app/Http/Api/Controllers/Controller.php b/app/Http/Api/Controllers/Controller.php new file mode 100644 index 00000000..68757f2d --- /dev/null +++ b/app/Http/Api/Controllers/Controller.php @@ -0,0 +1,13 @@ +router->getRoutes(); + + foreach ($routes as $route) { + if (strpos($route->getPattern(), '/api') !== false) { + $definitions[] = [ + 'pattern' => $route->getPattern(), + 'methods' => $route->getHttpMethods(), + ]; + } + } + + dd($definitions); + } + +} diff --git a/app/Http/Api/Module.php b/app/Http/Api/Module.php new file mode 100644 index 00000000..1df5f68e --- /dev/null +++ b/app/Http/Api/Module.php @@ -0,0 +1,25 @@ +setShared('view', function () { + $view = new View(); + $view->disable(); + return $view; + }); + } +} diff --git a/app/Http/Api/Services/Service.php b/app/Http/Api/Services/Service.php new file mode 100644 index 00000000..06751348 --- /dev/null +++ b/app/Http/Api/Services/Service.php @@ -0,0 +1,69 @@ +getAuthToken(); + + return $token ? $this->getUser($token) : $this->getGuest(); + } + + public function getLoggedUser() + { + $token = $this->getAuthToken(); + + $filter = new BaseFilter(); + + $filter->checkAuthToken($token); + + $user = $this->getUser($token); + + $filter->checkAuthUser($user); + + return $user; + } + + private function getAuthToken() + { + $token = null; + + if ($this->cookies->has('token')) { + + $cookie = $this->cookies->get('token'); + + $token = $cookie->getValue(); + } + + return $token; + } + + private function getGuest() + { + $guest = new UserModel(); + + $guest->id = 0; + $guest->name = 'guest'; + + return $guest; + } + + private function getUser($token) + { + $userRepo = new UserRepo(); + + $user = $userRepo->findById($token); + + return $user; + } + +} diff --git a/app/Http/Home/Controllers/AccountController.php b/app/Http/Home/Controllers/AccountController.php new file mode 100644 index 00000000..26239a9b --- /dev/null +++ b/app/Http/Home/Controllers/AccountController.php @@ -0,0 +1,101 @@ +signup(); + + $location = $this->request->getHTTPReferer(); + + $this->response->redirect($location); + } + + /** + * @Route("/login", name="home.account.login") + */ + public function loginAction() + { + $service = new AccountService(); + + $service->login(); + + $location = $this->request->getHTTPReferer(); + + $this->response->redirect($location); + } + + /** + * @Get("/logout", name="home.account.logout") + */ + public function logoutAction() + { + $service = new AccountService(); + + $service->logout(); + + $this->response->redirect(['for' => 'home.index']); + } + + /** + * @Route("/password/reset", name="home.account.reset_password") + */ + public function resetPasswordAction() + { + $service = new AccountService(); + + $service->resetPassword(); + + return $this->ajaxSuccess(); + } + + /** + * @Post("/mobile/update", name="home.account.update_mobile") + */ + public function updateMobileAction() + { + $service = new AccountService(); + + $service->updateMobile(); + + return $this->ajaxSuccess(); + } + + /** + * @Post("/password/update", name="home.account.update_password") + */ + public function updatePasswordAction() + { + $service = new AccountService(); + + $service->updatePassword(); + + return $this->ajaxSuccess(); + } + + /** + * @Post("/captcha/send", name="home.account.send_captcha") + */ + public function sendCaptchaAction() + { + $service = new AccountService(); + + $service->sendCaptcha(); + + return $this->ajaxSuccess(); + } + +} diff --git a/app/Http/Home/Controllers/CategoryController.php b/app/Http/Home/Controllers/CategoryController.php new file mode 100644 index 00000000..9e560451 --- /dev/null +++ b/app/Http/Home/Controllers/CategoryController.php @@ -0,0 +1,49 @@ +getCategory($id); + + return $this->response->ajaxSuccess($category); + } + + /** + * @Get("/{id}/childs", name="home.category.childs") + */ + public function childsAction($id) + { + $service = new CategoryService(); + + $childs = $service->getChilds($id); + + return $this->response->ajaxSuccess($childs); + } + + /** + * @Get("/{id}/courses", name="home.category.courses") + */ + public function coursesAction($id) + { + $service = new CategoryService(); + + $courses = $service->getCourses($id); + + return $this->response->ajaxSuccess($courses); + } + +} diff --git a/app/Http/Home/Controllers/ChapterController.php b/app/Http/Home/Controllers/ChapterController.php new file mode 100644 index 00000000..b9884477 --- /dev/null +++ b/app/Http/Home/Controllers/ChapterController.php @@ -0,0 +1,85 @@ +getChapter($id); + + $this->view->chapter = $chapter; + } + + /** + * @Get("/{id}/comments", name="home.chapter.comments") + */ + public function commentsAction($id) + { + $service = new ChapterService(); + + $comments = $service->getComments($id); + + $this->view->comments = $comments; + } + + /** + * @Post("/{id}/agree", name="home.chapter.agree") + */ + public function agreeAction($id) + { + $service = new ChapterService(); + + $service->agree($id); + + return $this->response->ajaxSuccess(); + } + + /** + * @Post("/{id}/oppose", name="home.chapter.oppose") + */ + public function opposeAction($id) + { + $service = new ChapterService(); + + $service->oppose($id); + + return $this->response->ajaxSuccess(); + } + + /** + * @Post("/{id}/position", name="home.chapter.position") + */ + public function positionAction($id) + { + $service = new ChapterService(); + + $service->position($id); + + return $this->response->ajaxSuccess(); + } + + /** + * @Post("/{id}/finish", name="home.chapter.finish") + */ + public function finishAction($id) + { + $service = new ChapterService(); + + $service->finish($id); + + return $this->response->ajaxSuccess(); + } + +} diff --git a/app/Http/Home/Controllers/CommentController.php b/app/Http/Home/Controllers/CommentController.php new file mode 100644 index 00000000..ab1c6ef6 --- /dev/null +++ b/app/Http/Home/Controllers/CommentController.php @@ -0,0 +1,85 @@ +create(); + + return $this->response->ajaxSuccess($comment); + } + + /** + * @Get("/{id}", name="home.comment.show") + */ + public function showAction($id) + { + $service = new CommentService(); + + $comment = $service->getComment($id); + + return $this->response->ajaxSuccess($comment); + } + + /** + * @Get("/{id}/replies", name="home.comment.replies") + */ + public function repliesAction($id) + { + $service = new CommentService(); + + $replies = $service->getReplies($id); + + return $this->response->ajaxSuccess($replies); + } + + /** + * @Post("/{id}/delete", name="home.comment.delete") + */ + public function deleteAction($id) + { + $service = new CommentService(); + + $service->delete($id); + + return $this->response->ajaxSuccess(); + } + + /** + * @Post("/{id}/agree", name="home.comment.agree") + */ + public function agreeAction($id) + { + $service = new CommentService(); + + $service->agree($id); + + return $this->response->ajaxSuccess(); + } + + /** + * @Post("/{id}/oppose", name="home.comment.oppose") + */ + public function opposeAction($id) + { + $service = new CommentService(); + + $service->oppose($id); + + return $this->response->ajaxSuccess(); + } + +} diff --git a/app/Http/Home/Controllers/ConsultController.php b/app/Http/Home/Controllers/ConsultController.php new file mode 100644 index 00000000..cde47ca3 --- /dev/null +++ b/app/Http/Home/Controllers/ConsultController.php @@ -0,0 +1,101 @@ +create(); + + $data = $service->getConsult($consult->id); + + return $this->ajaxSuccess($data); + } + + /** + * @Get("/{id}", name="home.consult.show") + */ + public function showAction($id) + { + $service = new ConsultService(); + + $consult = $service->getConsult($id); + + return $this->ajaxSuccess($consult); + } + + /** + * @Post("/{id}/update", name="home.consult.update") + */ + public function updateAction($id) + { + $service = new ConsultService(); + + $consult = $service->update($id); + + $data = $service->getConsult($consult->id); + + return $this->ajaxSuccess($data); + } + + /** + * @Post("/{id}/delete", name="home.consult.delete") + */ + public function deleteAction($id) + { + $service = new ConsultService(); + + $service->delete($id); + + return $this->ajaxSuccess(); + } + + /** + * @Post("/{id}/agree", name="home.consult.agree") + */ + public function agreeAction($id) + { + $service = new ConsultService(); + + $service->agree($id); + + return $this->ajaxSuccess(); + } + + /** + * @Post("/{id}/oppose", name="home.consult.oppose") + */ + public function opposeAction($id) + { + $service = new ConsultService(); + + $service->oppose($id); + + return $this->ajaxSuccess(); + } + + /** + * @Post("/{id}/reply", name="home.consult.reply") + */ + public function replyAction($id) + { + $service = new ConsultService(); + + $service->reply($id); + + return $this->ajaxSuccess(); + } + +} diff --git a/app/Http/Home/Controllers/Controller.php b/app/Http/Home/Controllers/Controller.php new file mode 100644 index 00000000..3eb2bc7e --- /dev/null +++ b/app/Http/Home/Controllers/Controller.php @@ -0,0 +1,26 @@ +router->getControllerName(); + + if ($controllerName != 'index') { + //$this->request->checkReferer(); + } + + if ($this->request->isPost()) { + //$this->request->checkToken(); + } + } + +} diff --git a/app/Http/Home/Controllers/CourseController.php b/app/Http/Home/Controllers/CourseController.php new file mode 100644 index 00000000..aa57c286 --- /dev/null +++ b/app/Http/Home/Controllers/CourseController.php @@ -0,0 +1,159 @@ +getCourses(); + + $this->view->courses = $courses; + } + + /** + * @Get("/{id}", name="home.course.show") + */ + public function showAction($id) + { + $service = new CourseService(); + + $course = $service->getCourse($id); + + $this->view->course = $course; + } + + /** + * @Get("/{id}/chapters", name="home.course.chapters") + */ + public function chaptersAction($id) + { + $service = new CourseService(); + + $chapters = $service->getChapters($id); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + + $this->view->chapters = $chapters; + } + + /** + * @Get("/{id}/consults", name="home.course.consults") + */ + public function consultsAction($id) + { + $service = new CourseService(); + + $consults = $service->getConsults($id); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + + $this->view->consults = $consults; + } + + /** + * @Get("/{id}/reviews", name="home.course.reviews") + */ + public function reviewsAction($id) + { + $service = new CourseService(); + + $reviews = $service->getReviews($id); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + + $this->view->reviews = $reviews; + } + + /** + * @Get("/{id}/comments", name="home.course.comments") + */ + public function commentsAction($id) + { + $service = new CourseService(); + + $comments = $service->getComments($id); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + + $this->view->comments = $comments; + } + + /** + * @Get("/{id}/users", name="home.course.users") + */ + public function usersAction($id) + { + $service = new CourseService(); + + $users = $service->getUsers($id); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + + $this->view->users = $users; + } + + /** + * @Post("/{id}/favorite", name="home.course.favorite") + */ + public function favoriteAction($id) + { + $service = new CourseService(); + + $service->favorite($id); + + return $this->response->ajaxSuccess(); + } + + /** + * @Post("/{id}/unfavorite", name="home.course.unfavorite") + */ + public function unfavoriteAction($id) + { + $service = new CourseService(); + + $service->unfavorite($id); + + return $this->response->ajaxSuccess(); + } + + /** + * @Post("/{id}/apply", name="home.course.apply") + */ + public function applyAction($id) + { + $service = new CourseService(); + + $service->apply($id); + + return $this->response->ajaxSuccess(); + } + + /** + * @Get("/{id}/start", name="home.course.start") + */ + public function startAction($id) + { + $service = new CourseService(); + + $chapter = $service->getStartChapter($id); + + $this->response->redirect([ + 'for' => 'home.chapter.show', + 'id' => $chapter->id, + ]); + } + +} diff --git a/app/Http/Home/Controllers/ErrorController.php b/app/Http/Home/Controllers/ErrorController.php new file mode 100644 index 00000000..8318b4c9 --- /dev/null +++ b/app/Http/Home/Controllers/ErrorController.php @@ -0,0 +1,65 @@ +view->setRenderLevel(View::LEVEL_ACTION_VIEW); + } + + /** + * @Get("/400", name="error.400") + */ + public function show400Action() + { + $this->response->setStatusCode(400); + } + + /** + * @Get("/401", name="error.401") + */ + public function show401Action() + { + $this->response->setStatusCode(401); + } + + /** + * @Get("/403", name="error.403") + */ + public function show403Action() + { + $this->response->setStatusCode(403); + } + + /** + * @Get("/404", name="error.404") + */ + public function show404Action() + { + $this->response->setStatusCode(404); + + if ($this->request->isAjax()) { + return $this->ajaxError(['code' => 'sys.uri_not_found']); + } + } + + /** + * @Get("/500", name="error.500") + */ + public function show500Action() + { + $this->response->setStatusCode(500); + } + +} diff --git a/app/Http/Home/Controllers/IndexController.php b/app/Http/Home/Controllers/IndexController.php new file mode 100644 index 00000000..eca43db2 --- /dev/null +++ b/app/Http/Home/Controllers/IndexController.php @@ -0,0 +1,24 @@ +getCourses(); + + var_dump($courses);exit; + + $this->view->courses = $courses; + } + + /** + * @Get("/consults", name="home.my.consults") + */ + public function consultsAction() + { + $service = new MyService(); + + $consults = $service->getConsults(); + + $this->view->consults = $consults; + } + + /** + * @Get("/reviews", name="home.my.reviews") + */ + public function reviewsAction() + { + $service = new MyService(); + + $reviews = $service->getReviews(); + + $this->view->reviews = $reviews; + } + + /** + * @Get("/orders", name="home.my.orders") + */ + public function ordersAction() + { + $service = new MyService(); + + $orders = $service->getOrders(); + + $this->view->orders = $orders; + + return $this->ajaxSuccess($orders); + } + + /** + * @Get("/coupons", name="home.my.coupons") + */ + public function couponsAction() + { + $service = new MyService(); + + $coupons = $service->getCoupons(); + + $this->view->coupons = $coupons; + } + + /** + * @Get("/balance", name="home.my.balance") + */ + public function balanceAction() + { + + } + +} diff --git a/app/Http/Home/Controllers/NotifyController.php b/app/Http/Home/Controllers/NotifyController.php new file mode 100644 index 00000000..01bc8364 --- /dev/null +++ b/app/Http/Home/Controllers/NotifyController.php @@ -0,0 +1,59 @@ +handleNotify(); + + if (!$response) exit; + + $response->send(); + + exit; + } + + /** + * @Post("/wxpay/notify", name="home.wxpay.notify") + */ + public function wxpayNotifyAction() + { + $alipayService = new AlipayService(); + + $response = $alipayService->handleNotify(); + + if (!$response) exit; + + $response->send(); + + exit; + } + + /** + * @Post("/vod/notify", name="home.vod.notify") + */ + public function vodNotifyAction() + { + + } + + /** + * @Post("/live/notify", name="home.live.notify") + */ + public function liveNotifyAction() + { + + } + +} diff --git a/app/Http/Home/Controllers/OrderController.php b/app/Http/Home/Controllers/OrderController.php new file mode 100644 index 00000000..40f52730 --- /dev/null +++ b/app/Http/Home/Controllers/OrderController.php @@ -0,0 +1,142 @@ +request->get('item_type'); + $itemId = $this->request->get('item_id'); + + $service = new OrderService(); + + switch ($itemType) { + + case OrderModel::ITEM_TYPE_COURSE: + + $course = $service->getCourse($itemId); + + $this->view->course = $course; + + break; + + case OrderModel::ITEM_TYPE_PACKAGE: + + $package = $service->getPackage($itemId); + $courses = $service->getPackageCourses($itemId); + + $this->view->package = $package; + $this->view->courses = $courses; + + break; + + case OrderModel::ITEM_TYPE_REWARD: + + $course = $service->getCourse($itemId); + + $this->view->course = $course; + + break; + } + } + + /** + * @Post("/create", name="home.order.create") + */ + public function createAction() + { + $service = new OrderService(); + + $order = $service->create(); + + return $this->response->ajaxSuccess($order); + } + + /** + * @Get("/cashier", name="home.order.cashier") + */ + public function cashierAction() + { + $service = new OrderService(); + + $tradeNo = $this->request->getQuery('trade_no'); + + $order = $service->getOrder($tradeNo); + $orderItems = $service->getOrderItems($order->id); + + $this->view->order = $order; + $this->view->orderItems = $orderItems; + + return $this->ajaxSuccess($order->toArray()); + } + + /** + * @Post("/pay", name="home.order.pay") + */ + public function payAction() + { + $service = new OrderService(); + + $tradeNo = $this->request->getPost('trade_no'); + $payChannel = $this->request->getPost('pay_channel'); + + $order = $service->getOrder($tradeNo); + + $qrCodeText = $service->qrCode($tradeNo, $payChannel); + + //$qrCodeUrl = "http://qr.liantu.com/api.php?text={$qrCodeText}"; + + $this->view->order = $order; + $this->view->qrCodeText = $qrCodeText; + } + + /** + * @Post("/notify/{channel}", name="home.order.notify") + */ + public function notifyAction($channel) + { + $service = new OrderService(); + + $service->notify($channel); + } + + /** + * @Post("/status", name="home.order.status") + */ + public function statusAction() + { + $service = new OrderService(); + + $tradeNo = $this->request->getPost('trade_no'); + + $order = $service->getOrder($tradeNo); + + $this->response->ajaxSuccess([ + 'status' => $order->status + ]); + } + + /** + * @Post("/cancel", name="home.order.cancel") + */ + public function cancelAction() + { + $service = new OrderService(); + + $order = $service->cancel(); + + return $this->ajaxSuccess($order->toArray()); + } + +} diff --git a/app/Http/Home/Controllers/PublicController.php b/app/Http/Home/Controllers/PublicController.php new file mode 100644 index 00000000..3af537fb --- /dev/null +++ b/app/Http/Home/Controllers/PublicController.php @@ -0,0 +1,30 @@ +response->setStatusCode(404); + return $this->response; + } + + $storageService = new StorageService(); + + $location = $storageService->getCiImageUrl($contentImage->path); + + $this->response->redirect($location); + } + +} diff --git a/app/Http/Home/Controllers/ReviewController.php b/app/Http/Home/Controllers/ReviewController.php new file mode 100644 index 00000000..482cd2f2 --- /dev/null +++ b/app/Http/Home/Controllers/ReviewController.php @@ -0,0 +1,101 @@ +create(); + + $data = $service->getReview($review->id); + + return $this->ajaxSuccess($data); + } + + /** + * @Get("/{id}", name="home.review.show") + */ + public function showAction($id) + { + $service = new ReviewService(); + + $review = $service->getReview($id); + + return $this->response->ajaxSuccess($review); + } + + /** + * @Post("/{id}/update", name="home.review.update") + */ + public function updateAction($id) + { + $service = new ReviewService(); + + $review = $service->update($id); + + $data = $service->getReview($review->id); + + return $this->response->ajaxSuccess($data); + } + + /** + * @Post("/{id}/delete", name="home.review.delete") + */ + public function deleteAction($id) + { + $service = new ReviewService(); + + $service->delete($id); + + return $this->response->ajaxSuccess(); + } + + /** + * @Post("/{id}/agree", name="home.review.agree") + */ + public function agreeAction($id) + { + $service = new ReviewService(); + + $service->agree($id); + + return $this->response->ajaxSuccess(); + } + + /** + * @Post("/{id}/oppose", name="home.review.oppose") + */ + public function opposeAction($id) + { + $service = new ReviewService(); + + $service->oppose($id); + + return $this->response->ajaxSuccess(); + } + + /** + * @Post("/{id}/reply", name="home.review.reply") + */ + public function replyAction($id) + { + $service = new ReviewService(); + + $service->reply($id); + + return $this->response->ajaxSuccess(); + } + +} diff --git a/app/Http/Home/Controllers/SearchController.php b/app/Http/Home/Controllers/SearchController.php new file mode 100644 index 00000000..3e26d39e --- /dev/null +++ b/app/Http/Home/Controllers/SearchController.php @@ -0,0 +1,89 @@ +request->getQuery('q'); + + $indexer = new \App\Library\Indexer\Course(); + + $courses = $indexer->search($query); + + echo "total: {$courses['total']}
"; + echo "
"; + + foreach ($courses['items'] as $course) { + echo "title:{$course->title}
"; + echo "summary:{$course->summary}
"; + echo "tags:{$course->tags}
"; + echo "
"; + } + + exit; + } + + /** + * @Get("/course/update", name="home.search.update_course") + */ + public function updateCourseAction() + { + $indexer = new \App\Library\Indexer\Course(); + + $courseRepo = new \App\Repos\Course(); + + $course = $courseRepo->findById(1); + + $indexer->updateIndex($course); + + echo "update ok"; + + exit; + } + + /** + * @Get("/course/create", name="home.search.create_course") + */ + public function createCourseAction() + { + $indexer = new \App\Library\Indexer\Course(); + + $courseRepo = new \App\Repos\Course(); + + $course = $courseRepo->findById(1); + + $indexer->addIndex($course); + + echo "create ok"; + + exit; + } + + /** + * @Get("/course/delete", name="home.search.delete_course") + */ + public function deleteCourseAction() + { + $indexer = new \App\Library\Indexer\Course(); + + $courseRepo = new \App\Repos\Course(); + + $course = $courseRepo->findById(1); + + $indexer->deleteIndex($course); + + echo "delete ok"; + + exit; + } + +} diff --git a/app/Http/Home/Controllers/UserController.php b/app/Http/Home/Controllers/UserController.php new file mode 100644 index 00000000..b2386694 --- /dev/null +++ b/app/Http/Home/Controllers/UserController.php @@ -0,0 +1,67 @@ +setShared('view', function () { + $view = new View(); + $view->setViewsDir(__DIR__ . '/Views'); + $view->registerEngines([ + '.volt' => 'volt', + ]); + return $view; + }); + } +} diff --git a/app/Http/Home/Services/Account.php b/app/Http/Home/Services/Account.php new file mode 100644 index 00000000..7df4b081 --- /dev/null +++ b/app/Http/Home/Services/Account.php @@ -0,0 +1,214 @@ +request->getPost(); + + $filter = new AccountFilter(); + + $mobile = $filter->checkMobile($post['mobile']); + $password = $filter->checkPassword($post['password']); + $code = $filter->checkCode($post['code']); + + $captcha = $filter->checkCaptcha($mobile, $code); + + $filter->checkIfMobileTaken($mobile); + + $accountRepo = new AccountRepo(); + + $account = $accountRepo->create([ + 'mobile' => $mobile, + 'password' => $this->security->hash($password), + ]); + + $userRepo = new UserRepo(); + + $userRepo->create([ + 'id' => $account->id, + 'name' => 'user_' . sprintf('%06d', $account->id), + ]); + + $this->clearCaptcha($captcha); + + $this->setAuthToken($account); + } + + public function login() + { + $post = $this->request->getPost(); + + $filter = new AccountFilter(); + + $mobile = $filter->checkMobile($post['mobile']); + $password = $filter->checkPassword($post['password']); + + $accountRepo = new AccountRepo(); + + $account = $accountRepo->findByMobile($mobile); + + if (!$account) { + throw new UnauthorizedException('account.login_mobile_incorrect'); + } + + $passwordOk = $this->security->checkHash($password, $account->password); + + if (!$passwordOk) { + throw new UnauthorizedException('account.login_password_incorrect'); + } + + $this->setAuthToken($account); + } + + public function logout() + { + if ($this->cookies->has('token')) { + $this->cookies->get('token')->delete(); + } + } + + public function resetPassword() + { + $post = $this->request->getPost(); + + $filter = new AccountFilter(); + + $mobile = $filter->checkMobile($post['mobile']); + $newPassword = $filter->checkPassword($post['new_password']); + $code = $filter->checkCode($post['code']); + + $filter->checkConfirmPassword($post['new_password'], $post['confirm_password']); + + $accountRepo = new AccountRepo(); + + $account = $accountRepo->findByMobile($mobile); + + if (!$account) { + throw new BadRequestException('account.not_found'); + } + + $captcha = $filter->checkCaptcha($mobile, $code); + + $account->password = $this->security->hash($newPassword); + + $account->update(); + + $this->clearCaptcha($captcha); + } + + public function updateMobile() + { + $user = $this->getLoggedUser(); + + $account = $this->findOrFail($user->id); + + $post = $this->request->getPost(); + + $filter = new AccountFilter(); + + $filter->checkOriginPassword($post['origin_password'], $account->password); + + $mobile = $filter->checkMobile($post['mobile']); + $code = $filter->checkCode($post['code']); + + if ($mobile != $account->mobile) { + $filter->checkIfMobileTaken($mobile); + } + + $captcha = $filter->checkCaptcha($mobile, $code); + + $account->mobile = $mobile; + + $account->update(); + + $this->clearCaptcha($captcha); + } + + public function updatePassword() + { + $user = $this->getLoggedUser(); + + $account = $this->findOrFail($user->id); + + $post = $this->request->getPost(); + + $filter = new AccountFilter(); + + $filter->checkOriginPassword($post['origin_password'], $account->password); + + $newPassword = $filter->checkPassword($post['new_password']); + + $filter->checkConfirmPassword($post['new_password'], $post['confirm_password']); + + $account->password = $this->security->hash($newPassword); + + $account->update(); + } + + public function sendCaptcha() + { + $post = $this->request->getPost(); + + $filter = new AccountFilter(); + + $mobile = $filter->checkMobile($post['mobile']); + + $captchaRepo = new CaptchaRepo(); + + $oldCaptcha = $captchaRepo->findLastByMobile($mobile); + + if ($oldCaptcha) { + if (time() + 120 < $oldCaptcha->expire_time) { + return $oldCaptcha; + } + } + + $clientIp = $this->request->getClientAddress(); + + $fromTime = time() - 3600; + + $filter->checkCaptchaLimit($clientIp, $fromTime); + + $captcha = $captchaRepo->create([ + 'mobile' => $mobile, + 'code' => rand(1000, 9999), + 'client_ip' => $clientIp, + 'expire_time' => time() + 600, + ]); + + return $captcha; + } + + private function findOrFail($id) + { + $repo = new AccountRepo(); + + $result = $repo->findOrFail($id); + + return $result; + } + + private function clearCaptcha($captcha) + { + $captcha->expire_time = 0; + + $captcha->update(); + } + + private function setAuthToken($account) + { + $this->cookies->set('token', $account->id, strtotime('+1 month')); + } + +} diff --git a/app/Http/Home/Services/Category.php b/app/Http/Home/Services/Category.php new file mode 100644 index 00000000..c9374365 --- /dev/null +++ b/app/Http/Home/Services/Category.php @@ -0,0 +1,96 @@ +findOrFail($id); + + return $category; + } + + public function getChilds($id) + { + $categoryRepo = new CategoryRepo(); + + $childs = $categoryRepo->find([ + 'parent_id' => $id, + 'status' => CategoryModel::STATUS_NORMAL, + ]); + + return $childs; + } + + public function getCourses($id) + { + $category = $this->findOrFail($id); + + $pagerQuery = new PagerQuery(); + + $params = $pagerQuery->getParams(); + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $filter = new CourseFilter(); + + $where = []; + + $where['category_id'] = $category->id; + + if (!empty($params['model'])) { + $where['model'] = $filter->checkModel($params['model']); + } + + if (!empty($params['level'])) { + $where['level'] = $filter->checkLevel($params['level']); + } + + $where['status'] = CourseModel::STATUS_PUBLISHED; + + $courseRepo = new CourseRepo(); + + $pager = $courseRepo->paginate($where, $sort, $page, $limit); + + return $this->handleCourses($pager); + } + + private function findOrFail($id) + { + $repo = new CategoryRepo(); + + $result = $repo->findOrFail($id); + + return $result; + } + + private function handleCourses($pager) + { + if ($pager->total_items > 0) { + + $builder = new CourseListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleUsers($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + +} diff --git a/app/Http/Home/Services/Chapter.php b/app/Http/Home/Services/Chapter.php new file mode 100644 index 00000000..d2712dc0 --- /dev/null +++ b/app/Http/Home/Services/Chapter.php @@ -0,0 +1,210 @@ +findOrFail($id); + + $user = $this->getCurrentUser(); + + return $this->handleChapter($user, $chapter); + } + + public function getComments($id) + { + $chapter = $this->findOrFail($id); + + $pagerQuery = new PagerQuery(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $where = [ + 'chapter_id' => $chapter->id, + 'status' => CommentModel::STATUS_NORMAL, + ]; + + $commentRepo = new CommentRepo(); + + $pager = $commentRepo->paginate($where, $sort, $page, $limit); + + return $this->handleComments($pager); + } + + public function agree($id) + { + $chapter = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $voteRepo = new ChapterVoteRepo(); + + $vote = $voteRepo->find($user->id, $chapter->id); + + if ($vote) { + throw new BadRequestException('chapter.has_voted'); + } + + $voteRepo->agree($user->id, $chapter->id); + + $chapter->agree_count += 1; + + $chapter->update(); + } + + public function oppose($id) + { + $chapter = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $chapterVoteRepo = new ChapterVoteRepo(); + + $vote = $chapterVoteRepo->find($user->id, $chapter->id); + + if ($vote) { + throw new BadRequestException('chapter.has_voted'); + } + + $chapterVoteRepo->oppose($user->id, $chapter->id); + + $chapter->oppose_count += 1; + + $chapter->update(); + } + + public function position($id) + { + $chapter = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $chapterUserRepo = new ChapterUserRepo(); + + $chapterUser = $chapterUserRepo->find($user->id, $chapter->id); + + if (!$chapterUser) { + return; + } + + $filter = new ChapterFilter(); + + $position = $this->request->getPost('position'); + + $chapterUser->position = $filter->checkPosition($position, $chapter->duration); + + $chapterUser->update(); + } + + public function finish($id) + { + $chapter = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $chapterUserRepo = new ChapterUserRepo(); + + $chapterUser = $chapterUserRepo->find($user->id, $chapter->id); + + if (!$chapterUser) { + throw new BadRequestException('chapter.has_not_started'); + } + + if ($chapterUser->finished == 1) { + return; + } + + $chapterUser->finished = 1; + + $chapterUser->update(); + + $chapter->finish_count += 1; + + $chapter->update(); + } + + private function findOrFail($id) + { + $repo = new ChapterRepo(); + + $result = $repo->findOrFail($id); + + return $result; + } + + private function handleComments($pager) + { + if ($pager->total_items > 0) { + + $builder = new CommentListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleUsers($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + + private function handleChapter($user, $chapter) + { + $result = $chapter->toArray(); + + $result['me']['allow_view'] = 0; + + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($chapter->course_id); + + $filter = new ChapterFilter(); + + $allowView = $filter->checkViewPriv($user, $chapter, $course); + + if ($allowView) { + + $result['me']['allow_view'] = 1; + + $chapterUserRepo = new ChapterUserRepo(); + + $chapterUser = $chapterUserRepo->find($user->id, $chapter->id); + + if (!$chapterUser) { + $chapterUserRepo->create([ + 'user_id' => $user->id, + 'course_id' => $course->id, + 'chapter_id' => $chapter->id, + ]); + } + + $videoRepo = new VideoRepo(); + + $videos = $videoRepo->findByChapterId($chapter->id); + + $result['videos'] = $videos->toArray(); + } + + return $result; + } + +} diff --git a/app/Http/Home/Services/ChapterAdmin.php b/app/Http/Home/Services/ChapterAdmin.php new file mode 100644 index 00000000..de57d068 --- /dev/null +++ b/app/Http/Home/Services/ChapterAdmin.php @@ -0,0 +1,180 @@ +findOrFail($id); + + return $chapter; + } + + public function getCourse($courseId) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($courseId); + + return $course; + } + + public function getTopChapters($courseId) + { + $courseRepo = new CourseRepo(); + + $result = $courseRepo->findTopChapters($courseId); + + return $result; + } + + public function create() + { + $user = $this->getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new ChapterFilter(); + + $data = []; + + $data['course_id'] = $filter->checkCourseId($post['course_id']); + $data['title'] = $filter->checkTitle($post['title']); + $data['summary'] = $filter->checkSummary($post['summary']); + $data['free'] = $filter->checkFree($post['free']); + + $chapterRepo = new ChapterRepo(); + + if (isset($post['parent_id'])) { + $data['parent_id'] = $filter->checkParentId($post['parent_id']); + $data['priority'] = $chapterRepo->maxSectionPriority($data['parent_id']); + } else { + $data['priority'] = $chapterRepo->maxChapterPriority($data['course_id']); + } + + $data['priority'] += 1; + $data['user_id'] = $user->id; + $data['status'] = ChapterModel::STATUS_DRAFT; + + $chapter = $chapterRepo->create($data); + + if ($chapter->parent_id > 0) { + + $service = new ChapterContent(); + + $service->create($chapter); + + $this->updateChapterCount($chapter); + } + + return $chapter; + } + + public function update($id) + { + $chapter = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new ChapterFilter(); + + $filter->checkOwner($user->id, $chapter->user_id); + + $data = []; + + if (isset($post['title'])) { + $data['title'] = $filter->checkTitle($post['title']); + } + + if (isset($post['summary'])) { + $data['summary'] = $filter->checkSummary($post['summary']); + } + + if (isset($post['free'])) { + $data['free'] = $filter->checkFree($post['free']); + } + + if (isset($post['priority'])) { + $data['priority'] = $filter->checkPriority($post['priority']); + } + + $chapter->update($data); + + return $chapter; + } + + public function delete($id) + { + $chapter = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $filter = new ChapterFilter(); + + $filter->checkOwner($user->id, $chapter->user_id); + + if ($chapter->status == ChapterModel::STATUS_DELETED) { + return; + } + + $chapter->status = ChapterModel::STATUS_DELETED; + + $chapter->update(); + + $this->updateChapterCount($chapter); + } + + public function getContent($id) + { + $service = new ChapterContent(); + + $chapter = $this->findOrFail($id); + + $result = $service->get($chapter); + + return $result; + } + + public function updateContent($id) + { + $service = new ChapterContent(); + + $chapter = $this->findOrFail($id); + + $result = $service->update($chapter); + + return $result; + } + + private function findOrFail($id) + { + $repo = new ChapterRepo(); + + $result = $repo->findOrFail($id); + + return $result; + } + + private function updateChapterCount($chapter) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($chapter->course_id); + + $chapterCount = $courseRepo->countChapters($course->id); + + $course->chapter_count = $chapterCount; + + $course->update(); + } + +} diff --git a/app/Http/Home/Services/ChapterContentAdmin.php b/app/Http/Home/Services/ChapterContentAdmin.php new file mode 100644 index 00000000..22b0babc --- /dev/null +++ b/app/Http/Home/Services/ChapterContentAdmin.php @@ -0,0 +1,234 @@ +findById($chapter->course_id); + + $result = null; + + switch ($course->model) { + + case CourseModel::MODEL_VIDEO: + $result = $this->getVideo($chapter); + break; + + case CourseModel::MODEL_LIVE: + $result = $this->getLive($chapter); + break; + + case CourseModel::MODEL_ARTICLE: + $result = $this->getArticle($chapter); + break; + } + + return $result; + } + + public function create($chapter) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($chapter->course_id); + + $result = null; + + switch ($course->model) { + + case CourseModel::MODEL_VIDEO: + $result = $this->createVideo($chapter); + break; + + case CourseModel::MODEL_LIVE: + $result = $this->createLive($chapter); + break; + + case CourseModel::MODEL_ARTICLE: + $result = $this->createArticle($chapter); + break; + } + + return $result; + } + + public function update($chapter) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($chapter->course_id); + + $result = null; + + switch ($course->model) { + + case CourseModel::MODEL_VIDEO: + $result = $this->updateVideo($chapter); + break; + + case CourseModel::MODEL_LIVE: + $result = $this->updateLive($chapter); + break; + + case CourseModel::MODEL_ARTICLE: + $result = $this->updateArticle($chapter); + break; + } + + return $result; + } + + private function getVideo($chapter) + { + $videoRepo = new ChapterVideoRepo(); + + $video = $videoRepo->findOriginChapterVideo($chapter->id); + + return $video; + } + + private function getArticle($chapter) + { + $articleRepo = new ChapterArticleRepo(); + + $article = $articleRepo->findByChapterId($chapter->id); + + return $article; + } + + private function getLive($chapter) + { + $liveRepo = new ChapterLiveRepo(); + + $live = $liveRepo->findByChapterId($chapter->id); + + $startTime = strtotime(date('y-m-d')); + $endTime = $startTime + 3600; + + if ($live->start_time == 0) { + $live->start_time = $startTime; + } + + if ($live->end_time == 0) { + $live->end_time = $endTime; + } + + return $live; + } + + private function createVideo($chapter) + { + $video = new ChapterVideoModel(); + + $video->chapter_id = $chapter->id; + $video->definition = ChapterVideoModel::DFN_ORG; + + $video->create(); + + return $video; + } + + private function createLive($chapter) + { + $live = new ChapterLiveModel(); + + $live->chapter_id = $chapter->id; + + $live->create(); + + return $live; + } + + private function createArticle($chapter) + { + $article = new ChapterArticleModel(); + + $article->chapter_id = $chapter->id; + $article->content_markdown = ''; + $article->content_html = ''; + + $article->create(); + + return $article; + } + + private function updateVideo($chapter) + { + $post = $this->request->getPost(); + + $filter = new ChapterVideoFilter(); + + $data = []; + + $data['play_url'] = $filter->checkPlayUrl($post['play_url']); + + $videoRepo = new ChapterVideoRepo(); + + $video = $videoRepo->findOriginChapterVideo($chapter->id); + + if ($video->play_url != $data['play_url']) { + $video->update($data); + } + + return $video; + } + + private function updateLive($chapter) + { + $post = $this->request->getPost(); + + $filter = new ChapterLiveFilter(); + + $data = []; + + $liveTime = $filter->checkLiveTime($post['start_time'], $post['end_time']); + + $data['start_time'] = $liveTime['start_time']; + $data['end_time'] = $liveTime['end_time']; + + $liveRepo = new ChapterLiveRepo(); + + $live = $liveRepo->findByChapterId($chapter->id); + + $live->update($data); + + return $live; + } + + private function updateArticle($chapter) + { + $post = $this->request->getPost(); + + $filter = new ChapterArticleFilter(); + + $data = []; + + $data['content_html'] = $filter->checkContent($post['content']); + + $articleRepo = new ChapterArticleRepo(); + + $article = $articleRepo->findByChapterId($chapter->id); + + $article->update($data); + + return $article; + } + +} diff --git a/app/Http/Home/Services/Comment.php b/app/Http/Home/Services/Comment.php new file mode 100644 index 00000000..e70c61d4 --- /dev/null +++ b/app/Http/Home/Services/Comment.php @@ -0,0 +1,198 @@ +getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new CommentFilter(); + + $data = []; + + $data['user_id'] = $user->id; + $data['chapter_id'] = $filter->checkChapterId($post['chapter_id']); + $data['content'] = $filter->checkContent($post['content']); + + if (!empty($post['parent_id'])) { + $data['parent_id'] = $filter->checkParentId($post['parent_id']); + } + + if (!empty($post['to_user_id'])) { + $data['to_user_id'] = $filter->checkToUserId($post['to_user_id']); + } + + $chapterRepo = new ChapterRepo(); + + $chapter = $chapterRepo->findById($data['chapter_id']); + + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($chapter->course_id); + + $data['course_id'] = $course->id; + + $commentRepo = new CommentRepo(); + + $comment = $commentRepo->create($data); + + $chapter->comment_count += 1; + + $chapter->update(); + + $course->comment_count += 1; + + $course->update(); + + return $comment; + } + + public function getComment($id) + { + $comment = $this->findOrFail($id); + + return $this->handleComment($comment); + } + + public function getReplies($id) + { + $comment = $this->findOrFail($id); + + $pagerQuery = new PagerQuery(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $where = [ + 'parent_id' => $comment->id, + 'status' => CommentModel::STATUS_NORMAL, + ]; + + $commentRepo = new CommentRepo(); + + $pager = $commentRepo->paginate($where, $sort, $page, $limit); + + $pager = $pager->paginate(); + + return $this->handleReplies($pager); + } + + public function delete($id) + { + $comment = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $filter = new CommentFilter(); + + $filter->checkOwner($user->id, $comment->user_id); + + if ($comment->status == CommentModel::STATUS_DELETED) { + return; + } + + $comment->status = CommentModel::STATUS_DELETED; + + $comment->update(); + } + + public function agree($id) + { + $comment = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $voteRepo = new CommentVoteRepo(); + + $vote = $voteRepo->find($user->id, $comment->id); + + if ($vote) { + throw new BadRequestException('comment.has_voted'); + } + + $voteRepo->agree($user->id, $comment->id); + + $comment->agree_count += 1; + + $comment->update(); + } + + public function oppose($id) + { + $comment = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $voteRepo = new CommentVoteRepo(); + + $vote = $voteRepo->find($user->id, $comment->id); + + if ($vote) { + throw new BadRequestException('comment.has_voted'); + } + + $voteRepo->oppose($user->id, $comment->id); + + $comment->oppose_count += 1; + + $comment->update(); + } + + private function findOrFail($id) + { + $repo = new CommentRepo(); + + $result = $repo->findOrFail($id); + + return $result; + } + + private function handleComment($comment) + { + $result = $comment->toArray(); + + $userRepo = new UserRepo(); + + $user = $userRepo->findShallowUser($comment->user_id); + + $result['user'] = $user->toArray(); + + return (object) $result; + } + + private function handleReplies($pager) + { + if ($pager->total_items > 0) { + + $builder = new CommentListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleUsers($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + +} diff --git a/app/Http/Home/Services/Consult.php b/app/Http/Home/Services/Consult.php new file mode 100644 index 00000000..0dd0ccf8 --- /dev/null +++ b/app/Http/Home/Services/Consult.php @@ -0,0 +1,174 @@ +getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new ConsultFilter(); + + $data = []; + + $data['user_id'] = $user->id; + $data['course_id'] = $filter->checkCourseId($post['course_id']); + $data['content'] = $filter->checkContent($post['content']); + + $consultRepo = new ConsultRepo(); + + $consult = $consultRepo->create($data); + + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($data['course_id']); + + $course->consult_count += 1; + + $course->update(); + + return $consult; + } + + public function getConsult($id) + { + $consult = $this->findOrFail($id); + + return $this->handleConsult($consult); + } + + public function update($id) + { + $consult = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new ConsultFilter(); + + $filter->checkOwner($user->id, $consult->user_id); + + $content = $filter->checkContent($post['content']); + + $consult->content = $content; + + return $consult; + } + + public function delete($id) + { + $consult = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $filter = new ConsultFilter(); + + $filter->checkOwner($user->id, $consult->user_id); + + if ($consult->status == ConsultModel::STATUS_DELETED) { + return; + } + + $consult->status = ConsultModel::STATUS_DELETED; + + $consult->update(); + } + + public function agree($id) + { + $consult = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $voteRepo = new ConsultVoteRepo(); + + $vote = $voteRepo->find($user->id, $consult->id); + + if ($vote) { + throw new BadRequestException('consult.has_voted'); + } + + $voteRepo->agree($user->id, $consult->id); + + $consult->agree_count += 1; + + $consult->update(); + } + + public function oppose($id) + { + $consult = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $voteRepo = new ConsultVoteRepo(); + + $vote = $voteRepo->find($user->id, $consult->id); + + if ($vote) { + throw new BadRequestException('consult.has_voted'); + } + + $voteRepo->oppose($user->id, $consult->id); + + $consult->oppose_count += 1; + + $consult->update(); + } + + public function reply($id) + { + $consult = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new ConsultFilter(); + + $filter->checkOwner($user->id, $consult->user_id); + + $reply = $filter->checkReply($post['reply']); + + $consult->reply = $reply; + $consult->reply_time = time(); + + $consult->update(); + } + + private function findOrFail($id) + { + $repo = new ConsultRepo(); + + $result = $repo->findOrFail($id); + + return $result; + } + + private function handleConsult($consult) + { + $result = $consult->toArray(); + + $userRepo = new UserRepo(); + + $user = $userRepo->findShallowUser($consult->user_id); + + $result['user'] = $user->toArray(); + + return (object) $result; + } + +} diff --git a/app/Http/Home/Services/Course.php b/app/Http/Home/Services/Course.php new file mode 100644 index 00000000..8e783ace --- /dev/null +++ b/app/Http/Home/Services/Course.php @@ -0,0 +1,374 @@ +findById($categoryId); + + $ids = explode(',', trim($category->path, ',')); + + $categories = $categoryRepo->findByIds($ids, ['id', 'name']); + + $paths = []; + + foreach ($categories as $category) { + $paths[] = $category->name; + } + + return implode(' > ', $paths); + } + + public function getCourse($id) + { + $course = $this->findOrFail($id); + + $user = $this->getCurrentUser(); + + return $this->handleCourse($user, $course); + } + + public function getChapters($id) + { + $course = $this->findOrFail($id); + + $user = $this->getCurrentUser(); + + $courseRepo = new CourseRepo(); + + $topChapters = $courseRepo->findTopChapters($course->id); + + $subChapters = $courseRepo->findSubChapters($course->id, $course->model); + + $myChapters = null; + + if ($user->id > 0) { + $myChapters = $courseRepo->findUserChapters($user->id, $course->id); + } + + return $this->handleChapters($topChapters, $subChapters, $myChapters); + } + + public function getConsults($id) + { + $course = $this->findOrFail($id); + + $pagerQuery = new PagerQuery(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $where = [ + 'course_id' => $course->id, + 'status' => ConsultModel::STATUS_NORMAL, + ]; + + $consultRepo = new ConsultRepo(); + + $pager = $consultRepo->paginate($where, $sort, $page, $limit); + + return $this->handleConsults($pager); + } + + public function getReviews($id) + { + $course = $this->findOrFail($id); + + $pagerQuery = new PagerQuery(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $where = [ + 'course_id' => $course->id, + 'status' => ReviewModel::STATUS_NORMAL, + ]; + + $reviewRepo = new ReviewRepo(); + + $pager = $reviewRepo->paginate($where, $sort, $page, $limit); + + return $this->handleReviews($pager); + } + + public function getComments($id) + { + $course = $this->findOrFail($id); + + $pagerQuery = new PagerQuery(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $where = [ + 'course_id' => $course->id, + 'status' => CommentModel::STATUS_NORMAL, + ]; + + $commentRepo = new CommentRepo(); + + $pager = $commentRepo->paginate($where, $sort, $page, $limit); + + return $this->handleComments($pager); + } + + public function getUsers($id) + { + $course = $this->findOrFail($id); + + $pagerQuery = new PagerQuery(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $where = ['course_id' => $course->id]; + + $courseUserRepo = new CourseUserRepo(); + + $pager = $courseUserRepo->paginate($where, $sort, $page, $limit); + + return $this->handleUsers($pager); + } + + public function favorite($id) + { + $course = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $favoriteRepo = new CourseFavoriteRepo(); + + $favorite = $favoriteRepo->find($user->id, $course->id); + + if ($favorite) { + throw new BadRequestException('course.favorite_existed'); + } + + $favoriteRepo->create($user->id, $course->id); + + $course->favorite_count += 1; + $course->update(); + } + + public function undoFavorite($id) + { + $course = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $favoriteRepo = new CourseFavoriteRepo(); + + $favorite = $favoriteRepo->find($user->id, $course->id); + + if (!$favorite) { + throw new BadRequestException('course.favorite_not_existed'); + } + + $favorite->delete(); + + $course->favorite_count -= 1; + $course->update(); + } + + public function apply($id) + { + $course = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + if ($course->status != CourseModel::STATUS_APPROVED) { + throw new BadRequestException('course.apply_unpublished_course'); + } + + if ($course->price > 0) { + throw new BadRequestException('course.apply_priced_course'); + } + + $courseUserRepo = new CourseUserRepo(); + + $courseUser = $courseUserRepo->find($user->id, $course->id); + + $expired = $courseUser->expire_time < time(); + + if ($courseUser && !$expired) { + throw new BadRequestException('course.has_applied'); + } + + $expireTime = time() + 86400 * $course->expiry; + + $courseUserRepo->create([ + 'user_id' => $user->id, + 'course_id' => $course->id, + 'expire_time' => $expireTime, + ]); + + if (!$courseUser) { + $course->user_count += 1; + $course->update(); + } + } + + private function findOrFail($id) + { + $repo = new CourseRepo(); + + $result = $repo->findOrFail($id); + + return $result; + } + + private function handleConsults($pager) + { + if ($pager->total_items > 0) { + + $builder = new ConsultListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleUsers($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + + private function handleReviews($pager) + { + if ($pager->total_items > 0) { + + $builder = new ReviewListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleUsers($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + + private function handleComments($pager) + { + if ($pager->total_items > 0) { + + $builder = new CommentListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleUsers($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + + private function handleUsers($pager) + { + if ($pager->total_items > 0) { + + $builder = new CourseUserListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleUsers($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + + private function handleCourse($user, $course) + { + $result = $course->toArray(); + + $userRepo = new UserRepo(); + + $user = $userRepo->findShallowUser($course->user_id); + + $result['user'] = $user->toArray(); + + $result['me']['favorited'] = 0; + $result['me']['bought'] = 0; + + if ($user->id > 0) { + + $cfRepo = new CourseFavoriteRepo(); + + $favorite = $cfRepo->find($user->id, $course->id); + + $result['me']['favorited'] = $favorite ? 1 : 0; + + $csRepo = new CourseUserRepo(); + + $cs = $csRepo->find($user->id, $course->id); + + if ($cs && $cs->expire_time < time()) { + $result['me']['bought'] = 1; + $result['me']['finish_count'] = $cs->finish_count; + } + } + + return $result; + } + + private function handleChapters($topChapters, $subChapters, $myChapters) + { + $chapters = array_merge($topChapters->toArray(), $subChapters->toArray()); + + $studyHistory = []; + + if ($myChapters) { + $studyHistory = $myChapters->toArray(); + } + + $builder = new ChapterListTransformer(); + + $stepA = $builder->handleProcess($chapters, $studyHistory); + + $stepB = $builder->handleTree($stepA); + + $result = $builder->arrayToObject($stepB); + + return $result; + } + +} diff --git a/app/Http/Home/Services/CourseAdmin.php b/app/Http/Home/Services/CourseAdmin.php new file mode 100644 index 00000000..e0823b1f --- /dev/null +++ b/app/Http/Home/Services/CourseAdmin.php @@ -0,0 +1,177 @@ +findOrFail($id); + + return $course; + } + + public function getTopCategories() + { + $categoryRepo = new CategoryRepo(); + + $categories = $categoryRepo->find([ + 'parent_id' => 0, + 'status' => CategoryModel::STATUS_NORMAL, + ]); + + return $categories; + } + + public function getChapters($id) + { + $course = $this->findOrFail($id); + + $courseRepo = new CourseRepo(); + + $topChapters = $courseRepo->findTopChapters($id); + + switch ($course->model) { + + case CourseModel::MODEL_VIDEO: + $subChapters = $courseRepo->findVideoChapters($id); + break; + + case CourseModel::MODEL_LIVE: + $subChapters = $courseRepo->findLiveChapters($id); + break; + + case CourseModel::MODEL_ARTICLE: + $subChapters = $courseRepo->findArticleChapters($id); + break; + } + + $result = $this->handleChapters($topChapters, $subChapters); + + return $result; + } + + public function create() + { + $user = $this->getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new CourseFilter(); + + $data = []; + + $data['user_id'] = $user->id; + $data['status'] = CourseModel::STATUS_DRAFT; + $data['category_id'] = $filter->checkCategoryId($post['category_id']); + $data['model'] = $filter->checkModel($post['model']); + $data['level'] = $filter->checkLevel($post['level']); + $data['title'] = $filter->checkTitle($post['title']); + $data['cover'] = $filter->checkCover($post['cover']); + $data['summary'] = $filter->checkSummary($post['summary']); + $data['keywords'] = $filter->checkKeywords($post['keywords']); + $data['price'] = $filter->checkPrice($post['price']); + $data['expiry'] = $filter->checkExpiry($post['expiry']); + + $courseRepo = new CourseRepo(); + + $course = $courseRepo->create($data); + + return $course; + } + + public function update($id) + { + $course = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new CourseFilter(); + + $filter->checkOwner($user->id, $course->user_id); + + $data = []; + + if (isset($post['category_id'])) { + $data['category_id'] = $filter->checkCategoryId($post['category_id']); + } + + if (isset($post['level'])) { + $data['level'] = $filter->checkLevel($post['level']); + } + + if (isset($post['title'])) { + $data['title'] = $filter->checkTitle($post['title']); + } + + if (isset($post['cover'])) { + $data['cover'] = $filter->checkCover($post['cover']); + } + + if (isset($post['summary'])) { + $data['summary'] = $filter->checkSummary($post['summary']); + } + + if (isset($post['keywords'])) { + $data['keywords'] = $filter->checkKeywords($post['keywords']); + } + + if (isset($post['price'])) { + $data['price'] = $filter->checkPrice($post['price']); + } + + $course->update($data); + + return $course; + } + + public function delete($id) + { + $course = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $filter = new CourseFilter(); + + $filter->checkOwner($user->id, $course->user_id); + + if ($course->status == CourseModel::STATUS_DELETED) { + return false; + } + + $course->status = CourseModel::STATUS_DELETED; + + $course->update(); + } + + private function findOrFail($id) + { + $repo = new CourseRepo(); + + $result = $repo->findOrFail($id); + + return $result; + } + + private function handleChapters($topChapters, $subChapters) + { + $chapters = array_merge($topChapters->toArray(), $subChapters->toArray()); + + $builder = new ChapterListTransformer(); + + $tree = $builder->handleTree($chapters); + + return $builder->arrayToObject($tree); + } + +} diff --git a/app/Http/Home/Services/Danmaku.php b/app/Http/Home/Services/Danmaku.php new file mode 100644 index 00000000..de620708 --- /dev/null +++ b/app/Http/Home/Services/Danmaku.php @@ -0,0 +1,87 @@ + $chapterId, + 'published' => 1, + 'deleted' => 0 + ]; + + $pager = $danmakuRepo->paginate($params, 'latest', 1, $limit); + + $result = $this->handleDanmakus($pager); + + return $result; + } + + public function createDanmaku() + { + $body = $this->request->getJsonRawBody(); + + $danmaku = new DanmakuModel(); + + $validator = new DanmakuValidator(); + + $data = []; + + $chapter = $validator->checkChapter($body->id); + + $user = $validator->checkUser($body->author, $body->token); + + $validator->checkPostLimit($user->id); + + $data['text'] = $validator->checkText($body->text); + $data['color'] = $validator->checkColor($body->color); + $data['type'] = $validator->checkType($body->type); + $data['time'] = $validator->checkTime($body->time); + $data['ip'] = $this->request->getClientAddress(); + $data['course_id'] = $chapter->course_id; + $data['chapter_id'] = $chapter->id; + $data['user_id'] = $user->id; + + $danmaku->create($data); + + return $danmaku; + } + + protected function handleDanmakus($pager) + { + if ($pager->total_items == 0) { + return []; + } + + $transformer = new DanmakuListTransformer(); + + $items = $pager->items->toArray(); + + $danmakus = $transformer->handleUsers($items); + + $result = []; + + foreach ($danmakus as $danmaku) { + $result[] = [ + $danmaku['time'], + $danmaku['type'], + $danmaku['color'], + $danmaku['user']['name'], + $danmaku['text'] . ' - by ' . $danmaku['user']['name'], + ]; + } + + return $result; + } + +} diff --git a/app/Http/Home/Services/My.php b/app/Http/Home/Services/My.php new file mode 100644 index 00000000..bcb22db6 --- /dev/null +++ b/app/Http/Home/Services/My.php @@ -0,0 +1,223 @@ +getLoggedUser(); + + $pagerQuery = new PagerQuery(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $where = ['user_id' => $user->id]; + + $courseUserRepo = new CourseUserRepo(); + + $pager = $courseUserRepo->paginate($where, $sort, $page, $limit); + + return $this->handleCourses($pager); + } + + public function getFavorites() + { + $user = $this->getLoggedUser(); + + $pagerQuery = new PagerQuery(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $where = ['user_id' => $user->id]; + + $favoriteRepo = new CourseFavoriteRepo(); + + $pager = $favoriteRepo->paginate($where, $sort, $page, $limit); + + return $this->handleFavorites($pager); + } + + public function getConsults() + { + $user = $this->getLoggedUser(); + + $pagerQuery = new PagerQuery(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $where = [ + 'user_id' => $user->id, + 'status' => ConsultModel::STATUS_NORMAL, + ]; + + $consultRepo = new ConsultRepo(); + + $pager = $consultRepo->paginate($where, $sort, $page, $limit); + + return $this->handleConsults($pager); + } + + public function getReviews() + { + $user = $this->getLoggedUser(); + + $pagerQuery = new PagerQuery(); + + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $where = [ + 'user_id' => $user->id, + 'status' => ReviewModel::STATUS_NORMAL, + ]; + + $reviewRepo = new ReviewRepo(); + + $pager = $reviewRepo->paginate($where, $sort, $page, $limit); + + return $this->handleReviews($pager); + } + + public function getOrders() + { + $user = $this->getLoggedUser(); + + $pagerQuery = new PagerQuery(); + + $params = $pagerQuery->getParams(); + $sort = $pagerQuery->getSort(); + $page = $pagerQuery->getPage(); + $limit = $pagerQuery->getLimit(); + + $filter = new OrderFilter(); + + $where = []; + + $where['user_id'] = $user->id; + + if (!empty($params['status'])) { + $where['status'] = $filter->checkStatus($params['status']); + } + + $orderRepo = new OrderRepo(); + + $pager = $orderRepo->paginate($where, $sort, $page, $limit); + + return $this->handleOrders($pager); + } + + private function handleCourses($pager) + { + if ($pager->total_items > 0) { + + $builder = new CourseUserListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleCourses($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + + private function handleFavorites($pager) + { + if ($pager->total_items > 0) { + + $builder = new CourseFavoriteListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleCourses($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + + private function handleConsults($pager) + { + if ($pager->total_items > 0) { + + $builder = new ConsultListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleCourses($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + + private function handleReviews($pager) + { + if ($pager->total_items > 0) { + + $builder = new ReviewListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleCourses($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + + private function handleOrders($pager) + { + if ($pager->total_items > 0) { + + $builder = new OrderListTransformer(); + + $pipeA = $pager->items->toArray(); + + $pipeB = $builder->handleItems($pipeA); + + $pipeC = $builder->arrayToObject($pipeB); + + $pager->items = $pipeC; + } + + return $pager; + } + +} diff --git a/app/Http/Home/Services/Order.php b/app/Http/Home/Services/Order.php new file mode 100644 index 00000000..22880317 --- /dev/null +++ b/app/Http/Home/Services/Order.php @@ -0,0 +1,439 @@ +findOrFail($courseId); + + return $course; + } + + public function getPackage($packageId) + { + $packageRepo = new packageRepo(); + + $package = $packageRepo->findOrFail($packageId); + + return $package; + } + + public function getPackageCourses($packageId) + { + $packageRepo = new PackageRepo(); + + $courses = $packageRepo->findPackageCourses($packageId); + + return $courses; + } + + public function getOrder($tradeNo) + { + $order = $this->findOrFail($tradeNo); + + return $order; + } + + public function getOrderItems($orderId) + { + $orderRepo = new OrderRepo(); + + $orderItems = $orderRepo->findOrderItems($orderId); + + return $orderItems; + } + + public function create() + { + $user = $this->getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new OrderFilter(); + + $filter->checkDailyLimit($user->id); + + $data = []; + + $data['user_id'] = $user->id; + $data['item_id'] = $filter->checkItemId($post['item_id']); + $data['item_type'] = $filter->checkItemType($post['item_type']); + + switch ($data['item_type']) { + + case OrderModel::ITEM_TYPE_COURSE: + + $course = $this->getCourse($data['item_id']); + + $data['amount'] = $filter->checkAmount($course->price); + + $data['provider_id'] = $course->user_id; + + $filter->checkIfBoughtCourse($user->id, $course->id); + + $order = $this->createCourseOrder($course, $data); + + break; + + case OrderModel::ITEM_TYPE_PACKAGE: + + $package = $this->getPackage($data['item_id']); + + $data['amount'] = $filter->checkAmount($package->price); + + $data['provider_id'] = $package->user_id; + + $filter->checkIfBoughtPackage($user->id, $package->id); + + $order = $this->createPackageOrder($package, $data); + + break; + + case OrderModel::ITEM_TYPE_REWARD: + + $course = $this->getCourse($data['item_id']); + + $data['amount'] = $filter->checkAmount($post['amount']); + + $data['provider_id'] = $course->user_id; + + $order = $this->createRewardOrder($course, $data); + + break; + } + + return $order; + } + + public function cancel() + { + $user = $this->getLoggedUser(); + + $tradeNo = $this->request->getPost('trade_no'); + + $order = $this->findOrFail($tradeNo); + + $filter = new OrderFilter(); + + $filter->checkOwner($user->id, $order->user_id); + + $filter->checkIfAllowCancel($order); + + $order->status = OrderModel::STATUS_CLOSED; + + $order->update(); + } + + public function qrCode($tradeNo, $payChannel) + { + $order = $this->findOrFail($tradeNo); + + $filter = new OrderFilter(); + + $filter->checkIfAllowPay($order); + + $filter->checkPayChannel($payChannel); + + switch ($payChannel) { + + case OrderModel::PAY_CHANNEL_ALIPAY: + $qrCodeText = $this->alipayQrCode($order); + break; + + case OrderModel::PAY_CHANNEL_WXPAY: + $qrCodeText = $this->wxpayQrCode($order); + break; + } + + $order->pay_channel = $payChannel; + + $order->update(); + + return urlencode($qrCodeText); + } + + public function notify($payChannel) + { + switch ($payChannel) { + + case OrderModel::PAY_CHANNEL_ALIPAY: + $this->alipayNotify(); + break; + + case OrderModel::PAY_CHANNEL_WXPAY: + $this->wxpayNotify(); + break; + } + } + + private function createCourseOrder($course, $data) + { + $orderRepo = new OrderRepo(); + + $order = $orderRepo->create($data); + + $orderItemRepo = new OrderItemRepo(); + + $orderItemRepo->create([ + 'order_id' => $order->id, + 'item_info' => [ + 'id' => $course->id, + 'title' => $course->title, + 'cover' => $course->cover, + 'price' => $course->price, + 'expiry' => $course->expiry, + ], + ]); + + return $order; + } + + private function createPackageOrder($package, $data) + { + $orderRepo = new OrderRepo(); + + $order = $orderRepo->create($data); + + $packageRepo = new PackageRepo(); + + $courses = $packageRepo->findPackageCourses($package->id); + + $orderItemRepo = new OrderItemRepo(); + + foreach ($courses as $course) { + + $orderItemRepo->create([ + 'order_id' => $order->id, + 'item_info' => [ + 'id' => $course->id, + 'title' => $course->title, + 'cover' => $course->cover, + 'price' => $course->price, + 'expiry' => $course->expiry, + ], + ]); + } + + return $order; + } + + private function createRewardOrder($course, $data) + { + $orderRepo = new OrderRepo(); + + $order = $orderRepo->create($data); + + $orderItemRepo = new OrderItemRepo(); + + $orderItemRepo->create([ + 'order_id' => $order->id, + 'item_info' => [ + 'id' => $course->id, + 'title' => $course->title, + 'cover' => $course->cover, + 'price' => $course->price, + 'expiry' => $course->expiry, + ], + ]); + + return $order; + } + + private function alipayQrCode($order) + { + $config = $this->config->alipay->toArray(); + + $config['notify_url'] = kg_base_url() . $this->url->get([ + 'for' => 'home.order.notify', + 'channel' => OrderModel::PAY_CHANNEL_ALIPAY, + ]); + + $data = [ + 'out_trade_no' => $order->trade_no, + 'total_amount' => $order->amount, + 'subject' => '', + ]; + + $pay = Pay::alipay($config)->scan($data); + + return $pay->qr_code; + } + + private function wxpayQrCode($order) + { + $config = $this->config->wxpay->toArray(); + + $config['notify_url'] = kg_base_url() . $this->url->get([ + 'for' => 'home.order.notify', + 'channel' => OrderModel::PAY_CHANNEL_ALIPAY, + ]); + + $data = [ + 'out_trade_no' => $order->trade_no, + 'total_fee' => 100 * $order->amount, + 'body' => 'test body - 测试', + ]; + + $pay = Pay::wxpay($config)->scan($data); + + return $pay->code_url; + } + + private function checkAlipayNotify($data) + { + $config = $this->config->alipay; + + if ($data->app_id != $config->app_id) { + return false; + } + + $scopes = ['TRADE_SUCCESS', 'TRADE_FINISHED']; + + if (!in_array($data->trade_status, $scopes)) { + return false; + } + + $orderRepo = new OrderRepo(); + + $order = $orderRepo->findByTradeNo($data->out_trade_no); + + if (!$order) { + return false; + } + + if ($order->status != OrderModel::STATUS_PENDING) { + return false; + } + + if ($data->total_amount != $order->amount) { + return false; + } + + return $order; + } + + private function checkWxpayNotify($data) + { + $config = $this->config->wxpay; + + if ($data->appid != $config->appid) { + return false; + } + + if ($data->result_code != 'SUCCESS') { + return false; + } + + $orderRepo = new OrderRepo(); + + $order = $orderRepo->findByTradeNo($data->out_trade_no); + + if (!$order) { + return false; + } + + if ($order->status != OrderModel::STATUS_PENDING) { + return false; + } + + if ($data->total_fee != 100 * $order->amount) { + return false; + } + + return $order; + } + + private function alipayNotify() + { + $config = $this->config->alipay->toArray(); + + $pay = Pay::alipay($config); + + $data = $pay->verify(); + + $order = $this->checkAlipayNotify($data); + + if ($order instanceof OrderModel) { + + $this->afterNotify($order); + + $pay->success()->send(); + } + } + + private function wxpayNotify() + { + $config = $this->config->wxpay->toArray(); + + $pay = Pay::wxpay($config); + + $data = $pay->verify(); + + $order = $this->checkWxpayNotify($data); + + if ($order instanceof OrderModel) { + + $this->afterNotify($order); + + $pay->success()->send(); + } + } + + private function afterNotify($order) + { + $orderRepo = new OrderRepo(); + + $orderItems = $orderRepo->findOrderItems($order->id); + + $itemTypes = [ + OrderModel::ITEM_TYPE_COURSE, + OrderModel::ITEM_TYPE_PACKAGE, + ]; + + if (in_array($order->item_type, $itemTypes)) { + + $courseUserRepo = new CourseUserRepo(); + + foreach ($orderItems as $item) { + + $course = json_decode($item->item_info); + + $expireTime = $course->expiry > 0 ? time() + 86400 * $course->expiry : 0; + + $courseUserRepo->create([ + 'user_id' => $order->user_id, + 'course_id' => $course->id, + 'expire_time' => $expireTime, + ]); + } + } + + $order->status = OrderModel::STATUS_FINISHED; + + $order->update(); + } + + private function findOrFail($tradeNo) + { + $orderRepo = new OrderRepo(); + + $order = $orderRepo->findOrFail($tradeNo); + + return $order; + } + +} diff --git a/app/Http/Home/Services/Review.php b/app/Http/Home/Services/Review.php new file mode 100644 index 00000000..9dede942 --- /dev/null +++ b/app/Http/Home/Services/Review.php @@ -0,0 +1,239 @@ +getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new ReviewFilter(); + + $data = []; + + $data['user_id'] = $user->id; + $data['course_id'] = $filter->checkCourseId($post['course_id']); + $data['content'] = $filter->checkContent($post['content']); + $data['rating'] = $filter->checkRating($post['rating']); + + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($data['course_id']); + + $courseUserRepo = new CourseUserRepo(); + + $courseUser = $courseUserRepo->find($user->id, $course->id); + + if (!$courseUser) { + throw new ForbiddenException('course.has_not_applied'); + } + + $reviewRepo = new ReviewRepo(); + + $record = $reviewRepo->findByUserCourseId($user->id, $course->id); + + if ($record) { + throw new BadRequestException('course.has_reviewed'); + } + + $review = $reviewRepo->create($data); + + $courseUser->reviewed = 1; + + $courseUser->update(); + + $course->review_count += 1; + + $course->update(); + + $this->handleReviewStats($course, $review); + + return $review; + } + + public function getReview($id) + { + $review = $this->findOrFail($id); + + return $this->handleReview($review); + } + + public function update($id) + { + $review = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new ReviewFilter(); + + $filter->checkOwner($user->id, $review->user_id); + + $data = []; + + $data['content'] = $filter->checkContent($post['content']); + $data['rating'] = $filter->checkRating($post['rating']); + + $review->update($data); + + return $review; + } + + public function delete($id) + { + $review = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $filter = new ReviewFilter(); + + $filter->checkOwner($user->id, $review->user_id); + + if ($review->status == ReviewModel::STATUS_DELETED) { + return false; + } + + $review->status = ReviewModel::STATUS_DELETED; + + $review->update(); + } + + public function agree($id) + { + $review = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $voteRepo = new ReviewVoteRepo(); + + $vote = $voteRepo->find($user->id, $review->id); + + if ($vote) { + throw new BadRequestException('review.has_voted'); + } + + $voteRepo->agree($user->id, $review->id); + + $review->agree_count += 1; + + $review->update(); + } + + public function oppose($id) + { + $review = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $voteRepo = new ReviewVoteRepo(); + + $vote = $voteRepo->find($user->id, $review->id); + + if ($vote) { + throw new BadRequestException('review.has_voted'); + } + + $voteRepo->oppose($user->id, $review->id); + + $review->oppose_count += 1; + + $review->update(); + } + + public function reply($id) + { + $review = $this->findOrFail($id); + + $user = $this->getLoggedUser(); + + $post = $this->request->getPost(); + + $filter = new ReviewFilter(); + + $filter->checkOwner($user->id, $review->user_id); + + $reply = $filter->checkReply($post['reply']); + + $review->reply = $reply; + $review->reply_time = time(); + + $review->update(); + } + + private function findOrFail($id) + { + $repo = new ReviewRepo(); + + $result = $repo->findOrFail($id); + + return $result; + } + + private function handleReview($review) + { + $result = $review->toArray(); + + $userRepo = new UserRepo(); + + $user = $userRepo->findShallowUser($review->user_id); + + $result['user'] = $user->toArray(); + + return (object) $result; + } + + private function handleReviewStats($course, $review) + { + $statsRepo = new ReviewStatsRepo(); + + $stats = $statsRepo->findByCourseId($course->id); + + if ($stats) { + + $stats->total_count += 1; + + if (in_array($review->rating, [1, 2])) { + $stats->bad_count += 1; + } elseif (in_array($review->rating, [3, 4])) { + $stats->medium_count += 1; + } else { + $stats->good_count += 1; + } + + $stats->update(); + + } else { + + $data = []; + + $data['course_id'] = $course->id; + $data['total_count'] = 1; + + if (in_array($review->rating, [1, 2])) { + $data['bad_count'] = 1; + } else if (in_array($review->rating, [3, 4])) { + $data['medium_count'] = 1; + } else { + $data['good_count'] = 1; + } + + $statsRepo->create($data); + } + } + +} diff --git a/app/Http/Home/Services/Service.php b/app/Http/Home/Services/Service.php new file mode 100644 index 00000000..94bf125d --- /dev/null +++ b/app/Http/Home/Services/Service.php @@ -0,0 +1,68 @@ +getAuthToken(); + + return $token ? $this->getUser($token) : $this->getGuest(); + } + + public function getLoggedUser() + { + $token = $this->getAuthToken(); + + $filter = new BaseFilter(); + + $filter->checkAuthToken($token); + + $user = $this->getUser($token); + + $filter->checkAuthUser($user); + + return $user; + } + + private function getAuthToken() + { + $token = null; + + if ($this->cookies->has('token')) { + + $cookie = $this->cookies->get('token'); + + $token = $cookie->getValue(); + } + + return $token; + } + + private function getGuest() + { + $guest = new UserModel(); + + $guest->id = 0; + $guest->name = 'guest'; + + return $guest; + } + + private function getUser($token) + { + $userRepo = new UserRepo(); + + $user = $userRepo->findById($token); + + return $user; + } + +} diff --git a/app/Http/Home/Views/error/show400.volt b/app/Http/Home/Views/error/show400.volt new file mode 100644 index 00000000..70269fe2 --- /dev/null +++ b/app/Http/Home/Views/error/show400.volt @@ -0,0 +1,3 @@ +{{ flashSession.output() }} + +

page 400

diff --git a/app/Http/Home/Views/error/show401.volt b/app/Http/Home/Views/error/show401.volt new file mode 100644 index 00000000..fd9dfd78 --- /dev/null +++ b/app/Http/Home/Views/error/show401.volt @@ -0,0 +1,3 @@ +{{ flashSession.output() }} + +

page 401

diff --git a/app/Http/Home/Views/error/show403.volt b/app/Http/Home/Views/error/show403.volt new file mode 100644 index 00000000..158c5040 --- /dev/null +++ b/app/Http/Home/Views/error/show403.volt @@ -0,0 +1,3 @@ +{{ flashSession.output() }} + +

page 403

diff --git a/app/Http/Home/Views/error/show404.volt b/app/Http/Home/Views/error/show404.volt new file mode 100644 index 00000000..694139bf --- /dev/null +++ b/app/Http/Home/Views/error/show404.volt @@ -0,0 +1,3 @@ +{{ flashSession.output() }} + +

page 404

diff --git a/app/Http/Home/Views/error/show500.volt b/app/Http/Home/Views/error/show500.volt new file mode 100644 index 00000000..e1d0962f --- /dev/null +++ b/app/Http/Home/Views/error/show500.volt @@ -0,0 +1,3 @@ +{{ flashSession.output() }} + +

page 500

diff --git a/app/Http/Home/Views/index.volt b/app/Http/Home/Views/index.volt new file mode 100644 index 00000000..6143efe6 --- /dev/null +++ b/app/Http/Home/Views/index.volt @@ -0,0 +1,18 @@ + + + + + + + Phalcon + {{ stylesheet_link("lib/layui/css/layui.css") }} + {{ javascript_include("lib/layui/layui.js") }} + + + + + {{ content() }} + + + + \ No newline at end of file diff --git a/app/Http/Home/Views/index/error404.volt b/app/Http/Home/Views/index/error404.volt new file mode 100644 index 00000000..db06848d --- /dev/null +++ b/app/Http/Home/Views/index/error404.volt @@ -0,0 +1,5 @@ + + +

I am home error404 page

diff --git a/app/Http/Home/Views/index/index.volt b/app/Http/Home/Views/index/index.volt new file mode 100644 index 00000000..e69de29b diff --git a/app/Http/Home/Views/index/player.volt b/app/Http/Home/Views/index/player.volt new file mode 100644 index 00000000..98cff815 --- /dev/null +++ b/app/Http/Home/Views/index/player.volt @@ -0,0 +1,338 @@ + +
+ +
+ +{{ javascript_include('library/chplayer/chplayer.min.js') }} + + + +

+ 官网chplayer.com,版本号:1.0

+

以下仅列出部分功能,全部功能请至官网《手册》查看

+

+ + + + + + + 更多弹幕动作 +

+

+

单独监听功能:

+

+ 播放状态:暂停
+ 无跳转时间
+ 当前音量:0.8
+ 是否全屏:否
+ 还未结束
+ 视频地址正常
+ 当前播放时间(秒):0 +

diff --git a/app/Library/Cache/Backend/Redis.php b/app/Library/Cache/Backend/Redis.php new file mode 100644 index 00000000..954f8395 --- /dev/null +++ b/app/Library/Cache/Backend/Redis.php @@ -0,0 +1,264 @@ +getRedis(); + + /** + * @var \Phalcon\Cache\FrontendInterface $frontend + */ + $frontend = $this->_frontend; + + $lastKey = $this->getKeyName($keyName); + + $this->_lastKey = $lastKey; + + $content = $redis->get($lastKey); + + if ($content === false) { + return null; + } + + if (is_numeric($content)) { + return $content; + } + + return $frontend->afterRetrieve($content); + } + + /** + * {@inheritdoc} + * + * @param string $keyName + * @param string $content + * @param int $lifetime + * @param bool $stopBuffer + * @return bool + * + * @throws Exception + */ + public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = true) + { + if ($keyName === null) { + $lastKey = $this->_lastKey; + } else { + $lastKey = $this->getKeyName($keyName); + $this->_lastKey = $lastKey; + } + + if (!$lastKey) { + throw new Exception('The cache must be started first'); + } + + $redis = $this->getRedis(); + + /** + * @var \Phalcon\Cache\FrontendInterface $frontend + */ + $frontend = $this->_frontend; + + if ($content === null) { + $cachedContent = $frontend->getContent(); + } else { + $cachedContent = $content; + } + + /** + * Prepare the content in the frontend + */ + if (!is_numeric($cachedContent)) { + $preparedContent = $frontend->beforeStore($cachedContent); + } else { + $preparedContent = $cachedContent; + } + + if ($lifetime === null) { + $tmp = $this->_lastLifetime; + $ttl = $tmp ? $tmp : $frontend->getLifetime(); + } else { + $ttl = $lifetime; + } + + $success = $redis->set($lastKey, $preparedContent); + + if (!$success) { + throw new Exception('Failed storing the data in redis'); + } + + if ($ttl > 0) { + $redis->setTimeout($lastKey, $ttl); + } + + $isBuffering = $frontend->isBuffering(); + + if ($stopBuffer === true) { + $frontend->stop(); + } + + if ($isBuffering === true) { + echo $cachedContent; + } + + $this->_started = false; + + return $success; + } + + /** + * {@inheritdoc} + * + * @param string $keyName + * @return bool + */ + public function delete($keyName) + { + $redis = $this->getRedis(); + + $lastKey = $this->getKeyName($keyName); + + return (bool)$redis->delete($lastKey); + } + + /** + * {@inheritdoc} + * + * @param string $prefix + * @return array + */ + public function queryKeys($prefix = null) + { + $redis = $this->getRedis(); + + $pattern = "{$this->_prefix}" . ($prefix ? $prefix : '') . '*'; + + return $redis->keys($pattern); + } + + /** + * {@inheritdoc} + * + * @param string $keyName + * @param string $lifetime + * @return bool + */ + public function exists($keyName = null, $lifetime = null) + { + $redis = $this->getRedis(); + + if ($keyName === null) { + $lastKey = $this->_lastKey; + } else { + $lastKey = $this->getKeyName($keyName); + } + + return (bool)$redis->exists($lastKey); + } + + /** + * {@inheritdoc} + * + * @param string $keyName + * @param int $value + * @return int + */ + public function increment($keyName = null, $value = 1) + { + $redis = $this->getRedis(); + + if ($keyName === null) { + $lastKey = $this->_lastKey; + } else { + $lastKey = $this->getKeyName($keyName); + } + + return $redis->incrBy($lastKey, $value); + } + + /** + * {@inheritdoc} + * + * @param string $keyName + * @param int $value + * @return int + */ + public function decrement($keyName = null, $value = 1) + { + $redis = $this->getRedis(); + + if ($keyName === null) { + $lastKey = $this->_lastKey; + } else { + $lastKey = $this->getKeyName($keyName); + } + + return $redis->decrBy($lastKey, $value); + } + + /** + * {@inheritdoc} + * + * @return bool + */ + public function flush() + { + + } + + /** + * Get Prefix + * + * @return string + */ + public function getPrefix() + { + return $this->_prefix; + } + + /** + * Get Redis Connection + * + * @return \Redis + */ + public function getRedis() + { + $redis = $this->_redis; + + if (!is_object($redis)) { + $this->_connect(); + $redis = $this->_redis; + } + + return $redis; + } + + /** + * Get Key Name + * + * @param $keyName + * @return string + */ + protected function getKeyName($keyName) + { + return $this->_prefix . $keyName; + } + +} diff --git a/app/Library/Helper.php b/app/Library/Helper.php new file mode 100644 index 00000000..01034065 --- /dev/null +++ b/app/Library/Helper.php @@ -0,0 +1,281 @@ + $value) { + if (in_array($key, $whitelist)) { + $result[$key] = $value; + } + } + + return $result; +} + +/** + * 数组转对象 + * + * @param array $array + * @return object + */ +function kg_array_object($array) +{ + $result = json_decode(json_encode($array)); + + return $result; +} + +/** + * 对象转数组 + * + * @param object $object + * @return object + */ +function kg_object_array($object) +{ + $result = json_decode(json_encode($object), true); + + return $result; +} + +/** + * ip to region + * + * @param $ip + * @param string $dbFile + * @return stdClass + */ +function kg_ip2region($ip, $dbFile = null) +{ + $searcher = new Ip2RegionSearcher($dbFile); + + $ip2region = $searcher->btreeSearch($ip); + + list($country, $area, $province, $city, $isp) = explode('|', $ip2region['region']); + + $result = compact('country', 'area', 'province', 'city', 'isp'); + + return kg_array_object($result); +} + +/** + * 获取站点基准URL + * + * @return string + */ +function kg_site_base_url() +{ + $scheme = filter_input(INPUT_SERVER, 'REQUEST_SCHEME'); + $host = filter_input(INPUT_SERVER, 'HTTP_HOST'); + $path = filter_input(INPUT_SERVER, 'SCRIPT_NAME'); + + $baseUrl = "{$scheme}://{$host}" . rtrim(dirname($path), '/'); + + return $baseUrl; +} + +/** + * 获取图片基准URL + * + * @return string + */ +function kg_img_base_url() +{ + $storage = new StorageService(); + + return $storage->getCiBaseUrl(); +} + +/** + * 获取图片URL + * + * @param string $path + * @param integer $width + * @param integer $height + * @return string + */ +function kg_img_url($path, $width = 0, $height = 0) +{ + $storage = new StorageService(); + + return $storage->getCiImageUrl($path, $width, $height); +} + +/** + * 格式化数字 + * + * @param integer $number + * @return string + */ +function kg_human_number($number) +{ + if ($number > 100000000) { + $result = round($number / 100000000, 1) . '亿'; + } elseif ($number > 10000) { + $result = round($number / 10000, 1) . '万'; + } elseif ($number > 1000) { + $result = number_format($number); + } else { + $result = $number; + } + + return $result; +} + +/** + * 播放时长 + * + * @param integer $time + * @return string + */ +function kg_play_duration($time) +{ + $result = '00:00'; + + if ($time > 0) { + + $hours = floor($time / 3600); + $minutes = floor(($time - $hours * 3600) / 60); + $seconds = $time % 60; + + $format = []; + + if ($hours > 0) { + $format[] = sprintf('%02d', $hours); + } + + if ($minutes >= 0) { + $format[] = sprintf('%02d', $minutes); + } + + if ($seconds >= 0) { + $format[] = sprintf('%02d', $seconds); + } + + $result = implode(':', $format); + } + + return $result; +} + +/** + * 总时长 + * + * @param integer $time + * @return string + */ +function kg_total_duration($time) +{ + $result = '00小时00分钟'; + + if ($time > 0) { + + $hours = floor($time / 3600); + $minutes = floor(($time - $hours * 3600) / 60); + + $format = []; + + if ($hours >= 0) { + $format[] = sprintf('%02d小时', $hours); + } + + if ($minutes >= 0) { + $format[] = sprintf('%02d分钟', $minutes); + } + + $result = implode('', $format); + } + + return $result; +} + +/** + * 判断是否有路由权限 + * + * @param string $route + * @return bool + */ +function kg_can($route = null) +{ + return true; +} diff --git a/app/Library/Logger.php b/app/Library/Logger.php new file mode 100644 index 00000000..a4e61293 --- /dev/null +++ b/app/Library/Logger.php @@ -0,0 +1,33 @@ +get('config'); + + $channel = $channel ? $channel . '-' : ''; + + $path = log_path() . '/' . $channel . date('Y-m-d') . '.log'; + + $level = $config->env != ENV_DEV ? $config->log->level : PhalconLogger::DEBUG; + + $logger = new FileLogger($path); + + $logger->setLogLevel($level); + + return $logger; + } + +} diff --git a/app/Library/OAuth.php b/app/Library/OAuth.php new file mode 100644 index 00000000..42490a1a --- /dev/null +++ b/app/Library/OAuth.php @@ -0,0 +1,52 @@ +appId = $appId; + $this->appSecret = $appSecret; + $this->appCallback = $appCallback; + } + + public function httpGet($uri, $params = [], $headers = []) + { + $client = new HttpClient(); + + $options = ['query' => $params, 'headers' => $headers]; + + $response = $client->get($uri, $options); + + return $response->getBody(); + } + + public function httpPost($uri, $params = [], $headers = []) + { + $client = new HttpClient(); + + $options = ['query' => $params, 'headers' => $headers]; + + $response = $client->post($uri, $options); + + return $response->getBody(); + } + + abstract public function getAuthorizeUrl(); + + abstract public function getAccessToken($code); + + abstract public function getOpenId($accessToken); + + abstract public function getUserInfo($accessToken, $openId); +} diff --git a/app/Library/OAuth/QQ.php b/app/Library/OAuth/QQ.php new file mode 100644 index 00000000..55c87bf8 --- /dev/null +++ b/app/Library/OAuth/QQ.php @@ -0,0 +1,112 @@ + $this->appId, + 'redirect_uri' => $this->appCallback, + 'response_type' => 'code', + 'scope' => '', + ]; + + return self::AUTHORIZE_URL . '?' . http_build_query($params); + } + + public function getAccessToken($code) + { + $params = [ + 'code' => $code, + 'client_id' => $this->appId, + 'client_secret' => $this->appSecret, + 'redirect_uri' => $this->appCallback, + 'grant_type' => 'authorization_code', + 'state' => 'ok', + ]; + + $response = $this->httpPost(self::ACCESS_TOKEN_URL, $params); + + $this->accessToken = $this->parseAccessToken($response); + + return $this->accessToken; + } + + public function getOpenId($accessToken) + { + $params = ['access_token' => $accessToken]; + + $response = $this->httpGet(self::OPENID_URL, $params); + + $this->openId = $this->parseOpenId($response); + + return $this->openId; + } + + public function getUserInfo($accessToken, $openId) + { + $params = [ + 'access_token' => $accessToken, + 'openid' => $openId, + 'oauth_consumer_key' => $this->appId, + ]; + + $response = $this->httpGet(self::USER_INFO_URL, $params); + + $this->parseUserInfo($response); + } + + protected function parseAccessToken($response) + { + $result = []; + + parse_str($response, $result); + + if (!isset($result['access_token'])) { + throw new \Exception("Fetch Access Token Failed:{$response}"); + } + + return $result['access_token']; + } + + protected function parseOpenId($response) + { + $result = $match = []; + + if (!empty($response)) { + preg_match('/callback\(\s+(.*?)\s+\)/i', $response, $match); + $result = json_decode($match[1], true); + } + + if (!isset($result['openid'])) { + throw new \Exception("Fetch Openid Failed:{$response}"); + } + + return $result['openid']; + } + + protected function parseUserInfo($response) + { + $data = json_decode($response, true); + + if ($data['ret'] != 0) { + throw new \Exception("Fetch User Info Failed:{$data['msg']}"); + } + + $userInfo['type'] = 'QQ'; + $userInfo['name'] = $data['nickname']; + $userInfo['nick'] = $data['nickname']; + $userInfo['head'] = $data['figureurl_2']; + + return $userInfo; + } + +} diff --git a/app/Library/OAuth/WeiBo.php b/app/Library/OAuth/WeiBo.php new file mode 100644 index 00000000..93d7df02 --- /dev/null +++ b/app/Library/OAuth/WeiBo.php @@ -0,0 +1,86 @@ + $this->appId, + 'redirect_uri' => $this->appCallback, + 'response_type' => 'code', + ]; + + return self::AUTHORIZE_URL . '?' . http_build_query($params); + } + + public function getAccessToken($code) + { + $params = [ + 'code' => $code, + 'client_id' => $this->appId, + 'client_secret' => $this->appSecret, + 'redirect_uri' => $this->appCallback, + 'grant_type' => 'authorization_code', + ]; + + $response = $this->httpPost(self::ACCESS_TOKEN_URL, $params); + + $this->accessToken = $this->parseAccessToken($response); + + return $this->accessToken; + } + + public function getOpenId($accessToken = null) + { + return $this->openId; + } + + public function getUserInfo($accessToken, $openId) + { + $params = [ + 'access_token' => $accessToken, + 'uid' => $openId, + ]; + + $response = $this->httpGet(self::USER_INFO_URL, $params); + + return $this->parseUserInfo($response); + } + + private function parseAccessToken($response) + { + $data = json_decode($response, true); + + if (!isset($data['access_token']) || isset($data['uid'])) { + throw new \Exception("Fetch Access Token Failed:{$response}"); + } + + $this->openId = $data['uid']; + + return $data['access_token']; + } + + private function parseUserInfo($response) + { + $data = json_decode($response, true); + + if ($data['error_code'] != 0) { + throw new \Exception("Fetch User Info Failed:{$data['error']}"); + } + + $userInfo['type'] = 'WEIBO'; + $userInfo['name'] = $data['name']; + $userInfo['nick'] = $data['screen_name']; + $userInfo['head'] = $data['avatar_large']; + + return $userInfo; + } + +} diff --git a/app/Library/OAuth/WeiXin.php b/app/Library/OAuth/WeiXin.php new file mode 100644 index 00000000..0dde7d69 --- /dev/null +++ b/app/Library/OAuth/WeiXin.php @@ -0,0 +1,87 @@ + $this->appId, + 'redirect_uri' => $this->appCallback, + 'response_type' => 'code', + 'scope' => 'snsapi_login', + 'state' => 'dev', + ]; + + return self::AUTHORIZE_URL . '?' . http_build_query($params); + } + + public function getAccessToken($code) + { + $params = [ + 'code' => $code, + 'appid' => $this->appId, + 'secret' => $this->appSecret, + 'grant_type' => 'authorization_code', + ]; + + $response = $this->httpPost(self::ACCESS_TOKEN_URL, $params); + + $this->accessToken = $this->parseAccessToken($response); + + return $this->accessToken; + } + + public function getOpenId($accessToken = null) + { + return $this->openId; + } + + public function getUserInfo($accessToken, $openId) + { + $params = [ + 'access_token' => $accessToken, + 'openid' => $openId, + ]; + + $response = $this->httpGet(self::USER_INFO_URL, $params); + + return $this->parseUserInfo($response); + } + + private function parseAccessToken($response) + { + $data = json_decode($response, true); + + if (isset($data['errcode']) && $data['errcode'] != 0) { + throw new \Exception("Fetch Access Token Failed:{$data['errmsg']}"); + } + + $this->openId = $data['openid']; + + return $data['access_token']; + } + + private function parseUserInfo($response) + { + $data = json_decode($response, true); + + if (isset($data['errcode']) && $data['errcode'] != 0) { + throw new \Exception("Fetch User Info Failed:{$data['errmsg']}"); + } + + $userInfo['type'] = 'WEIXIN'; + $userInfo['name'] = $data['name']; + $userInfo['nick'] = $data['screen_name']; + $userInfo['head'] = $data['avatar_large']; + + return $userInfo; + } + +} diff --git a/app/Library/Paginator/Adapter/QueryBuilder.php b/app/Library/Paginator/Adapter/QueryBuilder.php new file mode 100644 index 00000000..b2d93fc5 --- /dev/null +++ b/app/Library/Paginator/Adapter/QueryBuilder.php @@ -0,0 +1,61 @@ +initParams(); + + $pager->first = $this->buildPageUrl($pager->first); + $pager->before = $this->buildPageUrl($pager->before); + $pager->next = $this->buildPageUrl($pager->next); + $pager->last = $this->buildPageUrl($pager->last); + + return $pager; + } + + private function initParams() + { + $request = new HttpRequest(); + + $params = $request->get(); + + if ($params) { + foreach ($params as $key => $value) { + if (strlen($value) == 0) { + unset($params[$key]); + } + } + } + + $this->params = $params; + + if (!empty($this->params['_url'])) { + $this->url = $this->params['_url']; + unset($this->params['_url']); + } else { + $this->url = $request->get('_url'); + } + } + + private function buildPageUrl($page) + { + $this->params['page'] = $page; + + $queryUrl = $this->url . '?' . http_build_query($this->params); + + return $queryUrl; + } + +} diff --git a/app/Library/Paginator/Query.php b/app/Library/Paginator/Query.php new file mode 100644 index 00000000..994e8aea --- /dev/null +++ b/app/Library/Paginator/Query.php @@ -0,0 +1,49 @@ +request->get('page', 'int', 1); + + $result = $page > 1000 ? 1000 : $page; + + return $result; + } + + public function getLimit() + { + $limit = $this->request->get('limit', 'int', 15); + + $result = $limit > 100 ? 100 : $limit; + + return $result; + } + + public function getSort() + { + $sort = $this->request->get('sort', 'trim', ''); + + return $sort; + } + + public function getUrl() + { + $url = $this->request->get('_url', 'trim', ''); + + return $url; + } + + public function getParams() + { + $params = $this->request->get(); + + return $params; + } + +} diff --git a/app/Library/Security.php b/app/Library/Security.php new file mode 100644 index 00000000..031945c5 --- /dev/null +++ b/app/Library/Security.php @@ -0,0 +1,90 @@ +options['lifetime'] = $options['lifetime'] ?? 3600; + + $this->cache = Di::getDefault()->get('cache'); + $this->session = Di::getDefault()->get('session'); + + $this->generateToken(); + } + + public function getTokenKey() + { + return $this->tokenKey; + } + + public function getTokenValue() + { + return $this->tokenValue; + } + + public function generateToken() + { + $this->tokenKey = $this->session->getId(); + + $key = $this->getCacheKey($this->tokenKey); + + $content = [ + 'hash' => Text::random(Text::RANDOM_ALNUM, 32), + 'time' => time(), + ]; + + $lifetime = $this->options['lifetime']; + + $cachedContent = $this->cache->get($key); + + if ($cachedContent) { + $this->tokenValue = $cachedContent->hash; + if (time() - $cachedContent->time > $lifetime / 2) { + $this->cache->save($key, $content, $lifetime); + $this->tokenValue = $content['hash']; + } + } else { + $this->cache->save($key, $content, $lifetime); + $this->tokenValue = $content['hash']; + } + } + + public function checkToken($tokenKey, $tokenValue) + { + $key = $this->getCacheKey($tokenKey); + + $content = $this->cache->get($key); + + if (!$content) return false; + + return $tokenValue == $content->hash; + } + + protected function getCacheKey($tokenKey) + { + return "csrf_token:{$tokenKey}"; + } + +} diff --git a/app/Library/Util/Password.php b/app/Library/Util/Password.php new file mode 100644 index 00000000..b004a314 --- /dev/null +++ b/app/Library/Util/Password.php @@ -0,0 +1,27 @@ +get('cache'); + + $code = Text::random(Text::RANDOM_NUMERIC, 6); + + $cache->save(self::getKey($key), $code, $lifetime); + + return $code; + } + + public static function checkCode($key, $code) + { + /** + * @var \Phalcon\Cache\Backend $cache + */ + $cache = Di::getDefault()->get('cache'); + + $value = $cache->get(self::getKey($key)); + + return $code == $value; + } + + public static function getKey($key) + { + return "verify:{$key}"; + } + +} diff --git a/app/Library/Util/Word.php b/app/Library/Util/Word.php new file mode 100644 index 00000000..e1a691d6 --- /dev/null +++ b/app/Library/Util/Word.php @@ -0,0 +1,64 @@ += $value && $min <= $value; + } + + public static function equals($a, $b) + { + return $a == $b; + } + + public static function email($str) + { + return filter_var($str, FILTER_VALIDATE_EMAIL) ? true : false; + } + + public static function url($str) + { + if (strpos($str, '//') === 0) { + $str = 'http:' . $str; + } + + return filter_var($str, FILTER_VALIDATE_URL) ? true : false; + } + + public static function intNumber($str) + { + return filter_var($str, FILTER_VALIDATE_INT) ? true : false; + } + + public static function floatNumber($str) + { + return filter_var($str, FILTER_VALIDATE_FLOAT) === false; + } + + public static function natureNumber($number) + { + if (preg_match('/^0$/', $number)) { + return true; + } + + if (preg_match('/^[1-9][0-9]?/', $number)) { + return true; + } + + return false; + } + + public static function idCard($str) + { + $validator = new IdCard(); + + return $validator->validate($str); + } + + public static function phone($str) + { + $pattern = '/^(13[0-9]|15[0-3]|15[5-9]|180|18[5-9])[0-9]{8}$/'; + + return preg_match($pattern, $str) ? true : false; + } + + public static function name($str) + { + $pattern = '/^[\x{4e00}-\x{9fa5}A-Za-z0-9]{2,15}$/u'; + + return preg_match($pattern, $str) ? true : false; + } + + public static function password($str) + { + $pattern = '/^[A-Za-z0-9]{6,16}$/'; + + return preg_match($pattern, $str) ? true : false; + } + + public static function birthday($str) + { + $pattern = '/^(19|20)\d{2}-(1[0-2]|0[1-9])-(0[1-9]|[1-2][0-9]|3[0-1])$/'; + + return preg_match($pattern, $str) ? true : false; + } + + public static function date($str, $format = 'Y-m-d') + { + $date = date($format, strtotime($str)); + + return $str == $date; + } + +} diff --git a/app/Library/Validator/IdCard.php b/app/Library/Validator/IdCard.php new file mode 100644 index 00000000..da0d2c44 --- /dev/null +++ b/app/Library/Validator/IdCard.php @@ -0,0 +1,91 @@ +check18IdCard($idCard); + + } elseif ((strlen($idCard) == 15)) { + + $idCard = $this->convertIdCard15to18($idCard); + + return $this->check18IdCard($idCard); + } + + return false; + } + + /* + * 计算身份证的最后一位验证码,根据国家标准GB 11643-1999 + */ + private function calcIdCardCode($idCardBody) + { + if (strlen($idCardBody) != 17) { + return false; + } + + //加权因子 + $factor = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); + + //校验码对应值 + $code = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); + + $checksum = 0; + + for ($i = 0; $i < strlen($idCardBody); $i++) { + $checksum += substr($idCardBody, $i, 1) * $factor[$i]; + } + + return $code[$checksum % 11]; + } + + /* + * 将15位身份证升级到18位 + */ + private function convertIdCard15to18($idCard) + { + if (strlen($idCard) != 15) { + return false; + } + + // 如果身份证顺序码是996 997 998 999,这些是为百岁以上老人的特殊编码 + if (array_search(substr($idCard, 12, 3), array('996', '997', '998', '999')) !== false) { + $idCard = substr($idCard, 0, 6) . '18' . substr($idCard, 6, 9); + } else { + $idCard = substr($idCard, 0, 6) . '19' . substr($idCard, 6, 9); + } + + $idCard = $idCard . $this->calcIdCardCode($idCard); + + return $idCard; + } + + /* + * 18位身份证校验码有效性检查 + */ + private function check18IdCard($idCard) + { + if (strlen($idCard) != 18) { + return false; + } + + $idCardBody = substr($idCard, 0, 17); //身份证主体 + $idCardCode = strtoupper(substr($idCard, 17, 1)); //身份证最后一位的验证码 + + if ($this->calcIdCardCode($idCardBody) != $idCardCode) { + return false; + } + + return true; + } + +} diff --git a/app/Listeners/Listener.php b/app/Listeners/Listener.php new file mode 100644 index 00000000..81777d2e --- /dev/null +++ b/app/Listeners/Listener.php @@ -0,0 +1,41 @@ +getInstance($channel); + } + + /** + * 获取某组配置项 + * + * @param string $section + * @return \stdClass + */ + public function getSectionConfig($section) + { + $configCache = new ConfigCache(); + + $result = $configCache->getSectionConfig($section); + + return $result; + } + +} diff --git a/app/Listeners/Payment.php b/app/Listeners/Payment.php new file mode 100644 index 00000000..5c1ef003 --- /dev/null +++ b/app/Listeners/Payment.php @@ -0,0 +1,151 @@ +logger = $this->getLogger(); + } + + public function afterPay(Event $event, $source, TradeModel $trade) + { + try { + + $this->db->begin(); + + $trade->status = TradeModel::STATUS_FINISHED; + + if ($trade->update() === false) { + throw new \RuntimeException('Update Trade Status Failed'); + } + + $orderRepo = new OrderRepo(); + + $order = $orderRepo->findBySn($trade->order_sn); + + $order->status = OrderModel::STATUS_FINISHED; + + if ($order->update() === false) { + throw new \RuntimeException('Update Order Status Failed'); + } + + switch ($order->item_type) { + case OrderModel::TYPE_COURSE: + $this->handleCourseOrder($order); + break; + case OrderModel::TYPE_PACKAGE: + $this->handlePackageOrder($order); + break; + case OrderModel::TYPE_REWARD: + $this->handleRewardOrder($order); + break; + case OrderModel::TYPE_VIP: + $this->handleVipOrder($order); + break; + case OrderModel::TYPE_TEST: + $this->handleTestOrder($order); + break; + } + + $this->db->commit(); + + } catch (\Exception $e) { + + $this->db->rollback(); + + $this->logger->error('After Pay Event Exception {msg}', + ['msg' => $e->getMessage()] + ); + } + + $this->logger->debug('Event: {event}, Source: {source}, Data: {data}', [ + 'event' => $event->getType(), + 'source' => get_class($source), + 'data' => kg_json_encode($trade), + ]); + } + + protected function handleCourseOrder(OrderModel $order) + { + $courseUser = new CourseUserModel(); + + $courseUser->user_id = $order->user_id; + $courseUser->course_id = $order->item_id; + $courseUser->expire_time = $order->item_info['course']['expire_time']; + $courseUser->role_type = CourseUserModel::ROLE_STUDENT; + $courseUser->source_type = CourseUserModel::SOURCE_PAID; + + if ($courseUser->create() === false) { + throw new \RuntimeException('Create Course User Failed'); + } + } + + protected function handlePackageOrder(OrderModel $order) + { + foreach ($order->item_info['courses'] as $course) { + + $courseUser = new CourseUserModel(); + + $courseUser->user_id = $order->user_id; + $courseUser->course_id = $course['id']; + $courseUser->expire_time = $course['expire_time']; + $courseUser->role_type = CourseUserModel::ROLE_STUDENT; + $courseUser->source_type = CourseUserModel::SOURCE_PAID; + + if ($courseUser->create() === false) { + throw new \RuntimeException('Create Course User Failed'); + } + } + } + + protected function handleVipOrder(OrderModel $order) + { + $userRepo = new UserRepo(); + + $user = $userRepo->findById($order->user_id); + + $baseTime = $user->vip_expiry > time() ? $user->vip_expiry : time(); + + switch ($order->item_info['vip']['duration']) { + case 'one_month': + $user->vip_expiry = strtotime('+1 months', $baseTime); + break; + case 'three_month': + $user->vip_expiry = strtotime('+3 months', $baseTime); + break; + case 'six_month': + $user->vip_expiry = strtotime('+6 months', $baseTime); + break; + case 'twelve_month': + $user->vip_expiry = strtotime('+12 months', $baseTime); + break; + } + + if ($user->update() === false) { + throw new \RuntimeException('Update Vip Expiry Failed'); + } + } + + protected function handleRewardOrder(OrderModel $order) + { + + } + + protected function handleTestOrder(OrderModel $order) + { + + } + +} \ No newline at end of file diff --git a/app/Listeners/Profiler.php b/app/Listeners/Profiler.php new file mode 100644 index 00000000..58ebf44b --- /dev/null +++ b/app/Listeners/Profiler.php @@ -0,0 +1,49 @@ +logger = $this->getLogger('sql'); + + $this->profiler = new DbProfiler(); + } + + public function beforeQuery(Event $event, $connection) + { + $this->profiler->startProfile($connection->getSQLStatement(), $connection->getSQLVariables()); + } + + public function afterQuery(Event $event, $connection) + { + $this->profiler->stopProfile(); + + foreach ($this->profiler->getProfiles() as $profile) { + + $statement = sprintf('sql statement: %s', $profile->getSqlStatement()); + $elapsedTime = sprintf('elapsed time: %03f seconds', $profile->getTotalElapsedSeconds()); + + $this->logger->debug('--- BEGIN OF QUERY ---'); + $this->logger->debug($statement); + + if ($profile->getSqlVariables()) { + $variables = sprintf('sql variables: %s', kg_json_encode($profile->getSqlVariables())); + $this->logger->debug($variables); + } + + $this->logger->debug($elapsedTime); + $this->logger->debug('--- END OF QUERY ---'); + } + } + +} \ No newline at end of file diff --git a/app/Models/Audit.php b/app/Models/Audit.php new file mode 100644 index 00000000..ff55e041 --- /dev/null +++ b/app/Models/Audit.php @@ -0,0 +1,80 @@ +created_at = time(); + + if (!empty($this->req_data) && is_array($this->req_data)) { + $this->req_data = kg_json_encode($this->req_data); + } else { + $this->req_data = ''; + } + } + +} diff --git a/app/Models/Category.php b/app/Models/Category.php new file mode 100644 index 00000000..f2d4210c --- /dev/null +++ b/app/Models/Category.php @@ -0,0 +1,114 @@ +addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + +} diff --git a/app/Models/Chapter.php b/app/Models/Chapter.php new file mode 100644 index 00000000..e9de899e --- /dev/null +++ b/app/Models/Chapter.php @@ -0,0 +1,247 @@ + 0, + 'file_id' => 0, + 'file_status' => 'pending', + ]; + + /** + * @var array + * + * 直播扩展属性 + */ + protected $_live_attrs = [ + 'start_time' => 0, + 'end_time' => 0, + ]; + + /** + * @var array + * + * 图文扩展属性 + */ + protected $_article_attrs = ['word_count' => 0]; + + /** + * 主键编号 + * + * @var integer + */ + public $id; + + /** + * 课程编号 + * + * @var integer + */ + public $course_id; + + /** + * 父级编号 + * + * @var integer + */ + public $parent_id; + + /** + * 标题 + * + * @var string + */ + public $title; + + /** + * 摘要 + * + * @var string + */ + public $summary; + + /** + * 优先级 + * + * @var integer + */ + public $priority; + + /** + * 免费标识 + * + * @var integer + */ + public $free; + + /** + * 发布标识 + * + * @var integer + */ + public $published; + + /** + * 删除标识 + * + * @var integer + */ + public $deleted; + + /** + * 扩展属性 + * + * @var string + */ + public $attrs; + + /** + * 学员数 + * + * @var integer + */ + public $student_count; + + /** + * 讨论数 + * + * @var integer + */ + public $thread_count; + + /** + * 收藏数 + * + * @var integer + */ + public $favorite_count; + + /** + * 点赞数 + * + * @var integer + */ + public $like_count; + + /** + * 创建时间 + * + * @var integer + */ + public $created_at; + + /** + * 更新时间 + * + * @var integer + */ + public $updated_at; + + public function getSource() + { + return 'chapter'; + } + + public function initialize() + { + parent::initialize(); + + $this->addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->created_at = time(); + + if ($this->parent_id > 0) { + + $course = Course::findFirstById($this->course_id); + + $attrs = []; + + switch ($course->model) { + case Course::MODEL_VOD: + $attrs = $this->_vod_attrs; + break; + case Course::MODEL_LIVE: + $attrs = $this->_live_attrs; + break; + case Course::MODEL_ARTICLE: + $attrs = $this->_article_attrs; + break; + } + + $this->attrs = $attrs ? kg_json_encode($attrs) : ''; + } + + } + + public function beforeUpdate() + { + $this->updated_at = time(); + + if (!empty($this->attrs)) { + $this->attrs = kg_json_encode($this->attrs); + } + } + + public function afterFetch() + { + if (!empty($this->attrs)) { + $this->attrs = json_decode($this->attrs); + } + } + + public function afterCreate() + { + if ($this->parent_id > 0) { + + $course = Course::findFirstById($this->course_id); + + $data = [ + 'course_id' => $course->id, + 'chapter_id' => $this->id, + ]; + + switch ($course->model) { + case Course::MODEL_VOD: + $model = new ChapterVod(); + $model->create($data); + break; + case Course::MODEL_LIVE: + $model = new ChapterLive(); + $model->create($data); + break; + case Course::MODEL_ARTICLE: + $model = new ChapterArticle(); + $model->create($data); + break; + } + } + } + +} diff --git a/app/Models/ChapterArticle.php b/app/Models/ChapterArticle.php new file mode 100644 index 00000000..4acd6617 --- /dev/null +++ b/app/Models/ChapterArticle.php @@ -0,0 +1,78 @@ +created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + +} diff --git a/app/Models/ChapterLive.php b/app/Models/ChapterLive.php new file mode 100644 index 00000000..827b6986 --- /dev/null +++ b/app/Models/ChapterLive.php @@ -0,0 +1,79 @@ +created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + +} diff --git a/app/Models/ChapterUser.php b/app/Models/ChapterUser.php new file mode 100644 index 00000000..21e54e67 --- /dev/null +++ b/app/Models/ChapterUser.php @@ -0,0 +1,100 @@ +created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + +} diff --git a/app/Models/ChapterVod.php b/app/Models/ChapterVod.php new file mode 100644 index 00000000..81c95224 --- /dev/null +++ b/app/Models/ChapterVod.php @@ -0,0 +1,65 @@ +created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + +} diff --git a/app/Models/Config.php b/app/Models/Config.php new file mode 100644 index 00000000..2e52c4c8 --- /dev/null +++ b/app/Models/Config.php @@ -0,0 +1,41 @@ +created_at = time(); + } + +} diff --git a/app/Models/Course.php b/app/Models/Course.php new file mode 100644 index 00000000..c3ce2633 --- /dev/null +++ b/app/Models/Course.php @@ -0,0 +1,284 @@ + 0]; + + /** + * @var array + * + * 直播扩展属性 + */ + protected $_live_attrs = ['start_date' => '', 'end_date' => '']; + + /** + * @var array + * + * 图文扩展属性 + */ + protected $_article_attrs = ['word_count' => 0]; + + /** + * 主键编号 + * + * @var integer + */ + public $id; + + /** + * 作者编号 + * + * @var integer + */ + public $user_id; + + /** + * 类型 + * + * @var string + */ + public $model; + + /** + * 标题 + * + * @var string + */ + public $title; + + /** + * 封面 + * + * @var string + */ + public $cover; + + /** + * 简介 + * + * @var string + */ + public $summary; + + /** + * 关键字 + * + * @var string + */ + public $keywords; + + /** + * 详情 + * + * @var string + */ + public $details; + + /** + * 市场价格 + * + * @var float + */ + public $market_price; + + /** + * 会员价格 + * + * @var float + */ + public $vip_price; + + /** + * 有效期限(天) + * + * @var integer + */ + public $expiry; + + /** + * 综合得分 + * + * @var float + */ + public $score; + + /** + * 难度级别 + * + * @var string + */ + public $level; + + /** + * 发布标识 + * + * @var integer + */ + public $published; + + /** + * 删除标识 + * + * @var integer + */ + public $deleted; + + /** + * 扩展属性 + * + * @var string + */ + public $attrs; + + /** + * 课时数 + * + * @var integer + */ + public $lesson_count; + + /** + * 学员数 + * + * @var integer + */ + public $student_count; + + /** + * 讨论数 + * + * @var integer + */ + public $thread_count; + + /** + * 评价数 + * + * @var integer + */ + public $review_count; + + /** + * 收藏数 + * + * @var integer + */ + public $favorite_count; + + /** + * 创建时间 + * + * @var integer + */ + public $created_at; + + /** + * 更新时间 + * + * @var integer + */ + public $updated_at; + + public function getSource() + { + return 'course'; + } + + public function initialize() + { + parent::initialize(); + + $this->addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->created_at = time(); + + $attrs = []; + + switch ($this->model) { + case Course::MODEL_VOD: + $attrs = $this->_vod_attrs; + break; + case Course::MODEL_LIVE: + $attrs = $this->_live_attrs; + break; + case Course::MODEL_ARTICLE: + $attrs = $this->_article_attrs; + break; + } + + $this->attrs = $attrs ? kg_json_encode($attrs) : ''; + } + + public function beforeUpdate() + { + $this->updated_at = time(); + + if (!empty($this->attrs)) { + $this->attrs = kg_json_encode($this->attrs); + } + } + + public function afterFetch() + { + if (!empty($this->attrs)) { + $this->attrs = json_decode($this->attrs); + } + } + + public static function models() + { + $list = [ + self::MODEL_VOD => '点播', + self::MODEL_LIVE => '直播', + self::MODEL_ARTICLE => '图文', + ]; + + return $list; + } + + public static function levels() + { + $list = [ + self::LEVEL_ENTRY => '入门', + self::LEVEL_JUNIOR => '初级', + self::LEVEL_MEDIUM => '中级', + self::LEVEL_SENIOR => '高级', + ]; + + return $list; + } + +} diff --git a/app/Models/CourseCategory.php b/app/Models/CourseCategory.php new file mode 100644 index 00000000..70e37749 --- /dev/null +++ b/app/Models/CourseCategory.php @@ -0,0 +1,46 @@ +created_at = time(); + } + +} diff --git a/app/Models/CourseFavorite.php b/app/Models/CourseFavorite.php new file mode 100644 index 00000000..df12b934 --- /dev/null +++ b/app/Models/CourseFavorite.php @@ -0,0 +1,46 @@ +created_at = time(); + } + +} diff --git a/app/Models/CoursePackage.php b/app/Models/CoursePackage.php new file mode 100644 index 00000000..c2345291 --- /dev/null +++ b/app/Models/CoursePackage.php @@ -0,0 +1,46 @@ +created_at = time(); + } + +} diff --git a/app/Models/CourseRelated.php b/app/Models/CourseRelated.php new file mode 100644 index 00000000..91dae3f7 --- /dev/null +++ b/app/Models/CourseRelated.php @@ -0,0 +1,46 @@ +created_at = time(); + } + +} diff --git a/app/Models/CourseTopic.php b/app/Models/CourseTopic.php new file mode 100644 index 00000000..68946e1e --- /dev/null +++ b/app/Models/CourseTopic.php @@ -0,0 +1,46 @@ +created_at = time(); + } + +} diff --git a/app/Models/CourseUser.php b/app/Models/CourseUser.php new file mode 100644 index 00000000..fe4c3175 --- /dev/null +++ b/app/Models/CourseUser.php @@ -0,0 +1,150 @@ +created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + + public static function roles() + { + $list = [ + self::ROLE_STUDENT => '学员', + self::ROLE_TEACHER => '讲师', + ]; + + return $list; + } + + public static function sources() + { + $list = [ + self::SOURCE_FREE => '免费课程', + self::SOURCE_PAID => '付费课程', + self::SOURCE_VIP => '会员免费', + self::SOURCE_IMPORT => '后台导入', + ]; + + return $list; + } + +} diff --git a/app/Models/Learning.php b/app/Models/Learning.php new file mode 100644 index 00000000..cd350dbc --- /dev/null +++ b/app/Models/Learning.php @@ -0,0 +1,127 @@ +created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + +} diff --git a/app/Models/Model.php b/app/Models/Model.php new file mode 100644 index 00000000..1300f88d --- /dev/null +++ b/app/Models/Model.php @@ -0,0 +1,17 @@ +setup([ + 'notNullValidations' => false, + ]); + + $this->useDynamicUpdate(true); + } + +} \ No newline at end of file diff --git a/app/Models/Nav.php b/app/Models/Nav.php new file mode 100644 index 00000000..86728c6e --- /dev/null +++ b/app/Models/Nav.php @@ -0,0 +1,160 @@ +addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + + public static function positions() + { + $list = [ + self::POSITION_TOP => '顶部', + self::POSITION_BOTTOM => '底部', + ]; + + return $list; + } + + public static function targets() + { + $list = [ + self::TARGET_BLANK => '新窗口', + self::TARGET_SELF => '原窗口', + ]; + + return $list; + } + +} diff --git a/app/Models/Order.php b/app/Models/Order.php new file mode 100644 index 00000000..9d623db1 --- /dev/null +++ b/app/Models/Order.php @@ -0,0 +1,214 @@ +addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->sn = date('YmdHis') . rand(1000, 9999); + + $this->status = self::STATUS_PENDING; + + $this->created_at = time(); + + if (is_array($this->item_info) && !empty($this->item_info)) { + $this->item_info = kg_json_encode($this->item_info); + } + } + + public function beforeUpdate() + { + $this->updated_at = time(); + + if (!empty($this->item_info)) { + $this->item_info = kg_json_encode($this->item_info); + } + } + + public function afterFetch() + { + if (!empty($this->item_info)) { + $this->item_info = json_decode($this->item_info); + } + } + + public static function types() + { + $list = [ + self::TYPE_COURSE => '课程', + self::TYPE_PACKAGE => '套餐', + self::TYPE_REWARD => '打赏', + self::TYPE_VIP => '会员', + self::TYPE_TEST => '测试', + ]; + + return $list; + } + + public static function sources() + { + $list = [ + self::CLIENT_DESKTOP => 'desktop', + self::CLIENT_ANDROID => 'android', + self::CLIENT_IOS => 'ios', + ]; + + return $list; + } + + public static function statuses() + { + $list = [ + self::STATUS_PENDING => '待支付', + self::STATUS_FINISHED => '已完成', + self::STATUS_CLOSED => '已关闭', + self::STATUS_REFUNDED => '已退款', + ]; + + return $list; + } + +} diff --git a/app/Models/Package.php b/app/Models/Package.php new file mode 100644 index 00000000..2215a6b4 --- /dev/null +++ b/app/Models/Package.php @@ -0,0 +1,107 @@ +addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + +} diff --git a/app/Models/Page.php b/app/Models/Page.php new file mode 100644 index 00000000..9158692c --- /dev/null +++ b/app/Models/Page.php @@ -0,0 +1,79 @@ +addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + +} diff --git a/app/Models/Refund.php b/app/Models/Refund.php new file mode 100644 index 00000000..ecd504c8 --- /dev/null +++ b/app/Models/Refund.php @@ -0,0 +1,158 @@ +addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->sn = date('YmdHis') . rand(1000, 9999); + + $this->status = self::STATUS_PENDING; + + $this->created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + + public static function statuses() + { + $list = [ + self::STATUS_PENDING => '待处理', + self::STATUS_CANCELED => '已取消', + self::STATUS_APPROVED => '已审核', + self::STATUS_REFUSED => '已拒绝', + self::STATUS_FINISHED => '已完成', + self::STATUS_FAILED => '已失败', + ]; + + return $list; + } + +} diff --git a/app/Models/Review.php b/app/Models/Review.php new file mode 100644 index 00000000..cb9653ca --- /dev/null +++ b/app/Models/Review.php @@ -0,0 +1,100 @@ +addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + +} diff --git a/app/Models/Role.php b/app/Models/Role.php new file mode 100644 index 00000000..dc7cb745 --- /dev/null +++ b/app/Models/Role.php @@ -0,0 +1,151 @@ +addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->created_at = time(); + + if (is_array($this->routes) && !empty($this->routes)) { + $this->routes = kg_json_encode($this->routes); + } + } + + public function beforeUpdate() + { + $this->updated_at = time(); + + if (is_array($this->routes) && !empty($this->routes)) { + $this->routes = kg_json_encode($this->routes); + } + } + + public function afterFetch() + { + if (!empty($this->routes)) { + $this->routes = json_decode($this->routes, true); + } + } + + public static function types() + { + $list = [ + self::TYPE_SYSTEM => '内置', + self::TYPE_CUSTOM => '自定', + ]; + + return $list; + } + + public static function sysRoles() + { + $list = [ + self::ROLE_ADMIN => '管理人员', + self::ROLE_OPERATOR => '运营人员', + self::ROLE_EDITOR => '编辑人员', + self::ROLE_FINANCE => '财务人员', + ]; + + return $list; + } + +} diff --git a/app/Models/Slide.php b/app/Models/Slide.php new file mode 100644 index 00000000..ba3149ae --- /dev/null +++ b/app/Models/Slide.php @@ -0,0 +1,146 @@ +addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + + public static function targets() + { + $list = [ + self::TARGET_COURSE => '课程', + self::TARGET_PAGE => '单页', + self::TARGET_LINK => '链接', + ]; + + return $list; + } + +} diff --git a/app/Models/Task.php b/app/Models/Task.php new file mode 100644 index 00000000..93794ac6 --- /dev/null +++ b/app/Models/Task.php @@ -0,0 +1,124 @@ +created_at = time(); + + $this->status = self::STATUS_PENDING; + + if (is_array($this->item_info) && !empty($this->item_info)) { + $this->item_info = kg_json_encode($this->item_info); + } else { + $this->item_info = ''; + } + } + + public function beforeUpdate() + { + $this->updated_at = time(); + + if (is_array($this->item_info) && !empty($this->item_info)) { + $this->item_info = kg_json_encode($this->item_info); + } + } + + public function afterFetch() + { + if (!empty($this->item_info)) { + $this->item_info = json_decode($this->item_info, true); + } + } + +} diff --git a/app/Models/Topic.php b/app/Models/Topic.php new file mode 100644 index 00000000..87947eea --- /dev/null +++ b/app/Models/Topic.php @@ -0,0 +1,79 @@ +addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + +} diff --git a/app/Models/Trade.php b/app/Models/Trade.php new file mode 100644 index 00000000..3164053d --- /dev/null +++ b/app/Models/Trade.php @@ -0,0 +1,168 @@ +addBehavior( + new SoftDelete([ + 'field' => 'deleted', + 'value' => 1, + ]) + ); + } + + public function beforeCreate() + { + $this->sn = date('YmdHis') . rand(1000, 9999); + + $this->status = self::STATUS_PENDING; + + $this->created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + + public static function channels() + { + $list = [ + self::CHANNEL_ALIPAY => '阿里支付', + self::CHANNEL_WXPAY => '微信支付', + ]; + + return $list; + } + + public static function statuses() + { + $list = [ + self::STATUS_PENDING => '待支付', + self::STATUS_FINISHED => '已完成', + self::STATUS_CLOSED => '已关闭', + self::STATUS_REFUNDED => '已退款', + ]; + + return $list; + } + +} diff --git a/app/Models/User.php b/app/Models/User.php new file mode 100644 index 00000000..fb1a68f3 --- /dev/null +++ b/app/Models/User.php @@ -0,0 +1,172 @@ +created_at = time(); + } + + public function beforeUpdate() + { + $this->updated_at = time(); + } + + public static function eduRoles() + { + $list = [ + self::EDU_ROLE_STUDENT => '学员', + self::EDU_ROLE_TEACHER => '讲师', + ]; + + return $list; + } + +} diff --git a/app/Providers/AbstractProvider.php b/app/Providers/AbstractProvider.php new file mode 100644 index 00000000..f98e451b --- /dev/null +++ b/app/Providers/AbstractProvider.php @@ -0,0 +1,41 @@ +setDI($di); + } + + /** + * Gets the Service name. + * + * @return string + */ + public function getName() + { + return $this->serviceName; + } +} \ No newline at end of file diff --git a/app/Providers/Annotation.php b/app/Providers/Annotation.php new file mode 100644 index 00000000..6192327e --- /dev/null +++ b/app/Providers/Annotation.php @@ -0,0 +1,31 @@ +di->setShared($this->serviceName, function () { + + $config = $this->getShared('config'); + + if ($config->env == ENV_DEV) { + $annotations = new MemoryAnnotations(); + } else { + $annotations = new FileAnnotations([ + 'annotationsDir' => cache_path() . '/annotations/', + ]); + } + + return $annotations; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Cache.php b/app/Providers/Cache.php new file mode 100644 index 00000000..9e1c27cb --- /dev/null +++ b/app/Providers/Cache.php @@ -0,0 +1,33 @@ +di->setShared($this->serviceName, function () { + + $config = $this->getShared('config'); + + $frontend = new JsonFrontend([ + 'lifetime' => $config->redis->lifetime, + ]); + + $backend = new RedisBackend($frontend, [ + 'host' => $config->redis->host, + 'port' => $config->redis->port, + 'auth' => $config->redis->auth, + ]); + + return $backend; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/CliDispatcher.php b/app/Providers/CliDispatcher.php new file mode 100644 index 00000000..e6fbf42b --- /dev/null +++ b/app/Providers/CliDispatcher.php @@ -0,0 +1,24 @@ +di->setShared($this->serviceName, function() { + + $dispatcher = new Dispatcher(); + + $dispatcher->setDefaultNamespace('App\Console\Tasks'); + + return $dispatcher; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Config.php b/app/Providers/Config.php new file mode 100644 index 00000000..56328565 --- /dev/null +++ b/app/Providers/Config.php @@ -0,0 +1,24 @@ +di->setShared($this->serviceName, function () { + + $options = require config_path() . '/config.php'; + + $config = new PhalconConfig($options); + + return $config; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Cookie.php b/app/Providers/Cookie.php new file mode 100644 index 00000000..2fde7903 --- /dev/null +++ b/app/Providers/Cookie.php @@ -0,0 +1,17 @@ +di->setShared($this->serviceName, function () { + + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Crypt.php b/app/Providers/Crypt.php new file mode 100644 index 00000000..25b6412b --- /dev/null +++ b/app/Providers/Crypt.php @@ -0,0 +1,26 @@ +di->setShared($this->serviceName, function () { + + $config = $this->getShared('config'); + + $crypt = new PhalconCrypt(); + + $crypt->setKey($config->key); + + return $crypt; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Database.php b/app/Providers/Database.php new file mode 100644 index 00000000..5fc7425b --- /dev/null +++ b/app/Providers/Database.php @@ -0,0 +1,37 @@ +di->setShared($this->serviceName, function () { + + $config = $this->getShared('config'); + + $options = [ + 'host' => $config->db->host ?: '127.0.0.1', + 'port' => $config->db->host ?: 3306, + 'dbname' => $config->db->dbname, + 'username' => $config->db->username, + 'password' => $config->db->password, + 'charset' => $config->db->charset ?: 'utf8', + ]; + + $connection = new MySqlAdapter($options); + + if ($config->env == ENV_DEV) { + $connection->setEventsManager($this->getEventsManager()); + } + + return $connection; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Escaper.php b/app/Providers/Escaper.php new file mode 100644 index 00000000..e412c219 --- /dev/null +++ b/app/Providers/Escaper.php @@ -0,0 +1,17 @@ +di->setShared($this->serviceName, PhalconEscaper::class); + } + +} \ No newline at end of file diff --git a/app/Providers/EventsManager.php b/app/Providers/EventsManager.php new file mode 100644 index 00000000..a2fd58eb --- /dev/null +++ b/app/Providers/EventsManager.php @@ -0,0 +1,28 @@ +di->setShared($this->serviceName, function () { + + $events = require config_path() . '/events.php'; + + $eventsManager = new PhalconEventsManager(); + + foreach ($events as $eventType => $handler) { + $eventsManager->attach($eventType, new $handler()); + } + + return $eventsManager; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Logger.php b/app/Providers/Logger.php new file mode 100644 index 00000000..5a6ee4c6 --- /dev/null +++ b/app/Providers/Logger.php @@ -0,0 +1,22 @@ +di->setShared($this->serviceName, function () { + + $logger = new AppLogger(); + + return $logger->getInstance('common'); + }); + } + +} \ No newline at end of file diff --git a/app/Providers/MetaData.php b/app/Providers/MetaData.php new file mode 100644 index 00000000..58f11445 --- /dev/null +++ b/app/Providers/MetaData.php @@ -0,0 +1,31 @@ +di->setShared($this->serviceName, function () { + + $config = $this->getShared('config'); + + if ($config->env == ENV_DEV) { + $metaData = new MemoryMetaData(); + } else { + $metaData = new FileMetaData([ + 'metaDataDir' => cache_path() . '/metadata/', + ]); + } + + return $metaData; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/ProviderInterface.php b/app/Providers/ProviderInterface.php new file mode 100644 index 00000000..1d1a674a --- /dev/null +++ b/app/Providers/ProviderInterface.php @@ -0,0 +1,27 @@ +di->setShared($this->serviceName, function () { + + $config = $this->getShared('config'); + + $redis = new \Redis(); + + $host = $config->redis->host ?: '127.0.0.1'; + $port = $config->redis->port ?: 6379; + $persistent = $config->redis->persistent ?: false; + $auth = $config->redis->auth ?: null; + + if ($persistent) { + $redis->pconnect($host, $port); + } else { + $redis->connect($host, $port); + } + + if ($auth) { + $redis->auth($auth); + } + + return $redis; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Router.php b/app/Providers/Router.php new file mode 100644 index 00000000..238a7043 --- /dev/null +++ b/app/Providers/Router.php @@ -0,0 +1,59 @@ +di->setShared($this->serviceName, function () { + + $router = new AnnotationsRouter(false); + + $router->removeExtraSlashes(true); + + $router->setDefaultNamespace('App\Http\Home\Controllers'); + + $router->notFound([ + 'module' => 'home', + 'controller' => 'error', + 'action' => 'show404', + ]); + + $homeFiles = scandir(app_path('Http/Home/Controllers')); + + foreach ($homeFiles as $file) { + if (strpos($file, 'Controller.php')) { + $className = str_replace('Controller.php', '', $file); + $router->addModuleResource('home', 'App\Http\Home\Controllers\\' . $className); + } + } + + $adminFiles = scandir(app_path('Http/Admin/Controllers')); + + foreach ($adminFiles as $file) { + if (strpos($file, 'Controller.php')) { + $className = str_replace('Controller.php', '', $file); + $router->addModuleResource('admin', 'App\Http\Admin\Controllers\\' . $className); + } + } + + $apiFiles = scandir(app_path('Http/Api/Controllers')); + + foreach ($apiFiles as $file) { + if (strpos($file, 'Controller.php')) { + $className = str_replace('Controller.php', '', $file); + $router->addModuleResource('api', 'App\Http\Api\Controllers\\' . $className); + } + } + + return $router; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Security.php b/app/Providers/Security.php new file mode 100644 index 00000000..f7dc3b60 --- /dev/null +++ b/app/Providers/Security.php @@ -0,0 +1,22 @@ +di->setShared($this->serviceName, function () { + + $security = new AppSecurity(); + + return $security; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Session.php b/app/Providers/Session.php new file mode 100644 index 00000000..d07a490b --- /dev/null +++ b/app/Providers/Session.php @@ -0,0 +1,32 @@ +di->setShared($this->serviceName, function () { + + $config = $this->getShared('config'); + + $session = new RedisSession([ + 'host' => $config->redis->host, + 'port' => $config->redis->port, + 'auth' => $config->redis->auth, + 'lifetime' => $config->session->lifetime, + 'index' => 1, + ]); + + $session->start(); + + return $session; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Url.php b/app/Providers/Url.php new file mode 100644 index 00000000..d45ff5d1 --- /dev/null +++ b/app/Providers/Url.php @@ -0,0 +1,28 @@ +di->setShared($this->serviceName, function() { + + $config = $this->getShared('config'); + + $url = new UrlResolver(); + + $url->setBaseUri($config->url->base); + + $url->setStaticBaseUri($config->url->static); + + return $url; + }); + } + +} \ No newline at end of file diff --git a/app/Providers/Volt.php b/app/Providers/Volt.php new file mode 100644 index 00000000..1a4351d7 --- /dev/null +++ b/app/Providers/Volt.php @@ -0,0 +1,53 @@ +di->setShared('volt', function ($view, $di) { + + $volt = new PhalconVolt($view, $di); + + $volt->setOptions([ + 'compiledPath' => cache_path() . '/volt/', + 'compiledSeparator' => '_', + ]); + + $compiler = $volt->getCompiler(); + + $compiler->addFunction('substr', function ($resolvedArgs) { + return 'kg_substr(' . $resolvedArgs . ')'; + }); + + $compiler->addFunction('can', function ($resolvedArgs) { + return 'kg_can(' . $resolvedArgs . ')'; + }); + + $compiler->addFunction('img_url', function ($resolvedArgs) { + return 'kg_img_url(' . $resolvedArgs . ')'; + }); + + $compiler->addFilter('play_duration', function ($resolvedArgs) { + return 'kg_play_duration(' . $resolvedArgs . ')'; + }); + + $compiler->addFilter('total_duration', function ($resolvedArgs) { + return 'kg_total_duration(' . $resolvedArgs . ')'; + }); + + $compiler->addFilter('human_number', function ($resolvedArgs) { + return 'kg_human_number(' . $resolvedArgs . ')'; + }); + + return $volt; + }); + } + +} \ No newline at end of file diff --git a/app/Repos/Audit.php b/app/Repos/Audit.php new file mode 100644 index 00000000..138d9ee7 --- /dev/null +++ b/app/Repos/Audit.php @@ -0,0 +1,79 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(AuditModel::class); + + $builder->where('1 = 1'); + + if (!empty($where['user_id'])) { + $builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + if (!empty($where['user_name'])) { + $builder->andWhere('user_name = :user_name:', ['user_name' => $where['user_name']]); + } + + if (!empty($where['req_route'])) { + $builder->andWhere('req_route = :req_route:', ['req_route' => $where['req_route']]); + } + + if (!empty($where['req_path'])) { + $builder->andWhere('req_path = :req_path:', ['req_path' => $where['req_path']]); + } + + if (!empty($where['start_time']) && !empty($where['end_time'])) { + $startTime = strtotime($where['start_time']); + $endTime = strtotime($where['end_time']); + $builder->betweenWhere('created_at', $startTime, $endTime); + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + +} diff --git a/app/Repos/Category.php b/app/Repos/Category.php new file mode 100644 index 00000000..a4f6eaa6 --- /dev/null +++ b/app/Repos/Category.php @@ -0,0 +1,96 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function findAll($where = []) + { + $query = CategoryModel::query(); + + $query->where('1 = 1'); + + if (isset($where['parent_id'])) { + $query->andWhere('parent_id = :parent_id:', ['parent_id' => $where['parent_id']]); + } + + if (isset($where['level'])) { + $query->andWhere('level = :level:', ['level' => $where['level']]); + } + + if (isset($where['published'])) { + $query->andWhere('published = :published:', ['published' => $where['published']]); + } + + if (isset($where['deleted'])) { + $query->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]); + } + + $query->orderBy('priority ASC'); + + $result = $query->execute(); + + return $result; + } + + public function findTopCategories() + { + $result = CategoryModel::query() + ->where('parent_id = 0') + ->andWhere('deleted = 0') + ->execute(); + + return $result; + } + + public function findChildCategories($categoryId) + { + $result = CategoryModel::query() + ->where('parent_id = :parent_id:', ['parent_id' => $categoryId]) + ->andWhere('deleted = 0') + ->andWhere('published = 1') + ->execute(); + + return $result; + } + + public function countCourses($categoryId) + { + $phql = "SELECT COUNT(*) AS total FROM %s cc JOIN %s c ON cc.course_id = c.id + WHERE cc.category_id = :category_id: AND c.deleted = 0"; + + $row = $this->modelsManager->executeQuery( + sprintf($phql, CourseCategoryModel::class, CourseModel::class), + ['category_id' => $categoryId] + )->getFirst(); + + return (int)$row['total']; + } + +} diff --git a/app/Repos/Chapter.php b/app/Repos/Chapter.php new file mode 100644 index 00000000..b41c4bf4 --- /dev/null +++ b/app/Repos/Chapter.php @@ -0,0 +1,142 @@ +modelsManager->createBuilder() + ->columns('c.*') + ->addFrom(ChapterModel::class, 'c') + ->join(ChapterVodModel::class, 'c.id = cv.chapter_id', 'cv') + ->where('cv.file_id = :file_id:', ['file_id' => $fileId]) + ->getQuery()->execute()->getFirst(); + + return $result; + } + + public function findByIds($ids, $columns = '*') + { + $result = ChapterModel::query() + ->columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function findAll($where = []) + { + $query = ChapterModel::query(); + + $query->where('1 = 1'); + + if (isset($where['parent_id'])) { + $query->andWhere('parent_id = :parent_id:', ['parent_id' => $where['parent_id']]); + } + + if (isset($where['course_id'])) { + $query->andWhere('course_id = :course_id:', ['course_id' => $where['course_id']]); + } + + if (isset($where['published'])) { + $query->andWhere('published = :published:', ['published' => $where['published']]); + } + + if (isset($where['deleted'])) { + $query->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]); + } + + $result = $query->execute(); + + return $result; + } + + /** + * @param integer $chapterId + * @return ChapterVodModel + */ + public function findChapterVod($chapterId) + { + $result = ChapterVodModel::findFirstByChapterId($chapterId); + + return $result; + } + + /** + * @param integer $chapterId + * @return ChapterLiveModel + */ + public function findChapterLive($chapterId) + { + $result = ChapterLiveModel::findFirstByChapterId($chapterId); + + return $result; + } + + /** + * @param integer $chapterId + * @return ChapterArticleModel + */ + public function findChapterArticle($chapterId) + { + $result = ChapterArticleModel::findFirstByChapterId($chapterId); + + return $result; + } + + public function maxChapterPriority($courseId) + { + $result = ChapterModel::maximum([ + 'column' => 'priority', + 'conditions' => 'course_id = :course_id: AND parent_id = 0', + 'bind' => ['course_id' => $courseId], + ]); + + return $result; + } + + public function maxLessonPriority($chapterId) + { + $result = ChapterModel::maximum([ + 'column' => 'priority', + 'conditions' => 'parent_id = :parent_id:', + 'bind' => ['parent_id' => $chapterId], + ]); + + return $result; + } + + public function countLessons($chapterId) + { + $result = ChapterModel::count([ + 'conditions' => 'parent_id = :chapter_id: AND deleted = 0', + 'bind' => ['chapter_id' => $chapterId], + ]); + + return (int)$result; + } + +} diff --git a/app/Repos/ChapterUser.php b/app/Repos/ChapterUser.php new file mode 100644 index 00000000..f2a29025 --- /dev/null +++ b/app/Repos/ChapterUser.php @@ -0,0 +1,87 @@ +where('chapter_id = :chapter_id:', ['chapter_id' => $chapterId]) + ->andWhere('user_id = :user_id:', ['user_id' => $userId]) + ->execute() + ->getFirst(); + + return $result; + } + + public function findAll($where = []) + { + $query = ChapterUserModel::query(); + + $query->where('1 = 1'); + + if (!empty($where['course_id'])) { + $query->andWhere('course_id = :course_id:', ['course_id' => $where['course_id']]); + } + + if (!empty($where['chapter_id'])) { + $query->andWhere('chapter_id = :chapter_id:', ['chapter_id' => $where['chapter_id']]); + } + + if (!empty($where['user_id'])) { + $query->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + $result = $query->execute(); + + return $result; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(ChapterUserModel::class); + + $builder->where('1 = 1'); + + if (!empty($where['course_id'])) { + $builder->andWhere('course_id = :course_id:', ['course_id' => $where['course_id']]); + } + + if (!empty($where['chapter_id'])) { + $builder->andWhere('chapter_id = :chapter_id:', ['chapter_id' => $where['chapter_id']]); + } + + if (!empty($where['user_id'])) { + $builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + +} diff --git a/app/Repos/Config.php b/app/Repos/Config.php new file mode 100644 index 00000000..5a4dbde2 --- /dev/null +++ b/app/Repos/Config.php @@ -0,0 +1,46 @@ +where('section = :section:', ['section' => $section]) + ->andWhere('item_key = :key:', ['key' => $key]) + ->execute()->getFirst(); + + return $result; + } + + public function findBySection($section) + { + $query = ConfigModel::query(); + + $query->where('section = :section:', ['section' => $section]); + + $result = $query->execute(); + + return $result; + } + + public function findAll($where = []) + { + $query = ConfigModel::query(); + + $query->where('1 = 1'); + + if (isset($where['section'])) { + $query->andWhere('section = :section:', ['section' => $where['section']]); + } + + $result = $query->execute(); + + return $result; + } + +} diff --git a/app/Repos/Course.php b/app/Repos/Course.php new file mode 100644 index 00000000..e2c18674 --- /dev/null +++ b/app/Repos/Course.php @@ -0,0 +1,214 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function findTeachers($courseId) + { + $roleType = CourseUserModel::ROLE_TEACHER; + + $result = $this->modelsManager->createBuilder() + ->columns('u.*') + ->addFrom(UserModel::class, 'u') + ->join(CourseUserModel::class, 'u.id = cu.user_id', 'cu') + ->where('cu.course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('cu.role_type = :role_type:', ['role_type' => $roleType]) + ->andWhere('u.locked = 0') + ->getQuery()->execute(); + + return $result; + } + + public function findCategories($courseId) + { + $result = $this->modelsManager->createBuilder() + ->columns('c.*') + ->addFrom(CategoryModel::class, 'c') + ->join(CourseCategoryModel::class, 'c.id = cc.category_id', 'cc') + ->where('cc.course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('c.deleted = 0') + ->getQuery()->execute(); + + return $result; + } + + public function findRelatedCourses($courseId) + { + $result = $this->modelsManager->createBuilder() + ->columns('c.*') + ->addFrom(CourseModel::class, 'c') + ->join(CourseRelatedModel::class, 'c.id = cr.related_id', 'cr') + ->where('cr.course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('c.deleted = 0') + ->getQuery()->execute(); + + return $result; + } + + public function findChapters($courseId) + { + $result = ChapterModel::query() + ->where('course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('deleted = 0') + ->execute(); + + return $result; + } + + public function findLessons($courseId) + { + $result = ChapterModel::query() + ->where('course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('parent_id > 0') + ->andWhere('deleted = 0') + ->execute(); + + return $result; + } + + public function findUserLessons($courseId, $userId) + { + $result = ChapterUserModel::query() + ->where('course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('user_id = :user_id:', ['user_id' => $userId]) + ->execute(); + + return $result; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(CourseModel::class); + + $builder->where('1 = 1'); + + if (!empty($where['id'])) { + if (is_array($where['id'])) { + $builder->inWhere('id', $where['id']); + } else { + $builder->andWhere('id = :id:', ['id' => $where['id']]); + } + } + + if (!empty($where['user_id'])) { + $builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + if (!empty($where['title'])) { + $builder->andWhere('title LIKE :title:', ['title' => '%' . $where['title'] . '%']); + } + + if (!empty($where['model'])) { + $builder->andWhere('model = :model:', ['model' => $where['model']]); + } + + if (!empty($where['level'])) { + $builder->andWhere('level = :level:', ['level' => $where['level']]); + } + + if (isset($where['free'])) { + if ($where['free'] == 1) { + $builder->andWhere('market_price = 0'); + } else { + $builder->andWhere('market_price > 0'); + } + } + + if (isset($where['published'])) { + $builder->andWhere('published = :published:', ['published' => $where['published']]); + } + + if (isset($where['deleted'])) { + $builder->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]); + } + + switch ($sort) { + case 'rating': + $orderBy = 'rating DESC'; + break; + case 'score': + $orderBy = 'score DESC'; + break; + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + + public function countLessons($courseId) + { + $count = ChapterModel::count([ + 'conditions' => 'course_id = :course_id: AND parent_id > 0 AND deleted = 0', + 'bind' => ['course_id' => $courseId], + ]); + + return (int)$count; + } + + public function countStudents($courseId) + { + $count = CourseUserModel::count([ + 'conditions' => 'course_id = :course_id: AND deleted = 0', + 'bind' => ['course_id' => $courseId], + ]); + + return (int)$count; + } + + public function countReviews($courseId) + { + $count = ReviewModel::count([ + 'conditions' => 'course_id = :course_id: AND deleted = 0', + 'bind' => ['course_id' => $courseId], + ]); + + return (int)$count; + } + +} diff --git a/app/Repos/CourseCategory.php b/app/Repos/CourseCategory.php new file mode 100644 index 00000000..f4e97ddc --- /dev/null +++ b/app/Repos/CourseCategory.php @@ -0,0 +1,40 @@ +where('course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('category_id = :category_id:', ['category_id' => $categoryId]) + ->orderBy('id DESC') + ->execute() + ->getFirst(); + + return $result; + } + + public function findByCategoryIds($categoryIds) + { + $result = CourseCategoryModel::query() + ->inWhere('category_id', $categoryIds) + ->execute(); + + return $result; + } + + public function findByCourseIds($courseIds) + { + $result = CourseCategoryModel::query() + ->inWhere('course_id', $courseIds) + ->execute(); + + return $result; + } + +} diff --git a/app/Repos/CourseFavorite.php b/app/Repos/CourseFavorite.php new file mode 100644 index 00000000..c7aa077f --- /dev/null +++ b/app/Repos/CourseFavorite.php @@ -0,0 +1,54 @@ +where('course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('user_id = :user_id:', ['user_id' => $userId]) + ->execute() + ->getFirst(); + + return $result; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(CourseFavoriteModel::class); + + $builder->where('1 = 1'); + + if (isset($where['course_id'])) { + $builder->andWhere('course_id = :course_id:', ['course_id' => $where['course_id']]); + } + + if (isset($where['user_id'])) { + $builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager; + } + +} diff --git a/app/Repos/CoursePackage.php b/app/Repos/CoursePackage.php new file mode 100644 index 00000000..419b294f --- /dev/null +++ b/app/Repos/CoursePackage.php @@ -0,0 +1,40 @@ +where('course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('package_id = :package_id:', ['package_id' => $packageId]) + ->orderBy('id DESC') + ->execute() + ->getFirst(); + + return $result; + } + + public function findByCategoryIds($packageIds) + { + $result = CoursePackageModel::query() + ->inWhere('package_id', $packageIds) + ->execute(); + + return $result; + } + + public function findByCourseIds($courseIds) + { + $result = CoursePackageModel::query() + ->inWhere('course_id', $courseIds) + ->execute(); + + return $result; + } + +} diff --git a/app/Repos/CourseRelated.php b/app/Repos/CourseRelated.php new file mode 100644 index 00000000..5b4cab5c --- /dev/null +++ b/app/Repos/CourseRelated.php @@ -0,0 +1,40 @@ +where('course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('related_id = :related_id:', ['related_id' => $relatedId]) + ->orderBy('id DESC') + ->execute() + ->getFirst(); + + return $result; + } + + public function findByRelatedIds($relatedIds) + { + $result = CourseRelatedModel::query() + ->inWhere('related_id', $relatedIds) + ->execute(); + + return $result; + } + + public function findByCourseIds($courseIds) + { + $result = CourseRelatedModel::query() + ->inWhere('course_id', $courseIds) + ->execute(); + + return $result; + } + +} diff --git a/app/Repos/CourseUser.php b/app/Repos/CourseUser.php new file mode 100644 index 00000000..e421dbce --- /dev/null +++ b/app/Repos/CourseUser.php @@ -0,0 +1,125 @@ +where('course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('user_id = :user_id:', ['user_id' => $userId]) + ->execute() + ->getFirst(); + + return $result; + } + + /** + * @param integer $courseId + * @param integer $userId + * @return CourseUserModel + */ + public function findCourseTeacher($courseId, $userId) + { + $roleType = CourseUserModel::ROLE_TEACHER; + + $result = CourseUserModel::query() + ->where('course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('user_id = :user_id:', ['user_id' => $userId]) + ->andWhere('role_type = :role_type:', ['role_type' => $roleType]) + ->execute() + ->getFirst(); + + return $result; + } + + /** + * @param integer $courseId + * @param integer $userId + * @return CourseUserModel + */ + public function findCourseStudent($courseId, $userId) + { + $roleType = CourseUserModel::ROLE_STUDENT; + + $result = CourseUserModel::query() + ->where('course_id = :course_id:', ['course_id' => $courseId]) + ->andWhere('user_id = :user_id:', ['user_id' => $userId]) + ->andWhere('role_type = :role_type:', ['role_type' => $roleType]) + ->execute() + ->getFirst(); + + return $result; + } + + public function countFinishedChapters($courseId, $userId) + { + $count = ChapterUserModel::count([ + 'conditions' => 'course_id = :course_id: AND user_id = :user_id: AND finished = 1', + 'bind' => ['course_id' => $courseId, 'user_id' => $userId] + ]); + + return (int)$count; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(CourseUserModel::class); + + $builder->where('1 = 1'); + + if (!empty($where['course_id'])) { + $builder->andWhere('course_id = :course_id:', ['course_id' => $where['course_id']]); + } + + if (!empty($where['user_id'])) { + $builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + if (!empty($where['role_type'])) { + $builder->andWhere('role_type = :role_type:', ['role_type' => $where['role_type']]); + } + + if (!empty($where['source_type'])) { + $builder->andWhere('source_type = :source_type:', ['source_type' => $where['source_type']]); + } + + if (isset($where['locked'])) { + $builder->andWhere('locked = :locked:', ['locked' => $where['locked']]); + } + + if (isset($where['deleted'])) { + $builder->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]); + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + +} diff --git a/app/Repos/Learning.php b/app/Repos/Learning.php new file mode 100644 index 00000000..1aee120b --- /dev/null +++ b/app/Repos/Learning.php @@ -0,0 +1,59 @@ +modelsManager->createBuilder(); + + $builder->from(LearningModel::class); + + $builder->where('1 = 1'); + + if (!empty($where['user_id'])) { + $builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + if (!empty($where['course_id'])) { + $builder->andWhere('course_id = :course_id:', ['course_id' => $where['course_id']]); + } + + if (!empty($where['chapter_id'])) { + $builder->andWhere('chapter_id = :chapter_id:', ['chapter_id' => $where['chapter_id']]); + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + +} diff --git a/app/Repos/Nav.php b/app/Repos/Nav.php new file mode 100644 index 00000000..1c062397 --- /dev/null +++ b/app/Repos/Nav.php @@ -0,0 +1,64 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function findAll($where = []) + { + $query = NavModel::query(); + + $query->where('1 = 1'); + + if (isset($where['parent_id'])) { + $query->andWhere('parent_id = :parent_id:', ['parent_id' => $where['parent_id']]); + } + + if (isset($where['position'])) { + $query->andWhere('position = :position:', ['position' => $where['position']]); + } + + if (isset($where['level'])) { + $query->andWhere('level = :level:', ['level' => $where['level']]); + } + + if (isset($where['published'])) { + $query->andWhere('published = :published:', ['published' => $where['published']]); + } + + if (isset($where['deleted'])) { + $query->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]); + } + + $query->orderBy('position DESC,priority ASC'); + + $result = $query->execute(); + + return $result; + } + +} diff --git a/app/Repos/Order.php b/app/Repos/Order.php new file mode 100644 index 00000000..25063732 --- /dev/null +++ b/app/Repos/Order.php @@ -0,0 +1,120 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function findTrades($orderSn) + { + $result = TradeModel::query() + ->where('order_sn = :order_sn:', ['order_sn' => $orderSn]) + ->andWhere('deleted = 0') + ->execute(); + + return $result; + } + + public function findRefunds($orderSn) + { + $result = RefundModel::query() + ->where('order_sn = :order_sn:', ['order_sn' => $orderSn]) + ->andWhere('deleted = 0') + ->execute(); + + return $result; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(OrderModel::class); + + $builder->where('1 = 1'); + + if (!empty($where['id'])) { + $builder->andWhere('id = :id:', ['id' => $where['id']]); + } + + if (!empty($where['sn'])) { + $builder->andWhere('sn = :sn:', ['sn' => $where['sn']]); + } + + if (!empty($where['user_id'])) { + $builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + if (!empty($where['item_id'])) { + $builder->andWhere('item_id = :item_id:', ['item_id' => $where['item_id']]); + } + + if (!empty($where['item_type'])) { + $builder->andWhere('item_type = :item_type:', ['item_type' => $where['item_type']]); + } + + if (!empty($where['status'])) { + $builder->andWhere('status = :status:', ['status' => $where['status']]); + } + + if (!empty($where['start_time']) && !empty($where['end_time'])) { + $startTime = strtotime($where['start_time']); + $endTime = strtotime($where['end_time']); + $builder->betweenWhere('created_at', $startTime, $endTime); + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + +} diff --git a/app/Repos/Package.php b/app/Repos/Package.php new file mode 100644 index 00000000..98e95283 --- /dev/null +++ b/app/Repos/Package.php @@ -0,0 +1,94 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(PackageModel::class); + + $builder->where('1 = 1'); + + if (!empty($where['user_id'])) { + $builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + if (isset($where['published'])) { + $builder->andWhere('published = :published:', ['published' => $where['published']]); + } + + if (isset($where['deleted'])) { + $builder->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]); + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + + public function findCourses($packageId) + { + $result = $this->modelsManager->createBuilder() + ->columns('c.*') + ->addFrom(CourseModel::class, 'c') + ->join(CoursePackageModel::class, 'c.id = cp.course_id', 'cp') + ->where('cp.package_id = :package_id:', ['package_id' => $packageId]) + ->getQuery() + ->execute(); + + return $result; + } + + public function countCourses($packageId) + { + $count = CoursePackageModel::count([ + 'conditions' => 'package_id = :package_id:', + 'bind' => ['package_id' => $packageId], + ]); + + return (int)$count; + } + +} diff --git a/app/Repos/Page.php b/app/Repos/Page.php new file mode 100644 index 00000000..5bcf00bc --- /dev/null +++ b/app/Repos/Page.php @@ -0,0 +1,65 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(PageModel::class); + + $builder->where('1 = 1'); + + if (isset($where['published'])) { + $builder->andWhere('published = :published:', ['published' => $where['published']]); + } + + if (isset($where['deleted'])) { + $builder->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]); + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + +} diff --git a/app/Repos/Refund.php b/app/Repos/Refund.php new file mode 100644 index 00000000..3ea33d7c --- /dev/null +++ b/app/Repos/Refund.php @@ -0,0 +1,86 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(RefundModel::class); + + $builder->where('1 = 1'); + + if (!empty($where['user_id'])) { + $builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + if (!empty($where['order_sn'])) { + $builder->andWhere('order_sn = :order_sn:', ['order_sn' => $where['order_sn']]); + } + + if (!empty($where['status'])) { + $builder->andWhere('status = :status:', ['status' => $where['status']]); + } + + if (!empty($where['start_time']) && !empty($where['end_time'])) { + $startTime = strtotime($where['start_time']); + $endTime = strtotime($where['end_time']); + $builder->betweenWhere('created_at', $startTime, $endTime); + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + +} diff --git a/app/Repos/Repository.php b/app/Repos/Repository.php new file mode 100644 index 00000000..82c45068 --- /dev/null +++ b/app/Repos/Repository.php @@ -0,0 +1,10 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function findByUserCourseId($userId, $courseId) + { + $result = ReviewModel::query() + ->where('user_id = :user_id:', ['user_id' => $userId]) + ->andWhere('course_id = :course_id:', ['course_id' => $courseId]) + ->execute() + ->getFirst(); + + return $result; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(ReviewModel::class); + + $builder->where('1 = 1'); + + if (isset($where['id'])) { + $builder->andWhere('id = :id:', ['id' => $where['id']]); + } + + if (isset($where['user_id'])) { + $builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + if (isset($where['course_id'])) { + $builder->andWhere('course_id = :course_id:', ['course_id' => $where['course_id']]); + } + + if (isset($where['published'])) { + $builder->andWhere('published = :published:', ['published' => $where['published']]); + } + + if (isset($where['deleted'])) { + $builder->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]); + } + + if (isset($where['rating'])) { + switch ($where['rating']) { + case 'good': + $builder->andWhere('rating = 5'); + break; + case 'normal': + $builder->betweenWhere('rating', 3, 4); + break; + case 'bad': + $builder->andWhere('rating < 3'); + break; + } + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + +} diff --git a/app/Repos/Role.php b/app/Repos/Role.php new file mode 100644 index 00000000..7ba04c76 --- /dev/null +++ b/app/Repos/Role.php @@ -0,0 +1,56 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function findAll($where = []) + { + $query = RoleModel::query(); + + $query->where('1 = 1'); + + if (isset($where['deleted'])) { + $query->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]); + } + + $result = $query->execute(); + + return $result; + } + + public function countUsers($roleId) + { + $count = UserModel::count([ + 'conditions' => 'admin_role = :role_id:', + 'bind' => ['role_id' => $roleId], + ]); + + return (int)$count; + } +} diff --git a/app/Repos/Slide.php b/app/Repos/Slide.php new file mode 100644 index 00000000..d686e720 --- /dev/null +++ b/app/Repos/Slide.php @@ -0,0 +1,81 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function findTopSlides($limit = 5) + { + $result = SlideModel::query() + ->andWhere('published = :published:', ['published' => 1]) + ->andWhere('deleted = :deleted:', ['deleted' => 0]) + ->orderBy('priority ASC') + ->limit($limit) + ->execute(); + + return $result; + } + + public function paginate($where = [], $sort = 'priority', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(SlideModel::class); + + $builder->where('1 = 1'); + + if (isset($where['item_type'])) { + $builder->andWhere('item_type = :item_type:', ['item_type' => $where['item_type']]); + } + + if (isset($where['published'])) { + $builder->andWhere('published = :published:', ['published' => $where['published']]); + } + + if (isset($where['deleted'])) { + $builder->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]); + } + + switch ($sort) { + default: + $orderBy = 'priority ASC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + +} diff --git a/app/Repos/Trade.php b/app/Repos/Trade.php new file mode 100644 index 00000000..197dfff3 --- /dev/null +++ b/app/Repos/Trade.php @@ -0,0 +1,119 @@ +columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function findRefunds($tradeSn) + { + $result = RefundModel::query() + ->where('trade_sn = :trade_sn:', ['trade_sn' => $tradeSn]) + ->execute(); + + return $result; + } + + public function findLatestRefund($tradeSn) + { + $result = RefundModel::query() + ->where('trade_sn = :trade_sn:', ['trade_sn' => $tradeSn]) + ->orderBy('id DESC') + ->execute() + ->getFirst(); + + return $result; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(TradeModel::class); + + $builder->where('1 = 1'); + + if (!empty($where['id'])) { + $builder->andWhere('id = :id:', ['id' => $where['id']]); + } + + if (!empty($where['sn'])) { + $builder->andWhere('sn = :sn:', ['sn' => $where['sn']]); + } + + if (!empty($where['user_id'])) { + $builder->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); + } + + if (!empty($where['order_sn'])) { + $builder->andWhere('order_sn = :order_sn:', ['order_sn' => $where['order_sn']]); + } + + if (!empty($where['channel'])) { + $builder->andWhere('channel = :channel:', ['channel' => $where['channel']]); + } + + if (!empty($where['status'])) { + $builder->andWhere('status = :status:', ['status' => $where['status']]); + } + + if (!empty($where['start_time']) && !empty($where['end_time'])) { + $startTime = strtotime($where['start_time']); + $endTime = strtotime($where['end_time']); + $builder->betweenWhere('created_at', $startTime, $endTime); + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + +} diff --git a/app/Repos/User.php b/app/Repos/User.php new file mode 100644 index 00000000..8e2bf5f4 --- /dev/null +++ b/app/Repos/User.php @@ -0,0 +1,152 @@ +findByEmail($account); + } elseif (CommonValidator::phone($account)) { + $user = $this->findByPhone($account); + } else { + $user = $this->findByName($account); + } + + return $user; + } + + public function findByIds($ids, $columns = '*') + { + $result = UserModel::query() + ->columns($columns) + ->inWhere('id', $ids) + ->execute(); + + return $result; + } + + public function findTeachers() + { + $eduRole = UserModel::EDU_ROLE_TEACHER; + + $result = UserModel::query() + ->where('edu_role = :edu_role:', ['edu_role' => $eduRole]) + ->andWhere('locked = :locked:', ['locked' => 0]) + ->execute(); + + return $result; + } + + public function paginate($where = [], $sort = 'latest', $page = 1, $limit = 15) + { + $builder = $this->modelsManager->createBuilder(); + + $builder->from(UserModel::class); + + $builder->where('1 = 1'); + + if (!empty($where['id'])) { + $builder->andWhere('id = :id:', ['id' => $where['id']]); + } + + if (!empty($where['name'])) { + $builder->andWhere('name = :name:', ['name' => $where['name']]); + } + + if (!empty($where['email'])) { + $builder->andWhere('email = :email:', ['email' => $where['email']]); + } + + if (!empty($where['phone'])) { + $builder->andWhere('phone = :phone:', ['phone' => $where['phone']]); + } + + if (!empty($where['edu_role'])) { + $builder->andWhere('edu_role = :edu_role:', ['edu_role' => $where['edu_role']]); + } + + if (!empty($where['admin_role'])) { + $builder->andWhere('admin_role = :admin_role:', ['admin_role' => $where['admin_role']]); + } + + if (isset($where['vip'])) { + $builder->andWhere('vip = :vip:', ['vip' => $where['vip']]); + } + + if (isset($where['locked'])) { + $builder->andWhere('locked = :locked:', ['locked' => $where['locked']]); + } + + switch ($sort) { + default: + $orderBy = 'id DESC'; + break; + } + + $builder->orderBy($orderBy); + + $pager = new PagerQueryBuilder([ + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit, + ]); + + return $pager->getPaginate(); + } + +} diff --git a/app/Searchers/Course.php b/app/Searchers/Course.php new file mode 100644 index 00000000..02532410 --- /dev/null +++ b/app/Searchers/Course.php @@ -0,0 +1,94 @@ +xs = new \XS($fileName); + } + + /** + * 搜索 + * + * @param string $query + * @param integer $limit + * @param integer $offset + * @throws \XSException + * @return array + */ + public function search($query, $limit = 15, $offset = 0) + { + $search = $this->xs->search; + + $items = $search->setQuery($query)->setLimit($limit, $offset)->search(); + + $total = $search->getLastCount(); + + return [ + 'total' => $total, + 'items' => $items, + ]; + } + + /** + * 添加索引 + * + * @param CourseModel $course + */ + public function addIndex($course) + { + $doc = $this->setXSDocument($course); + + $this->xs->index->add($doc); + } + + /** + * 更新索引 + * + * @param CourseModel $course + * @throws \XSException + */ + public function updateIndex($course) + { + $doc = $this->setXSDocument($course); + + $this->xs->index->update($doc); + } + + /** + * 删除索引 + * + * @param CourseModel $course + */ + public function deleteIndex($course) + { + $this->xs->index->del($course->id); + } + + /** + * 设置文档 + * + * @param CourseModel $course + * @return \XSDocument + */ + private function setXSDocument($course) + { + $data = $course->toArray(); + + $doc = new \XSDocument(); + + $doc->setFields($data); + + return $doc; + } + +} diff --git a/app/Searchers/course.ini b/app/Searchers/course.ini new file mode 100644 index 00000000..e087081d --- /dev/null +++ b/app/Searchers/course.ini @@ -0,0 +1,51 @@ +project.name = course + +[id] +type = id + +[user_id] +type = string +index = self +tokenizer = full + +[category_id] +type = string +index = self +tokenizer = full + +[type] +type = string +index = self +tokenizer = full + +[title] +type = title + +[summary] +type = body + +[tags] +type = string +index = both + +[rating] +type = numeric + +[score] +type = numeric + +[price] +type = numeric + +[level] +type = string +index = self +tokenizer = full + +[status] +type = string +index = self +tokenizer = full + +[create_time] +type = numeric diff --git a/app/Services/Alipay.php b/app/Services/Alipay.php new file mode 100644 index 00000000..3bd79634 --- /dev/null +++ b/app/Services/Alipay.php @@ -0,0 +1,238 @@ +config = $this->getSectionConfig('payment.alipay'); + $this->gateway = $this->getGateway(); + } + + /** + * 查询订单(扫码生成订单后可执行) + * + * @param string $outTradeNo + * @return \Yansongda\Supports\Collection + */ + public function findOrder($outTradeNo) + { + try { + + $order = ['out_trade_no' => $outTradeNo]; + + $result = $this->gateway->find($order); + + return $result; + + } catch (\Exception $e) { + + Log::error('Alipay Find Order Exception', [ + 'code' => $e->getCode(), + 'message' => $e->getMessage(), + ]); + + return false; + } + } + + /** + * 撤销订单(未生成订单也可执行) + * + * @param string $outTradeNo + * @return \Yansongda\Supports\Collection + */ + public function cancelOrder($outTradeNo) + { + try { + + $order = ['out_trade_no' => $outTradeNo]; + + $result = $this->gateway->cancel($order); + + return $result; + + } catch (\Exception $e) { + + Log::error('Alipay Cancel Order Exception', [ + 'code' => $e->getCode(), + 'message' => $e->getMessage(), + ]); + + return false; + } + } + + /** + * 关闭订单(扫码生成订单后可执行) + * + * @param string $outTradeNo + * @return \Yansongda\Supports\Collection + */ + public function closeOrder($outTradeNo) + { + try { + + $order = ['out_trade_no' => $outTradeNo]; + + $result = $this->gateway->close($order); + + return $result; + + } catch (\Exception $e) { + + Log::error('Alipay Close Order Exception', [ + 'code' => $e->getCode(), + 'message' => $e->getMessage(), + ]); + + return false; + } + } + + /** + * 订单退款 + * + * + * $order = [ + * 'out_trade_no' => '1514027114', + * 'refund_amount' => '0.01', + * ]; + * + * + * @param array $order + * @return bool|mixed + */ + public function refundOrder($order) + { + try { + + $result = $this->gateway->refund($order); + + return $result; + + } catch (\Exception $e) { + + Log::error('Alipay Refund Order Exception', [ + 'code' => $e->getCode(), + 'message' => $e->getMessage(), + ]); + + return false; + } + } + + /** + * 获取二维码内容 + * + * @param array $order + * @return bool|string + */ + public function getQrCode($order) + { + try { + + $response = $this->gateway->scan($order); + + $result = $response->qr_code ?? false; + + return $result; + + } catch (\Exception $e) { + + Log::error('Alipay Qrcode Exception', [ + 'code' => $e->getCode(), + 'message' => $e->getMessage(), + ]); + + return false; + } + } + + /** + * 处理异步通知 + **/ + public function handleNotify() + { + try { + + $data = $this->gateway->verify(); + + Log::debug('Alipay Verify Data', $data->all()); + + } catch (\Exception $e) { + + Log::error('Alipay Verify Exception', [ + 'code' => $e->getCode(), + 'message' => $e->getMessage(), + ]); + + return false; + } + + if ($data->trade_status != 'TRADE_SUCCESS') { + return false; + } + + if ($data->app_id != $this->config->app_id) { + return false; + } + + $tradeRepo = new TradeRepo(); + + $trade = $tradeRepo->findBySn($data->out_trade_no); + + if (!$trade) return false; + + if ($data->total_amount != $trade->amount) { + return false; + } + + if ($trade->status != TradeModel::STATUS_PENDING) { + return false; + } + + $trade->channel_sn = $data->trade_no; + + $this->eventsManager->fire('payment:afterPay', $this, $trade); + + return $this->gateway->success(); + } + + /** + * 获取 Alipay Gateway + * + * @return \Yansongda\Pay\Gateways\Alipay + */ + public function getGateway() + { + $config = [ + 'app_id' => $this->config->app_id, + 'ali_public_key' => $this->config->public_key, + 'private_key' => $this->config->private_key, + 'notify_url' => $this->config->notify_url, + 'log' => [ + 'file' => log_path('alipay.log'), + 'level' => 'debug', + 'type' => 'daily', + 'max_file' => 30, + ], + 'mode' => 'dev', + ]; + + $gateway = Pay::alipay($config); + + return $gateway; + } + +} diff --git a/app/Services/Captcha.php b/app/Services/Captcha.php new file mode 100644 index 00000000..3ec838f7 --- /dev/null +++ b/app/Services/Captcha.php @@ -0,0 +1,108 @@ +config = $this->getSectionConfig('captcha'); + $this->logger = $this->getLogger('captcha'); + $this->client = $this->getCaptchaClient(); + } + + /** + * 校验验证码 + * + * @param string $ticket + * @param string $rand + * @return bool + */ + function verify($ticket, $rand) + { + $appId = $this->config->app_id; + $secretKey = $this->config->secret_key; + $userIp = $this->request->getClientAddress(); + $captchaType = 9; + + try { + + $request = new DescribeCaptchaResultRequest(); + + $params = json_encode([ + 'Ticket' => $ticket, + 'Randstr' => $rand, + 'UserIp' => $userIp, + 'CaptchaType' => (int)$captchaType, + 'CaptchaAppId' => (int)$appId, + 'AppSecretKey' => $secretKey, + ]); + + $request->fromJsonString($params); + + $this->logger->debug('Describe Captcha Result Request ' . $params); + + $response = $this->client->DescribeCaptchaResult($request); + + $this->logger->debug('Describe Captcha Result Response ' . $response->toJsonString()); + + $result = json_decode($response->toJsonString(), true); + + return $result['CaptchaCode'] == 1 ? true : false; + + } catch (TencentCloudSDKException $e) { + + $this->logger->error('Describe Captcha Result Exception ' . kg_json_encode([ + 'code' => $e->getErrorCode(), + 'message' => $e->getMessage(), + 'requestId' => $e->getRequestId(), + ])); + + return false; + } + } + + /** + * 获取CaptchaClient + * + * @return CaptchaClient + */ + public function getCaptchaClient() + { + $secret = $this->getSectionConfig('secret'); + + $secretId = $secret->secret_id; + $secretKey = $secret->secret_key; + + $region = $this->config->region ?? 'ap-guangzhou'; + + $credential = new Credential($secretId, $secretKey); + + $httpProfile = new HttpProfile(); + + $httpProfile->setEndpoint(self::END_POINT); + + $clientProfile = new ClientProfile(); + + $clientProfile->setHttpProfile($httpProfile); + + $client = new CaptchaClient($credential, $region, $clientProfile); + + return $client; + } + +} diff --git a/app/Services/Category.php b/app/Services/Category.php new file mode 100644 index 00000000..b65f6f19 --- /dev/null +++ b/app/Services/Category.php @@ -0,0 +1,82 @@ +findByCategoryIds($categoryIds); + + $result = []; + + if ($relations->count() > 0) { + foreach ($relations as $relation) { + $result[] = $relation->course_id; + } + } + + return $result; + } + + /** + * 通过单个分类(顶级|子级)查找课程号 + * + * @param integer $categoryId + * @return array + */ + public function getCourseIdsBySingleCategory($categoryId) + { + $categoryRepo = new CategoryRepo(); + + $category = $categoryRepo->findById($categoryId); + + $childCategoryIds = []; + + if ($category->level == 1) { + $childCategories = $categoryRepo->findChildCategories($categoryId); + if ($childCategories->count() > 0) { + foreach ($childCategories as $category) { + $childCategoryIds[] = $category->id; + } + } + } else { + $childCategoryIds[] = $categoryId; + } + + if (empty($childCategoryIds)) { + return []; + } + + $courseCategoryRepo = new CourseCategoryRepo(); + + $relations = $courseCategoryRepo->findByCategoryIds($childCategoryIds); + + $result = []; + + if ($relations->count() > 0) { + foreach ($relations as $relation) { + $result[] = $relation->course_id; + } + } + + return $result; + } + +} diff --git a/app/Services/CourseStats.php b/app/Services/CourseStats.php new file mode 100644 index 00000000..380b991d --- /dev/null +++ b/app/Services/CourseStats.php @@ -0,0 +1,133 @@ +findById($courseId); + + $lessonCount = $courseRepo->countLessons($courseId); + + $course->lesson_count = $lessonCount; + + $course->update(); + } + + public function updateStudentCount($courseId) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($courseId); + + $studentCount = $courseRepo->countStudents($courseId); + + $course->student_count = $studentCount; + + $course->update(); + } + + public function updateArticleWordCount($courseId) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($courseId); + + $lessons = $courseRepo->findLessons($courseId); + + if ($lessons->count() == 0) { + return; + } + + $wordCount = 0; + + foreach ($lessons as $lesson) { + if (isset($lesson->attrs->word_count)) { + $wordCount += $lesson->attrs->word_count; + } + } + + if ($wordCount == 0) { + return; + } + + /** + * @var \stdClass $attrs + */ + $attrs = $course->attrs; + $attrs->word_count = $wordCount; + $course->update(['attrs' => $attrs]); + } + + public function updateLiveDateRange($courseId) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($courseId); + + $lessons = $courseRepo->findChapters($course->id); + + if ($lessons->count() == 0) { + return; + } + + $scopes = []; + + foreach ($lessons as $lesson) { + if (isset($lesson->attrs->start_time)) { + $scopes[] = $lesson->attrs->start_time; + } + } + + if (!$scopes) { + return; + } + + /** + * @var \stdClass $attrs + */ + $attrs = $course->attrs; + $attrs->start_date = date('Y-m-d', min($scopes)); + $attrs->end_date = date('Y-m-d', max($scopes)); + $course->update(['attrs' => $attrs]); + } + + public function updateVodDuration($courseId) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($courseId); + + $lessons = $courseRepo->findLessons($course->id); + + if ($lessons->count() == 0) { + return; + } + + $duration = 0; + + foreach ($lessons as $lesson) { + if (isset($lesson->attrs->duration)) { + $duration += $lesson->attrs->duration; + } + } + + if ($duration == 0) { + return; + } + + /** + * @var \stdClass $attrs + */ + $attrs = $course->attrs; + $attrs->duration = $duration; + $course->update(['attrs' => $attrs]); + } + +} diff --git a/app/Services/Learning.php b/app/Services/Learning.php new file mode 100644 index 00000000..dfdffdbd --- /dev/null +++ b/app/Services/Learning.php @@ -0,0 +1,68 @@ +cache = $this->getDI()->get('cache'); + } + + public function save(LearningModel $learning, $timeout = 10) + { + // 秒和毫秒判断 + if ($timeout > 1000) { + $timeout = intval($timeout / 1000); + } + + $key = $this->getKey($learning->request_id); + + $item = $this->cache->get($key); + + $clientIp = $this->getClientIp(); + $clientType = $this->getClientType(); + + $content = [ + 'request_id' => $learning->request_id, + 'course_id' => $learning->course_id, + 'chapter_id' => $learning->chapter_id, + 'user_id' => $learning->user_id, + 'position' => $learning->position, + 'client_ip' => $clientIp, + 'client_type' => $clientType, + ]; + + if (!$item) { + + $content['duration'] = $timeout; + + $this->cache->save($key, $content, $this->lifetime); + + } else { + + $content['duration'] = $item->duration + $timeout; + + $this->cache->save($key, $content, $this->lifetime); + } + } + + public function getKey($requestId) + { + return "learning:{$requestId}"; + } + +} diff --git a/app/Services/Live.php b/app/Services/Live.php new file mode 100644 index 00000000..9c1b2aed --- /dev/null +++ b/app/Services/Live.php @@ -0,0 +1,103 @@ +config = $this->getSectionConfig('live'); + } + + /** + * 获取推流地址 + * + * @param string $streamName + * @return string + */ + function getPushUrl($streamName) + { + $authEnabled = $this->config->push_auth_enabled; + $authKey = $this->config->push_auth_key; + $expireTime = $this->config->push_auth_delta + time(); + $domain = $this->config->push_domain; + $appName = 'live'; + + $authParams = $this->getAuthParams($streamName, $authKey, $expireTime); + + $pushUrl = "rtmp://{$domain}/{$appName}/{$streamName}"; + $pushUrl .= $authEnabled ? "?{$authParams}" : ''; + + return $pushUrl; + } + + /** + * 获取拉流地址 + * + * @param string $streamName + * @param string $format + * @return mixed + */ + public function getPullUrls($streamName, $format) + { + $extension = ($format == 'hls') ? 'm3u8' : $format; + + $extensions = ['flv', 'm3u8']; + + if (!in_array($extension, $extensions)) return; + + $appName = 'live'; + + $protocol = $this->config->pull_protocol; + $domain = $this->config->pull_domain; + $authEnabled = $this->config->pull_auth_enabled; + $transEnabled = $this->config->pull_trans_enabled; + $authKey = $this->config->pull_auth_key; + $expireTime = $this->config->pull_auth_delta + time(); + + $urls = []; + + if ($transEnabled) { + foreach (['fd', 'sd', 'hd', 'od'] as $rateName) { + $realStreamName = ($rateName == 'od') ? $streamName : "{$streamName}_{$rateName}"; + $authParams = $this->getAuthParams($realStreamName, $authKey, $expireTime); + $url = "{$protocol}://{$domain}/{$appName}/{$realStreamName}.{$extension}"; + $url .= $authEnabled ? "?{$authParams}" : ''; + $urls[$rateName] = $url; + } + } else { + $authParams = $this->getAuthParams($streamName, $authKey, $expireTime); + $url = "{$protocol}://{$domain}/{$appName}/{$streamName}.{$extension}"; + $url .= $authEnabled ? "?{$authParams}" : ''; + $urls['od'] = $url; + } + + return $urls; + } + + /** + * 获取鉴权参数 + * + * @param string $streamName + * @param string $authKey + * @param integer $expireTime + * @return string + */ + protected function getAuthParams($streamName, $authKey, $expireTime) + { + $txTime = strtoupper(base_convert($expireTime, 10, 16)); + + $txSecret = md5($authKey . $streamName . $txTime); + + $authParams = http_build_query([ + 'txSecret' => $txSecret, + 'txTime' => $txTime + ]); + + return $authParams; + } + +} diff --git a/app/Services/Mailer.php b/app/Services/Mailer.php new file mode 100644 index 00000000..3f1b8139 --- /dev/null +++ b/app/Services/Mailer.php @@ -0,0 +1,66 @@ +manager = $this->getManager(); + } + + /** + * 发送测试邮件 + * + * @param string $email + * @return mixed + */ + public function sendTestMail($email) + { + $message = $this->manager->createMessage(); + + $result = $message->to($email) + ->subject('这是一封测试邮件') + ->content('这是一封测试邮件') + ->send(); + + return $result; + } + + /** + * 获取Manager + */ + protected function getManager() + { + $opt = $this->getSectionConfig('mailer'); + + $config = [ + 'driver' => 'smtp', + 'host' => $opt->smtp_host, + 'port' => $opt->smtp_port, + 'from' => [ + 'email' => $opt->smtp_from_email, + 'name' => $opt->smtp_from_name, + ], + ]; + + if ($opt->smtp_encryption) { + $config['encryption'] = $opt->smtp_encryption; + } + + if ($opt->smtp_authentication) { + $config['username'] = $opt->smtp_username; + $config['password'] = $opt->smtp_password; + } + + $manager = new MailerManager($config); + + return $manager; + } + +} diff --git a/app/Services/Order.php b/app/Services/Order.php new file mode 100644 index 00000000..98c3ecb9 --- /dev/null +++ b/app/Services/Order.php @@ -0,0 +1,179 @@ +getDI()->get('auth')->getAuthUser(); + + $expiry = $course->expiry; + $expireTime = strtotime("+{$expiry} days"); + + $itemInfo = [ + 'course' => [ + 'id' => $course->id, + 'title' => $course->title, + 'cover' => $course->cover, + 'expiry' => $course->expiry, + 'market_price' => $course->market_price, + 'vip_price' => $course->vip_price, + 'expire_time' => $expireTime, + ] + ]; + + $amount = $authUser->vip ? $course->vip_price : $course->market_price; + + $order = new OrderModel(); + + $order->user_id = $authUser->id; + $order->item_id = $course->id; + $order->item_type = OrderModel::TYPE_COURSE; + $order->item_info = $itemInfo; + $order->amount = $amount; + $order->subject = "课程 - {$course->title}"; + $order->create(); + + return $order; + } + + /** + * 创建套餐订单 + * + * @param PackageModel $package + * @return OrderModel $order + */ + public function createPackageOrder(PackageModel $package) + { + $authUser = $this->getDI()->get('auth')->getAuthUser(); + + $packageRepo = new PackageRepo(); + + $courses = $packageRepo->findCourses($package->id); + + $itemInfo = []; + + $itemInfo['package'] = [ + 'id' => $package->id, + 'title' => $package->title, + 'market_price' => $package->market_price, + 'vip_price' => $package->vip_price, + ]; + + foreach ($courses as $course) { + $expiry = $course->expiry; + $expireTime = strtotime("+{$expiry} days"); + $itemInfo['courses'][] = [ + 'id' => $course->id, + 'title' => $course->title, + 'cover' => $course->cover, + 'expiry' => $expiry, + 'market_price' => $course->market_price, + 'vip_price' => $course->vip_price, + 'expire_time' => $expireTime, + ]; + } + + $amount = $authUser->vip ? $package->vip_price : $package->market_price; + + $order = new OrderModel(); + + $order->user_id = $authUser->id; + $order->item_id = $package->id; + $order->item_type = OrderModel::TYPE_PACKAGE; + $order->item_info = $itemInfo; + $order->amount = $amount; + $order->subject = "套餐 - {$package->title}"; + $order->create(); + + return $order; + } + + /** + * 创建赞赏订单 + * + * @param CourseModel $course + * @param float $amount + * @return OrderModel $order + */ + public function createRewardOrder(CourseModel $course, $amount) + { + $authUser = $this->getDI()->get('auth')->getAuthUser(); + + $itemInfo = [ + 'course' => [ + 'id' => $course->id, + 'title' => $course->title, + 'cover' => $course->cover, + ] + ]; + + $order = new OrderModel(); + + $order->user_id = $authUser->id; + $order->item_id = $course->id; + $order->item_type = OrderModel::TYPE_REWARD; + $order->item_info = $itemInfo; + $order->amount = $amount; + $order->subject = "赞赏 - {$course->title}"; + $order->create(); + + return $order; + } + + /** + * 创建会员服务订单 + * + * @param string $duration + * @return OrderModel + */ + public function createVipOrder($duration) + { + $authUser = $this->getDI()->get('auth')->getAuthUser(); + + $vipInfo = new VipInfo(); + + $vipItem = $vipInfo->getItem($duration); + + $itemInfo = [ + 'vip' => [ + 'duration' => $vipItem['duration'], + 'label' => $vipItem['label'], + 'price' => $vipItem['price'], + ] + ]; + + $order = new OrderModel(); + + $order->user_id = $authUser->id; + $order->item_type = OrderModel::TYPE_VIP; + $order->item_info = $itemInfo; + $order->amount = $vipItem['price']; + $order->subject = "会员 - 会员服务({$vipItem['label']})"; + $order->create(); + + return $order; + } + + /** + * 获取订单来源 + */ + protected function getSource() + { + + } + +} diff --git a/app/Services/Refund.php b/app/Services/Refund.php new file mode 100644 index 00000000..b32ff5eb --- /dev/null +++ b/app/Services/Refund.php @@ -0,0 +1,128 @@ +status != OrderModel::STATUS_FINISHED) { + //return $amount; + } + + if ($order->item_type == OrderModel::TYPE_COURSE) { + $amount = $this->getCourseRefundAmount($order); + } elseif ($order->item_type == OrderModel::TYPE_PACKAGE) { + $amount = $this->getPackageRefundAmount($order); + } + + return $amount; + } + + protected function getCourseRefundAmount(OrderModel $order) + { + $course = $order->item_info->course; + + $courseId = $order->item_id; + $userId = $order->user_id; + $amount = $order->amount; + $expireTime = $course->expire_time; + + $refundAmount = 0.00; + + if ($expireTime > time()) { + $percent = $this->getCourseRefundPercent($courseId, $userId); + $refundAmount = $amount * $percent; + } + + return $refundAmount; + } + + protected function getPackageRefundAmount(OrderModel $order) + { + $userId = $order->user_id; + $courses = $order->item_info->courses; + $amount = $order->amount; + + $totalMarketPrice = 0.00; + + foreach ($courses as $course) { + $totalMarketPrice += $course->market_price; + } + + $totalRefundAmount = 0.00; + + /** + * 按照占比方式计算退款 + */ + foreach ($courses as $course) { + if ($course->expire_time > time()) { + $pricePercent = round($course->market_price / $totalMarketPrice, 4); + $refundPercent = $this->getCourseRefundPercent($course->id, $userId); + $refundAmount = round($amount * $pricePercent * $refundPercent, 2); + $totalRefundAmount += $refundAmount; + } + } + + return $totalRefundAmount; + } + + protected function getCourseRefundPercent($courseId, $userId) + { + $courseRepo = new CourseRepo(); + + $userLessons = $courseRepo->findUserLessons($courseId, $userId); + + if ($userLessons->count() == 0) { + return 1.00; + } + + $course = $courseRepo->findById($courseId); + $lessons = $courseRepo->findLessons($courseId); + + $durationMapping = []; + + foreach ($lessons as $lesson) { + $durationMapping[$lesson->id] = $lesson->attrs->duration ?? null; + } + + $totalCount = $course->lesson_count; + $finishCount = 0; + + /** + * 消费规则 + * 1.点播观看时间大于时长30% + * 2.直播观看时间超过10分钟 + * 3.图文浏览即消费 + */ + foreach ($userLessons as $learning) { + $chapterId = $learning->chapter_id; + $duration = $durationMapping[$chapterId] ?? null; + if ($course->model == CourseModel::MODEL_VOD) { + if ($duration && $learning->duration > 0.3 * $duration) { + $finishCount++; + } + } elseif ($course->model == CourseModel::MODEL_LIVE) { + if ($learning->duration > 600) { + $finishCount++; + } + } elseif ($course->model == CourseModel::MODEL_LIVE) { + $finishCount++; + } + } + + $refundCount = $totalCount - $finishCount; + + $percent = round($refundCount / $totalCount, 4); + + return $percent; + } + +} diff --git a/app/Services/Service.php b/app/Services/Service.php new file mode 100644 index 00000000..0bee4d07 --- /dev/null +++ b/app/Services/Service.php @@ -0,0 +1,41 @@ +getInstance($channel); + } + + /** + * 获取某组配置项 + * + * @param string $section + * @return \stdClass + */ + public function getSectionConfig($section) + { + $configCache = new ConfigCache(); + + $result = $configCache->getSectionConfig($section); + + return $result; + } + +} diff --git a/app/Services/Smser.php b/app/Services/Smser.php new file mode 100644 index 00000000..ba9a4860 --- /dev/null +++ b/app/Services/Smser.php @@ -0,0 +1,110 @@ +config = $this->getSectionConfig('smser'); + $this->logger = $this->getLogger('smser'); + } + + public function register() + { + + } + + public function resetPassword() + { + + } + + public function buyCourse() + { + + } + + public function buyMember() + { + + } + + /** + * 发送测试短信 + * + * @param string $phone + * @return bool + */ + public function sendTestMessage($phone) + { + $sender = $this->createSingleSender(); + $templateId = $this->getTemplateId('register'); + $signature = $this->getSignature(); + + $params = [888888, 5]; + + try { + + $response = $sender->sendWithParam('86', $phone, $templateId, $params, $signature); + + $this->logger->debug('Send Test Message Response ' . $response); + + $content = json_decode($response, true); + + return $content['result'] == 0 ? true : false; + + } catch (\Exception $e) { + + $this->logger->error('Send Test Message Exception ' . kg_json_encode([ + 'code' => $e->getCode(), + 'message' => $e->getMessage(), + ])); + + return false; + } + } + + protected function createSingleSender() + { + $sender = new SmsSingleSender($this->config->app_id, $this->config->app_key); + + return $sender; + } + + protected function createMultiSender() + { + $sender = new SmsMultiSender($this->config->app_id, $this->config->app_key); + + return $sender; + } + + protected function getRandNumber() + { + $result = rand(100, 999) . rand(100, 999); + + return $result; + } + + protected function getTemplateId($code) + { + $template = json_decode($this->config->template); + + $templateId = $template->{$code}->id ?? null; + + return $templateId; + } + + protected function getSignature() + { + return $this->config->signature; + } + +} diff --git a/app/Services/Storage.php b/app/Services/Storage.php new file mode 100644 index 00000000..8945cc5a --- /dev/null +++ b/app/Services/Storage.php @@ -0,0 +1,281 @@ +config = $this->getSectionConfig('storage'); + $this->logger = $this->getLogger('storage'); + $this->client = $this->getCosClient(); + } + + /** + * 上传测试文件 + * + * @return bool + */ + public function uploadTestFile() + { + $key = 'hello_world.txt'; + $value = 'hello world'; + + $result = $this->putString($key, $value); + + return $result; + } + + /** + * 上传封面图片 + * + * @return mixed + */ + public function uploadCoverImage() + { + $result = $this->uploadImage('/img/cover/'); + + return $result; + } + + /** + * 上传内容图片 + * + * @return mixed + */ + public function uploadContentImage() + { + $path = $this->uploadImage('/img/content/'); + + if (!$path) return false; + + $contentImage = new ContentImageModel(); + + $contentImage->path = $path; + + $contentImage->create(); + + $result = $this->url->get([ + 'for' => 'home.content.img', + 'id' => $contentImage->id, + ]); + + return $result; + } + + /** + * 上传头像图片 + * + * @return mixed + */ + public function uploadAvatarImage() + { + $result = $this->uploadImage('/img/avatar/'); + + return $result; + } + + /** + * 上传图片 + * + * @param string $prefix + * @return mixed + */ + public function uploadImage($prefix = '') + { + $paths = []; + + if ($this->request->hasFiles(true)) { + + $files = $this->request->getUploadedFiles(true); + + foreach ($files as $file) { + $extension = $this->getFileExtension($file->getName()); + $keyName = $this->generateFileName($extension, $prefix); + $path = $this->putFile($keyName, $file->getTempName()); + if ($path) { + $paths[] = $path; + } + } + } + + $result = !empty($paths[0]) ? $paths[0] : false; + + return $result; + } + + /** + * 上传字符内容 + * + * @param string $key + * @param string $body + * @return mixed string|bool + */ + public function putString($key, $body) + { + $bucket = $this->config->bucket_name; + + try { + + $response = $this->client->upload($bucket, $key, $body); + + $result = $response['Location'] ? $key : false; + + return $result; + + } catch (\Exception $e) { + + $this->logger->error('Put String Exception ' . kg_json_encode([ + 'code' => $e->getCode(), + 'message' => $e->getMessage(), + ])); + + return false; + } + } + + /** + * 上传文件 + * + * @param string $key + * @param string $fileName + * @return mixed string|bool + */ + public function putFile($key, $fileName) + { + $bucket = $this->config->bucket_name; + + try { + + $body = fopen($fileName, 'rb'); + + $response = $this->client->upload($bucket, $key, $body); + + $result = $response['Location'] ? $key : false; + + return $result; + + } catch (\Exception $e) { + + $this->logger->error('Put File Exception ' . kg_json_encode([ + 'code' => $e->getCode(), + 'message' => $e->getMessage(), + ])); + + return false; + } + } + + /** + * 获取存储桶文件URL + * + * @param string $key + * @return string + */ + public function getBucketFileUrl($key) + { + $result = $this->getBucketBaseUrl() . $key; + + return $result; + } + + /** + * 获取数据万象图片URL + * @param string $key + * @param integer $width + * @param integer $height + * @return string + */ + public function getCiImageUrl($key, $width = 0, $height = 0) + { + $result = $this->getCiBaseUrl() . $key; + + return $result; + } + + /** + * 获取存储桶根URL + * + * @return string + */ + public function getBucketBaseUrl() + { + $protocol = $this->config->bucket_protocol; + $domain = $this->config->bucket_domain; + $result = $protocol . '://' . $domain; + + return $result; + } + + /** + * 获取数据万象根URL + * + * @return string + */ + public function getCiBaseUrl() + { + $protocol = $this->config->ci_protocol; + $domain = $this->config->ci_domain; + $result = $protocol . '://' . $domain; + + return $result; + } + + /** + * 生成文件存储名 + * + * @param string $extension + * @param string $prefix + * @return string + */ + protected function generateFileName($extension = '', $prefix = '') + { + $randName = date('YmdHis') . rand(1000, 9999); + + $result = $prefix . $randName . '.' . $extension; + + return $result; + } + + /** + * 获取文件扩展名 + * + * @param $fileName + * @return string + */ + protected function getFileExtension($fileName) + { + $result = pathinfo($fileName, PATHINFO_EXTENSION); + + return strtolower($result); + } + + /** + * 获取 CosClient + * + * @return CosClient + */ + public function getCosClient() + { + $secret = $this->getSectionConfig('secret'); + + $client = new CosClient([ + 'region' => $this->config->bucket_region, + 'schema' => 'https', + 'credentials' => [ + 'secretId' => $secret->secret_id, + 'secretKey' => $secret->secret_key, + ]]); + + return $client; + } + +} diff --git a/app/Services/Trade.php b/app/Services/Trade.php new file mode 100644 index 00000000..2c4e526b --- /dev/null +++ b/app/Services/Trade.php @@ -0,0 +1,85 @@ +findBySn($sn); + + $trade = new TradeModel(); + + $trade->user_id = $order->user_id; + $trade->order_sn = $order->sn; + $trade->subject = $order->subject; + $trade->amount = $order->amount; + $trade->channel = $channel; + + $trade->create(); + + return $trade; + } + + /** + * 获取交易二维码 + * + * @param $sn + * @param $channel + * @return bool|string|null + */ + public function getQrCode($sn, $channel) + { + $trade = $this->createTrade($sn, $channel); + + $code = null; + + if ($channel == TradeModel::CHANNEL_ALIPAY) { + $alipay = new Alipay(); + $code = $alipay->getQrCode([ + 'out_trade_no' => $trade->sn, + 'total_amount' => $trade->amount, + 'subject' => $trade->subject, + ]); + } elseif ($channel == TradeModel::CHANNEL_WXPAY) { + $wxpay = new Wxpay(); + $code = $wxpay->getQrCode([ + 'out_trade_no' => $trade->sn, + 'total_fee' => 100 * $trade->amount, + 'body' => $trade->subject, + ]); + } + + return $code; + } + + /** + * 获取交易状态 + * + * @param string $sn + * @return string + */ + public function getStatus($sn) + { + $tradeRepo = new TradeRepo(); + + $trade = $tradeRepo->findBySn($sn); + + return $trade->status; + } + +} diff --git a/app/Services/VipInfo.php b/app/Services/VipInfo.php new file mode 100644 index 00000000..6fd54899 --- /dev/null +++ b/app/Services/VipInfo.php @@ -0,0 +1,67 @@ +config = $this->getSectionConfig('vip'); + } + + /** + * 获取条目 + * + * @param string $duration + * @return array + */ + public function getItem($duration) + { + $items = $this->getItems(); + + foreach ($items as $item) { + if ($item['duration'] == $duration) { + return $item; + } + } + + return $items[0]; + } + + /** + * 获取条目列表 + * + * @return array + */ + public function getItems() + { + $items = [ + [ + 'duration' => 'one_month', + 'label' => '1个月', + 'price' => $this->config->one_month, + ], + [ + 'duration' => 'three_month', + 'label' => '3个月', + 'price' => $this->config->three_month, + ], + [ + 'duration' => 'six_month', + 'label' => '6个月', + 'price' => $this->config->six_month, + ], + [ + 'duration' => 'twelve_month', + 'label' => '12个月', + 'price' => $this->config->twelve_month, + ], + ]; + + return $items; + } + +} diff --git a/app/Services/Vod.php b/app/Services/Vod.php new file mode 100644 index 00000000..76834772 --- /dev/null +++ b/app/Services/Vod.php @@ -0,0 +1,595 @@ +config = $this->getSectionConfig('vod'); + $this->logger = $this->getLogger('vod'); + $this->client = $this->getVodClient(); + } + + /** + * 配置测试 + * + * @return bool + */ + public function test() + { + try { + + $request = new DescribeAudioTrackTemplatesRequest(); + + $params = '{}'; + + $request->fromJsonString($params); + + $response = $this->client->DescribeAudioTrackTemplates($request); + + $this->logger->debug('Describe Audio Track Templates Response ' . $response->toJsonString()); + + $result = $response->TotalCount > 0 ? true : false; + + return $result; + + } catch (TencentCloudSDKException $e) { + + $this->logger->error('Describe Audio Track Templates Exception ', kg_json_encode([ + 'code' => $e->getErrorCode(), + 'message' => $e->getMessage(), + 'requestId' => $e->getRequestId(), + ])); + + return false; + } + } + + /** + * 获取上传签名 + * + * @return string + */ + public function getUploadSignature() + { + $secret = $this->getSectionConfig('secret'); + + $secretId = $secret->secret_id; + $secretKey = $secret->secret_key; + + $params = [ + 'secretId' => $secretId, + 'currentTimeStamp' => time(), + 'expireTime' => time() + 86400, + 'random' => rand(1000, 9999), + ]; + + $original = http_build_query($params); + $hash = hash_hmac('SHA1', $original, $secretKey, true); + $signature = base64_encode($hash . $original); + + return $signature; + } + + /** + * 获取播放地址 + * + * @param string $playUrl + * @return string + */ + public function getPlayUrl($playUrl) + { + if ($this->config->key_anti_enabled == 0) { + return $playUrl; + } + + $key = $this->config->key_anti_key; + $expiry = $this->config->key_anti_expiry ?: 10800; + + $path = parse_url($playUrl, PHP_URL_PATH); + $pos = strrpos($path, '/'); + $fileName = substr($path, $pos + 1); + $dirName = str_replace($fileName, '', $path); + + $expiredTime = base_convert(time() + $expiry, 10, 16); // 过期时间(十六进制) + $tryTime = 0; // 试看时间,0不限制 + $ipLimit = 0; // ip数量限制,0不限制 + $random = rand(100000, 999999); // 随机数 + + /** + * 腾讯坑爹的参数类型和文档,先凑合吧 + * 不限制试看 => 必须exper=0(不能设置为空) + * 不限制IP => 必须rlimit为空(不能设置为0),暂不可用 + */ + $myTryTime = $tryTime >= 0 ? $tryTime : 0; + $myIpLimit = $ipLimit > 0 ? $ipLimit : ''; + $sign = $key . $dirName . $expiredTime . $myTryTime . $myIpLimit . $random; // 签名串 + + $query = []; + + $query['t'] = $expiredTime; + + if ($tryTime >= 0) { + $query['exper'] = $tryTime; + } + + if ($ipLimit > 0) { + $query['rlimit'] = $ipLimit; + } + + $query['us'] = $random; + $query['sign'] = md5($sign); + + $result = $playUrl . '?' . http_build_query($query); + + return $result; + } + + /** + * 拉取事件 + * + * @return bool|array + */ + public function pullEvents() + { + try { + + $request = new PullEventsRequest(); + + $params = '{}'; + + $request->fromJsonString($params); + + $this->logger->debug('Pull Events Request ' . $params); + + $response = $this->client->PullEvents($request); + + $this->logger->debug('Pull Events Response ' . $response->toJsonString()); + + $result = json_decode($response->toJsonString(), true); + + return $result['EventSet'] ?? []; + + } catch (TencentCloudSDKException $e) { + + $this->logger->error('Pull Events Exception ' . kg_json_encode([ + 'code' => $e->getErrorCode(), + 'message' => $e->getMessage(), + 'requestId' => $e->getRequestId(), + ])); + + return false; + } + } + + /** + * 确认事件 + * + * @param array $eventHandles + * @return bool|mixed + */ + public function confirmEvents($eventHandles) + { + try { + + $request = new ConfirmEventsRequest(); + + $params = json_encode(['EventHandles' => $eventHandles]); + + $request->fromJsonString($params); + + $this->logger->debug('Confirm Events Request ' . $params); + + $response = $this->client->ConfirmEvents($request); + + $this->logger->debug('Confirm Events Response ' . $response->toJsonString()); + + $result = json_decode($response->toJsonString(), true); + + return $result; + + } catch (TencentCloudSDKException $e) { + + $this->logger->error('Confirm Events Exception ' . kg_json_encode([ + 'code' => $e->getErrorCode(), + 'message' => $e->getMessage(), + 'requestId' => $e->getRequestId(), + ])); + + return false; + } + } + + /** + * 获取媒体信息 + * + * @param string $fileId + * @return array|bool + */ + public function getMediaInfo($fileId) + { + try { + + $request = new DescribeMediaInfosRequest(); + + $fileIds = [$fileId]; + + $params = json_encode(['FileIds' => $fileIds]); + + $request->fromJsonString($params); + + $this->logger->debug('Describe Media Info Request ' . $params); + + $response = $this->client->DescribeMediaInfos($request); + + $this->logger->debug('Describe Media Info Response ' . $response->toJsonString()); + + $result = json_decode($response->toJsonString(), true); + + if (!isset($result['MediaInfoSet'][0]['MetaData'])) { + return false; + } + + return $result; + + } catch (TencentCloudSDKException $e) { + + $this->logger->error('Describe Media Info Exception ' . kg_json_encode([ + 'code' => $e->getErrorCode(), + 'message' => $e->getMessage(), + 'requestId' => $e->getRequestId(), + ])); + + return false; + } + } + + /** + * 获取任务信息 + * + * @param string $taskId + * @return array|bool + */ + public function getTaskInfo($taskId) + { + try { + + $request = new DescribeTaskDetailRequest(); + + $params = json_encode(['TaskId' => $taskId]); + + $request->fromJsonString($params); + + $this->logger->debug('Describe Task Detail Request ' . $params); + + $response = $this->client->DescribeTaskDetail($request); + + $this->logger->debug('Describe Task Detail Response ' . $response->toJsonString()); + + $result = json_decode($response->toJsonString(), true); + + if (!isset($result['TaskType'])) { + return false; + } + + return $result; + + } catch (TencentCloudSDKException $e) { + + $this->logger->error('Describe Task Detail Exception ' . kg_json_encode([ + 'code' => $e->getErrorCode(), + 'message' => $e->getMessage(), + 'requestId' => $e->getRequestId(), + ])); + + return false; + } + } + + /** + * 创建视频转码任务 + * + * @param string $fileId + * @return string|bool + */ + public function createTransVideoTask($fileId) + { + $originVideoInfo = $this->getOriginVideoInfo($fileId); + + if (!$originVideoInfo) return false; + + $videoTransTemplates = $this->getVideoTransTemplates(); + + $watermarkTemplate = $this->getWatermarkTemplate(); + + $transCodeTaskSet = []; + + foreach ($videoTransTemplates as $key => $template) { + if ($originVideoInfo['width'] >= $template['width'] || + $originVideoInfo['bit_rate'] >= 1000 * $template['bit_rate'] + ) { + $item = ['Definition' => $key]; + if ($watermarkTemplate) { + $item['WatermarkSet'][] = ['Definition' => $watermarkTemplate]; + } + $transCodeTaskSet[] = $item; + } + } + + /** + * 无匹配转码模板,取第一项转码 + */ + if (empty($transCodeTaskSet)) { + $keys = array_keys($videoTransTemplates); + $item = ['Definition' => $keys[0]]; + if ($watermarkTemplate) { + $item['WatermarkSet'][] = ['Definition' => $watermarkTemplate]; + } + $transCodeTaskSet[] = $item; + } + + $params = json_encode([ + 'FileId' => $fileId, + 'MediaProcessTask' => [ + 'TranscodeTaskSet' => $transCodeTaskSet, + ], + ]); + + try { + + $request = new ProcessMediaRequest(); + + $request->fromJsonString($params); + + $this->logger->debug('Process Media Request ' . $params); + + $response = $this->client->ProcessMedia($request); + + $this->logger->debug('Process Media Response ' . $response->toJsonString()); + + $result = $response->TaskId ?: false; + + return $result; + + } catch (TencentCloudSDKException $e) { + + $this->logger->error('Process Media Exception ' . kg_json_encode([ + 'code' => $e->getErrorCode(), + 'message' => $e->getMessage(), + 'requestId' => $e->getRequestId(), + ])); + + return false; + } + } + + /** + * 创建音频转码任务 + * + * @param string $fileId + * @return string|bool + */ + public function createTransAudioTask($fileId) + { + $originAudioInfo = $this->getOriginAudioInfo($fileId); + + if (!$originAudioInfo) return false; + + $audioTransTemplates = $this->getAudioTransTemplates(); + + $transCodeTaskSet = []; + + foreach ($audioTransTemplates as $key => $template) { + if ($originAudioInfo['bit_rate'] >= 1000 * $template['bit_rate']) { + $item = ['Definition' => $key]; + $transCodeTaskSet[] = $item; + } + } + + /** + * 无匹配转码模板,取第一项转码 + */ + if (empty($transCodeTaskSet)) { + $keys = array_keys($audioTransTemplates); + $item = ['Definition' => $keys[0]]; + $transCodeTaskSet[] = $item; + } + + $params = json_encode([ + 'FileId' => $fileId, + 'MediaProcessTask' => [ + 'TranscodeTaskSet' => $transCodeTaskSet, + ], + ]); + + try { + + $request = new ProcessMediaRequest(); + + $request->fromJsonString($params); + + $this->logger->debug('Process Media Request ' . $params); + + $response = $this->client->ProcessMedia($request); + + $this->logger->debug('Process Media Response ' . $response->toJsonString()); + + $result = $response->TaskId ?: false; + + return $result; + + } catch (TencentCloudSDKException $e) { + + $this->logger->error('Process Media Exception ' . kg_json_encode([ + 'code' => $e->getErrorCode(), + 'message' => $e->getMessage(), + 'requestId' => $e->getRequestId(), + ])); + + return false; + } + } + + /** + * 获取原始视频信息 + * + * @param string $fileId + * @return array|bool + */ + public function getOriginVideoInfo($fileId) + { + $response = $this->getMediaInfo($fileId); + + if (!$response) return false; + + $metaData = $response['MediaInfoSet'][0]['MetaData']; + + $result = [ + 'bit_rate' => $metaData['Bitrate'], + 'size' => $metaData['Size'], + 'width' => $metaData['Width'], + 'height' => $metaData['Height'], + 'duration' => $metaData['Duration'], + ]; + + return $result; + } + + /** + * 获取原始音频信息 + * + * @param string $fileId + * @return array|bool + */ + public function getOriginAudioInfo($fileId) + { + $response = $this->getMediaInfo($fileId); + + if (!$response) return false; + + $metaData = $response['MediaInfoSet'][0]['MetaData']; + + $result = [ + 'bit_rate' => $metaData['Bitrate'], + 'size' => $metaData['Size'], + 'width' => $metaData['Width'], + 'height' => $metaData['Height'], + 'duration' => $metaData['Duration'], + ]; + + return $result; + } + + /** + * 获取水印模板 + * + * @return mixed + */ + public function getWatermarkTemplate() + { + $result = null; + + if ($this->config->watermark_enabled && $this->config->watermark_template > 0) { + $result = (int)$this->config->watermark_template; + } + + return $result; + } + + /*** + * 获取视频转码模板 + * + * @return array + */ + public function getVideoTransTemplates() + { + $hls = [ + 210 => ['width' => 480, 'bit_rate' => 256, 'frame_rate' => 24], + 220 => ['width' => 640, 'bit_rate' => 512, 'frame_rate' => 24], + 230 => ['width' => 1280, 'bit_rate' => 1024, 'frame_rate' => 25], + ]; + + $mp4 = [ + 10 => ['width' => 480, 'bit_rate' => 256, 'frame_rate' => 24], + 20 => ['width' => 640, 'bit_rate' => 512, 'frame_rate' => 24], + 30 => ['width' => 1280, 'bit_rate' => 1024, 'frame_rate' => 25], + ]; + + $format = $this->config->video_format; + + $result = $format == 'hls' ? $hls : $mp4; + + return $result; + } + + /** + * 获取音频转码模板 + * + * @return array + */ + public function getAudioTransTemplates() + { + $m4a = [ + 1110 => ['bit_rate' => 48, 'sample_rate' => 44100], + 1120 => ['bit_rate' => 96, 'sample_rate' => 44100], + ]; + + $mp3 = [ + 1010 => ['bit_rate' => 128, 'sample_rate' => 44100], + ]; + + $result = $this->config->audio_format == 'm4a' ? $m4a : $mp3; + + return $result; + } + + /** + * 获取VodClient + * + * @return VodClient + */ + public function getVodClient() + { + $secret = $this->getSectionConfig('secret'); + + $secretId = $secret->secret_id; + $secretKey = $secret->secret_key; + + $region = $this->config->storage_type == 'fixed' ? $this->config->storage_region : ''; + + $credential = new Credential($secretId, $secretKey); + + $httpProfile = new HttpProfile(); + + $httpProfile->setEndpoint(self::END_POINT); + + $clientProfile = new ClientProfile(); + + $clientProfile->setHttpProfile($httpProfile); + + $client = new VodClient($credential, $region, $clientProfile); + + return $client; + } + +} diff --git a/app/Services/Wxpay.php b/app/Services/Wxpay.php new file mode 100644 index 00000000..5e4b39f9 --- /dev/null +++ b/app/Services/Wxpay.php @@ -0,0 +1,127 @@ +config = $this->getSectionConfig('payment.wxpay'); + $this->gateway = $this->getGateway(); + } + + /** + * 获取二维码内容 + * + * @param array $order + * @return bool|string + */ + public function qrcode($order) + { + try { + + $response = $this->gateway->scan($order); + + $result = $response->code_url ?? false; + + return $result; + + } catch (\Exception $e) { + + Log::error('Wxpay Scan Error', [ + 'code' => $e->getCode(), + 'message' => $e->getMessage(), + ]); + + return false; + } + } + + /** + * 处理异步通知 + */ + public function notify() + { + try { + + $data = $this->gateway->verify(); + + Log::debug('Wxpay Verify Data', $data->all()); + + } catch (\Exception $e) { + + Log::error('Wxpay Verify Error', [ + 'code' => $e->getCode(), + 'message' => $e->getMessage(), + ]); + + return false; + } + + if ($data->result_code != 'SUCCESS') { + return false; + } + + if ($data->mch_id != $this->config->mch_id) { + return false; + } + + $tradeRepo = new TradeRepo(); + + $trade = $tradeRepo->findBySn($data->out_trade_no); + + if (!$trade) { + return false; + } + + if ($data->total_fee != 100 * $trade->amount) { + return false; + } + + if ($trade->status != TradeModel::STATUS_PENDING) { + return false; + } + + $trade->channel_sn = $data->transaction_id; + + $this->eventsManager->fire('payment:afterPay', $this, $trade); + + return $this->gateway->success(); + } + + /** + * 获取 Wxpay Gateway + * + * @return \Yansongda\Pay\Gateways\Wxpay + */ + public function getGateway() + { + $config = [ + 'app_id' => $this->config->app_id, + 'mch_id' => $this->config->mch_id, + 'key' => $this->config->key, + 'notify_url' => $this->config->notify_url, + 'log' => [ + 'file' => log_path('wxpay.log'), + 'level' => 'debug', + 'type' => 'daily', + 'max_file' => 30, + ], + 'mode' => 'dev', + ]; + + $gateway = Pay::wxpay($config); + + return $gateway; + } + +} diff --git a/app/Traits/Ajax.php b/app/Traits/Ajax.php new file mode 100644 index 00000000..a86fab82 --- /dev/null +++ b/app/Traits/Ajax.php @@ -0,0 +1,38 @@ +response->setStatusCode(200); + $this->response->setJsonContent($content); + + return $this->response; + } + + public function ajaxError($content = []) + { + $content['code'] = $content['code'] ?? 1; + $content['msg'] = $content['msg'] ?? $this->getErrorMessage($content['code']); + + $this->response->setJsonContent($content); + + return $this->response; + } + + public function getErrorMessage($code) + { + $errors = require config_path() . '/errors.php'; + + $message = $errors[$code] ?? $code; + + return $message; + } + +} \ No newline at end of file diff --git a/app/Traits/Client.php b/app/Traits/Client.php new file mode 100644 index 00000000..44a802e9 --- /dev/null +++ b/app/Traits/Client.php @@ -0,0 +1,30 @@ +request->getClientAddress(); + } + + public function getClientType() + { + $userAgent = $this->request->getServer('HTTP_USER_AGENT'); + + $result = new BrowserParser($userAgent); + + $clientType = 'desktop'; + + if ($result->isMobile()) { + $clientType = 'mobile'; + } + + return $clientType; + } + +} \ No newline at end of file diff --git a/app/Traits/Security.php b/app/Traits/Security.php new file mode 100644 index 00000000..248656ea --- /dev/null +++ b/app/Traits/Security.php @@ -0,0 +1,38 @@ +request->getHeader('X-Csrf-Token-Key'); + $tokenValue = $this->request->getHeader('X-Csrf-Token-Value'); + $checkToken = $this->security->checkToken($tokenKey, $tokenValue); + + return $checkToken; + } + + public function checkHttpReferer() + { + $httpHost = parse_url($this->request->getHttpReferer(), PHP_URL_HOST); + + $checkHost = $httpHost == $this->request->getHttpHost(); + + return $checkHost; + } + + public function notSafeRequest() + { + $method = $this->request->getMethod(); + + $whitelist = ['post', 'put', 'patch', 'delete']; + + $result = in_array(strtolower($method), $whitelist); + + return $result; + + } + +} \ No newline at end of file diff --git a/app/Transformers/ChapterList.php b/app/Transformers/ChapterList.php new file mode 100644 index 00000000..81a5c5cb --- /dev/null +++ b/app/Transformers/ChapterList.php @@ -0,0 +1,51 @@ + $chapter) { + $chapters[$key]['finished'] = isset($status[$chapter['id']]) ? $status[$chapter['id']] : 0; + } + + return $chapters; + } + + public function handleTree($chapters) + { + $list = []; + + foreach ($chapters as $chapter) { + if ($chapter['parent_id'] == 0) { + $list[$chapter['id']] = $chapter; + $list[$chapter['id']]['child'] = []; + } else { + $list[$chapter['parent_id']]['child'][] = $chapter; + } + } + + usort($list, function($a, $b) { + return $a['priority'] > $b['priority']; + }); + + foreach ($list as $key => $value) { + usort($list[$key]['child'], function($a, $b) { + return $a['priority'] > $b['priority']; + }); + } + + return $list; + } + +} diff --git a/app/Transformers/ChapterUserList.php b/app/Transformers/ChapterUserList.php new file mode 100644 index 00000000..a87e59ce --- /dev/null +++ b/app/Transformers/ChapterUserList.php @@ -0,0 +1,67 @@ +getChapters($relations); + + foreach ($relations as $key => $value) { + $relations[$key]['course'] = $courses[$value['chapter_id']]; + } + + return $relations; + } + + public function handleUsers($relations) + { + $users = $this->getUsers($relations); + + foreach ($relations as $key => $value) { + $relations[$key]['user'] = $users[$value['user_id']]; + } + + return $relations; + } + + protected function getChapters($relations) + { + $ids = kg_array_column($relations, 'chapter_id'); + + $courseRepo = new ChapterRepo(); + + $courses = $courseRepo->findByIds($ids, ['id', 'title'])->toArray(); + + $result = []; + + foreach ($courses as $course) { + $result[$course['id']] = $course; + } + + return $result; + } + + protected function getUsers($relations) + { + $ids = kg_array_column($relations, 'user_id'); + + $userRepo = new UserRepo(); + + $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar'])->toArray(); + + $result = []; + + foreach ($users as $user) { + $result[$user['id']] = $user; + } + + return $result; + } + +} diff --git a/app/Transformers/CommentList.php b/app/Transformers/CommentList.php new file mode 100644 index 00000000..8ba10f4f --- /dev/null +++ b/app/Transformers/CommentList.php @@ -0,0 +1,100 @@ +getCourses($comments); + + foreach ($comments as $key => $comment) { + $comments[$key]['course'] = $courses[$comment['course_id']]; + } + + return $comments; + } + + public function handleChapters($comments) + { + $chapters = $this->getChapters($comments); + + foreach ($comments as $key => $comment) { + $comments[$key]['chapter'] = $chapters[$comment['chapter_id']]; + } + + return $comments; + } + + public function handleUsers($comments) + { + $users = $this->getUsers($comments); + + foreach ($comments as $key => $comment) { + $comments[$key]['user'] = $users[$comment['user_id']]; + $comments[$key]['to_user'] = $comment['to_user_id'] > 0 ? $users[$comment['to_user_id']] : []; + } + + return $comments; + } + + protected function getCourses($comments) + { + $ids = kg_array_column($comments, 'course_id'); + + $courseRepo = new CourseRepo(); + + $courses = $courseRepo->findByIds($ids, ['id', 'title'])->toArray(); + + $result = []; + + foreach ($courses as $course) { + $result[$course['id']] = $course; + } + + return $result; + } + + protected function getChapters($comments) + { + $ids = kg_array_column($comments, 'chapter_id'); + + $chapterRepo = new ChapterRepo(); + + $chapters = $chapterRepo->findByIds($ids, ['id', 'title'])->toArray(); + + $result = []; + + foreach ($chapters as $chapter) { + $result[$chapter['id']] = $chapter; + } + + return $result; + } + + protected function getUsers($comments) + { + $userIds = kg_array_column($comments, 'user_id'); + $toUserIds = kg_array_column($comments, 'to_user_id'); + + $ids = array_merge($userIds, $toUserIds); + + $userRepo = new UserRepo(); + + $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar'])->toArray(); + + $result = []; + + foreach ($users as $user) { + $result[$user['id']] = $user; + } + + return $result; + } + +} diff --git a/app/Transformers/CourseFavoriteList.php b/app/Transformers/CourseFavoriteList.php new file mode 100644 index 00000000..3833a7da --- /dev/null +++ b/app/Transformers/CourseFavoriteList.php @@ -0,0 +1,67 @@ +getCourses($relations); + + foreach ($relations as $key => $value) { + $relations[$key]['course'] = $courses[$value['course_id']]; + } + + return $relations; + } + + public function handleUsers($relations) + { + $users = $this->getUsers($relations); + + foreach ($relations as $key => $value) { + $relations[$key]['user'] = $users[$value['user_id']]; + } + + return $relations; + } + + protected function getCourses($relations) + { + $ids = kg_array_column($relations, 'course_id'); + + $courseRepo = new CourseRepo(); + + $courses = $courseRepo->findByIds($ids, ['id', 'title'])->toArray(); + + $result = []; + + foreach ($courses as $course) { + $result[$course['id']] = $course; + } + + return $result; + } + + protected function getUsers($relations) + { + $ids = kg_array_column($relations, 'user_id'); + + $userRepo = new UserRepo(); + + $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar'])->toArray(); + + $result = []; + + foreach ($users as $user) { + $result[$user['id']] = $user; + } + + return $result; + } + +} diff --git a/app/Transformers/CourseList.php b/app/Transformers/CourseList.php new file mode 100644 index 00000000..801f565a --- /dev/null +++ b/app/Transformers/CourseList.php @@ -0,0 +1,92 @@ +getCategories($courses); + + foreach ($courses as $key => $course) { + $courses[$key]['categories'] = $categories[$course['id']] ?? []; + } + + return $courses; + } + + public function handleUsers($courses) + { + $users = $this->getUsers($courses); + + foreach ($courses as $key => $course) { + $courses[$key]['user'] = $users[$course['user_id']]; + } + + return $courses; + } + + public function handleCourses($courses) + { + foreach ($courses as $key => $course) { + unset($courses[$key]['details']); + } + + return $courses; + } + + protected function getCategories($courses) + { + $categoryRepo = new CategoryRepo(); + + $categories = $categoryRepo->findAll(); + + $mapping = []; + + foreach ($categories as $category) { + $mapping[$category->id] = [ + 'id' => $category->id, + 'name' => $category->name, + ]; + } + + $courseIds = kg_array_column($courses, 'id'); + + $courseCategoryRepo = new CourseCategoryRepo(); + + $relations = $courseCategoryRepo->findByCourseIds($courseIds); + + $result = []; + + foreach ($relations as $relation) { + $categoryId = $relation->category_id; + $courseId = $relation->course_id; + $result[$courseId][] = $mapping[$categoryId] ?? []; + } + + return $result; + } + + protected function getUsers($courses) + { + $ids = kg_array_column($courses, 'user_id'); + + $userRepo = new UserRepo(); + + $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar'])->toArray(); + + $result = []; + + foreach ($users as $user) { + $result[$user['id']] = $user; + } + + return $result; + } + +} diff --git a/app/Transformers/CourseUserList.php b/app/Transformers/CourseUserList.php new file mode 100644 index 00000000..d1edc302 --- /dev/null +++ b/app/Transformers/CourseUserList.php @@ -0,0 +1,67 @@ +getCourses($relations); + + foreach ($relations as $key => $value) { + $relations[$key]['course'] = $courses[$value['course_id']]; + } + + return $relations; + } + + public function handleUsers($relations) + { + $users = $this->getUsers($relations); + + foreach ($relations as $key => $value) { + $relations[$key]['user'] = $users[$value['user_id']]; + } + + return $relations; + } + + protected function getCourses($relations) + { + $ids = kg_array_column($relations, 'course_id'); + + $courseRepo = new CourseRepo(); + + $courses = $courseRepo->findByIds($ids, ['id', 'title', 'cover'])->toArray(); + + $result = []; + + foreach ($courses as $course) { + $result[$course['id']] = $course; + } + + return $result; + } + + protected function getUsers($relations) + { + $ids = kg_array_column($relations, 'user_id'); + + $userRepo = new UserRepo(); + + $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar'])->toArray(); + + $result = []; + + foreach ($users as $user) { + $result[$user['id']] = $user; + } + + return $result; + } + +} diff --git a/app/Transformers/LearningList.php b/app/Transformers/LearningList.php new file mode 100644 index 00000000..74caa99a --- /dev/null +++ b/app/Transformers/LearningList.php @@ -0,0 +1,96 @@ +getCourses($relations); + + foreach ($relations as $key => $value) { + $relations[$key]['course'] = $courses[$value['course_id']]; + } + + return $relations; + } + + public function handleChapters($relations) + { + $chapters = $this->getChapters($relations); + + foreach ($relations as $key => $value) { + $relations[$key]['chapter'] = $chapters[$value['chapter_id']]; + } + + return $relations; + } + + public function handleUsers($relations) + { + $users = $this->getUsers($relations); + + foreach ($relations as $key => $value) { + $relations[$key]['user'] = $users[$value['user_id']]; + } + + return $relations; + } + + protected function getCourses($relations) + { + $ids = kg_array_column($relations, 'course_id'); + + $courseRepo = new CourseRepo(); + + $courses = $courseRepo->findByIds($ids, ['id', 'title', 'cover'])->toArray(); + + $result = []; + + foreach ($courses as $course) { + $result[$course['id']] = $course; + } + + return $result; + } + + protected function getChapters($relations) + { + $ids = kg_array_column($relations, 'chapter_id'); + + $chapterRepo = new ChapterRepo(); + + $chapters = $chapterRepo->findByIds($ids, ['id', 'title'])->toArray(); + + $result = []; + + foreach ($chapters as $chapter) { + $result[$chapter['id']] = $chapter; + } + + return $result; + } + + protected function getUsers($relations) + { + $ids = kg_array_column($relations, 'user_id'); + + $userRepo = new UserRepo(); + + $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar'])->toArray(); + + $result = []; + + foreach ($users as $user) { + $result[$user['id']] = $user; + } + + return $result; + } + +} diff --git a/app/Transformers/OrderList.php b/app/Transformers/OrderList.php new file mode 100644 index 00000000..8ab4fdd3 --- /dev/null +++ b/app/Transformers/OrderList.php @@ -0,0 +1,99 @@ +imgBaseUrl = kg_img_base_url(); + } + + public function handleItems($orders) + { + $itemInfo = []; + + foreach ($orders as $key => $order) { + switch ($order['item_type']) { + case OrderModel::TYPE_COURSE: + $itemInfo = $this->handleCourseInfo($order['item_info']); + break; + case OrderModel::TYPE_PACKAGE: + $itemInfo = $this->handlePackageInfo($order['item_info']); + break; + case OrderModel::TYPE_REWARD: + $itemInfo = $this->handleRewardInfo($order['item_info']); + break; + } + $orders[$key]['item_info'] = $itemInfo; + } + + return $orders; + } + + protected function handleCourseInfo($itemInfo) + { + if (!empty($itemInfo) && is_string($itemInfo)) { + $itemInfo = json_decode($itemInfo, true); + $itemInfo['course']['cover'] = $this->imgBaseUrl . $itemInfo['course']['cover']; + } + + return $itemInfo; + } + + protected function handlePackageInfo($itemInfo) + { + if (!empty($itemInfo) && is_string($itemInfo)) { + $itemInfo = json_decode($itemInfo, true); + foreach ($itemInfo['courses'] as $key => $course) { + $itemInfo['courses'][$key]['cover'] = $this->imgBaseUrl . $course['cover']; + } + } + + return $itemInfo; + } + + protected function handleRewardInfo($itemInfo) + { + if (!empty($itemInfo) && is_string($itemInfo)) { + $itemInfo = json_decode($itemInfo, true); + $itemInfo['course']['cover'] = $this->imgBaseUrl . $itemInfo['course']['cover']; + } + + return $itemInfo; + } + + public function handleUsers($orders) + { + $users = $this->getUsers($orders); + + foreach ($orders as $key => $order) { + $orders[$key]['user'] = $users[$order['user_id']]; + } + + return $orders; + } + + protected function getUsers($orders) + { + $ids = kg_array_column($orders, 'user_id'); + + $userRepo = new UserRepo(); + + $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar'])->toArray(); + + $result = []; + + foreach ($users as $user) { + $result[$user['id']] = $user; + } + + return $result; + } + +} diff --git a/app/Transformers/RefundList.php b/app/Transformers/RefundList.php new file mode 100644 index 00000000..4d7909e2 --- /dev/null +++ b/app/Transformers/RefundList.php @@ -0,0 +1,38 @@ +getUsers($refunds); + + foreach ($refunds as $key => $refund) { + $refunds[$key]['user'] = $users[$refund['user_id']]; + } + + return $refunds; + } + + protected function getUsers($refunds) + { + $ids = kg_array_column($refunds, 'user_id'); + + $userRepo = new UserRepo(); + + $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar'])->toArray(); + + $result = []; + + foreach ($users as $user) { + $result[$user['id']] = $user; + } + + return $result; + } + +} diff --git a/app/Transformers/ReviewList.php b/app/Transformers/ReviewList.php new file mode 100644 index 00000000..7c397448 --- /dev/null +++ b/app/Transformers/ReviewList.php @@ -0,0 +1,67 @@ +getCourses($reviews); + + foreach ($reviews as $key => $review) { + $reviews[$key]['course'] = $courses[$review['course_id']]; + } + + return $reviews; + } + + public function handleUsers($reviews) + { + $users = $this->getUsers($reviews); + + foreach ($reviews as $key => $review) { + $reviews[$key]['user'] = $users[$review['user_id']]; + } + + return $reviews; + } + + protected function getCourses($reviews) + { + $ids = kg_array_column($reviews, 'course_id'); + + $courseRepo = new CourseRepo(); + + $courses = $courseRepo->findByIds($ids, ['id', 'title'])->toArray(); + + $result = []; + + foreach ($courses as $course) { + $result[$course['id']] = $course; + } + + return $result; + } + + protected function getUsers($reviews) + { + $ids = kg_array_column($reviews, 'user_id'); + + $userRepo = new UserRepo(); + + $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar'])->toArray(); + + $result = []; + + foreach ($users as $user) { + $result[$user['id']] = $user; + } + + return $result; + } + +} diff --git a/app/Transformers/TradeList.php b/app/Transformers/TradeList.php new file mode 100644 index 00000000..20aa6910 --- /dev/null +++ b/app/Transformers/TradeList.php @@ -0,0 +1,38 @@ +getUsers($trades); + + foreach ($trades as $key => $trade) { + $trades[$key]['user'] = $users[$trade['user_id']]; + } + + return $trades; + } + + protected function getUsers($trades) + { + $ids = kg_array_column($trades, 'user_id'); + + $userRepo = new UserRepo(); + + $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar'])->toArray(); + + $result = []; + + foreach ($users as $user) { + $result[$user['id']] = $user; + } + + return $result; + } + +} diff --git a/app/Transformers/Transformer.php b/app/Transformers/Transformer.php new file mode 100644 index 00000000..3aef33b3 --- /dev/null +++ b/app/Transformers/Transformer.php @@ -0,0 +1,17 @@ +getAdminRoles($users); + + foreach ($users as $key => $user) { + $users[$key]['admin_role'] = $roles[$user['admin_role']] ?? ['id' => 0, 'name' => 'N/A']; + } + + return $users; + } + + public function handleEduRoles($users) + { + $roles = $this->getEduRoles($users); + + foreach ($users as $key => $user) { + $users[$key]['edu_role'] = $roles[$user['edu_role']] ?? ['id' => 0, 'name' => 'N/A']; + } + + return $users; + } + + private function getAdminRoles($users) + { + $ids = kg_array_column($users, 'admin_role'); + + $roleRepo = new RoleRepo(); + + $roles = $roleRepo->findByIds($ids, ['id', 'name'])->toArray(); + + $result = []; + + foreach ($roles as $role) { + $result[$role['id']] = $role; + } + + return $result; + } + + private function getEduRoles() + { + $result = [ + UserModel::EDU_ROLE_STUDENT => [ + 'id' => UserModel::EDU_ROLE_STUDENT, + 'name' => '学员', + ], + UserModel::EDU_ROLE_TEACHER => [ + 'id' => UserModel::EDU_ROLE_TEACHER, + 'name' => '讲师', + ], + ]; + + return $result; + } + +} diff --git a/app/Validators/Category.php b/app/Validators/Category.php new file mode 100644 index 00000000..484cf041 --- /dev/null +++ b/app/Validators/Category.php @@ -0,0 +1,82 @@ +findById($id); + + if (!$category) { + throw new NotFoundException('category.not_found'); + } + + return $category; + } + + public function checkParent($parentId) + { + $categoryRepo = new CategoryRepo(); + + $category = $categoryRepo->findById($parentId); + + if (!$category || $category->deleted == 1) { + throw new BadRequestException('category.parent_not_found'); + } + + return $category; + } + + public function checkName($name) + { + $value = $this->filter->sanitize($name, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length < 2) { + throw new BadRequestException('category.name_too_short'); + } + + if ($length > 30) { + throw new BadRequestException('category.name_too_long'); + } + + return $value; + } + + public function checkPriority($priority) + { + $value = $this->filter->sanitize($priority, ['trim', 'int']); + + if ($value < 1 || $value > 255) { + throw new BadRequestException('category.invalid_priority'); + } + + return $value; + } + + public function checkPublishStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + if (!in_array($value, [0, 1])) { + throw new BadRequestException('category.invalid_publish_status'); + } + + return $value; + } + +} diff --git a/app/Validators/Chapter.php b/app/Validators/Chapter.php new file mode 100644 index 00000000..263b20dd --- /dev/null +++ b/app/Validators/Chapter.php @@ -0,0 +1,179 @@ +findById($id); + + if (!$chapter) { + throw new NotFoundException('chapter.not_found'); + } + + return $chapter; + } + + public function checkCourseId($courseId) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($courseId); + + if (!$course) { + throw new BadRequestException('chapter.invalid_course_id'); + } + + return $course->id; + } + + public function checkParentId($parentId) + { + $chapterRepo = new ChapterRepo(); + + $chapter = $chapterRepo->findById($parentId); + + if (!$chapter) { + throw new BadRequestException('chapter.invalid_parent_id'); + } + + return $chapter->id; + } + + public function checkTitle($title) + { + $value = $this->filter->sanitize($title, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length < 2) { + throw new BadRequestException('chapter.title_too_short'); + } + + if ($length > 50) { + throw new BadRequestException('chapter.title_too_long'); + } + + return $value; + } + + public function checkSummary($summary) + { + $value = $this->filter->sanitize($summary, ['trim', 'string']); + + return $value; + } + + public function checkPriority($priority) + { + $value = $this->filter->sanitize($priority, ['trim', 'int']); + + if ($value < 1 || $value > 255) { + throw new BadRequestException('chapter.invalid_priority'); + } + + return $value; + } + + public function checkFreeStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + if (!in_array($status, [0, 1])) { + throw new BadRequestException('chapter.invalid_free_status'); + } + + return $value; + } + + public function checkPublishStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + if (!in_array($value, [0, 1])) { + throw new BadRequestException('course.invalid_publish_status'); + } + + return $value; + } + + public function checkPublishAbility($chapter) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($chapter->course_id); + + if ($course->model == CourseModel::MODEL_VOD) { + if ($chapter->attrs['upload'] == 0) { + throw new BadRequestException('chapter.vod_not_uploaded'); + } + if ($chapter->attrs['translate'] != 'finished') { + throw new BadRequestException('chapter.vod_not_translated'); + } + } elseif ($course->model == CourseModel::MODEL_LIVE) { + if ($chapter->attrs['start_time'] == 0) { + throw new BadRequestException('chapter.live_time_empty'); + } + } elseif ($course->model == CourseModel::MODEL_ARTICLE) { + if ($chapter->attrs['word_count'] == 0) { + throw new BadRequestException('chapter.article_content_empty'); + } + } + } + + public function checkViewPrivilege($user, $chapter, $course) + { + if ($chapter->parent_id == 0) { + return false; + } + + if ($course->deleted == 1) { + return false; + } + + if ($chapter->published == 0) { + return false; + } + + if ($chapter->free == 1) { + return true; + } + + if ($course->price == 0) { + return true; + } + + if ($user->id == 0) { + return false; + } + + $courseUserRepo = new CourseUserRepo(); + + $courseUser = $courseUserRepo->findCourseUser($user->id, $course->id); + + if (!$courseUser) { + return false; + } + + if ($courseUser->expire_at < time()) { + return false; + } + } + +} diff --git a/app/Validators/ChapterArticle.php b/app/Validators/ChapterArticle.php new file mode 100644 index 00000000..108be9ce --- /dev/null +++ b/app/Validators/ChapterArticle.php @@ -0,0 +1,26 @@ +filter->sanitize($content, ['trim']); + + $length = kg_strlen($value); + + if ($length < 10) { + throw new BadRequestException('chapter_article.content_too_short'); + } + + if ($length > 65535) { + throw new BadRequestException('chapter_article.content_too_long'); + } + + return $value; + } +} diff --git a/app/Validators/ChapterAudio.php b/app/Validators/ChapterAudio.php new file mode 100644 index 00000000..02e0c158 --- /dev/null +++ b/app/Validators/ChapterAudio.php @@ -0,0 +1,22 @@ +filter->sanitize($fileId, ['trim', 'string']); + + if (!CommonValidator::intNumber($value)) { + throw new BadRequestException('chapter_audio.invalid_file_id'); + } + + return $value; + } + +} diff --git a/app/Validators/ChapterLive.php b/app/Validators/ChapterLive.php new file mode 100644 index 00000000..5ee226c1 --- /dev/null +++ b/app/Validators/ChapterLive.php @@ -0,0 +1,51 @@ += $endTimeStamp) { + throw new BadRequestException('chapter_live.start_gt_end'); + } + + if ($endTimeStamp - $startTimeStamp > 3 * 3600) { + throw new BadRequestException('chapter_live.time_too_long'); + } + } + +} diff --git a/app/Validators/ChapterVod.php b/app/Validators/ChapterVod.php new file mode 100644 index 00000000..becf93b9 --- /dev/null +++ b/app/Validators/ChapterVod.php @@ -0,0 +1,22 @@ +filter->sanitize($fileId, ['trim', 'string']); + + if (!CommonValidator::intNumber($value)) { + throw new BadRequestException('chapter_vod.invalid_file_id'); + } + + return $value; + } + +} diff --git a/app/Validators/Course.php b/app/Validators/Course.php new file mode 100644 index 00000000..b3e20b8a --- /dev/null +++ b/app/Validators/Course.php @@ -0,0 +1,178 @@ +findById($id); + + if (!$course) { + throw new NotFoundException('course.not_found'); + } + + return $course; + } + + public function checkModel($model) + { + $value = $this->filter->sanitize($model, ['trim', 'string']); + + $scopes = CourseModel::models(); + + if (!isset($scopes[$value])) { + throw new BadRequestException('course.invalid_model'); + } + + return $value; + } + + public function checkCover($cover) + { + $value = $this->filter->sanitize($cover, ['trim', 'string']); + + if (!CommonValidator::url($value)) { + throw new BadRequestException('course.invalid_cover'); + } + + $result = parse_url($value, PHP_URL_PATH); + + return $result; + } + + public function checkTitle($title) + { + $value = $this->filter->sanitize($title, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length < 5) { + throw new BadRequestException('course.title_too_short'); + } + + if ($length > 50) { + throw new BadRequestException('course.title_too_long'); + } + + return $value; + } + + public function checkDetails($details) + { + $value = $this->filter->sanitize($details, ['trim']); + + return $value; + } + + public function checkSummary($summary) + { + $value = $this->filter->sanitize($summary, ['trim', 'string']); + + return $value; + } + + public function checkKeywords($keywords) + { + $value = $this->filter->sanitize($keywords, ['trim', 'string']); + + return $value; + } + + public function checkMarketPrice($price) + { + $value = $this->filter->sanitize($price, ['trim', 'float']); + + if ($value < 0 || $value > 10000) { + throw new BadRequestException('course.invalid_market_price'); + } + + return $value; + } + + public function checkVipPrice($price) + { + $value = $this->filter->sanitize($price, ['trim', 'float']); + + if ($value < 0 || $value > 10000) { + throw new BadRequestException('course.invalid_vip_price'); + } + + return $value; + } + + public function checkExpiry($expiry) + { + $value = $this->filter->sanitize($expiry, ['trim', 'int']); + + if ($value < 1 || $value > 3 * 365) { + throw new BadRequestException('course.invalid_expiry'); + } + + return $value; + } + + public function checkLevel($level) + { + $value = $this->filter->sanitize($level, ['trim', 'string']); + + $scopes = CourseModel::levels(); + + if (!isset($scopes[$value])) { + throw new BadRequestException('course.invalid_level'); + } + + return $value; + } + + public function checkPublishStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + if (!in_array($value, [0, 1])) { + throw new BadRequestException('course.invalid_publish_status'); + } + + return $value; + } + + public function checkPublishAbility($course) + { + $courseRepo = new CourseRepo(); + + $chapters = $courseRepo->findChapters($course->id); + + $totalCount = $chapters->count(); + + if ($totalCount < 1) { + throw new BadRequestException('course.pub_chapter_not_found'); + } + + $publishedCount = 0; + + foreach ($chapters as $chapter) { + if ($chapter->parent_id > 0 && $chapter->published == 1) { + $publishedCount++; + } + } + + if ($publishedCount < $totalCount / 3) { + throw new BadRequestException('course.pub_chapter_too_few'); + } + } + +} diff --git a/app/Validators/CourseQuery.php b/app/Validators/CourseQuery.php new file mode 100644 index 00000000..09c6e6cd --- /dev/null +++ b/app/Validators/CourseQuery.php @@ -0,0 +1,128 @@ +filter->sanitize($courseId, ['trim', 'int']); + + if ($value > 0) { + return $value; + } + + return false; + } + + public function checkUserId($userId) + { + $value = $this->filter->sanitize($userId, ['trim', 'int']); + + if ($value > 0) { + return $value; + } + + return false; + } + + public function checkCategoryId($categoryId) + { + $value = $this->filter->sanitize($categoryId, ['trim', 'int']); + + if ($value <= 0) { + return false; + } + + $categoryRepo = new CategoryRepo(); + + $category = $categoryRepo->findById($value); + + if (!$category) { + return false; + } + + return $category->id; + } + + public function checkTitle($title) + { + $value = $this->filter->sanitize($title, ['trim', 'string']); + + if (!empty($value)) { + return $value; + } + + return false; + } + + public function checkLevel($level) + { + $value = $this->filter->sanitize($level, ['trim', 'int']); + + $scopes = [ + CourseModel::LEVEL_ENTRY, + CourseModel::LEVEL_JUNIOR, + CourseModel::LEVEL_MIDDLE, + CourseModel::LEVEL_SENIOR, + ]; + + if (in_array($value, $scopes)) { + return $value; + } + + return false; + } + + public function checkPrice($price) + { + $value = $this->filter->sanitize($price, ['trim', 'float']); + + if ($value < 0) { + throw new BadRequestException('无效的价格'); + } + + return $value; + } + + public function checkStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + $scopes = [ + CourseModel::LEVEL_ENTRY, + CourseModel::LEVEL_JUNIOR, + CourseModel::LEVEL_MIDDLE, + CourseModel::LEVEL_SENIOR, + ]; + + if (in_array($value, $scopes)) { + return $value; + } + + return false; + } + + public function checkSort($sort) + { + switch ($sort) { + case 'rating': + $orderBy = 'rating DESC'; + break; + case 'score': + $orderBy = 'score DESC'; + break; + default: + $orderBy = 'id DESC'; + break; + } + + return $orderBy; + } + +} diff --git a/app/Validators/CourseUser.php b/app/Validators/CourseUser.php new file mode 100644 index 00000000..e7901faf --- /dev/null +++ b/app/Validators/CourseUser.php @@ -0,0 +1,96 @@ +findCourseStudent($courseId, $userId); + + if (!$courseUser) { + throw new BadRequestException('course_student.not_found'); + } + + return $courseUser; + } + + public function checkCourseId($courseId) + { + $value = $this->filter->sanitize($courseId, ['trim', 'int']); + + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($value); + + if (!$course) { + throw new BadRequestException('course_student.course_not_found'); + } + + return $course->id; + } + + public function checkUserId($userId) + { + $value = $this->filter->sanitize($userId, ['trim', 'int']); + + $userRepo = new UserRepo(); + + $user = $userRepo->findById($value); + + if (!$user) { + throw new BadRequestException('course_student.user_not_found'); + } + + return $user->id; + } + + public function checkExpireTime($expireTime) + { + $value = $this->filter->sanitize($expireTime, ['trim', 'string']); + + if (!CommonValidator::date($value, 'Y-m-d H:i:s')) { + throw new BadRequestException('course_student.invalid_expire_time'); + } + + return strtotime($value); + } + + public function checkLockStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + if (!in_array($value, [0, 1])) { + throw new BadRequestException('course_student.invalid_lock_status'); + } + + return $value; + } + + public function checkIfJoined($courseId, $userId) + { + $repo = new CourseUserRepo(); + + $courseUser = $repo->findCourseStudent($courseId, $userId); + + if ($courseUser) { + throw new BadRequestException('course_student.user_has_joined'); + } + } + +} diff --git a/app/Validators/Nav.php b/app/Validators/Nav.php new file mode 100644 index 00000000..2c579a90 --- /dev/null +++ b/app/Validators/Nav.php @@ -0,0 +1,125 @@ +findById($id); + + if (!$nav) { + throw new NotFoundException('nav.not_found'); + } + + return $nav; + } + + public function checkParent($parentId) + { + $navRepo = new NavRepo(); + + $nav = $navRepo->findById($parentId); + + if (!$nav || $nav->deleted == 1) { + throw new BadRequestException('nav.parent_not_found'); + } + + return $nav; + } + + public function checkName($name) + { + $value = $this->filter->sanitize($name, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length < 2) { + throw new BadRequestException('nav.name_too_short'); + } + + if ($length > 30) { + throw new BadRequestException('nav.name_too_long'); + } + + return $value; + } + + public function checkPriority($priority) + { + $value = $this->filter->sanitize($priority, ['trim', 'int']); + + if ($value < 1 || $value > 255) { + throw new BadRequestException('nav.invalid_priority'); + } + + return $value; + } + + public function checkUrl($url) + { + $value = $this->filter->sanitize($url, ['trim']); + + $stageA = Text::startsWith($value, '/'); + $stageB = CommonValidator::url($value); + + if (!$stageA && !$stageB) { + throw new BadRequestException('nav.invalid_url'); + } + + return $value; + } + + public function checkTarget($target) + { + $value = $this->filter->sanitize($target, ['trim']); + + $scopes = NavModel::targets(); + + if (!isset($scopes[$value])) { + throw new BadRequestException('nav.invalid_target'); + } + + return $value; + } + + public function checkPosition($position) + { + $value = $this->filter->sanitize($position, ['trim']); + + $scopes = NavModel::positions(); + + if (!isset($scopes[$value])) { + throw new BadRequestException('nav.invalid_position'); + } + + return $value; + } + + public function checkPublishStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + if (!in_array($value, [0, 1])) { + throw new BadRequestException('nav.invalid_publish_status'); + } + + return $value; + } + +} diff --git a/app/Validators/Order.php b/app/Validators/Order.php new file mode 100644 index 00000000..55ca0aca --- /dev/null +++ b/app/Validators/Order.php @@ -0,0 +1,163 @@ +findById($id); + + if (!$order) { + throw new NotFoundException('order.not_found'); + } + + return $order; + } + + public function checkItemId($id) + { + $value = $this->filter->sanitize($id, ['trim', 'int']); + + return $value; + } + + public function checkItemType($type) + { + $scopes = [ + OrderModel::ITEM_TYPE_COURSE, + OrderModel::ITEM_TYPE_PACKAGE, + OrderModel::ITEM_TYPE_REWARD, + ]; + + if (!in_array($type, $scopes)) { + throw new BadRequestException('order.invalid_item_type'); + } + + return $type; + } + + public function checkAmount($amount) + { + $value = $this->filter->sanitize($amount, ['trim', 'float']); + + if ($value < 0.01) { + throw new BadRequestException('order.invalid_pay_amount'); + } + + return $value; + } + + public function checkStatus($status) + { + $scopes = [ + OrderModel::STATUS_PENDING, + OrderModel::STATUS_FINISHED, + OrderModel::STATUS_CLOSED, + OrderModel::STATUS_REFUND, + ]; + + if (!in_array($status, $scopes)) { + throw new BadRequestException('order.invalid_status'); + } + + return $status; + } + + public function checkPayChannel($channel) + { + $scopes = [ + OrderModel::PAY_CHANNEL_ALIPAY, + OrderModel::PAY_CHANNEL_WXPAY, + ]; + + if (!in_array($channel, $scopes)) { + throw new BadRequestException('order.invalid_pay_channel'); + } + + return $channel; + } + + public function checkDailyLimit($userId) + { + $orderRepo = new OrderRepo(); + + $count = $orderRepo->countUserTodayOrders($userId); + + if ($count > 50) { + throw new BadRequestException('order.reach_daily_limit'); + } + } + + public function checkIfAllowPay($order) + { + if (time() - $order->created_at > 3600) { + + if ($order->status == OrderModel::STATUS_PENDING) { + + $order->status = OrderModel::STATUS_CLOSED; + + $order->update(); + } + + throw new BadRequestException('order.trade_expired'); + } + + if ($order->status != OrderModel::STATUS_PENDING) { + throw new BadRequestException('order.invalid_status_action'); + } + } + + public function checkIfAllowCancel($order) + { + if ($order->status != OrderModel::STATUS_PENDING) { + throw new BadRequestException('order.invalid_status_action'); + } + } + + public function checkIfBoughtCourse($userId, $courseId) + { + $courseUserRepo = new CourseUserRepo(); + + $record = $courseUserRepo->find($userId, $courseId); + + if ($record) { + + $conditionA = $record->expire_time == 0; + $conditionB = $record->expire_time > time(); + + if ($conditionA || $conditionB) { + throw new BadRequestException('order.has_bought_course'); + } + } + } + + public function checkIfBoughtPackage($userId, $packageId) + { + $orderRepo = new OrderRepo(); + + $itemType = OrderModel::ITEM_TYPE_PACKAGE; + + $order = $orderRepo->findSuccessUserOrder($userId, $packageId, $itemType); + + if ($order) { + throw new BadRequestException('order.has_bought_package'); + } + } + +} diff --git a/app/Validators/Package.php b/app/Validators/Package.php new file mode 100644 index 00000000..84e37c0e --- /dev/null +++ b/app/Validators/Package.php @@ -0,0 +1,87 @@ +findById($id); + + if (!$package) { + throw new NotFoundException('package.not_found'); + } + + return $package; + } + + public function checkTitle($title) + { + $value = $this->filter->sanitize($title, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length < 2) { + throw new BadRequestException('package.title_too_short'); + } + + if ($length > 50) { + throw new BadRequestException('package.title_too_long'); + } + + return $value; + } + + public function checkSummary($summary) + { + $value = $this->filter->sanitize($summary, ['trim', 'string']); + + return $value; + } + + public function checkMarketPrice($price) + { + $value = $this->filter->sanitize($price, ['trim', 'float']); + + if ($value < 0.01 || $value > 10000) { + throw new BadRequestException('package.invalid_market_price'); + } + + return $value; + } + + public function checkVipPrice($price) + { + $value = $this->filter->sanitize($price, ['trim', 'float']); + + if ($value < 0.01 || $value > 10000) { + throw new BadRequestException('package.invalid_vip_price'); + } + + return $value; + } + + public function checkPublishStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + if (!in_array($value, [0, 1])) { + throw new BadRequestException('package.invalid_publish_status'); + } + + return $value; + } + +} diff --git a/app/Validators/Page.php b/app/Validators/Page.php new file mode 100644 index 00000000..cee177ca --- /dev/null +++ b/app/Validators/Page.php @@ -0,0 +1,75 @@ +findById($id); + + if (!$page) { + throw new NotFoundException('page.not_found'); + } + + return $page; + } + + public function checkTitle($title) + { + $value = $this->filter->sanitize($title, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length < 2) { + throw new BadRequestException('page.title_too_short'); + } + + if ($length > 50) { + throw new BadRequestException('page.title_too_long'); + } + + return $value; + } + + public function checkContent($content) + { + $value = $this->filter->sanitize($content, ['trim']); + + $length = kg_strlen($value); + + if ($length < 10) { + throw new BadRequestException('page.content_too_short'); + } + + if ($length > 65535) { + throw new BadRequestException('page.content_too_long'); + } + + return $value; + } + + public function checkPublishStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + if (!in_array($value, [0, 1])) { + throw new BadRequestException('page.invalid_publish_status'); + } + + return $value; + } + +} diff --git a/app/Validators/Refund.php b/app/Validators/Refund.php new file mode 100644 index 00000000..97288793 --- /dev/null +++ b/app/Validators/Refund.php @@ -0,0 +1,56 @@ +findById($id); + + if (!$trade) { + throw new NotFoundException('refund.not_found'); + } + + return $trade; + } + + public function checkIfAllowReview($refund) + { + if ($refund->status != RefundModel::STATUS_PENDING) { + throw new BadRequestException('refund.review_not_allowed'); + } + } + + public function checkReviewStatus($status) + { + $scopes = [RefundModel::STATUS_APPROVED, RefundModel::STATUS_REFUSED]; + + if (!in_array($status, $scopes)) { + throw new BadRequestException('refund.invalid_review_status'); + } + + return $status; + } + + public function checkReviewNote($note) + { + $value = $this->filter->sanitize($note, ['trim', 'string']); + + return $value; + } + +} diff --git a/app/Validators/Review.php b/app/Validators/Review.php new file mode 100644 index 00000000..8da6ceae --- /dev/null +++ b/app/Validators/Review.php @@ -0,0 +1,83 @@ +findById($id); + + if (!$review) { + throw new NotFoundException('review.not_found'); + } + + return $review; + } + + public function checkCourseId($courseId) + { + $courseRepo = new CourseRepo(); + + $course = $courseRepo->findById($courseId); + + if (!$course) { + throw new BadRequestException('review.course_not_found'); + } + + return $courseId; + } + + public function checkContent($content) + { + $value = $this->filter->sanitize($content, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length < 5) { + throw new BadRequestException('review.content_too_short'); + } + + if ($length > 255) { + throw new BadRequestException('review.content_too_long'); + } + + return $value; + } + + public function checkRating($rating) + { + $value = $this->filter->sanitize($rating, ['trim', 'int']); + + if (!in_array($value, [1, 2, 3, 4, 5])) { + throw new BadRequestException('review.invalid_rating'); + } + + return $value; + } + + public function checkPublishStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + if (!in_array($value, [0, 1])) { + throw new BadRequestException('review.invalid_publish_status'); + } + + return $value; + } + +} diff --git a/app/Validators/Role.php b/app/Validators/Role.php new file mode 100644 index 00000000..f7d31261 --- /dev/null +++ b/app/Validators/Role.php @@ -0,0 +1,63 @@ +findById($id); + + if (!$role) { + throw new NotFoundException('role.not_found'); + } + + return $role; + } + + public function checkName($name) + { + $value = $this->filter->sanitize($name, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length < 2) { + throw new BadRequestException('role.name_too_short'); + } + + if ($length > 30) { + throw new BadRequestException('role.name_too_long'); + } + + return $value; + } + + public function checkSummary($summary) + { + $value = $this->filter->sanitize($summary, ['trim', 'string']); + + return $value; + } + + public function checkRoutes($routes) + { + if (empty($routes)) { + throw new BadRequestException('role.routes_required'); + } + + return array_values($routes); + } + +} diff --git a/app/Validators/Slide.php b/app/Validators/Slide.php new file mode 100644 index 00000000..1649cc10 --- /dev/null +++ b/app/Validators/Slide.php @@ -0,0 +1,170 @@ +findById($id); + + if (!$slide) { + throw new NotFoundException('slide.not_found'); + } + + return $slide; + } + + public function checkTitle($title) + { + $value = $this->filter->sanitize($title, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length < 2) { + throw new BadRequestException('slide.title_too_short'); + } + + if ($length > 30) { + throw new BadRequestException('slide.title_too_long'); + } + + return $value; + } + + public function checkSummary($summary) + { + $value = $this->filter->sanitize($summary, ['trim', 'string']); + + return $value; + } + + public function checkCover($cover) + { + $value = $this->filter->sanitize($cover, ['trim', 'string']); + + if (!CommonValidator::url($value)) { + throw new BadRequestException('slide.invalid_cover'); + } + + $result = parse_url($value, PHP_URL_PATH); + + return $result; + } + + public function checkTarget($target) + { + $targets = array_keys(SlideModel::targets()); + + if (!in_array($target, $targets)) { + throw new BadRequestException('slide.invalid_target'); + } + + return $target; + } + + public function checkPriority($priority) + { + $value = $this->filter->sanitize($priority, ['trim', 'int']); + + if ($value < 1 || $value > 255) { + throw new BadRequestException('slide.invalid_priority'); + } + + return $value; + } + + public function checkStartTime($startTime) + { + if (!CommonValidator::date($startTime, 'Y-m-d H:i:s')) { + throw new BadRequestException('slide.invalid_start_time'); + } + + return strtotime($startTime); + } + + public function checkEndTime($endTime) + { + if (!CommonValidator::date($endTime, 'Y-m-d H:i:s')) { + throw new BadRequestException('slide.invalid_end_time'); + } + + return strtotime($endTime); + } + + public function checkTimeRange($startTime, $endTime) + { + if (strtotime($startTime) >= strtotime($endTime)) { + throw new BadRequestException('slide.invalid_time_range'); + } + } + + public function checkPublishStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + if (!in_array($value, [0, 1])) { + throw new BadRequestException('slide.invalid_publish_status'); + } + + return $value; + } + + public function checkCourse($courseId) + { + $course = CourseModel::findFirstById($courseId); + + if (!$course || $course->deleted == 1) { + throw new BadRequestException('slide.course_not_found'); + } + + if ($course->published == 0) { + throw new BadRequestException('slide.course_not_published'); + } + + return $course; + } + + public function checkPage($pageId) + { + $page = PageModel::findFirstById($pageId); + + if (!$page || $page->deleted == 1) { + throw new BadRequestException('slide.page_not_found'); + } + + if ($page->published == 0) { + throw new BadRequestException('slide.page_not_published'); + } + + return $page; + } + + public function checkLink($link) + { + $value = $this->filter->sanitize($link, ['trim', 'string']); + + if (!CommonValidator::url($value)) { + throw new BadRequestException('slide.invalid_link'); + } + + return $value; + } + +} diff --git a/app/Validators/Trade.php b/app/Validators/Trade.php new file mode 100644 index 00000000..16806377 --- /dev/null +++ b/app/Validators/Trade.php @@ -0,0 +1,56 @@ +findById($id); + + if (!$trade) { + throw new NotFoundException('trade.not_found'); + } + + return $trade; + } + + public function checkIfAllowClose($trade) + { + if ($trade->status != TradeModel::STATUS_PENDING) { + throw new BadRequestException('trade.close_not_allowed'); + } + } + + public function checkIfAllowRefund($trade) + { + if ($trade->status != TradeModel::STATUS_FINISHED) { + throw new BadRequestException('trade.refund_not_allowed'); + } + + $tradeRepo = new TradeRepo(); + + $refund = $tradeRepo->findLatestRefund($trade->sn); + + $scopes = [RefundModel::STATUS_PENDING, RefundModel::STATUS_APPROVED]; + + if ($refund && in_array($refund->status, $scopes)) { + throw new BadRequestException('trade.refund_existed'); + } + } + +} diff --git a/app/Validators/User.php b/app/Validators/User.php new file mode 100644 index 00000000..cd492f36 --- /dev/null +++ b/app/Validators/User.php @@ -0,0 +1,273 @@ +findById($id); + + if (!$user) { + throw new NotFoundException('user.not_found'); + } + + return $user; + } + + public function checkPhone($phone) + { + $value = $this->filter->sanitize($phone, ['trim', 'string']); + + if (!CommonValidator::phone($value)) { + throw new BadRequestException('account.invalid_phone'); + } + + return $value; + } + + public function checkEmail($email) + { + $value = $this->filter->sanitize($email, ['trim', 'string']); + + if (!CommonValidator::email($value)) { + throw new BadRequestException('account.invalid_email'); + } + + return $value; + } + + public function checkPassword($password) + { + $value = $this->filter->sanitize($password, ['trim', 'string']); + + if (!CommonValidator::password($value)) { + throw new BadRequestException('account.invalid_password'); + } + + return $value; + } + + public function checkName($name) + { + $value = $this->filter->sanitize($name, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length < 2) { + throw new BadRequestException('user.name_too_short'); + } + + if ($length > 15) { + throw new BadRequestException('user.name_too_long'); + } + + return $value; + } + + public function checkTitle($title) + { + $value = $this->filter->sanitize($title, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length > 30) { + throw new BadRequestException('role.title_too_long'); + } + + return $value; + } + + public function checkAbout($about) + { + $value = $this->filter->sanitize($about, ['trim', 'string']); + + $length = kg_strlen($value); + + if ($length > 255) { + throw new BadRequestException('user.about_too_long'); + } + + return $value; + } + + public function checkEduRole($role) + { + $value = $this->filter->sanitize($role, ['trim', 'int']); + + $roleIds = [UserModel::EDU_ROLE_STUDENT, UserModel::EDU_ROLE_TEACHER]; + + if (!in_array($value, $roleIds)) { + throw new BadRequestException('user.invalid_edu_role'); + } + + return $value; + } + + public function checkAdminRole($role) + { + $value = $this->filter->sanitize($role, ['trim', 'int']); + + if (!$value) return 0; + + $roleRepo = new RoleRepo(); + + $role = $roleRepo->findById($value); + + if (!$role || $role->deleted == 1) { + throw new BadRequestException('user.invalid_admin_role'); + } + + return $role->id; + } + + public function checkLockStatus($status) + { + $value = $this->filter->sanitize($status, ['trim', 'int']); + + if (!in_array($value, [0, 1])) { + throw new BadRequestException('user.invalid_lock_status'); + } + + return $value; + } + + public function checkLockExpiry($expiry) + { + if (!CommonValidator::date($expiry, 'Y-m-d H:i:s')) { + throw new BadRequestException('user.invalid_locked_expiry'); + } + + return strtotime($expiry); + } + + public function checkIfPhoneTaken($phone) + { + $accountRepo = new AccountRepo(); + + $account = $accountRepo->findByPhone($phone); + + if ($account) { + throw new BadRequestException('account.phone_taken'); + } + } + + public function checkIfEmailTaken($email) + { + $accountRepo = new AccountRepo(); + + $account = $accountRepo->findByEmail($email); + + if ($account) { + throw new BadRequestException('account.email_taken'); + } + } + + public function checkIfNameTaken($name) + { + $userRepo = new UserRepo(); + + $user = $userRepo->findByName($name); + + if ($user) { + throw new BadRequestException('user.name_taken'); + } + } + + public function checkVerifyCode($key, $code) + { + if (!VerificationUtil::checkCode($key, $code)) { + throw new BadRequestException('user.invalid_verify_code'); + } + } + + public function checkCaptchaCode($ticket, $rand) + { + $captchaService = new CaptchaService(); + + $result = $captchaService->verify($ticket, $rand); + + if (!$result) { + throw new BadRequestException('user.invalid_captcha_code'); + } + } + + public function checkOriginPassword($user, $password) + { + $hash = PasswordUtil::hash($password, $user->salt); + + if ($hash != $user->password) { + throw new BadRequestException('user.origin_password_incorrect'); + } + } + + public function checkConfirmPassword($newPassword, $confirmPassword) + { + if ($newPassword != $confirmPassword) { + throw new BadRequestException('user.confirm_password_incorrect'); + } + } + + public function checkAdminLogin($user) + { + if ($user->admin_role == 0) { + throw new ForbiddenException('user.admin_not_authorized'); + } + } + + public function checkLoginAccount($account) + { + $userRepo = new UserRepo(); + + $user = $userRepo->findByAccount($account); + + if (!$user) { + throw new BadRequestException('user.login_account_incorrect'); + } + + return $user; + } + + public function checkLoginPassword($user, $password) + { + $hash = PasswordUtil::hash($password, $user->salt); + + if ($hash != $user->password) { + throw new BadRequestException('user.login_password_incorrect'); + } + + if ($user->locked == 1) { + throw new ForbiddenException('user.login_locked'); + } + + } + + public function checkIfCanEditUser($user) + { + $auth = $this->getDI()->get('auth'); + + $authUser = $auth->getAuthUser(); + + if ($authUser->id) { + } + } + +} diff --git a/app/Validators/Validator.php b/app/Validators/Validator.php new file mode 100644 index 00000000..4cdc58e0 --- /dev/null +++ b/app/Validators/Validator.php @@ -0,0 +1,37 @@ +logger = $this->getLogger(); + + set_error_handler([$this, 'handleError']); + + set_exception_handler([$this, 'handleException']); + } + + public function handleError($no, $str, $file, $line) + { + $content = compact('no', 'str', 'file', 'line'); + + $this->logger->error('Console Error ' . kg_json_encode($content)); + } + + public function handleException($e) + { + $content = [ + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'message' => $e->getMessage(), + ]; + + $this->logger->error('Console Exception ' . kg_json_encode($content)); + } + + protected function getLogger() + { + $logger = new AppLogger(); + + return $logger->getInstance('console'); + } + +} diff --git a/bootstrap/ConsoleKernel.php b/bootstrap/ConsoleKernel.php new file mode 100644 index 00000000..892ae050 --- /dev/null +++ b/bootstrap/ConsoleKernel.php @@ -0,0 +1,92 @@ +di = new \Phalcon\Di\FactoryDefault\Cli(); + $this->app = new \Phalcon\Cli\Console(); + $this->loader = new \Phalcon\Loader(); + + $this->initAppEnv(); + $this->initAppConfigs(); + $this->initAppSettings(); + $this->registerLoaders(); + $this->registerServices(); + $this->registerErrorHandler(); + } + + public function handle() + { + $this->app->setDI($this->di); + + $options = getopt('', ['task:', 'action:']); + + if (!empty($options['task']) && !empty($options['action'])) { + + $this->app->handle($options); + + } else { + + $options = []; + + foreach ($_SERVER['argv'] as $k => $arg) { + if ($k == 1) { + $options['task'] = $arg; + } elseif ($k == 2) { + $options['action'] = $arg; + } elseif ($k >= 3) { + $options['params'][] = $arg; + } + } + + $this->app->handle($options); + + echo PHP_EOL . PHP_EOL; + } + } + + protected function registerLoaders() + { + $this->loader->registerNamespaces([ + 'App' => app_path(), + 'Bootstrap' => bootstrap_path(), + ]); + + $this->loader->registerFiles([ + vendor_path('autoload.php'), + app_path('Library/Helper.php'), + ]); + + $this->loader->register(); + } + + protected function registerServices() + { + $providers = [ + \App\Providers\Cache::class, + \App\Providers\Config::class, + \App\Providers\Crypt::class, + \App\Providers\Database::class, + \App\Providers\EventsManager::class, + \App\Providers\Logger::class, + \App\Providers\MetaData::class, + \App\Providers\Redis::class, + \App\Providers\CliDispatcher::class, + ]; + + foreach ($providers as $provider) { + $service = new $provider($this->di); + $service->register(); + } + } + + protected function registerErrorHandler() + { + return new ConsoleErrorHandler(); + } + +} \ No newline at end of file diff --git a/bootstrap/Helper.php b/bootstrap/Helper.php new file mode 100644 index 00000000..6fca6bf2 --- /dev/null +++ b/bootstrap/Helper.php @@ -0,0 +1,139 @@ +logger = $this->getDI()->get('logger'); + + set_error_handler([$this, 'handleError']); + + set_exception_handler([$this, 'handleException']); + } + + public function handleError($no, $str, $file, $line) + { + $content = compact('no', 'str', 'file', 'line'); + + $error = json_encode($content); + + $this->logger->log($error); + } + + public function handleException($e) + { + $this->setStatusCode($e); + + if ($this->router->getModuleName() == 'api') { + $this->apiError($e); + } else if ($this->isAjax()) { + $this->ajaxError($e); + } else { + $this->pageError($e); + } + } + + protected function setStatusCode($e) + { + if ($e instanceof BadRequestException) { + $this->response->setStatusCode(400); + } else if ($e instanceof UnauthorizedException) { + $this->response->setStatusCode(401); + } else if ($e instanceof ForbiddenException) { + $this->response->setStatusCode(403); + } else if ($e instanceof NotFoundException) { + $this->response->setStatusCode(404); + } else { + $this->response->setStatusCode(500); + $this->report($e); + } + } + + protected function report($e) + { + $content = sprintf('%s(%d): %s', $e->getFile(), $e->getLine(), $e->getMessage()); + + $this->logger->error($content); + } + + protected function apiError($e) + { + $content = $this->translate($e->getMessage()); + + $this->response->setJsonContent($content); + $this->response->send(); + } + + protected function ajaxError($e) + { + $content = $this->translate($e->getMessage()); + + $this->response->setJsonContent($content); + $this->response->send(); + } + + protected function pageError($e) + { + $content = $this->translate($e->getMessage()); + + $this->flash->error($content); + + $this->response->redirect([ + 'for' => 'error.' . $this->response->getStatusCode() + ])->send(); + } + + protected function translate($code) + { + $errors = require config_path() . '/errors.php'; + + $content = [ + 'code' => $code, + 'msg' => $errors[$code] ?? $code, + ]; + + return $content; + } + + protected function isAjax() + { + if ($this->request->isAjax()) { + return true; + } + + $contentType = $this->request->getContentType(); + + if (Text::startsWith($contentType, 'application/json')) { + return true; + } + + return false; + } + +} diff --git a/bootstrap/HttpKernel.php b/bootstrap/HttpKernel.php new file mode 100644 index 00000000..54164a0e --- /dev/null +++ b/bootstrap/HttpKernel.php @@ -0,0 +1,95 @@ +di = new \Phalcon\Di\FactoryDefault(); + $this->app = new \Phalcon\Mvc\Application(); + $this->loader = new \Phalcon\Loader(); + + $this->initAppEnv(); + $this->initAppConfigs(); + $this->initAppSettings(); + $this->registerLoaders(); + $this->registerServices(); + $this->registerModules(); + $this->registerErrorHandler(); + } + + public function handle() + { + $this->app->setDI($this->di); + $this->app->handle()->send(); + } + + protected function registerLoaders() + { + $this->loader->registerNamespaces([ + 'App' => app_path(), + 'Bootstrap' => bootstrap_path(), + ]); + + $this->loader->registerFiles([ + vendor_path('autoload.php'), + app_path('Library/Helper.php'), + ]); + + $this->loader->register(); + } + + protected function registerServices() + { + $providers = [ + \App\Providers\Annotation::class, + \App\Providers\Cache::class, + \App\Providers\Cookie::class, + \App\Providers\Config::class, + \App\Providers\Crypt::class, + \App\Providers\Database::class, + \App\Providers\EventsManager::class, + \App\Providers\Logger::class, + \App\Providers\MetaData::class, + \App\Providers\Redis::class, + \App\Providers\Router::class, + \App\Providers\Security::class, + \App\Providers\Session::class, + \App\Providers\Url::class, + \App\Providers\Volt::class, + ]; + + foreach ($providers as $provider) { + $service = new $provider($this->di); + $service->register(); + } + } + + protected function registerModules() + { + $modules = [ + 'api' => [ + 'className' => 'App\Http\Api\Module', + 'path' => app_path('Http/Api/Module.php'), + ], + 'admin' => [ + 'className' => 'App\Http\Admin\Module', + 'path' => app_path('Http/Admin/Module.php'), + ], + 'home' => [ + 'className' => 'App\Http\Home\Module', + 'path' => app_path('Http/Home/Module.php'), + ], + ]; + + $this->app->registerModules($modules); + } + + protected function registerErrorHandler() + { + return new HttpErrorHandler(); + } + +} \ No newline at end of file diff --git a/bootstrap/Kernel.php b/bootstrap/Kernel.php new file mode 100644 index 00000000..ca52573a --- /dev/null +++ b/bootstrap/Kernel.php @@ -0,0 +1,57 @@ +app; + } + + public function getDI() + { + return $this->di; + } + + protected function initAppEnv() + { + require __DIR__ . '/Helper.php'; + } + + protected function initAppConfigs() + { + $this->configs = require config_path() . '/config.php'; + } + + protected function initAppSettings() + { + ini_set('date.timezone', $this->configs['timezone']); + + if ($this->configs['env'] == ENV_DEV) { + ini_set('display_errors', 1); + error_reporting(E_ALL); + } else { + ini_set('display_errors', 0); + error_reporting(0); + } + } + + abstract public function handle(); + + abstract protected function registerLoaders(); + + abstract protected function registerServices(); + + abstract protected function registerErrorHandler(); + +} \ No newline at end of file diff --git a/common b/common new file mode 100644 index 00000000..bcbc138c --- /dev/null +++ b/common @@ -0,0 +1 @@ +[Sun, 17 Nov 19 16:45:15 +0800][ERROR] fuck you off diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..33da8f8b --- /dev/null +++ b/composer.json @@ -0,0 +1,24 @@ +{ + "require": { + "phalcon/incubator": "^3.4", + "guzzlehttp/guzzle": "^6.3", + "swiftmailer/swiftmailer": "^6.0", + "peppeocchi/php-cron-scheduler": "^2.4", + "yansongda/pay": "^2.8", + "xiaochong0302/ip2region": "dev-master", + "tencentcloud/tencentcloud-sdk-php": "3.*", + "qcloudsms/qcloudsms_php": "0.1.*", + "qcloud/cos-sdk-v5": "2.*", + "workerman/gateway-worker": "^3.0.12", + "whichbrowser/parser": "^2.0", + "hightman/xunsearch": "^1.4.14" + }, + "require-dev": { + }, + "repositories": { + "packagist": { + "type": "composer", + "url": "https://mirrors.aliyun.com/composer" + } + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..a042edc2 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2021 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "0f1bd4f098897d13a5f8452989407860", + "packages": [ + { + "name": "doctrine/lexer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "e17f069ede36f7534b95adec71910ed1b49c74ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/e17f069ede36f7534b95adec71910ed1b49c74ea", + "reference": "e17f069ede36f7534b95adec71910ed1b49c74ea", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.2" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan": "^0.11.8", + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "time": "2019-07-30T19:33:28+00:00" + }, + { + "name": "egulias/email-validator", + "version": "2.1.11", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "92dd169c32f6f55ba570c309d83f5209cefb5e23" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/92dd169c32f6f55ba570c309d83f5209cefb5e23", + "reference": "92dd169c32f6f55ba570c309d83f5209cefb5e23", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "doctrine/lexer": "^1.0.1", + "php": ">= 5.5" + }, + "require-dev": { + "dominicsayers/isemail": "dev-master", + "phpunit/phpunit": "^4.8.35||^5.7||^6.0", + "satooshi/php-coveralls": "^1.0.1", + "symfony/phpunit-bridge": "^4.4@dev" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "EmailValidator" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ], + "time": "2019-08-13T17:33:27+00:00" + }, + { + "name": "guzzlehttp/command", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/command.git", + "reference": "2aaa2521a8f8269d6f5dfc13fe2af12c76921034" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/command/zipball/2aaa2521a8f8269d6f5dfc13fe2af12c76921034", + "reference": "2aaa2521a8f8269d6f5dfc13fe2af12c76921034", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "guzzlehttp/guzzle": "^6.2", + "guzzlehttp/promises": "~1.3", + "guzzlehttp/psr7": "~1.0", + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.9-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Command\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + } + ], + "description": "Provides the foundation for building command-based web service clients", + "time": "2016-11-24T13:34:15+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.3.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2018-04-22T15:46:56+00:00" + }, + { + "name": "guzzlehttp/guzzle-services", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle-services.git", + "reference": "9e3abf20161cbf662d616cbb995f2811771759f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle-services/zipball/9e3abf20161cbf662d616cbb995f2811771759f7", + "reference": "9e3abf20161cbf662d616cbb995f2811771759f7", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "guzzlehttp/command": "~1.0", + "guzzlehttp/guzzle": "^6.2", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "gimler/guzzle-description-loader": "^0.0.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Command\\Guzzle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "Stefano Kowalke", + "email": "blueduck@mail.org", + "homepage": "https://github.com/konafets" + } + ], + "description": "Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.", + "time": "2017-10-06T14:32:02+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2019-07-01T23:21:34+00:00" + }, + { + "name": "monolog/monolog", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "68545165e19249013afd1d6f7485aecff07a2d22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/68545165e19249013afd1d6f7485aecff07a2d22", + "reference": "68545165e19249013afd1d6f7485aecff07a2d22", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.2", + "psr/log": "^1.0.1" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^6.0", + "graylog2/gelf-php": "^1.4.2", + "jakub-onderka/php-parallel-lint": "^0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpspec/prophecy": "^1.6.1", + "phpunit/phpunit": "^8.3", + "predis/predis": "^1.1", + "rollbar/rollbar": "^1.3", + "ruflin/elastica": ">=0.90 <3.0", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2019-08-30T09:56:44+00:00" + }, + { + "name": "mtdowling/cron-expression", + "version": "v1.2.1", + "source": { + "type": "git", + "url": "https://github.com/mtdowling/cron-expression.git", + "reference": "9504fa9ea681b586028adaaa0877db4aecf32bad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/9504fa9ea681b586028adaaa0877db4aecf32bad", + "reference": "9504fa9ea681b586028adaaa0877db4aecf32bad", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Cron\\": "src/Cron/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", + "keywords": [ + "cron", + "schedule" + ], + "time": "2017-01-23T04:29:33+00:00" + }, + { + "name": "peppeocchi/php-cron-scheduler", + "version": "v2.4", + "source": { + "type": "git", + "url": "https://github.com/peppeocchi/php-cron-scheduler.git", + "reference": "1b18892fdd4f9c913107fda1544ac402eb7ec6e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/peppeocchi/php-cron-scheduler/zipball/1b18892fdd4f9c913107fda1544ac402eb7ec6e5", + "reference": "1b18892fdd4f9c913107fda1544ac402eb7ec6e5", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "mtdowling/cron-expression": "~1.0", + "php": ">=5.5.9" + }, + "require-dev": { + "phpunit/phpunit": "~5.7", + "satooshi/php-coveralls": "^1.0", + "swiftmailer/swiftmailer": "~5.4 || ^6.0" + }, + "suggest": { + "swiftmailer/swiftmailer": "Required to send the output of a job to email address/es (~5.4 || ^6.0)." + }, + "type": "library", + "autoload": { + "psr-4": { + "GO\\": "src/GO/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Giuseppe Occhipinti", + "email": "peppeocchi@gmail.com" + }, + { + "name": "Carsten Windler", + "email": "carsten@carstenwindler.de", + "homepage": "http://carstenwindler.de", + "role": "Contributor" + } + ], + "description": "PHP Cron Job Scheduler", + "keywords": [ + "cron job", + "scheduler" + ], + "time": "2018-10-25T21:33:38+00:00" + }, + { + "name": "phalcon/incubator", + "version": "v3.4.6", + "source": { + "type": "git", + "url": "https://github.com/phalcon/incubator.git", + "reference": "4883d9009a9d651308bfc201a0e9440c0ff692e2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phalcon/incubator/zipball/4883d9009a9d651308bfc201a0e9440c0ff692e2", + "reference": "4883d9009a9d651308bfc201a0e9440c0ff692e2", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-phalcon": "^3.3", + "php": ">=5.5" + }, + "require-dev": { + "codeception/aerospike-module": "^1.0", + "codeception/codeception": "^2.5", + "codeception/mockery-module": "0.2.2", + "codeception/specify": "^0.4", + "codeception/verify": "^0.3", + "doctrine/instantiator": "1.0.5", + "phalcon/dd": "^1.1", + "phpdocumentor/reflection-docblock": "2.0.4", + "phpunit/phpunit": "^4.8", + "squizlabs/php_codesniffer": "^2.9", + "vlucas/phpdotenv": "^2.4" + }, + "suggest": { + "duncan3dc/fork-helper": "To use extended class to access the beanstalk queue service", + "ext-aerospike": "*", + "phalcon/ide-stubs": "Phalcon IDE Stubs", + "sergeyklay/aerospike-php-stubs": "The most complete Aerospike PHP stubs which allows autocomplete in modern IDEs", + "swiftmailer/swiftmailer": "~5.2", + "twig/twig": "~1.35|~2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Phalcon\\": "Library/Phalcon/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Phalcon Team", + "email": "team@phalconphp.com", + "homepage": "https://phalconphp.com/en/team" + }, + { + "name": "Contributors", + "homepage": "https://github.com/phalcon/incubator/graphs/contributors" + } + ], + "description": "Adapters, prototypes or functionality that can be potentially incorporated to the C-framework.", + "homepage": "https://phalconphp.com", + "keywords": [ + "framework", + "incubator", + "phalcon" + ], + "time": "2019-09-16T13:54:24+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06T20:24:11+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2018-11-20T15:27:04+00:00" + }, + { + "name": "qcloud/cos-sdk-v5", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/tencentyun/cos-php-sdk-v5.git", + "reference": "a8ac2dc1f58ddb36e5d702d19f9d7cb8d6f1dc5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/a8ac2dc1f58ddb36e5d702d19f9d7cb8d6f1dc5e", + "reference": "a8ac2dc1f58ddb36e5d702d19f9d7cb8d6f1dc5e", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "guzzlehttp/guzzle": "~6.3", + "guzzlehttp/guzzle-services": "~1.1", + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Qcloud\\Cos\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "yaozongyou", + "email": "yaozongyou@vip.qq.com" + }, + { + "name": "lewzylu", + "email": "327874225@qq.com" + } + ], + "description": "PHP SDK for QCloud COS", + "keywords": [ + "cos", + "php", + "qcloud" + ], + "time": "2019-09-25T12:28:54+00:00" + }, + { + "name": "qcloudsms/qcloudsms_php", + "version": "v0.1.4", + "source": { + "type": "git", + "url": "https://github.com/qcloudsms/qcloudsms_php.git", + "reference": "48822045772d343b93c3d505d8a187cd51153c5a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/qcloudsms/qcloudsms_php/zipball/48822045772d343b93c3d505d8a187cd51153c5a", + "reference": "48822045772d343b93c3d505d8a187cd51153c5a", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require-dev": { + "sami/sami": "dev-master" + }, + "type": "library", + "autoload": { + "psr-4": { + "Qcloud\\Sms\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "qcloud sms php sdk", + "keywords": [ + "php", + "qcloud", + "sdk", + "sms" + ], + "time": "2018-09-19T07:19:17+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v6.2.1", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a", + "reference": "5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "egulias/email-validator": "~2.0", + "php": ">=7.0.0", + "symfony/polyfill-iconv": "^1.0", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.1", + "symfony/phpunit-bridge": "^3.4.19|^4.1.8" + }, + "suggest": { + "ext-intl": "Needed to support internationalized email addresses", + "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "https://swiftmailer.symfony.com", + "keywords": [ + "email", + "mail", + "mailer" + ], + "time": "2019-04-21T09:21:45+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v4.3.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "429d0a1451d4c9c4abe1959b2986b88794b9b7d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/429d0a1451d4c9c4abe1959b2986b88794b9b7d2", + "reference": "429d0a1451d4c9c4abe1959b2986b88794b9b7d2", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.1.3", + "symfony/event-dispatcher-contracts": "^1.1" + }, + "conflict": { + "symfony/dependency-injection": "<3.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "1.1" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/http-foundation": "^3.4|^4.0", + "symfony/service-contracts": "^1.1", + "symfony/stopwatch": "~3.4|~4.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2019-08-26T08:55:16+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v1.1.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "c61766f4440ca687de1084a5c00b08e167a2575c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/c61766f4440ca687de1084a5c00b08e167a2575c", + "reference": "c61766f4440ca687de1084a5c00b08e167a2575c", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.1.3" + }, + "suggest": { + "psr/event-dispatcher": "", + "symfony/event-dispatcher-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-06-20T06:46:26+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v4.3.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "d804bea118ff340a12e22a79f9c7e7eb56b35adc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d804bea118ff340a12e22a79f9c7e7eb56b35adc", + "reference": "d804bea118ff340a12e22a79f9c7e7eb56b35adc", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.1.3", + "symfony/mime": "^4.3", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "predis/predis": "~1.0", + "symfony/expression-language": "~3.4|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2019-08-26T08:55:16+00:00" + }, + { + "name": "symfony/mime", + "version": "v4.3.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/mime.git", + "reference": "987a05df1c6ac259b34008b932551353f4f408df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mime/zipball/987a05df1c6ac259b34008b932551353f4f408df", + "reference": "987a05df1c6ac259b34008b932551353f4f408df", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10", + "symfony/dependency-injection": "~3.4|^4.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Mime\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A library to manipulate MIME messages", + "homepage": "https://symfony.com", + "keywords": [ + "mime", + "mime-type" + ], + "time": "2019-08-22T08:16:11+00:00" + }, + { + "name": "symfony/polyfill-iconv", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-iconv.git", + "reference": "685968b11e61a347c18bf25db32effa478be610f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/685968b11e61a347c18bf25db32effa478be610f", + "reference": "685968b11e61a347c18bf25db32effa478be610f", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-iconv": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Iconv\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Iconv extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "iconv", + "polyfill", + "portable", + "shim" + ], + "time": "2019-08-06T08:03:45+00:00" + }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "6af626ae6fa37d396dc90a399c0ff08e5cfc45b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6af626ae6fa37d396dc90a399c0ff08e5cfc45b2", + "reference": "6af626ae6fa37d396dc90a399c0ff08e5cfc45b2", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php72": "^1.9" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "time": "2019-08-06T08:03:45+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-08-06T08:03:45+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "04ce3335667451138df4307d6a9b61565560199e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/04ce3335667451138df4307d6a9b61565560199e", + "reference": "04ce3335667451138df4307d6a9b61565560199e", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-08-06T08:03:45+00:00" + }, + { + "name": "tencentcloud/tencentcloud-sdk-php", + "version": "3.0.92", + "source": { + "type": "git", + "url": "https://github.com/TencentCloud/tencentcloud-sdk-php.git", + "reference": "71164956c234368c65c00e321e96f6dbd0f8d9c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/TencentCloud/tencentcloud-sdk-php/zipball/71164956c234368c65c00e321e96f6dbd0f8d9c0", + "reference": "71164956c234368c65c00e321e96f6dbd0f8d9c0", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "guzzlehttp/guzzle": "^6.3", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.6.33" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/QcloudApi/QcloudApi.php" + ], + "psr-4": { + "TencentCloud\\": "./src/TencentCloud" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "coolli", + "email": "tencentcloudapi@tencent.com", + "homepage": "https://cloud.tencent.com/document/sdk/PHP", + "role": "Developer" + } + ], + "description": "TencentCloudApi php sdk", + "homepage": "https://github.com/TencentCloud/tencentcloud-sdk-php", + "time": "2019-09-27T09:23:30+00:00" + }, + { + "name": "whichbrowser/parser", + "version": "v2.0.37", + "source": { + "type": "git", + "url": "https://github.com/WhichBrowser/Parser-PHP.git", + "reference": "9c6ad8eadc23294b1c66d92876c11f13c5d4cf48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WhichBrowser/Parser-PHP/zipball/9c6ad8eadc23294b1c66d92876c11f13c5d4cf48", + "reference": "9c6ad8eadc23294b1c66d92876c11f13c5d4cf48", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.4.0", + "psr/cache": "^1.0" + }, + "require-dev": { + "icomefromthenet/reverse-regex": "0.0.6.3", + "phpunit/php-code-coverage": "^2.2|^3.0", + "phpunit/phpunit": "^4.0|^5.0", + "satooshi/php-coveralls": "^1.0", + "squizlabs/php_codesniffer": "2.5.*", + "symfony/yaml": ">=2.8" + }, + "suggest": { + "cache/array-adapter": "Allows testing of the caching functionality" + }, + "type": "library", + "autoload": { + "psr-4": { + "WhichBrowser\\": [ + "src/", + "tests/src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niels Leenheer", + "email": "niels@leenheer.nl", + "role": "Developer" + } + ], + "description": "Useragent sniffing library for PHP", + "homepage": "http://whichbrowser.net", + "keywords": [ + "browser", + "sniffing", + "ua", + "useragent" + ], + "time": "2018-10-02T09:26:41+00:00" + }, + { + "name": "workerman/gateway-worker", + "version": "v3.0.13", + "source": { + "type": "git", + "url": "https://github.com/walkor/GatewayWorker.git", + "reference": "38b44c95f21cd340b5a9cff3987ddb2abb9a2a38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/walkor/GatewayWorker/zipball/38b44c95f21cd340b5a9cff3987ddb2abb9a2a38", + "reference": "38b44c95f21cd340b5a9cff3987ddb2abb9a2a38", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "workerman/workerman": ">=3.1.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "GatewayWorker\\": "./src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "homepage": "http://www.workerman.net", + "keywords": [ + "communication", + "distributed" + ], + "time": "2019-07-02T11:55:24+00:00" + }, + { + "name": "workerman/workerman", + "version": "v3.5.22", + "source": { + "type": "git", + "url": "https://github.com/walkor/Workerman.git", + "reference": "488f108f9e446f31bac4d689bb9f9fe3705862cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/walkor/Workerman/zipball/488f108f9e446f31bac4d689bb9f9fe3705862cf", + "reference": "488f108f9e446f31bac4d689bb9f9fe3705862cf", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3" + }, + "suggest": { + "ext-event": "For better performance. " + }, + "type": "library", + "autoload": { + "psr-4": { + "Workerman\\": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "walkor", + "email": "walkor@workerman.net", + "homepage": "http://www.workerman.net", + "role": "Developer" + } + ], + "description": "An asynchronous event driven PHP framework for easily building fast, scalable network applications.", + "homepage": "http://www.workerman.net", + "keywords": [ + "asynchronous", + "event-loop" + ], + "time": "2019-09-06T03:42:47+00:00" + }, + { + "name": "xiaochong0302/ip2region", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/xiaochong0302/ip2region.git", + "reference": "3cb3c50fa9e2c49115e40252f6b651437712a4e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/xiaochong0302/ip2region/zipball/3cb3c50fa9e2c49115e40252f6b651437712a4e9", + "reference": "3cb3c50fa9e2c49115e40252f6b651437712a4e9", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Koogua\\Ip2Region\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "xiaochong0302", + "email": "xiaochong0302@gmail.com" + } + ], + "description": "ip2region扩展包", + "keywords": [ + "Ip2Region" + ], + "time": "2019-08-18T14:57:02+00:00" + }, + { + "name": "yansongda/pay", + "version": "v2.8.6", + "source": { + "type": "git", + "url": "https://github.com/yansongda/pay.git", + "reference": "841999b65f97466ed1b405c52400c0c73aeaa3b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yansongda/pay/zipball/841999b65f97466ed1b405c52400c0c73aeaa3b5", + "reference": "841999b65f97466ed1b405c52400c0c73aeaa3b5", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-json": "*", + "ext-libxml": "*", + "ext-openssl": "*", + "ext-simplexml": "*", + "php": ">=7.1.3", + "symfony/event-dispatcher": "^4.0", + "symfony/http-foundation": "^4.0", + "yansongda/supports": "^2.0" + }, + "require-dev": { + "mockery/mockery": "^1.2", + "phpunit/phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Yansongda\\Pay\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "yansongda", + "email": "me@yansongda.cn" + } + ], + "description": "专注 Alipay 和 WeChat 的支付扩展包", + "keywords": [ + "alipay", + "pay", + "wechat" + ], + "time": "2019-09-21T15:05:57+00:00" + }, + { + "name": "yansongda/supports", + "version": "v2.0.2", + "source": { + "type": "git", + "url": "https://github.com/yansongda/supports.git", + "reference": "d4742562cf0453d127dc064334ad6dc3f86d247d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yansongda/supports/zipball/d4742562cf0453d127dc064334ad6dc3f86d247d", + "reference": "d4742562cf0453d127dc064334ad6dc3f86d247d", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "guzzlehttp/guzzle": "^6.2", + "monolog/monolog": "^1.23 || ^2.0", + "php": ">=7.1.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.15", + "phpunit/phpunit": "^7.5", + "predis/predis": "^1.1" + }, + "suggest": { + "predis/predis": "Allows to use throttle feature" + }, + "type": "library", + "autoload": { + "psr-4": { + "Yansongda\\Supports\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "yansongda", + "email": "me@yansongda.cn" + } + ], + "description": "common components", + "keywords": [ + "Guzzle", + "array", + "collection", + "config", + "http", + "support", + "throttle" + ], + "time": "2019-09-21T14:56:18+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "xiaochong0302/ip2region": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/config/config.default.php b/config/config.default.php new file mode 100644 index 00000000..7daab3cb --- /dev/null +++ b/config/config.default.php @@ -0,0 +1,45 @@ + '/', // 必须以"/"结尾 + 'static' => '/static/', // 必须以"/"结尾 +]; + +$config['db'] = [ + 'adapter' => 'Mysql', + 'host' => 'localhost', + 'username' => '', + 'password' => '', + 'dbname' => '', + 'charset' => 'utf8', +]; + +$config['redis'] = [ + 'host' => '127.0.0.1', + 'port' => 6379, + 'persistent' => false, + 'auth' => '', + 'index' => 0, + 'lifetime' => 86400, +]; + +$config['session'] = [ + 'lifetime' => 7200, +]; + +$config['log'] = [ + 'level' => Phalcon\Logger::INFO, +]; + +return $config; diff --git a/config/crossdomain.xml b/config/crossdomain.xml new file mode 100644 index 00000000..a4251da5 --- /dev/null +++ b/config/crossdomain.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/config/errors.php b/config/errors.php new file mode 100644 index 00000000..ee7df884 --- /dev/null +++ b/config/errors.php @@ -0,0 +1,206 @@ + \App\Listeners\Profiler::class, + 'payment' => \App\Listeners\Payment::class, + +]; + +return $events; \ No newline at end of file diff --git a/console.php b/console.php new file mode 100644 index 00000000..5918db45 --- /dev/null +++ b/console.php @@ -0,0 +1,13 @@ +#!/usr/bin/env php + +handle(); + diff --git a/db/migrations/20190616155547_my_test_migration.php b/db/migrations/20190616155547_my_test_migration.php new file mode 100644 index 00000000..88b50aaf --- /dev/null +++ b/db/migrations/20190616155547_my_test_migration.php @@ -0,0 +1,36 @@ + /etc/timezone + +VOLUME ["/usr/lib/mysql", "/var/log/mysql"] + +EXPOSE 3306 \ No newline at end of file diff --git a/docker/mysql/data/.gitignore b/docker/mysql/data/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/docker/mysql/data/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/docker/mysql/log/.gitignore b/docker/mysql/log/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/docker/mysql/log/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile new file mode 100644 index 00000000..15af50df --- /dev/null +++ b/docker/nginx/Dockerfile @@ -0,0 +1,10 @@ +FROM nginx:1.14 + +ENV TZ=Asia/Shanghai + +RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \ + && echo ${TZ} > /etc/timezone + +VOLUME ["/etc/nginx/conf.d", "/var/www/html", "/var/log/nginx"] + +EXPOSE 6379 \ No newline at end of file diff --git a/docker/nginx/conf.d/default.conf b/docker/nginx/conf.d/default.conf new file mode 100644 index 00000000..2a100b2e --- /dev/null +++ b/docker/nginx/conf.d/default.conf @@ -0,0 +1,29 @@ +server { + + listen 80 default_server; + server_name test.ctc.local; + + root /var/www/html/web/public; + index index.html index.htm index.php; + charset utf-8; + + location / { + try_files $uri $uri/ /index.php?_url=$uri&$args; + } + + location ~ \.php$ { + + include fastcgi_params; + + fastcgi_pass php:9000; + fastcgi_index /index.php; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } + + location ~ /\.ht { + deny all; + } +} diff --git a/docker/nginx/log/.gitignore b/docker/nginx/log/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/docker/nginx/log/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile new file mode 100644 index 00000000..e2cf4acc --- /dev/null +++ b/docker/php/Dockerfile @@ -0,0 +1,27 @@ +FROM mileschou/phalcon:7.2-fpm + +ENV TZ=Asia/Shanghai + +COPY ./docker/sources.list /opt + +RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \ + && echo ${TZ} > /etc/timezone \ + && cat /opt/sources.list > /etc/apt/sources.list \ + && apt-get update \ + && apt-get install -y git wget \ + && rm -r /var/lib/apt/lists/* + +RUN docker-php-ext-install pdo_mysql mbstring zip \ + && pecl install redis-4.1.1 \ + && docker-php-ext-enable redis + +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ + && composer config -g repo.packagist composer https://packagist.phpcomposer.com + +COPY . /var/www/html + +RUN chown -R www-data:www-data /var/www/html + +VOLUME ["/var/log/php-fpm", "/var/www/html"] + +EXPOSE 9000 \ No newline at end of file diff --git a/docker/php/log/.gitignore b/docker/php/log/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/docker/php/log/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/docker/redis/Dockerfile b/docker/redis/Dockerfile new file mode 100644 index 00000000..f04a7d2e --- /dev/null +++ b/docker/redis/Dockerfile @@ -0,0 +1,10 @@ +FROM redis:4.0 + +ENV TZ=Asia/Shanghai + +RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \ + && echo ${TZ} > /etc/timezone + +VOLUME ["/data"] + +EXPOSE 6379 \ No newline at end of file diff --git a/docker/redis/data/.gitignore b/docker/redis/data/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/docker/redis/data/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/docker/sources.list b/docker/sources.list new file mode 100644 index 00000000..cfa5418c --- /dev/null +++ b/docker/sources.list @@ -0,0 +1,8 @@ +deb http://mirrors.163.com/debian/ stretch main non-free contrib +deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib +deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib +deb-src http://mirrors.163.com/debian/ stretch main non-free contrib +deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib +deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib +deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib +deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib \ No newline at end of file diff --git a/docker/xunsearch/Dockerfile b/docker/xunsearch/Dockerfile new file mode 100644 index 00000000..975f8f77 --- /dev/null +++ b/docker/xunsearch/Dockerfile @@ -0,0 +1,28 @@ +FROM debian:stretch + +ENV TZ=Asia/Shanghai + +COPY ./docker/sources.list /opt +COPY ./docker/xunsearch/xs-docker.sh /opt + +RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \ + && echo ${TZ} > /etc/timezone \ + && cat /opt/sources.list > /etc/apt/sources.list \ + && apt-get update \ + && apt-get -y --no-install-recommends install wget make gcc g++ bzip2 zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +RUN cd /tmp \ + && wget http://www.xunsearch.com/download/xunsearch-full-latest.tar.bz2 \ + && tar -xjf xunsearch-full-latest.tar.bz2 \ + && cd /tmp/xunsearch-full-* \ + && sh setup.sh --prefix=/usr/local/xunsearch \ + && cat /opt/xs-docker.sh > /usr/local/xunsearch/bin/xs-docker.sh \ + && rm -r /tmp/xunsearch-full-* + +VOLUME ["/usr/local/xunsearch/data"] + +EXPOSE 8383 +EXPOSE 8384 + +ENTRYPOINT ["sh", "/usr/local/xunsearch/bin/xs-docker.sh"] \ No newline at end of file diff --git a/docker/xunsearch/data/.gitignore b/docker/xunsearch/data/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/docker/xunsearch/data/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/docker/xunsearch/xs-docker.sh b/docker/xunsearch/xs-docker.sh new file mode 100644 index 00000000..11a4b354 --- /dev/null +++ b/docker/xunsearch/xs-docker.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +xs_path="/usr/local/xunsearch" + +rm -f ${xs_path}/tmp/pid.* + +echo -n > ${xs_path}/tmp/docker.log + +${xs_path}/bin/xs-indexd -l ${xs_path}/tmp/docker.log -k start + +sleep 1 + +${xs_path}/bin/xs-searchd -l ${xs_path}/tmp/docker.log -k start + +sleep 1 + +tail -f ${xs_path}/tmp/docker.log \ No newline at end of file diff --git a/phinx.php b/phinx.php new file mode 100644 index 00000000..621e8e98 --- /dev/null +++ b/phinx.php @@ -0,0 +1,42 @@ +getDI()->getShared('config'); + +$db = $config->database; + +$options = [ + + 'version_order' => 'creation', + + 'paths' => [ + 'migrations' => 'db/migrations', + 'seeds' => 'db/seeds', + ], + + 'environments' => [ + + 'default_migration_table' => 'migration', + 'default_database' => 'production', + + 'production' => [ + 'adapter' => $db->adapter, + 'host' => $db->host, + 'port' => $db->port, + 'name' => $db->dbname, + 'user' => $db->username, + 'pass' => $db->password, + 'charset' => $db->charset, + ], + + ], + +]; + +return $options; \ No newline at end of file diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 00000000..fcf1d37e --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,8 @@ +AddDefaultCharset UTF-8 + + + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L] + \ No newline at end of file diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..8d824733b204aebac90a4d68d499537b11862927 GIT binary patch literal 4286 zcmb_gZ%9>V7(Yu=QcFc}1Yykx#-N}S#V>6i@{=|6Lxg>-b2RgA4$YyFS)gOOYop=Z zMogGdi><9-8|9doli9)>x}~G8nWd;nl4)N5U(bHO+n@l;e)e6nrZw)e2x038PD4k9mi$BrFE zZnyjM`}gm6`~7~};TO87Q)z>pkM}n~Z6Nc>lP5#9wY6Ww#l;;JSj5hK32~3UY15{6 z8X6iJCnhGws0)iasXNF98;>?x*s%XjR#sNIzUYZy-qFy|P#^SiQFp)(&>gS^ zeBKd#Zua)}{+XVh{{Bm_E&XDTybG0obe!WPYO1%3Lm2by->2nd0JN_x}C+E0U6u3L&SofpIGCg7H8s``MW%_mE3-m6ers zA+U|`@bDw$<>hC)ySqJ;lapif^YhHTd8Xp@^zR!0IQIhMs-vT$?bfYZt&G>Hsj2a?v9aNlloS;{{h>2A zMSWn6k~MX@udlBMesd|#ZZM}uMn)b=Y?$ghfByW1ty{P9zNy!Ujg39JZ{NQ1>gwwH z#KgpR6?&|F)WsSFU96L`o}0Wk$S{tB?yah-st)(IAn}`;ntmdtAp3rq6LwzEJL{y- z<;Jra{_vx|oehP5{rdGECAQD!n>cXbz^M>>gRrpA$veziE%aG^Y-VQ0my?roTBS2A zEG)09tLvu3=bdlfyqW%0<(U&p^{umC;LPk((9lFZisS7^BMM9{T@%%8DGRRIKvPei}}YIFpYcdiiwF~pLfa{ zyLRn5#=b-WuED{<-rc)*mkJwrXEN{g_3PK?uU)$~Poal;4bCv^6HvoCE@wp#V!(Ik z(4k7~35o&AH8wV0fX~>wtTiw&;N@(Rot=Gh@7}#93JMB7ym;~A*Q_nuw{I_^49IyF zopThfp1J1%$vKt1z-()4Yi7JD8a3_nbN2vSH&hS|LokkvsiI{o&FMW@9e*{!v*p` zdi2PfnwlCazKu0&*5n;Lc<}V)%a^}JUHl!h(jE3b&ZsRdElrG7#(=|zoPo+YPZC35 z$+OF6H2Bv1)!Es3(>Cim?~vd0kIuUy)`krm@*^T5Sd(NN+GTXka?vR1QSuxGJvvUhWS;0(h#inAPLuo&mmL0tjeLBKYKeV=$|ZZcOrAZzwyzhKW| z-zL#VV9DCVJ={wf$_8-xzS`xK!?&Cj-FR;X(Jzk$@tr*WCTr@da2GZ0&1aex^H9?w aZfIKADg1Whandle(); \ No newline at end of file diff --git a/public/static/admin/css/style.css b/public/static/admin/css/style.css new file mode 100644 index 00000000..3875e3eb --- /dev/null +++ b/public/static/admin/css/style.css @@ -0,0 +1,182 @@ +.kg-body { + padding: 15px; +} + +.kg-clearfix:after { + content: "."; + display: block; + visibility: hidden; + clear: both; + height: 0; +} + +.kg-login-form { + width: 420px; + margin: 100px auto; +} + +.kg-login-form .layui-input-block { + margin-left: 60px; + width: 300px; +} + +.kg-login-form .layui-form-label { + width: 30px; +} + +.kg-btn-verify { + color: green; +} + +.kg-tips { + margin-top: 30px; + text-align: center; +} + +.kg-tips .layui-icon-face-surprised { + display: inline-block; + font-size: 200px; + color: #393D49; +} + +.kg-tips .layui-text { + width: 500px; + margin: 30px auto; + padding-top: 20px; + border-top: 5px solid #009688; +} + +.kg-tips h1 { + font-size: 100px; + line-height: 100px; + color: #009688; +} + +.kg-tips .layui-text span { + display: inline-block; +} + +.kg-side-menu-bar { + position: absolute; + top: 0; + left: 200px; + line-height: 60px; +} + +.kg-side-menu-bar .layui-icon { + color: #009688; + font-size: 25px; +} + +.kg-nav-module { + position: absolute; + top: 0; + left: 230px; +} + +.kg-breadcrumb { + margin-left: 3px; + margin-bottom: 15px; +} + +.kg-nav { + position: relative; + height: 30px; + line-height: 30px; + margin-bottom: 17px; +} + +.kg-nav-left { + position: absolute; + top: 0; + left: 5px; +} + +.kg-nav-right { + position: absolute; + top: 0; + right: 0; +} + +.kg-back { + cursor: pointer; +} + +.kg-tab-title { + margin: 0 0 15px 0; +} + +.kg-table td { + padding: 10px; +} + +.kg-table p { + line-height: 1.8em; +} + +.kg-table .kg-progress { + margin: 15px 0 5px 0; +} + +.kg-table .layui-rate { + padding: 0; +} + +.kg-table .layui-form-switch { + margin: 0; +} + +.kg-priority-input { + width: 60px; +} + +img.kg-cover { + width: 185px; + height: 100px; + cursor: pointer; +} + +.kg-form .layui-form-label { + width: 120px; +} + +.kg-form .layui-input-block { + margin-left: 150px; +} + +.kg-form .xm-body { + padding: 10px; +} + +.kg-search-box .layui-input { + width: 250px; +} + +.kg-qrcode-block { + padding: 20px; + text-align: center; +} + +.kg-qrcode-block .layui-icon-close-fill { + color: red; +} + +.kg-qrcode-block .layui-icon-ok-circle { + color: green; +} + +.kg-order-date { + margin-left: 30px; +} + +.kg-order-item { + margin-top: 10px; + padding-top: 10px; + border-top: 1px solid #e6e6e6; +} + +.kg-order-item:first-child { + margin-top: 0; + padding-top: 0; + border-top: none; +} diff --git a/public/static/admin/img/default_cover.png b/public/static/admin/img/default_cover.png new file mode 100644 index 0000000000000000000000000000000000000000..39069d41693b4b7bc5e3a0f08e6d4d6c336fda38 GIT binary patch literal 2692 zcmbVMX;c$g7ET9{pb{IgMI~Y;ic24|k{xh?AVwiUMMOc!R>4R%lR`oOwQ#x}#g^kh zix|{a+jUeTG=d-ydlX!ov29#HhX`VXu!TkTFolXeKRo@zI;W~$-MZhs-}~;pZ(les z#C7tV$p{3(mAi_w4uSZ}4Bu#!18k9Us2kwdY%n+qT(6RXNkR>PSRqk~04!G_j0e^M zLP_%WyMR9e;h>X6M1fIZp=_~AK@g7n5OfMPj7A{*m+90(aRLBhML@hv8G!37tHfbt zk^tOBS{Nxz9RzHZtZ+3nHrR-l-TizLXj#F48XxmKWssv4h#DfSgHLe6f7B0CsY&31QJo9 z7~j`>Z!NeE_>;zGy|od^YJj*7(5ezOVz?gC`4eDRyT48}?g+DC^EEQKC_*_$B~DZT zN|4J5z`=hA5}Aa}VA6dluzGl3x~~XN1z0RR3t)=yQj!D^(a91aT|%CS^ErGVl|y1M z7_^lf4ueb%rZOoE=E^_@ixC{?%VMk`O<=i7Ehtoqfr;EQIQK^^^)IpPAPpb{RhkHu zNgpO87-(*89v&Wk_wJqDZnxQN zuU@?x85!yC?;jl+5^__HBE6`|H=Q8yg$j+S;0$np#_1 zJ3BkAR%=H`hs9!f^X5%%q=te(Ormo+DU>|K2Raky^xv>^{u&HuBDu#Zy9=eT*jlOqtm7lsJQZ?gAClh&M zH5Hk`G~Hj<2WyaqEI zG4GanHvASO$UtV;OBp>mGm-Ukqd2b0TNSOxAk%5%=F21JkZaha&>O3oFPL`P_*W~& zVy+H()Hofs3mc0LS&+p2mBxx{Ov%$)su`W_0-c*t5)hi|HQ?Qq zjbwbkZ{uc^f4M0~C~8O{&4v`NKKC^j!%_aVCSHI8Ntf6`9a z)8cw5+E3tk4X++}8w1*0-{@F~?WVI@Ovj?MZcp+EIB`m$NVo=)QaIRl|iT$mn8^EyrFTndZcch~@~a=qxaq zP)GZBv^r~{F|GP$t-xNeOsz+kf$7^QK>|-c$UMIK`^-J%z&66;p1E>M?j9eeaJb`9^a*!I0?b_sH>hte}aOZ^attLUAQs0rK*>D1W;NYAr7k zV%7htAZ3`Erlo54H^mCFik$5(@)ZIyx8}0zXc8UFzcJtF3S}HEE~fW75r#_-I7iQl zN;gD%>XA7on#m6K$VrD=pG@LUb0Qo}wbVLa|C{j`q*5y0#y;9!>ikH3_h1pkFQ(sm zbj&8mNhpw`Q!9#2F6wHzc)Y@b`1;vJ)2TvhxWHG3+oIKDEt$!sG&l%+X!j|4`*%80dA7IeLlB&mY8D8yufl z@8@&fb$QT~6w5j2SQS5ex-JGfEpGBi-}oCJ>G#8lK|6B}GV@zCYwf!Sk8VE)h!l~oz`m`+cA@q&AFFd%aY1|`3tzw(YZ2Wpt7%bHhc ztmyYW?@r9KApJ7fs`8g1!W|D7jyqG#J+W)A5T0&q(Z>yJ^>U_L^<%>~`i_P-|ByyU zW@6Pvqs^9-L%&+5Wc02z|8kt}zicP7zy7{=*D7RAMM3xDI!vpoaTuzly}22YSgFk6 zn%$fT|LnM5y^v+Fx~->Tn5ABxihG?_AgSKFE5*T??dsk)`0`=*$#iMi&ArA4hR*cm zX<);*4SqlVU6z=Lw+_#R@`t&vUX?vQ%dC68#V)p@{TC&qIonXd0=c1*#XB@9M7eHCyz> zP`Nc@@ML+PlFz46dr12-c40GKUKgfSK9$BTy%U0R;)4)L^n zAGQD2na|`o*iD_cm1dT**@4`*2+rmXRXX#X6~7}u9>7cIa=}aO7Ma}AbuNb z3l|UwJj!_sa6>pxhSv{ka6Wj#tvw?_AU=_uHyBh{jOILq1rZzwAW&^q?3VLY&KT=w z?cx9e#q0rrCka*Y??>0*i$S}snf^Z~yz&Cbz64#=P zhL;mXGvb@LK#0{V zTzi9l*FPiG*%F+*f2J`cCGr0AU#a_iv?fnwGeQNoc$khu6p+MbryWX_#*LC({^pzS?%*rS~g0+LGT(^+RxFTcQwkB_^qxXwQN-XY~xY5Y?1 z!Rxt>Z(Kq@waiu$W-i!2df>nq+4lGD~d3vsb=*jl*wlDxKyGNk3< zgF?j5^tS87&|lU&9byC77f{X>d(?J&7X849@?J017MwNz;rP(ArmgE*&lT+~ zc8Om79Ld|ZX*Tvb7Dntqx}agc%7ymw`)$hxA6^9ZT>xR6oPS0I_J;kG<86MyQhMH@ z@PMXn8E~Txp&>op(tP;F9#C|oggeGk`d0hRE6-Z^Qa(%!;+V)E8Vb@*(zg zyzm>=cpxPn^KEuj^r`;I+M`EY8;2JvVh3LIlePCcw01(76G1D%*E$#t>HYy zlYT+?{rzl(Fa20YCB=_`btIS2f!v#KQ$L*lKAa-Nle$I;P3Z8NcJ;PXbuDa88f!j= zGQI3Dd0%YmB|)j;TPt6j|G4V7;@OnxACXBm1N{?mlU{rC2f_?)Yj>;WCzo+0crWjw z9Eh~>L2<{ER-@)}u8+!N8zRP7VPkR;Dco^sbZ-H8=mhUQ2m*HgdP~~W$(Fv`1bFy)3aw%yr`X+>|1Bv^2cax7p>zo{>^= z0fx+){=VJTxj4OrlWWhGkheej?!_&LJ#Z%Epf76~&|e;L_a+ZV|6cfY_@N*!AE?vT zh}ianioH?w_V7f*fbhZl8b7KuV%eKxxT_%Oy{^RTV+%D5CV~a@$6pf7fJA`tpv)(< zl%tuvA>CTg!AHjyaGEbJa)lgB7vH7 zWC}u4lW#G+$BuICKs0Ni$GZ~9uvg7Mk_$Z8EC5)>O;o)_s^c`m>uRAr9#^WC7)a#k z88jlff9O6Zs^;*3Af$SVOw67YvSmA?*W_&p5Xb%vjNn3;kivxYF>w((oh{eS@-{Da zCtM>Gmr~OU#^!E}&?;5+KqpF@I=gyl%H7PaCT8=}8r!Zt8;4KV^FVttSX;n6t|eg& z`Jx!7^WDJ1TAcP-D=-6!oXPfKr4B1#>50kmZ} zUWQR!t`9XC6f8dM`#$*;=Mc{x>Nd|Je$ohSg0*i9aT!_ges~-!dcC@Aw_oBl79ZqhX{)z^rG-5_GS4&dR1P}-=-{rZS9Wb{@s3%JyI)1{()uAWso+3Fo;Mj& z!U$SlpTj8_i_p*Xbgs*Km@L<6b#h0fMgV>rTj@N?z3m&NLPvVXRcU0lUw|KR+8^r7oOj_T2g)WAyl_WjaNPlKMT zk)9(`-9?6kPwB)>iBfJxdV*2hWq03HQK@=QdFOu4CT2}UKC&2*rzj}s3r3S*ezdzI0P;_crWG(cmp-qjFa`YF0;04)qD9YeNo8W z<%hu>{V;ci$iVYk_kT8L>efVF{+ecUYcelDtMnPXj|4uj8(a~<8(d;GaId$wcM(Id zEqtJ=ijSlr2!ZQtj=^uKe-)5+AnvF^kaMqe0OVt#Eb?MM^jckhQWD(dVYAgP?3}W- zZfRx`l_v_dw-fC&SeQGz0FcSnxKya`GHL4q$068)I1b_T5ll?zG#Nn4O=>q(SOycc zAHRGf%z#=g!D7d+c^F9oS2i#0JlYMBk$24N|dhdWT}Dr8 z?_vQVL6TlqM5R^-bkg3lFa=F_I2sew%c~Zd#ZQa@82ZWWjTE0jR}{}Qgzpp-Lwdft zEJzZv6wVRDGAIbK*Gw}E2ISSS1o@zDL>-3dmFAv;6EV_0CWSdxU`G%NUk+ahS1!lU z{NB%u`-}F`-v35p2vEh*$@4@%xi-^#YBNAzC5ycB4&$K$F6ttIJS-q^szb0!Rv=bz z>k15e)-uQRx6;CFisyf8T9_)F`|dGVNeFJGqD?#+u= z^<@|4-Ypt?4apvY`#ocCTadSr`yuqmKStcmPUx3Uujy^4?rw**jQ$+o!cnqE72ChI z!og+ra6SX-Rn2y)_PJ;C?@D65-+iS4*Dm9$B5yugc2${A|8ruF*Q@lx3uWEMp6HlF zp+U$yd{wpiZ+yt+{l)7xf}7uzD=B60Tc_V0`CM1U7EKiv3!6q96TNNmg9te6RoVBt z`@3&x7Us^CW=r43qsz+SYhFRKaS=KS8B2BA9eWd;+34lKe6`HW7BkD^2HO$TXX&GE z8Daj~oz-uBR(h}90sXvbEYPfhOqMqOVTa_rUV{17Mth|a4 z@&5YAqSTc2*f04C6UD5 zZ%&qXc;mkh2u`Z(Tg#$f6~lDr{m5|A^Z)oW|BYTF9pXA^k4R}c1y*$y=l4+Q*s6c- zI^KNsF_$3@*>~n%>Uo(+keOJJAM;U4YnS}O${FRk(o;4h{>G;FPS*2Jr+PDPN3o~i zvTq}08cdO&2k$i9Lc5;a_k8-J57(XadEI);=Z%W19PfY1hJZ~jb9kQ}ue2y!(zYc_ zXi6&A3cZ^DhL)9qol&)zQZqL{U!$&W6BN&OCThyiw}KLWe32B(X@0RNQ?QS!vUN-7 z)M}y!-d2gyVLuoue$1o>?;a)A9rWb_FDR< zGZR*kdF}G~u6BUO5&4DXEiTiq>xnL|ow}rqa|aXAW#2+w<>G_6R8N!$Rh~U}@>KyFyjqB7;m9H@`}AX(zLdkbU{%rUlcHUAp*8ro4CzVu1T6BPh`d`+z59$>3}9^d7`}TiIPc+yBtCXwfa1p0#khSf zML)PSj4&=%d%mjLpY&{*?jI~{DlIr&4dT&`el&7M*OX_^yUzy~L-b^fR!1%S${-0h z_omsYZrWv2g5U6=l%J;~86NUg>ISbND|7F9GUV{~hsQ92u1?gM;hMRHu<4H(k?$|9 zh~vv8U6T!o+pO%RkwbcxZs!!wxdjrze5TS9BZ8fmgX_igFYU)uLlj|GQWoOf2AmtT z130{z4{`?szz_6-B?lQJKmnT_$Xb((N>-*5dSL^WoxPo%ya!e`WJxoSsFpQy-${Oi zg!|XUcNoY+21qRoeOEi7FZqck*q`oIC>sTmu^D|YnDe<0bT2t0-ud6C$R(xfjRRQg ztH7OwjM7(H+kU>I{=P(ip8&4R<9M&v^p`32w2zWH2(Ox33rs|Wdof&%UuMx&s)14u z;?6y~;wRQ8Fn2zSQ=d3jP3Q+^faFOlB}@>U<3eIL~y3zBNjOCZQoWcR*kecCLQ%` za+iyxUsf>wSD{34(VW1@9v@ip&&azR3J?zkfpw1J1tS*$9G5mpHxY7&$7 zp{w0lqj?9Q?i@L`w};uanKC;P)_2eiX;1UrREO^4gGx$DYHP2vPp==5BXtdt8x4^c zs{K5MX_pNTtYng2eiA zw99h~2Z7mHJ!=eq$dMQ!BhzhG!XmE|c;FxGFYvb+Wly=JqnfXMU zPib16U>fL#P+Xi6Z8aioioHqIiuo?}Xd^hPU`QFe^HUOEOg{8nWtco9BmM=gf0E3B zx7VpfH?OB$r50dRnn5K>iCCwC1H5-(8fz69VtwV5BReWloAD7~0~Z?v0#vg{tYGPy--H^TrKEMH= z_jb}zz8N2Hvq$WWmc>=2mIX2clm8W91+6c$^r7PWs-u!au>R{?;^z`|6j;Rw)!9Ga zVA3fyyPIk1nKc%Yi%*my)Z))dJ}ofuF&~b_IAoPmbpBp04X$4MVn&>HEWl&rUz&7% zY-EH?j$;R|zwTy2)NaZ_rGcFU_%>ng_AECRE=FH`xd=3~$HkQC- zlnmD&Z+jL`Oq~Hts6>ELDv|yscJ9z=XFf_M;7Q`!;JaEL?F49wdZ9WkZ zZ3XD@o}iV-m>P!0w~OfqF-}s?NLMlPc4@WexGhu4tiU$^Ze75@!=r!=PX9jA3jpBf zcB;tHsz3}^(xArEIHFo?|Fv38!Lb?i0rg?IRkw8KH1k~u(4mWZMGIeSvg&;y z_4vn?1NwyPT$AEaa$$pzLIV#y=+NPt7NQ0=$^5k$i4Kj%>y zAwH)CT8}#3j7hy6^=dJ3tliFNUVyv_j_Lx@GZZIG!L(ET?Lj56_ex9C z#Qb#*dZ+#CMJ`biz)@M!lKWZ~7-V33`)zA?=Nn$bL_bQ?RY8w-eGM*HpIChtH$~zR zs;T8XK|lPxD5xsssvs)#f(tm11zym{ihpCilbum8&Emj2Q5y8$>qp$$vdg*Ya5RUt z95(f|G!A4J6z7Q8UrALj(+uL)uOe+mH52661Its7&4TnY*z+JmxJp8AplM}sz&N=qkY1tpgc zJ@F>ze_^vWfb86)4};GE_Ey*Hrj7XyvVdD98AqMmyH8uYMK;3S(N6$hu3Jh~3+Nq+ zVe0Lrk3Cyep=uRcf;{w#W4P~Yr+TZTtOlCVMs)Ykt2sDt1P#yMG3L(%K^KteO-$4* zPjrH;HLP>Pn8L-Ytp#juO~3W-Q#p_`h-RA$9KAKLj(7*sp-Y*>ireuBSlG%dC!iO# zBtrKKJ*d7TX0QSJ@JES#a+j%qD&H(c5!4e?k3y^6v;w>Rbvy)KqP{crl(S+okkJQS zI3ho1xDF$O`=*nm5Ang$0Ge$WrpH>X3x`6E7dvK0Qf2s1$p5 z;25|uE@3pdKj*ky{-nZGr7%%J+Jhfo_%^?elr;vg@kNNS7g^QbQV^m*1&`k3JN(<+U!cLh1_8c7C#!1azz06277Z@*6*V!wb} z@*xH~-`XoA!_!Ec_G{Qu#v38#_2!2GpE|LLDtL`0`=qc>X9T^_5Qd?@(2lTp5Rja**-g8=4aj00eQT z+Byw7bnrfai35B#-)a!`xi~O1aPhJcZ5{w>A89TwYldsrZU?O=1*IaY4pRd(>7y4n zg^swGcdORl7FdiI-WUiw2D-ccUNA~m-hh|X84Z8PcZ^bpfB)%tq8N)b*^q2-*8uT2 z_k#85dB{iT%Zw*RC;`f^Tru>&tHHMGd$Y5Xn~5O=?N~p5;zmd3p9%ez=WEEYVfOZK z=`VK!fj5=|1|6jgnw<}zr2#4$8;N7FmbMmToyNMhvs;%9^4W}_fX$w_UCK(m50u}? zy?F~#J%ZtQ%qDC0xdVMRqG4r|idqyYGJzh|4#&SwxNE0H3D`#$z*b6`tfCqv5`Ta^ zfO}~C{v0qyZ_G??cJ0Au8if{xtMwNfvYF`=tzm%Atmw)4u`Laycwgu|kN@muB|?5AJeg z!k)eqEu(2j`P0#R>ER^pM{`3WGjX`>%!&*bV`*NhwOj13<9%Om5(MfowI=yJZ{YHM zu8&kMGuAoz5_$y-mpYcyCJA8JK)^O2sl)M6Ya`wnvh3fvdOA%U!%|P^Bd_ZYBY}MM zt6cQ5iMJ`(?gFt$=Eai&Asz3oR$fse`kyL04fEH6=;uPw1gj)1@GPL3k)hh#S9Kf! zlxh!e^LxC4dNl$~RW|_YuZ2KJ>EK)Tje5B(z$6wqdI3jsuBP4oihs|hOmSnrS}L64 z(2o*-(?YJj9QssJM1+rI0f`#YTgF*Bb*(R`D@ZB?JGcb~&KLz)F6QvexS6$+X}jbA z0~@VrmU<2ko>kq8tj2SJ<=&GQedIW_YX;=#e-eoSlZn?JkO9iTgV8d$Q&Hg(E;!{3 zU0$qNla<1649(npV|kSD_BBi*5%HMT^o@bl)25$&qf;2q=`Z-Z*Ppr`V3I#XM}3Wx zh%*3y;%E=a>sLj3TbpzgEaMdDM>uq;4x8LAH=9kAd=~^`4_TQ~O z^8m}up3Rm%T|>U7X@2;;%jD^-a9@Gi;^OH__dgs4P0N}impXdC47CZ=JUO6q>d6Ij zIq_*!>tVG26L^e)iwoMC3ukp2^X5}nrbT(I%~4y0RhfzEDwWIQ;w25LZixp^mLXrN zIMXEy-z6NOeQMSS8N_jj(N7)x6b+Pxa~L+2UDQ^Dz6FKVo3y7;UKzmKaG6sL+2Ac~=`GRA(ku zeDILA0ar_d`rNadv2^NE8IqYd z%xd!EcvsXw##0fTIw7o|fYZ zKj<}WZQ28q-eE9iP%Hb>Pz`naXZe{U_`Q8eW@Abg6OnY7wP;=c*liK`WusV3qx!1?xcy#iu3-zy10MG#oGB!?4w=K%w2ycujRp~fmI+m(*-_Qu9jW7$P4K%2B z{R%*Hg&J$}eat9-rLpLJ$rM5lYBvBiV?}Sn-?x>er>)_ugiY2m!T>FR{pUtn(gmH> zfBY_@a*V@9kWU20DJCmRBL2Ju$dR#r#PL85t`}@!swN`1Y2ZPd^#xf{fq?>=aw9bX zM)}#lTZ`kdmC?!|)p)$x93w|9A|pqb$Hjx6n-dSIs1=#GcAayCwzMP-VorGU??7CT zcpnNdZxk+Xk^DOaeDRFCb%Dt!oTGLATaXx?ztIPAX!(MMXy1-ZF#r~}8W=zf^cme; z0v6VACK(|k`9M}>W-i3QgFxb}gaBtl`20VWlH(q+HkZZgg|=~PBfzNNJc1hpL-mlZ zWkBMwO~nKPy6Mtlo==mF?dvEfAG(u&^b(K%K*D*X{t4mRcJbLw<|0k-lOt!OgW#b0 zai(;#EaRRCx4?bwKS@eR*;nPACsPwbV3)7LC}q4zF9U;c$wUfh#!96zRup;szwn5r z$${0vsoWkeZw(+Sp=rVA72J14U*iy*v@U#`50xjX8E~qE;r|H+fmDs)IRXrb*g4U>Qyz9fsR!|T^y~Z~ zgA$!I(Yk05-5>U3u8RbL+MTqubrldxMoN-8@yB*bjsFO_(Vi6#28r=1e-jbB8*D(w zCSQBA_*=r`G(?DN?*k!X*Wf7pVD!LGW(@p7HI!77z`L;@SmH8j1?%(A{B+j1^0x!T zYCmYTJSo*BO-~E-UHGf$r9}a|!=fI(CsWH)zeN)q$Tu4VPoBNCE0pO{BnBe&C)+7! zlK2iLOV*@@QpoGc!|{kGE7V-bc{L3h1p&FF!)vMdH)(^3_nEckJ(`)+RjQSs&J%iX z@p^1xYepKDgfBH`Mt};cm-{R{UYQXa%SA-_LV^?IMz%sS6+d`E_Y1-}FB z8Tj2ISKfL~*#+wW?W0E7{{J1|=n}tEQSSN^6Qx&AOd=AbNvd=w#FJ2JfKE>B=X> zbZ&@%zc1=SJ?!0grMPzyqDbw37fIWPt-&fv;=4)lw|!dlY}FunolLRKlrY*Son7t~ z8Sz2_f4PQdpjT?~SlTDcUA_s=!xx&1eUObWYk%NEoFc zF(O}$33_0UR=*+DtS1s-q8U>EEtZSP&=T~}$o;$x%X>k36qJ)25bZ#d6ButkfAPHt z$`cPg&Rtps6Kl2jApuu_{bi(h`%?0GAf5Y-P2eJdd(F4A3_2xr>w5NDd#X2GKH(4T znQ7w5@mlk*S(b#i{L5nTk_0I5{kaFTljKQNIu$It6BvHg1+ik-N3PDIU2+%2tvXVz znsWZK%Gr=YsJxx!_v9A|Dt|)9E%N&Jy@~H8t^az(cL=XWx?i&hZA7`G6Ni#g&t(a_ z;WzF*C?`hmkWa_kG&wV+ss{BZrzvD88}-Y2$eSyETP(&nJY!%d3@zS-`_?$JGZb^2 zDIz<&;foQatQ}yOV{%cWtr17zZWNP_q&qK>sy(!#{Dp~QEQG2h_2g(J!O^m^B9o_3 zavS-(lQ^uzUyaML@}msP4oz$Ej{YSdohcpzaKno-aWa}sX}ZJBm z<=B?R(AWnNK^j!m_#u^-6jAv0F8_C~1*h&){F)V;quTZP$>QU9hEqUYR=&t;U!&?` zx(M~5^pK}E@84So_qdEC8cRIDBEtAnqwq_K1F+G@ar`lK6S5eX>kW zL!(Uk?ueJrG7cYZn3EvU5_mWF(4$TG1Wz`+WNz~4P}qobk(B@sE)6tOGnZ2T7QBA?gTD|4A8ED!2% z3FHBE2(Jt~>Fakwn$Kt|TC-gQI-pM(cYK|f6H{CPQb z7laBZ1{~S1^EEQL^_X<}C+6oIP^PhhduDkN!%FpU*rxjRR3z;#k|Gu4|x|L&$Qf=>nhi`Z{6!QF{EHmMbn#xr}4 zs1}*#%?qg(%vlSU-zt3Jn#}P)JNIuvJI%A;FC0Q;@nZ`w!zXXZSow6l&07`2a zP3RFX@qK!VllhJPbu_trddHgUz!J|;R8{`=;xfqN^pW@!U1rMhQHfHxp7Y+>A`ugR z%#2?3RQcl|IoJNnk7#;Yt@k{XKypD8{GSPYw*?JK7b|4`;8mkhj>=~UofZDheV}15 zC*AM+yap*Nv9$9tlCocxvm33yI{FSF`cN+zX;(~I_ckMG=ZHQq3#Qp?yu>ALNsl^w zvPCB%S_-5isNwp zWb~Lo4I&k{!98wLPf!{-Zez-u35#sW9Yy#)nMo(ezJcjq z=;AY;af}1gUrp7ixbzQs%w4@&aqU*@he4COsS0oQn6y7@$`t#!%*Q;9nE-(ju=J!> zfZ=hOmB{zB*2j0h>i(IMa>8+Iu0o{SiQS2GMT@+cDF3~l4sS+Yzx+7OLj&)lVK4xv zac?mtZB|x$0!K^*J;PtQu<~x>A99ESwp7exkjvWo$zqC5;8ocp9{krXa-1ZSmqbKu z2l;~#@Emx>7f&|StB(w1SLXclGv?|X22D{T5zoL>uQB1G3OW7~4G;+|2VhbH!O8GG zAOi`o0j_h(>xP&DPFZ<5Oeg6t)IfsLu|xt)B@2x|C_<-fzHQZ@T-5$M;}ioZ0JOKc zlA68GRg#6{e|`%=(&F0wWhqeWzygkrg@{>&WH8y=I3l=hMex7%g7`S(`)F=-GMQ}X z$+qFuT#C@v(#|R|-l4#h(Ha~;MS${j|65El>CtJxRI{*@CL6lr|x{lP^qtmA1^R>-BvpdWi2AfK$aWLY@u?SEi zK{>V0^8G;OzM&Xka3ej_X-q)zbiTBBzR8JE#-^m&i*%6oQ-QPH3cWq`C&ItIa5Z%8 z`7sZ&5HkP9N@+V&oZXi>^rl^<59(~t=7#7!a4+7r?#Fe9KGj0$*RJdCiE(h^=L|Pg zvX64i`+6-EXd71(0O+0ea_G$(%*4k*U z4?Z!i=se6`_)7N5!u3Gbk}91h^x0AB8~Q|6O}A4xmF94;_+|1vt2;KDzr!^L zY%3oH#5-R3E}LgkR&t^z_*d=S$crC8h`p0n@KP`-kyOP$XFLX29L4aufRYLM_l9CH zTLA97%A>QjVdxd##qXNd+*d+GNUq)Lh=T*;;0Lz%dDDKpO!7VfZ-KfPx{fY8e|Oy@ zoaP-q5h0rJCFeZ6qXY5!O+KA7Qwa8vu$xd{bJqN$a>JwR9 zC1K~a@I{^vg4RjDqt98j2}g=+T8>b&#+4Jsx66l1K7PD+;Z+7Z*Kmik7~SEc2UMkZzH>1De;L{TM*q*91QK+s Wa1TKMdodftdD$Fvw0LMnjQ>BhtEj^O literal 0 HcmV?d00001 diff --git a/public/static/admin/img/vip_cover.png b/public/static/admin/img/vip_cover.png new file mode 100644 index 0000000000000000000000000000000000000000..911331ef9405e2717bc4417ad22a9ca8c82dd3ac GIT binary patch literal 17587 zcmeIaXHZjJ*fyF1p(J#KP^5P$p;saFDheW92rZz3ND&c`gbvb0x(HJB5fl&*0U>mx zHx*QR2bC@@WS{sv-+c3(-{;Jk^W$YE6V_(W-fORQm+QXnYm;!z+>nlzlNJO5(HR@* zS%N^|dGd#z8bUrYdwd;5{-U{OWETJe!CC%(z@WTmNb*4nPwgw(AW%(8*qKEJdCcc# zWO)Sy3K0f@@KGSp2|)hd0Ds;&fNweke;})p0-u+H&^1(FU?Ld zBxMPPH7T;43IvJ2r9f@a{_l}{5Il%es>txaQQH5E{(rg>KQm?Nbz~8`zZyN9gIMe~9I#r#)eJkFMwo2NY4$wkt-xJ0*Q( zrkhBxqGld{d4b?jceFio7(lQ3%~FO&Fd;|N<03u#K0CfZ&Q=>4AF*y`*?bLt3TUm# zc!~GdUU6;No_6|E;E&YlBb2o9F2Oz781r`}YM(?jl_=e7Z~1ocbM^WN`pQRG7Ng?o z4`Tdc_TARZRNZvapPWc7=Xap)7HX3t!`-mHquZ zSNdU;jl=2qME2_<0CD!)li-#zz%rMO9!ydBD!Gy!Ng+D>VmA%!z5A=k%OsPvA70lz z4fWA2xsq%$t)}AnK66_YQjzlK{iea`ykF!QUzK&!9ox+QAxB8HTaOBLCz{dm%-gk^ zk-BUF@HNhU@>oc{b*lFw|~+Xzv^i45oDB!=#FA|;CIh8J<+ zyU@bmF7~xxQh4-@>2b&1Kb{3T*;LgrqBzLs%0!0%&D1})97Y2T?_T}Lq2>j5Fl~`0 zT`Z+;x^}Eger~A;tg#VD+S`ZG{QA{?n!WwE0#flZX==%I;HCT3LR%n*-XZhzCaO*= zZC->xL^k^#h(2-FW@M^%%C1cEnpnH~akAt%()Dsp24TbDhjMt?J(UVp$^z-?vG)uo zrH*XBM`kPHAN=wvP}F*e%`%*5sGEE%k%@Z;C%oa<;-jX}4t$`roI=4|Wpx`M%&k$q zJchH>SEKY6R1DVNepz+8JR|ZpXIgR{x9_#~!n5(hl(AK3qfg*9x27nkf1*y`HDcSp zAAeJ*^6Q$|eL5V6l6^z_KrF&Q!?^56@`g;x6U8f^w>?OFjvni!DtXP<6y_u{PX60) zR*FdEW0Je494-8D%$K0q;dj9o9T;52;|q#^dn@_Tqdp4k_p^#?@`pKvjyhw*xD%WT z4*Dn#8Lg@9cBL~L-{>v&X}3&zP23eYhVw@x|#RQw~17|;3-A73(*lsglP7@y-&M^r{9io zn7F5*bJtftCaM>a4%&}@iC1L@i<)=qr!^hSN#7G%Xe4s9^1RzJQp}6@1wpO7UzvL) zb-z&cy8`yqels_yWZ%tj@}Q?D2j zfu1PzRcNo3t)Cio0B?Nm`>Z)FL0f;QM8NFA!|R`7NK3o5&h7WVrdUQMDkfpIOqV38 zd!O6m3x0a}&%74q*o1%TcxW-qq5eh{04(+=&d8wD>0gJ_gmN zndEoD>(=?v(f66k$R5PtPc0za&2tfZ44>S844&En&hCJ8_E$tC%j8Qn&QBiaQ69Vx zEy}~w(+O`F!Cv)^dCSp`g3zEpLr#<~eAFHCM^XGS4T}!n&m^ohBc@={8fZQWiu)P& zl`**;2HJNYZ#7IU9S322O(xGA*nLP(1xP+0Is}WgOmY2kl5BbrBDYH;GOyBE?86R! z2fY5o(FMZihIA9_Hv)1I_c5+X_n=_PX>drBP7{L+JNQY1S#< zNj#Ewth+4P5IUn?lK7aUBLkjNcDq0}!+7%^2lg5j?RKqJnSGhbMSF(}UEkeh62+`- zY`Lk`OHFbYWzC+@u74=Kv@*f@nCYwhZz}rBB6q(EU9jGSm+%p z=U7>XzY}{gpN?@z-A;VlOt)1j!j;z`G-lz+v$6M@#Zq&NgNUlq-XCs(rlCK}brZri zA7{S#=Md=nxUIc7|wKI|lmPp%Z-ESShix|0D&R7;~t;wG4m^LGCI*_0R69dob?jpGFN&lfVq_O z)1YTy1^-LC*-S^9uA?Z(1g=L57a`@0<-uCZim~27k!a{B;g58%QW{tR1Cj9M z;FuE1v5f)b{qS+0guvPx(I!PJ%m$W|6%OW8IttK)5ZPtaO>jB zB3|#ZeJ_s7w6RPeYQpe^B|bza!SR^@g@k39Nf^Ybz1hwVi9Du6F|Lm@t9OM;SjC#F zeo8kqd~EL7+q7q_!Y&a1@!`#4t!92(g;!kcXElC$dhaMBjP>Y#etFqYq}K1Qi@;~D zm-tr==OwQj1oYob)c5S1iPqe}W)6t=oD}9JWHCPXf%e+r&^9#h?U5@j7tbfe(C)=%i` zBn)SGesrF?BS&ZMO3hx$1V=pQ(>BNgV0&+3sB}s(fzw!uAU12f^Bg zVWY^F>BL8$E#^F?rq*`Viv4720mi7FON3C79bq^H}LFzohk9hQMb==3^v@Xy)lxC+T*F zRh9PFC%*1=jdsfWu|c}sPs|-Sz+Ik~B(|CLljr%S_c7@y%v1uoktQE6)tx-zi%pzA z(M5XGhTrALLRV8=gXSmSnR)OdCyvJCboh#TxFxqQpt`KSOc$nS&}$(4_2N(VYj6A& z!Ay2ym;JlB6BvFnSu)>Oe{X!D%Eg3raXzzN{_?TYcjZAwkzILJv2!U5|X4FV{0rF|qLzww}52BkLhWYx*IE zUE8xP>S37EnIX3kbcMdUah{lUJ7Eelu9p+^h4ND_($?a+DKUOx)95Fq|YD&oN$Af}ERKS>_zIFN0Vthj9MS|{3jk@=ccw)mZP|0`_guPQ)43og@l zpb#-W6KUQkJ~dgnd-Or(?Uz-dHfSRwz6%tz0`py6oAzqx?#Tx+Vuen`{c&iMTTF1h zLjU`m56so}Cm**v9?B<)GV7}S;gjT%=a%pKT%)w6nWz!XoyWoIq4&0g^~vrUSRE3m zw9m{Wl_TD08g}tXu*vwJFa251?b@aV-0;_@D*8+EOB`5L!h5(t3`SdG@nX)Q=W6aH zeiqeV+)reEN;1d3-TLw7zUN!V^PryIaQ5=AxC1u)$2*4Fe6f)k+0l9yI}eZy%QG#J z!3cFzE+$EK+1Jb6Ei)#57u?~AgETziBAqB-ry7+I+_kL8;-_LEsWh99DwSC2W8+E< zuBCjIdi6T^BC1N8=!Dh2q@M8@rh;X=V>|Gvg9H<16B-2tft5$x&zawal4OhT?gfo+ zf=$11wN?y>TRB9_FXp)a5>|S3ds?38_s^2rFKgZ@)rqZa>C!J-InvFOce2I{5Kh;2 zJcFtK29|#Og{fvwA}N0t&XU2`x!s1-+&&qb}h*$$U{i99Siyajj{3W}kiP8`jm;4K}1q zqWW?Py^TVFUuU=R%E*POjqGem!38hDlYE9hKuuCw7$J< zHa8v%PHCAWBD+Y4JV26J0vMGidA>xjwV-7->z8FMzY+48T`gU=*MfW zjVax7B@XoyuF=FUQ&`7V6u#Xqq+K8KwPJO2a@1v-u8)MQOka)DhdkKvY`=ws3$I;R z=`Znv#OM{*{+WUQ1F6PUH%A1rb_Kp)y3n7g>|fT!ZW5oNpeE6JUas&|!$MllXx2dwF-}D$4oNJR@ZYIAji7Hpj@}Fu}3%ZB7H-Ci@ zmg9s!T9M`oynV~vnO=sFS$p>TVb4+7v#QJWj#s2Zk{BpI#+vNa#TIkP)VYlbaP$Fq z+8;A|SrjkQJk>>ht9P3Z_R?C47z?zD*?3{~V{fH8d+BN4(U?IYhYIX|M;YqA7n|f> zw{J|o?|>5a5@5DchaGa!_l-ZlYa%5Vb!@maZy!iUTtR4(VUadR4dsqm-_RsXoGb?{3JXahvih~}hPI>Kz702U zMYn61Ti;Lz(RVy>kqK;=eA|;QE}{BZXrTgyy+6P?lB9F{WqUY4d|I2?y5gj~c;K3K z`rr|w^Y&W(lfkPGS;d&}qOHucgo6|oy};nz4|9|1*Ljl$_MQcr__(Oa@3?8*!FKtX zoIJfzlMAhUU#&GP5|<|?-I+{@OUMRs`ei*-iGj$euQ78*LbYesc zm_yOn$x-LX-ZMG(IEJWcQPd$$m01KuY2d1jPmwE@jJku7Y(+7Fbz-s+E3J;SQAH;} z#ijX-WIm?KGX^c^@{yYoVt#TVZ~Mj2lpwM*g#L8~+V3Z~bjxZ3pwZu$hC6>X(y_=3 z$}>Z545ijEJ?@XEb|{eTKixPH|C0~C*&;l~2t#Elz_D|Z56l+U4I6oLKV;o5g4HK7 zGC#54tcVijHJ%0Qb$)qS0?H_p61Scx3siXV?7>Tu1HCBkg=}~R4QUU(2gknCW>BUeryWw&%3hMqwPE-Q=~&LHvV3L z_pb1Hk^HAIZ&y2qZ@& z6r?+6|8njsJc=XXG`e@r*jb?JFSQX85P(EE;~VMdr6U8S*sg?S%}bgQf-cE-;_N?U z(

NI3JPdno=08UJ*SAYFwYXKw031Biy;C$I5cO>xEsnc}2|eKJaz!Dq;|@MXG4` z3PrrR>`wLNvU`#i0_~kle>pX>osNukA9VkX6VxCkDJ8<#{zT z$F|mg2-YPqdrfNT(PipXZm)>2vJUo|g8mH8lX!%KV9_H^sHq2=gJ-$_ta2)} zk%GUXnQ`(T^FD|B$+xZKQtp_)8GEEXDPaALqN`iQP`9c9TP@@QvyI4F>h9v^c6PqPuta6e0~cAqz?|CW%nEY>e>u5F6&<_eyf&{M8TALGz+mhM zrsHfVpOr`iDh$^|4Z&a#Bf5lAp@2{bXrT@7-7_MwKLA%Tho9yytm(qC-r|7B-*u-{ zoNz3$_c$?kLv$ZUU*6^jwv%>*6EWzEsVj1@Kr4TW z{N4fJB8GJ#HxkN_XhLtpCR6NK)tF+T2K6rPlP6J~En{BmCSY`2FEXVZIsAXvdKYkUY-eY8RK( z1qYPNfwp!}i5guIxOTU4brG=_^6gzmmrm7;L=vGve!cv)bJ6t|?N#$QL|RN3nuo=! z?WAyS(2QK^Yf~kWj!!a^ou4HuM{1A$*7}YsLU0KxLnr3u01iVIMo7y{;`9Z~WWKyT zIu%m;FOU-^^ER=qLf2u5_ic7HDQ#u}T7kx=Ch`hPr59{&CN$3K7ZGdj7_0Vmke><*8X5_y&OiCwQlNZL$GFh_ z?9tQ5k{U8`+7MBZnEhkxyr@I=jp3A* zYJFZG-rnTXK(mlUK|pDMbv1tOg9?Ar`t{$8=f{k+7M3Q3@_sqR1LE^b@TrrP?&nj5 zE3-v4DeEqSRS&+`PH$|YZ(`Lw^DWG~qN>YlgD!4*fj_n|owvF#zB%U7pd9rAUlHA* zni8SRN+`O}Q;FdF!z&_f2Qvou03+eJri1M>w=Y0ZeswO|#!J2iRecTszW}XK606AQ zDAoEs#Awrd9KezDYBCb$bDapEdj_%h?WN|7$5MQzEy{P+4wCghUwi7tT8~Xbd19H* zj<#i4M*Wf^i`bN3ijUBLlQ&jn48lhH?sq!Xf9wdaQI=Qs3WcZatC8BYXjHvuT5=tj z3Qw%;a&}1+S$;y=`(sbFXvM&wziDRTH6FW)JvrkDG`I+t8E|Hc^_}C$$qDy2erI}0 z_C3=6+Dx04vo>6bAj-zi`vEK=uibo(Bt&&j-q8lmph}Fk=#r#6^5-7zo*ridJ6lI@ z=gcHqymcfH#UgDF&1~CRF~^?>gZ-q`UEpXAH*MQ!Hw^%1r1bQd49kk@#04%YPyxkd z_ScA)fjuGh7dES6fw`ZZ{+*Kb`6ETiOF3wQtHMeu#N;oTILt#f%J>fTvy8NO0cz`6 zolCoHv+ZAI-5#>TxvJ`!DKmb~sj$>BGE*?UZt-`SuF~Y`9BjFJZRM(oTTEI}Us@lv zFz4M6bK>Wf>#9zV#|DMDZJsppcPVh%iEnvu;PaK&pZ)NO_n>AEcH#VRrpw}#J71&t znz67ZZV*FYU0=9H9lA=Za+B>c$L0sajnXi(KHS%CaX@N8U?ZqYcFCql%5dTQ+=; zgFz|@Nh$QVNqKP*i6I>4uka4=ityaPjv*U(+el$*eS6!gTr4sZg}9=LGY)NCp7~IO zT@HCNN84ZLaBbSA8M*xI1w<(O2*B|oF{dV%Av1#e9AU?}$5r>3Lt&6kGLM|*K@G{O zWcrXp+cQRv2%N`&r>a+#&qSF>h0giAy`r&m0Prq~-F<=sl!&dYINaY{Y@XtpBIAe| zBxeMruwaG2@b}hFP{Q7kIhO@{bky&gExn*hUkWKC<)HQj#BnVo>6?C-f?*QGotz$$ z0NAGjT|p&C_%49O?PhN<^g4^j%3Q^1ZJ(Zm^D>k`I@@FjPxfV4I_Gd^NeDBuqTJ@T zBmf{{mp!lx7}o^~wvy4y_@e8Iq$M>8POG3!`{|;R6X5*x=xm@+Yi)qu?k5qAxgTii%xcs2UA|}=} z*y-CDP5uGKUa8}{lBTDixmn)scT(*UB>e&KORS+-U+CHxZt{!#a6f6 z+~oOhNFk`Bqu07Di`O#__uK*S`N~d>??d!&MwoBd_XEBe);Qs^P{Jiwo)?rs9bO(a zUnU@*r@m>@dQ9S9oGWmGuSf>28maSG^puUNwmGcRLgIS#9d-KfVvXSYaSAuPcDr&Y zS}Ga-iEvA+^8V>5t#^N|Nj2K?zBM91lA*E1O4c4eI@V&$|LS%2RR_&&zMER-yA#WI z2YWx8PW1DpW)03(5{OGjOCq39&(tUsLf6H?9MIEGM^3507OA#yMA+1_8Z0wZ zdc+5BP%)a$fr}AiYwX_>*wKL9?UaXJmg4QKJPranzAu_jzjuG*{4l(j*5(M26%!JU zzcCks)yGzqW{qiIEmdLdV%&=0=p&Fg9HSPg<7?Q(nEan8Me{tVvNC+9+BhS=px)?M zy;!H*)F6XbOP_=0HNT4d&dzX7(oi&7p*uRRF}TP}^{tnvlw`Cf+eU0}a-vk28r)tS zEqcAHd(?p3)Gu-R3+{L@An!c6njI2wwlO!iJt!H80C2!5ker|&zw*gFmf->J(TC3d zoy_zIN?UZ4Ij6_@$j%yjnyc%o2X@KBeG!A_UN>_DpRXOo;c%L=5e8;>?4$Fu!XquC zO?j_r-fURDEo;E&FNkQwvli8Nnp8jYhE&=jRv0no<`&ZE9&rlU%S^ zH)e_g`vYJf2TQ>b$`x2H!MPZqEDY7vl-&aI&^I1zKyDj~v~~gT^Ew#|QL?&Yo5Kj7_0Vhul4t#KpUTH&BallkN|^s1ToOx5PFm9vJrS~BozU<4U|30ZTw6|d*}PW zfU^j!9N4s;8)hvQ>YDThKAl}M$vEQbm`S*NyMGx8Zm^`n!NL(-uUQEAVRKG3+!kIq^_N5H2{uJL(hD29VCWiGXr2{|wGi zcN8(G#X-WI?jJ3+X=&ww56uzX>vmrxKrVv^|$isEtdod$#eNCHCtUa(0_Y+NT`A z@nEyaYX*R;?qV0QWdFddlBpB=_{)(TJyEyY%9GC z7@t(vK9&Ve5tRs1ROu84635W^6__jRqn1=ty`U}n+2XY-4Xb(*lUVpTdH~bD2w>M}@#NN8FvXNNZbNk%M?~&zj`$Q8wbaTF4QZuYr<5s9Kk- zS356uG&0#4K(@)r%F9-NLQ#K{KlgNb`0;2?3j^nz9Hvaw2e1^1p?`+^bbRXXYTw(J?<{=ltP*Sh4gah2g8tiT zQ=#rcG1jyALi9%Y#(oK_K&j@PxY;ar?A{jef9Pg=IMdf1SW@HukmA7l$WO&pfBxeY zyAK0|j)xyK>jpEPOnGD`?IfKF#wSM3{Zwx#`IG%MngGANX?w*u=KskQ})jIl#HwX%EPo3vlr` zK1^LWdhi^8AaKtCkJBOX`C$RhPC~^&{su#*Ov6|jH(4FG^IugQhddtGNzUH-zU}#6KMSb$WwQ}yF?0O6&lWDfLHck9n zYZnrbnwb!h5wXGx9cadxIpa{_uB?G>S!S5|%(Fv4YHbeiPSQXO&Kc73S1uFGUfcM8UNiE=Z?LQR&#Ap3@a4$7+fp=g|3sJO`fh3!&^Z7BbIpAClM1FfV zZh>e~a|YTxz*+OSU}QLsQmM}H|8`w}H*RiVibOmCqIO4=gRFaaam&*R6S$oXvX799 zs579=w-T*L_J)%~(pOwi&|OpWPe_>b3JxGa@+Z-X2q2tva+DDfaYupgudt2?;sdGQ z_l58wD6So=xH4Z;_mQM%zxb?E*3n5ooON4NEw>Qov z?#a@ey9NJAbjZ+^i_%5|9)jI+`<@vgKR$W zf76&$Q5?;2_fAT(ab9{lG_Ym8P>W2Ry11SUbqJAwk#)vivO(xxAR7evR}}bXQZ0`3 z=&bt~Pu})i<7W$VT0L!TNRpo%Dv52B94iqw{w0tO?tyV_HK-bSSz39>z$Q?PFbhNA z3T26;K2+1IP_ixX!~a!I@JO%7?}uVxES@ zgh7GhwKZH8AemGdX$FuhpJSjfflTwkCkn@|MExJPM}f(k?1?=E3K!Uq$89j3x#_#x zID^=+@rQr!jUeAUP;}v6MJX%7^1mtn&**IB-z(KVuP>`4gO11(TG{T>Ebn1~XialRZUAO58!I?8lStB}n4VvqM@ z7J$Mrx&Katn0T_m*mz({7BDtV&df3L^~%^3s(&FQ3$&cEL{j|1978Nn^1pU2ID3T5 zIB)~1E6Cvc5eOL8+};+#h_;d_(w15uNt)x85Bo@YTQ9ZYKM8qfE9FoJ)LS1|vjQ>v z8m9nJFy8MiYKt;iYjZ}D0IuYZf1jhhTDq{^bRHkWBPBXZmZSgkS_Li01+_>0e)=>I!L3lj(Z)g%0WI^xS3<3l#!bssPEz5~CzDb3OzUhl_uQ)lRB z#{i)UOgkl`%+Weq6nFF9&c6637qOpRJ3+h!I7kun1+i=h(~mnL`^e)fFT9I>mI+0( z`QaFwZs^ABS!u%CNx|4Y_E7?XBJ06DP?8KrEZyR)G*A zt6>8#v3oI%QWOc^O0PqKN7aIhA?0G2CQiyp@|y<=i*T=C%UFfe-}m`T)8KNJ;Ffu4 zLj%4{sG1ME3ihKkdyypo#jrsHiSXEQ|Px`mxpZ zye6VsxtaCT3-DyOua52Xh-aY0l|GQx^WrmVq@K`?wKNF3tt`~ovEB4SkrnLrJv0cV z6Je3+=m=p^^`9|*Xwu2hXY|=CIX0c#F!OR}A5Hra`6C6^aQO23B?_!5W+@RPtbLzv zHMQeWb9S{lf0?|HE#4dRkj@+TB2&AlI4kh$<1?0gd2yKr{BVXL=go)Bg$o<55Mk7|!9`gC=EY1ZB`Tn4*p%y-_>JM3IYT{P#pf34l56dHe3h)^zFEf&WGf5kN% zlS1!>&?hHL!SHx!PM-cV#$3AbrVm-EWqwp6w+OWi&u^r4rw34SGfK|jMKE8e&`ge; z>0C0wuuEz3@}snohZLg*7<1j<7v%{(X6X)|&hgTf=~0n=24C18-+>gpO?TKrhf*0& zgAX*l+yQZuJ0N6>rK~~?eGdN01A%dxW(6^|bv9Ol0yN>bj55*y?D4nU6{X=oC+n4b z7Axbz-iBp$?8vHMv=K6-wC-Jn-g!#tT8PFKh9XzT&U;;mP2=98quKAj%pSF;(v=-i1r4~re=1o+sh;(*CoIpwUcv3j)&aU|o&~A>tY5Rv5LI>C)|> zbhR5ssQ8z1m*bVHp$96j0%*LFt!u&lnMw6Y22OThgr{rPjh*~OL_jb&`Sb41=ZIiy zLp~Y%ik8~wR4?sVl{BiA;A>RB`4y?Yw62PQ{;NyUo1&vUH939gB;Sw(zpTpp-=aPk z?v-CR;LpeR3b=y?Z*?);MX;i|rXDu9@2n^}c|o|m-`y5V{38BFa?GGE&6AZTr8wzL zjqYFkOK!b1zKwegP5iQJ$mK+_>b_^qPUuxm&mRd+68J8#eDCaD9{M>|Jx5J4r$xw<(qhjxu|%tC!|91{_+n}MG4Tp z>k54nfqjd%??Lk$1OfJ|%fBFeQ}A-#IFL^ss|}c3_=5{fx*?oCs$JJ_D-N~6DC;4q31T0<}2qI35H_xI3>afe)&=$#!P zov=<08p6hF;yWO9J#NrbMxoWT?veIKPhzWC`o}rtR`qFu{KUMQ!apQv9{4uG2K+-M zAQ)G)(>TfPo_9%aUf(N4Wp(cV2*TwQo_Y3Odrg7uco%}KoM{kE%xeYks#zUB_3|Qe zU86{{mii4pT*K!*m^X@tI1!a5OXm(i;MXwfdG_+WIYUmEm}JLWm-Ce3b)Z*SLRpLc zt3hrd(gqBd+328~eUdMWl=*wZ`ijLOL*afA46N*oP)!(J<^JeDmun3zc7HMyn{dz} zD2`FA%gu+mU$g91uDh`&^*$RI2(bzjG>gB-+Yv?=dzv^8t3ii>rN|9MbvKX`M z32G2rP@`L{I#6UONj7-)%s(S~F{ued=q)M}f6f#AOvPx1#MaVf_(m%2!7IM(94l32 zCe_F3UllvIP>x%PvNi%N)AIy11MP9O4-0-KDpG%!Wgfzrqq0-M;Hu=n(gwEST$-fB zbn_J&7wEoBaQ>e9#qm_ND}dT7gz<2PPOd>U{v^XrotYx1`D85U)u;e^zIT-$zNosy zdS&R?UuDVB6=H^eXNkgT!lx7lU%!;^1?ROhDqb%_3f9p7; zLW&<~MXuO@W~Xo*-lndr$x?VL_6}O`Ne*35T@5>CAyJi`!uJsld{ka2ErN24TD9M^ zM|T~#q_d~JP!x*b;NpqR;Zin&^bHh7%<>W)RPo&$)hQHBEMJS2T~FO@RI#bZ1JJhZO*H&TF|OTV7s@276vp+@QnWgBu+!&tC`nB_>(CkMQzab z$^=UU&hLbBdm-2Nh(+3GjO`iZyNOWp8_diF8jfDk(P90Y*OFRR5w`AWkEW5U3tW?& z*?e4#&qhE>HvA8MpojfCT9n}@$5O-%THJE+=f&V}RkrU*OAHjtA-m*PFwXV+ScSV3 zG-TDA#AE-PLf#*b%hift8OC%t>$2d%`h=gs^J!57__vzZdOTZE_4poNxVr`F)zCu) zw^#K|^ot%Ep$D?yT`I)xOF?GXmwyU=F1^RUf+O*^174V0@DD!l+F2%5<}rJup3;>x z!z}!vKy8^9S2_O8=?QDM+0%bQ4jhFbe>WKJ#eG5jO8|1G^k(H|gaDxw;oAZ-Wn5mp zP(1{<0u4%~b?!yn)PF7)Mknl%L=u1HiF|Rzius23~l@v{~|7Xv>Oysj`02Sf`KyfcY5b*_#LhDZBe}!2=6;Z zhqwr9ka{;mMN}>0RgQ=rcudrT9F|N9hf&7Ew3xuOcb{o)gR7Ds()JT}hQaRc+$_X% z$Um5Qroe4ne5=<|Wf1sd)!>JUrny*{f7fQaIc{^gddQ z2)L9!tq{g>M49aNN?L^e4{G(EWrWbFP0Tfc)y<`z=@JkRuc2}pZ$0m|#qUJ*fUj@%ckHg*=|E^sKm?5jdV5*=FK1O1+%--2-n8~(?xvmaPS_9|D&&@BRyJs2*CZi>M z4VURk-)fzF)6sc=QOIjY*1YCmT%h5M`+@qM-z*~cwpX-wT<$00ifVaDU(MqSM$W=* z1!fVYjDxzqnRk{f75qKi%RDHacXJKDtx#9o|9q010(FyJzAmEj0d(FQe>55K=7^u^ z`*y6DmVUyseJ`%QSFLp!2?~2PyjpZE-k~v{|B)Dc;{Zy&Yvn@lr-m(yD3jq|o92b9 zml$$LzwZ~X$rc$*6pUKI&0aB7Fyw5H4mU-EG=77X=H_2RW%EPP;sO<`d{wH{G`Gy! zze<6O`{qG=jTBfe-m88Il~0~@D#tVE8dZQfnB;}=KT)o*q75kiKEJ(PlIIha>FK^i z>G_++7{w$zwUS(zT}kqtG)6fMm8mx=T-^U9=BYn-Tc+bI6*@C6zOhCLsTLRT!X#to zW7tWn5^o}DenFIZxP?1LDpX93EA!b=Yo}?=@6o-sJi5wMcU!Fxk9lQ#eU7hKNC&C? zN)anXIqagdL9b;SBM2xhUY*9e%<}eWqQXBv(^(L*&`|`dw-tZw-Od&~t(sg2wOXJ`f+t2Mns&bzLQ+R3I_SD zL>v7>t)+_JtepwsfM66iznxgak^+RzH(N)V=Uby<+P|0 z(tMsWh|=k85=XmN^l0#Nq*UVdx78oCB>Z$#4YvC38lSQ-9e*hE9SI; zJ1A4nL46h5)CI!^rg3XfLx1{Z>cQBwoAo82e@RCKr*#>0f_6{ng1b1R^totjGVE3= zs2-Hh994P&bU@i+5v6fI${MNNljx_&!*5AoUaM1|R9NOxi_i7f+w$RiO=VA~`Zzj= zQP(M2eLl{2ephkSrw@AGH{=PkgcZ&G7EYUuf5z9%{Sc(aGxZ#8{{8p?jrOKa9c;V3+0ctBc1Wzbrs7ad%rG+HW!@_mEUl1V1T!)Ra!xX|xcu=vUG2nLx>IS@$Buy9mSq zwf`dc8(galBt~t9XuNG*6tUyNs{!>(Gr)()i&Ti+CW zltUwgRKfs;H561tB}iOv!N_un>0xn_!C6H*+%A~L)ai=+6zJQhQ``4nuiuq4W_qmD zV4jqLT7pb74w^6x(ZX6LI_^pJ^~!b_BKS-f#R}u2a-u4{3}7Z6MK>}jZa{{jlNuNb zI#`ymJXL_eFq)a$Fv;pY^l#!`|CbvQLzYr1kYQkocIv;RS35cA|4p9%uaES)3!;+{ zNlBO|2@62mSlY$E{~!V336fl&kKq|2_b4r1<6&w~b0ZQmB4VfpFV4J_BU4vm$W>v5 zmyJ-i5JGV()`L7#i&x~+(qoRaD#)n8i*yvV0FawK|DHO#A}2S;%Pk&+hecE6c{xhn}q69j%7U& z`fJ9Q$?d~`*TaNkXpqol&}>1E2NiE3739~vl9K=Zi>vV!E;5@S88w&i?*%PTa(`3$ wn<$>YPnHy^P5WPq;D1K{vl96K!zK_Q`KvWfD=zY1LF6A}eRI7xI+)1+3v9zN%>V!Z literal 0 HcmV?d00001 diff --git a/public/static/admin/js/common.js b/public/static/admin/js/common.js new file mode 100644 index 00000000..4249a26c --- /dev/null +++ b/public/static/admin/js/common.js @@ -0,0 +1,79 @@ +layui.config({ + base: '/static/lib/layui/extends/' +}).extend({ + dropdown: 'dropdown' +}); + +layui.use(['jquery', 'form', 'element', 'layer', 'dropdown'], function () { + + var $ = layui.jquery; + var form = layui.form; + var layer = layui.layer; + + $.ajaxSetup({ + beforeSend: function (xhr) { + var csrfTokenKey = $('meta[name="csrf-token-key"]').attr('content'); + var csrfTokenValue = $('meta[name="csrf-token-value"]').attr('content'); + xhr.setRequestHeader('X-Csrf-Token-Key', csrfTokenKey); + xhr.setRequestHeader('X-Csrf-Token-Value', csrfTokenValue); + } + }); + + form.on('submit(go)', function (data) { + var submit = $(this); + submit.attr('disabled', true).text('提交中...'); + $.ajax({ + type: 'POST', + url: data.form.action, + data: data.field, + success: function (res) { + if (res.msg != '') { + var icon = (res.code == 0) ? 1 : 2; + layer.msg(res.msg, {icon: icon}); + } + if (res.location) { + setTimeout(function () { + window.location.href = res.location; + }, 1500); + } + submit.attr('disabled', false).text('提交'); + }, + error: function (xhr) { + var json = JSON.parse(xhr.responseText); + layer.msg(json.msg, {icon: 2}); + submit.attr('disabled', false).text('提交'); + } + }); + return false; + }); + + $('.kg-delete,.kg-restore').on('click', function () { + var url = $(this).attr('url'); + var tips = $(this).hasClass('kg-delete') ? '确定要删除吗?' : '确定要还原吗?'; + layer.confirm(tips, function () { + $.ajax({ + type: 'POST', + url: url, + success: function (res) { + layer.msg(res.msg, {icon: 1}); + if (res.location) { + setTimeout(function () { + window.location.href = res.location; + }, 1500); + } else { + window.location.reload(); + } + }, + error: function (xhr) { + var json = JSON.parse(xhr.responseText); + layer.msg(json.msg, {icon: 2}); + } + }); + }); + }); + + $('.kg-back').on('click', function () { + window.history.back(); + }); + +}); \ No newline at end of file diff --git a/public/static/admin/js/index.js b/public/static/admin/js/index.js new file mode 100644 index 00000000..838622cf --- /dev/null +++ b/public/static/admin/js/index.js @@ -0,0 +1,41 @@ +layui.use(['jquery', 'element'], function () { + + var $ = layui.jquery; + + $('.kg-nav-module > li').on('click', function () { + + var navModule = $(this).attr('nav-module'); + + $('.layui-nav-tree').each(function () { + if ($(this).attr('nav-module') == navModule) { + $(this).removeClass('layui-hide'); + var href = $(this).find('a[target=content]:first').attr('href'); + window.frames['content'].location.href = href; + } else { + $(this).addClass('layui-hide'); + } + }); + }); + + $('.kg-side-menu-bar > a').on('click', function () { + + var icon = $(this).children('.layui-icon'); + var body = $('.layui-body'); + var footer = $('.layui-footer'); + var spreadLeft = 'layui-icon-spread-left'; + var shrinkRight = 'layui-icon-shrink-right'; + + $('.layui-side').toggle(); + + if (icon.hasClass(spreadLeft)) { + icon.removeClass(spreadLeft).addClass(shrinkRight); + body.css('left', 0); + footer.css('left', 0); + } else { + icon.removeClass(shrinkRight).addClass(spreadLeft); + body.css('left', '200px'); + footer.css('left', '200px'); + } + }); + +}); diff --git a/public/static/admin/js/xm-course.js b/public/static/admin/js/xm-course.js new file mode 100644 index 00000000..7fa9e887 --- /dev/null +++ b/public/static/admin/js/xm-course.js @@ -0,0 +1,107 @@ +/** + * 挑选课程组件 + * @param array data 默认数据 + * @param string url 请求地址 + */ +function xmCourse(data, url) { + + layui.use(['jquery', 'table'], function () { + + var $ = layui.jquery; + var table = layui.table; + + var xmCourse = xmSelect.render({ + el: '#xm-course-ids', + name: 'xm_course_ids', + height: 'auto', + autoRow: true, + prop: { + name: 'title', + value: 'id', + }, + data: data, + content: ` +

+
` + }); + + table.render({ + id: 'course-table', + elem: '#course-table', + url: url, + page: true, + cols: [[ + {field: 'id', title: '编号', width: 50}, + {field: 'title', title: '标题', width: 300}, + { + field: 'model', title: '类型', width: 60, templet: function (d) { + if (d.model == 'vod') { + return '点播'; + } else if (d.model == 'live') { + return '直播'; + } else if (d.model == 'article') { + return '图文'; + } + } + }, + { + field: 'lesson_count', title: '课时数', width: 60, templet: function (d) { + return '' + d.lesson_count + ''; + } + }, + { + field: 'expiry', title: '有效期', width: 70, templet: function (d) { + if (d.expiry == '30') { + return '一个月'; + } else if (d.expiry == '90') { + return '三个月'; + } + else if (d.expiry == '180') { + return '半年'; + } else if (d.expiry == '365') { + return '一年'; + } else if (d.expiry == '1095') { + return '三年'; + } + } + }, + { + field: 'market_price', title: '市场价', width: 70, templet: function (d) { + return '¥' + d.market_price; + } + }, + { + field: 'vip_price', title: '会员价', width: 70, templet: function (d) { + return '¥' + d.vip_price; + } + }, + ]] + }); + + table.on('rowDouble(course)', function (obj) { + var item = obj.data; + var values = xmCourse.getValue(); + var has = values.find(function (i) { + return i.id === item.id; + }); + if (!has) { + xmCourse.append([item]); + } + }); + + $('#search-btn').on('click', function () { + table.reload('course-table', { + where: {title: $('#search-keyword').val()}, + page: {curr: 1} + }); + }); + + }); +}; diff --git a/public/static/lib/clipboard.min.js b/public/static/lib/clipboard.min.js new file mode 100644 index 00000000..02c549e3 --- /dev/null +++ b/public/static/lib/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v2.0.4 + * https://zenorocha.github.io/clipboard.js + * + * Licensed MIT © Zeno Rocha + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;nt?1:-1})},d=function(e){var t,n,o,i=[],a=l(e);for(t=0;t=r){var c=i.digest("hex");return void t(null,c)}var u=Math.min(r,s+1048576);E.fileSlice(e,s,u,!1,function(e){v(e,function(t){e=null,i=i.update(t,!0),o+=t.length,t=null,n&&n({loaded:o,total:r,percent:Math.round(o/r*1e4)/1e4}),a(s+1048576)})})};a(0)},x=function(e){var t,n,r,o="";for(t=0,n=e.length/2;t-1||"deleteMultipleObject"===e||"multipartList"===e||"listObjectVersions"===e){if(!n)return"Bucket";if(!r)return"Region"}else if(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e){if(!n)return"Bucket";if(!r)return"Region";if(!o)return"Key"}return!1},S=function(e,t){if(t=i({},t),"getAuth"!==e&&"getV4Auth"!==e&&"getObjectUrl"!==e){var n=t.Headers||{};if(t&&"object"==typeof t){!function(){for(var e in t)t.hasOwnProperty(e)&&e.indexOf("x-cos-")>-1&&(n[e]=t[e])}();var r={"x-cos-mfa":"MFA","Content-MD5":"ContentMD5","Content-Length":"ContentLength","Content-Type":"ContentType",Expect:"Expect",Expires:"Expires","Cache-Control":"CacheControl","Content-Disposition":"ContentDisposition","Content-Encoding":"ContentEncoding",Range:"Range","If-Modified-Since":"IfModifiedSince","If-Unmodified-Since":"IfUnmodifiedSince","If-Match":"IfMatch","If-None-Match":"IfNoneMatch","x-cos-copy-source":"CopySource","x-cos-copy-source-Range":"CopySourceRange","x-cos-metadata-directive":"MetadataDirective","x-cos-copy-source-If-Modified-Since":"CopySourceIfModifiedSince","x-cos-copy-source-If-Unmodified-Since":"CopySourceIfUnmodifiedSince","x-cos-copy-source-If-Match":"CopySourceIfMatch","x-cos-copy-source-If-None-Match":"CopySourceIfNoneMatch","x-cos-acl":"ACL","x-cos-grant-read":"GrantRead","x-cos-grant-write":"GrantWrite","x-cos-grant-full-control":"GrantFullControl","x-cos-grant-read-acp":"GrantReadAcp","x-cos-grant-write-acp":"GrantWriteAcp","x-cos-storage-class":"StorageClass","x-cos-server-side-encryption-customer-algorithm":"SSECustomerAlgorithm","x-cos-server-side-encryption-customer-key":"SSECustomerKey","x-cos-server-side-encryption-customer-key-MD5":"SSECustomerKeyMD5","x-cos-server-side-encryption":"ServerSideEncryption","x-cos-server-side-encryption-cos-kms-key-id":"SSEKMSKeyId","x-cos-server-side-encryption-context":"SSEContext"};E.each(r,function(e,r){void 0!==t[e]&&(n[r]=t[e])}),t.Headers=y(n)}}return t},T=function(e,t){return function(n,r){"function"==typeof n&&(r=n,n={}),n=S(e,n);var o=function(e){return e&&e.headers&&(e.headers["x-cos-version-id"]&&(e.VersionId=e.headers["x-cos-version-id"]),e.headers["x-cos-delete-marker"]&&(e.DeleteMarker=e.headers["x-cos-delete-marker"])),e},i=function(e,t){r&&r(o(e),o(t))};if("getService"!==e&&"abortUploadTask"!==e){var a;if(a=k(e,n))return void i({error:"missing param "+a});if(n.Region){if(n.Region.indexOf("cos.")>-1)return void i({error:'param Region should not be start with "cos."'});if(!/^([a-z\d-]+)$/.test(n.Region))return void i({error:"Region format error."});this.options.CompatibilityMode||-1!==n.Region.indexOf("-")||"yfb"===n.Region||"default"===n.Region||console.warn("warning: param Region format error, find help here: https://cloud.tencent.com/document/product/436/6224")}if(n.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(n.Bucket))if(n.AppId)n.Bucket=n.Bucket+"-"+n.AppId;else{if(!this.options.AppId)return void i({error:'Bucket should format as "test-1250000000".'});n.Bucket=n.Bucket+"-"+this.options.AppId}n.AppId&&(console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'),delete n.AppId)}!this.options.UseRawKey&&n.Key&&"/"===n.Key.substr(0,1)&&(n.Key=n.Key.substr(1))}var s=t.call(this,n,i);if("getAuth"===e||"getObjectUrl"===e)return s}},w=function(e,t){function n(){if(o=0,t&&"function"==typeof t){r=Date.now();var n,i=Math.max(0,Math.round((s-a)/((r-c)/1e3)*100)/100);n=0===s&&0===e?1:Math.round(s/e*100)/100||0,c=r,a=s;try{t({loaded:s,total:e,speed:i,percent:n})}catch(e){}}}var r,o,i=this,a=0,s=0,c=Date.now();return function(t,r){if(t&&(s=t.loaded,e=t.total),r)clearTimeout(o),n();else{if(o)return;o=setTimeout(n,i.options.ProgressInterval)}}},R=function(e,t,n){var r;if("string"==typeof t.Body&&(t.Body=new Blob([t.Body],{type:"text/plain"})),!t.Body||!(t.Body instanceof Blob||"[object File]"===t.Body.toString()||"[object Blob]"===t.Body.toString()))return void n({error:"params body format error, Only allow File|Blob|String."});r=t.Body.size,t.ContentLength=r,n(null,r)},A=function(e){return Date.now()+(e||0)},E={noop:m,formatParams:S,apiWrapper:T,xml2json:p,json2xml:h,md5:d,clearKey:y,getFileMd5:C,binaryBase64:x,extend:i,isArray:a,isInArray:s,each:c,map:u,filter:l,clone:o,uuid:b,camSafeUrlEncode:r,throttleOnProgress:w,getFileSize:R,getSkewTime:A,getAuth:g,isBrowser:!0},B=function(){var e=function(e,t){e=e.split("."),t=t.split(".");for(var n=0;nparseInt(t[n])?1:-1;return 0};return function(t){var n=(t.match(/Chrome\/([.\d]+)/)||[])[1],r=(t.match(/QBCore\/([.\d]+)/)||[])[1],o=(t.match(/QQBrowser\/([.\d]+)/)||[])[1];return n&&e(n,"53.0.2785.116")<0&&r&&e(r,"3.53.991.400")<0&&o&&e(o,"9.0.2524.400")<=0||!1}(navigator&&navigator.userAgent)}();E.fileSlice=function(e,t,n,r,o){var i;if(e.slice?i=e.slice(t,n):e.mozSlice?i=e.mozSlice(t,n):e.webkitSlice&&(i=e.webkitSlice(t,n)),r&&B){var a=new FileReader;a.onload=function(e){i=null,o(new Blob([a.result]))},a.readAsArrayBuffer(i)}else o(i)},E.getFileUUID=function(e,t){return e.name&&e.size&&e.lastModifiedDate&&t?E.md5([e.name,e.size,e.lastModifiedDate,t].join("::")):null},E.getBodyMd5=function(e,t,n,r){n=n||m,e?"string"==typeof t?n(E.md5(t,!0)):Blob&&t instanceof Blob?E.getFileMd5(t,function(e,t){n(t)},r):n():n()},e.exports=E},function(e,t){function n(e,t){for(var n in e)t[n]=e[n]}function r(e,t){function r(){}var o=e.prototype;if(Object.create){var i=Object.create(t.prototype);o.__proto__=i}o instanceof t||(r.prototype=t.prototype,r=new r,n(o,r),e.prototype=o=r),o.constructor!=e&&("function"!=typeof e&&console.error("unknow Class:"+e),o.constructor=e)}function o(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,oe[e]),this.message=oe[e],Error.captureStackTrace&&Error.captureStackTrace(this,o);return n.code=e,t&&(this.message=this.message+": "+t),n}function i(){}function a(e,t){this._node=e,this._refresh=t,s(this)}function s(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var r=e._refresh(e._node);F(e,"length",r.length),n(r,e),e._inc=t}}function c(){}function u(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function l(e,t,n,r){if(r?t[u(t,r)]=n:t[t.length++]=n,e){n.ownerElement=e;var o=e.ownerDocument;o&&(r&&v(o,e,r),y(o,e,n))}}function d(e,t,n){var r=u(t,n);if(!(r>=0))throw o(ae,new Error(e.tagName+"@"+n));for(var i=t.length-1;r"==e&&">"||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function g(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(g(e,t))return!0}while(e=e.nextSibling)}function m(){}function y(e,t,n){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&(t._nsMap[n.prefix?n.localName:""]=n.value)}function v(e,t,n,r){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&delete t._nsMap[n.prefix?n.localName:""]}function C(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var o=t.firstChild,i=0;o;)r[i++]=o,o=o.nextSibling;r.length=i}}}function x(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,C(e.ownerDocument,e),t}function b(e,t,n){var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===te){var o=t.firstChild;if(null==o)return t;var i=t.lastChild}else o=i=t;var a=n?n.previousSibling:e.lastChild;o.previousSibling=a,i.nextSibling=n,a?a.nextSibling=o:e.firstChild=o,null==n?e.lastChild=i:n.previousSibling=i;do{o.parentNode=e}while(o!==i&&(o=o.nextSibling));return C(e.ownerDocument||e,e),t.nodeType==te&&(t.firstChild=t.lastChild=null),t}function k(e,t){var n=t.parentNode;if(n){var r=e.lastChild;n.removeChild(t);var r=e.lastChild}var r=e.lastChild;return t.parentNode=e,t.previousSibling=r,t.nextSibling=null,r?r.nextSibling=t:e.firstChild=t,e.lastChild=t,C(e.ownerDocument,e,t),t}function S(){this._nsMap={}}function T(){}function w(){}function R(){}function A(){}function E(){}function B(){}function N(){}function _(){}function P(){}function D(){}function I(){}function O(){}function M(e,t){var n=[],r=9==this.nodeType?this.documentElement:this,o=r.prefix,i=r.namespaceURI;if(i&&null==o){var o=r.lookupPrefix(i);if(null==o)var a=[{namespace:i,prefix:null}]}return j(this,n,e,t,a),n.join("")}function L(e,t,n){var r=e.prefix||"",o=e.namespaceURI;if(!r&&!o)return!1;if("xml"===r&&"http://www.w3.org/XML/1998/namespace"===o||"http://www.w3.org/2000/xmlns/"==o)return!1;for(var i=n.length;i--;){var a=n[i];if(a.prefix==r)return a.namespace!=o}return!0}function j(e,t,n,r,o){if(r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case G:o||(o=[]);var i=(o.length,e.attributes),a=i.length,s=e.firstChild,c=e.tagName;n=z===e.namespaceURI||n,t.push("<",c);for(var u=0;u"),n&&/^script$/i.test(c))for(;s;)s.data?t.push(s.data):j(s,t,n,r,o),s=s.nextSibling;else for(;s;)j(s,t,n,r,o),s=s.nextSibling;t.push("")}else t.push("/>");return;case Z:case te:for(var s=e.firstChild;s;)j(s,t,n,r,o),s=s.nextSibling;return;case V:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,h),'"');case X:return t.push(e.data.replace(/[<&]/g,h));case W:return t.push("");case Y:return t.push("\x3c!--",e.data,"--\x3e");case ee:var g=e.publicId,m=e.systemId;if(t.push("');else if(m&&"."!=m)t.push(' SYSTEM "',m,'">');else{var y=e.internalSubset;y&&t.push(" [",y,"]"),t.push(">")}return;case J:return t.push("");case $:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function U(e,t,n){var r;switch(t.nodeType){case G:r=t.cloneNode(!1),r.ownerDocument=e;case te:break;case V:n=!0}if(r||(r=t.cloneNode(!1)),r.ownerDocument=e,r.parentNode=null,n)for(var o=t.firstChild;o;)r.appendChild(U(e,o,n)),o=o.nextSibling;return r}function H(e,t,n){var r=new t.constructor;for(var o in t){var a=t[o];"object"!=typeof a&&a!=r[o]&&(r[o]=a)}switch(t.childNodes&&(r.childNodes=new i),r.ownerDocument=e,r.nodeType){case G:var s=t.attributes,u=r.attributes=new c,l=s.length;u._ownerElement=r;for(var d=0;d0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var r in n)if(n[r]==e)return r;t=t.nodeType==V?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==V?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},n(q,p),n(q,p.prototype),m.prototype={nodeName:"#document",nodeType:Z,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==te){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return null==this.documentElement&&e.nodeType==G&&(this.documentElement=e),b(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),x(this,e)},importNode:function(e,t){return U(this,e,t)},getElementById:function(e){var t=null;return g(this.documentElement,function(n){if(n.nodeType==G&&n.getAttribute("id")==e)return t=n,!0}),t},createElement:function(e){var t=new S;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new i,(t.attributes=new c)._ownerElement=t,t},createDocumentFragment:function(){var e=new D;return e.ownerDocument=this,e.childNodes=new i,e},createTextNode:function(e){var t=new R;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new A;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new E;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new I;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new T;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new P;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new S,r=t.split(":"),o=n.attributes=new c;return n.childNodes=new i,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,o._ownerElement=n,n},createAttributeNS:function(e,t){var n=new T,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},r(m,p),S.prototype={nodeType:G,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===te?this.insertBefore(e,null):k(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new a(this,function(t){var n=[];return g(t,function(r){r===t||r.nodeType!=G||"*"!==e&&r.tagName!=e||n.push(r)}),n})},getElementsByTagNameNS:function(e,t){return new a(this,function(n){var r=[];return g(n,function(o){o===n||o.nodeType!==G||"*"!==e&&o.namespaceURI!==e||"*"!==t&&o.localName!=t||r.push(o)}),r})}},m.prototype.getElementsByTagName=S.prototype.getElementsByTagName,m.prototype.getElementsByTagNameNS=S.prototype.getElementsByTagNameNS,r(S,p),T.prototype.nodeType=V,r(T,p),w.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(oe[ie])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},r(w,p),R.prototype={nodeName:"#text",nodeType:X,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},r(R,w),A.prototype={nodeName:"#comment",nodeType:Y},r(A,w),E.prototype={nodeName:"#cdata-section",nodeType:W},r(E,w),B.prototype.nodeType=ee,r(B,p),N.prototype.nodeType=ne,r(N,p),_.prototype.nodeType=Q,r(_,p),P.prototype.nodeType=$,r(P,p),D.prototype.nodeName="#document-fragment",D.prototype.nodeType=te,r(D,p),I.prototype.nodeType=J,r(I,p),O.prototype.serializeToString=function(e,t,n){return M.call(e,t,n)},p.prototype.toString=M;try{Object.defineProperty&&(Object.defineProperty(a.prototype,"length",{get:function(){return s(this),this.$$length}}),Object.defineProperty(p.prototype,"textContent",{get:function(){return K(this)},set:function(e){switch(this.nodeType){case G:case te:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),F=function(e,t,n){e["$$"+t]=n})}catch(e){}t.DOMImplementation=f,t.XMLSerializer=O},function(e,t){var n=function(e){var t={},n=function(e){return!t[e]&&(t[e]=[]),t[e]};e.on=function(e,t){"task-list-update"===e&&console.warn('warning: Event "'+e+'" has been deprecated. Please use "list-update" instead.'),n(e).push(t)},e.off=function(e,t){for(var r=n(e),o=r.length-1;o>=0;o--)t===r[o]&&r.splice(o,1)},e.emit=function(e,t){for(var r=n(e).map(function(e){return e}),o=0;o>>32-o,n)}function o(e,t,n,o,i,a,s){return r(t&n|~t&o,e,t,i,a,s)}function i(e,t,n,o,i,a,s){return r(t&o|n&~o,e,t,i,a,s)}function a(e,t,n,o,i,a,s){return r(t^n^o,e,t,i,a,s)}function s(e,t,n,o,i,a,s){return r(n^(t|~o),e,t,i,a,s)}function c(e){var t,r=e.length,o=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)n(o,l(e.substring(t-64,t)));e=e.substring(t-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(o,i),t=0;t<16;t++)i[t]=0;return i[14]=8*r,n(o,i),o}function u(){var e={};return e.state=[1732584193,-271733879,-1732584194,271733878],e.tail="",e.size=0,e.update=function(t,r){r||(t=p(t)),e.size+=t.length,t=e.tail+t;var o,i=e.state;for(o=64;o<=t.length;o+=64)n(i,l(t.substring(o-64,o)));return e.tail=t.substring(o-64),e},e.digest=function(t){var r,o=e.size,i=e.state,a=e.tail,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r>2]|=a.charCodeAt(r)<<(r%4<<3);if(s[r>>2]|=128<<(r%4<<3),r>55)for(n(i,s),r=0;r<16;r++)s[r]=0;return s[14]=8*o,n(i,s),"hex"===t?f(i):"base64"===t?g(f(i)):i},e}function l(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function d(e){for(var t="",n=0;n<4;n++)t+=m[e>>8*n+4&15]+m[e>>8*n&15];return t}function f(e){for(var t=0;t127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}function h(e,t){return t||(e=p(e)),f(c(e))}var g=function(e){var t,n,r,o="";for(t=0,n=e.length/2;t>16)+(t>>16)+(n>>16)<<16|65535&n}),h.getCtx=u,e.exports=h},function(e,t,n){var r=r||function(e,t){var n={},r=n.lib={},o=function(){},i=r.Base={extend:function(e){o.prototype=this;var t=new o;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=void 0!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes;if(e=e.sigBytes,this.clamp(),r%4)for(var o=0;o>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(r+o)%4*8;else if(65535>>2]=n[o>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},u=s.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new a.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},d=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i),s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0);if(t=s*i,o=e.min(4*t,o),t){for(var c=0;cu;u++){if(16>u)i[u]=0|e[t+u];else{var l=i[u-3]^i[u-8]^i[u-14]^i[u-16];i[u]=l<<1|l>>>31}l=(r<<5|r>>>27)+c+i[u],l=20>u?l+(1518500249+(o&a|~o&s)):40>u?l+(1859775393+(o^a^s)):60>u?l+((o&a|o&s|a&s)-1894007588):l+((o^a^s)-899497514),c=s,s=a,a=o<<30|o>>>2,o=r,r=l}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=o._createHelper(t),e.HmacSHA1=o._createHmacHelper(t)}(),function(){var e=r,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,o=4*r;n.sigBytes>o&&(n=e.finalize(n)),n.clamp();for(var i=this._oKey=n.clone(),a=this._iKey=n.clone(),s=i.words,c=a.words,u=0;u>>2]>>>24-i%4*8&255,s=t[i+1>>>2]>>>24-(i+1)%4*8&255,c=t[i+2>>>2]>>>24-(i+2)%4*8&255,u=a<<16|s<<8|c,l=0;l<4&&i+.75*l>>6*(3-l)&63));var d=r.charAt(64);if(d)for(;o.length%4;)o.push(d);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=r.charAt(64);if(o){var i=e.indexOf(o);-1!=i&&(t=i)}for(var a=[],s=0,c=0;c>>6-c%4*2;a[s>>>2]|=(u|l)<<24-s%4*8,s++}return n.create(a,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.exports=r},function(e,t,n){var r=n(8).DOMParser,o=function(){this.version="1.3.5";var e={mergeCDATA:!0,normalize:!0,stripElemPrefix:!0},t=new RegExp(/(?!xmlns)^.*:/);new RegExp(/^\s+|\s+$/g);return this.grokType=function(e){return/^\s*$/.test(e)?null:/^(?:true|false)$/i.test(e)?"true"===e.toLowerCase():isFinite(e)?parseFloat(e):e},this.parseString=function(e,t){if(e){var n=this.stringToXML(e);return n.getElementsByTagName("parsererror").length?null:this.parseXML(n,t)}return null},this.parseXML=function(n,r){for(var i in r)e[i]=r[i];var a={},s=0,c="";if(n.childNodes.length)for(var u,l,d,f=0;f=t+n||t?new java.lang.String(e,t,n)+"":e}function u(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}r.prototype.parseFromString=function(e,t){var n=this.options,r=new l,a=n.domBuilder||new i,s=n.errorHandler,c=n.locator,u=n.xmlns||{},d={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return c&&a.setDocumentLocator(c),r.errorHandler=o(s,a,c),r.domBuilder=n.domBuilder||a,/\/x?html?$/.test(t)&&(d.nbsp="\xa0",d.copy="\xa9",u[""]="http://www.w3.org/1999/xhtml"),u.xml=u.xml||"http://www.w3.org/XML/1998/namespace",e?r.parse(e,u,d):r.errorHandler.error("invalid doc source"),a.doc},i.prototype={startDocument:function(){this.doc=(new d).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var o=this.doc,i=o.createElementNS(e,n||t),s=r.length;u(this,i),this.currentElement=i,this.locator&&a(this.locator,i);for(var c=0;c65535){e-=65536;var t=55296+(e>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function h(e){var t=e.slice(1,-1);return t in n?n[t]:"#"===t.charAt(0)?p(parseInt(t.substr(1).replace("x","0x"))):(u.error("entity not found:"+e),e)}function g(t){if(t>S){var n=e.substring(S,t).replace(/&#?\w+;/g,h);x&&m(S),r.characters(n,0,t-S),S=t}}function m(t,n){for(;t>=v&&(n=C.exec(e));)y=n.index,v=y+n[0].length,x.lineNumber++;x.columnNumber=t-y+1}for(var y=0,v=0,C=/.*(?:\r\n?|\n)|.*$/g,x=r.locator,b=[{currentNSMap:t}],k={},S=0;;){try{var T=e.indexOf("<",S);if(T<0){if(!e.substr(S).match(/^\s*$/)){var w=r.doc,R=w.createTextNode(e.substr(S));w.appendChild(R),r.currentElement=R}return}switch(T>S&&g(T),e.charAt(T+1)){case"/":var A=e.indexOf(">",T+3),E=e.substring(T+2,A),B=b.pop();A<0?(E=e.substring(T+2).replace(/[\s<].*/,""),u.error("end tag name: "+E+" is not complete:"+B.tagName),A=T+1+E.length):E.match(/\sS?S=A:g(Math.max(T,S)+1)}}function o(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function i(e,t,n,r,o,i){for(var a,s,c=++t,u=v;;){var l=e.charAt(c);switch(l){case"=":if(u===C)a=e.slice(t,c),u=b;else{if(u!==x)throw new Error("attribute equal must after attrName");u=b}break;case"'":case'"':if(u===b||u===C){if(u===C&&(i.warning('attribute value must after "="'),a=e.slice(t,c)),t=c+1,!((c=e.indexOf(l,t))>0))throw new Error("attribute value no end '"+l+"' match");s=e.slice(t,c).replace(/&#?\w+;/g,o),n.add(a,s,t-1),u=S}else{if(u!=k)throw new Error('attribute value must after "="');s=e.slice(t,c).replace(/&#?\w+;/g,o),n.add(a,s,t),i.warning('attribute "'+a+'" missed start quot('+l+")!!"),t=c+1,u=S}break;case"/":switch(u){case v:n.setTagName(e.slice(t,c));case S:case T:case w:u=w,n.closed=!0;case k:case C:case x:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),u==v&&n.setTagName(e.slice(t,c)),c;case">":switch(u){case v:n.setTagName(e.slice(t,c));case S:case T:case w:break;case k:case C:s=e.slice(t,c),"/"===s.slice(-1)&&(n.closed=!0,s=s.slice(0,-1));case x:u===x&&(s=a),u==k?(i.warning('attribute "'+s+'" missed quot(")!!'),n.add(a,s.replace(/&#?\w+;/g,o),t)):("http://www.w3.org/1999/xhtml"===r[""]&&s.match(/^(?:disabled|checked|selected)$/i)||i.warning('attribute "'+s+'" missed value!! "'+s+'" instead!!'),n.add(s,s,t));break;case b:throw new Error("attribute value missed!!")}return c;case"\x80":l=" ";default:if(l<=" ")switch(u){case v:n.setTagName(e.slice(t,c)),u=T;break;case C:a=e.slice(t,c),u=x;break;case k:var s=e.slice(t,c).replace(/&#?\w+;/g,o);i.warning('attribute "'+s+'" missed quot(")!!'),n.add(a,s,t);case S:u=T}else switch(u){case x:n.tagName;"http://www.w3.org/1999/xhtml"===r[""]&&a.match(/^(?:disabled|checked|selected)$/i)||i.warning('attribute "'+a+'" missed value!! "'+a+'" instead2!!'),n.add(a,a,t),t=c,u=C;break;case S:i.warning('attribute space is required"'+a+'"!!');case T:u=C,t=c;break;case b:u=k,t=c;break;case w:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function a(e,t,n){for(var r=e.tagName,o=null,i=e.length;i--;){var a=e[i],s=a.qName,c=a.value,l=s.indexOf(":");if(l>0)var d=a.prefix=s.slice(0,l),f=s.slice(l+1),p="xmlns"===d&&f;else f=s,d=null,p="xmlns"===s&&"";a.localName=f,!1!==p&&(null==o&&(o={},u(n,n={})),n[p]=o[p]=c,a.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(p,c))}for(var i=e.length;i--;){a=e[i];var d=a.prefix;d&&("xml"===d&&(a.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==d&&(a.uri=n[d||""]))}var l=r.indexOf(":");l>0?(d=e.prefix=r.slice(0,l),f=e.localName=r.slice(l+1)):(d=null,f=e.localName=r);var h=e.uri=n[d||""];if(t.startElement(h,f,r,e),!e.closed)return e.currentNSMap=n,e.localNSMap=o,!0;if(t.endElement(h,f,r),o)for(d in o)t.endPrefixMapping(d)}function s(e,t,n,r,o){if(/^(?:script|textarea)$/i.test(n)){var i=e.indexOf("",t),a=e.substring(t+1,i);if(/[&<]/.test(a))return/^script$/i.test(n)?(o.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,r),o.characters(a,0,a.length),i)}return t+1}function c(e,t,n,r){var o=r[n];return null==o&&(o=e.lastIndexOf(""),ot?(n.comment(e,t+4,o-t-4),o+3):(r.error("Unclosed comment"),-1)}return-1;default:if("CDATA["==e.substr(t+3,6)){var o=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,o-t-9),n.endCDATA(),o+3}var i=h(e,t),a=i.length;if(a>1&&/!doctype/i.test(i[0][0])){var s=i[1][0],c=a>3&&/^public$/i.test(i[2][0])&&i[3][0],u=a>4&&i[4][0],l=i[a-1];return n.startDTD(s,c&&c.replace(/^(['"])(.*?)\1$/,"$2"),u&&u.replace(/^(['"])(.*?)\1$/,"$2")),n.endDTD(),l.index+l[0].length}}return-1}function d(e,t,n){var r=e.indexOf("?>",t);if(r){var o=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(o){o[0].length;return n.processingInstruction(o[1],o[2]),r+2}return-1}return-1}function f(e){}function p(e,t){return e.__proto__=t,e}function h(e,t){var n,r=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(o.lastIndex=t,o.exec(e);n=o.exec(e);)if(r.push(n),n[1])return r}var g=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,m=new RegExp("[\\-\\.0-9"+g.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),y=new RegExp("^"+g.source+m.source+"*(?::"+g.source+m.source+"*)?$"),v=0,C=1,x=2,b=3,k=4,S=5,T=6,w=7;n.prototype={parse:function(e,t,n){var o=this.domBuilder;o.startDocument(),u(t,t={}),r(e,t,n,o,this.errorHandler),o.endDocument()}},f.prototype={setTagName:function(e){if(!y.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},add:function(e,t,n){if(!y.test(e))throw new Error("invalid attribute:"+e);this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},p({},p.prototype)instanceof p||(p=function(e,t){function n(){}n.prototype=t,n=new n;for(t in e)n[t]=e[t];return n}),t.XMLReader=n},function(e,t){function n(e){return(""+e).replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(o,"")}var r=new RegExp("^([^a-zA-Z_\xc0-\xd6\xd8-\xf6\xf8-\xff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fff\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd])|^((x|X)(m|M)(l|L))|([^a-zA-Z_\xc0-\xd6\xd8-\xf6\xf8-\xff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fff\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd-.0-9\xb7\u0300-\u036f\u203f\u2040])","g"),o=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,i=function(e){var t=[];if(e instanceof Object)for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},a=function(e,t){var o=function(e,n,o,i,a){var s=void 0!==t.indent?t.indent:"\t",c=t.prettyPrint?"\n"+new Array(i).join(s):"";t.removeIllegalNameCharacters&&(e=e.replace(r,"_"));var u=[c,"<",e,o||""];return n&&n.length>0?(u.push(">"),u.push(n),a&&u.push(c),u.push("")):u.push("/>"),u.join("")};return function e(r,a,s){var c=typeof r;switch((Array.isArray?Array.isArray(r):r instanceof Array)?c="array":r instanceof Date&&(c="date"),c){case"array":var u=[];return r.map(function(t){u.push(e(t,1,s+1))}),t.prettyPrint&&u.push("\n"),u.join("");case"date":return r.toJSON?r.toJSON():r+"";case"object":var l=[];for(var d in r)if(r.hasOwnProperty(d))if(r[d]instanceof Array)for(var f=0;f0&&l.push("\n"),l.join("");case"function":return r();default:return t.escape?n(r):""+r}}(e,0,0)},s=function(e){var t=['"),t.join("")};e.exports=function(e,t){if(t||(t={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" ",escape:!0}),"string"==typeof e)try{e=JSON.parse(e.toString())}catch(e){return!1}var n="",r="";return t&&("object"==typeof t?(t.xmlHeader&&(n=s(!!t.xmlHeader.standalone)),void 0!==t.docType&&(r="")):n=s()),t=t||{},[n,t.prettyPrint&&r?"\n":"",r,a(e,t)].join("").replace(/\n{2,}/g,"\n").replace(/\s+$/g,"")}},function(e,t,n){var r=n(0),o={},i=function(e,t){o[t]=e[t],e[t]=function(e,n){e.SkipTask?o[t].call(this,e,n):this._addTask(t,e,n)}},a=function(e){var t=[],n={},i=0,a=0,s=function(e){var t={id:e.id,Bucket:e.Bucket,Region:e.Region,Key:e.Key,FilePath:e.FilePath,state:e.state,loaded:e.loaded,size:e.size,speed:e.speed,percent:e.percent,hashPercent:e.hashPercent,error:e.error};return e.FilePath&&(t.FilePath=e.FilePath),e._custom&&(t._custom=e._custom),t},c=function(){var n,o=function(){n=0,e.emit("task-list-update",{list:r.map(t,s)}),e.emit("list-update",{list:r.map(t,s)})};return function(){n||(n=setTimeout(o))}}(),u=function(){if(!(t.length<=e.options.UploadQueueSize)){for(var r=0;re.options.UploadQueueSize;){var o="waiting"===t[r].state||"checking"===t[r].state||"uploading"===t[r].state;t[r]&&o?r++:(n[t[r].id]&&delete n[t[r].id],t.splice(r,1),a--)}c()}},l=function(){if(a/gi,"<$1Rule>"),r=r.replace(/<(\/?)Tags>/gi,"<$1Tag>");var o=e.Headers;o["Content-Type"]="application/xml",o["Content-MD5"]=te.binaryBase64(te.md5(r)),J.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"replication",headers:o},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})}function T(e,t){J.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"ReplicationConfigurationnotFoundError"!==e.error.Code)t(e);else{var r={ReplicationConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else e||!n.ReplicationConfiguration&&(n.ReplicationConfiguration={}),n.ReplicationConfiguration.Rule&&(n.ReplicationConfiguration.Rules=n.ReplicationConfiguration.Rule,delete n.ReplicationConfiguration.Rule),t(e,n)})}function w(e,t){J.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})}function R(e,t){J.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},function(n,r){if(n){var o=n.statusCode;return e.Headers["If-Modified-Since"]&&o&&304===o?t(null,{NotModified:!0,statusCode:o}):t(n)}r.headers&&r.headers.etag&&(r.ETag=r.headers&&r.headers.etag),t(null,r)})}function A(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n["key-marker"]=e.KeyMarker,n["version-id-marker"]=e.VersionIdMarker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,J.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"versions"},function(e,n){if(e)return t(e);var r=n.ListVersionsResult||{},o=r.DeleteMarker||[];o=te.isArray(o)?o:[o];var i=r.Version||[];i=te.isArray(i)?i:[i];var a=te.clone(r);delete a.DeleteMarker,delete a.Version,te.extend(a,{DeleteMarkers:o,Versions:i,statusCode:n.statusCode,headers:n.headers}),t(null,a)})}function E(e,t){var n={};n["response-content-type"]=e.ResponseContentType,n["response-content-language"]=e.ResponseContentLanguage,n["response-expires"]=e.ResponseExpires,n["response-cache-control"]=e.ResponseCacheControl,n["response-content-disposition"]=e.ResponseContentDisposition,n["response-content-encoding"]=e.ResponseContentEncoding,J.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,qs:n,rawBody:!0},function(n,r){if(n){var o=n.statusCode;return e.Headers["If-Modified-Since"]&&o&&304===o?t(null,{NotModified:!0}):t(n)}var i={};i.Body=r.body,r.headers&&r.headers.etag&&(i.ETag=r.headers&&r.headers.etag),te.extend(i,{statusCode:r.statusCode,headers:r.headers}),t(null,i)})}function B(e,t){var n=this,r=e.ContentLength,o=te.throttleOnProgress.call(n,r,e.onProgress),i=e.Headers;!i["Cache-Control"]&&(i["Cache-Control"]="");var a=i["Content-Type"]||e.Body&&e.Body.type;!i["Content-Type"]&&a&&(i["Content-Type"]=a);var s=e.UploadAddMetaMd5||n.options.UploadAddMetaMd5||n.options.UploadCheckContentMd5;te.getBodyMd5(s,e.Body,function(i){i&&(n.options.UploadCheckContentMd5&&(e.Headers["Content-MD5"]=te.binaryBase64(i)),(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5)&&(e.Headers["x-cos-meta-md5"]=i)),void 0!==e.ContentLength&&(e.Headers["Content-Length"]=e.ContentLength),o(null,!0),J.call(n,{Action:"name/cos:PutObject",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,body:e.Body,onProgress:o},function(i,a){if(i)return o(null,!0),t(i);if(o({loaded:r,total:r},!0),a){var s=W({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key});s=s.substr(s.indexOf("://")+3);var c={Location:s,statusCode:a.statusCode,headers:a.headers};return a.headers&&a.headers.etag&&(c.ETag=a.headers.etag),t(null,c)}t(null,a)})},e.onHashProgress)}function N(e,t){J.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,VersionId:e.VersionId},function(e,n){if(e){var r=e.statusCode;return r&&204===r?t(null,{statusCode:r}):r&&404===r?t(null,{BucketNotFound:!0,statusCode:r}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})})}function _(e,t){J.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"acl"},function(e,n){if(e)return t(e);var r=n.AccessControlPolicy||{},o=r.Owner||{},i=r.AccessControlList&&r.AccessControlList.Grant||[];i=te.isArray(i)?i:[i];var a=V(r);n.headers&&n.headers["x-cos-acl"]&&(a.ACL=n.headers["x-cos-acl"]),a=te.extend(a,{Owner:o,Grants:i,statusCode:n.statusCode,headers:n.headers}),t(null,a)})}function P(e,t){var n=e.Headers,r="";if(e.AccessControlPolicy){var o=te.clone(e.AccessControlPolicy||{}),i=o.Grants||o.Grant;i=te.isArray(i)?i:[i],delete o.Grant,delete o.Grants,o.AccessControlList={Grant:i},r=te.json2xml({AccessControlPolicy:o}),n["Content-Type"]="application/xml",n["Content-MD5"]=te.binaryBase64(te.md5(r))}te.each(n,function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=X(n[t]))}),J.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"acl",headers:n,body:r},function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})})}function D(e,t){var n=e.Headers;n.Origin=e.Origin,n["Access-Control-Request-Method"]=e.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,J.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:n},function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(null,{OptionsForbidden:!0,statusCode:e.statusCode}):t(e);var r=n.headers||{};t(null,{AccessControlAllowOrigin:r["access-control-allow-origin"],AccessControlAllowMethods:r["access-control-allow-methods"],AccessControlAllowHeaders:r["access-control-allow-headers"],AccessControlExposeHeaders:r["access-control-expose-headers"],AccessControlMaxAge:r["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})})}function I(e,t){var n=e.Headers;!n["Cache-Control"]&&(n["Cache-Control"]="");var r=e.CopySource||"",o=r.match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(!o)return void t({error:"CopySource format error"});var i=o[1],a=o[3],s=decodeURIComponent(o[4]);J.call(this,{Scope:[{action:"name/cos:GetObject",bucket:i,region:a,prefix:s},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},function(e,n){if(e)return t(e);var r=te.clone(n.CopyObjectResult||{});te.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}function O(e,t){var n=e.CopySource||"",r=n.match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(!r)return void t({error:"CopySource format error"});var o=r[1],i=r[3],a=decodeURIComponent(r[4]);J.call(this,{Scope:[{action:"name/cos:GetObject",bucket:o,region:i,prefix:a},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers},function(e,n){if(e)return t(e);var r=te.clone(n.CopyPartResult||{});te.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}function M(e,t){var n=e.Objects||[],r=e.Quiet;n=te.isArray(n)?n:[n];var o=te.json2xml({Delete:{Object:n,Quiet:r||!1}}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=te.binaryBase64(te.md5(o));var a=te.map(n,function(t){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:t.Key}});J.call(this,{Scope:a,method:"POST",Bucket:e.Bucket,Region:e.Region,body:o,action:"delete",headers:i},function(e,n){if(e)return t(e);var r=n.DeleteResult||{},o=r.Deleted||[],i=r.Error||[];o=te.isArray(o)?o:[o],i=te.isArray(i)?i:[i];var a=te.clone(r);te.extend(a,{Error:i,Deleted:o,statusCode:n.statusCode,headers:n.headers}),t(null,a)})}function L(e,t){var n=e.Headers;if(!e.RestoreRequest)return void t({error:"missing param RestoreRequest"});var r=e.RestoreRequest||{},o=te.json2xml({RestoreRequest:r});n["Content-Type"]="application/xml",n["Content-MD5"]=te.binaryBase64(te.md5(o)),J.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:o,action:"restore",headers:n},function(e,n){t(e,n)})}function j(e,t){var n=this,r=e.Headers;!r["Cache-Control"]&&(r["Cache-Control"]=""),te.getBodyMd5(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5,e.Body,function(r){r&&(e.Headers["x-cos-meta-md5"]=r),J.call(n,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers},function(e,n){return e?t(e):(n=te.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,te.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)})},e.onHashProgress)}function U(e,t){var n=this;te.getFileSize("multipartUpload",e,function(){te.getBodyMd5(n.options.UploadCheckContentMd5,e.Body,function(r){r&&(e.Headers["Content-MD5"]=te.binaryBase64(r)),J.call(n,{Action:"name/cos:UploadPart",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers,onProgress:e.onProgress,body:e.Body||null},function(e,n){if(e)return t(e);n.headers=n.headers||{},t(null,{ETag:n.headers.etag||"",statusCode:n.statusCode,headers:n.headers})})})})}function H(e,t){for(var n=this,r=e.UploadId,o=e.Parts,i=0,a=o.length;i-1?n.Authorization:"sign="+encodeURIComponent(n.Authorization)),n.XCosSecurityToken&&(o+="&x-cos-security-token="+n.XCosSecurityToken),n.ClientIP&&(o+="&clientIP="+n.ClientIP),n.ClientUA&&(o+="&clientUA="+n.ClientUA),n.Token&&(o+="&token="+n.Token),setTimeout(function(){t(null,{Url:o})})}});return o?r+"?"+o.Authorization+(o.XCosSecurityToken?"&x-cos-security-token="+o.XCosSecurityToken:""):r}function V(e){var t={GrantFullControl:[],GrantWrite:[],GrantRead:[],GrantReadAcp:[],GrantWriteAcp:[],ACL:""},n={FULL_CONTROL:"GrantFullControl",WRITE:"GrantWrite",READ:"GrantRead",READ_ACP:"GrantReadAcp",WRITE_ACP:"GrantWriteAcp"},r=e.AccessControlList.Grant;r&&(r=te.isArray(r)?r:[r]);var o={READ:0,WRITE:0,FULL_CONTROL:0};return r.length&&te.each(r,function(r){"qcs::cam::anyone:anyone"===r.Grantee.ID||"http://cam.qcloud.com/groups/global/AllUsers"===r.Grantee.URI?o[r.Permission]=1:r.Grantee.ID!==e.Owner.ID&&t[n[r.Permission]].push('id="'+r.Grantee.ID+'"')}),o.FULL_CONTROL||o.WRITE&&o.READ?t.ACL="public-read-write":o.READ?t.ACL="public-read":t.ACL="private",te.each(n,function(e){t[e]=X(t[e].join(","))}),t}function X(e){var t,n,r=e.split(","),o={};for(t=0;t-1?"{Region}.myqcloud.com":"cos.{Region}.myqcloud.com",e.ForcePathStyle||(o="{Bucket}."+o)),o=o.replace(/\{\{AppId\}\}/gi,r).replace(/\{\{Bucket\}\}/gi,n).replace(/\{\{Region\}\}/gi,i).replace(/\{\{.*?\}\}/gi,""),o=o.replace(/\{AppId\}/gi,r).replace(/\{BucketName\}/gi,n).replace(/\{Bucket\}/gi,t).replace(/\{Region\}/gi,i).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(o)||(o=s+"//"+o),"/"===o.slice(-1)&&(o=o.slice(0,-1));var c=o;return e.ForcePathStyle&&(c+="/"+t),c+="/",a&&(c+=te.camSafeUrlEncode(a).replace(/%2F/g,"/")),e.isLocation&&(c=c.replace(/^https?:\/\//,"")),c}function $(e,t){var n=te.clone(e.Headers);delete n["Content-Type"],delete n["Cache-Control"],te.each(n,function(e,t){""===e&&delete n[t]});var r=function(e){var n=!1,r=e.Authorization;if(r)if(r.indexOf(" ")>-1)n=!1;else if(r.indexOf("q-sign-algorithm=")>-1&&r.indexOf("q-ak=")>-1&&r.indexOf("q-sign-time=")>-1&&r.indexOf("q-key-time=")>-1&&r.indexOf("q-url-param-list=")>-1)n=!0;else try{r=atob(r),r.indexOf("a=")>-1&&r.indexOf("k=")>-1&&r.indexOf("t=")>-1&&r.indexOf("r=")>-1&&r.indexOf("b=")>-1&&(n=!0)}catch(e){}n?t&&t(null,e):t&&t("authorization error")},o=this,i=e.Bucket||"",a=e.Region||"",s=e.Key||"";o.options.ForcePathStyle&&i&&(s=i+"/"+s);var c="/"+s,u={},l=e.Scope;if(!l){var d=e.Action||"",f=e.ResourceKey||e.Key||"";l=e.Scope||[{action:d,bucket:i,region:a,prefix:f}]}var p=te.md5(JSON.stringify(l));o._StsCache=o._StsCache||[],function(){var e,t;for(e=o._StsCache.length-1;e>=0;e--){t=o._StsCache[e];var n=Math.round(te.getSkewTime(o.options.SystemClockOffset)/1e3)+30;if(t.StartTime&&n=t.ExpiredTime)o._StsCache.splice(e,1);else if(!t.ScopeLimit||t.ScopeLimit&&t.ScopeKey===p){u=t;break}}}();var h=function(){var t=te.getAuth({SecretId:u.TmpSecretId,SecretKey:u.TmpSecretKey,Method:e.Method,Pathname:c,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:o.options.UseRawKey,SystemClockOffset:o.options.SystemClockOffset}),i={Authorization:t,XCosSecurityToken:u.XCosSecurityToken||"",Token:u.Token||"",ClientIP:u.ClientIP||"",ClientUA:u.ClientUA||""};r(i)};if(u.ExpiredTime&&u.ExpiredTime-te.getSkewTime(o.options.SystemClockOffset)/1e3>60)h();else if(o.options.getAuthorization)o.options.getAuthorization.call(o,{Bucket:i,Region:a,Method:e.Method,Key:s,Pathname:c,Query:e.Query,Headers:n,Scope:l},function(e){"string"==typeof e&&(e={Authorization:e}),e.TmpSecretId&&e.TmpSecretKey&&e.XCosSecurityToken&&e.ExpiredTime?(u=e||{},u.Scope=l,u.ScopeKey=p,o._StsCache.push(u),h()):r(e)});else{if(!o.options.getSTS)return function(){var t=te.getAuth({SecretId:e.SecretId||o.options.SecretId,SecretKey:e.SecretKey||o.options.SecretKey,Method:e.Method,Pathname:c,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:o.options.UseRawKey,SystemClockOffset:o.options.SystemClockOffset}),i={Authorization:t,XCosSecurityToken:o.options.XCosSecurityToken};return r(i),i}();o.options.getSTS.call(o,{Bucket:i,Region:a},function(e){u=e||{},u.Scope=l,u.ScopeKey=p,u.TmpSecretId=u.SecretId,u.TmpSecretKey=u.SecretKey,o._StsCache.push(u),h()})}return""}function Q(e){var t=!1,n=!1,r=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var o=e.error.Code,i=e.error.Message;("RequestTimeTooSkewed"===o||"AccessDenied"===o&&"Request has expired"===i)&&(n=!0)}catch(e){}if(e)if(n&&r){var a=Date.parse(r);this.options.CorrectClockSkew&&Math.abs(te.getSkewTime(this.options.SystemClockOffset)-a)>=3e4&&(console.error("error: Local time is too skewed."),this.options.SystemClockOffset=a-Date.now(),t=!0)}else 5===Math.round(e.statusCode/100)&&(t=!0);return t}function J(e,t){var n=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=te.clearKey(e.qs),e.headers&&(e.headers=te.clearKey(e.headers)),e.qs&&(e.qs=te.clearKey(e.qs));var r=te.clone(e.qs);e.action&&(r[e.action]="");var o=function(i){var a=n.options.SystemClockOffset;$.call(n,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:r,Headers:e.headers,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope},function(r,s){if(r)return void t(r);e.AuthData=s,Y.call(n,e,function(r,s){r&&i<2&&(a!==n.options.SystemClockOffset||Q.call(n,r))?(e.headers&&(delete e.headers.Authorization,delete e.headers.token,delete e.headers.clientIP,delete e.headers.clientUA,delete e.headers["x-cos-security-token"]),o(i+1)):t(r,s)})})};o(1)}function Y(e,t){var n=this,r=e.TaskId;if(!r||n._isRunningTask(r)){var o=e.Bucket,i=e.Region,a=e.Key,s=e.method||"GET",c=e.url,u=e.body,l=e.json,d=e.rawBody;c=c||W({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:o,region:i,object:a}),e.action&&(c=c+"?"+e.action);var f={method:s,url:c,headers:e.headers,qs:e.qs,body:u,json:l};if(f.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(f.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(f.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(f.headers.clientUA=e.AuthData.ClientUA),e.AuthData.XCosSecurityToken&&(f.headers["x-cos-security-token"]=e.AuthData.XCosSecurityToken),f.headers&&(f.headers=te.clearKey(f.headers)),f=te.clearKey(f),e.onProgress&&"function"==typeof e.onProgress){var p=u&&(u.size||u.length)||0;f.onProgress=function(t){if(!r||n._isRunningTask(r)){var o=t?t.loaded:0;e.onProgress({loaded:o,total:p})}}}this.options.Timeout&&(f.timeout=this.options.Timeout),n.emit("before-send",f);var h=ee(f,function(e,o,i){if("abort"!==e){var a,s=function(e,i){if(r&&n.off("inner-kill-task",g),!a){a=!0;var s={};o&&o.statusCode&&(s.statusCode=o.statusCode),o&&o.headers&&(s.headers=o.headers),e?(e=te.extend(e||{},s),t(e,null)):(i=te.extend(i||{},s),t(null,i)),h=null}};if(e)return void s({error:e});var c;if(d)c={},c.body=i;else try{c=i&&i.indexOf("<")>-1&&i.indexOf(">")>-1&&te.xml2json(i)||{}}catch(e){c=i||{}}var u=o.statusCode;return 2===Math.floor(u/100)?c.Error?void s({error:c.Error}):void s(null,c):void s({error:c.Error||c})}}),g=function(e){e.TaskId===r&&(h&&h.abort&&h.abort(),n.off("inner-kill-task",g))};r&&n.on("inner-kill-task",g)}}function Z(e,t,n){te.each(["Cors","Acl"],function(r){if(e.slice(-r.length)===r){var o=e.slice(0,-r.length)+r.toUpperCase(),i=te.apiWrapper(e,t),a=!1;n[o]=function(){!a&&console.warn("warning: cos."+o+" has been deprecated. Please Use cos."+e+" instead."),a=!0,i.apply(this,arguments)}}})}var ee=n(13),te=n(0),ne={getBucket:o,headBucket:r,deleteBucket:i,getBucketAcl:a,putBucketAcl:s,getBucketCors:c,putBucketCors:u,deleteBucketCors:l,getBucketLocation:p,putBucketTagging:m,getBucketTagging:g,deleteBucketTagging:y,getBucketPolicy:h,putBucketPolicy:d,deleteBucketPolicy:f,getBucketLifecycle:C,putBucketLifecycle:v,deleteBucketLifecycle:x,putBucketVersioning:b,getBucketVersioning:k,putBucketReplication:S,getBucketReplication:T,deleteBucketReplication:w,getObject:E,headObject:R,listObjectVersions:A,putObject:B,deleteObject:N,getObjectAcl:_,putObjectAcl:P,optionsObject:D,putObjectCopy:I,deleteMultipleObject:M,restoreObject:L,uploadPartCopy:O,multipartInit:j,multipartUpload:U,multipartComplete:H,multipartList:F,multipartListPart:K,multipartAbort:z,getObjectUrl:G,getAuth:q};e.exports.init=function(e,t){t.transferToTaskMethod(ne,"putObject"),te.each(ne,function(t,n){e.prototype[n]=te.apiWrapper(n,t),Z(n,t,e.prototype)})}},function(e,t,n){var r=n(14),o=function(){function e(e){var t=e.length,n=E.type(e);return"function"!==n&&!E.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e))}function t(e){var t=L[e]={};return E.each(e.match(M)||[],function(e,n){t[n]=!0}),t}function n(){I.addEventListener?(I.removeEventListener("DOMContentLoaded",r,!1),window.removeEventListener("load",r,!1)):(I.detachEvent("onreadystatechange",r),window.detachEvent("onload",r))}function r(){(I.addEventListener||"load"===event.type||"complete"===I.readyState)&&(n(),E.ready())}function o(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(F,"-$1").toLowerCase();if("string"==typeof(n=e.getAttribute(r))){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:H.test(n)?E.parseJSON(n):n)}catch(e){}E.data(e,t,n)}else n=void 0}return n}function i(e){var t;for(t in e)if(("data"!==t||!E.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function a(e,t,n,r){if(E.acceptData(e)){var o,i,a=E.expando,s=e.nodeType,c=s?E.cache:e,u=s?e[a]:e[a]&&a;if(u&&c[u]&&(r||c[u].data)||void 0!==n||"string"!=typeof t)return u||(u=s?e[a]=v.pop()||E.guid++:a),c[u]||(c[u]=s?{}:{toJSON:E.noop}),"object"!=typeof t&&"function"!=typeof t||(r?c[u]=E.extend(c[u],t):c[u].data=E.extend(c[u].data,t)),i=c[u],r||(i.data||(i.data={}),i=i.data),void 0!==n&&(i[E.camelCase(t)]=n),"string"==typeof t?null==(o=i[t])&&(o=i[E.camelCase(t)]):o=i,o}}function s(e,t,n){if(E.acceptData(e)){var r,o,a=e.nodeType,s=a?E.cache:e,c=a?e[E.expando]:E.expando;if(s[c]){if(t&&(r=n?s[c]:s[c].data)){E.isArray(t)?t=t.concat(E.map(t,E.camelCase)):t in r?t=[t]:(t=E.camelCase(t),t=t in r?[t]:t.split(" ")),o=t.length;for(;o--;)delete r[t[o]];if(n?!i(r):!E.isEmptyObject(r))return}(n||(delete s[c].data,i(s[c])))&&(a?E.cleanData([e],!0):R.deleteExpando||s!=s.window?delete s[c]:s[c]=null)}}}function c(){return!0}function u(){return!1}function l(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o=0,i=t.toLowerCase().match(M)||[];if(E.isFunction(n))for(;r=i[o++];)"+"===r.charAt(0)?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function d(e,t,n,r){function o(s){var c;return i[s]=!0,E.each(e[s]||[],function(e,s){var u=s(t,n,r);return"string"!=typeof u||a||i[u]?a?!(c=u):void 0:(t.dataTypes.unshift(u),o(u),!1)}),c}var i={},a=e===ae;return o(t.dataTypes[0])||!i["*"]&&o("*")}function f(e,t){var n,r,o=E.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((o[r]?e:n||(n={}))[r]=t[r]);return n&&E.extend(!0,e,n),e}function p(e,t,n){for(var r,o,i,a,s=e.contents,c=e.dataTypes;"*"===c[0];)c.shift(),void 0===o&&(o=e.mimeType||t.getResponseHeader("Content-Type"));if(o)for(a in s)if(s[a]&&s[a].test(o)){c.unshift(a);break}if(c[0]in n)i=c[0];else{for(a in n){if(!c[0]||e.converters[a+" "+c[0]]){i=a;break}r||(r=a)}i=i||r}if(i)return i!==c[0]&&c.unshift(i),n[i]}function h(e,t,n,r){var o,i,a,s,c,u={},l=e.dataTypes.slice();if(l[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];for(i=l.shift();i;)if(e.responseFields[i]&&(n[e.responseFields[i]]=t),!c&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),c=i,i=l.shift())if("*"===i)i=c;else if("*"!==c&&c!==i){if(!(a=u[c+" "+i]||u["* "+i]))for(o in u)if(s=o.split(" "),s[1]===i&&(a=u[c+" "+s[0]]||u["* "+s[0]])){!0===a?a=u[o]:!0!==u[o]&&(i=s[0],l.unshift(s[1]));break}if(!0!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+c+" to "+i}}}return{state:"success",data:t}}function g(e,t,n,r){var o;if(E.isArray(t))E.each(t,function(t,o){n||ue.test(e)?r(e,o):g(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==E.type(t))r(e,t);else for(o in t)g(e+"["+o+"]",t[o],n,r)}function m(){try{return new window.XMLHttpRequest}catch(e){}}function y(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}var v=[],C=v.slice,x=v.concat,b=v.push,k=v.indexOf,S={},T=S.toString,w=S.hasOwnProperty,R={},A="1.11.1 -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-effects/support,-dimensions,-offset,-deprecated,-event-alias,-wrap",E=function(e,t){return new E.fn.init(e,t)},B=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^-ms-/,_=/-([\da-z])/gi,P=function(e,t){return t.toUpperCase()};E.fn=E.prototype={jquery:A,constructor:E,selector:"",length:0,toArray:function(){return C.call(this)},get:function(e){return null!=e?e<0?this[e+this.length]:this[e]:C.call(this)},pushStack:function(e){var t=E.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return E.each(this,e,t)},map:function(e){return this.pushStack(E.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(C.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==E.type(e)||e.nodeType||E.isWindow(e))return!1;try{if(e.constructor&&!w.call(e,"constructor")&&!w.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}if(R.ownLast)for(t in e)return w.call(e,t);for(t in e);return void 0===t||w.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?S[T.call(e)]||"object":typeof e},globalEval:function(e){e&&E.trim(e)&&(window.execScript||function(e){window.eval.call(window,e)})(e)},camelCase:function(e){return e.replace(N,"ms-").replace(_,P)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(t,n,r){var o=0,i=t.length,a=e(t);if(r){if(a)for(;o)[^>]*|#([\w-]*))$/;(E.fn.init=function(e,t){var n,r;if(!e)return this;if("string"==typeof e){if(!(n="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:O.exec(e))||!n[1]&&t)return!t||t.jquery?(t||D).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof E?t[0]:t,E.merge(this,E.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:I,!0)),rsingleTag.test(n[1])&&E.isPlainObject(t))for(n in t)E.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}if((r=I.getElementById(n[2]))&&r.parentNode){if(r.id!==n[2])return D.find(e);this.length=1,this[0]=r}return this.context=I,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):E.isFunction(e)?void 0!==D.ready?D.ready(e):e(E):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),E.makeArray(e,this))}).prototype=E.fn,D=E(I);var M=/\S+/g,L={};E.Callbacks=function(e){e="string"==typeof e?L[e]||t(e):E.extend({},e);var n,r,o,i,a,s,c=[],u=!e.once&&[],l=function(t){for(r=e.memory&&t,o=!0,a=s||0,s=0,i=c.length,n=!0;c&&a-1;)c.splice(r,1),n&&(r<=i&&i--,r<=a&&a--)}),this},has:function(e){return e?E.inArray(e,c)>-1:!(!c||!c.length)},empty:function(){return c=[],i=0,this},disable:function(){return c=u=r=void 0,this},disabled:function(){return!c},lock:function(){return u=void 0,r||d.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!c||o&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):l(t)),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!o}};return d},E.extend({Deferred:function(e){var t=[["resolve","done",E.Callbacks("once memory"),"resolved"],["reject","fail",E.Callbacks("once memory"),"rejected"],["notify","progress",E.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return E.Deferred(function(n){E.each(t,function(t,i){var a=E.isFunction(e[t])&&e[t];o[i[1]](function(){var e=a&&a.apply(this,arguments);e&&E.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[i[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?E.extend(e,r):r}},o={};return r.pipe=r.then,E.each(t,function(e,i){var a=i[2],s=i[3];r[i[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),o[i[0]]=function(){return o[i[0]+"With"](this===o?r:this,arguments),this},o[i[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(e){var t,n,r,o=0,i=C.call(arguments),a=i.length,s=1!==a||e&&E.isFunction(e.promise)?a:0,c=1===s?e:E.Deferred(),u=function(e,n,r){return function(o){n[e]=this,r[e]=arguments.length>1?C.call(arguments):o,r===t?c.notifyWith(n,r):--s||c.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);o0||(j.resolveWith(I,[E]),E.fn.triggerHandler&&(E(I).triggerHandler("ready"),E(I).off("ready")))}}}),E.ready.promise=function(e){if(!j)if(j=E.Deferred(),"complete"===I.readyState)setTimeout(E.ready);else if(I.addEventListener)I.addEventListener("DOMContentLoaded",r,!1),window.addEventListener("load",r,!1);else{I.attachEvent("onreadystatechange",r),window.attachEvent("onload",r);var t=!1;try{t=null==window.frameElement&&I.documentElement}catch(e){}t&&t.doScroll&&function e(){if(!E.isReady){try{t.doScroll("left")}catch(t){return setTimeout(e,50)}n(),E.ready()}}()}return j.promise(e)};var U;for(U in E(R))break;R.ownLast="0"!==U,R.inlineBlockNeedsLayout=!1,E(function(){var e,t,n,r;(n=I.getElementsByTagName("body")[0])&&n.style&&(t=I.createElement("div"),r=I.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),void 0!==t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",R.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=I.createElement("div");if(null==R.deleteExpando){R.deleteExpando=!0;try{delete e.test}catch(e){R.deleteExpando=!1}}e=null}(),E.acceptData=function(e){var t=E.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||!0!==t&&e.getAttribute("classid")===t)};var H=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,F=/([A-Z])/g;E.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return!!(e=e.nodeType?E.cache[e[E.expando]]:e[E.expando])&&!i(e)},data:function(e,t,n){return a(e,t,n)},removeData:function(e,t){return s(e,t)},_data:function(e,t,n){return a(e,t,n,!0)},_removeData:function(e,t){return s(e,t,!0)}}),E.fn.extend({data:function(e,t){var n,r,i,a=this[0],s=a&&a.attributes;if(void 0===e){if(this.length&&(i=E.data(a),1===a.nodeType&&!E._data(a,"parsedAttrs"))){for(n=s.length;n--;)s[n]&&(r=s[n].name,0===r.indexOf("data-")&&(r=E.camelCase(r.slice(5)),o(a,r,i[r])));E._data(a,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){E.data(this,e)}):arguments.length>1?this.each(function(){E.data(this,e,t)}):a?o(a,e,E.data(a,e)):void 0},removeData:function(e){return this.each(function(){E.removeData(this,e)})}}),E.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=E._data(e,t),n&&(!r||E.isArray(n)?r=E._data(e,t,E.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=E.queue(e,t),r=n.length,o=n.shift(),i=E._queueHooks(e,t),a=function(){E.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,a,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return E._data(e,n)||E._data(e,n,{empty:E.Callbacks("once memory").add(function(){E._removeData(e,t+"queue"),E._removeData(e,n)})})}}),E.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length=0&&(p=f.split("."),f=p.shift(),p.sort()),i=f.indexOf(":")<0&&"on"+f,e=e[E.expando]?e:new E.Event(f,"object"==typeof e&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:E.makeArray(t,[e]),c=E.event.special[f]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!E.isWindow(n)){for(s=c.delegateType||f,G.test(s+f)||(a=a.parentNode);a;a=a.parentNode)d.push(a),u=a;u===(n.ownerDocument||I)&&d.push(u.defaultView||u.parentWindow||window)}for(l=0;(a=d[l++])&&!e.isPropagationStopped();)e.type=l>1?s:c.bindType||f,o=(E._data(a,"events")||{})[e.type]&&E._data(a,"handle"),o&&o.apply(a,t),(o=i&&a[i])&&o.apply&&E.acceptData(a)&&(e.result=o.apply(a,t),!1===e.result&&e.preventDefault());if(e.type=f,!r&&!e.isDefaultPrevented()&&(!c._default||!1===c._default.apply(d.pop(),t))&&E.acceptData(n)&&i&&n[f]&&!E.isWindow(n)){u=n[i],u&&(n[i]=null),E.event.triggered=f;try{n[f]()}catch(e){}E.event.triggered=void 0,u&&(n[i]=u)}return e.result}},dispatch:function(e){e=E.event.fix(e);var t,n,r,o,i,a=[],s=C.call(arguments),c=(E._data(this,"events")||{})[e.type]||[],u=E.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!u.preDispatch||!1!==u.preDispatch.call(this,e)){for(a=E.event.handlers.call(this,e,c),t=0;(o=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=o.elem,i=0;(r=o.handlers[i++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(r.namespace)||(e.handleObj=r,e.data=r.data,void 0!==(n=((E.event.special[r.origType]||{}).handle||r.handler).apply(o.elem,s))&&!1===(e.result=n)&&(e.preventDefault(),e.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,o,i,a=[],s=t.delegateCount,c=e.target;if(s&&c.nodeType&&(!e.button||"click"!==e.type))for(;c!=this;c=c.parentNode||this)if(1===c.nodeType&&(!0!==c.disabled||"click"!==e.type)){for(o=[],i=0;i=0:E.find(n,this,null,[c]).length),o[n]&&o.push(r);o.length&&a.push({elem:c,handlers:o})}return s0?4:0,o=e>=200&&e<300||304===e,n&&(x=p(f,T,n)),x=h(f,x,T,o),o?(f.ifModified&&(b=T.getResponseHeader("Last-Modified"),b&&(E.lastModified[i]=b),(b=T.getResponseHeader("etag"))&&(E.etag[i]=b)),204===e||"HEAD"===f.type?S="nocontent":304===e?S="notmodified":(S=x.state,l=x.data,d=x.error,o=!d)):(d=S,!e&&S||(S="error",e<0&&(e=0))),T.status=e,T.statusText=(t||S)+"",o?y.resolveWith(g,[l,S,T]):y.rejectWith(g,[T,S,d]),T.statusCode(C),C=void 0,c&&m.trigger(o?"ajaxSuccess":"ajaxError",[T,f,o?l:d]),v.fireWith(g,[T,S]),c&&(m.trigger("ajaxComplete",[T,f]),--E.active||E.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,o,i,a,s,c,u,l,f=E.ajaxSetup({},t),g=f.context||f,m=f.context&&(g.nodeType||g.jquery)?E(g):E.event,y=E.Deferred(),v=E.Callbacks("once memory"),C=f.statusCode||{},x={},b={},k=0,S="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===k){if(!l)for(l={};t=ee.exec(a);)l[t[1].toLowerCase()]=t[2];t=l[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===k?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return k||(e=b[n]=b[n]||e,x[e]=t),this},overrideMimeType:function(e){return k||(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(k<2)for(t in e)C[t]=[C[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||S;return u&&u.abort(t),n(0,t),this}};if(y.promise(T).complete=v.add,T.success=T.done,T.error=T.fail,f.url=((e||f.url||J)+"").replace(Y,"").replace(re,Q[1]+"//"),f.type=t.method||t.type||f.method||f.type,f.dataTypes=E.trim(f.dataType||"*").toLowerCase().match(M)||[""],null==f.crossDomain&&(r=oe.exec(f.url.toLowerCase()),f.crossDomain=!(!r||r[1]===Q[1]&&r[2]===Q[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(Q[3]||("http:"===Q[1]?"80":"443")))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=E.param(f.data,f.traditional)),d(ie,f,t,T),2===k)return T;c=f.global,c&&0==E.active++&&E.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!ne.test(f.type),i=f.url,f.hasContent||(f.data&&(i=f.url+=(W.test(i)?"&":"?")+f.data,delete f.data),!1===f.cache&&(f.url=Z.test(i)?i.replace(Z,"$1_="+X++):i+(W.test(i)?"&":"?")+"_="+X++)),f.ifModified&&(E.lastModified[i]&&T.setRequestHeader("If-Modified-Since",E.lastModified[i]),E.etag[i]&&T.setRequestHeader("If-None-Match",E.etag[i])),(f.data&&f.hasContent&&!1!==f.contentType||t.contentType)&&T.setRequestHeader("Content-Type",f.contentType);for(o in f.headers)T.setRequestHeader(o,f.headers[o]);if(f.beforeSend&&(!1===f.beforeSend.call(g,T,f)||2===k))return T.abort();S="abort";for(o in{success:1,error:1,complete:1})T[o](f[o]);if(u=d(ae,f,t,T)){T.readyState=1,c&&m.trigger("ajaxSend",[T,f]),f.async&&f.timeout>0&&(s=setTimeout(function(){T.abort("timeout")},f.timeout));try{k=1,u.send(x,n)}catch(e){if(!(k<2))throw e;n(-1,e)}}else n(-1,"No Transport");return T},getJSON:function(e,t,n){return E.get(e,t,n,"json")},getScript:function(e,t){return E.get(e,void 0,t,"script")}}),E.each(["get","post"],function(e,t){E[t]=function(e,n,r,o){return E.isFunction(n)&&(o=o||r,r=n,n=void 0),E.ajax({url:e,type:t,dataType:o,data:n,success:r})}}),E.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){E.fn[t]=function(e){return this.on(t,e)}}),E._evalUrl=function(e){return E.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})};var ce=/%20/g,ue=/\[\]$/,le=/\r?\n/g,de=/^(?:submit|button|image|reset|file)$/i,fe=/^(?:input|select|textarea|keygen)/i;E.param=function(e,t){var n,r=[],o=function(e,t){t=E.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=E.ajaxSettings&&E.ajaxSettings.traditional),E.isArray(e)||e.jquery&&!E.isPlainObject(e))E.each(e,function(){o(this.name,this.value)});else for(n in e)g(n,e[n],t,o);return r.join("&").replace(ce,"+")},E.fn.extend({serialize:function(){return E.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=E.prop(this,"elements");return e?E.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!E(this).is(":disabled")&&fe.test(this.nodeName)&&!de.test(e)&&(this.checked||!rcheckableType.test(e))}).map(function(e,t){var n=E(this).val();return null==n?null:E.isArray(n)?E.map(n,function(e){return{name:t.name,value:e.replace(le,"\r\n")}}):{name:t.name,value:n.replace(le,"\r\n")}}).get()}}),E.ajaxSettings.xhr=void 0!==window.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&m()||y()}:m;var pe=0,he={},ge=E.ajaxSettings.xhr();window.ActiveXObject&&E(window).on("unload",function(){for(var e in he)he[e](void 0,!0)}),R.cors=!!ge&&"withCredentials"in ge,ge=R.ajax=!!ge,ge&&E.ajaxTransport(function(e){if(!e.crossDomain||R.cors){var t;return{send:function(n,r){var o,i=e.xhr(),a=++pe;if(i.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)i[o]=e.xhrFields[o];e.mimeType&&i.overrideMimeType&&i.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(o in n)void 0!==n[o]&&i.setRequestHeader(o,n[o]+"");i.upload&&e.progress&&(i.upload.onprogress=e.progress),i.send(e.hasContent&&(e.body||e.data)||null),t=function(n,o){var s,c,u;if(t&&(o||4===i.readyState))if(delete he[a],t=void 0,i.onreadystatechange=E.noop,o)4!==i.readyState&&i.abort();else{u={},s=i.status,"string"==typeof i.responseText&&(u.text=i.responseText);try{c=i.statusText}catch(e){c=""}s||!e.isLocal||e.crossDomain?1223===s&&(s=204):s=u.text?200:404}u&&r(s,c,u,i.getAllResponseHeaders())},e.async?4===i.readyState?setTimeout(t):i.onreadystatechange=he[a]=t:t()},abort:function(){t&&t(void 0,!0)}}}}),E.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return E.globalEval(e),e}}}),E.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),E.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=I.head||E("head")[0]||I.documentElement;return{send:function(r,o){t=I.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||o(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var me=[],ye=/(=)\?(?=&|$)|\?\?/;return E.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=me.pop()||E.expando+"_"+X++;return this[e]=!0,e}}),E.ajaxPrefilter("json jsonp",function(e,t,n){var r,o,i,a=!1!==e.jsonp&&(ye.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&ye.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=E.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(ye,"$1"+r):!1!==e.jsonp&&(e.url+=(W.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return i||E.error(r+" was not called"),i[0]},e.dataTypes[0]="json",o=window[r],window[r]=function(){i=arguments},n.always(function(){window[r]=o,e[r]&&(e.jsonpCallback=t.jsonpCallback,me.push(r)),i&&E.isFunction(o)&&o(i[0]),i=o=void 0}),"script"}),E.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||I;var r=rsingleTag.exec(e),o=!n&&[];return r?[t.createElement(r[1])]:(r=E.buildFragment([e],t,o),o&&o.length&&E(o).remove(),E.merge([],r.childNodes))},E}(),i=function(e,t){if(e=o.extend(!0,{headers:{},qs:{}},e),e.type=e.method,delete e.method,e.onProgress&&(e.progress=e.onProgress,delete e.onProgress),e.qs){var n=r.stringify(e.qs);n&&(e.url+=(-1===e.url.indexOf("?")?"?":"&")+n),delete e.qs}if(e.json&&(e.data=e.body,delete e.json,delete e.body,!e.headers&&(e.headers={}),e.headers["Content-Type"]="application/json"),e.body&&(e.body instanceof Blob||"[object File]"===e.body.toString()||"[object Blob]"===e.body.toString()||(e.data=e.body,delete e.body)),e.headers){var i=e.headers;delete e.headers,e.beforeSend=function(e){for(var t in i)i.hasOwnProperty(t)&&"content-length"!==t.toLowerCase()&&"user-agent"!==t.toLowerCase()&&"origin"!==t.toLowerCase()&&"host"!==t.toLowerCase()&&e.setRequestHeader(t,i[t])}}var a=function(e){var t={};return e.getAllResponseHeaders().trim().split("\n").forEach(function(e){if(e){var n=e.indexOf(":"),r=e.substr(0,n).trim().toLowerCase(),o=e.substr(n+1).trim();t[r]=o}}),{statusCode:e.status,statusMessage:e.statusText,headers:t}};return e.success=function(e,n,r){t(null,a(r),e)},e.error=function(e){e.responseText?t(null,a(e),e.responseText):t(e.statusText,a(e),e.responseText)},e.dataType="text",o.ajax(e)};e.exports=i},function(e,t,n){"use strict";t.decode=t.parse=n(15),t.encode=t.stringify=n(16)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var c=1e3;i&&"number"==typeof i.maxKeys&&(c=i.maxKeys);var u=e.length;c>0&&u>c&&(u=c);for(var l=0;l=0?(d=g.substr(0,m),f=g.substr(m+1)):(d=g,f=""),p=decodeURIComponent(d),h=decodeURIComponent(f),r(a,p)?o(a[p])?a[p].push(h):a[p]=[a[p],h]:a[p]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";function r(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=0;r--)C[r][0]===e&&C[r][1]===t&&C.splice(r,1);C.unshift([e,t]);var i=this.options.UploadIdCacheLimit;C.length>i&&C.splice(i),i&&setTimeout(function(){try{localStorage.setItem(T,JSON.stringify(C))}catch(e){}})}function a(e){o.call(this),delete S[e];for(var t=C.length-1;t>=0;t--)C[t][1]===e&&C.splice(t,1);var n=this.options.UploadIdCacheLimit;C.length>n&&C.splice(n),n&&setTimeout(function(){try{C.length?localStorage.setItem(T,JSON.stringify(C)):localStorage.removeItem(T)}catch(e){}})}function s(e){o.call(this);for(var t=[],n=0;ng)return t(null,!1);if(n>1){if(Math.max(e[0].Size,e[1].Size)!==h)return t(null,!1)}var r=function(o){if(o=c.length)return void w.emit("has_upload_id",t);var s=c[e];return k.isInArray(t,s)?S[s]?void f(e+1):void l.call(d,{Bucket:r,Region:o,Key:i,UploadId:s},function(t,r){d._isRunningTask(n)&&(t?(a.call(d,s),f(e+1)):w.emit("upload_id_ready",{UploadId:s,PartList:r.PartList}))}):(a.call(d,s),void f(e+1))};f(0)}else w.emit("has_upload_id",t)}),w.on("get_remote_upload_id_list",function(t){u.call(d,{Bucket:r,Region:o,Key:i},function(t,r){if(d._isRunningTask(n)){if(t)return w.emit("error",t);var o=k.filter(r.UploadList,function(e){return e.Key===i&&(!c||e.StorageClass.toUpperCase()===c.toUpperCase())}).reverse().map(function(e){return e.UploadId||e.UploadID});if(o.length)w.emit("seek_local_avail_upload_id",o);else{var u,l=k.getFileUUID(e.Body,e.ChunkSize);l&&(u=s.call(d,l))&&k.each(u,function(e){a.call(d,e)}),w.emit("no_available_upload_id")}}})}),w.emit("get_remote_upload_id_list")}function u(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Prefix:e.Key},i=function(){n.multipartList(o,function(e,n){if(e)return t(e);r.push.apply(r,n.Upload||[]),"true"===n.IsTruncated?(o.KeyMarker=n.NextKeyMarker,o.UploadIdMarker=n.NextUploadIdMarker,i()):t(null,{UploadList:r})})};i()}function l(e,t){var n=this,r=[],o={Bucket:e.Bucket,Region:e.Region,Key:e.Key,UploadId:e.UploadId},i=function(){n.multipartListPart(o,function(e,n){if(e)return t(e);r.push.apply(r,n.Part||[]),"true"===n.IsTruncated?(o.PartNumberMarker=n.NextPartNumberMarker,i()):t(null,{PartList:r})})};i()}function d(e,t){var n=this,r=e.TaskId,o=e.Bucket,i=e.Region,a=e.Key,s=e.UploadData,c=e.FileSize,u=e.SliceSize,l=Math.min(e.AsyncLimit||n.options.ChunkParallelLimit||1,256),d=e.Body,p=Math.ceil(c/u),h=0,g=e.ServerSideEncryption,m=k.filter(s.PartList,function(e){return e.Uploaded&&(h+=e.PartNumber>=p?c%u||u:u),!e.Uploaded}),y=e.onProgress;x.eachLimit(m,l,function(e,t){if(n._isRunningTask(r)){var l=e.PartNumber,p=Math.min(c,e.PartNumber*u)-(e.PartNumber-1)*u,m=0;f.call(n,{TaskId:r,Bucket:o,Region:i,Key:a,SliceSize:u,FileSize:c,PartNumber:l,ServerSideEncryption:g,Body:d,UploadData:s,onProgress:function(e){h+=e.loaded-m,m=e.loaded,y({loaded:h,total:c})}},function(o,i){n._isRunningTask(r)&&(!k.isBrowser||o||i.ETag||(o='get ETag error, please add "ETag" to CORS ExposeHeader setting.'),o?h-=m:(h+=p-m,e.ETag=i.ETag),t(o||null,i))})}},function(e){if(n._isRunningTask(r))return e?t(e):void t(null,{UploadId:s.UploadId,SliceList:s.PartList})})}function f(e,t){var n=this,r=e.TaskId,o=e.Bucket,i=e.Region,a=e.Key,s=e.FileSize,c=e.Body,u=1*e.PartNumber,l=e.SliceSize,d=e.ServerSideEncryption,f=e.UploadData,p=n.options.ChunkRetryTimes+1,h=l*(u-1),g=l,m=h+l;m>s&&(m=s,g=m-h);var y=f.PartList[u-1];x.retry(p,function(t){n._isRunningTask(r)&&k.fileSlice(c,h,m,!0,function(s){n.multipartUpload({TaskId:r,Bucket:o,Region:i,Key:a,ContentLength:g,PartNumber:u,UploadId:f.UploadId,ServerSideEncryption:d,Body:s,onProgress:e.onProgress},function(e,o){if(n._isRunningTask(r))return e?t(e):(y.Uploaded=!0,t(null,o))})})},function(e,o){if(n._isRunningTask(r))return t(e,o)})}function p(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.UploadId,a=e.SliceList,s=this,c=this.options.ChunkRetryTimes+1,u=a.map(function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}});x.retry(c,function(e){s.multipartComplete({Bucket:n,Region:r,Key:o,UploadId:i,Parts:u},e)},function(e,n){t(e,n)})}function h(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.UploadId,a=e.Level||"task",s=e.AsyncLimit,c=this,l=new b;if(l.on("error",function(e){return t(e)}),l.on("get_abort_array",function(i){g.call(c,{Bucket:n,Region:r,Key:o,Headers:e.Headers,AsyncLimit:s,AbortArray:i},function(e,n){if(e)return t(e);t(null,n)})}),"bucket"===a)u.call(c,{Bucket:n,Region:r},function(e,n){if(e)return t(e);l.emit("get_abort_array",n.UploadList||[])});else if("file"===a){if(!o)return t({error:"abort_upload_task_no_key"});u.call(c,{Bucket:n,Region:r,Key:o},function(e,n){if(e)return t(e);l.emit("get_abort_array",n.UploadList||[])})}else{if("task"!==a)return t({error:"abort_unknown_level"});if(!i)return t({error:"abort_upload_task_no_id"});if(!o)return t({error:"abort_upload_task_no_key"});l.emit("get_abort_array",[{Key:o,UploadId:i}])}}function g(e,t){var n=e.Bucket,r=e.Region,o=e.Key,i=e.AbortArray,a=e.AsyncLimit||1,s=this,c=0,u=new Array(i.length);x.eachLimit(i,a,function(t,i){var a=c;if(o&&o!==t.Key)return u[a]={error:{KeyNotMatch:!0}},void i(null);var l=t.UploadId||t.UploadID;s.multipartAbort({Bucket:n,Region:r,Key:t.Key,Headers:e.Headers,UploadId:l},function(e,o){var s={Bucket:n,Region:r,Key:t.Key,UploadId:l};u[a]={error:e,task:s},i(null)}),c++},function(e){if(e)return t(e);for(var n=[],r=[],o=0,i=u.length;o=r?"sliceUploadFile":"putObject";d.push({api:v,params:e,callback:y})}()}),n._addTasks(d)}function y(e,t){var n=new b,r=this,o=e.Bucket,i=e.Region,a=e.Key,s=e.CopySource,c=s.match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(!c)return void t({error:"CopySource format error"});var u=c[1],l=c[3],d=decodeURIComponent(c[4]),f=void 0===e.CopySliceSize?r.options.CopySliceSize:e.CopySliceSize;f=Math.max(0,f);var p,h,g=e.CopyChunkSize||this.options.CopyChunkSize,m=this.options.CopyChunkParallelLimit,y=0;n.on("copy_slice_complete",function(e){r.multipartComplete({Bucket:o,Region:i,Key:a,UploadId:e.UploadId,Parts:e.PartList},function(e,n){if(e)return h(null,!0),t(e);h({loaded:p,total:p},!0),t(null,n)})}),n.on("get_copy_data_finish",function(e){x.eachLimit(e.PartList,m,function(t,n){var c=t.PartNumber,u=t.CopySourceRange,l=t.end-t.start,d=0;v.call(r,{Bucket:o,Region:i,Key:a,CopySource:s,UploadId:e.UploadId,PartNumber:c,CopySourceRange:u,onProgress:function(e){y+=e.loaded-d,d=e.loaded,h({loaded:y,total:p})}},function(e,r){if(e)return n(e);h({loaded:y,total:p}),y+=l-d,t.ETag=r.ETag,n(e||null,r)})},function(r){if(r)return h(null,!0),t(r);n.emit("copy_slice_complete",e)})}),n.on("get_file_size_finish",function(s){!function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],n=1048576,o=0;o"x-cos-meta-".length&&(s[t]=e)}),n.emit("get_file_size_finish",s)}})}function v(e,t){var n=e.TaskId,r=e.Bucket,o=e.Region,i=e.Key,a=e.CopySource,s=e.UploadId,c=1*e.PartNumber,u=e.CopySourceRange,l=this.options.ChunkRetryTimes+1,d=this;x.retry(l,function(t){d.uploadPartCopy({TaskId:n,Bucket:r,Region:o,Key:i,CopySource:a,UploadId:s,PartNumber:c,CopySourceRange:u,onProgress:e.onProgress},function(e,n){t(e||null,n)})},function(e,n){return t(e,n)})}var C,x=n(18),b=n(2).EventProxy,k=n(0),S={},T="cos_sdk_upload_cache",w={sliceUploadFile:r,abortUploadTask:h,uploadFiles:m,sliceCopyFile:y};e.exports.init=function(e,t){t.transferToTaskMethod(w,"sliceUploadFile"),k.each(w,function(t,n){e.prototype[n]=k.apiWrapper(n,t)})}},function(e,t){var n=function(e,t,n,r){if(r=r||function(){},!e.length||t<=0)return r();var o=0,i=0,a=0;!function s(){if(o>=e.length)return r();for(;a=e.length?r():s())})}()},r=function(e,t,n){var r=function(o){t(function(t,i){t&&oa?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; + +return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/\s*$/g,ra={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X
","
"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?""!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("',"",""].join(""));return l.ie&&l.ie<8?c.removeClass("layui-hide").addClass(o):(d[0]&&d.remove(),s.call(a,m,c[0],y),c.addClass("layui-hide").after(m),a.index)},c.prototype.getContent=function(t){var e=u(t);if(e[0])return d(e[0].document.body.innerHTML)},c.prototype.getText=function(t){var i=u(t);if(i[0])return e(i[0].document.body).text()},c.prototype.setContent=function(t,i,a){var l=u(t);l[0]&&(a?e(l[0].document.body).append(i):e(l[0].document.body).html(i),layedit.sync(t))},c.prototype.sync=function(t){var i=u(t);if(i[0]){var a=e("#"+i[1].attr("textarea"));a.val(d(i[0].document.body.innerHTML))}},c.prototype.getSelection=function(t){var e=u(t);if(e[0]){var i=m(e[0].document);return document.selection?i.text:i.toString()}};var s=function(t,i,a){var l=this,n=t.find("iframe");n.css({height:a.height}).on("load",function(){var o=n.contents(),r=n.prop("contentWindow"),c=o.find("head"),s=e([""].join("")),u=o.find("body");c.append(s),u.attr("contenteditable","true").css({"min-height":a.height}).html(i.value||""),y.apply(l,[r,n,i,a]),g.call(l,r,t,a)})},u=function(t){var i=e("#LAY_layedit_"+t),a=i.prop("contentWindow");return[a,i]},d=function(t){return 8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),t},y=function(t,a,n,o){var r=t.document,c=e(r.body);c.on("keydown",function(t){var e=t.keyCode;if(13===e){var a=m(r),l=p(a),n=l.parentNode;if("pre"===n.tagName.toLowerCase()){if(t.shiftKey)return;return i.msg("请暂时用shift+enter"),!1}r.execCommand("formatBlock",!1,"

")}}),e(n).parents("form").on("submit",function(){var t=c.html();8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),n.value=t}),c.on("paste",function(e){r.execCommand("formatBlock",!1,"

"),setTimeout(function(){f.call(t,c),n.value=c.html()},100)})},f=function(t){var i=this;i.document;t.find("*[style]").each(function(){var t=this.style.textAlign;this.removeAttribute("style"),e(this).css({"text-align":t||""})}),t.find("table").addClass("layui-table"),t.find("script,link").remove()},m=function(t){return t.selection?t.selection.createRange():t.getSelection().getRangeAt(0)},p=function(t){return t.endContainer||t.parentElement().childNodes[0]},v=function(t,i,a){var l=this.document,n=document.createElement(t);for(var o in i)n.setAttribute(o,i[o]);if(n.removeAttribute("text"),l.selection){var r=a.text||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.pasteHTML(e(n).prop("outerHTML")),a.select()}else{var r=a.toString()||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.deleteContents(),a.insertNode(n)}},h=function(t,i){var a=this.document,l="layedit-tool-active",n=p(m(a)),o=function(e){return t.find(".layedit-tool-"+e)};i&&i[i.hasClass(l)?"removeClass":"addClass"](l),t.find(">i").removeClass(l),o("unlink").addClass(r),e(n).parents().each(function(){var t=this.tagName.toLowerCase(),e=this.style.textAlign;"b"!==t&&"strong"!==t||o("b").addClass(l),"i"!==t&&"em"!==t||o("i").addClass(l),"u"===t&&o("u").addClass(l),"strike"===t&&o("d").addClass(l),"p"===t&&("center"===e?o("center").addClass(l):"right"===e?o("right").addClass(l):o("left").addClass(l)),"a"===t&&(o("link").addClass(l),o("unlink").removeClass(r))})},g=function(t,a,l){var n=t.document,o=e(n.body),c={link:function(i){var a=p(i),l=e(a).parent();b.call(o,{href:l.attr("href"),target:l.attr("target")},function(e){var a=l[0];"A"===a.tagName?a.href=e.url:v.call(t,"a",{target:e.target,href:e.url,text:e.url},i)})},unlink:function(t){n.execCommand("unlink")},face:function(e){x.call(this,function(i){v.call(t,"img",{src:i.src,alt:i.alt},e)})},image:function(a){var n=this;layui.use("upload",function(o){var r=l.uploadImage||{};o.render({url:r.url,method:r.type,elem:e(n).find("input")[0],done:function(e){0==e.code?(e.data=e.data||{},v.call(t,"img",{src:e.data.src,alt:e.data.title},a)):i.msg(e.msg||"上传失败")}})})},code:function(e){k.call(o,function(i){v.call(t,"pre",{text:i.code,"lay-lang":i.lang},e)})},help:function(){i.open({type:2,title:"帮助",area:["600px","380px"],shadeClose:!0,shade:.1,skin:"layui-layer-msg",content:["http://www.layui.com/about/layedit/help.html","no"]})}},s=a.find(".layui-layedit-tool"),u=function(){var i=e(this),a=i.attr("layedit-event"),l=i.attr("lay-command");if(!i.hasClass(r)){o.focus();var u=m(n);u.commonAncestorContainer;l?(n.execCommand(l),/justifyLeft|justifyCenter|justifyRight/.test(l)&&n.execCommand("formatBlock",!1,"

"),setTimeout(function(){o.focus()},10)):c[a]&&c[a].call(this,u),h.call(t,s,i)}},d=/image/;s.find(">i").on("mousedown",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)||u.call(this)}).on("click",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)&&u.call(this)}),o.on("click",function(){h.call(t,s),i.close(x.index)})},b=function(t,e){var l=this,n=i.open({type:1,id:"LAY_layedit_link",area:"350px",shade:.05,shadeClose:!0,moveType:1,title:"超链接",skin:"layui-layer-msg",content:['

    ','
  • ','','
    ','',"
    ","
  • ",'
  • ','','
    ','",'","
    ","
  • ",'
  • ','','',"
  • ","
"].join(""),success:function(t,n){var o="submit(layedit-link-yes)";a.render("radio"),t.find(".layui-btn-primary").on("click",function(){i.close(n),l.focus()}),a.on(o,function(t){i.close(b.index),e&&e(t.field)})}});b.index=n},x=function(t){var a=function(){var t=["[微笑]","[嘻嘻]","[哈哈]","[可爱]","[可怜]","[挖鼻]","[吃惊]","[害羞]","[挤眼]","[闭嘴]","[鄙视]","[爱你]","[泪]","[偷笑]","[亲亲]","[生病]","[太开心]","[白眼]","[右哼哼]","[左哼哼]","[嘘]","[衰]","[委屈]","[吐]","[哈欠]","[抱抱]","[怒]","[疑问]","[馋嘴]","[拜拜]","[思考]","[汗]","[困]","[睡]","[钱]","[失望]","[酷]","[色]","[哼]","[鼓掌]","[晕]","[悲伤]","[抓狂]","[黑线]","[阴险]","[怒骂]","[互粉]","[心]","[伤心]","[猪头]","[熊猫]","[兔子]","[ok]","[耶]","[good]","[NO]","[赞]","[来]","[弱]","[草泥马]","[神马]","[囧]","[浮云]","[给力]","[围观]","[威武]","[奥特曼]","[礼物]","[钟]","[话筒]","[蜡烛]","[蛋糕]"],e={};return layui.each(t,function(t,i){e[i]=layui.cache.dir+"images/face/"+t+".gif"}),e}();return x.hide=x.hide||function(t){"face"!==e(t.target).attr("layedit-event")&&i.close(x.index)},x.index=i.tips(function(){var t=[];return layui.each(a,function(e,i){t.push('
  • '+e+'
  • ')}),'
      '+t.join("")+"
    "}(),this,{tips:1,time:0,skin:"layui-box layui-util-face",maxWidth:500,success:function(l,n){l.css({marginTop:-4,marginLeft:-10}).find(".layui-clear>li").on("click",function(){t&&t({src:a[this.title],alt:this.title}),i.close(n)}),e(document).off("click",x.hide).on("click",x.hide)}})},k=function(t){var e=this,l=i.open({type:1,id:"LAY_layedit_code",area:"550px",shade:.05,shadeClose:!0,moveType:1,title:"插入代码",skin:"layui-layer-msg",content:['
      ','
    • ','','
      ','","
      ","
    • ",'
    • ','','
      ','',"
      ","
    • ",'
    • ','','',"
    • ","
    "].join(""),success:function(l,n){var o="submit(layedit-code-yes)";a.render("select"),l.find(".layui-btn-primary").on("click",function(){i.close(n),e.focus()}),a.on(o,function(e){i.close(k.index),t&&t(e.field)})}});k.index=l},C={html:'',strong:'',italic:'',underline:'',del:'',"|":'',left:'',center:'',right:'',link:'',unlink:'',face:'',image:'',code:'',help:''},w=new c;t(n,w)}); \ No newline at end of file diff --git a/public/static/lib/layui/lay/modules/layer.js b/public/static/lib/layui/lay/modules/layer.js new file mode 100644 index 00000000..bc816610 --- /dev/null +++ b/public/static/lib/layui/lay/modules/layer.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
    '+(f?r.title[0]:r.title)+"
    ":"";return r.zIndex=s,t([r.shade?'
    ':"",'
    '+(e&&2!=r.type?"":u)+'
    '+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
    '+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
    '+e+"
    "}():"")+(r.resize?'':"")+"
    "],u,i('
    ')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"","auto"];t.content='';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(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=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(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"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
      '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
    • '+(t[0].content||"no content")+"
    • ";i'+(t[i].content||"no content")+"";return a}()+"
    ",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||
    '+(u.length>1?'':"")+'
    '+(u[d].alt||"")+""+s.imgIndex+"/"+u.length+"
    ",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
    是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window); \ No newline at end of file diff --git a/public/static/lib/layui/lay/modules/laypage.js b/public/static/lib/layui/lay/modules/laypage.js new file mode 100644 index 00000000..478c11f2 --- /dev/null +++ b/public/static/lib/layui/lay/modules/laypage.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'共 '+a.count+" 条",limit:function(){var e=['"}(),refresh:['','',""].join(""),skip:function(){return['到第','','页',""].join("")}()};return['
    ',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
    "].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)}); \ No newline at end of file diff --git a/public/static/lib/layui/lay/modules/laytpl.js b/public/static/lib/layui/lay/modules/laytpl.js new file mode 100644 index 00000000..dd0d5671 --- /dev/null +++ b/public/static/lib/layui/lay/modules/laytpl.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)}); \ No newline at end of file diff --git a/public/static/lib/layui/lay/modules/mobile.js b/public/static/lib/layui/lay/modules/mobile.js new file mode 100644 index 00000000..bd2fe1bc --- /dev/null +++ b/public/static/lib/layui/lay/modules/mobile.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;layui.define(function(i){i("layui.mobile",layui.v)});layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});layui.define(function(e){"use strict";var t=(window,document),i="querySelectorAll",n="getElementsByClassName",a=function(e){return t[i](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var i in e)t[i]=e[i];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var o=0,r=["layui-m-layer"],d=function(e){var t=this;t.config=l.extend(e),t.view()};d.prototype.view=function(){var e=this,i=e.config,s=t.createElement("div");e.id=s.id=r[0]+o,s.setAttribute("class",r[0]+" "+r[0]+(i.type||0)),s.setAttribute("index",o);var l=function(){var e="object"==typeof i.title;return i.title?'

    '+(e?i.title[0]:i.title)+"

    ":""}(),d=function(){"string"==typeof i.btn&&(i.btn=[i.btn]);var e,t=(i.btn||[]).length;return 0!==t&&i.btn?(e=''+i.btn[0]+"",2===t&&(e=''+i.btn[1]+""+e),'
    '+e+"
    "):""}();if(i.fixed||(i.top=i.hasOwnProperty("top")?i.top:100,i.style=i.style||"",i.style+=" top:"+(t.body.scrollTop+i.top)+"px"),2===i.type&&(i.content='

    '+(i.content||"")+"

    "),i.skin&&(i.anim="up"),"msg"===i.skin&&(i.shade=!1),s.innerHTML=(i.shade?"
    ':"")+'
    "+l+'
    '+i.content+"
    "+d+"
    ",!i.type||2===i.type){var y=t[n](r[0]+i.type),u=y.length;u>=1&&c.close(y[0].getAttribute("index"))}document.body.appendChild(s);var m=e.elem=a("#"+e.id)[0];i.success&&i.success(m),e.index=o++,e.action(i,m)},d.prototype.action=function(e,t){var i=this;e.time&&(l.timer[i.index]=setTimeout(function(){c.close(i.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),c.close(i.index)):e.yes?e.yes(i.index):c.close(i.index)};if(e.btn)for(var s=t[n]("layui-m-layerbtn")[0].children,o=s.length,r=0;r0&&e-1 in t)}function s(t){return A.call(t,function(t){return null!=t})}function u(t){return t.length>0?T.fn.concat.apply([],t):t}function c(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function l(t){return t in F?F[t]:F[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function f(t,e){return"number"!=typeof e||k[c(t)]?e:e+"px"}function h(t){var e,n;return $[t]||(e=L.createElement(t),L.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),$[t]=n),$[t]}function p(t){return"children"in t?D.call(t.children):T.map(t.childNodes,function(t){if(1==t.nodeType)return t})}function d(t,e){var n,r=t?t.length:0;for(n=0;n]*>/,R=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Z=/^(?:body|html)$/i,q=/([A-Z])/g,H=["val","css","html","text","data","width","height","offset"],I=["after","prepend","before","append"],V=L.createElement("table"),_=L.createElement("tr"),B={tr:L.createElement("tbody"),tbody:V,thead:V,tfoot:V,td:_,th:_,"*":L.createElement("div")},U=/complete|loaded|interactive/,X=/^[\w-]*$/,J={},W=J.toString,Y={},G=L.createElement("div"),K={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},Q=Array.isArray||function(t){return t instanceof Array};return Y.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=G).appendChild(t),r=~Y.qsa(i,e).indexOf(t),o&&G.removeChild(t),r},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},N=function(t){return A.call(t,function(e,n){return t.indexOf(e)==n})},Y.fragment=function(t,e,n){var r,i,a;return R.test(t)&&(r=T(L.createElement(RegExp.$1))),r||(t.replace&&(t=t.replace(z,"<$1>")),e===E&&(e=M.test(t)&&RegExp.$1),e in B||(e="*"),a=B[e],a.innerHTML=""+t,r=T.each(D.call(a.childNodes),function(){a.removeChild(this)})),o(n)&&(i=T(r),T.each(n,function(t,e){H.indexOf(t)>-1?i[t](e):i.attr(t,e)})),r},Y.Z=function(t,e){return new d(t,e)},Y.isZ=function(t){return t instanceof Y.Z},Y.init=function(t,n){var r;if(!t)return Y.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&M.test(t))r=Y.fragment(t,RegExp.$1,n),t=null;else{if(n!==E)return T(n).find(t);r=Y.qsa(L,t)}else{if(e(t))return T(L).ready(t);if(Y.isZ(t))return t;if(Q(t))r=s(t);else if(i(t))r=[t],t=null;else if(M.test(t))r=Y.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==E)return T(n).find(t);r=Y.qsa(L,t)}}return Y.Z(r,t)},T=function(t,e){return Y.init(t,e)},T.extend=function(t){var e,n=D.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){m(t,n,e)}),t},Y.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,a=X.test(o);return t.getElementById&&a&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:D.call(a&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},T.contains=L.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},T.type=t,T.isFunction=e,T.isWindow=n,T.isArray=Q,T.isPlainObject=o,T.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},T.isNumeric=function(t){var e=Number(t),n=typeof t;return null!=t&&"boolean"!=n&&("string"!=n||t.length)&&!isNaN(e)&&isFinite(e)||!1},T.inArray=function(t,e,n){return O.indexOf.call(e,t,n)},T.camelCase=C,T.trim=function(t){return null==t?"":String.prototype.trim.call(t)},T.uuid=0,T.support={},T.expr={},T.noop=function(){},T.map=function(t,e){var n,r,i,o=[];if(a(t))for(r=0;r=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return O.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return e(t)?this.not(this.not(t)):T(A.call(this,function(e){return Y.matches(e,t)}))},add:function(t,e){return T(N(this.concat(T(t,e))))},is:function(t){return this.length>0&&Y.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==E)this.each(function(e){t.call(this,e)||n.push(this)});else{var r="string"==typeof t?this.filter(t):a(t)&&e(t.item)?D.call(t):T(t);this.forEach(function(t){r.indexOf(t)<0&&n.push(t)})}return T(n)},has:function(t){return this.filter(function(){return i(t)?T.contains(this,t):T(this).find(t).size()})},eq:function(t){return t===-1?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!i(t)?t:T(t)},last:function(){var t=this[this.length-1];return t&&!i(t)?t:T(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?T(t).filter(function(){var t=this;return O.some.call(n,function(e){return T.contains(e,t)})}):1==this.length?T(Y.qsa(this[0],t)):this.map(function(){return Y.qsa(this,t)}):T()},closest:function(t,e){var n=[],i="object"==typeof t&&T(t);return this.each(function(o,a){for(;a&&!(i?i.indexOf(a)>=0:Y.matches(a,t));)a=a!==e&&!r(a)&&a.parentNode;a&&n.indexOf(a)<0&&n.push(a)}),T(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=T.map(n,function(t){if((t=t.parentNode)&&!r(t)&&e.indexOf(t)<0)return e.push(t),t});return v(e,t)},parent:function(t){return v(N(this.pluck("parentNode")),t)},children:function(t){return v(this.map(function(){return p(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||D.call(this.childNodes)})},siblings:function(t){return v(this.map(function(t,e){return A.call(p(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return T.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=h(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=e(t);if(this[0]&&!n)var r=T(t).get(0),i=r.parentNode||this.length>1;return this.each(function(e){T(this).wrapAll(n?t.call(this,e):i?r.cloneNode(!0):r)})},wrapAll:function(t){if(this[0]){T(this[0]).before(t=T(t));for(var e;(e=t.children()).length;)t=e.first();T(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each(function(e){var r=T(this),i=r.contents(),o=n?t.call(this,e):t;i.length?i.wrapAll(o):r.append(o)})},unwrap:function(){return this.parent().each(function(){T(this).replaceWith(T(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var e=T(this);(t===E?"none"==e.css("display"):t)?e.show():e.hide()})},prev:function(t){return T(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return T(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;T(this).empty().append(g(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=g(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(t,e){var n;return"string"!=typeof t||1 in arguments?this.each(function(n){if(1===this.nodeType)if(i(t))for(j in t)y(this,j,t[j]);else y(this,t,g(this,e,n,this.getAttribute(t)))}):0 in this&&1==this[0].nodeType&&null!=(n=this[0].getAttribute(t))?n:E},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){y(this,t)},this)})},prop:function(t,e){return t=K[t]||t,1 in arguments?this.each(function(n){this[t]=g(this,e,n,this[t])}):this[0]&&this[0][t]},removeProp:function(t){return t=K[t]||t,this.each(function(){delete this[t]})},data:function(t,e){var n="data-"+t.replace(q,"-$1").toLowerCase(),r=1 in arguments?this.attr(n,e):this.attr(n);return null!==r?b(r):E},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each(function(e){this.value=g(this,t,e,this.value)})):this[0]&&(this[0].multiple?T(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var n=T(this),r=g(this,t,e,n.offset()),i=n.offsetParent().offset(),o={top:r.top-i.top,left:r.left-i.left};"static"==n.css("position")&&(o.position="relative"),n.css(o)});if(!this.length)return null;if(L.documentElement!==this[0]&&!T.contains(L.documentElement,this[0]))return{top:0,left:0};var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(e,n){if(arguments.length<2){var r=this[0];if("string"==typeof e){if(!r)return;return r.style[C(e)]||getComputedStyle(r,"").getPropertyValue(e)}if(Q(e)){if(!r)return;var i={},o=getComputedStyle(r,"");return T.each(e,function(t,e){i[e]=r.style[C(e)]||o.getPropertyValue(e)}),i}}var a="";if("string"==t(e))n||0===n?a=c(e)+":"+f(e,n):this.each(function(){this.style.removeProperty(c(e))});else for(j in e)e[j]||0===e[j]?a+=c(j)+":"+f(j,e[j])+";":this.each(function(){this.style.removeProperty(c(j))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(T(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return!!t&&O.some.call(this,function(t){return this.test(x(t))},l(t))},addClass:function(t){return t?this.each(function(e){if("className"in this){S=[];var n=x(this),r=g(this,t,e,n);r.split(/\s+/g).forEach(function(t){T(this).hasClass(t)||S.push(t)},this),S.length&&x(this,n+(n?" ":"")+S.join(" "))}}):this},removeClass:function(t){return this.each(function(e){if("className"in this){if(t===E)return x(this,"");S=x(this),g(this,t,e,S).split(/\s+/g).forEach(function(t){S=S.replace(l(t)," ")}),x(this,S.trim())}})},toggleClass:function(t,e){return t?this.each(function(n){var r=T(this),i=g(this,t,n,x(this));i.split(/\s+/g).forEach(function(t){(e===E?!r.hasClass(t):e)?r.addClass(t):r.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===E?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===E?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),r=Z.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(T(t).css("margin-top"))||0,n.left-=parseFloat(T(t).css("margin-left"))||0,r.top+=parseFloat(T(e[0]).css("border-top-width"))||0,r.left+=parseFloat(T(e[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||L.body;t&&!Z.test(t.nodeName)&&"static"==T(t).css("position");)t=t.offsetParent;return t})}},T.fn.detach=T.fn.remove,["width","height"].forEach(function(t){var e=t.replace(/./,function(t){return t[0].toUpperCase()});T.fn[t]=function(i){var o,a=this[0];return i===E?n(a)?a["inner"+e]:r(a)?a.documentElement["scroll"+e]:(o=this.offset())&&o[t]:this.each(function(e){a=T(this),a.css(t,g(this,i,e,a[t]()))})}}),I.forEach(function(e,n){var r=n%2;T.fn[e]=function(){var e,i,o=T.map(arguments,function(n){var r=[];return e=t(n),"array"==e?(n.forEach(function(t){return t.nodeType!==E?r.push(t):T.zepto.isZ(t)?r=r.concat(t.get()):void(r=r.concat(Y.fragment(t)))}),r):"object"==e||null==n?n:Y.fragment(n)}),a=this.length>1;return o.length<1?this:this.each(function(t,e){i=r?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null;var s=T.contains(L.documentElement,i);o.forEach(function(t){if(a)t=t.cloneNode(!0);else if(!i)return T(t).remove();i.insertBefore(t,e),s&&w(t,function(t){if(!(null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src)){var e=t.ownerDocument?t.ownerDocument.defaultView:window;e.eval.call(e,t.innerHTML)}})})})},T.fn[r?e+"To":"insert"+(n?"Before":"After")]=function(t){return T(t)[e](this),this}}),Y.Z.prototype=d.prototype=T.fn,Y.uniq=N,Y.deserializeValue=b,T.zepto=Y,T}();!function(t){function e(t){return t._zid||(t._zid=h++)}function n(t,n,o,a){if(n=r(n),n.ns)var s=i(n.ns);return(v[e(t)]||[]).filter(function(t){return t&&(!n.e||t.e==n.e)&&(!n.ns||s.test(t.ns))&&(!o||e(t.fn)===e(o))&&(!a||t.sel==a)})}function r(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function i(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function o(t,e){return t.del&&!y&&t.e in x||!!e}function a(t){return b[t]||y&&x[t]||t}function s(n,i,s,u,l,h,p){var d=e(n),m=v[d]||(v[d]=[]);i.split(/\s/).forEach(function(e){if("ready"==e)return t(document).ready(s);var i=r(e);i.fn=s,i.sel=l,i.e in b&&(s=function(e){var n=e.relatedTarget;if(!n||n!==this&&!t.contains(this,n))return i.fn.apply(this,arguments)}),i.del=h;var d=h||s;i.proxy=function(t){if(t=c(t),!t.isImmediatePropagationStopped()){t.data=u;var e=d.apply(n,t._args==f?[t]:[t].concat(t._args));return e===!1&&(t.preventDefault(),t.stopPropagation()),e}},i.i=m.length,m.push(i),"addEventListener"in n&&n.addEventListener(a(i.e),i.proxy,o(i,p))})}function u(t,r,i,s,u){var c=e(t);(r||"").split(/\s/).forEach(function(e){n(t,e,i,s).forEach(function(e){delete v[c][e.i],"removeEventListener"in t&&t.removeEventListener(a(e.e),e.proxy,o(e,u))})})}function c(e,n){return!n&&e.isDefaultPrevented||(n||(n=e),t.each(T,function(t,r){var i=n[t];e[t]=function(){return this[r]=w,i&&i.apply(n,arguments)},e[r]=E}),e.timeStamp||(e.timeStamp=Date.now()),(n.defaultPrevented!==f?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=w)),e}function l(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===f||(n[e]=t[e]);return c(n,t)}var f,h=1,p=Array.prototype.slice,d=t.isFunction,m=function(t){return"string"==typeof t},v={},g={},y="onfocusin"in window,x={focus:"focusin",blur:"focusout"},b={mouseenter:"mouseover",mouseleave:"mouseout"};g.click=g.mousedown=g.mouseup=g.mousemove="MouseEvents",t.event={add:s,remove:u},t.proxy=function(n,r){var i=2 in arguments&&p.call(arguments,2);if(d(n)){var o=function(){return n.apply(r,i?i.concat(p.call(arguments)):arguments)};return o._zid=e(n),o}if(m(r))return i?(i.unshift(n[r],n),t.proxy.apply(null,i)):t.proxy(n[r],n);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var w=function(){return!0},E=function(){return!1},j=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,T={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,n,r,i,o){var a,c,h=this;return e&&!m(e)?(t.each(e,function(t,e){h.on(t,n,r,e,o)}),h):(m(n)||d(i)||i===!1||(i=r,r=n,n=f),i!==f&&r!==!1||(i=r,r=f),i===!1&&(i=E),h.each(function(f,h){o&&(a=function(t){return u(h,t.type,i),i.apply(this,arguments)}),n&&(c=function(e){var r,o=t(e.target).closest(n,h).get(0);if(o&&o!==h)return r=t.extend(l(e),{currentTarget:o,liveFired:h}),(a||i).apply(o,[r].concat(p.call(arguments,1)))}),s(h,e,i,r,n,c||a)}))},t.fn.off=function(e,n,r){var i=this;return e&&!m(e)?(t.each(e,function(t,e){i.off(t,n,e)}),i):(m(n)||d(r)||r===!1||(r=n,n=f),r===!1&&(r=E),i.each(function(){u(this,e,r,n)}))},t.fn.trigger=function(e,n){return e=m(e)||t.isPlainObject(e)?t.Event(e):c(e),e._args=n,this.each(function(){e.type in x&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,r){var i,o;return this.each(function(a,s){i=l(m(e)?t.Event(e):e),i._args=r,i.target=s,t.each(n(s,e.type||e),function(t,e){if(o=e.proxy(i),i.isImmediatePropagationStopped())return!1})}),o},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){m(t)||(e=t,t=e.type);var n=document.createEvent(g[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),c(n)}}(e),function(t){function e(e,n,r){var i=t.Event(n);return t(e).trigger(i,r),!i.isDefaultPrevented()}function n(t,n,r,i){if(t.global)return e(n||x,r,i)}function r(e){e.global&&0===t.active++&&n(e,null,"ajaxStart")}function i(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}function o(t,e){var r=e.context;return e.beforeSend.call(r,t,e)!==!1&&n(e,r,"ajaxBeforeSend",[t,e])!==!1&&void n(e,r,"ajaxSend",[t,e])}function a(t,e,r,i){var o=r.context,a="success";r.success.call(o,t,a,e),i&&i.resolveWith(o,[t,a,e]),n(r,o,"ajaxSuccess",[e,r,t]),u(a,e,r)}function s(t,e,r,i,o){var a=i.context;i.error.call(a,r,e,t),o&&o.rejectWith(a,[r,e,t]),n(i,a,"ajaxError",[r,i,t||e]),u(e,r,i)}function u(t,e,r){var o=r.context;r.complete.call(o,e,t),n(r,o,"ajaxComplete",[e,r]),i(r)}function c(t,e,n){if(n.dataFilter==l)return t;var r=n.context;return n.dataFilter.call(r,t,e)}function l(){}function f(t){return t&&(t=t.split(";",2)[0]),t&&(t==T?"html":t==j?"json":w.test(t)?"script":E.test(t)&&"xml")||"text"}function h(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function p(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()&&"jsonp"!=e.dataType||(e.url=h(e.url,e.data),e.data=void 0)}function d(e,n,r,i){return t.isFunction(n)&&(i=r,r=n,n=void 0),t.isFunction(r)||(i=r,r=void 0),{url:e,data:n,success:r,dataType:i}}function m(e,n,r,i){var o,a=t.isArray(n),s=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),i&&(n=r?i:i+"["+(s||"object"==o||"array"==o?n:"")+"]"),!i&&a?e.add(u.name,u.value):"array"==o||!r&&"object"==o?m(e,u,r,n):e.add(n,u)})}var v,g,y=+new Date,x=window.document,b=/)<[^<]*)*<\/script>/gi,w=/^(?:text|application)\/javascript/i,E=/^(?:text|application)\/xml/i,j="application/json",T="text/html",S=/^\s*$/,C=x.createElement("a");C.href=window.location.href,t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var r,i,u=e.jsonpCallback,c=(t.isFunction(u)?u():u)||"Zepto"+y++,l=x.createElement("script"),f=window[c],h=function(e){t(l).triggerHandler("error",e||"abort")},p={abort:h};return n&&n.promise(p),t(l).on("load error",function(o,u){clearTimeout(i),t(l).off().remove(),"error"!=o.type&&r?a(r[0],p,e,n):s(null,u||"error",p,e,n),window[c]=f,r&&t.isFunction(f)&&f(r[0]),f=r=void 0}),o(p,e)===!1?(h("abort"),p):(window[c]=function(){r=arguments},l.src=e.url.replace(/\?(.+)=\?/,"?$1="+c),x.head.appendChild(l),e.timeout>0&&(i=setTimeout(function(){h("timeout")},e.timeout)),p)},t.ajaxSettings={type:"GET",beforeSend:l,success:l,error:l,complete:l,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:j,xml:"application/xml, text/xml",html:T,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:l},t.ajax=function(e){var n,i,u=t.extend({},e||{}),d=t.Deferred&&t.Deferred();for(v in t.ajaxSettings)void 0===u[v]&&(u[v]=t.ajaxSettings[v]);r(u),u.crossDomain||(n=x.createElement("a"),n.href=u.url,n.href=n.href,u.crossDomain=C.protocol+"//"+C.host!=n.protocol+"//"+n.host),u.url||(u.url=window.location.toString()),(i=u.url.indexOf("#"))>-1&&(u.url=u.url.slice(0,i)),p(u);var m=u.dataType,y=/\?.+=\?/.test(u.url);if(y&&(m="jsonp"),u.cache!==!1&&(e&&e.cache===!0||"script"!=m&&"jsonp"!=m)||(u.url=h(u.url,"_="+Date.now())),"jsonp"==m)return y||(u.url=h(u.url,u.jsonp?u.jsonp+"=?":u.jsonp===!1?"":"callback=?")),t.ajaxJSONP(u,d);var b,w=u.accepts[m],E={},j=function(t,e){E[t.toLowerCase()]=[t,e]},T=/^([\w-]+:)\/\//.test(u.url)?RegExp.$1:window.location.protocol,N=u.xhr(),O=N.setRequestHeader;if(d&&d.promise(N),u.crossDomain||j("X-Requested-With","XMLHttpRequest"),j("Accept",w||"*/*"),(w=u.mimeType||w)&&(w.indexOf(",")>-1&&(w=w.split(",",2)[0]),N.overrideMimeType&&N.overrideMimeType(w)),(u.contentType||u.contentType!==!1&&u.data&&"GET"!=u.type.toUpperCase())&&j("Content-Type",u.contentType||"application/x-www-form-urlencoded"),u.headers)for(g in u.headers)j(g,u.headers[g]);if(N.setRequestHeader=j,N.onreadystatechange=function(){if(4==N.readyState){N.onreadystatechange=l,clearTimeout(b);var e,n=!1;if(N.status>=200&&N.status<300||304==N.status||0==N.status&&"file:"==T){if(m=m||f(u.mimeType||N.getResponseHeader("content-type")),"arraybuffer"==N.responseType||"blob"==N.responseType)e=N.response;else{e=N.responseText;try{e=c(e,m,u),"script"==m?(0,eval)(e):"xml"==m?e=N.responseXML:"json"==m&&(e=S.test(e)?null:t.parseJSON(e))}catch(r){n=r}if(n)return s(n,"parsererror",N,u,d)}a(e,N,u,d)}else s(N.statusText||null,N.status?"error":"abort",N,u,d)}},o(N,u)===!1)return N.abort(),s(null,"abort",N,u,d),N;var P=!("async"in u)||u.async;if(N.open(u.type,u.url,P,u.username,u.password),u.xhrFields)for(g in u.xhrFields)N[g]=u.xhrFields[g];for(g in E)O.apply(N,E[g]);return u.timeout>0&&(b=setTimeout(function(){N.onreadystatechange=l,N.abort(),s(null,"timeout",N,u,d)},u.timeout)),N.send(u.data?u.data:null),N},t.get=function(){return t.ajax(d.apply(null,arguments))},t.post=function(){var e=d.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=d.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,r){if(!this.length)return this;var i,o=this,a=e.split(/\s/),s=d(e,n,r),u=s.success;return a.length>1&&(s.url=a[0],i=a[1]),s.success=function(e){o.html(i?t("
    ").html(e.replace(b,"")).find(i):e),u&&u.apply(o,arguments)},t.ajax(s),this};var N=encodeURIComponent;t.param=function(e,n){var r=[];return r.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(N(e)+"="+N(n))},m(r,e,n),r.join("&").replace(/%20/g,"+")}}(e),function(t){t.fn.serializeArray=function(){var e,n,r=[],i=function(t){return t.forEach?t.forEach(i):void r.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(r,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&i(t(o).val())}),r},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(e),function(){try{getComputedStyle(void 0)}catch(t){var e=getComputedStyle;window.getComputedStyle=function(t,n){try{return e(t,n)}catch(r){return null}}}}(),t("zepto",e)});layui.define(function(i){i("layim-mobile",layui.v)});layui["layui.mobile"]||layui.config({base:layui.cache.dir+"lay/modules/mobile/"}).extend({"layer-mobile":"layer-mobile",zepto:"zepto","upload-mobile":"upload-mobile","layim-mobile":"layim-mobile"}),layui.define(["layer-mobile","zepto","layim-mobile"],function(l){l("mobile",{layer:layui["layer-mobile"],layim:layui["layim-mobile"]})}); \ No newline at end of file diff --git a/public/static/lib/layui/lay/modules/rate.js b/public/static/lib/layui/lay/modules/rate.js new file mode 100644 index 00000000..bcc103fe --- /dev/null +++ b/public/static/lib/layui/lay/modules/rate.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;layui.define("jquery",function(e){"use strict";var a=layui.jquery,i={config:{},index:layui.rate?layui.rate.index+1e4:0,set:function(e){var i=this;return i.config=a.extend({},i.config,e),i},on:function(e,a){return layui.onevent.call(this,n,e,a)}},l=function(){var e=this,a=e.config;return{setvalue:function(a){e.setvalue.call(e,a)},config:a}},n="rate",t="layui-rate",o="layui-icon-rate",s="layui-icon-rate-solid",u="layui-icon-rate-half",r="layui-icon-rate-solid layui-icon-rate-half",c="layui-icon-rate-solid layui-icon-rate",f="layui-icon-rate layui-icon-rate-half",v=function(e){var l=this;l.index=++i.index,l.config=a.extend({},l.config,i.config,e),l.render()};v.prototype.config={length:5,text:!1,readonly:!1,half:!1,value:0,theme:""},v.prototype.render=function(){var e=this,i=e.config,l=i.theme?'style="color: '+i.theme+';"':"";i.elem=a(i.elem),parseInt(i.value)!==i.value&&(i.half||(i.value=Math.ceil(i.value)-i.value<.5?Math.ceil(i.value):Math.floor(i.value)));for(var n='
      ",u=1;u<=i.length;u++){var r='
    • ";i.half&&parseInt(i.value)!==i.value&&u==Math.ceil(i.value)?n=n+'
    • ":n+=r}n+="
    "+(i.text?''+i.value+"星":"")+"";var c=i.elem,f=c.next("."+t);f[0]&&f.remove(),e.elemTemp=a(n),i.span=e.elemTemp.next("span"),i.setText&&i.setText(i.value),c.html(e.elemTemp),c.addClass("layui-inline"),i.readonly||e.action()},v.prototype.setvalue=function(e){var a=this,i=a.config;i.value=e,a.render()},v.prototype.action=function(){var e=this,i=e.config,l=e.elemTemp,n=l.find("i").width();l.children("li").each(function(e){var t=e+1,v=a(this);v.on("click",function(e){if(i.value=t,i.half){var o=e.pageX-a(this).offset().left;o<=n/2&&(i.value=i.value-.5)}i.text&&l.next("span").text(i.value+"星"),i.choose&&i.choose(i.value),i.setText&&i.setText(i.value)}),v.on("mousemove",function(e){if(l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+t+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half){var c=e.pageX-a(this).offset().left;c<=n/2&&v.children("i").addClass(u).removeClass(s)}}),v.on("mouseleave",function(){l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+Math.floor(i.value)+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half&&parseInt(i.value)!==i.value&&l.children("li:eq("+Math.floor(i.value)+")").children("i").addClass(u).removeClass(c)})})},v.prototype.events=function(){var e=this;e.config},i.render=function(e){var a=new v(e);return l.call(a)},e(n,i)}); \ No newline at end of file diff --git a/public/static/lib/layui/lay/modules/slider.js b/public/static/lib/layui/lay/modules/slider.js new file mode 100644 index 00000000..c39707d0 --- /dev/null +++ b/public/static/lib/layui/lay/modules/slider.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;layui.define("jquery",function(e){"use strict";var i=layui.jquery,t={config:{},index:layui.slider?layui.slider.index+1e4:0,set:function(e){var t=this;return t.config=i.extend({},t.config,e),t},on:function(e,i){return layui.onevent.call(this,n,e,i)}},a=function(){var e=this,i=e.config;return{setValue:function(i,t){return e.slide("set",i,t||0)},config:i}},n="slider",l="layui-disabled",s="layui-slider",r="layui-slider-bar",o="layui-slider-wrap",u="layui-slider-wrap-btn",d="layui-slider-tips",v="layui-slider-input",c="layui-slider-input-txt",m="layui-slider-input-btn",p="layui-slider-hover",f=function(e){var a=this;a.index=++t.index,a.config=i.extend({},a.config,t.config,e),a.render()};f.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:"#009688"},f.prototype.render=function(){var e=this,t=e.config;if(t.step<1&&(t.step=1),t.maxt.min?a:t.min,t.value[1]=n>t.min?n:t.min,t.value[0]=t.value[0]>t.max?t.max:t.value[0],t.value[1]=t.value[1]>t.max?t.max:t.value[1];var r=Math.floor((t.value[0]-t.min)/(t.max-t.min)*100),v=Math.floor((t.value[1]-t.min)/(t.max-t.min)*100),m=v-r+"%";r+="%",v+="%"}else{"object"==typeof t.value&&(t.value=Math.min.apply(null,t.value)),t.valuet.max&&(t.value=t.max);var m=Math.floor((t.value-t.min)/(t.max-t.min)*100)+"%"}var p=t.disabled?"#c2c2c2":t.theme,f='
    '+(t.tips?'
    ':"")+'
    '+(t.range?'
    ':"")+"
    ",h=i(t.elem),y=h.next("."+s);if(y[0]&&y.remove(),e.elemTemp=i(f),t.range?(e.elemTemp.find("."+o).eq(0).data("value",t.value[0]),e.elemTemp.find("."+o).eq(1).data("value",t.value[1])):e.elemTemp.find("."+o).data("value",t.value),h.html(e.elemTemp),"vertical"===t.type&&e.elemTemp.height(t.height+"px"),t.showstep){for(var g=(t.max-t.min)/t.step,b="",x=1;x
    ')}e.elemTemp.append(b)}if(t.input&&!t.range){var w=i('
    ');h.css("position","relative"),h.append(w),h.find("."+c).children("input").val(t.value),"vertical"===t.type?w.css({left:0,top:-48}):e.elemTemp.css("margin-right",w.outerWidth()+15)}t.disabled?(e.elemTemp.addClass(l),e.elemTemp.find("."+u).addClass(l)):e.slide(),e.elemTemp.find("."+u).on("mouseover",function(){var a="vertical"===t.type?t.height:e.elemTemp[0].offsetWidth,n=e.elemTemp.find("."+o),l="vertical"===t.type?a-i(this).parent()[0].offsetTop-n.height():i(this).parent()[0].offsetLeft,s=l/a*100,r=i(this).parent().data("value"),u=t.setTips?t.setTips(r):r;e.elemTemp.find("."+d).html(u),"vertical"===t.type?e.elemTemp.find("."+d).css({bottom:s+"%","margin-bottom":"20px",display:"inline-block"}):e.elemTemp.find("."+d).css({left:s+"%",display:"inline-block"})}).on("mouseout",function(){e.elemTemp.find("."+d).css("display","none")})},f.prototype.slide=function(e,t,a){var n=this,l=n.config,s=n.elemTemp,f=function(){return"vertical"===l.type?l.height:s[0].offsetWidth},h=s.find("."+o),y=s.next("."+v),g=y.children("."+c).children("input").val(),b=100/((l.max-l.min)/Math.ceil(l.step)),x=function(e,i){e=Math.ceil(e)*b>100?Math.ceil(e)*b:Math.round(e)*b,e=e>100?100:e,h.eq(i).css("vertical"===l.type?"bottom":"left",e+"%");var t=T(h[0].offsetLeft),a=l.range?T(h[1].offsetLeft):0;"vertical"===l.type?(s.find("."+d).css({bottom:e+"%","margin-bottom":"20px"}),t=T(f()-h[0].offsetTop-h.height()),a=l.range?T(f()-h[1].offsetTop-h.height()):0):s.find("."+d).css("left",e+"%"),t=t>100?100:t,a=a>100?100:a;var n=Math.min(t,a),o=Math.abs(t-a);"vertical"===l.type?s.find("."+r).css({height:o+"%",bottom:n+"%"}):s.find("."+r).css({width:o+"%",left:n+"%"});var u=l.min+Math.round((l.max-l.min)*e/100);if(g=u,y.children("."+c).children("input").val(g),h.eq(i).data("value",u),u=l.setTips?l.setTips(u):u,s.find("."+d).html(u),l.range){var v=[h.eq(0).data("value"),h.eq(1).data("value")];v[0]>v[1]&&v.reverse()}l.change&&l.change(l.range?v:u)},T=function(e){var i=e/f()*100/b,t=Math.round(i)*b;return e==f()&&(t=Math.ceil(i)*b),t},w=i(['
    f()&&(r=f());var o=r/f()*100/b;x(o,e),t.addClass(p),s.find("."+d).show(),i.preventDefault()},o=function(){t.removeClass(p),s.find("."+d).hide()};M(r,o)})}),s.on("click",function(e){var t=i("."+u);if(!t.is(event.target)&&0===t.has(event.target).length&&t.length){var a,n="vertical"===l.type?f()-e.clientY+i(this).offset().top:e.clientX-i(this).offset().left;n<0&&(n=0),n>f()&&(n=f());var s=n/f()*100/b;a=l.range?"vertical"===l.type?Math.abs(n-parseInt(i(h[0]).css("bottom")))>Math.abs(n-parseInt(i(h[1]).css("bottom")))?1:0:Math.abs(n-h[0].offsetLeft)>Math.abs(n-h[1].offsetLeft)?1:0:0,x(s,a),e.preventDefault()}}),y.hover(function(){var e=i(this);e.children("."+m).fadeIn("fast")},function(){var e=i(this);e.children("."+m).fadeOut("fast")}),y.children("."+m).children("i").each(function(e){i(this).on("click",function(){g=1==e?g-l.stepl.max?l.max:Number(g)+l.step;var i=(g-l.min)/(l.max-l.min)*100/b;x(i,0)})});var q=function(){var e=this.value;e=isNaN(e)?0:e,e=el.max?l.max:e,this.value=e;var i=(e-l.min)/(l.max-l.min)*100/b;x(i,0)};y.children("."+c).children("input").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),q.call(this))}).on("change",q)},f.prototype.events=function(){var e=this;e.config},t.render=function(e){var i=new f(e);return a.call(i)},e(n,t)}); \ No newline at end of file diff --git a/public/static/lib/layui/lay/modules/table.js b/public/static/lib/layui/lay/modules/table.js new file mode 100644 index 00000000..51b697f9 --- /dev/null +++ b/public/static/lib/layui/lay/modules/table.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;layui.define(["laytpl","laypage","layer","form","util"],function(e){"use strict";var t=layui.$,i=layui.laytpl,a=layui.laypage,l=layui.layer,n=layui.form,o=(layui.util,layui.hint()),r=layui.device(),d={config:{checkName:"LAY_CHECKED",indexName:"LAY_TABLE_INDEX"},cache:{},index:layui.table?layui.table.index+1e4:0,set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,y,e,t)}},c=function(){var e=this,t=e.config,i=t.id||t.index;return i&&(c.that[i]=e,c.config[i]=t),{config:t,reload:function(t){e.reload.call(e,t)},setColsWidth:function(){e.setColsWidth.call(e)},resize:function(){e.resize.call(e)}}},s=function(e){var t=c.config[e];return t||o.error("The ID option was not found in the table instance"),t||null},u=function(e,a,l,n){var o=e.templet?function(){return"function"==typeof e.templet?e.templet(l):i(t(e.templet).html()||String(a)).render(l)}():a;return n?t("
    "+o+"
    ").text():o},y="table",h=".layui-table",f="layui-hide",p="layui-none",v="layui-table-view",m=".layui-table-tool",g=".layui-table-box",b=".layui-table-init",x=".layui-table-header",k=".layui-table-body",C=".layui-table-main",w=".layui-table-fixed",T=".layui-table-fixed-l",A=".layui-table-fixed-r",L=".layui-table-total",N=".layui-table-page",S=".layui-table-sort",W="layui-table-edit",_="layui-table-hover",E=function(e){var t='{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}';return e=e||{},['
    ',"","{{# 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; } }}',function(){return 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("")},z=['',"","
    "].join(""),H=['
    ',"{{# if(d.data.toolbar){ }}",'
    ','
    ','
    ',"
    ","{{# } }}",'
    ',"{{# if(d.data.loading){ }}",'
    ','',"
    ","{{# } }}","{{# var left, right; }}",'
    ',E(),"
    ",'
    ',z,"
    ","{{# if(left){ }}",'
    ','
    ',E({fixed:!0}),"
    ",'
    ',z,"
    ","
    ","{{# }; }}","{{# if(right){ }}",'
    ','
    ',E({fixed:"right"}),'
    ',"
    ",'
    ',z,"
    ","
    ","{{# }; }}","
    ","{{# if(d.data.totalRow){ }}",'
    ','','',"
    ","
    ","{{# } }}","{{# if(d.data.page){ }}",'
    ','
    ',"
    ","{{# } }}","","
    "].join(""),R=t(window),F=t(document),j=function(e){var i=this;i.index=++d.index,i.config=t.extend({},i.config,d.config,e),i.render()};j.prototype.config={limit:10,loading:!0,cellMinWidth:60,defaultToolbar:["filter","exports","print"],autoSort:!0,text:{none:"无数据"}},j.prototype.render=function(){var e=this,a=e.config;if(a.elem=t(a.elem),a.where=a.where||{},a.id=a.id||a.elem.attr("id")||e.index,a.request=t.extend({pageName:"page",limitName:"limit"},a.request),a.response=t.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",countName:"count"},a.response),"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,e.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return e;a.height&&/^full-\d+$/.test(a.height)&&(e.fullHeightGap=a.height.split("-")[1],a.height=R.height()-e.fullHeightGap),e.setInit();var l=a.elem,n=l.next("."+v),o=e.elem=t(i(H).render({VIEW_CLASS:v,data:a,index:e.index}));if(a.index=e.index,e.key=a.id||a.index,n[0]&&n.remove(),l.after(o),e.layTool=o.find(m),e.layBox=o.find(g),e.layHeader=o.find(x),e.layMain=o.find(C),e.layBody=o.find(k),e.layFixed=o.find(w),e.layFixLeft=o.find(T),e.layFixRight=o.find(A),e.layTotal=o.find(L),e.layPage=o.find(N),e.renderToolbar(),e.fullSize(),a.cols.length>1){var r=e.layFixed.find(x).find("th");r.height(e.layHeader.height()-1-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom")))}e.pullData(e.page),e.events()},j.prototype.initOpts=function(e){var t=this,i=(t.config,{checkbox:48,radio:48,space:15,numbers:40});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||i[e.type])},j.prototype.setInit=function(e){var t=this,i=t.config;return i.clientWidth=i.width||function(){var e=function(t){var a,l;t=t||i.elem.parent(),a=t.width();try{l="none"===t.css("display")}catch(n){}return!t[0]||a&&!l?a:e(t.parent())};return e()}(),"width"===e?i.clientWidth:void layui.each(i.cols,function(e,a){layui.each(a,function(l,n){if(!n)return void a.splice(l,1);if(n.key=e+"-"+l,n.hide=n.hide||!1,n.colGroup||n.colspan>1){var o=0;layui.each(i.cols[e+1],function(t,i){i.HAS_PARENT||o>1&&o==n.colspan||(i.HAS_PARENT=!0,i.parentKey=e+"-"+l,o+=parseInt(i.colspan>1?i.colspan:1))}),n.colGroup=!0}t.initOpts(n)})})},j.prototype.renderToolbar=function(){var e=this,a=e.config,l=['
    ','
    ','
    '].join(""),n=e.layTool.find(".layui-table-tool-temp");if("default"===a.toolbar)n.html(l);else if("string"==typeof a.toolbar){var o=t(a.toolbar).html()||"";o&&n.html(i(o).render(a))}var r={filter:{title:"筛选列",layEvent:"LAYTABLE_COLS",icon:"layui-icon-cols"},exports:{title:"导出",layEvent:"LAYTABLE_EXPORT",icon:"layui-icon-export"},print:{title:"打印",layEvent:"LAYTABLE_PRINT",icon:"layui-icon-print"}},d=[];"object"==typeof a.defaultToolbar&&layui.each(a.defaultToolbar,function(e,t){var i="string"==typeof t?r[t]:t;i&&d.push('
    ')}),e.layTool.find(".layui-table-tool-self").html(d.join(""))},j.prototype.setParentCol=function(e,t){var i=this,a=i.config,l=i.layHeader.find('th[data-key="'+a.index+"-"+t+'"]'),n=parseInt(l.attr("colspan"))||0;if(l[0]){var o=t.split("-"),r=a.cols[o[0]][o[1]];e?n--:n++,l.attr("colspan",n),l[n<1?"addClass":"removeClass"](f),r.colspan=n,r.hide=n<1;var d=l.data("parentkey");d&&i.setParentCol(e,d)}},j.prototype.setColsPatch=function(){var e=this,t=e.config;layui.each(t.cols,function(t,i){layui.each(i,function(t,i){i.hide&&e.setParentCol(i.hide,i.parentKey)})})},j.prototype.setColsWidth=function(){var e=this,t=e.config,i=0,a=0,l=0,n=0,o=e.setInit("width");e.eachCols(function(e,t){t.hide||i++}),o=o-function(){return"line"===t.skin||"nob"===t.skin?2:i+1}()-e.getScrollWidth(e.layMain[0])-1;var r=function(e){layui.each(t.cols,function(i,r){layui.each(r,function(i,d){var c=0,s=d.minWidth||t.cellMinWidth;return d?void(d.colGroup||d.hide||(e?l&&ln&&a&&(l=(o-n)/a)};r(),r(!0),e.autoColNums=a,e.eachCols(function(i,a){var n=a.minWidth||t.cellMinWidth;a.colGroup||a.hide||(0===a.width?e.getCssRule(t.index+"-"+a.key,function(e){e.style.width=Math.floor(l>=n?l:n)+"px"}):/\d+%$/.test(a.width)&&e.getCssRule(t.index+"-"+a.key,function(e){e.style.width=Math.floor(parseFloat(a.width)/100*o)+"px"}))});var d=e.layMain.width()-e.getScrollWidth(e.layMain[0])-e.layMain.children("table").outerWidth();if(e.autoColNums&&d>=-i&&d<=i){var c=function(t){var i;return t=t||e.layHeader.eq(0).find("thead th:last-child"),i=t.data("field"),!i&&t.prev()[0]?c(t.prev()):t},s=c(),u=s.data("key");e.getCssRule(u,function(t){var i=t.style.width||s.outerWidth();t.style.width=parseFloat(i)+d+"px",e.layMain.height()-e.layMain.prop("clientHeight")>0&&(t.style.width=parseFloat(t.style.width)-1+"px")})}e.loading(!0)},j.prototype.resize=function(){var e=this;e.fullSize(),e.setColsWidth(),e.scrollPatch()},j.prototype.reload=function(e){var i=this;e=e||{},delete i.haveInit,e.data&&e.data.constructor===Array&&delete i.config.data,i.config=t.extend(!0,{},i.config,e),i.render()},j.prototype.errorView=function(e){var i=this,a=i.layMain.find("."+p),l=t('
    '+(e||"Error")+"
    ");a[0]&&(i.layNone.remove(),a.remove()),i.layFixed.addClass(f),i.layMain.find("tbody").html(""),i.layMain.append(i.layNone=l),d.cache[i.key]=[]},j.prototype.page=1,j.prototype.pullData=function(e){var i=this,a=i.config,l=a.request,n=a.response,o=function(){"object"==typeof a.initSort&&i.sort(a.initSort.field,a.initSort.type)};if(i.startTime=(new Date).getTime(),a.url){var r={};r[l.pageName]=e,r[l.limitName]=a.limit;var d=t.extend(r,a.where);a.contentType&&0==a.contentType.indexOf("application/json")&&(d=JSON.stringify(d)),i.loading(),t.ajax({type:a.method||"get",url:a.url,contentType:a.contentType,data:d,dataType:"json",headers:a.headers||{},success:function(t){"function"==typeof a.parseData&&(t=a.parseData(t)||t),t[n.statusName]!=n.statusCode?(i.renderForm(),i.errorView(t[n.msgName]||'返回的数据不符合规范,正确的成功状态码应为:"'+n.statusName+'": '+n.statusCode)):(i.renderData(t,e,t[n.countName]),o(),a.time=(new Date).getTime()-i.startTime+" ms"),i.setColsWidth(),"function"==typeof a.done&&a.done(t,e,t[n.countName])},error:function(e,t){i.errorView("数据接口请求异常:"+t),i.renderForm(),i.setColsWidth()}})}else if(a.data&&a.data.constructor===Array){var c={},s=e*a.limit-a.limit;c[n.dataName]=a.data.concat().splice(s,a.limit),c[n.countName]=a.data.length,i.renderData(c,e,c[n.countName]),o(),i.setColsWidth(),"function"==typeof a.done&&a.done(c,e,c[n.countName])}},j.prototype.eachCols=function(e){var t=this;return d.eachCols(null,e,t.config.cols),t},j.prototype.renderData=function(e,n,o,r){var c=this,s=c.config,y=e[s.response.dataName]||[],h=[],v=[],m=[],g=function(){var e;return!r&&c.sortKey?c.sort(c.sortKey.field,c.sortKey.sort,!0):(layui.each(y,function(a,l){var o=[],y=[],p=[],g=a+s.limit*(n-1)+1;0!==l.length&&(r||(l[d.config.indexName]=a),c.eachCols(function(n,r){var c=r.field||n,h=s.index+"-"+r.key,v=l[c];if(void 0!==v&&null!==v||(v=""),!r.colGroup){var m=['','
    '+function(){var n=t.extend(!0,{LAY_INDEX:g},l),o=d.config.checkName;switch(r.type){case"checkbox":return'";case"radio":return n[o]&&(e=a),'';case"numbers":return g}return r.toolbar?i(t(r.toolbar).html()||"").render(n):u(r,v,n)}(),"
    "].join("");o.push(m),r.fixed&&"right"!==r.fixed&&y.push(m),"right"===r.fixed&&p.push(m)}}),h.push(''+o.join("")+""),v.push(''+y.join("")+""),m.push(''+p.join("")+""))}),c.layBody.scrollTop(0),c.layMain.find("."+p).remove(),c.layMain.find("tbody").html(h.join("")),c.layFixLeft.find("tbody").html(v.join("")),c.layFixRight.find("tbody").html(m.join("")),c.renderForm(),"number"==typeof e&&c.setThisRowChecked(e),c.syncCheckAll(),c.haveInit?c.scrollPatch():setTimeout(function(){c.scrollPatch()},50),c.haveInit=!0,l.close(c.tipsIndex),s.HAS_SET_COLS_PATCH||c.setColsPatch(),void(s.HAS_SET_COLS_PATCH=!0))};return d.cache[c.key]=y,c.layPage[0==o||0===y.length&&1==n?"addClass":"removeClass"](f),r?g():0===y.length?(c.renderForm(),c.errorView(s.text.none)):(c.layFixed.removeClass(f),g(),c.renderTotal(y),void(s.page&&(s.page=t.extend({elem:"layui-table-page"+s.index,count:o,limit:s.limit,limits:s.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||(c.page=e.curr,s.limit=e.limit,c.pullData(e.curr))}},s.page),s.page.count=o,a.render(s.page))))},j.prototype.renderTotal=function(e){var t=this,i=t.config,a={};if(i.totalRow){layui.each(e,function(e,i){0!==i.length&&t.eachCols(function(e,t){var l=t.field||e,n=i[l];t.totalRow&&(a[l]=(a[l]||0)+(parseFloat(n)||0))})}),t.dataTotal={};var l=[];t.eachCols(function(e,n){var o=n.field||e,r=function(){var e=n.totalRowText||"",t=parseFloat(a[o]).toFixed(2),i={};return i[o]=t,t=u(n,t,i),n.totalRow?t||e:e}(),d=['','
    '+r,"
    "].join("");n.field&&(t.dataTotal[o]=r),l.push(d)}),t.layTotal.find("tbody").html(""+l.join("")+"")}},j.prototype.getColElem=function(e,t){var i=this,a=i.config;return e.eq(0).find(".laytable-cell-"+(a.index+"-"+t)+":eq(0)")},j.prototype.renderForm=function(e){n.render(e,"LAY-table-"+this.index)},j.prototype.setThisRowChecked=function(e){var t=this,i=(t.config,"layui-table-click"),a=t.layBody.find('tr[data-index="'+e+'"]');a.addClass(i).siblings("tr").removeClass(i)},j.prototype.sort=function(e,i,a,l){var n,r,c=this,s={},u=c.config,h=u.elem.attr("lay-filter"),f=d.cache[c.key];"string"==typeof e&&c.layHeader.find("th").each(function(i,a){var l=t(this),o=l.data("field");if(o===e)return e=l,n=o,!1});try{var n=n||e.data("field"),p=e.data("key");if(c.sortKey&&!a&&n===c.sortKey.field&&i===c.sortKey.sort)return;var v=c.layHeader.find("th .laytable-cell-"+p).find(S);c.layHeader.find("th").find(S).removeAttr("lay-sort"),v.attr("lay-sort",i||null),c.layFixed.find("th")}catch(m){return o.error("Table modules: Did not match to field")}c.sortKey={field:n,sort:i},u.autoSort&&("asc"===i?r=layui.sort(f,n):"desc"===i?r=layui.sort(f,n,!0):(r=layui.sort(f,d.config.indexName),delete c.sortKey)),s[u.response.dataName]=r||f,c.renderData(s,c.page,c.count,!0),l&&layui.event.call(e,y,"sort("+h+")",{field:n,type:i})},j.prototype.loading=function(e){var i=this,a=i.config;a.loading&&(e?(i.layInit&&i.layInit.remove(),delete i.layInit,i.layBox.find(b).remove()):(i.layInit=t(['
    ','',"
    "].join("")),i.layBox.append(i.layInit)))},j.prototype.setCheckData=function(e,t){var i=this,a=i.config,l=d.cache[i.key];l[e]&&l[e].constructor!==Array&&(l[e][a.checkName]=t)},j.prototype.syncCheckAll=function(){var e=this,t=e.config,i=e.layHeader.find('input[name="layTableCheckbox"]'),a=function(i){return e.eachCols(function(e,a){"checkbox"===a.type&&(a[t.checkName]=i)}),i};i[0]&&(d.checkStatus(e.key).isAll?(i[0].checked||(i.prop("checked",!0),e.renderForm("checkbox")),a(!0)):(i[0].checked&&(i.prop("checked",!1),e.renderForm("checkbox")),a(!1)))},j.prototype.getCssRule=function(e,t){var i=this,a=i.elem.find("style")[0],l=a.sheet||a.styleSheet||{},n=l.cssRules||l.rules;layui.each(n,function(i,a){if(a.selectorText===".laytable-cell-"+e)return t(a),!0})},j.prototype.fullSize=function(){var e,t=this,i=t.config,a=i.height;t.fullHeightGap&&(a=R.height()-t.fullHeightGap,a<135&&(a=135),t.elem.css("height",a)),a&&(e=parseFloat(a)-(t.layHeader.outerHeight()||38),i.toolbar&&(e-=t.layTool.outerHeight()||50),i.totalRow&&(e-=t.layTotal.outerHeight()||40),i.page&&(e-=t.layPage.outerHeight()||41),t.layMain.css("height",e-2))},j.prototype.getScrollWidth=function(e){var t=0;return e?t=e.offsetWidth-e.clientWidth:(e=document.createElement("div"),e.style.width="100px",e.style.height="100px",e.style.overflowY="scroll",document.body.appendChild(e),t=e.offsetWidth-e.clientWidth,document.body.removeChild(e)),t},j.prototype.scrollPatch=function(){var e=this,i=e.layMain.children("table"),a=e.layMain.width()-e.layMain.prop("clientWidth"),l=e.layMain.height()-e.layMain.prop("clientHeight"),n=(e.getScrollWidth(e.layMain[0]),i.outerWidth()-e.layMain.width()),o=function(e){if(a&&l){if(e=e.eq(0),!e.find(".layui-table-patch")[0]){var i=t('
    ');i.find("div").css({width:a}),e.find("tr").append(i)}}else e.find(".layui-table-patch").remove()};o(e.layHeader),o(e.layTotal);var r=e.layMain.height(),d=r-l;e.layFixed.find(k).css("height",i.height()>=d?d:"auto"),e.layFixRight[n>0?"removeClass":"addClass"](f),e.layFixRight.css("right",a-1)},j.prototype.events=function(){var e,i=this,a=i.config,o=t("body"),c={},s=i.layHeader.find("th"),h=".layui-table-cell",p=a.elem.attr("lay-filter");i.layTool.on("click","*[lay-event]",function(e){var o=t(this),c=o.attr("lay-event"),s=function(e){var l=t(e.list),n=t('
      ');n.html(l),a.height&&n.css("max-height",a.height-(i.layTool.outerHeight()||50)),o.find(".layui-table-tool-panel")[0]||o.append(n),i.renderForm(),n.on("click",function(e){layui.stope(e)}),e.done&&e.done(n,l)};switch(layui.stope(e),F.trigger("table.tool.panel.remove"),l.close(i.tipsIndex),c){case"LAYTABLE_COLS":s({list:function(){var e=[];return i.eachCols(function(t,i){i.field&&"normal"==i.type&&e.push('
    • ')}),e.join("")}(),done:function(){n.on("checkbox(LAY_TABLE_TOOL_COLS)",function(e){var l=t(e.elem),n=this.checked,o=l.data("key"),r=l.data("parentkey");layui.each(a.cols,function(e,t){layui.each(t,function(t,l){if(e+"-"+t===o){var d=l.hide;l.hide=!n,i.elem.find('*[data-key="'+a.index+"-"+o+'"]')[n?"removeClass":"addClass"](f),d!=l.hide&&i.setParentCol(!n,r),i.resize()}})})})}});break;case"LAYTABLE_EXPORT":r.ie?l.tips("导出功能不支持 IE,请用 Chrome 等高级浏览器导出",this,{tips:3}):s({list:function(){return['
    • 导出到 Csv 文件
    • ','
    • 导出到 Excel 文件
    • '].join("")}(),done:function(e,l){l.on("click",function(){var e=t(this).data("type");d.exportFile.call(i,a.id,null,e)})}});break;case"LAYTABLE_PRINT":var u=window.open("打印窗口","_blank"),h=[""].join(""),v=t(i.layHeader.html());v.append(i.layMain.find("table").html()),v.append(i.layTotal.find("table").html()),v.find("th.layui-table-patch").remove(),v.find(".layui-table-col-special").remove(),u.document.write(h+v.prop("outerHTML")),u.document.close(),u.print(),u.close()}layui.event.call(this,y,"toolbar("+p+")",t.extend({event:c,config:a},{}))}),s.on("mousemove",function(e){var i=t(this),a=i.offset().left,l=e.clientX-a;i.data("unresize")||c.resizeStart||(c.allowResize=i.width()-l<=10,o.css("cursor",c.allowResize?"col-resize":""))}).on("mouseleave",function(){t(this);c.resizeStart||o.css("cursor","")}).on("mousedown",function(e){var l=t(this);if(c.allowResize){var n=l.data("key");e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],i.getCssRule(n,function(e){var t=e.style.width||l.outerWidth();c.rule=e,c.ruleWidth=parseFloat(t),c.minWidth=l.data("minwidth")||a.cellMinWidth})}}),F.on("mousemove",function(t){if(c.resizeStart){if(t.preventDefault(),c.rule){var a=c.ruleWidth+t.clientX-c.offset[0];a');return n[0].value=i.data("content")||l.text(),i.find("."+W)[0]||i.append(n),n.focus(),void layui.stope(e)}}).on("mouseenter","td",function(){b.call(this)}).on("mouseleave","td",function(){b.call(this,"hide")});var g="layui-table-grid-down",b=function(e){var i=t(this),a=i.children(h);if(!i.data("off"))if(e)i.find(".layui-table-grid-down").remove();else if(a.prop("scrollWidth")>a.outerWidth()){if(a.find("."+g)[0])return;i.append('
      ')}};i.layBody.on("click","."+g,function(e){var n=t(this),o=n.parent(),d=o.children(h);i.tipsIndex=l.tips(['
      ',d.html(),"
      ",''].join(""),d[0],{tips:[3,""],time:-1,anim:-1,maxWidth:r.ios||r.android?300:i.elem.width()/2,isOutAnim:!1,skin:"layui-table-tips",success:function(e,t){e.find(".layui-table-tips-c").on("click",function(){l.close(t)})}}),layui.stope(e)}),i.layBody.on("click","*[lay-event]",function(){var e=t(this),a=e.parents("tr").eq(0).data("index");layui.event.call(this,y,"tool("+p+")",v.call(this,{event:e.attr("lay-event")})),i.setThisRowChecked(a)}),i.layMain.on("scroll",function(){var e=t(this),a=e.scrollLeft(),n=e.scrollTop();i.layHeader.scrollLeft(a),i.layTotal.scrollLeft(a),i.layFixed.find(k).scrollTop(n),l.close(i.tipsIndex)}),R.on("resize",function(){i.resize()})},function(){F.on("click",function(){F.trigger("table.remove.tool.panel")}),F.on("table.remove.tool.panel",function(){t(".layui-table-tool-panel").remove()})}(),d.init=function(e,i){i=i||{};var a=this,l=t(e?'table[lay-filter="'+e+'"]':h+"[lay-data]"),n="Table element property lay-data configuration item has a syntax error: ";return l.each(function(){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){o.error(n+l)}var c=[],s=t.extend({elem:this,cols:[],data:[],skin:a.attr("lay-skin"),size:a.attr("lay-size"),even:"string"==typeof a.attr("lay-even")},d.config,i,l);e&&a.hide(),a.find("thead>tr").each(function(e){s.cols[e]=[],t(this).children().each(function(i){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){return o.error(n+l)}var d=t.extend({title:a.text(),colspan:a.attr("colspan")||0,rowspan:a.attr("rowspan")||0},l);d.colspan<2&&c.push(d),s.cols[e].push(d)})}),a.find("tbody>tr").each(function(e){var i=t(this),a={};i.children("td").each(function(e,i){var l=t(this),n=l.data("field");if(n)return a[n]=l.html()}),layui.each(c,function(e,t){var l=i.children("td").eq(e);a[t.field]=l.html()}),s.data[e]=a}),d.render(s)}),a},c.that={},c.config={},d.eachCols=function(e,i,a){var l=c.config[e]||{},n=[],o=0;a=t.extend(!0,[],a||l.cols),layui.each(a,function(e,t){layui.each(t,function(t,i){if(i.colGroup){var l=0;o++,i.CHILD_COLS=[],layui.each(a[e+1],function(e,t){t.PARENT_COL_INDEX||l>1&&l==i.colspan||(t.PARENT_COL_INDEX=o,i.CHILD_COLS.push(t),l+=parseInt(t.colspan>1?t.colspan:1))})}i.PARENT_COL_INDEX||n.push(i)})});var r=function(e){layui.each(e||n,function(e,t){return t.CHILD_COLS?r(t.CHILD_COLS):void("function"==typeof i&&i(e,t))})};r()},d.checkStatus=function(e){var t=0,i=0,a=[],l=d.cache[e]||[];return layui.each(l,function(e,l){return l.constructor===Array?void i++:void(l[d.config.checkName]&&(t++,a.push(d.clearCacheKey(l))))}),{data:a,isAll:!!l.length&&t===l.length-i}},d.exportFile=function(e,t,i){var a=this;t=t||d.clearCacheKey(d.cache[e]),i=i||"csv";var l=c.config[e]||{},n={csv:"text/csv",xls:"application/vnd.ms-excel"}[i],s=document.createElement("a");return r.ie?o.error("IE_NOT_SUPPORT_EXPORTS"):(s.href="data:"+n+";charset=utf-8,\ufeff"+encodeURIComponent(function(){var i=[],l=[],n=[];return layui.each(t,function(t,a){var n=[];"object"==typeof e?(layui.each(e,function(e,a){0==t&&i.push(a||"")}),layui.each(d.clearCacheKey(a),function(e,t){n.push('"'+(t||"")+'"')})):d.eachCols(e,function(e,l){if(l.field&&"normal"==l.type&&!l.hide){var o=a[l.field];void 0!==o&&null!==o||(o=""),0==t&&i.push(l.title||""),n.push('"'+u(l,o,a,"text")+'"')}}),l.push(n.join(","))}),layui.each(a.dataTotal,function(e,t){n.push(t)}),i.join(",")+"\r\n"+l.join("\r\n")+"\r\n"+n.join(",")}()),s.download=(l.title||"table_"+(l.index||""))+"."+i,document.body.appendChild(s),s.click(),void document.body.removeChild(s))},d.resize=function(e){if(e){var t=s(e);if(!t)return;c.that[e].resize()}else layui.each(c.that,function(){this.resize()})},d.reload=function(e,t){var i=s(e);if(i){var a=c.that[e];return a.reload(t),c.call(a)}},d.render=function(e){var t=new j(e);return c.call(t)},d.clearCacheKey=function(e){return e=t.extend({},e),delete e[d.config.checkName],delete e[d.config.indexName],e},d.init(),e(y,d)}); \ No newline at end of file diff --git a/public/static/lib/layui/lay/modules/transfer.js b/public/static/lib/layui/lay/modules/transfer.js new file mode 100644 index 00000000..6b7b6777 --- /dev/null +++ b/public/static/lib/layui/lay/modules/transfer.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;layui.define(["laytpl","form"],function(e){"use strict";var a=layui.$,t=layui.laytpl,n=layui.form,i="transfer",l={config:{},index:layui[i]?layui[i].index+1e4:0,set:function(e){var t=this;return t.config=a.extend({},t.config,e),t},on:function(e,a){return layui.onevent.call(this,i,e,a)}},r=function(){var e=this,a=e.config,t=a.id||e.index;return r.that[t]=e,r.config[t]=a,{config:a,reload:function(a){e.reload.call(e,a)},getData:function(){return e.getData.call(e)}}},c="layui-hide",o="layui-btn-disabled",d="layui-none",s="layui-transfer-box",u="layui-transfer-header",h="layui-transfer-search",f="layui-transfer-active",y="layui-transfer-data",p=function(e){return e=e||{},['
      ','
      ','","
      ","{{# if(d.data.showSearch){ }}",'","{{# } }}",'
        ',"
        "].join("")},v=['
        ',p({index:0,checkAllName:"layTransferLeftCheckAll"}),'
        ','",'","
        ",p({index:1,checkAllName:"layTransferRightCheckAll"}),"
        "].join(""),x=function(e){var t=this;t.index=++l.index,t.config=a.extend({},t.config,l.config,e),t.render()};x.prototype.config={title:["列表一","列表二"],width:200,height:360,data:[],value:[],showSearch:!1,id:"",text:{none:"无数据",searchNone:"无匹配数据"}},x.prototype.reload=function(e){var t=this;layui.each(e,function(e,a){a.constructor===Array&&delete t.config[e]}),t.config=a.extend(!0,{},t.config,e),t.render()},x.prototype.render=function(){var e=this,n=e.config,i=e.elem=a(t(v).render({data:n,index:e.index})),l=n.elem=a(n.elem);l[0]&&(n.data=n.data||[],n.value=n.value||[],e.key=n.id||e.index,l.html(e.elem),e.layBox=e.elem.find("."+s),e.layHeader=e.elem.find("."+u),e.laySearch=e.elem.find("."+h),e.layData=i.find("."+y),e.layBtn=i.find("."+f+" .layui-btn"),e.layBox.css({width:n.width,height:n.height}),e.layData.css({height:function(){return n.height-e.layHeader.outerHeight()-e.laySearch.outerHeight()-2}()}),e.renderData(),e.events())},x.prototype.renderData=function(){var e=this,a=(e.config,[{checkName:"layTransferLeftCheck",views:[]},{checkName:"layTransferRightCheck",views:[]}]);e.parseData(function(e){var t=e.selected?1:0,n=["
      • ",'',"
      • "].join("");a[t].views.push(n),delete e.selected}),e.layData.eq(0).html(a[0].views.join("")),e.layData.eq(1).html(a[1].views.join("")),e.renderCheckBtn()},x.prototype.renderForm=function(e){n.render(e,"LAY-transfer-"+this.index)},x.prototype.renderCheckBtn=function(e){var t=this,n=t.config;e=e||{},t.layBox.each(function(i){var l=a(this),r=l.find("."+y),d=l.find("."+u).find('input[type="checkbox"]'),s=r.find('input[type="checkbox"]'),h=0,f=!1;if(s.each(function(){var e=a(this).data("hide");(this.checked||this.disabled||e)&&h++,this.checked&&!e&&(f=!0)}),d.prop("checked",f&&h===s.length),t.layBtn.eq(i)[f?"removeClass":"addClass"](o),!e.stopNone){var p=r.children("li:not(."+c+")").length;t.noneView(r,p?"":n.text.none)}}),t.renderForm("checkbox")},x.prototype.noneView=function(e,t){var n=a('

        '+(t||"")+"

        ");e.find("."+d)[0]&&e.find("."+d).remove(),t.replace(/\s/g,"")&&e.append(n)},x.prototype.setValue=function(){var e=this,t=e.config,n=[];return e.layBox.eq(1).find("."+y+' input[type="checkbox"]').each(function(){var e=a(this).data("hide");e||n.push(this.value)}),t.value=n,e},x.prototype.parseData=function(e){var t=this,n=t.config,i=[];return layui.each(n.data,function(t,l){l=("function"==typeof n.parseData?n.parseData(l):l)||l,i.push(l=a.extend({},l)),layui.each(n.value,function(e,a){a==l.value&&(l.selected=!0)}),e&&e(l)}),n.data=i,t},x.prototype.getData=function(e){var a=this,t=a.config,n=[];return a.setValue(),layui.each(e||t.value,function(e,a){layui.each(t.data,function(e,t){delete t.selected,a==t.value&&n.push(t)})}),n},x.prototype.events=function(){var e=this,t=e.config;e.elem.on("click",'input[lay-filter="layTransferCheckbox"]+',function(){var t=a(this).prev(),n=t[0].checked,i=t.parents("."+s).eq(0).find("."+y);t[0].disabled||("all"===t.attr("lay-type")&&i.find('input[type="checkbox"]').each(function(){this.disabled||(this.checked=n)}),e.renderCheckBtn({stopNone:!0}))}),e.layBtn.on("click",function(){var n=a(this),i=n.data("index"),l=e.layBox.eq(i),r=[];if(!n.hasClass(o)){e.layBox.eq(i).each(function(t){var n=a(this),i=n.find("."+y);i.children("li").each(function(){var t=a(this),n=t.find('input[type="checkbox"]'),i=n.data("hide");n[0].checked&&!i&&(n[0].checked=!1,l.siblings("."+s).find("."+y).append(t.clone()),t.remove(),r.push(n[0].value)),e.setValue()})}),e.renderCheckBtn();var c=l.siblings("."+s).find("."+h+" input");""===c.val()||c.trigger("keyup"),t.onchange&&t.onchange(e.getData(r),i)}}),e.laySearch.find("input").on("keyup",function(){var n=this.value,i=a(this).parents("."+h).eq(0).siblings("."+y),l=i.children("li");l.each(function(){var e=a(this),t=e.find('input[type="checkbox"]'),i=t[0].title.indexOf(n)!==-1;e[i?"removeClass":"addClass"](c),t.data("hide",!i)}),e.renderCheckBtn();var r=l.length===i.children("li."+c).length;e.noneView(i,r?t.text.searchNone:"")})},r.that={},r.config={},l.reload=function(e,a){var t=r.that[e];return t.reload(a),r.call(t)},l.getData=function(e){var a=r.that[e];return a.getData()},l.render=function(e){var a=new x(e);return r.call(a)},e(i,l)}); \ No newline at end of file diff --git a/public/static/lib/layui/lay/modules/tree.js b/public/static/lib/layui/lay/modules/tree.js new file mode 100644 index 00000000..15fb294d --- /dev/null +++ b/public/static/lib/layui/lay/modules/tree.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;layui.define("form",function(e){"use strict";var i=layui.$,a=layui.form,n=layui.layer,t="tree",r={config:{},index:layui[t]?layui[t].index+1e4:0,set:function(e){var a=this;return a.config=i.extend({},a.config,e),a},on:function(e,i){return layui.onevent.call(this,t,e,i)}},l=function(){var e=this,i=e.config,a=i.id||e.index;return l.that[a]=e,l.config[a]=i,{config:i,reload:function(i){e.reload.call(e,i)},getChecked:function(){return e.getChecked.call(e)},setChecked:function(i){return e.setChecked.call(e,i)}}},c="layui-hide",d="layui-disabled",s="layui-tree-set",o="layui-tree-iconClick",h="layui-icon-addition",u="layui-icon-subtraction",p="layui-tree-entry",f="layui-tree-main",y="layui-tree-txt",v="layui-tree-pack",C="layui-tree-spread",k="layui-tree-setLineShort",m="layui-tree-showLine",x="layui-tree-lineExtend",b=function(e){var a=this;a.index=++r.index,a.config=i.extend({},a.config,r.config,e),a.render()};b.prototype.config={data:[],showCheckbox:!1,showLine:!0,accordion:!1,onlyIconControl:!1,isJump:!1,edit:!1,text:{defaultNodeName:"未命名",none:"无数据"}},b.prototype.reload=function(e){var a=this;layui.each(e,function(e,i){i.constructor===Array&&delete a.config[e]}),a.config=i.extend(!0,{},a.config,e),a.render()},b.prototype.render=function(){var e=this,a=e.config;e.checkids=[];var n=i('
        ');e.tree(n);var t=a.elem=i(a.elem);if(t[0]){if(e.key=a.id||e.index,e.elem=n,e.elemNone=i('
        '+a.text.none+"
        "),t.html(e.elem),0==e.elem.find(".layui-tree-set").length)return e.elem.append(e.elemNone);a.showCheckbox&&e.renderForm("checkbox"),e.elem.find(".layui-tree-set").each(function(){var e=i(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(k),e.next()[0]||e.parents(".layui-tree-set").eq(0).next()[0]||e.addClass(k)}),e.events()}},b.prototype.renderForm=function(e){a.render(e,"LAY-tree-"+this.index)},b.prototype.tree=function(e,a){var n=this,t=n.config,r=a||t.data;layui.each(r,function(a,r){var l=r.children&&r.children.length>0,o=i('
        '),h=i(['
        ','
        ','
        ',function(){return t.showLine?l?'':'':''}(),function(){return t.showCheckbox?'':""}(),function(){return t.isJump&&r.href?''+(r.title||r.label||t.text.defaultNodeName)+"":''+(r.title||r.label||t.text.defaultNodeName)+""}(),"
        ",function(){if(!t.edit)return"";var e={add:'',update:'',del:''},i=['
        '];return t.edit===!0&&(t.edit=["update","del"]),"object"==typeof t.edit?(layui.each(t.edit,function(a,n){i.push(e[n]||"")}),i.join("")+"
        "):void 0}(),"
        "].join(""));l&&(h.append(o),n.tree(o,r.children)),e.append(h),h.prev("."+s)[0]&&h.prev().children(".layui-tree-pack").addClass("layui-tree-showLine"),l||h.parent(".layui-tree-pack").addClass("layui-tree-lineExtend"),n.spread(h,r),t.showCheckbox&&(r.checked&&n.checkids.push(r.id),n.checkClick(h,r)),t.edit&&n.operate(h,r)})},b.prototype.spread=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f),c=r.find("."+o),k=r.find("."+y),m=t.onlyIconControl?c:l,x="";m.on("click",function(i){var a=e.children("."+v),n=m.children(".layui-icon")[0]?m.children(".layui-icon"):m.find(".layui-tree-icon").children(".layui-icon");if(a[0]){if(e.hasClass(C))e.removeClass(C),a.slideUp(200),n.removeClass(u).addClass(h);else if(e.addClass(C),a.slideDown(200),n.addClass(u).removeClass(h),t.accordion){var r=e.siblings("."+s);r.removeClass(C),r.children("."+v).slideUp(200),r.find(".layui-tree-icon").children(".layui-icon").removeClass(u).addClass(h)}}else x="normal"}),k.on("click",function(){var n=i(this);n.hasClass(d)||(x=e.hasClass(C)?t.onlyIconControl?"open":"close":t.onlyIconControl?"close":"open",t.click&&t.click({elem:e,state:x,data:a}))})},b.prototype.setCheckbox=function(e,i,a){var n=this,t=(n.config,a.prop("checked"));if(!a.prop("disabled")){if("object"==typeof i.children||e.find("."+v)[0]){var r=e.find("."+v).find('input[same="layuiTreeCheck"]');r.each(function(){this.disabled||(this.checked=t)})}var l=function(e){if(e.parents("."+s)[0]){var i,a=e.parent("."+v),n=a.parent(),r=a.prev().find('input[same="layuiTreeCheck"]');t?r.prop("checked",t):(a.find('input[same="layuiTreeCheck"]').each(function(){this.checked&&(i=!0)}),i||r.prop("checked",!1)),l(n)}};l(e),n.renderForm("checkbox")}},b.prototype.checkClick=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f);l.on("click",'input[same="layuiTreeCheck"]+',function(r){layui.stope(r);var l=i(this).prev(),c=l.prop("checked");l.prop("disabled")||(n.setCheckbox(e,a,l),t.oncheck&&t.oncheck({elem:e,checked:c,data:a}))})},b.prototype.operate=function(e,a){var t=this,r=t.config,l=e.children("."+p),d=l.children("."+f);l.children(".layui-tree-btnGroup").on("click",".layui-icon",function(l){layui.stope(l);var f=i(this).data("type"),b=e.children("."+v),g={data:a,type:f,elem:e};if("add"==f){b[0]||(r.showLine?(d.find("."+o).addClass("layui-tree-icon"),d.find("."+o).children(".layui-icon").addClass(h).removeClass("layui-icon-file")):d.find(".layui-tree-iconArrow").removeClass(c),e.append('
        '));var w=r.operate&&r.operate(g),N={};if(N.title=r.text.defaultNodeName,N.id=w,t.tree(e.children("."+v),[N]),r.showLine)if(b[0])b.hasClass(x)||b.addClass(x),e.find("."+v).each(function(){i(this).children("."+s).last().addClass(k)}),b.children("."+s).last().prev().hasClass(k)?b.children("."+s).last().prev().removeClass(k):b.children("."+s).last().removeClass(k),!e.parent("."+v)[0]&&e.next()[0]&&b.children("."+s).last().removeClass(k);else{var T=e.siblings("."+s),L=1,A=e.parent("."+v);layui.each(T,function(e,a){i(a).children("."+v)[0]||(L=0)}),1==L?(T.children("."+v).addClass(m),T.children("."+v).children("."+s).removeClass(k),e.children("."+v).addClass(m),A.removeClass(x),A.children("."+s).last().children("."+v).children("."+s).last().addClass(k)):e.children("."+v).children("."+s).addClass(k)}if(!r.showCheckbox)return;if(d.find('input[same="layuiTreeCheck"]')[0].checked){var I=e.children("."+v).children("."+s).last();I.find('input[same="layuiTreeCheck"]')[0].checked=!0}t.renderForm("checkbox")}else if("update"==f){var F=d.children("."+y).html();d.children("."+y).html(""),d.append(''),d.children(".layui-tree-editInput").val(F).focus();var j=function(e){var i=e.val().trim();i=i?i:r.text.defaultNodeName,e.remove(),d.children("."+y).html(i),g.data.title=i,r.operate&&r.operate(g)};d.children(".layui-tree-editInput").blur(function(){j(i(this))}),d.children(".layui-tree-editInput").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),j(i(this)))})}else n.confirm('确认删除该节点 "'+(a.title||"")+'" 吗?',function(a){if(r.operate&&r.operate(g),g.status="remove",n.close(a),!e.prev("."+s)[0]&&!e.next("."+s)[0]&&!e.parent("."+v)[0])return e.remove(),void t.elem.append(t.elemNone);if(e.siblings("."+s).children("."+p)[0]){if(r.showCheckbox){var l=function(e){if(e.parents("."+s)[0]){var a=e.siblings("."+s).children("."+p),n=e.parent("."+v).prev(),r=n.find('input[same="layuiTreeCheck"]')[0],c=1,d=0;0==r.checked&&(a.each(function(e,a){var n=i(a).find('input[same="layuiTreeCheck"]')[0];0!=n.checked||n.disabled||(c=0),n.disabled||(d=1)}),1==c&&1==d&&(r.checked=!0,t.renderForm("checkbox"),l(n.parent("."+s))))}};l(e)}if(r.showLine){var d=e.siblings("."+s),h=1,f=e.parent("."+v);layui.each(d,function(e,a){i(a).children("."+v)[0]||(h=0)}),1==h?(b[0]||(f.removeClass(x),d.children("."+v).addClass(m),d.children("."+v).children("."+s).removeClass(k)),e.next()[0]?f.children("."+s).last().children("."+v).children("."+s).last().addClass(k):e.prev().children("."+v).children("."+s).last().addClass(k),e.next()[0]||e.parents("."+s)[1]||e.parents("."+s).eq(0).next()[0]||e.prev("."+s).addClass(k)):!e.next()[0]&&e.hasClass(k)&&e.prev().addClass(k)}}else{var y=e.parent("."+v).prev();if(r.showLine){y.find("."+o).removeClass("layui-tree-icon"),y.find("."+o).children(".layui-icon").removeClass(u).addClass("layui-icon-file");var w=y.parents("."+v).eq(0);w.addClass(x),w.children("."+s).each(function(){i(this).children("."+v).children("."+s).last().addClass(k)})}else y.find(".layui-tree-iconArrow").addClass(c);e.parents("."+s).eq(0).removeClass(C),e.parent("."+v).remove()}e.remove()})})},b.prototype.events=function(){var e=this,a=e.config;e.elem.find(".layui-tree-checkedFirst");e.setChecked(e.checkids),e.elem.find(".layui-tree-search").on("keyup",function(){var n=i(this),t=n.val(),r=n.nextAll(),l=[];r.find("."+y).each(function(){var e=i(this).parents("."+p);if(i(this).html().indexOf(t)!=-1){l.push(i(this).parent());var a=function(e){e.addClass("layui-tree-searchShow"),e.parent("."+v)[0]&&a(e.parent("."+v).parent("."+s))};a(e.parent("."+s))}}),r.find("."+p).each(function(){var e=i(this).parent("."+s);e.hasClass("layui-tree-searchShow")||e.addClass(c)}),0==r.find(".layui-tree-searchShow").length&&e.elem.append(e.elemNone),a.onsearch&&a.onsearch({elem:l})}),e.elem.find(".layui-tree-search").on("keydown",function(){i(this).nextAll().find("."+p).each(function(){var e=i(this).parent("."+s);e.removeClass("layui-tree-searchShow "+c)}),i(".layui-tree-emptyText")[0]&&i(".layui-tree-emptyText").remove()})},b.prototype.getChecked=function(){var e=this,a=e.config,n=[],t=[];e.elem.find(".layui-form-checked").each(function(){n.push(i(this).prev()[0].value)});var r=function(e,a){layui.each(e,function(e,t){layui.each(n,function(e,n){if(t.id==n){var l=i.extend({},t);return delete l.children,a.push(l),t.children&&(l.children=[],r(t.children,l.children)),!0}})})};return r(i.extend({},a.data),t),t},b.prototype.setChecked=function(e){var a=this;a.config;a.elem.find("."+s).each(function(a,n){var t=i(this).data("id"),r=i(n).children("."+p).find('input[same="layuiTreeCheck"]'),l=r.next();if("number"==typeof e){if(t==e)return r[0].checked||l.click(),!1}else"object"==typeof e&&layui.each(e,function(e,i){if(i==t&&!r[0].checked)return l.click(),!0})})},l.that={},l.config={},r.reload=function(e,i){var a=l.that[e];return a.reload(i),l.call(a)},r.getChecked=function(e){var i=l.that[e];return i.getChecked()},r.setChecked=function(e,i){var a=l.that[e];return a.setChecked(i)},r.render=function(e){var i=new b(e);return l.call(i)},e(t,r)}); \ No newline at end of file diff --git a/public/static/lib/layui/lay/modules/upload.js b/public/static/lib/layui/lay/modules/upload.js new file mode 100644 index 00000000..262b5130 --- /dev/null +++ b/public/static/lib/layui/lay/modules/upload.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,n=layui.hint(),o=layui.device(),a={config:{},set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,r,e,t)}},l=function(){var e=this;return{upload:function(t){e.upload.call(e,t)},reload:function(t){e.reload.call(e,t)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var i=this;i.config=t.extend({},i.config,a.config,e),i.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",acceptMime:"",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var i=this,e=i.config;e.elem=t(e.elem),e.bindAction=t(e.bindAction),i.file(),i.events()},p.prototype.file=function(){var e=this,i=e.config,n=e.elemFile=t(['"].join("")),a=i.elem.next();(a.hasClass(u)||a.hasClass(c))&&a.remove(),o.ie&&o.ie<10&&i.elem.wrap('
        '),e.isFile()?(e.elemFile=i.elem,i.field=i.elem[0].name):i.elem.after(n),o.ie&&o.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,i=e.config,n=t(''),o=t(['
        ',"
        "].join(""));t("#"+f)[0]||t("body").append(n),i.elem.next().hasClass(c)||(e.elemFile.wrap(o),i.elem.next("."+c).append(function(){var e=[];return layui.each(i.data,function(t,i){i="function"==typeof i?i():i,e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return i.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var t=this;window.FileReader&&layui.each(t.chooseFiles,function(t,i){var n=new FileReader;n.readAsDataURL(i),n.onload=function(){e&&e(t,i,this.result)}})},p.prototype.upload=function(e,i){var n,a=this,l=a.config,r=a.elemFile[0],u=function(){var i=0,n=0,o=e||a.files||a.chooseFiles||r.files,u=function(){l.multiple&&i+n===a.fileLength&&"function"==typeof l.allDone&&l.allDone({total:a.fileLength,successful:i,aborted:n})};layui.each(o,function(e,o){var r=new FormData;r.append(l.field,o),layui.each(l.data,function(e,t){t="function"==typeof t?t():t,r.append(e,t)}),t.ajax({url:l.url,type:"post",data:r,contentType:!1,processData:!1,dataType:"json",headers:l.headers||{},success:function(t){i++,d(e,t),u()},error:function(){n++,a.msg("请求上传接口出现异常"),m(e),u()},xhr:function(){var e=new XMLHttpRequest;return e.upload.addEventListener("progress",function(e){if(e.lengthComputable){var t=Math.floor(e.loaded/e.total*100);"function"==typeof l.progress&&l.progress(t,e)}}),e}})})},c=function(){var e=t("#"+f);a.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var t,i=e.contents().find("body");try{t=i.text()}catch(n){a.msg("获取上传后的响应信息出现异常"),clearInterval(p.timer),m()}t&&(clearInterval(p.timer),i.html(""),d(0,t))},30)},d=function(e,t){if(a.elemFile.next("."+s).remove(),r.value="","object"!=typeof t)try{t=JSON.parse(t)}catch(i){return t={},a.msg("请对上传接口返回有效JSON")}"function"==typeof l.done&&l.done(t,e||0,function(e){a.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){a.upload(e)})},h=l.exts,v=function(){var t=[];return layui.each(e||a.chooseFiles,function(e,i){t.push(i.name)}),t}(),g={preview:function(e){a.preview(e)},upload:function(e,t){var i={};i[e]=t,a.upload(i)},pushFile:function(){return a.files=a.files||{},layui.each(a.chooseFiles,function(e,t){a.files[e]=t}),a.files},resetFile:function(e,t,i){var n=new File([t],i);a.files=a.files||{},a.files[e]=n}},y=function(){if("choose"!==i&&!l.auto||(l.choose&&l.choose(g),"choose"!==i))return l.before&&l.before(g),o.ie?o.ie>9?u():c():void u()};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return a.msg("选择的文件中包含不支持的格式"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return a.msg("选择的视频中包含不支持的格式"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return a.msg("选择的音频中包含不支持的格式"),r.value="";break;default:if(layui.each(v,function(e,t){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(t))||(n=!0)}),n)return a.msg("选择的图片中包含不支持的格式"),r.value=""}if(a.fileLength=function(){var t=0,i=e||a.files||a.chooseFiles||r.files;return layui.each(i,function(){t++}),t}(),l.number&&a.fileLength>l.number)return a.msg("同时最多只能上传的数量为:"+l.number);if(l.size>0&&!(o.ie&&o.ie<10)){var F;if(layui.each(a.chooseFiles,function(e,t){if(t.size>1024*l.size){var i=l.size/1024;i=i>=1?i.toFixed(2)+"MB":l.size+"KB",r.value="",F=i}}),F)return a.msg("文件不能超过"+F)}y()}},p.prototype.reload=function(e){e=e||{},delete e.elem,delete e.bindAction;var i=this,e=i.config=t.extend({},i.config,a.config,e),n=e.elem.next();n.attr({name:e.name,accept:e.acceptMime,multiple:e.multiple})},p.prototype.events=function(){var e=this,i=e.config,a=function(t){e.chooseFiles={},layui.each(t,function(t,i){var n=(new Date).getTime();e.chooseFiles[n+"-"+t]=i})},l=function(t,n){var o=e.elemFile,a=t.length>1?t.length+"个文件":(t[0]||{}).name||o[0].value.match(/[^\/\\]+\..+/g)||[]||"";o.next().hasClass(s)&&o.next().remove(),e.upload(null,"choose"),e.isFile()||i.choose||o.after(''+a+"")};i.elem.off("upload.start").on("upload.start",function(){var o=t(this),a=o.attr("lay-data");if(a)try{a=new Function("return "+a)(),e.config=t.extend({},i,a)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+a)}e.config.item=o,e.elemFile[0].click()}),o.ie&&o.ie<10||i.elem.off("upload.over").on("upload.over",function(){var e=t(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=t(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,o){var r=t(this),u=o.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),a(u),i.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var t=this.files||[];a(t),i.auto?e.upload():l(t)}),i.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),i.elem.data("haveEvents")||(e.elemFile.on("change",function(){t(this).trigger("upload.change")}),i.elem.on("click",function(){e.isFile()||t(this).trigger("upload.start")}),i.drag&&i.elem.on("dragover",function(e){e.preventDefault(),t(this).trigger("upload.over")}).on("dragleave",function(e){t(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),t(this).trigger("upload.drop",e)}),i.bindAction.on("click",function(){t(this).trigger("upload.action")}),i.elem.data("haveEvents",!0))},a.render=function(e){var t=new p(e);return l.call(t)},e(r,a)}); \ No newline at end of file diff --git a/public/static/lib/layui/lay/modules/util.js b/public/static/lib/layui/lay/modules/util.js new file mode 100644 index 00000000..256f47aa --- /dev/null +++ b/public/static/lib/layui/lay/modules/util.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;layui.define("jquery",function(t){"use strict";var e=layui.$,i={fixbar:function(t){var i,n,a="layui-fixbar",o="layui-fixbar-top",r=e(document),l=e("body");t=e.extend({showHeight:200},t),t.bar1=t.bar1===!0?"":t.bar1,t.bar2=t.bar2===!0?"":t.bar2,t.bgcolor=t.bgcolor?"background-color:"+t.bgcolor:"";var c=[t.bar1,t.bar2,""],g=e(['
          ',t.bar1?'
        • '+c[0]+"
        • ":"",t.bar2?'
        • '+c[1]+"
        • ":"",'
        • '+c[2]+"
        • ","
        "].join("")),s=g.find("."+o),u=function(){var e=r.scrollTop();e>=t.showHeight?i||(s.show(),i=1):i&&(s.hide(),i=0)};e("."+a)[0]||("object"==typeof t.css&&g.css(t.css),l.append(g),u(),g.find("li").on("click",function(){var i=e(this),n=i.attr("lay-type");"top"===n&&e("html,body").animate({scrollTop:0},200),t.click&&t.click.call(this,n)}),r.on("scroll",function(){clearTimeout(n),n=setTimeout(function(){u()},100)}))},countdown:function(t,e,i){var n=this,a="function"==typeof e,o=new Date(t).getTime(),r=new Date(!e||a?(new Date).getTime():e).getTime(),l=o-r,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=e);var g=setTimeout(function(){n.countdown(t,r+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],e,g),l<=0&&clearTimeout(g),g},timeAgo:function(t,e){var i=this,n=[[],[]],a=(new Date).getTime()-new Date(t).getTime();return a>6912e5?(a=new Date(t),n[0][0]=i.digit(a.getFullYear(),4),n[0][1]=i.digit(a.getMonth()+1),n[0][2]=i.digit(a.getDate()),e||(n[1][0]=i.digit(a.getHours()),n[1][1]=i.digit(a.getMinutes()),n[1][2]=i.digit(a.getSeconds())),n[0].join("-")+" "+n[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=12e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(t,e){var i="";t=String(t),e=e||2;for(var n=t.length;n/g,">").replace(/'/g,"'").replace(/"/g,""")},event:function(t,n,a){n=i.event[t]=e.extend(!0,i.event[t],n)||{},e("body").on(a||"click","*["+t+"]",function(){var i=e(this),a=i.attr(t);n[a]&&n[a].call(this,i)})}};!function(t,e,i){"$:nomunge";function n(){a=e[l](function(){o.each(function(){var e=t(this),i=e.width(),n=e.height(),a=t.data(this,g);(i!==a.w||n!==a.h)&&e.trigger(c,[a.w=i,a.h=n])}),n()},r[s])}var a,o=t([]),r=t.resize=t.extend(t.resize,{}),l="setTimeout",c="resize",g=c+"-special-event",s="delay",u="throttleWindow";r[s]=250,r[u]=!0,t.event.special[c]={setup:function(){if(!r[u]&&this[l])return!1;var e=t(this);o=o.add(e),t.data(this,g,{w:e.width(),h:e.height()}),1===o.length&&n()},teardown:function(){if(!r[u]&&this[l])return!1;var e=t(this);o=o.not(e),e.removeData(g),o.length||clearTimeout(a)},add:function(e){function n(e,n,o){var r=t(this),l=t.data(this,g)||{};l.w=n!==i?n:r.width(),l.h=o!==i?o:r.height(),a.apply(this,arguments)}if(!r[u]&&this[l])return!1;var a;return t.isFunction(e)?(a=e,n):(a=e.handler,void(e.handler=n))}}}(e,window),t("util",i)}); \ No newline at end of file diff --git a/public/static/lib/layui/layui.all.js b/public/static/lib/layui/layui.all.js new file mode 100644 index 00000000..1d911b3a --- /dev/null +++ b/public/static/lib/layui/layui.all.js @@ -0,0 +1,5 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;!function(e){"use strict";var t=document,o={modules:{},status:{},timeout:10,event:{}},n=function(){this.v="2.5.5"},r=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,o=t.scripts,n=o.length-1,r=n;r>0;r--)if("interactive"===o[r].readyState){e=o[r].src;break}return e||o[n].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),i=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},a="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),u={layer:"modules/layer",laydate:"modules/laydate",laypage:"modules/laypage",laytpl:"modules/laytpl",layim:"modules/layim",layedit:"modules/layedit",form:"modules/form",upload:"modules/upload",transfer:"modules/transfer",tree:"modules/tree",table:"modules/table",element:"modules/element",rate:"modules/rate",colorpicker:"modules/colorpicker",slider:"modules/slider",carousel:"modules/carousel",flow:"modules/flow",util:"modules/util",code:"modules/code",jquery:"modules/jquery",mobile:"modules/mobile","layui.all":"../layui.all"};n.prototype.cache=o,n.prototype.define=function(e,t){var n=this,r="function"==typeof e,i=function(){var e=function(e,t){layui[e]=t,o.status[e]=!0};return"function"==typeof t&&t(function(n,r){e(n,r),o.callback[n]=function(){t(e)}}),this};return r&&(t=e,e=[]),!layui["layui.all"]&&layui["layui.mobile"]?i.call(n):(n.use(e,i),n)},n.prototype.use=function(e,n,l){function s(e,t){var n="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||n.test((e.currentTarget||e.srcElement).readyState))&&(o.modules[f]=t,d.removeChild(v),function r(){return++m>1e3*o.timeout/4?i(f+" is not a valid module"):void(o.status[f]?c():setTimeout(r,4))}())}function c(){l.push(layui[f]),e.length>1?y.use(e.slice(1),n,l):"function"==typeof n&&n.apply(layui,l)}var y=this,p=o.dir=o.dir?o.dir:r,d=t.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(y.each(e,function(t,o){"jquery"===o&&e.splice(t,1)}),layui.jquery=layui.$=jQuery);var f=e[0],m=0;if(l=l||[],o.host=o.host||(p.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&u[f]||!layui["layui.all"]&&layui["layui.mobile"]&&u[f])return c(),y;if(o.modules[f])!function g(){return++m>1e3*o.timeout/4?i(f+" is not a valid module"):void("string"==typeof o.modules[f]&&o.status[f]?c():setTimeout(g,4))}();else{var v=t.createElement("script"),h=(u[f]?p+"lay/":/^\{\/\}/.test(y.modules[f])?"":o.base||"")+(y.modules[f]||f)+".js";h=h.replace(/^\{\/\}/,""),v.async=!0,v.charset="utf-8",v.src=h+function(){var e=o.version===!0?o.v||(new Date).getTime():o.version||"";return e?"?v="+e:""}(),d.appendChild(v),!v.attachEvent||v.attachEvent.toString&&v.attachEvent.toString().indexOf("[native code")<0||a?v.addEventListener("load",function(e){s(e,h)},!1):v.attachEvent("onreadystatechange",function(e){s(e,h)}),o.modules[f]=h}return y},n.prototype.getStyle=function(t,o){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](o)},n.prototype.link=function(e,n,r){var a=this,u=t.createElement("link"),l=t.getElementsByTagName("head")[0];"string"==typeof n&&(r=n);var s=(r||e).replace(/\.|\//g,""),c=u.id="layuicss-"+s,y=0;return u.rel="stylesheet",u.href=e+(o.debug?"?v="+(new Date).getTime():""),u.media="all",t.getElementById(c)||l.appendChild(u),"function"!=typeof n?a:(function p(){return++y>1e3*o.timeout/100?i(e+" timeout"):void(1989===parseInt(a.getStyle(t.getElementById(c),"width"))?function(){n()}():setTimeout(p,100))}(),a)},o.callback={},n.prototype.factory=function(e){if(layui[e])return"function"==typeof o.callback[e]?o.callback[e]:null},n.prototype.addcss=function(e,t,n){return layui.link(o.dir+"css/"+e,t,n)},n.prototype.img=function(e,t,o){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,"function"==typeof t&&t(n)},void(n.onerror=function(e){n.onerror=null,"function"==typeof o&&o(e)}))},n.prototype.config=function(e){e=e||{};for(var t in e)o[t]=e[t];return this},n.prototype.modules=function(){var e={};for(var t in u)e[t]=u[t];return e}(),n.prototype.extend=function(e){var t=this;e=e||{};for(var o in e)t[o]||t.modules[o]?i("模块名 "+o+" 已被占用"):t.modules[o]=e[o];return t},n.prototype.router=function(e){var t=this,e=e||location.hash,o={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(e=e.replace(/^#\//,""),o.href="/"+e,e=e.replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),o.search[t[0]]=t[1]}():o.path.push(t)}),o):o},n.prototype.data=function(t,o,n){if(t=t||"layui",n=n||localStorage,e.JSON&&e.JSON.parse){if(null===o)return delete n[t];o="object"==typeof o?o:{key:o};try{var r=JSON.parse(n[t])}catch(i){var r={}}return"value"in o&&(r[o.key]=o.value),o.remove&&delete r[o.key],n[t]=JSON.stringify(r),o.key?r[o.key]:r}},n.prototype.sessionData=function(e,t){return this.data(e,t,sessionStorage)},n.prototype.device=function(t){var o=navigator.userAgent.toLowerCase(),n=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(o.match(t)||[])[1],e||!1},r={os:function(){return/windows/.test(o)?"windows":/linux/.test(o)?"linux":/iphone|ipod|ipad|ios/.test(o)?"ios":/mac/.test(o)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((o.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:n("micromessenger")};return t&&!r[t]&&(r[t]=n(t)),r.android=/android/.test(o),r.ios="ios"===r.os,r},n.prototype.hint=function(){return{error:i}},n.prototype.each=function(e,t){var o,n=this;if("function"!=typeof t)return n;if(e=e||[],e.constructor===Object){for(o in e)if(t.call(e[o],o,e[o]))break}else for(o=0;oi?1:r/g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'共 '+a.count+" 条",limit:function(){var e=['"}(),refresh:['','',""].join(""),skip:function(){return['到第','','页',""].join("")}()};return['
        ',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
        "].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)});!function(){"use strict";var e=window.layui&&layui.define,t={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,n=t.length-1,a=n;a>0;a--)if("interactive"===t[a].readyState){e=t[a].src;break}return e||t[n].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),getStyle:function(e,t){var n=e.currentStyle?e.currentStyle:window.getComputedStyle(e,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](t)},link:function(e,a,i){if(n.path){var r=document.getElementsByTagName("head")[0],o=document.createElement("link");"string"==typeof a&&(i=a);var s=(i||e).replace(/\.|\//g,""),l="layuicss-"+s,d=0;o.rel="stylesheet",o.href=n.path+e,o.id=l,document.getElementById(l)||r.appendChild(o),"function"==typeof a&&!function c(){return++d>80?window.console&&console.error("laydate.css: Invalid"):void(1989===parseInt(t.getStyle(document.getElementById(l),"width"))?a():setTimeout(c,100))}()}}},n={v:"5.0.9",config:{},index:window.laydate&&window.laydate.v?1e5:0,path:t.getPath,set:function(e){var t=this;return t.config=w.extend({},t.config,e),t},ready:function(a){var i="laydate",r="",o=(e?"modules/laydate/":"theme/")+"default/laydate.css?v="+n.v+r;return e?layui.addcss(o,a,i):t.link(o,a,i),this}},a=function(){var e=this;return{hint:function(t){e.hint.call(e,t)},config:e.config}},i="laydate",r=".layui-laydate",o="layui-this",s="laydate-disabled",l="开始日期超出了结束日期
        建议重新选择",d=[100,2e5],c="layui-laydate-static",m="layui-laydate-list",u="laydate-selected",h="layui-laydate-hint",y="laydate-day-prev",f="laydate-day-next",p="layui-laydate-footer",g=".laydate-btns-confirm",v="laydate-time-text",D=".laydate-btns-time",T=function(e){var t=this;t.index=++n.index,t.config=w.extend({},t.config,n.config,e),n.ready(function(){t.init()})},w=function(e){return new C(e)},C=function(e){for(var t=0,n="object"==typeof e?[e]:(this.selector=e,document.querySelectorAll(e||null));t0)return n[0].getAttribute(e)}():n.each(function(n,a){a.setAttribute(e,t)})},C.prototype.removeAttr=function(e){return this.each(function(t,n){n.removeAttribute(e)})},C.prototype.html=function(e){return this.each(function(t,n){n.innerHTML=e})},C.prototype.val=function(e){return this.each(function(t,n){n.value=e})},C.prototype.append=function(e){return this.each(function(t,n){"object"==typeof e?n.appendChild(e):n.innerHTML=n.innerHTML+e})},C.prototype.remove=function(e){return this.each(function(t,n){e?n.removeChild(e):n.parentNode.removeChild(n)})},C.prototype.on=function(e,t){return this.each(function(n,a){a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1)})},C.prototype.off=function(e,t){return this.each(function(n,a){a.detachEvent?a.detachEvent("on"+e,t):a.removeEventListener(e,t,!1)})},T.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},T.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"focus",show:!1,showBottom:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},T.prototype.lang=function(){var e=this,t=e.config,n={cn:{weeks:["日","一","二","三","四","五","六"],time:["时","分","秒"],timeTips:"选择时间",startTime:"开始时间",endTime:"结束时间",dateTips:"返回日期",month:["一","二","三","四","五","六","七","八","九","十","十一","十二"],tools:{confirm:"确定",clear:"清空",now:"现在"}},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"}}};return n[t.lang]||n.cn},T.prototype.init=function(){var e=this,t=e.config,n="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s",a="static"===t.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};t.elem=w(t.elem),t.eventElem=w(t.eventElem),t.elem[0]&&(t.range===!0&&(t.range="-"),t.format===i.date&&(t.format=i[t.type]),e.format=t.format.match(new RegExp(n+"|.","g"))||[],e.EXP_IF="",e.EXP_SPLIT="",w.each(e.format,function(t,a){var i=new RegExp(n).test(a)?"\\d{"+function(){return new RegExp(n).test(e.format[0===t?t+1:t-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;e.EXP_IF=e.EXP_IF+i,e.EXP_SPLIT=e.EXP_SPLIT+"("+i+")"}),e.EXP_IF=new RegExp("^"+(t.range?e.EXP_IF+"\\s\\"+t.range+"\\s"+e.EXP_IF:e.EXP_IF)+"$"),e.EXP_SPLIT=new RegExp("^"+e.EXP_SPLIT+"$",""),e.isInput(t.elem[0])||"focus"===t.trigger&&(t.trigger="click"),t.elem.attr("lay-key")||(t.elem.attr("lay-key",e.index),t.eventElem.attr("lay-key",e.index)),t.mark=w.extend({},t.calendar&&"cn"===t.lang?{"0-1-1":"元旦","0-2-14":"情人","0-3-8":"妇女","0-3-12":"植树","0-4-1":"愚人","0-5-1":"劳动","0-5-4":"青年","0-6-1":"儿童","0-9-10":"教师","0-9-18":"国耻","0-10-1":"国庆","0-12-25":"圣诞"}:{},t.mark),w.each(["min","max"],function(e,n){var a=[],i=[];if("number"==typeof t[n]){var r=t[n],o=(new Date).getTime(),s=864e5,l=new Date(r?r0)return!0;var a=w.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=w.elem("div",{"class":"laydate-set-ym"}),t=w.elem("span"),n=w.elem("span");return e.appendChild(t),e.appendChild(n),e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=w.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],d=w.elem("div",{"class":"layui-laydate-content"}),c=w.elem("table"),m=w.elem("thead"),u=w.elem("tr");w.each(i,function(e,t){a.appendChild(t)}),m.appendChild(u),w.each(new Array(6),function(e){var t=c.insertRow(0);w.each(new Array(7),function(a){if(0===e){var i=w.elem("th");i.innerHTML=n.weeks[a],u.appendChild(i)}t.insertCell(a)})}),c.insertBefore(m,c.children[0]),d.appendChild(c),r[e]=w.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),r[e].appendChild(a),r[e].appendChild(d),o.push(i),s.push(d),l.push(c)}),w(d).html(function(){var e=[],i=[];return"datetime"===t.type&&e.push(''+n.timeTips+""),w.each(t.btns,function(e,r){var o=n.tools[r]||"btn";t.range&&"now"===r||(a&&"clear"===r&&(o="cn"===t.lang?"重置":"Reset"),i.push(''+o+""))}),e.push('"),e.join("")}()),w.each(r,function(e,t){i.appendChild(t)}),t.showBottom&&i.appendChild(d),/^#/.test(t.theme)){var m=w.elem("style"),u=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,t.theme);"styleSheet"in m?(m.setAttribute("type","text/css"),m.styleSheet.cssText=u):m.innerHTML=u,w(i).addClass("laydate-theme-molv"),i.appendChild(m)}e.remove(T.thisElemDate),a?t.elem.append(i):(document.body.appendChild(i),e.position()),e.checkDate().calendar(),e.changeEvent(),T.thisElemDate=e.elemID,"function"==typeof t.ready&&t.ready(w.extend({},t.dateTime,{month:t.dateTime.month+1}))},T.prototype.remove=function(e){var t=this,n=(t.config,w("#"+(e||t.elemID)));return n.hasClass(c)||t.checkDate(function(){n.remove()}),t},T.prototype.position=function(){var e=this,t=e.config,n=e.bindElem||t.elem[0],a=n.getBoundingClientRect(),i=e.elem.offsetWidth,r=e.elem.offsetHeight,o=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},s=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},l=5,d=a.left,c=a.bottom;d+i+l>s("width")&&(d=s("width")-i-l),c+r+l>s()&&(c=a.top>r?a.top-r:s()-r,c-=2*l),t.position&&(e.elem.style.position=t.position),e.elem.style.left=d+("fixed"===t.position?0:o(1))+"px",e.elem.style.top=c+("fixed"===t.position?0:o())+"px"},T.prototype.hint=function(e){var t=this,n=(t.config,w.elem("div",{"class":h}));t.elem&&(n.innerHTML=e||"",w(t.elem).find("."+h).remove(),t.elem.appendChild(n),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){w(t.elem).find("."+h).remove()},3e3))},T.prototype.getAsYM=function(e,t,n){return n?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},T.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},T.prototype.checkDate=function(e){var t,a,i=this,r=(new Date,i.config),o=r.dateTime=r.dateTime||i.systemDate(),s=i.bindElem||r.elem[0],l=(i.isInput(s)?"val":"html",i.isInput(s)?s.value:"static"===r.position?"":s.innerHTML),c=function(e){e.year>d[1]&&(e.year=d[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=n.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},m=function(e,t,n){var o=["startTime","endTime"];t=(t.match(i.EXP_SPLIT)||[]).slice(1),n=n||0,r.range&&(i[o[n]]=i[o[n]]||{}),w.each(i.format,function(s,l){var c=parseFloat(t[s]);t[s].length必须遵循下述格式:
        "+(r.range?r.format+" "+r.range+" "+r.format:r.format)+"
        已为你重置"),a=!0):l&&l.constructor===Date?r.dateTime=i.systemDate(l):(r.dateTime=i.systemDate(),delete i.startState,delete i.endState,delete i.startDate,delete i.endDate,delete i.startTime,delete i.endTime),c(o),a&&l&&i.setValue(r.range?i.endDate?i.parse():"":i.parse()),e&&e(),i)},T.prototype.mark=function(e,t){var n,a=this,i=a.config;return w.each(i.mark,function(e,a){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(n=a||t[2])}),n&&e.html(''+n+""),a},T.prototype.limit=function(e,t,n,a){var i,r=this,o=r.config,l={},d=o[n>41?"endDate":"dateTime"],c=w.extend({},d,t||{});return w.each({now:c,min:o.min,max:o.max},function(e,t){l[e]=r.newDate(w.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return w.each(a,function(n,a){e[a]=t[a]}),e}())).getTime()}),i=l.nowl.max,e&&e[i?"addClass":"removeClass"](s),i},T.prototype.calendar=function(e){var t,a,i,r=this,s=r.config,l=e||s.dateTime,c=new Date,m=r.lang(),u="date"!==s.type&&"datetime"!==s.type,h=e?1:0,y=w(r.table[h]).find("td"),f=w(r.elemHeader[h][2]).find("span");if(l.yeard[1]&&(l.year=d[1],r.hint("最高只能支持到公元"+d[1]+"年")),r.firstDate||(r.firstDate=w.extend({},l)),c.setFullYear(l.year,l.month,1),t=c.getDay(),a=n.getEndDate(l.month||12,l.year),i=n.getEndDate(l.month+1,l.year),w.each(y,function(e,n){var d=[l.year,l.month],c=0;n=w(n),n.removeAttr("class"),e=t&&e=n.firstDate.year&&(r.month=a.max.month,r.date=a.max.date),n.limit(w(i),r,t),M++}),w(u[f?0:1]).attr("lay-ym",M-8+"-"+T[1]).html(b+p+" - "+(M-1+p))}else if("month"===e)w.each(new Array(12),function(e){var i=w.elem("li",{"lay-ym":e}),s={year:T[0],month:e};e+1==T[1]&&w(i).addClass(o),i.innerHTML=r.month[e]+(f?"月":""),d.appendChild(i),T[0]=n.firstDate.year&&(s.date=a.max.date),n.limit(w(i),s,t)}),w(u[f?0:1]).attr("lay-ym",T[0]+"-"+T[1]).html(T[0]+p);else if("time"===e){var E=function(){w(d).find("ol").each(function(e,a){w(a).find("li").each(function(a,i){n.limit(w(i),[{hours:a},{hours:n[x].hours,minutes:a},{hours:n[x].hours,minutes:n[x].minutes,seconds:a}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),a.range||n.limit(w(n.footer).find(g),n[x],0,["hours","minutes","seconds"])};a.range?n[x]||(n[x]={hours:0,minutes:0,seconds:0}):n[x]=i,w.each([24,60,60],function(e,t){var a=w.elem("li"),i=["

        "+r.time[e]+"

          "];w.each(new Array(t),function(t){i.push(""+w.digit(t,2)+"")}),a.innerHTML=i.join("")+"
        ",d.appendChild(a)}),E()}if(y&&h.removeChild(y),h.appendChild(d),"year"===e||"month"===e)w(n.elemMain[t]).addClass("laydate-ym-show"),w(d).find("li").on("click",function(){var r=0|w(this).attr("lay-ym");if(!w(this).hasClass(s)){if(0===t)i[e]=r,l&&(n.startDate[e]=r),n.limit(w(n.footer).find(g),null,0);else if(l)n.endDate[e]=r;else{var c="year"===e?n.getAsYM(r,T[1]-1,"sub"):n.getAsYM(T[0],r,"sub");w.extend(i,{year:c[0],month:c[1]})}"year"===a.type||"month"===a.type?(w(d).find("."+o).removeClass(o),w(this).addClass(o),"month"===a.type&&"year"===e&&(n.listYM[t][0]=r,l&&(n[["startDate","endDate"][t]].year=r),n.list("month",t))):(n.checkDate("limit").calendar(),n.closeList()),n.setBtnStatus(),a.range||n.done(null,"change"),w(n.footer).find(D).removeClass(s)}});else{var S=w.elem("span",{"class":v}),k=function(){w(d).find("ol").each(function(e){var t=this,a=w(t).find("li");t.scrollTop=30*(n[x][C[e]]-2),t.scrollTop<=0&&a.each(function(e,n){if(!w(this).hasClass(s))return t.scrollTop=30*(e-2),!0})})},H=w(c[2]).find("."+v);k(),S.innerHTML=a.range?[r.startTime,r.endTime][t]:r.timeTips,w(n.elemMain[t]).addClass("laydate-time-show"),H[0]&&H.remove(),c[2].appendChild(S),w(d).find("ol").each(function(e){var t=this;w(t).find("li").on("click",function(){var r=0|this.innerHTML;w(this).hasClass(s)||(a.range?n[x][C[e]]=r:i[C[e]]=r,w(t).find("."+o).removeClass(o),w(this).addClass(o),E(),k(),(n.endDate||"time"===a.type)&&n.done(null,"change"),n.setBtnStatus())})})}return n},T.prototype.listYM=[],T.prototype.closeList=function(){var e=this;e.config;w.each(e.elemCont,function(t,n){w(this).find("."+m).remove(),w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),w(e.elem).find("."+v).remove()},T.prototype.setBtnStatus=function(e,t,n){var a,i=this,r=i.config,o=w(i.footer).find(g),d=r.range&&"date"!==r.type&&"time"!==r.type;d&&(t=t||i.startDate,n=n||i.endDate,a=i.newDate(t).getTime()>i.newDate(n).getTime(),i.limit(null,t)||i.limit(null,n)?o.addClass(s):o[a?"addClass":"removeClass"](s),e&&a&&i.hint("string"==typeof e?l.replace(/日期/g,e):l))},T.prototype.parse=function(e,t){var n=this,a=n.config,i=t||(e?w.extend({},n.endDate,n.endTime):a.range?w.extend({},n.startDate,n.startTime):a.dateTime),r=n.format.concat();return w.each(r,function(e,t){/yyyy|y/.test(t)?r[e]=w.digit(i.year,t.length):/MM|M/.test(t)?r[e]=w.digit(i.month+1,t.length):/dd|d/.test(t)?r[e]=w.digit(i.date,t.length):/HH|H/.test(t)?r[e]=w.digit(i.hours,t.length):/mm|m/.test(t)?r[e]=w.digit(i.minutes,t.length):/ss|s/.test(t)&&(r[e]=w.digit(i.seconds,t.length))}),a.range&&!e?r.join("")+" "+a.range+" "+n.parse(1):r.join("")},T.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)},T.prototype.setValue=function(e){var t=this,n=t.config,a=t.bindElem||n.elem[0],i=t.isInput(a)?"val":"html";return"static"===n.position||w(a)[i](e||""),this},T.prototype.stampRange=function(){var e,t,n=this,a=n.config,i=w(n.elem).find("td");if(a.range&&!n.endDate&&w(n.footer).find(g).addClass(s),n.endDate)return e=n.newDate({year:n.startDate.year,month:n.startDate.month,date:n.startDate.date}).getTime(),t=n.newDate({year:n.endDate.year,month:n.endDate.month,date:n.endDate.date}).getTime(),e>t?n.hint(l):void w.each(i,function(a,i){var r=w(i).attr("lay-ymd").split("-"),s=n.newDate({year:r[0],month:r[1]-1,date:r[2]}).getTime();w(i).removeClass(u+" "+o),s!==e&&s!==t||w(i).addClass(w(i).hasClass(y)||w(i).hasClass(f)?u:o),s>e&&s0&&t-1 in e)}function r(e,t,n){if(pe.isFunction(t))return pe.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return pe.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(Ce.test(t))return pe.filter(t,e,n);t=pe.filter(t,e)}return pe.grep(e,function(e){return pe.inArray(e,t)>-1!==n})}function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function o(e){var t={};return pe.each(e.match(De)||[],function(e,n){t[n]=!0}),t}function a(){re.addEventListener?(re.removeEventListener("DOMContentLoaded",s),e.removeEventListener("load",s)):(re.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}function s(){(re.addEventListener||"load"===e.event.type||"complete"===re.readyState)&&(a(),pe.ready())}function u(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(_e,"-$1").toLowerCase();if(n=e.getAttribute(r),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:qe.test(n)?pe.parseJSON(n):n)}catch(i){}pe.data(e,t,n)}else n=void 0}return n}function l(e){var t;for(t in e)if(("data"!==t||!pe.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,n,r){if(He(e)){var i,o,a=pe.expando,s=e.nodeType,u=s?pe.cache:e,l=s?e[a]:e[a]&&a;if(l&&u[l]&&(r||u[l].data)||void 0!==n||"string"!=typeof t)return l||(l=s?e[a]=ne.pop()||pe.guid++:a),u[l]||(u[l]=s?{}:{toJSON:pe.noop}),"object"!=typeof t&&"function"!=typeof t||(r?u[l]=pe.extend(u[l],t):u[l].data=pe.extend(u[l].data,t)),o=u[l],r||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[pe.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[pe.camelCase(t)])):i=o,i}}function f(e,t,n){if(He(e)){var r,i,o=e.nodeType,a=o?pe.cache:e,s=o?e[pe.expando]:pe.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){pe.isArray(t)?t=t.concat(pe.map(t,pe.camelCase)):t in r?t=[t]:(t=pe.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;for(;i--;)delete r[t[i]];if(n?!l(r):!pe.isEmptyObject(r))return}(n||(delete a[s].data,l(a[s])))&&(o?pe.cleanData([e],!0):fe.deleteExpando||a!=a.window?delete a[s]:a[s]=void 0)}}}function d(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:function(){return pe.css(e,t,"")},u=s(),l=n&&n[3]||(pe.cssNumber[t]?"":"px"),c=(pe.cssNumber[t]||"px"!==l&&+u)&&Me.exec(pe.css(e,t));if(c&&c[3]!==l){l=l||c[3],n=n||[],c=+u||1;do o=o||".5",c/=o,pe.style(e,t,c+l);while(o!==(o=s()/u)&&1!==o&&--a)}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}function p(e){var t=ze.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function h(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||pe.nodeName(r,t)?o.push(r):pe.merge(o,h(r,t));return void 0===t||t&&pe.nodeName(e,t)?pe.merge([e],o):o}function g(e,t){for(var n,r=0;null!=(n=e[r]);r++)pe._data(n,"globalEval",!t||pe._data(t[r],"globalEval"))}function m(e){Be.test(e.type)&&(e.defaultChecked=e.checked)}function y(e,t,n,r,i){for(var o,a,s,u,l,c,f,d=e.length,y=p(t),v=[],x=0;x"!==f[1]||Ve.test(a)?0:u:u.firstChild,o=a&&a.childNodes.length;o--;)pe.nodeName(c=a.childNodes[o],"tbody")&&!c.childNodes.length&&a.removeChild(c);for(pe.merge(v,u.childNodes),u.textContent="";u.firstChild;)u.removeChild(u.firstChild);u=y.lastChild}else v.push(t.createTextNode(a));for(u&&y.removeChild(u),fe.appendChecked||pe.grep(h(v,"input"),m),x=0;a=v[x++];)if(r&&pe.inArray(a,r)>-1)i&&i.push(a);else if(s=pe.contains(a.ownerDocument,a),u=h(y.appendChild(a),"script"),s&&g(u),n)for(o=0;a=u[o++];)Ie.test(a.type||"")&&n.push(a);return u=null,y}function v(){return!0}function x(){return!1}function b(){try{return re.activeElement}catch(e){}}function w(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)w(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=x;else if(!i)return e;return 1===o&&(a=i,i=function(e){return pe().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=pe.guid++)),e.each(function(){pe.event.add(this,t,i,r,n)})}function T(e,t){return pe.nodeName(e,"table")&&pe.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function C(e){return e.type=(null!==pe.find.attr(e,"type"))+"/"+e.type,e}function E(e){var t=it.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function N(e,t){if(1===t.nodeType&&pe.hasData(e)){var n,r,i,o=pe._data(e),a=pe._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;r1&&"string"==typeof p&&!fe.checkClone&&rt.test(p))return e.each(function(i){var o=e.eq(i);g&&(t[0]=p.call(this,i,o.html())),S(o,t,n,r)});if(f&&(l=y(t,e[0].ownerDocument,!1,e,r),i=l.firstChild,1===l.childNodes.length&&(l=i),i||r)){for(s=pe.map(h(l,"script"),C),a=s.length;c")).appendTo(t.documentElement),t=(ut[0].contentWindow||ut[0].contentDocument).document,t.write(),t.close(),n=D(e,t),ut.detach()),lt[e]=n),n}function L(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function H(e){if(e in Et)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=Ct.length;n--;)if(e=Ct[n]+t,e in Et)return e}function q(e,t){for(var n,r,i,o=[],a=0,s=e.length;a=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==pe.type(e)||e.nodeType||pe.isWindow(e))return!1;try{if(e.constructor&&!ce.call(e,"constructor")&&!ce.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(!fe.ownFirst)for(t in e)return ce.call(e,t);for(t in e);return void 0===t||ce.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?ue[le.call(e)]||"object":typeof e},globalEval:function(t){t&&pe.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ge,"ms-").replace(me,ye)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var r,i=0;if(n(e))for(r=e.length;iT.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[P]=!0,e}function i(e){var t=H.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;)T.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||V)-(~e.sourceIndex||V);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function f(){}function d(e){for(var t=0,n=e.length,r="";t1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function g(e,n,r){for(var i=0,o=n.length;i-1&&(r[l]=!(a[l]=f))}}else x=m(x===a?x.splice(h,x.length):x),o?o(null,a,x,u):Q.apply(a,x)})}function v(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],a=o||T.relative[" "],s=o?1:0,u=p(function(e){return e===t},a,!0),l=p(function(e){return ee(t,e)>-1},a,!0),c=[function(e,n,r){var i=!o&&(r||n!==A)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,i}];s1&&h(c),s>1&&d(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,s0,o=e.length>0,a=function(r,a,s,u,l){var c,f,d,p=0,h="0",g=r&&[],y=[],v=A,x=r||o&&T.find.TAG("*",l),b=W+=null==v?1:Math.random()||.1,w=x.length;for(l&&(A=a===H||a||l);h!==w&&null!=(c=x[h]);h++){if(o&&c){for(f=0,a||c.ownerDocument===H||(L(c),s=!_);d=e[f++];)if(d(c,a||H,s)){u.push(c);break}l&&(W=b)}i&&((c=!d&&c)&&p--,r&&g.push(c))}if(p+=h,i&&h!==p){for(f=0;d=n[f++];)d(g,y,a,s);if(r){if(p>0)for(;h--;)g[h]||y[h]||(y[h]=G.call(u));y=m(y)}Q.apply(u,y),l&&!r&&y.length>0&&p+n.length>1&&t.uniqueSort(u)}return l&&(W=b,A=v),g};return i?r(a):a}var b,w,T,C,E,N,k,S,A,D,j,L,H,q,_,F,M,O,R,P="sizzle"+1*new Date,B=e.document,W=0,I=0,$=n(),z=n(),X=n(),U=function(e,t){return e===t&&(j=!0),0},V=1<<31,Y={}.hasOwnProperty,J=[],G=J.pop,K=J.push,Q=J.push,Z=J.slice,ee=function(e,t){for(var n=0,r=e.length;n+~]|"+ne+")"+ne+"*"),ce=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),fe=new RegExp(oe),de=new RegExp("^"+re+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},he=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,me=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ve=/[+~]/,xe=/'|\\/g,be=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),we=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Te=function(){L()};try{Q.apply(J=Z.call(B.childNodes),B.childNodes),J[B.childNodes.length].nodeType}catch(Ce){Q={apply:J.length?function(e,t){K.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}w=t.support={},E=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},L=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:B;return r!==H&&9===r.nodeType&&r.documentElement?(H=r,q=H.documentElement,_=!E(H),(n=H.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Te,!1):n.attachEvent&&n.attachEvent("onunload",Te)),w.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=i(function(e){return e.appendChild(H.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=me.test(H.getElementsByClassName),w.getById=i(function(e){return q.appendChild(e).id=P,!H.getElementsByName||!H.getElementsByName(P).length}),w.getById?(T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&_){var n=t.getElementById(e);return n?[n]:[]}},T.filter.ID=function(e){var t=e.replace(be,we);return function(e){return e.getAttribute("id")===t}}):(delete T.find.ID,T.filter.ID=function(e){var t=e.replace(be,we);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),T.find.TAG=w.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):w.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},T.find.CLASS=w.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&_)return t.getElementsByClassName(e)},M=[],F=[],(w.qsa=me.test(H.querySelectorAll))&&(i(function(e){q.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&F.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||F.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+P+"-]").length||F.push("~="),e.querySelectorAll(":checked").length||F.push(":checked"),e.querySelectorAll("a#"+P+"+*").length||F.push(".#.+[+~]")}),i(function(e){var t=H.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&F.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||F.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),F.push(",.*:")})),(w.matchesSelector=me.test(O=q.matches||q.webkitMatchesSelector||q.mozMatchesSelector||q.oMatchesSelector||q.msMatchesSelector))&&i(function(e){w.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),M.push("!=",oe)}),F=F.length&&new RegExp(F.join("|")),M=M.length&&new RegExp(M.join("|")),t=me.test(q.compareDocumentPosition),R=t||me.test(q.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},U=t?function(e,t){if(e===t)return j=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!w.sortDetached&&t.compareDocumentPosition(e)===n?e===H||e.ownerDocument===B&&R(B,e)?-1:t===H||t.ownerDocument===B&&R(B,t)?1:D?ee(D,e)-ee(D,t):0:4&n?-1:1)}:function(e,t){if(e===t)return j=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],u=[t];if(!i||!o)return e===H?-1:t===H?1:i?-1:o?1:D?ee(D,e)-ee(D,t):0;if(i===o)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?a(s[r],u[r]):s[r]===B?-1:u[r]===B?1:0},H):H},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==H&&L(e),n=n.replace(ce,"='$1']"),w.matchesSelector&&_&&!X[n+" "]&&(!M||!M.test(n))&&(!F||!F.test(n)))try{var r=O.call(e,n);if(r||w.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return t(n,H,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==H&&L(e),R(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==H&&L(e);var n=T.attrHandle[t.toLowerCase()],r=n&&Y.call(T.attrHandle,t.toLowerCase())?n(e,t,!_):void 0;return void 0!==r?r:w.attributes||!_?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(j=!w.detectDuplicates,D=!w.sortStable&&e.slice(0),e.sort(U),j){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return D=null,e},C=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=C(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=C(t);return n},T=t.selectors={cacheLength:50,createPseudo:r,match:pe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(be,we),e[3]=(e[3]||e[4]||e[5]||"").replace(be,we),"~="===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]||t.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]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return pe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&fe.test(n)&&(t=N(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(be,we).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=$[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&$(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:!n||(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(ae," ")+" ").indexOf(r)>-1:"|="===n&&(o===r||o.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,d,p,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s,x=!1;if(m){if(o){for(;g;){for(d=t;d=d[g];)if(s?d.nodeName.toLowerCase()===y:1===d.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){for(d=m,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}), +l=c[e]||[],p=l[0]===W&&l[1],x=p&&l[2],d=p&&m.childNodes[p];d=++p&&d&&d[g]||(x=p=0)||h.pop();)if(1===d.nodeType&&++x&&d===t){c[e]=[W,p,x];break}}else if(v&&(d=t,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===W&&l[1],x=p),x===!1)for(;(d=++p&&d&&d[g]||(x=p=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==y:1!==d.nodeType)||!++x||(v&&(f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),c[e]=[W,x]),d!==t)););return x-=i,x===r||x%r===0&&x/r>=0}}},PSEUDO:function(e,n){var i,o=T.pseudos[e]||T.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[P]?o(n):o.length>1?(i=[e,e,"",n],T.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=ee(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=k(e.replace(se,"$1"));return i[P]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(be,we),function(t){return(t.textContent||t.innerText||C(t)).indexOf(e)>-1}}),lang:r(function(e){return de.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(be,we).toLowerCase(),function(t){var n;do if(n=_?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===q},focus:function(e){return e===H.activeElement&&(!H.hasFocus||H.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!T.pseudos.empty(e)},header:function(e){return ge.test(e.nodeName)},input:function(e){return he.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:l(function(){return[0]}),last:l(function(e,t){return[t-1]}),eq:l(function(e,t,n){return[n<0?n+t:n]}),even:l(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:l(function(e,t,n){for(var r=n<0?n+t:n;++r2&&"ID"===(a=o[0]).type&&w.getById&&9===t.nodeType&&_&&T.relative[o[1].type]){if(t=(T.find.ID(a.matches[0].replace(be,we),t)||[])[0],!t)return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=pe.needsContext.test(e)?0:o.length;i--&&(a=o[i],!T.relative[s=a.type]);)if((u=T.find[s])&&(r=u(a.matches[0].replace(be,we),ve.test(o[0].type)&&c(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&d(o),!e)return Q.apply(n,r),n;break}}return(l||k(e,f))(r,t,!_,n,!t||ve.test(e)&&c(t.parentNode)||t),n},w.sortStable=P.split("").sort(U).join("")===P,w.detectDuplicates=!!j,L(),w.sortDetached=i(function(e){return 1&e.compareDocumentPosition(H.createElement("div"))}),i(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),w.attributes&&i(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);pe.find=ve,pe.expr=ve.selectors,pe.expr[":"]=pe.expr.pseudos,pe.uniqueSort=pe.unique=ve.uniqueSort,pe.text=ve.getText,pe.isXMLDoc=ve.isXML,pe.contains=ve.contains;var xe=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&pe(e).is(n))break;r.push(e)}return r},be=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},we=pe.expr.match.needsContext,Te=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Ce=/^.[^:#\[\.,]*$/;pe.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?pe.find.matchesSelector(r,e)?[r]:[]:pe.find.matches(e,pe.grep(t,function(e){return 1===e.nodeType}))},pe.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(pe(e).filter(function(){for(t=0;t1?pe.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},filter:function(e){return this.pushStack(r(this,e||[],!1))},not:function(e){return this.pushStack(r(this,e||[],!0))},is:function(e){return!!r(this,"string"==typeof e&&we.test(e)?pe(e):e||[],!1).length}});var Ee,Ne=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ke=pe.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||Ee,"string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:Ne.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof pe?t[0]:t,pe.merge(this,pe.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:re,!0)),Te.test(r[1])&&pe.isPlainObject(t))for(r in t)pe.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}if(i=re.getElementById(r[2]),i&&i.parentNode){if(i.id!==r[2])return Ee.find(e);this.length=1,this[0]=i}return this.context=re,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):pe.isFunction(e)?"undefined"!=typeof n.ready?n.ready(e):e(pe):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),pe.makeArray(e,this))};ke.prototype=pe.fn,Ee=pe(re);var Se=/^(?:parents|prev(?:Until|All))/,Ae={children:!0,contents:!0,next:!0,prev:!0};pe.fn.extend({has:function(e){var t,n=pe(e,this),r=n.length;return this.filter(function(){for(t=0;t-1:1===n.nodeType&&pe.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?pe.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?pe.inArray(this[0],pe(e)):pe.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(pe.uniqueSort(pe.merge(this.get(),pe(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),pe.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return xe(e,"parentNode")},parentsUntil:function(e,t,n){return xe(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return xe(e,"nextSibling")},prevAll:function(e){return xe(e,"previousSibling")},nextUntil:function(e,t,n){return xe(e,"nextSibling",n)},prevUntil:function(e,t,n){return xe(e,"previousSibling",n)},siblings:function(e){return be((e.parentNode||{}).firstChild,e)},children:function(e){return be(e.firstChild)},contents:function(e){return pe.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:pe.merge([],e.childNodes)}},function(e,t){pe.fn[e]=function(n,r){var i=pe.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=pe.filter(r,i)),this.length>1&&(Ae[e]||(i=pe.uniqueSort(i)),Se.test(e)&&(i=i.reverse())),this.pushStack(i)}});var De=/\S+/g;pe.Callbacks=function(e){e="string"==typeof e?o(e):pe.extend({},e);var t,n,r,i,a=[],s=[],u=-1,l=function(){for(i=e.once,r=t=!0;s.length;u=-1)for(n=s.shift();++u-1;)a.splice(n,1),n<=u&&u--}),this},has:function(e){return e?pe.inArray(e,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return i=s=[],a=n="",this},disabled:function(){return!a},lock:function(){return i=!0,n||c.disable(),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],s.push(n),t||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},pe.extend({Deferred:function(e){var t=[["resolve","done",pe.Callbacks("once memory"),"resolved"],["reject","fail",pe.Callbacks("once memory"),"rejected"],["notify","progress",pe.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return pe.Deferred(function(n){pe.each(t,function(t,o){var a=pe.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&pe.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[o[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?pe.extend(e,r):r}},i={};return r.pipe=r.then,pe.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=ie.call(arguments),a=o.length,s=1!==a||e&&pe.isFunction(e.promise)?a:0,u=1===s?e:pe.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?ie.call(arguments):i,r===t?u.notifyWith(n,r):--s||u.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);i0||(je.resolveWith(re,[pe]),pe.fn.triggerHandler&&(pe(re).triggerHandler("ready"),pe(re).off("ready"))))}}),pe.ready.promise=function(t){if(!je)if(je=pe.Deferred(),"complete"===re.readyState||"loading"!==re.readyState&&!re.documentElement.doScroll)e.setTimeout(pe.ready);else if(re.addEventListener)re.addEventListener("DOMContentLoaded",s),e.addEventListener("load",s);else{re.attachEvent("onreadystatechange",s),e.attachEvent("onload",s);var n=!1;try{n=null==e.frameElement&&re.documentElement}catch(r){}n&&n.doScroll&&!function i(){if(!pe.isReady){try{n.doScroll("left")}catch(t){return e.setTimeout(i,50)}a(),pe.ready()}}()}return je.promise(t)},pe.ready.promise();var Le;for(Le in pe(fe))break;fe.ownFirst="0"===Le,fe.inlineBlockNeedsLayout=!1,pe(function(){var e,t,n,r;n=re.getElementsByTagName("body")[0],n&&n.style&&(t=re.createElement("div"),r=re.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),"undefined"!=typeof t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",fe.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=re.createElement("div");fe.deleteExpando=!0;try{delete e.test}catch(t){fe.deleteExpando=!1}e=null}();var He=function(e){var t=pe.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||t!==!0&&e.getAttribute("classid")===t)},qe=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,_e=/([A-Z])/g;pe.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?pe.cache[e[pe.expando]]:e[pe.expando],!!e&&!l(e)},data:function(e,t,n){return c(e,t,n)},removeData:function(e,t){return f(e,t)},_data:function(e,t,n){return c(e,t,n,!0)},_removeData:function(e,t){return f(e,t,!0)}}),pe.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=pe.data(o),1===o.nodeType&&!pe._data(o,"parsedAttrs"))){for(n=a.length;n--;)a[n]&&(r=a[n].name,0===r.indexOf("data-")&&(r=pe.camelCase(r.slice(5)),u(o,r,i[r])));pe._data(o,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){pe.data(this,e)}):arguments.length>1?this.each(function(){pe.data(this,e,t)}):o?u(o,e,pe.data(o,e)):void 0},removeData:function(e){return this.each(function(){pe.removeData(this,e)})}}),pe.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=pe._data(e,t),n&&(!r||pe.isArray(n)?r=pe._data(e,t,pe.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=pe.queue(e,t),r=n.length,i=n.shift(),o=pe._queueHooks(e,t),a=function(){pe.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return pe._data(e,n)||pe._data(e,n,{empty:pe.Callbacks("once memory").add(function(){pe._removeData(e,t+"queue"),pe._removeData(e,n)})})}}),pe.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length
        a",fe.leadingWhitespace=3===e.firstChild.nodeType,fe.tbody=!e.getElementsByTagName("tbody").length,fe.htmlSerialize=!!e.getElementsByTagName("link").length,fe.html5Clone="<:nav>"!==re.createElement("nav").cloneNode(!0).outerHTML,n.type="checkbox",n.checked=!0,t.appendChild(n),fe.appendChecked=n.checked,e.innerHTML="",fe.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue,t.appendChild(e),n=re.createElement("input"),n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),e.appendChild(n),fe.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,fe.noCloneEvent=!!e.addEventListener,e[pe.expando]=1,fe.attributes=!e.getAttribute(pe.expando)}();var Xe={option:[1,""],legend:[1,"
        ","
        "],area:[1,"",""],param:[1,"",""],thead:[1,"","
        "],tr:[2,"","
        "],col:[2,"","
        "],td:[3,"","
        "],_default:fe.htmlSerialize?[0,"",""]:[1,"X
        ","
        "]};Xe.optgroup=Xe.option,Xe.tbody=Xe.tfoot=Xe.colgroup=Xe.caption=Xe.thead,Xe.th=Xe.td;var Ue=/<|&#?\w+;/,Ve=/-1&&(h=p.split("."),p=h.shift(),h.sort()),a=p.indexOf(":")<0&&"on"+p,t=t[pe.expando]?t:new pe.Event(p,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=h.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:pe.makeArray(n,[t]),l=pe.event.special[p]||{},i||!l.trigger||l.trigger.apply(r,n)!==!1)){if(!i&&!l.noBubble&&!pe.isWindow(r)){for(u=l.delegateType||p,Ke.test(u+p)||(s=s.parentNode);s;s=s.parentNode)d.push(s),c=s;c===(r.ownerDocument||re)&&d.push(c.defaultView||c.parentWindow||e)}for(f=0;(s=d[f++])&&!t.isPropagationStopped();)t.type=f>1?u:l.bindType||p,o=(pe._data(s,"events")||{})[t.type]&&pe._data(s,"handle"),o&&o.apply(s,n),o=a&&s[a],o&&o.apply&&He(s)&&(t.result=o.apply(s,n),t.result===!1&&t.preventDefault());if(t.type=p,!i&&!t.isDefaultPrevented()&&(!l._default||l._default.apply(d.pop(),n)===!1)&&He(r)&&a&&r[p]&&!pe.isWindow(r)){c=r[a],c&&(r[a]=null),pe.event.triggered=p;try{r[p]()}catch(g){}pe.event.triggered=void 0,c&&(r[a]=c)}return t.result}},dispatch:function(e){e=pe.event.fix(e);var t,n,r,i,o,a=[],s=ie.call(arguments),u=(pe._data(this,"events")||{})[e.type]||[],l=pe.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){for(a=pe.event.handlers.call(this,e,u),t=0;(i=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!e.isImmediatePropagationStopped();)e.rnamespace&&!e.rnamespace.test(o.namespace)||(e.handleObj=o,e.data=o.data,r=((pe.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s),void 0!==r&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,a=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(r=[],n=0;n-1:pe.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&a.push({elem:u,handlers:r})}return s]","i"),tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,nt=/\s*$/g,at=p(re),st=at.appendChild(re.createElement("div"));pe.extend({htmlPrefilter:function(e){return e.replace(tt,"<$1>")},clone:function(e,t,n){var r,i,o,a,s,u=pe.contains(e.ownerDocument,e);if(fe.html5Clone||pe.isXMLDoc(e)||!et.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(st.innerHTML=e.outerHTML,st.removeChild(o=st.firstChild)),!(fe.noCloneEvent&&fe.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||pe.isXMLDoc(e)))for(r=h(o),s=h(e),a=0;null!=(i=s[a]);++a)r[a]&&k(i,r[a]);if(t)if(n)for(s=s||h(e),r=r||h(o),a=0;null!=(i=s[a]);a++)N(i,r[a]);else N(e,o);return r=h(o,"script"),r.length>0&&g(r,!u&&h(e,"script")),r=s=i=null,o},cleanData:function(e,t){for(var n,r,i,o,a=0,s=pe.expando,u=pe.cache,l=fe.attributes,c=pe.event.special;null!=(n=e[a]);a++)if((t||He(n))&&(i=n[s],o=i&&u[i])){if(o.events)for(r in o.events)c[r]?pe.event.remove(n,r):pe.removeEvent(n,r,o.handle);u[i]&&(delete u[i],l||"undefined"==typeof n.removeAttribute?n[s]=void 0:n.removeAttribute(s),ne.push(i))}}}),pe.fn.extend({domManip:S,detach:function(e){return A(this,e,!0)},remove:function(e){return A(this,e)},text:function(e){return Pe(this,function(e){return void 0===e?pe.text(this):this.empty().append((this[0]&&this[0].ownerDocument||re).createTextNode(e))},null,e,arguments.length)},append:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.appendChild(e)}})},prepend:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return S(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return S(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&&pe.cleanData(h(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&pe.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 pe.clone(this,e,t)})},html:function(e){return Pe(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(Ze,""):void 0;if("string"==typeof e&&!nt.test(e)&&(fe.htmlSerialize||!et.test(e))&&(fe.leadingWhitespace||!$e.test(e))&&!Xe[(We.exec(e)||["",""])[1].toLowerCase()]){e=pe.htmlPrefilter(e);try{for(;nt",t=l.getElementsByTagName("td"),t[0].style.cssText="margin:0;border:0;padding:0;display:none",o=0===t[0].offsetHeight,o&&(t[0].style.display="",t[1].style.display="none",o=0===t[0].offsetHeight)),f.removeChild(u)}var n,r,i,o,a,s,u=re.createElement("div"),l=re.createElement("div");l.style&&(l.style.cssText="float:left;opacity:.5",fe.opacity="0.5"===l.style.opacity,fe.cssFloat=!!l.style.cssFloat,l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",fe.clearCloneStyle="content-box"===l.style.backgroundClip,u=re.createElement("div"),u.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",l.innerHTML="",u.appendChild(l),fe.boxSizing=""===l.style.boxSizing||""===l.style.MozBoxSizing||""===l.style.WebkitBoxSizing,pe.extend(fe,{reliableHiddenOffsets:function(){return null==n&&t(),o},boxSizingReliable:function(){return null==n&&t(),i},pixelMarginRight:function(){return null==n&&t(),r},pixelPosition:function(){return null==n&&t(),n},reliableMarginRight:function(){return null==n&&t(),a},reliableMarginLeft:function(){return null==n&&t(),s}}))}();var ht,gt,mt=/^(top|right|bottom|left)$/;e.getComputedStyle?(ht=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n.getPropertyValue(t)||n[t]:void 0,""!==a&&void 0!==a||pe.contains(e.ownerDocument,e)||(a=pe.style(e,t)),n&&!fe.pixelMarginRight()&&ft.test(a)&&ct.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o),void 0===a?a:a+""}):pt.currentStyle&&(ht=function(e){return e.currentStyle},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n[t]:void 0,null==a&&s&&s[t]&&(a=s[t]),ft.test(a)&&!mt.test(t)&&(r=s.left,i=e.runtimeStyle,o=i&&i.left,o&&(i.left=e.currentStyle.left),s.left="fontSize"===t?"1em":a,a=s.pixelLeft+"px",s.left=r,o&&(i.left=o)),void 0===a?a:a+""||"auto"});var yt=/alpha\([^)]*\)/i,vt=/opacity\s*=\s*([^)]*)/i,xt=/^(none|table(?!-c[ea]).+)/,bt=new RegExp("^("+Fe+")(.*)$","i"),wt={position:"absolute",visibility:"hidden",display:"block"},Tt={letterSpacing:"0",fontWeight:"400"},Ct=["Webkit","O","Moz","ms"],Et=re.createElement("div").style;pe.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=gt(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":fe.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=pe.camelCase(t),u=e.style;if(t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:u[t];if(o=typeof n,"string"===o&&(i=Me.exec(n))&&i[1]&&(n=d(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(pe.cssNumber[s]?"":"px")),fe.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),!(a&&"set"in a&&void 0===(n=a.set(e,n,r)))))try{u[t]=n}catch(l){}}},css:function(e,t,n,r){var i,o,a,s=pe.camelCase(t);return t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],a&&"get"in a&&(o=a.get(e,!0,n)),void 0===o&&(o=gt(e,t,r)),"normal"===o&&t in Tt&&(o=Tt[t]),""===n||n?(i=parseFloat(o),n===!0||isFinite(i)?i||0:o):o}}),pe.each(["height","width"],function(e,t){pe.cssHooks[t]={get:function(e,n,r){if(n)return xt.test(pe.css(e,"display"))&&0===e.offsetWidth?dt(e,wt,function(){return M(e,t,r)}):M(e,t,r)},set:function(e,n,r){var i=r&&ht(e);return _(e,n,r?F(e,t,r,fe.boxSizing&&"border-box"===pe.css(e,"boxSizing",!1,i),i):0)}}}),fe.opacity||(pe.cssHooks.opacity={get:function(e,t){return vt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=pe.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===pe.trim(o.replace(yt,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=yt.test(o)?o.replace(yt,i):o+" "+i)}}),pe.cssHooks.marginRight=L(fe.reliableMarginRight,function(e,t){if(t)return dt(e,{display:"inline-block"},gt,[e,"marginRight"])}),pe.cssHooks.marginLeft=L(fe.reliableMarginLeft,function(e,t){if(t)return(parseFloat(gt(e,"marginLeft"))||(pe.contains(e.ownerDocument,e)?e.getBoundingClientRect().left-dt(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}):0))+"px"}),pe.each({margin:"",padding:"",border:"Width"},function(e,t){pe.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+Oe[r]+t]=o[r]||o[r-2]||o[0];return i}},ct.test(e)||(pe.cssHooks[e+t].set=_)}),pe.fn.extend({css:function(e,t){return Pe(this,function(e,t,n){var r,i,o={},a=0;if(pe.isArray(t)){for(r=ht(e),i=t.length;a1)},show:function(){return q(this,!0)},hide:function(){return q(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Re(this)?pe(this).show():pe(this).hide()})}}),pe.Tween=O,O.prototype={constructor:O,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||pe.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(pe.cssNumber[n]?"":"px")},cur:function(){var e=O.propHooks[this.prop];return e&&e.get?e.get(this):O.propHooks._default.get(this)},run:function(e){var t,n=O.propHooks[this.prop];return this.options.duration?this.pos=t=pe.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):O.propHooks._default.set(this),this}},O.prototype.init.prototype=O.prototype,O.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=pe.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){pe.fx.step[e.prop]?pe.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[pe.cssProps[e.prop]]&&!pe.cssHooks[e.prop]?e.elem[e.prop]=e.now:pe.style(e.elem,e.prop,e.now+e.unit)}}},O.propHooks.scrollTop=O.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},pe.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},pe.fx=O.prototype.init,pe.fx.step={};var Nt,kt,St=/^(?:toggle|show|hide)$/,At=/queueHooks$/;pe.Animation=pe.extend($,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return d(n.elem,e,Me.exec(t),n),n}]},tweener:function(e,t){pe.isFunction(e)?(t=e,e=["*"]):e=e.match(De);for(var n,r=0,i=e.length;r
        a",e=n.getElementsByTagName("a")[0],t.setAttribute("type","checkbox"),n.appendChild(t),e=n.getElementsByTagName("a")[0],e.style.cssText="top:1px",fe.getSetAttribute="t"!==n.className,fe.style=/top/.test(e.getAttribute("style")),fe.hrefNormalized="/a"===e.getAttribute("href"),fe.checkOn=!!t.value,fe.optSelected=i.selected,fe.enctype=!!re.createElement("form").enctype,r.disabled=!0,fe.optDisabled=!i.disabled,t=re.createElement("input"),t.setAttribute("value",""),fe.input=""===t.getAttribute("value"),t.value="t",t.setAttribute("type","radio"),fe.radioValue="t"===t.value}();var Dt=/\r/g,jt=/[\x20\t\r\n\f]+/g;pe.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=pe.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,pe(this).val()):e,null==i?i="":"number"==typeof i?i+="":pe.isArray(i)&&(i=pe.map(i,function(e){return null==e?"":e+""})),t=pe.valHooks[this.type]||pe.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return t=pe.valHooks[i.type]||pe.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(Dt,""):null==n?"":n)}}}),pe.extend({valHooks:{option:{get:function(e){var t=pe.find.attr(e,"value");return null!=t?t:pe.trim(pe.text(e)).replace(jt," ")}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,a=o?null:[],s=o?i+1:r.length,u=i<0?s:o?i:0;u-1)try{r.selected=n=!0}catch(s){r.scrollHeight}else r.selected=!1;return n||(e.selectedIndex=-1),i}}}}),pe.each(["radio","checkbox"],function(){pe.valHooks[this]={set:function(e,t){if(pe.isArray(t))return e.checked=pe.inArray(pe(e).val(),t)>-1}},fe.checkOn||(pe.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Lt,Ht,qt=pe.expr.attrHandle,_t=/^(?:checked|selected)$/i,Ft=fe.getSetAttribute,Mt=fe.input;pe.fn.extend({attr:function(e,t){return Pe(this,pe.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){pe.removeAttr(this,e)})}}),pe.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?pe.prop(e,t,n):(1===o&&pe.isXMLDoc(e)||(t=t.toLowerCase(),i=pe.attrHooks[t]||(pe.expr.match.bool.test(t)?Ht:Lt)),void 0!==n?null===n?void pe.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=pe.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!fe.radioValue&&"radio"===t&&pe.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(De);if(o&&1===e.nodeType)for(;n=o[i++];)r=pe.propFix[n]||n,pe.expr.match.bool.test(n)?Mt&&Ft||!_t.test(n)?e[r]=!1:e[pe.camelCase("default-"+n)]=e[r]=!1:pe.attr(e,n,""),e.removeAttribute(Ft?n:r)}}),Ht={set:function(e,t,n){return t===!1?pe.removeAttr(e,n):Mt&&Ft||!_t.test(n)?e.setAttribute(!Ft&&pe.propFix[n]||n,n):e[pe.camelCase("default-"+n)]=e[n]=!0,n}},pe.each(pe.expr.match.bool.source.match(/\w+/g),function(e,t){var n=qt[t]||pe.find.attr;Mt&&Ft||!_t.test(t)?qt[t]=function(e,t,r){var i,o;return r||(o=qt[t],qt[t]=i,i=null!=n(e,t,r)?t.toLowerCase():null,qt[t]=o),i}:qt[t]=function(e,t,n){if(!n)return e[pe.camelCase("default-"+t)]?t.toLowerCase():null}}),Mt&&Ft||(pe.attrHooks.value={set:function(e,t,n){return pe.nodeName(e,"input")?void(e.defaultValue=t):Lt&&Lt.set(e,t,n)}}),Ft||(Lt={set:function(e,t,n){var r=e.getAttributeNode(n);if(r||e.setAttributeNode(r=e.ownerDocument.createAttribute(n)),r.value=t+="","value"===n||t===e.getAttribute(n))return t}},qt.id=qt.name=qt.coords=function(e,t,n){var r;if(!n)return(r=e.getAttributeNode(t))&&""!==r.value?r.value:null},pe.valHooks.button={get:function(e,t){var n=e.getAttributeNode(t);if(n&&n.specified)return n.value},set:Lt.set},pe.attrHooks.contenteditable={set:function(e,t,n){Lt.set(e,""!==t&&t,n)}},pe.each(["width","height"],function(e,t){pe.attrHooks[t]={set:function(e,n){if(""===n)return e.setAttribute(t,"auto"),n}}})),fe.style||(pe.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var Ot=/^(?:input|select|textarea|button|object)$/i,Rt=/^(?:a|area)$/i;pe.fn.extend({prop:function(e,t){return Pe(this,pe.prop,e,t,arguments.length>1)},removeProp:function(e){return e=pe.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e]}catch(t){}})}}),pe.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&pe.isXMLDoc(e)||(t=pe.propFix[t]||t,i=pe.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=pe.find.attr(e,"tabindex");return t?parseInt(t,10):Ot.test(e.nodeName)||Rt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),fe.hrefNormalized||pe.each(["href","src"],function(e,t){pe.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),fe.optSelected||(pe.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),pe.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){pe.propFix[this.toLowerCase()]=this}),fe.enctype||(pe.propFix.enctype="encoding");var Pt=/[\t\r\n\f]/g;pe.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).addClass(e.call(this,t,z(this)))});if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).removeClass(e.call(this,t,z(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):pe.isFunction(e)?this.each(function(n){pe(this).toggleClass(e.call(this,n,z(this),t),t)}):this.each(function(){var t,r,i,o;if("string"===n)for(r=0,i=pe(this),o=e.match(De)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else void 0!==e&&"boolean"!==n||(t=z(this),t&&pe._data(this,"__className__",t),pe.attr(this,"class",t||e===!1?"":pe._data(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+z(n)+" ").replace(Pt," ").indexOf(t)>-1)return!0;return!1}}),pe.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){pe.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),pe.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}});var Bt=e.location,Wt=pe.now(),It=/\?/,$t=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;pe.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,r=null,i=pe.trim(t+"");return i&&!pe.trim(i.replace($t,function(e,t,i,o){return n&&t&&(r=0),0===r?e:(n=i||t,r+=!o-!i,"")}))?Function("return "+i)():pe.error("Invalid JSON: "+t)},pe.parseXML=function(t){var n,r;if(!t||"string"!=typeof t)return null;try{e.DOMParser?(r=new e.DOMParser,n=r.parseFromString(t,"text/xml")):(n=new e.ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t))}catch(i){n=void 0}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||pe.error("Invalid XML: "+t),n};var zt=/#.*$/,Xt=/([?&])_=[^&]*/,Ut=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Vt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Yt=/^(?:GET|HEAD)$/,Jt=/^\/\//,Gt=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Kt={},Qt={},Zt="*/".concat("*"),en=Bt.href,tn=Gt.exec(en.toLowerCase())||[];pe.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:en,type:"GET",isLocal:Vt.test(tn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":pe.parseJSON,"text xml":pe.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?V(V(e,pe.ajaxSettings),t):V(pe.ajaxSettings,e)},ajaxPrefilter:X(Kt),ajaxTransport:X(Qt),ajax:function(t,n){function r(t,n,r,i){var o,f,v,x,w,C=n;2!==b&&(b=2,u&&e.clearTimeout(u),c=void 0,s=i||"",T.readyState=t>0?4:0,o=t>=200&&t<300||304===t,r&&(x=Y(d,T,r)),x=J(d,x,T,o),o?(d.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(pe.lastModified[a]=w),w=T.getResponseHeader("etag"),w&&(pe.etag[a]=w)),204===t||"HEAD"===d.type?C="nocontent":304===t?C="notmodified":(C=x.state,f=x.data,v=x.error,o=!v)):(v=C,!t&&C||(C="error",t<0&&(t=0))),T.status=t,T.statusText=(n||C)+"",o?g.resolveWith(p,[f,C,T]):g.rejectWith(p,[T,C,v]),T.statusCode(y),y=void 0,l&&h.trigger(o?"ajaxSuccess":"ajaxError",[T,d,o?f:v]),m.fireWith(p,[T,C]),l&&(h.trigger("ajaxComplete",[T,d]),--pe.active||pe.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,d=pe.ajaxSetup({},n),p=d.context||d,h=d.context&&(p.nodeType||p.jquery)?pe(p):pe.event,g=pe.Deferred(),m=pe.Callbacks("once memory"),y=d.statusCode||{},v={},x={},b=0,w="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!f)for(f={};t=Ut.exec(s);)f[t[1].toLowerCase()]=t[2];t=f[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=x[n]=x[n]||e,v[e]=t),this},overrideMimeType:function(e){return b||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(b<2)for(t in e)y[t]=[y[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||w;return c&&c.abort(t),r(0,t),this}};if(g.promise(T).complete=m.add,T.success=T.done,T.error=T.fail,d.url=((t||d.url||en)+"").replace(zt,"").replace(Jt,tn[1]+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=pe.trim(d.dataType||"*").toLowerCase().match(De)||[""],null==d.crossDomain&&(i=Gt.exec(d.url.toLowerCase()),d.crossDomain=!(!i||i[1]===tn[1]&&i[2]===tn[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(tn[3]||("http:"===tn[1]?"80":"443")))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=pe.param(d.data,d.traditional)),U(Kt,d,n,T),2===b)return T;l=pe.event&&d.global,l&&0===pe.active++&&pe.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Yt.test(d.type),a=d.url,d.hasContent||(d.data&&(a=d.url+=(It.test(a)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=Xt.test(a)?a.replace(Xt,"$1_="+Wt++):a+(It.test(a)?"&":"?")+"_="+Wt++)),d.ifModified&&(pe.lastModified[a]&&T.setRequestHeader("If-Modified-Since",pe.lastModified[a]),pe.etag[a]&&T.setRequestHeader("If-None-Match",pe.etag[a])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&T.setRequestHeader("Content-Type",d.contentType),T.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Zt+"; q=0.01":""):d.accepts["*"]);for(o in d.headers)T.setRequestHeader(o,d.headers[o]);if(d.beforeSend&&(d.beforeSend.call(p,T,d)===!1||2===b))return T.abort();w="abort";for(o in{success:1,error:1,complete:1})T[o](d[o]);if(c=U(Qt,d,n,T)){if(T.readyState=1,l&&h.trigger("ajaxSend",[T,d]),2===b)return T;d.async&&d.timeout>0&&(u=e.setTimeout(function(){T.abort("timeout")},d.timeout));try{b=1,c.send(v,r)}catch(C){if(!(b<2))throw C;r(-1,C)}}else r(-1,"No Transport");return T},getJSON:function(e,t,n){return pe.get(e,t,n,"json")},getScript:function(e,t){return pe.get(e,void 0,t,"script")}}),pe.each(["get","post"],function(e,t){pe[t]=function(e,n,r,i){return pe.isFunction(n)&&(i=i||r,r=n,n=void 0),pe.ajax(pe.extend({url:e,type:t,dataType:i,data:n,success:r},pe.isPlainObject(e)&&e))}}),pe._evalUrl=function(e){return pe.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},pe.fn.extend({wrapAll:function(e){if(pe.isFunction(e))return this.each(function(t){pe(this).wrapAll(e.call(this,t))});if(this[0]){var t=pe(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return pe.isFunction(e)?this.each(function(t){pe(this).wrapInner(e.call(this,t))}):this.each(function(){var t=pe(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=pe.isFunction(e);return this.each(function(n){pe(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){pe.nodeName(this,"body")||pe(this).replaceWith(this.childNodes)}).end()}}),pe.expr.filters.hidden=function(e){return fe.reliableHiddenOffsets()?e.offsetWidth<=0&&e.offsetHeight<=0&&!e.getClientRects().length:K(e)},pe.expr.filters.visible=function(e){return!pe.expr.filters.hidden(e)};var nn=/%20/g,rn=/\[\]$/,on=/\r?\n/g,an=/^(?:submit|button|image|reset|file)$/i,sn=/^(?:input|select|textarea|keygen)/i;pe.param=function(e,t){var n,r=[],i=function(e,t){t=pe.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=pe.ajaxSettings&&pe.ajaxSettings.traditional),pe.isArray(e)||e.jquery&&!pe.isPlainObject(e))pe.each(e,function(){i(this.name,this.value)});else for(n in e)Q(n,e[n],t,i);return r.join("&").replace(nn,"+")},pe.fn.extend({serialize:function(){return pe.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=pe.prop(this,"elements");return e?pe.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!pe(this).is(":disabled")&&sn.test(this.nodeName)&&!an.test(e)&&(this.checked||!Be.test(e))}).map(function(e,t){var n=pe(this).val();return null==n?null:pe.isArray(n)?pe.map(n,function(e){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),pe.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return this.isLocal?ee():re.documentMode>8?Z():/^(get|post|head|put|delete|options)$/i.test(this.type)&&Z()||ee()}:Z;var un=0,ln={},cn=pe.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var e in ln)ln[e](void 0,!0)}),fe.cors=!!cn&&"withCredentials"in cn,cn=fe.ajax=!!cn,cn&&pe.ajaxTransport(function(t){if(!t.crossDomain||fe.cors){var n;return{send:function(r,i){var o,a=t.xhr(),s=++un;if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)a[o]=t.xhrFields[o];t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(o in r)void 0!==r[o]&&a.setRequestHeader(o,r[o]+"");a.send(t.hasContent&&t.data||null),n=function(e,r){var o,u,l;if(n&&(r||4===a.readyState))if(delete ln[s],n=void 0,a.onreadystatechange=pe.noop,r)4!==a.readyState&&a.abort();else{l={},o=a.status,"string"==typeof a.responseText&&(l.text=a.responseText);try{u=a.statusText}catch(c){u=""}o||!t.isLocal||t.crossDomain?1223===o&&(o=204):o=l.text?200:404}l&&i(o,u,l,a.getAllResponseHeaders())},t.async?4===a.readyState?e.setTimeout(n):a.onreadystatechange=ln[s]=n:n()},abort:function(){n&&n(void 0,!0)}}}}),pe.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return pe.globalEval(e),e}}}),pe.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),pe.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=re.head||pe("head")[0]||re.documentElement;return{send:function(r,i){t=re.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||i(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var fn=[],dn=/(=)\?(?=&|$)|\?\?/;pe.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=fn.pop()||pe.expando+"_"+Wt++;return this[e]=!0,e}}),pe.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=t.jsonp!==!1&&(dn.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&dn.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=pe.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(dn,"$1"+i):t.jsonp!==!1&&(t.url+=(It.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||pe.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?pe(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,fn.push(i)),a&&pe.isFunction(o)&&o(a[0]),a=o=void 0}),"script"}),pe.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||re;var r=Te.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=y([e],t,i),i&&i.length&&pe(i).remove(),pe.merge([],r.childNodes))};var pn=pe.fn.load;return pe.fn.load=function(e,t,n){if("string"!=typeof e&&pn)return pn.apply(this,arguments);var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=pe.trim(e.slice(s,e.length)),e=e.slice(0,s)),pe.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&pe.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?pe("
        ").append(pe.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},pe.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){pe.fn[t]=function(e){return this.on(t,e)}}),pe.expr.filters.animated=function(e){return pe.grep(pe.timers,function(t){return e===t.elem}).length},pe.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=pe.css(e,"position"),f=pe(e),d={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=pe.css(e,"top"),u=pe.css(e,"left"),l=("absolute"===c||"fixed"===c)&&pe.inArray("auto",[o,u])>-1,l?(r=f.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),pe.isFunction(t)&&(t=t.call(e,n,pe.extend({},s))),null!=t.top&&(d.top=t.top-s.top+a),null!=t.left&&(d.left=t.left-s.left+i),"using"in t?t.using.call(e,d):f.css(d)}},pe.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){pe.offset.setOffset(this,e,t)});var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(o)return t=o.documentElement,pe.contains(t,i)?("undefined"!=typeof i.getBoundingClientRect&&(r=i.getBoundingClientRect()),n=te(o),{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):r},position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===pe.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),pe.nodeName(e[0],"html")||(n=e.offset()),n.top+=pe.css(e[0],"borderTopWidth",!0),n.left+=pe.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-pe.css(r,"marginTop",!0),left:t.left-n.left-pe.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){ +for(var e=this.offsetParent;e&&!pe.nodeName(e,"html")&&"static"===pe.css(e,"position");)e=e.offsetParent;return e||pt})}}),pe.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n=/Y/.test(t);pe.fn[e]=function(r){return Pe(this,function(e,r,i){var o=te(e);return void 0===i?o?t in o?o[t]:o.document.documentElement[r]:e[r]:void(o?o.scrollTo(n?pe(o).scrollLeft():i,n?i:pe(o).scrollTop()):e[r]=i)},e,r,arguments.length,null)}}),pe.each(["top","left"],function(e,t){pe.cssHooks[t]=L(fe.pixelPosition,function(e,n){if(n)return n=gt(e,t),ft.test(n)?pe(e).position()[t]+"px":n})}),pe.each({Height:"height",Width:"width"},function(e,t){pe.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){pe.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),a=n||(r===!0||i===!0?"margin":"border");return Pe(this,function(t,n,r){var i;return pe.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):void 0===r?pe.css(t,n,a):pe.style(t,n,r,a)},t,o?r:void 0,o,null)}})}),pe.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),pe.fn.size=function(){return this.length},pe.fn.andSelf=pe.fn.addBack,layui.define(function(e){layui.$=pe,e("jquery",pe)}),pe});!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
        '+(f?r.title[0]:r.title)+"
        ":"";return r.zIndex=s,t([r.shade?'
        ':"",'
        '+(e&&2!=r.type?"":u)+'
        '+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
        '+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
        '+e+"
        "}():"")+(r.resize?'':"")+"
        "],u,i('
        ')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"","auto"];t.content='';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(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=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(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"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
          '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
        • '+(t[0].content||"no content")+"
        • ";i'+(t[i].content||"no content")+"";return a}()+"
        ",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||
        '+(u.length>1?'':"")+'
        '+(u[d].alt||"")+""+s.imgIndex+"/"+u.length+"
        ",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
        是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window);layui.define("jquery",function(t){"use strict";var a=layui.$,i=(layui.hint(),layui.device()),e="element",l="layui-this",n="layui-show",s=function(){this.config={}};s.prototype.set=function(t){var i=this;return a.extend(!0,i.config,t),i},s.prototype.on=function(t,a){return layui.onevent.call(this,e,t,a)},s.prototype.tabAdd=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.children(".layui-tab-bar"),o=l.children(".layui-tab-content"),r='
      • "+(i.title||"unnaming")+"
      • ";return s[0]?s.before(r):n.append(r),o.append('
        '+(i.content||"")+"
        "),f.hideTabMore(!0),f.tabAuto(),this},s.prototype.tabDelete=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabDelete(null,s),this},s.prototype.tabChange=function(t,i){var e=".layui-tab-title",l=a(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+i+'"]');return f.tabClick.call(s[0],null,null,s),this},s.prototype.tab=function(t){t=t||{},b.on("click",t.headerElem,function(i){var e=a(this).index();f.tabClick.call(this,i,e,null,t)})},s.prototype.progress=function(t,i){var e="layui-progress",l=a("."+e+"[lay-filter="+t+"]"),n=l.find("."+e+"-bar"),s=n.find("."+e+"-text");return n.css("width",i),s.text(i),this};var o=".layui-nav",r="layui-nav-item",c="layui-nav-bar",u="layui-nav-tree",d="layui-nav-child",y="layui-nav-more",h="layui-anim layui-anim-upbit",f={tabClick:function(t,i,s,o){o=o||{};var r=s||a(this),i=i||r.parent().children("li").index(r),c=o.headerElem?r.parent():r.parents(".layui-tab").eq(0),u=o.bodyElem?a(o.bodyElem):c.children(".layui-tab-content").children(".layui-tab-item"),d=r.find("a"),y=c.attr("lay-filter");"javascript:;"!==d.attr("href")&&"_blank"===d.attr("target")||(r.addClass(l).siblings().removeClass(l),u.eq(i).addClass(n).siblings().removeClass(n)),layui.event.call(this,e,"tab("+y+")",{elem:c,index:i})},tabDelete:function(t,i){var n=i||a(this).parent(),s=n.index(),o=n.parents(".layui-tab").eq(0),r=o.children(".layui-tab-content").children(".layui-tab-item"),c=o.attr("lay-filter");n.hasClass(l)&&(n.next()[0]?f.tabClick.call(n.next()[0],null,s+1):n.prev()[0]&&f.tabClick.call(n.prev()[0],null,s-1)),n.remove(),r.eq(s).remove(),setTimeout(function(){f.tabAuto()},50),layui.event.call(this,e,"tabDelete("+c+")",{elem:o,index:s})},tabAuto:function(){var t="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",n=this;a(".layui-tab").each(function(){var s=a(this),o=s.children(".layui-tab-title"),r=(s.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),c=a('');if(n===window&&8!=i.ie&&f.hideTabMore(!0),s.attr("lay-allowClose")&&o.find("li").each(function(){var t=a(this);if(!t.find("."+l)[0]){var i=a('');i.on("click",f.tabDelete),t.append(i)}}),"string"!=typeof s.attr("lay-unauto"))if(o.prop("scrollWidth")>o.outerWidth()+1){if(o.find("."+e)[0])return;o.append(c),s.attr("overflow",""),c.on("click",function(a){o[this.title?"removeClass":"addClass"](t),this.title=this.title?"":"收缩"})}else o.find("."+e).remove(),s.removeAttr("overflow")})},hideTabMore:function(t){var i=a(".layui-tab-title");t!==!0&&"tabmore"===a(t.target).attr("lay-stope")||(i.removeClass("layui-tab-more"),i.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=a(this),i=t.parents(o),n=i.attr("lay-filter"),s=t.parent(),c=t.siblings("."+d),y="string"==typeof s.attr("lay-unselect");"javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||y||c[0]||(i.find("."+l).removeClass(l),s.addClass(l)),i.hasClass(u)&&(c.removeClass(h),c[0]&&(s["none"===c.css("display")?"addClass":"removeClass"](r+"ed"),"all"===i.attr("lay-shrink")&&s.siblings().removeClass(r+"ed"))),layui.event.call(this,e,"nav("+n+")",t)},collapse:function(){var t=a(this),i=t.find(".layui-colla-icon"),l=t.siblings(".layui-colla-content"),s=t.parents(".layui-collapse").eq(0),o=s.attr("lay-filter"),r="none"===l.css("display");if("string"==typeof s.attr("lay-accordion")){var c=s.children(".layui-colla-item").children("."+n);c.siblings(".layui-colla-title").children(".layui-colla-icon").html(""),c.removeClass(n)}l[r?"addClass":"removeClass"](n),i.html(r?"":""),layui.event.call(this,e,"collapse("+o+")",{title:t,content:l,show:r})}};s.prototype.init=function(t,e){var l=function(){return e?'[lay-filter="'+e+'"]':""}(),s={tab:function(){f.tabAuto.call({})},nav:function(){var t=200,e={},s={},p={},b=function(l,o,r){var c=a(this),f=c.find("."+d);o.hasClass(u)?l.css({top:c.position().top,height:c.children("a").outerHeight(),opacity:1}):(f.addClass(h),l.css({left:c.position().left+parseFloat(c.css("marginLeft")),top:c.position().top+c.height()-l.height()}),e[r]=setTimeout(function(){l.css({width:c.width(),opacity:1})},i.ie&&i.ie<10?0:t),clearTimeout(p[r]),"block"===f.css("display")&&clearTimeout(s[r]),s[r]=setTimeout(function(){f.addClass(n),c.find("."+y).addClass(y+"d")},300))};a(o+l).each(function(i){var l=a(this),o=a(''),h=l.find("."+r);l.find("."+c)[0]||(l.append(o),h.on("mouseenter",function(){b.call(this,o,l,i)}).on("mouseleave",function(){l.hasClass(u)||(clearTimeout(s[i]),s[i]=setTimeout(function(){l.find("."+d).removeClass(n),l.find("."+y).removeClass(y+"d")},300))}),l.on("mouseleave",function(){clearTimeout(e[i]),p[i]=setTimeout(function(){l.hasClass(u)?o.css({height:0,top:o.position().top+o.height()/2,opacity:0}):o.css({width:0,left:o.position().left+o.width()/2,opacity:0})},t)})),h.find("a").each(function(){var t=a(this),i=(t.parent(),t.siblings("."+d));i[0]&&!t.children("."+y)[0]&&t.append(''),t.off("click",f.clickThis).on("click",f.clickThis)})})},breadcrumb:function(){var t=".layui-breadcrumb";a(t+l).each(function(){var t=a(this),i="lay-separator",e=t.attr(i)||"/",l=t.find("a");l.next("span["+i+"]")[0]||(l.each(function(t){t!==l.length-1&&a(this).after(""+e+"")}),t.css("visibility","visible"))})},progress:function(){var t="layui-progress";a("."+t+l).each(function(){var i=a(this),e=i.find(".layui-progress-bar"),l=e.attr("lay-percent");e.css("width",function(){return/^.+\/.+$/.test(l)?100*new Function("return "+l)()+"%":l}()),i.attr("lay-showPercent")&&setTimeout(function(){e.html(''+l+"")},350)})},collapse:function(){var t="layui-collapse";a("."+t+l).each(function(){var t=a(this).find(".layui-colla-item");t.each(function(){var t=a(this),i=t.find(".layui-colla-title"),e=t.find(".layui-colla-content"),l="none"===e.css("display");i.find(".layui-colla-icon").remove(),i.append(''+(l?"":"")+""),i.off("click",f.collapse).on("click",f.collapse)})})}};return s[t]?s[t]():layui.each(s,function(t,a){a()})},s.prototype.render=s.prototype.init;var p=new s,b=a(document);p.render();var v=".layui-tab-title li";b.on("click",v,f.tabClick),b.on("click",f.hideTabMore),a(window).on("resize",f.tabAuto),t(e,p)});layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,n=layui.hint(),o=layui.device(),a={config:{},set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,r,e,t)}},l=function(){var e=this;return{upload:function(t){e.upload.call(e,t)},reload:function(t){e.reload.call(e,t)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var i=this;i.config=t.extend({},i.config,a.config,e),i.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",acceptMime:"",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var i=this,e=i.config;e.elem=t(e.elem),e.bindAction=t(e.bindAction),i.file(),i.events()},p.prototype.file=function(){var e=this,i=e.config,n=e.elemFile=t(['"].join("")),a=i.elem.next();(a.hasClass(u)||a.hasClass(c))&&a.remove(),o.ie&&o.ie<10&&i.elem.wrap('
        '),e.isFile()?(e.elemFile=i.elem,i.field=i.elem[0].name):i.elem.after(n),o.ie&&o.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,i=e.config,n=t(''),o=t(['
        ',"
        "].join(""));t("#"+f)[0]||t("body").append(n),i.elem.next().hasClass(c)||(e.elemFile.wrap(o),i.elem.next("."+c).append(function(){var e=[];return layui.each(i.data,function(t,i){i="function"==typeof i?i():i,e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return i.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var t=this;window.FileReader&&layui.each(t.chooseFiles,function(t,i){var n=new FileReader;n.readAsDataURL(i),n.onload=function(){e&&e(t,i,this.result)}})},p.prototype.upload=function(e,i){var n,a=this,l=a.config,r=a.elemFile[0],u=function(){var i=0,n=0,o=e||a.files||a.chooseFiles||r.files,u=function(){l.multiple&&i+n===a.fileLength&&"function"==typeof l.allDone&&l.allDone({total:a.fileLength,successful:i,aborted:n})};layui.each(o,function(e,o){var r=new FormData;r.append(l.field,o),layui.each(l.data,function(e,t){t="function"==typeof t?t():t,r.append(e,t)}),t.ajax({url:l.url,type:"post",data:r,contentType:!1,processData:!1,dataType:"json",headers:l.headers||{},success:function(t){i++,d(e,t),u()},error:function(){n++,a.msg("请求上传接口出现异常"),m(e),u()},xhr:function(){var e=new XMLHttpRequest;return e.upload.addEventListener("progress",function(e){if(e.lengthComputable){var t=Math.floor(e.loaded/e.total*100);"function"==typeof l.progress&&l.progress(t,e)}}),e}})})},c=function(){var e=t("#"+f);a.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var t,i=e.contents().find("body");try{t=i.text()}catch(n){a.msg("获取上传后的响应信息出现异常"),clearInterval(p.timer),m()}t&&(clearInterval(p.timer),i.html(""),d(0,t))},30)},d=function(e,t){if(a.elemFile.next("."+s).remove(),r.value="","object"!=typeof t)try{t=JSON.parse(t)}catch(i){return t={},a.msg("请对上传接口返回有效JSON")}"function"==typeof l.done&&l.done(t,e||0,function(e){a.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){a.upload(e)})},h=l.exts,v=function(){var t=[];return layui.each(e||a.chooseFiles,function(e,i){t.push(i.name)}),t}(),g={preview:function(e){a.preview(e)},upload:function(e,t){var i={};i[e]=t,a.upload(i)},pushFile:function(){return a.files=a.files||{},layui.each(a.chooseFiles,function(e,t){a.files[e]=t}),a.files},resetFile:function(e,t,i){var n=new File([t],i);a.files=a.files||{},a.files[e]=n}},y=function(){if("choose"!==i&&!l.auto||(l.choose&&l.choose(g),"choose"!==i))return l.before&&l.before(g),o.ie?o.ie>9?u():c():void u()};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return a.msg("选择的文件中包含不支持的格式"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return a.msg("选择的视频中包含不支持的格式"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return a.msg("选择的音频中包含不支持的格式"),r.value="";break;default:if(layui.each(v,function(e,t){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(t))||(n=!0)}),n)return a.msg("选择的图片中包含不支持的格式"),r.value=""}if(a.fileLength=function(){var t=0,i=e||a.files||a.chooseFiles||r.files;return layui.each(i,function(){t++}),t}(),l.number&&a.fileLength>l.number)return a.msg("同时最多只能上传的数量为:"+l.number);if(l.size>0&&!(o.ie&&o.ie<10)){var F;if(layui.each(a.chooseFiles,function(e,t){if(t.size>1024*l.size){var i=l.size/1024;i=i>=1?i.toFixed(2)+"MB":l.size+"KB",r.value="",F=i}}),F)return a.msg("文件不能超过"+F)}y()}},p.prototype.reload=function(e){e=e||{},delete e.elem,delete e.bindAction;var i=this,e=i.config=t.extend({},i.config,a.config,e),n=e.elem.next();n.attr({name:e.name,accept:e.acceptMime,multiple:e.multiple})},p.prototype.events=function(){var e=this,i=e.config,a=function(t){e.chooseFiles={},layui.each(t,function(t,i){var n=(new Date).getTime();e.chooseFiles[n+"-"+t]=i})},l=function(t,n){var o=e.elemFile,a=t.length>1?t.length+"个文件":(t[0]||{}).name||o[0].value.match(/[^\/\\]+\..+/g)||[]||"";o.next().hasClass(s)&&o.next().remove(),e.upload(null,"choose"),e.isFile()||i.choose||o.after(''+a+"")};i.elem.off("upload.start").on("upload.start",function(){var o=t(this),a=o.attr("lay-data");if(a)try{a=new Function("return "+a)(),e.config=t.extend({},i,a)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+a)}e.config.item=o,e.elemFile[0].click()}),o.ie&&o.ie<10||i.elem.off("upload.over").on("upload.over",function(){var e=t(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=t(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,o){var r=t(this),u=o.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),a(u),i.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var t=this.files||[];a(t),i.auto?e.upload():l(t)}),i.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),i.elem.data("haveEvents")||(e.elemFile.on("change",function(){t(this).trigger("upload.change")}),i.elem.on("click",function(){e.isFile()||t(this).trigger("upload.start")}),i.drag&&i.elem.on("dragover",function(e){e.preventDefault(),t(this).trigger("upload.over")}).on("dragleave",function(e){t(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),t(this).trigger("upload.drop",e)}),i.bindAction.on("click",function(){t(this).trigger("upload.action")}),i.elem.data("haveEvents",!0))},a.render=function(e){var t=new p(e);return l.call(t)},e(r,a)});layui.define("jquery",function(e){"use strict";var i=layui.jquery,t={config:{},index:layui.slider?layui.slider.index+1e4:0,set:function(e){var t=this;return t.config=i.extend({},t.config,e),t},on:function(e,i){return layui.onevent.call(this,n,e,i)}},a=function(){var e=this,i=e.config;return{setValue:function(i,t){return e.slide("set",i,t||0)},config:i}},n="slider",l="layui-disabled",s="layui-slider",r="layui-slider-bar",o="layui-slider-wrap",u="layui-slider-wrap-btn",d="layui-slider-tips",v="layui-slider-input",c="layui-slider-input-txt",m="layui-slider-input-btn",p="layui-slider-hover",f=function(e){var a=this;a.index=++t.index,a.config=i.extend({},a.config,t.config,e),a.render()};f.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:"#009688"},f.prototype.render=function(){var e=this,t=e.config;if(t.step<1&&(t.step=1),t.maxt.min?a:t.min,t.value[1]=n>t.min?n:t.min,t.value[0]=t.value[0]>t.max?t.max:t.value[0],t.value[1]=t.value[1]>t.max?t.max:t.value[1];var r=Math.floor((t.value[0]-t.min)/(t.max-t.min)*100),v=Math.floor((t.value[1]-t.min)/(t.max-t.min)*100),m=v-r+"%";r+="%",v+="%"}else{"object"==typeof t.value&&(t.value=Math.min.apply(null,t.value)),t.valuet.max&&(t.value=t.max);var m=Math.floor((t.value-t.min)/(t.max-t.min)*100)+"%"}var p=t.disabled?"#c2c2c2":t.theme,f='
        '+(t.tips?'
        ':"")+'
        '+(t.range?'
        ':"")+"
        ",h=i(t.elem),y=h.next("."+s);if(y[0]&&y.remove(),e.elemTemp=i(f),t.range?(e.elemTemp.find("."+o).eq(0).data("value",t.value[0]),e.elemTemp.find("."+o).eq(1).data("value",t.value[1])):e.elemTemp.find("."+o).data("value",t.value),h.html(e.elemTemp),"vertical"===t.type&&e.elemTemp.height(t.height+"px"),t.showstep){for(var g=(t.max-t.min)/t.step,b="",x=1;x')}e.elemTemp.append(b)}if(t.input&&!t.range){var w=i('
        ');h.css("position","relative"),h.append(w),h.find("."+c).children("input").val(t.value),"vertical"===t.type?w.css({left:0,top:-48}):e.elemTemp.css("margin-right",w.outerWidth()+15)}t.disabled?(e.elemTemp.addClass(l),e.elemTemp.find("."+u).addClass(l)):e.slide(),e.elemTemp.find("."+u).on("mouseover",function(){var a="vertical"===t.type?t.height:e.elemTemp[0].offsetWidth,n=e.elemTemp.find("."+o),l="vertical"===t.type?a-i(this).parent()[0].offsetTop-n.height():i(this).parent()[0].offsetLeft,s=l/a*100,r=i(this).parent().data("value"),u=t.setTips?t.setTips(r):r;e.elemTemp.find("."+d).html(u),"vertical"===t.type?e.elemTemp.find("."+d).css({bottom:s+"%","margin-bottom":"20px",display:"inline-block"}):e.elemTemp.find("."+d).css({left:s+"%",display:"inline-block"})}).on("mouseout",function(){e.elemTemp.find("."+d).css("display","none")})},f.prototype.slide=function(e,t,a){var n=this,l=n.config,s=n.elemTemp,f=function(){return"vertical"===l.type?l.height:s[0].offsetWidth},h=s.find("."+o),y=s.next("."+v),g=y.children("."+c).children("input").val(),b=100/((l.max-l.min)/Math.ceil(l.step)),x=function(e,i){e=Math.ceil(e)*b>100?Math.ceil(e)*b:Math.round(e)*b,e=e>100?100:e,h.eq(i).css("vertical"===l.type?"bottom":"left",e+"%");var t=T(h[0].offsetLeft),a=l.range?T(h[1].offsetLeft):0;"vertical"===l.type?(s.find("."+d).css({bottom:e+"%","margin-bottom":"20px"}),t=T(f()-h[0].offsetTop-h.height()),a=l.range?T(f()-h[1].offsetTop-h.height()):0):s.find("."+d).css("left",e+"%"),t=t>100?100:t,a=a>100?100:a;var n=Math.min(t,a),o=Math.abs(t-a);"vertical"===l.type?s.find("."+r).css({height:o+"%",bottom:n+"%"}):s.find("."+r).css({width:o+"%",left:n+"%"});var u=l.min+Math.round((l.max-l.min)*e/100);if(g=u,y.children("."+c).children("input").val(g),h.eq(i).data("value",u),u=l.setTips?l.setTips(u):u,s.find("."+d).html(u),l.range){var v=[h.eq(0).data("value"),h.eq(1).data("value")];v[0]>v[1]&&v.reverse()}l.change&&l.change(l.range?v:u)},T=function(e){var i=e/f()*100/b,t=Math.round(i)*b;return e==f()&&(t=Math.ceil(i)*b),t},w=i(['
        f()&&(r=f());var o=r/f()*100/b;x(o,e),t.addClass(p),s.find("."+d).show(),i.preventDefault()},o=function(){t.removeClass(p),s.find("."+d).hide()};M(r,o)})}),s.on("click",function(e){var t=i("."+u);if(!t.is(event.target)&&0===t.has(event.target).length&&t.length){var a,n="vertical"===l.type?f()-e.clientY+i(this).offset().top:e.clientX-i(this).offset().left;n<0&&(n=0),n>f()&&(n=f());var s=n/f()*100/b;a=l.range?"vertical"===l.type?Math.abs(n-parseInt(i(h[0]).css("bottom")))>Math.abs(n-parseInt(i(h[1]).css("bottom")))?1:0:Math.abs(n-h[0].offsetLeft)>Math.abs(n-h[1].offsetLeft)?1:0:0,x(s,a),e.preventDefault()}}),y.hover(function(){var e=i(this);e.children("."+m).fadeIn("fast")},function(){var e=i(this);e.children("."+m).fadeOut("fast")}),y.children("."+m).children("i").each(function(e){i(this).on("click",function(){g=1==e?g-l.stepl.max?l.max:Number(g)+l.step;var i=(g-l.min)/(l.max-l.min)*100/b;x(i,0)})});var q=function(){var e=this.value;e=isNaN(e)?0:e,e=el.max?l.max:e,this.value=e;var i=(e-l.min)/(l.max-l.min)*100/b;x(i,0)};y.children("."+c).children("input").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),q.call(this))}).on("change",q)},f.prototype.events=function(){var e=this;e.config},t.render=function(e){var i=new f(e);return a.call(i)},e(n,t)});layui.define("jquery",function(e){"use strict";var i=layui.jquery,o={config:{},index:layui.colorpicker?layui.colorpicker.index+1e4:0,set:function(e){var o=this;return o.config=i.extend({},o.config,e),o},on:function(e,i){return layui.onevent.call(this,"colorpicker",e,i)}},r=function(){var e=this,i=e.config;return{config:i}},t="colorpicker",n="layui-show",l="layui-colorpicker",c=".layui-colorpicker-main",a="layui-icon-down",s="layui-icon-close",f="layui-colorpicker-trigger-span",d="layui-colorpicker-trigger-i",u="layui-colorpicker-side",p="layui-colorpicker-side-slider",g="layui-colorpicker-basis",v="layui-colorpicker-alpha-bgcolor",h="layui-colorpicker-alpha-slider",m="layui-colorpicker-basis-cursor",b="layui-colorpicker-main-input",k=function(e){var i={h:0,s:0,b:0},o=Math.min(e.r,e.g,e.b),r=Math.max(e.r,e.g,e.b),t=r-o;return i.b=r,i.s=0!=r?255*t/r:0,0!=i.s?e.r==r?i.h=(e.g-e.b)/t:e.g==r?i.h=2+(e.b-e.r)/t:i.h=4+(e.r-e.g)/t:i.h=-1,r==o&&(i.h=0),i.h*=60,i.h<0&&(i.h+=360),i.s*=100/255,i.b*=100/255,i},y=function(e){var e=e.indexOf("#")>-1?e.substring(1):e;if(3==e.length){var i=e.split("");e=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]}e=parseInt(e,16);var o={r:e>>16,g:(65280&e)>>8,b:255&e};return k(o)},x=function(e){var i={},o=e.h,r=255*e.s/100,t=255*e.b/100;if(0==r)i.r=i.g=i.b=t;else{var n=t,l=(255-r)*t/255,c=(n-l)*(o%60)/60;360==o&&(o=0),o<60?(i.r=n,i.b=l,i.g=l+c):o<120?(i.g=n,i.b=l,i.r=n-c):o<180?(i.g=n,i.r=l,i.b=l+c):o<240?(i.b=n,i.r=l,i.g=n-c):o<300?(i.b=n,i.g=l,i.r=l+c):o<360?(i.r=n,i.g=l,i.b=n-c):(i.r=0,i.g=0,i.b=0)}return{r:Math.round(i.r),g:Math.round(i.g),b:Math.round(i.b)}},C=function(e){var o=x(e),r=[o.r.toString(16),o.g.toString(16),o.b.toString(16)];return i.each(r,function(e,i){1==i.length&&(r[e]="0"+i)}),r.join("")},P=function(e){var i=/[0-9]{1,3}/g,o=e.match(i)||[];return{r:o[0],g:o[1],b:o[2]}},B=i(window),w=i(document),D=function(e){var r=this;r.index=++o.index,r.config=i.extend({},r.config,o.config,e),r.render()};D.prototype.config={color:"",size:null,alpha:!1,format:"hex",predefine:!1,colors:["#009688","#5FB878","#1E9FFF","#FF5722","#FFB800","#01AAED","#999","#c00","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgb(0, 186, 189)","rgb(255, 120, 0)","rgb(250, 212, 0)","#393D49","rgba(0,0,0,.5)","rgba(255, 69, 0, 0.68)","rgba(144, 240, 144, 0.5)","rgba(31, 147, 255, 0.73)"]},D.prototype.render=function(){var e=this,o=e.config,r=i(['
        ',"",'3&&(o.alpha&&"rgb"==o.format||(e="#"+C(k(P(o.color))))),"background: "+e):e}()+'">','',"","","
        "].join("")),t=i(o.elem);o.size&&r.addClass("layui-colorpicker-"+o.size),t.addClass("layui-inline").html(e.elemColorBox=r),e.color=e.elemColorBox.find("."+f)[0].style.background,e.events()},D.prototype.renderPicker=function(){var e=this,o=e.config,r=e.elemColorBox[0],t=e.elemPicker=i(['
        ','
        ','
        ','
        ','
        ','
        ',"
        ",'
        ','
        ',"
        ","
        ",'
        ','
        ','
        ',"
        ","
        ",function(){if(o.predefine){var e=['
        '];return layui.each(o.colors,function(i,o){e.push(['
        ','
        ',"
        "].join(""))}),e.push("
        "),e.join("")}return""}(),'
        ','
        ','',"
        ",'
        ','','',"","
        "].join(""));e.elemColorBox.find("."+f)[0];i(c)[0]&&i(c).data("index")==e.index?e.removePicker(D.thisElemInd):(e.removePicker(D.thisElemInd),i("body").append(t)),D.thisElemInd=e.index,D.thisColor=r.style.background,e.position(),e.pickerEvents()},D.prototype.removePicker=function(e){var o=this;o.config;return i("#layui-colorpicker"+(e||o.index)).remove(),o},D.prototype.position=function(){var e=this,i=e.config,o=e.bindElem||e.elemColorBox[0],r=e.elemPicker[0],t=o.getBoundingClientRect(),n=r.offsetWidth,l=r.offsetHeight,c=function(e){return e=e?"scrollLeft":"scrollTop",document.body[e]|document.documentElement[e]},a=function(e){return document.documentElement[e?"clientWidth":"clientHeight"]},s=5,f=t.left,d=t.bottom;f-=(n-o.offsetWidth)/2,d+=s,f+n+s>a("width")?f=a("width")-n-s:fa()&&(d=t.top>l?t.top-l:a()-l,d-=2*s),i.position&&(r.style.position=i.position),r.style.left=f+("fixed"===i.position?0:c(1))+"px",r.style.top=d+("fixed"===i.position?0:c())+"px"},D.prototype.val=function(){var e=this,i=(e.config,e.elemColorBox.find("."+f)),o=e.elemPicker.find("."+b),r=i[0],t=r.style.backgroundColor;if(t){var n=k(P(t)),l=i.attr("lay-type");if(e.select(n.h,n.s,n.b),"torgb"===l&&o.find("input").val(t),"rgba"===l){var c=P(t);if(3==(t.match(/[0-9]{1,3}/g)||[]).length)o.find("input").val("rgba("+c.r+", "+c.g+", "+c.b+", 1)"),e.elemPicker.find("."+h).css("left",280);else{o.find("input").val(t);var a=280*t.slice(t.lastIndexOf(",")+1,t.length-1);e.elemPicker.find("."+h).css("left",a)}e.elemPicker.find("."+v)[0].style.background="linear-gradient(to right, rgba("+c.r+", "+c.g+", "+c.b+", 0), rgb("+c.r+", "+c.g+", "+c.b+"))"}}else e.select(0,100,100),o.find("input").val(""),e.elemPicker.find("."+v)[0].style.background="",e.elemPicker.find("."+h).css("left",280)},D.prototype.side=function(){var e=this,o=e.config,r=e.elemColorBox.find("."+f),t=r.attr("lay-type"),n=e.elemPicker.find("."+u),l=e.elemPicker.find("."+p),c=e.elemPicker.find("."+g),y=e.elemPicker.find("."+m),C=e.elemPicker.find("."+v),w=e.elemPicker.find("."+h),D=l[0].offsetTop/180*360,E=100-(y[0].offsetTop+3)/180*100,H=(y[0].offsetLeft+3)/260*100,W=Math.round(w[0].offsetLeft/280*100)/100,j=e.elemColorBox.find("."+d),F=e.elemPicker.find(".layui-colorpicker-pre").children("div"),L=function(i,n,l,c){e.select(i,n,l);var f=x({h:i,s:n,b:l});if(j.addClass(a).removeClass(s),r[0].style.background="rgb("+f.r+", "+f.g+", "+f.b+")","torgb"===t&&e.elemPicker.find("."+b).find("input").val("rgb("+f.r+", "+f.g+", "+f.b+")"),"rgba"===t){var d=0;d=280*c,w.css("left",d),e.elemPicker.find("."+b).find("input").val("rgba("+f.r+", "+f.g+", "+f.b+", "+c+")"),r[0].style.background="rgba("+f.r+", "+f.g+", "+f.b+", "+c+")",C[0].style.background="linear-gradient(to right, rgba("+f.r+", "+f.g+", "+f.b+", 0), rgb("+f.r+", "+f.g+", "+f.b+"))"}o.change&&o.change(e.elemPicker.find("."+b).find("input").val())},M=i(['
        t&&(r=t);var l=r/180*360;D=l,L(l,H,E,W),e.preventDefault()};Y(r),e.preventDefault()}),n.on("click",function(e){var o=e.clientY-i(this).offset().top;o<0&&(o=0),o>this.offsetHeight&&(o=this.offsetHeight);var r=o/180*360;D=r,L(r,H,E,W),e.preventDefault()}),y.on("mousedown",function(e){var i=this.offsetTop,o=this.offsetLeft,r=e.clientY,t=e.clientX,n=function(e){var n=i+(e.clientY-r),l=o+(e.clientX-t),a=c[0].offsetHeight-3,s=c[0].offsetWidth-3;n<-3&&(n=-3),n>a&&(n=a),l<-3&&(l=-3),l>s&&(l=s);var f=(l+3)/260*100,d=100-(n+3)/180*100;E=d,H=f,L(D,f,d,W),e.preventDefault()};layui.stope(e),Y(n),e.preventDefault()}),c.on("mousedown",function(e){var o=e.clientY-i(this).offset().top-3+B.scrollTop(),r=e.clientX-i(this).offset().left-3+B.scrollLeft();o<-3&&(o=-3),o>this.offsetHeight-3&&(o=this.offsetHeight-3),r<-3&&(r=-3),r>this.offsetWidth-3&&(r=this.offsetWidth-3);var t=(r+3)/260*100,n=100-(o+3)/180*100;E=n,H=t,L(D,t,n,W),e.preventDefault(),y.trigger(e,"mousedown")}),w.on("mousedown",function(e){var i=this.offsetLeft,o=e.clientX,r=function(e){var r=i+(e.clientX-o),t=C[0].offsetWidth;r<0&&(r=0),r>t&&(r=t);var n=Math.round(r/280*100)/100;W=n,L(D,H,E,n),e.preventDefault()};Y(r),e.preventDefault()}),C.on("click",function(e){var o=e.clientX-i(this).offset().left;o<0&&(o=0),o>this.offsetWidth&&(o=this.offsetWidth);var r=Math.round(o/280*100)/100;W=r,L(D,H,E,r),e.preventDefault()}),F.each(function(){i(this).on("click",function(){i(this).parent(".layui-colorpicker-pre").addClass("selected").siblings().removeClass("selected");var e,o=this.style.backgroundColor,r=k(P(o)),t=o.slice(o.lastIndexOf(",")+1,o.length-1);D=r.h,H=r.s,E=r.b,3==(o.match(/[0-9]{1,3}/g)||[]).length&&(t=1),W=t,e=280*t,L(r.h,r.s,r.b,t)})})},D.prototype.select=function(e,i,o,r){var t=this,n=(t.config,C({h:e,s:100,b:100})),l=C({h:e,s:i,b:o}),c=e/360*180,a=180-o/100*180-3,s=i/100*260-3;t.elemPicker.find("."+p).css("top",c),t.elemPicker.find("."+g)[0].style.background="#"+n,t.elemPicker.find("."+m).css({top:a,left:s}),"change"!==r&&t.elemPicker.find("."+b).find("input").val("#"+l)},D.prototype.pickerEvents=function(){var e=this,o=e.config,r=e.elemColorBox.find("."+f),t=e.elemPicker.find("."+b+" input"),n={clear:function(i){r[0].style.background="",e.elemColorBox.find("."+d).removeClass(a).addClass(s),e.color="",o.done&&o.done(""),e.removePicker()},confirm:function(i,n){var l=t.val(),c=l,f={};if(l.indexOf(",")>-1){if(f=k(P(l)),e.select(f.h,f.s,f.b),r[0].style.background=c="#"+C(f),(l.match(/[0-9]{1,3}/g)||[]).length>3&&"rgba"===r.attr("lay-type")){var u=280*l.slice(l.lastIndexOf(",")+1,l.length-1);e.elemPicker.find("."+h).css("left",u),r[0].style.background=l,c=l}}else f=y(l),r[0].style.background=c="#"+C(f),e.elemColorBox.find("."+d).removeClass(s).addClass(a);return"change"===n?(e.select(f.h,f.s,f.b,n),void(o.change&&o.change(c))):(e.color=l,o.done&&o.done(l),void e.removePicker())}};e.elemPicker.on("click","*[colorpicker-events]",function(){var e=i(this),o=e.attr("colorpicker-events");n[o]&&n[o].call(this,e)}),t.on("keyup",function(e){var o=i(this);n.confirm.call(this,o,13===e.keyCode?null:"change")})},D.prototype.events=function(){var e=this,o=e.config,r=e.elemColorBox.find("."+f);e.elemColorBox.on("click",function(){e.renderPicker(),i(c)[0]&&(e.val(),e.side())}),o.elem[0]&&!e.elemColorBox[0].eventHandler&&(w.on("click",function(o){if(!i(o.target).hasClass(l)&&!i(o.target).parents("."+l)[0]&&!i(o.target).hasClass(c.replace(/\./g,""))&&!i(o.target).parents(c)[0]&&e.elemPicker){if(e.color){var t=k(P(e.color));e.select(t.h,t.s,t.b)}else e.elemColorBox.find("."+d).removeClass(a).addClass(s);r[0].style.background=e.color||"",e.removePicker()}}),B.on("resize",function(){return!(!e.elemPicker||!i(c)[0])&&void e.position()}),e.elemColorBox[0].eventHandler=!0)},o.render=function(e){var i=new D(e);return r.call(i)},e(t,o)});layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,a=layui.hint(),n=layui.device(),l="form",r=".layui-form",s="layui-this",o="layui-hide",c="layui-disabled",u=function(){this.config={verify:{required:[/[\S]+/,"必填项不能为空"],phone:[/^1\d{10}$/,"请输入正确的手机号"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"邮箱格式不正确"],url:[/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/,"链接格式不正确"],number:function(e){if(!e||isNaN(e))return"只能填写数字"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"日期格式不正确"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"请输入正确的身份证号"]}}};u.prototype.set=function(e){var i=this;return t.extend(!0,i.config,e),i},u.prototype.verify=function(e){var i=this;return t.extend(!0,i.config.verify,e),i},u.prototype.on=function(e,t){return layui.onevent.call(this,l,e,t)},u.prototype.val=function(e,i){var a=this,n=t(r+'[lay-filter="'+e+'"]');return n.each(function(e,a){var n=t(this);layui.each(i,function(e,t){var i,a=n.find('[name="'+e+'"]');a[0]&&(i=a[0].type,"checkbox"===i?a[0].checked=t:"radio"===i?a.each(function(){this.value==t&&(this.checked=!0)}):a.val(t))})}),f.render(null,e),a.getValue(e)},u.prototype.getValue=function(e,i){i=i||t(r+'[lay-filter="'+e+'"]').eq(0);var a={},n={},l=i.find("input,select,textarea");return layui.each(l,function(e,t){if(t.name=(t.name||"").replace(/^\s*|\s*&/,""),t.name){if(/^.*\[\]$/.test(t.name)){var i=t.name.match(/^(.*)\[\]$/g)[0];a[i]=0|a[i],t.name=t.name.replace(/^(.*)\[\]$/,"$1["+a[i]++ +"]")}/^checkbox|radio$/.test(t.type)&&!t.checked||(n[t.name]=t.value)}}),n},u.prototype.render=function(e,i){var n=this,u=t(r+function(){return i?'[lay-filter="'+i+'"]':""}()),d={select:function(){var e,i="请选择",a="layui-form-select",n="layui-select-title",r="layui-select-none",d="",f=u.find("select"),v=function(i,l){t(i.target).parent().hasClass(n)&&!l||(t("."+a).removeClass(a+"ed "+a+"up"),e&&d&&e.val(d)),e=null},y=function(i,u,f){var y,p=t(this),m=i.find("."+n),k=m.find("input"),g=i.find("dl"),x=g.children("dd"),b=this.selectedIndex;if(!u){var C=function(){var e=i.offset().top+i.outerHeight()+5-h.scrollTop(),t=g.outerHeight();b=p[0].selectedIndex,i.addClass(a+"ed"),x.removeClass(o),y=null,x.eq(b).addClass(s).siblings().removeClass(s),e+t>h.height()&&e>=t&&i.addClass(a+"up"),T()},w=function(e){i.removeClass(a+"ed "+a+"up"),k.blur(),y=null,e||$(k.val(),function(e){var i=p[0].selectedIndex;e&&(d=t(p[0].options[i]).html(),0===i&&d===k.attr("placeholder")&&(d=""),k.val(d||""))})},T=function(){var e=g.children("dd."+s);if(e[0]){var t=e.position().top,i=g.height(),a=e.height();t>i&&g.scrollTop(t+g.scrollTop()-i+a-5),t<0&&g.scrollTop(t+g.scrollTop()-5)}};m.on("click",function(e){i.hasClass(a+"ed")?w():(v(e,!0),C()),g.find("."+r).remove()}),m.find(".layui-edge").on("click",function(){k.focus()}),k.on("keyup",function(e){var t=e.keyCode;9===t&&C()}).on("keydown",function(e){var t=e.keyCode;9===t&&w();var i=function(t,a){var n,l;e.preventDefault();var r=function(){var e=g.children("dd."+s);if(g.children("dd."+o)[0]&&"next"===t){var i=g.children("dd:not(."+o+",."+c+")"),n=i.eq(0).index();if(n>=0&&n无匹配项

        '):g.find("."+r).remove()},"keyup"),""===t&&g.find("."+r).remove(),void T())};f&&k.on("keyup",q).on("blur",function(i){var a=p[0].selectedIndex;e=k,d=t(p[0].options[a]).html(),0===a&&d===k.attr("placeholder")&&(d=""),setTimeout(function(){$(k.val(),function(e){d||k.val("")},"blur")},200)}),x.on("click",function(){var e=t(this),a=e.attr("lay-value"),n=p.attr("lay-filter");return!e.hasClass(c)&&(e.hasClass("layui-select-tips")?k.val(""):(k.val(e.text()),e.addClass(s)),e.siblings().removeClass(s),p.val(a).removeClass("layui-form-danger"),layui.event.call(this,l,"select("+n+")",{elem:p[0],value:a,othis:i}),w(!0),!1)}),i.find("dl>dt").on("click",function(e){return!1}),t(document).off("click",v).on("click",v)}};f.each(function(e,l){var r=t(this),o=r.next("."+a),u=this.disabled,d=l.value,f=t(l.options[l.selectedIndex]),v=l.options[0];if("string"==typeof r.attr("lay-ignore"))return r.show();var h="string"==typeof r.attr("lay-search"),p=v?v.value?i:v.innerHTML||i:i,m=t(['
        ','
        ','','
        ','
        ',function(e){var t=[];return layui.each(e,function(e,a){0!==e||a.value?"optgroup"===a.tagName.toLowerCase()?t.push("
        "+a.label+"
        "):t.push('
        '+a.innerHTML+"
        "):t.push('
        '+(a.innerHTML||i)+"
        ")}),0===t.length&&t.push('
        没有选项
        '),t.join("")}(r.find("*"))+"
        ","
        "].join(""));o[0]&&o.remove(),r.after(m),y.call(this,m,u,h)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},i=u.find("input[type=checkbox]"),a=function(e,i){var a=t(this);e.on("click",function(){var t=a.attr("lay-filter"),n=(a.attr("lay-text")||"").split("|");a[0].disabled||(a[0].checked?(a[0].checked=!1,e.removeClass(i[1]).find("em").text(n[1])):(a[0].checked=!0,e.addClass(i[1]).find("em").text(n[0])),layui.event.call(a[0],l,i[2]+"("+t+")",{elem:a[0],value:a[0].value,othis:e}))})};i.each(function(i,n){var l=t(this),r=l.attr("lay-skin"),s=(l.attr("lay-text")||"").split("|"),o=this.disabled;"switch"===r&&(r="_"+r);var u=e[r]||e.checkbox;if("string"==typeof l.attr("lay-ignore"))return l.show();var d=l.next("."+u[0]),f=t(['
        ",function(){var e=n.title.replace(/\s/g,""),t={checkbox:[e?""+n.title+"":"",''].join(""),_switch:""+((n.checked?s[0]:s[1])||"")+""};return t[r]||t.checkbox}(),"
        "].join(""));d[0]&&d.remove(),l.after(f),a.call(this,f,u)})},radio:function(){var e="layui-form-radio",i=["",""],a=u.find("input[type=radio]"),n=function(a){var n=t(this),s="layui-anim-scaleSpring";a.on("click",function(){var o=n[0].name,c=n.parents(r),u=n.attr("lay-filter"),d=c.find("input[name="+o.replace(/(\.|#|\[|\])/g,"\\$1")+"]");n[0].disabled||(layui.each(d,function(){var a=t(this).next("."+e);this.checked=!1,a.removeClass(e+"ed"),a.find(".layui-icon").removeClass(s).html(i[1])}),n[0].checked=!0,a.addClass(e+"ed"),a.find(".layui-icon").addClass(s).html(i[0]),layui.event.call(n[0],l,"radio("+u+")",{elem:n[0],value:n[0].value,othis:a}))})};a.each(function(a,l){var r=t(this),s=r.next("."+e),o=this.disabled;if("string"==typeof r.attr("lay-ignore"))return r.show();s[0]&&s.remove();var u=t(['
        ',''+i[l.checked?0:1]+"","
        "+function(){var e=l.title||"";return"string"==typeof r.next().attr("lay-radio")&&(e=r.next().html(),r.next().remove()),e}()+"
        ","
        "].join(""));r.after(u),n.call(this,u)})}};return e?d[e]?d[e]():a.error("不支持的"+e+"表单渲染"):layui.each(d,function(e,t){t()}),n};var d=function(){var e=null,a=f.config.verify,s="layui-form-danger",o={},c=t(this),u=c.parents(r),d=u.find("*[lay-verify]"),v=c.parents("form")[0],h=c.attr("lay-filter");return layui.each(d,function(l,r){var o=t(this),c=o.attr("lay-verify").split("|"),u=o.attr("lay-verType"),d=o.val();if(o.removeClass(s),layui.each(c,function(t,l){var c,f="",v="function"==typeof a[l];if(a[l]){var c=v?f=a[l](d,r):!a[l][0].test(d);if(f=f||a[l][1],"required"===l&&(f=o.attr("lay-reqText")||f),c)return"tips"===u?i.tips(f,function(){return"string"==typeof o.attr("lay-ignore")||"select"!==r.tagName.toLowerCase()&&!/^checkbox|radio$/.test(r.type)?o:o.next()}(),{tips:1}):"alert"===u?i.alert(f,{title:"提示",shadeClose:!0}):i.msg(f,{icon:5,shift:6}),n.android||n.ios||setTimeout(function(){r.focus()},7),o.addClass(s),e=!0}}),e)return e}),!e&&(o=f.getValue(null,u),layui.event.call(this,l,"submit("+h+")",{elem:this,form:v,field:o}))},f=new u,v=t(document),h=t(window);f.render(),v.on("reset",r,function(){var e=t(this).attr("lay-filter");setTimeout(function(){f.render(null,e)},50)}),v.on("submit",r,d).on("click","*[lay-submit]",d),e(l,f)});layui.define("form",function(e){"use strict";var i=layui.$,a=layui.form,n=layui.layer,t="tree",r={config:{},index:layui[t]?layui[t].index+1e4:0,set:function(e){var a=this;return a.config=i.extend({},a.config,e),a},on:function(e,i){return layui.onevent.call(this,t,e,i)}},l=function(){var e=this,i=e.config,a=i.id||e.index;return l.that[a]=e,l.config[a]=i,{config:i,reload:function(i){e.reload.call(e,i)},getChecked:function(){return e.getChecked.call(e)},setChecked:function(i){return e.setChecked.call(e,i)}}},c="layui-hide",d="layui-disabled",s="layui-tree-set",o="layui-tree-iconClick",h="layui-icon-addition",u="layui-icon-subtraction",p="layui-tree-entry",f="layui-tree-main",y="layui-tree-txt",v="layui-tree-pack",C="layui-tree-spread",k="layui-tree-setLineShort",m="layui-tree-showLine",x="layui-tree-lineExtend",b=function(e){var a=this;a.index=++r.index,a.config=i.extend({},a.config,r.config,e),a.render()};b.prototype.config={data:[],showCheckbox:!1,showLine:!0,accordion:!1,onlyIconControl:!1,isJump:!1,edit:!1,text:{defaultNodeName:"未命名",none:"无数据"}},b.prototype.reload=function(e){var a=this;layui.each(e,function(e,i){i.constructor===Array&&delete a.config[e]}),a.config=i.extend(!0,{},a.config,e),a.render()},b.prototype.render=function(){var e=this,a=e.config;e.checkids=[];var n=i('
        ');e.tree(n);var t=a.elem=i(a.elem);if(t[0]){if(e.key=a.id||e.index,e.elem=n,e.elemNone=i('
        '+a.text.none+"
        "),t.html(e.elem),0==e.elem.find(".layui-tree-set").length)return e.elem.append(e.elemNone);a.showCheckbox&&e.renderForm("checkbox"),e.elem.find(".layui-tree-set").each(function(){var e=i(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(k),e.next()[0]||e.parents(".layui-tree-set").eq(0).next()[0]||e.addClass(k)}),e.events()}},b.prototype.renderForm=function(e){a.render(e,"LAY-tree-"+this.index)},b.prototype.tree=function(e,a){var n=this,t=n.config,r=a||t.data;layui.each(r,function(a,r){var l=r.children&&r.children.length>0,o=i('
        '),h=i(['
        ','
        ','
        ',function(){return t.showLine?l?'':'':''}(),function(){return t.showCheckbox?'':""}(),function(){return t.isJump&&r.href?''+(r.title||r.label||t.text.defaultNodeName)+"":''+(r.title||r.label||t.text.defaultNodeName)+""}(),"
        ",function(){if(!t.edit)return"";var e={add:'',update:'',del:''},i=['
        '];return t.edit===!0&&(t.edit=["update","del"]),"object"==typeof t.edit?(layui.each(t.edit,function(a,n){i.push(e[n]||"")}),i.join("")+"
        "):void 0}(),"
        "].join(""));l&&(h.append(o),n.tree(o,r.children)),e.append(h),h.prev("."+s)[0]&&h.prev().children(".layui-tree-pack").addClass("layui-tree-showLine"),l||h.parent(".layui-tree-pack").addClass("layui-tree-lineExtend"),n.spread(h,r),t.showCheckbox&&(r.checked&&n.checkids.push(r.id),n.checkClick(h,r)),t.edit&&n.operate(h,r)})},b.prototype.spread=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f),c=r.find("."+o),k=r.find("."+y),m=t.onlyIconControl?c:l,x="";m.on("click",function(i){var a=e.children("."+v),n=m.children(".layui-icon")[0]?m.children(".layui-icon"):m.find(".layui-tree-icon").children(".layui-icon");if(a[0]){if(e.hasClass(C))e.removeClass(C),a.slideUp(200),n.removeClass(u).addClass(h);else if(e.addClass(C),a.slideDown(200),n.addClass(u).removeClass(h),t.accordion){var r=e.siblings("."+s);r.removeClass(C),r.children("."+v).slideUp(200),r.find(".layui-tree-icon").children(".layui-icon").removeClass(u).addClass(h)}}else x="normal"}),k.on("click",function(){var n=i(this);n.hasClass(d)||(x=e.hasClass(C)?t.onlyIconControl?"open":"close":t.onlyIconControl?"close":"open",t.click&&t.click({elem:e,state:x,data:a}))})},b.prototype.setCheckbox=function(e,i,a){var n=this,t=(n.config,a.prop("checked"));if(!a.prop("disabled")){if("object"==typeof i.children||e.find("."+v)[0]){var r=e.find("."+v).find('input[same="layuiTreeCheck"]');r.each(function(){this.disabled||(this.checked=t)})}var l=function(e){if(e.parents("."+s)[0]){var i,a=e.parent("."+v),n=a.parent(),r=a.prev().find('input[same="layuiTreeCheck"]');t?r.prop("checked",t):(a.find('input[same="layuiTreeCheck"]').each(function(){this.checked&&(i=!0)}),i||r.prop("checked",!1)),l(n)}};l(e),n.renderForm("checkbox")}},b.prototype.checkClick=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f);l.on("click",'input[same="layuiTreeCheck"]+',function(r){layui.stope(r);var l=i(this).prev(),c=l.prop("checked");l.prop("disabled")||(n.setCheckbox(e,a,l),t.oncheck&&t.oncheck({elem:e,checked:c,data:a}))})},b.prototype.operate=function(e,a){var t=this,r=t.config,l=e.children("."+p),d=l.children("."+f);l.children(".layui-tree-btnGroup").on("click",".layui-icon",function(l){layui.stope(l);var f=i(this).data("type"),b=e.children("."+v),g={data:a,type:f,elem:e};if("add"==f){b[0]||(r.showLine?(d.find("."+o).addClass("layui-tree-icon"),d.find("."+o).children(".layui-icon").addClass(h).removeClass("layui-icon-file")):d.find(".layui-tree-iconArrow").removeClass(c),e.append('
        '));var w=r.operate&&r.operate(g),N={};if(N.title=r.text.defaultNodeName,N.id=w,t.tree(e.children("."+v),[N]),r.showLine)if(b[0])b.hasClass(x)||b.addClass(x),e.find("."+v).each(function(){i(this).children("."+s).last().addClass(k)}),b.children("."+s).last().prev().hasClass(k)?b.children("."+s).last().prev().removeClass(k):b.children("."+s).last().removeClass(k),!e.parent("."+v)[0]&&e.next()[0]&&b.children("."+s).last().removeClass(k);else{var T=e.siblings("."+s),L=1,A=e.parent("."+v);layui.each(T,function(e,a){i(a).children("."+v)[0]||(L=0)}),1==L?(T.children("."+v).addClass(m),T.children("."+v).children("."+s).removeClass(k),e.children("."+v).addClass(m),A.removeClass(x),A.children("."+s).last().children("."+v).children("."+s).last().addClass(k)):e.children("."+v).children("."+s).addClass(k)}if(!r.showCheckbox)return;if(d.find('input[same="layuiTreeCheck"]')[0].checked){var I=e.children("."+v).children("."+s).last();I.find('input[same="layuiTreeCheck"]')[0].checked=!0}t.renderForm("checkbox")}else if("update"==f){var F=d.children("."+y).html();d.children("."+y).html(""),d.append(''),d.children(".layui-tree-editInput").val(F).focus();var j=function(e){var i=e.val().trim();i=i?i:r.text.defaultNodeName,e.remove(),d.children("."+y).html(i),g.data.title=i,r.operate&&r.operate(g)};d.children(".layui-tree-editInput").blur(function(){j(i(this))}),d.children(".layui-tree-editInput").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),j(i(this)))})}else n.confirm('确认删除该节点 "'+(a.title||"")+'" 吗?',function(a){if(r.operate&&r.operate(g),g.status="remove",n.close(a),!e.prev("."+s)[0]&&!e.next("."+s)[0]&&!e.parent("."+v)[0])return e.remove(),void t.elem.append(t.elemNone);if(e.siblings("."+s).children("."+p)[0]){if(r.showCheckbox){var l=function(e){if(e.parents("."+s)[0]){var a=e.siblings("."+s).children("."+p),n=e.parent("."+v).prev(),r=n.find('input[same="layuiTreeCheck"]')[0],c=1,d=0;0==r.checked&&(a.each(function(e,a){var n=i(a).find('input[same="layuiTreeCheck"]')[0];0!=n.checked||n.disabled||(c=0),n.disabled||(d=1)}),1==c&&1==d&&(r.checked=!0,t.renderForm("checkbox"),l(n.parent("."+s))))}};l(e)}if(r.showLine){var d=e.siblings("."+s),h=1,f=e.parent("."+v);layui.each(d,function(e,a){i(a).children("."+v)[0]||(h=0)}),1==h?(b[0]||(f.removeClass(x),d.children("."+v).addClass(m),d.children("."+v).children("."+s).removeClass(k)),e.next()[0]?f.children("."+s).last().children("."+v).children("."+s).last().addClass(k):e.prev().children("."+v).children("."+s).last().addClass(k),e.next()[0]||e.parents("."+s)[1]||e.parents("."+s).eq(0).next()[0]||e.prev("."+s).addClass(k)):!e.next()[0]&&e.hasClass(k)&&e.prev().addClass(k)}}else{var y=e.parent("."+v).prev();if(r.showLine){y.find("."+o).removeClass("layui-tree-icon"),y.find("."+o).children(".layui-icon").removeClass(u).addClass("layui-icon-file");var w=y.parents("."+v).eq(0);w.addClass(x),w.children("."+s).each(function(){i(this).children("."+v).children("."+s).last().addClass(k)})}else y.find(".layui-tree-iconArrow").addClass(c);e.parents("."+s).eq(0).removeClass(C),e.parent("."+v).remove()}e.remove()})})},b.prototype.events=function(){var e=this,a=e.config;e.elem.find(".layui-tree-checkedFirst");e.setChecked(e.checkids),e.elem.find(".layui-tree-search").on("keyup",function(){var n=i(this),t=n.val(),r=n.nextAll(),l=[];r.find("."+y).each(function(){var e=i(this).parents("."+p);if(i(this).html().indexOf(t)!=-1){l.push(i(this).parent());var a=function(e){e.addClass("layui-tree-searchShow"),e.parent("."+v)[0]&&a(e.parent("."+v).parent("."+s))};a(e.parent("."+s))}}),r.find("."+p).each(function(){var e=i(this).parent("."+s);e.hasClass("layui-tree-searchShow")||e.addClass(c)}),0==r.find(".layui-tree-searchShow").length&&e.elem.append(e.elemNone),a.onsearch&&a.onsearch({elem:l})}),e.elem.find(".layui-tree-search").on("keydown",function(){i(this).nextAll().find("."+p).each(function(){var e=i(this).parent("."+s);e.removeClass("layui-tree-searchShow "+c)}),i(".layui-tree-emptyText")[0]&&i(".layui-tree-emptyText").remove()})},b.prototype.getChecked=function(){var e=this,a=e.config,n=[],t=[];e.elem.find(".layui-form-checked").each(function(){n.push(i(this).prev()[0].value)});var r=function(e,a){layui.each(e,function(e,t){layui.each(n,function(e,n){if(t.id==n){var l=i.extend({},t);return delete l.children,a.push(l),t.children&&(l.children=[],r(t.children,l.children)),!0}})})};return r(i.extend({},a.data),t),t},b.prototype.setChecked=function(e){var a=this;a.config;a.elem.find("."+s).each(function(a,n){var t=i(this).data("id"),r=i(n).children("."+p).find('input[same="layuiTreeCheck"]'),l=r.next();if("number"==typeof e){if(t==e)return r[0].checked||l.click(),!1}else"object"==typeof e&&layui.each(e,function(e,i){if(i==t&&!r[0].checked)return l.click(),!0})})},l.that={},l.config={},r.reload=function(e,i){var a=l.that[e];return a.reload(i),l.call(a)},r.getChecked=function(e){var i=l.that[e];return i.getChecked()},r.setChecked=function(e,i){var a=l.that[e];return a.setChecked(i)},r.render=function(e){var i=new b(e);return l.call(i)},e(t,r)});layui.define(["laytpl","form"],function(e){"use strict";var a=layui.$,t=layui.laytpl,n=layui.form,i="transfer",l={config:{},index:layui[i]?layui[i].index+1e4:0,set:function(e){var t=this;return t.config=a.extend({},t.config,e),t},on:function(e,a){return layui.onevent.call(this,i,e,a)}},r=function(){var e=this,a=e.config,t=a.id||e.index;return r.that[t]=e,r.config[t]=a,{config:a,reload:function(a){e.reload.call(e,a)},getData:function(){return e.getData.call(e)}}},c="layui-hide",o="layui-btn-disabled",d="layui-none",s="layui-transfer-box",u="layui-transfer-header",h="layui-transfer-search",f="layui-transfer-active",y="layui-transfer-data",p=function(e){return e=e||{},['
        ','
        ','","
        ","{{# if(d.data.showSearch){ }}",'","{{# } }}",'
          ',"
          "].join("")},v=['
          ',p({index:0,checkAllName:"layTransferLeftCheckAll"}),'
          ','",'","
          ",p({index:1,checkAllName:"layTransferRightCheckAll"}),"
          "].join(""),x=function(e){var t=this;t.index=++l.index,t.config=a.extend({},t.config,l.config,e),t.render()};x.prototype.config={title:["列表一","列表二"],width:200,height:360,data:[],value:[],showSearch:!1,id:"",text:{none:"无数据",searchNone:"无匹配数据"}},x.prototype.reload=function(e){var t=this;layui.each(e,function(e,a){a.constructor===Array&&delete t.config[e]}),t.config=a.extend(!0,{},t.config,e),t.render()},x.prototype.render=function(){var e=this,n=e.config,i=e.elem=a(t(v).render({data:n,index:e.index})),l=n.elem=a(n.elem);l[0]&&(n.data=n.data||[],n.value=n.value||[],e.key=n.id||e.index,l.html(e.elem),e.layBox=e.elem.find("."+s),e.layHeader=e.elem.find("."+u),e.laySearch=e.elem.find("."+h),e.layData=i.find("."+y),e.layBtn=i.find("."+f+" .layui-btn"),e.layBox.css({width:n.width,height:n.height}),e.layData.css({height:function(){return n.height-e.layHeader.outerHeight()-e.laySearch.outerHeight()-2}()}),e.renderData(),e.events())},x.prototype.renderData=function(){var e=this,a=(e.config,[{checkName:"layTransferLeftCheck",views:[]},{checkName:"layTransferRightCheck",views:[]}]);e.parseData(function(e){var t=e.selected?1:0,n=["
        • ",'',"
        • "].join("");a[t].views.push(n),delete e.selected}),e.layData.eq(0).html(a[0].views.join("")),e.layData.eq(1).html(a[1].views.join("")),e.renderCheckBtn()},x.prototype.renderForm=function(e){n.render(e,"LAY-transfer-"+this.index)},x.prototype.renderCheckBtn=function(e){var t=this,n=t.config;e=e||{},t.layBox.each(function(i){var l=a(this),r=l.find("."+y),d=l.find("."+u).find('input[type="checkbox"]'),s=r.find('input[type="checkbox"]'),h=0,f=!1;if(s.each(function(){var e=a(this).data("hide");(this.checked||this.disabled||e)&&h++,this.checked&&!e&&(f=!0)}),d.prop("checked",f&&h===s.length),t.layBtn.eq(i)[f?"removeClass":"addClass"](o),!e.stopNone){var p=r.children("li:not(."+c+")").length;t.noneView(r,p?"":n.text.none)}}),t.renderForm("checkbox")},x.prototype.noneView=function(e,t){var n=a('

          '+(t||"")+"

          ");e.find("."+d)[0]&&e.find("."+d).remove(),t.replace(/\s/g,"")&&e.append(n)},x.prototype.setValue=function(){var e=this,t=e.config,n=[];return e.layBox.eq(1).find("."+y+' input[type="checkbox"]').each(function(){var e=a(this).data("hide");e||n.push(this.value)}),t.value=n,e},x.prototype.parseData=function(e){var t=this,n=t.config,i=[];return layui.each(n.data,function(t,l){l=("function"==typeof n.parseData?n.parseData(l):l)||l,i.push(l=a.extend({},l)),layui.each(n.value,function(e,a){a==l.value&&(l.selected=!0)}),e&&e(l)}),n.data=i,t},x.prototype.getData=function(e){var a=this,t=a.config,n=[];return a.setValue(),layui.each(e||t.value,function(e,a){layui.each(t.data,function(e,t){delete t.selected,a==t.value&&n.push(t)})}),n},x.prototype.events=function(){var e=this,t=e.config;e.elem.on("click",'input[lay-filter="layTransferCheckbox"]+',function(){var t=a(this).prev(),n=t[0].checked,i=t.parents("."+s).eq(0).find("."+y);t[0].disabled||("all"===t.attr("lay-type")&&i.find('input[type="checkbox"]').each(function(){this.disabled||(this.checked=n)}),e.renderCheckBtn({stopNone:!0}))}),e.layBtn.on("click",function(){var n=a(this),i=n.data("index"),l=e.layBox.eq(i),r=[];if(!n.hasClass(o)){e.layBox.eq(i).each(function(t){var n=a(this),i=n.find("."+y);i.children("li").each(function(){var t=a(this),n=t.find('input[type="checkbox"]'),i=n.data("hide");n[0].checked&&!i&&(n[0].checked=!1,l.siblings("."+s).find("."+y).append(t.clone()),t.remove(),r.push(n[0].value)),e.setValue()})}),e.renderCheckBtn();var c=l.siblings("."+s).find("."+h+" input");""===c.val()||c.trigger("keyup"),t.onchange&&t.onchange(e.getData(r),i)}}),e.laySearch.find("input").on("keyup",function(){var n=this.value,i=a(this).parents("."+h).eq(0).siblings("."+y),l=i.children("li");l.each(function(){var e=a(this),t=e.find('input[type="checkbox"]'),i=t[0].title.indexOf(n)!==-1;e[i?"removeClass":"addClass"](c),t.data("hide",!i)}),e.renderCheckBtn();var r=l.length===i.children("li."+c).length;e.noneView(i,r?t.text.searchNone:"")})},r.that={},r.config={},l.reload=function(e,a){var t=r.that[e];return t.reload(a),r.call(t)},l.getData=function(e){var a=r.that[e];return a.getData()},l.render=function(e){var a=new x(e);return r.call(a)},e(i,l)});layui.define(["laytpl","laypage","layer","form","util"],function(e){"use strict";var t=layui.$,i=layui.laytpl,a=layui.laypage,l=layui.layer,n=layui.form,o=(layui.util,layui.hint()),r=layui.device(),d={config:{checkName:"LAY_CHECKED",indexName:"LAY_TABLE_INDEX"},cache:{},index:layui.table?layui.table.index+1e4:0,set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,y,e,t)}},c=function(){var e=this,t=e.config,i=t.id||t.index;return i&&(c.that[i]=e,c.config[i]=t),{config:t,reload:function(t){e.reload.call(e,t)},setColsWidth:function(){e.setColsWidth.call(e)},resize:function(){e.resize.call(e)}}},s=function(e){var t=c.config[e];return t||o.error("The ID option was not found in the table instance"),t||null},u=function(e,a,l,n){var o=e.templet?function(){return"function"==typeof e.templet?e.templet(l):i(t(e.templet).html()||String(a)).render(l)}():a;return n?t("
          "+o+"
          ").text():o},y="table",h=".layui-table",f="layui-hide",p="layui-none",v="layui-table-view",m=".layui-table-tool",g=".layui-table-box",b=".layui-table-init",x=".layui-table-header",k=".layui-table-body",C=".layui-table-main",w=".layui-table-fixed",T=".layui-table-fixed-l",A=".layui-table-fixed-r",L=".layui-table-total",N=".layui-table-page",S=".layui-table-sort",W="layui-table-edit",_="layui-table-hover",E=function(e){var t='{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}';return e=e||{},['',"","{{# 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; } }}',function(){return 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("")},z=['',"","
          "].join(""),H=['
          ',"{{# if(d.data.toolbar){ }}",'
          ','
          ','
          ',"
          ","{{# } }}",'
          ',"{{# if(d.data.loading){ }}",'
          ','',"
          ","{{# } }}","{{# var left, right; }}",'
          ',E(),"
          ",'
          ',z,"
          ","{{# if(left){ }}",'
          ','
          ',E({fixed:!0}),"
          ",'
          ',z,"
          ","
          ","{{# }; }}","{{# if(right){ }}",'
          ','
          ',E({fixed:"right"}),'
          ',"
          ",'
          ',z,"
          ","
          ","{{# }; }}","
          ","{{# if(d.data.totalRow){ }}",'
          ','','',"
          ","
          ","{{# } }}","{{# if(d.data.page){ }}",'
          ','
          ',"
          ","{{# } }}","","
          "].join(""),R=t(window),F=t(document),j=function(e){var i=this;i.index=++d.index,i.config=t.extend({},i.config,d.config,e),i.render()};j.prototype.config={limit:10,loading:!0,cellMinWidth:60,defaultToolbar:["filter","exports","print"],autoSort:!0,text:{none:"无数据"}},j.prototype.render=function(){var e=this,a=e.config;if(a.elem=t(a.elem),a.where=a.where||{},a.id=a.id||a.elem.attr("id")||e.index,a.request=t.extend({pageName:"page",limitName:"limit"},a.request),a.response=t.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",countName:"count"},a.response),"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,e.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return e;a.height&&/^full-\d+$/.test(a.height)&&(e.fullHeightGap=a.height.split("-")[1],a.height=R.height()-e.fullHeightGap),e.setInit();var l=a.elem,n=l.next("."+v),o=e.elem=t(i(H).render({VIEW_CLASS:v,data:a,index:e.index}));if(a.index=e.index,e.key=a.id||a.index,n[0]&&n.remove(),l.after(o),e.layTool=o.find(m),e.layBox=o.find(g),e.layHeader=o.find(x),e.layMain=o.find(C),e.layBody=o.find(k),e.layFixed=o.find(w),e.layFixLeft=o.find(T),e.layFixRight=o.find(A),e.layTotal=o.find(L),e.layPage=o.find(N),e.renderToolbar(),e.fullSize(),a.cols.length>1){var r=e.layFixed.find(x).find("th");r.height(e.layHeader.height()-1-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom")))}e.pullData(e.page),e.events()},j.prototype.initOpts=function(e){var t=this,i=(t.config,{checkbox:48,radio:48,space:15,numbers:40});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||i[e.type])},j.prototype.setInit=function(e){var t=this,i=t.config;return i.clientWidth=i.width||function(){var e=function(t){var a,l;t=t||i.elem.parent(),a=t.width();try{l="none"===t.css("display")}catch(n){}return!t[0]||a&&!l?a:e(t.parent())};return e()}(),"width"===e?i.clientWidth:void layui.each(i.cols,function(e,a){layui.each(a,function(l,n){if(!n)return void a.splice(l,1);if(n.key=e+"-"+l,n.hide=n.hide||!1,n.colGroup||n.colspan>1){var o=0;layui.each(i.cols[e+1],function(t,i){i.HAS_PARENT||o>1&&o==n.colspan||(i.HAS_PARENT=!0,i.parentKey=e+"-"+l,o+=parseInt(i.colspan>1?i.colspan:1))}),n.colGroup=!0}t.initOpts(n)})})},j.prototype.renderToolbar=function(){var e=this,a=e.config,l=['
          ','
          ','
          '].join(""),n=e.layTool.find(".layui-table-tool-temp");if("default"===a.toolbar)n.html(l);else if("string"==typeof a.toolbar){var o=t(a.toolbar).html()||"";o&&n.html(i(o).render(a))}var r={filter:{title:"筛选列",layEvent:"LAYTABLE_COLS",icon:"layui-icon-cols"},exports:{title:"导出",layEvent:"LAYTABLE_EXPORT",icon:"layui-icon-export"},print:{title:"打印",layEvent:"LAYTABLE_PRINT",icon:"layui-icon-print"}},d=[];"object"==typeof a.defaultToolbar&&layui.each(a.defaultToolbar,function(e,t){var i="string"==typeof t?r[t]:t;i&&d.push('
          ')}),e.layTool.find(".layui-table-tool-self").html(d.join(""))},j.prototype.setParentCol=function(e,t){var i=this,a=i.config,l=i.layHeader.find('th[data-key="'+a.index+"-"+t+'"]'),n=parseInt(l.attr("colspan"))||0;if(l[0]){var o=t.split("-"),r=a.cols[o[0]][o[1]];e?n--:n++,l.attr("colspan",n),l[n<1?"addClass":"removeClass"](f),r.colspan=n,r.hide=n<1;var d=l.data("parentkey");d&&i.setParentCol(e,d)}},j.prototype.setColsPatch=function(){var e=this,t=e.config;layui.each(t.cols,function(t,i){layui.each(i,function(t,i){i.hide&&e.setParentCol(i.hide,i.parentKey)})})},j.prototype.setColsWidth=function(){var e=this,t=e.config,i=0,a=0,l=0,n=0,o=e.setInit("width");e.eachCols(function(e,t){t.hide||i++}),o=o-function(){return"line"===t.skin||"nob"===t.skin?2:i+1}()-e.getScrollWidth(e.layMain[0])-1;var r=function(e){layui.each(t.cols,function(i,r){layui.each(r,function(i,d){var c=0,s=d.minWidth||t.cellMinWidth;return d?void(d.colGroup||d.hide||(e?l&&ln&&a&&(l=(o-n)/a)};r(),r(!0),e.autoColNums=a,e.eachCols(function(i,a){var n=a.minWidth||t.cellMinWidth;a.colGroup||a.hide||(0===a.width?e.getCssRule(t.index+"-"+a.key,function(e){e.style.width=Math.floor(l>=n?l:n)+"px"}):/\d+%$/.test(a.width)&&e.getCssRule(t.index+"-"+a.key,function(e){e.style.width=Math.floor(parseFloat(a.width)/100*o)+"px"}))});var d=e.layMain.width()-e.getScrollWidth(e.layMain[0])-e.layMain.children("table").outerWidth();if(e.autoColNums&&d>=-i&&d<=i){var c=function(t){var i;return t=t||e.layHeader.eq(0).find("thead th:last-child"),i=t.data("field"),!i&&t.prev()[0]?c(t.prev()):t},s=c(),u=s.data("key");e.getCssRule(u,function(t){var i=t.style.width||s.outerWidth();t.style.width=parseFloat(i)+d+"px",e.layMain.height()-e.layMain.prop("clientHeight")>0&&(t.style.width=parseFloat(t.style.width)-1+"px")})}e.loading(!0)},j.prototype.resize=function(){var e=this;e.fullSize(),e.setColsWidth(),e.scrollPatch()},j.prototype.reload=function(e){var i=this;e=e||{},delete i.haveInit,e.data&&e.data.constructor===Array&&delete i.config.data,i.config=t.extend(!0,{},i.config,e),i.render()},j.prototype.errorView=function(e){var i=this,a=i.layMain.find("."+p),l=t('
          '+(e||"Error")+"
          ");a[0]&&(i.layNone.remove(),a.remove()),i.layFixed.addClass(f),i.layMain.find("tbody").html(""),i.layMain.append(i.layNone=l),d.cache[i.key]=[]},j.prototype.page=1,j.prototype.pullData=function(e){var i=this,a=i.config,l=a.request,n=a.response,o=function(){"object"==typeof a.initSort&&i.sort(a.initSort.field,a.initSort.type)};if(i.startTime=(new Date).getTime(),a.url){var r={};r[l.pageName]=e,r[l.limitName]=a.limit;var d=t.extend(r,a.where);a.contentType&&0==a.contentType.indexOf("application/json")&&(d=JSON.stringify(d)),i.loading(),t.ajax({type:a.method||"get",url:a.url,contentType:a.contentType,data:d,dataType:"json",headers:a.headers||{},success:function(t){"function"==typeof a.parseData&&(t=a.parseData(t)||t),t[n.statusName]!=n.statusCode?(i.renderForm(),i.errorView(t[n.msgName]||'返回的数据不符合规范,正确的成功状态码应为:"'+n.statusName+'": '+n.statusCode)):(i.renderData(t,e,t[n.countName]),o(),a.time=(new Date).getTime()-i.startTime+" ms"),i.setColsWidth(),"function"==typeof a.done&&a.done(t,e,t[n.countName])},error:function(e,t){i.errorView("数据接口请求异常:"+t),i.renderForm(),i.setColsWidth()}})}else if(a.data&&a.data.constructor===Array){var c={},s=e*a.limit-a.limit;c[n.dataName]=a.data.concat().splice(s,a.limit),c[n.countName]=a.data.length,i.renderData(c,e,c[n.countName]),o(),i.setColsWidth(),"function"==typeof a.done&&a.done(c,e,c[n.countName])}},j.prototype.eachCols=function(e){var t=this;return d.eachCols(null,e,t.config.cols),t},j.prototype.renderData=function(e,n,o,r){var c=this,s=c.config,y=e[s.response.dataName]||[],h=[],v=[],m=[],g=function(){var e;return!r&&c.sortKey?c.sort(c.sortKey.field,c.sortKey.sort,!0):(layui.each(y,function(a,l){var o=[],y=[],p=[],g=a+s.limit*(n-1)+1;0!==l.length&&(r||(l[d.config.indexName]=a),c.eachCols(function(n,r){var c=r.field||n,h=s.index+"-"+r.key,v=l[c];if(void 0!==v&&null!==v||(v=""),!r.colGroup){var m=['','
          '+function(){var n=t.extend(!0,{LAY_INDEX:g},l),o=d.config.checkName;switch(r.type){case"checkbox":return'";case"radio":return n[o]&&(e=a),'';case"numbers":return g}return r.toolbar?i(t(r.toolbar).html()||"").render(n):u(r,v,n)}(),"
          "].join("");o.push(m),r.fixed&&"right"!==r.fixed&&y.push(m),"right"===r.fixed&&p.push(m)}}),h.push(''+o.join("")+""),v.push(''+y.join("")+""),m.push(''+p.join("")+""))}),c.layBody.scrollTop(0),c.layMain.find("."+p).remove(),c.layMain.find("tbody").html(h.join("")),c.layFixLeft.find("tbody").html(v.join("")),c.layFixRight.find("tbody").html(m.join("")),c.renderForm(),"number"==typeof e&&c.setThisRowChecked(e),c.syncCheckAll(),c.haveInit?c.scrollPatch():setTimeout(function(){c.scrollPatch()},50),c.haveInit=!0,l.close(c.tipsIndex),s.HAS_SET_COLS_PATCH||c.setColsPatch(),void(s.HAS_SET_COLS_PATCH=!0))};return d.cache[c.key]=y,c.layPage[0==o||0===y.length&&1==n?"addClass":"removeClass"](f),r?g():0===y.length?(c.renderForm(),c.errorView(s.text.none)):(c.layFixed.removeClass(f),g(),c.renderTotal(y),void(s.page&&(s.page=t.extend({elem:"layui-table-page"+s.index,count:o,limit:s.limit,limits:s.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||(c.page=e.curr,s.limit=e.limit,c.pullData(e.curr))}},s.page),s.page.count=o,a.render(s.page))))},j.prototype.renderTotal=function(e){var t=this,i=t.config,a={};if(i.totalRow){layui.each(e,function(e,i){0!==i.length&&t.eachCols(function(e,t){var l=t.field||e,n=i[l];t.totalRow&&(a[l]=(a[l]||0)+(parseFloat(n)||0))})}),t.dataTotal={};var l=[];t.eachCols(function(e,n){var o=n.field||e,r=function(){var e=n.totalRowText||"",t=parseFloat(a[o]).toFixed(2),i={};return i[o]=t,t=u(n,t,i),n.totalRow?t||e:e}(),d=['','
          '+r,"
          "].join("");n.field&&(t.dataTotal[o]=r),l.push(d)}),t.layTotal.find("tbody").html(""+l.join("")+"")}},j.prototype.getColElem=function(e,t){var i=this,a=i.config;return e.eq(0).find(".laytable-cell-"+(a.index+"-"+t)+":eq(0)")},j.prototype.renderForm=function(e){n.render(e,"LAY-table-"+this.index)},j.prototype.setThisRowChecked=function(e){var t=this,i=(t.config,"layui-table-click"),a=t.layBody.find('tr[data-index="'+e+'"]');a.addClass(i).siblings("tr").removeClass(i)},j.prototype.sort=function(e,i,a,l){var n,r,c=this,s={},u=c.config,h=u.elem.attr("lay-filter"),f=d.cache[c.key];"string"==typeof e&&c.layHeader.find("th").each(function(i,a){var l=t(this),o=l.data("field");if(o===e)return e=l,n=o,!1});try{var n=n||e.data("field"),p=e.data("key");if(c.sortKey&&!a&&n===c.sortKey.field&&i===c.sortKey.sort)return;var v=c.layHeader.find("th .laytable-cell-"+p).find(S);c.layHeader.find("th").find(S).removeAttr("lay-sort"),v.attr("lay-sort",i||null),c.layFixed.find("th")}catch(m){return o.error("Table modules: Did not match to field")}c.sortKey={field:n,sort:i},u.autoSort&&("asc"===i?r=layui.sort(f,n):"desc"===i?r=layui.sort(f,n,!0):(r=layui.sort(f,d.config.indexName),delete c.sortKey)),s[u.response.dataName]=r||f,c.renderData(s,c.page,c.count,!0),l&&layui.event.call(e,y,"sort("+h+")",{field:n,type:i})},j.prototype.loading=function(e){var i=this,a=i.config;a.loading&&(e?(i.layInit&&i.layInit.remove(),delete i.layInit,i.layBox.find(b).remove()):(i.layInit=t(['
          ','',"
          "].join("")),i.layBox.append(i.layInit)))},j.prototype.setCheckData=function(e,t){var i=this,a=i.config,l=d.cache[i.key];l[e]&&l[e].constructor!==Array&&(l[e][a.checkName]=t)},j.prototype.syncCheckAll=function(){var e=this,t=e.config,i=e.layHeader.find('input[name="layTableCheckbox"]'),a=function(i){return e.eachCols(function(e,a){"checkbox"===a.type&&(a[t.checkName]=i)}),i};i[0]&&(d.checkStatus(e.key).isAll?(i[0].checked||(i.prop("checked",!0),e.renderForm("checkbox")),a(!0)):(i[0].checked&&(i.prop("checked",!1),e.renderForm("checkbox")),a(!1)))},j.prototype.getCssRule=function(e,t){var i=this,a=i.elem.find("style")[0],l=a.sheet||a.styleSheet||{},n=l.cssRules||l.rules;layui.each(n,function(i,a){if(a.selectorText===".laytable-cell-"+e)return t(a),!0})},j.prototype.fullSize=function(){var e,t=this,i=t.config,a=i.height;t.fullHeightGap&&(a=R.height()-t.fullHeightGap,a<135&&(a=135),t.elem.css("height",a)),a&&(e=parseFloat(a)-(t.layHeader.outerHeight()||38),i.toolbar&&(e-=t.layTool.outerHeight()||50),i.totalRow&&(e-=t.layTotal.outerHeight()||40),i.page&&(e-=t.layPage.outerHeight()||41),t.layMain.css("height",e-2))},j.prototype.getScrollWidth=function(e){var t=0;return e?t=e.offsetWidth-e.clientWidth:(e=document.createElement("div"),e.style.width="100px",e.style.height="100px",e.style.overflowY="scroll",document.body.appendChild(e),t=e.offsetWidth-e.clientWidth,document.body.removeChild(e)),t},j.prototype.scrollPatch=function(){var e=this,i=e.layMain.children("table"),a=e.layMain.width()-e.layMain.prop("clientWidth"),l=e.layMain.height()-e.layMain.prop("clientHeight"),n=(e.getScrollWidth(e.layMain[0]),i.outerWidth()-e.layMain.width()),o=function(e){if(a&&l){if(e=e.eq(0),!e.find(".layui-table-patch")[0]){var i=t('
          ');i.find("div").css({width:a}),e.find("tr").append(i)}}else e.find(".layui-table-patch").remove()};o(e.layHeader),o(e.layTotal);var r=e.layMain.height(),d=r-l;e.layFixed.find(k).css("height",i.height()>=d?d:"auto"),e.layFixRight[n>0?"removeClass":"addClass"](f),e.layFixRight.css("right",a-1)},j.prototype.events=function(){var e,i=this,a=i.config,o=t("body"),c={},s=i.layHeader.find("th"),h=".layui-table-cell",p=a.elem.attr("lay-filter");i.layTool.on("click","*[lay-event]",function(e){var o=t(this),c=o.attr("lay-event"),s=function(e){var l=t(e.list),n=t('
            ');n.html(l),a.height&&n.css("max-height",a.height-(i.layTool.outerHeight()||50)),o.find(".layui-table-tool-panel")[0]||o.append(n),i.renderForm(),n.on("click",function(e){layui.stope(e)}),e.done&&e.done(n,l)};switch(layui.stope(e),F.trigger("table.tool.panel.remove"),l.close(i.tipsIndex),c){case"LAYTABLE_COLS":s({list:function(){var e=[];return i.eachCols(function(t,i){i.field&&"normal"==i.type&&e.push('
          • ')}),e.join("")}(),done:function(){n.on("checkbox(LAY_TABLE_TOOL_COLS)",function(e){var l=t(e.elem),n=this.checked,o=l.data("key"),r=l.data("parentkey");layui.each(a.cols,function(e,t){layui.each(t,function(t,l){if(e+"-"+t===o){var d=l.hide;l.hide=!n,i.elem.find('*[data-key="'+a.index+"-"+o+'"]')[n?"removeClass":"addClass"](f),d!=l.hide&&i.setParentCol(!n,r),i.resize()}})})})}});break;case"LAYTABLE_EXPORT":r.ie?l.tips("导出功能不支持 IE,请用 Chrome 等高级浏览器导出",this,{tips:3}):s({list:function(){return['
          • 导出到 Csv 文件
          • ','
          • 导出到 Excel 文件
          • '].join("")}(),done:function(e,l){l.on("click",function(){var e=t(this).data("type");d.exportFile.call(i,a.id,null,e)})}});break;case"LAYTABLE_PRINT":var u=window.open("打印窗口","_blank"),h=[""].join(""),v=t(i.layHeader.html());v.append(i.layMain.find("table").html()),v.append(i.layTotal.find("table").html()),v.find("th.layui-table-patch").remove(),v.find(".layui-table-col-special").remove(),u.document.write(h+v.prop("outerHTML")),u.document.close(),u.print(),u.close()}layui.event.call(this,y,"toolbar("+p+")",t.extend({event:c,config:a},{}))}),s.on("mousemove",function(e){var i=t(this),a=i.offset().left,l=e.clientX-a;i.data("unresize")||c.resizeStart||(c.allowResize=i.width()-l<=10,o.css("cursor",c.allowResize?"col-resize":""))}).on("mouseleave",function(){t(this);c.resizeStart||o.css("cursor","")}).on("mousedown",function(e){var l=t(this);if(c.allowResize){var n=l.data("key");e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],i.getCssRule(n,function(e){var t=e.style.width||l.outerWidth();c.rule=e,c.ruleWidth=parseFloat(t),c.minWidth=l.data("minwidth")||a.cellMinWidth})}}),F.on("mousemove",function(t){if(c.resizeStart){if(t.preventDefault(),c.rule){var a=c.ruleWidth+t.clientX-c.offset[0];a');return n[0].value=i.data("content")||l.text(),i.find("."+W)[0]||i.append(n),n.focus(),void layui.stope(e)}}).on("mouseenter","td",function(){b.call(this)}).on("mouseleave","td",function(){b.call(this,"hide")});var g="layui-table-grid-down",b=function(e){var i=t(this),a=i.children(h);if(!i.data("off"))if(e)i.find(".layui-table-grid-down").remove();else if(a.prop("scrollWidth")>a.outerWidth()){if(a.find("."+g)[0])return;i.append('
            ')}};i.layBody.on("click","."+g,function(e){var n=t(this),o=n.parent(),d=o.children(h);i.tipsIndex=l.tips(['
            ',d.html(),"
            ",''].join(""),d[0],{tips:[3,""],time:-1,anim:-1,maxWidth:r.ios||r.android?300:i.elem.width()/2,isOutAnim:!1,skin:"layui-table-tips",success:function(e,t){e.find(".layui-table-tips-c").on("click",function(){l.close(t)})}}),layui.stope(e)}),i.layBody.on("click","*[lay-event]",function(){var e=t(this),a=e.parents("tr").eq(0).data("index");layui.event.call(this,y,"tool("+p+")",v.call(this,{event:e.attr("lay-event")})),i.setThisRowChecked(a)}),i.layMain.on("scroll",function(){var e=t(this),a=e.scrollLeft(),n=e.scrollTop();i.layHeader.scrollLeft(a),i.layTotal.scrollLeft(a),i.layFixed.find(k).scrollTop(n),l.close(i.tipsIndex)}),R.on("resize",function(){i.resize()})},function(){F.on("click",function(){F.trigger("table.remove.tool.panel")}),F.on("table.remove.tool.panel",function(){t(".layui-table-tool-panel").remove()})}(),d.init=function(e,i){i=i||{};var a=this,l=t(e?'table[lay-filter="'+e+'"]':h+"[lay-data]"),n="Table element property lay-data configuration item has a syntax error: ";return l.each(function(){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){o.error(n+l)}var c=[],s=t.extend({elem:this,cols:[],data:[],skin:a.attr("lay-skin"),size:a.attr("lay-size"),even:"string"==typeof a.attr("lay-even")},d.config,i,l);e&&a.hide(),a.find("thead>tr").each(function(e){s.cols[e]=[],t(this).children().each(function(i){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(r){return o.error(n+l)}var d=t.extend({title:a.text(),colspan:a.attr("colspan")||0,rowspan:a.attr("rowspan")||0},l);d.colspan<2&&c.push(d),s.cols[e].push(d)})}),a.find("tbody>tr").each(function(e){var i=t(this),a={};i.children("td").each(function(e,i){var l=t(this),n=l.data("field");if(n)return a[n]=l.html()}),layui.each(c,function(e,t){var l=i.children("td").eq(e);a[t.field]=l.html()}),s.data[e]=a}),d.render(s)}),a},c.that={},c.config={},d.eachCols=function(e,i,a){var l=c.config[e]||{},n=[],o=0;a=t.extend(!0,[],a||l.cols),layui.each(a,function(e,t){layui.each(t,function(t,i){if(i.colGroup){var l=0;o++,i.CHILD_COLS=[],layui.each(a[e+1],function(e,t){t.PARENT_COL_INDEX||l>1&&l==i.colspan||(t.PARENT_COL_INDEX=o,i.CHILD_COLS.push(t),l+=parseInt(t.colspan>1?t.colspan:1))})}i.PARENT_COL_INDEX||n.push(i)})});var r=function(e){layui.each(e||n,function(e,t){return t.CHILD_COLS?r(t.CHILD_COLS):void("function"==typeof i&&i(e,t))})};r()},d.checkStatus=function(e){var t=0,i=0,a=[],l=d.cache[e]||[];return layui.each(l,function(e,l){return l.constructor===Array?void i++:void(l[d.config.checkName]&&(t++,a.push(d.clearCacheKey(l))))}),{data:a,isAll:!!l.length&&t===l.length-i}},d.exportFile=function(e,t,i){var a=this;t=t||d.clearCacheKey(d.cache[e]),i=i||"csv";var l=c.config[e]||{},n={csv:"text/csv",xls:"application/vnd.ms-excel"}[i],s=document.createElement("a");return r.ie?o.error("IE_NOT_SUPPORT_EXPORTS"):(s.href="data:"+n+";charset=utf-8,\ufeff"+encodeURIComponent(function(){var i=[],l=[],n=[];return layui.each(t,function(t,a){var n=[];"object"==typeof e?(layui.each(e,function(e,a){0==t&&i.push(a||"")}),layui.each(d.clearCacheKey(a),function(e,t){n.push('"'+(t||"")+'"')})):d.eachCols(e,function(e,l){if(l.field&&"normal"==l.type&&!l.hide){var o=a[l.field];void 0!==o&&null!==o||(o=""),0==t&&i.push(l.title||""),n.push('"'+u(l,o,a,"text")+'"')}}),l.push(n.join(","))}),layui.each(a.dataTotal,function(e,t){n.push(t)}),i.join(",")+"\r\n"+l.join("\r\n")+"\r\n"+n.join(",")}()),s.download=(l.title||"table_"+(l.index||""))+"."+i,document.body.appendChild(s),s.click(),void document.body.removeChild(s))},d.resize=function(e){if(e){var t=s(e);if(!t)return;c.that[e].resize()}else layui.each(c.that,function(){this.resize()})},d.reload=function(e,t){var i=s(e);if(i){var a=c.that[e];return a.reload(t),c.call(a)}},d.render=function(e){var t=new j(e);return c.call(t)},d.clearCacheKey=function(e){return e=t.extend({},e),delete e[d.config.checkName],delete e[d.config.indexName],e},d.init(),e(y,d)});layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(clearInterval(e.timer),e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['",'"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['
              ',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("")}),i.join("")}(),"
            "].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).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(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a",u=1;u<=i.length;u++){var r='
          • ";i.half&&parseInt(i.value)!==i.value&&u==Math.ceil(i.value)?n=n+'
          • ":n+=r}n+=""+(i.text?''+i.value+"星":"")+"";var c=i.elem,f=c.next("."+t);f[0]&&f.remove(),e.elemTemp=a(n),i.span=e.elemTemp.next("span"),i.setText&&i.setText(i.value),c.html(e.elemTemp),c.addClass("layui-inline"),i.readonly||e.action()},v.prototype.setvalue=function(e){var a=this,i=a.config;i.value=e,a.render()},v.prototype.action=function(){var e=this,i=e.config,l=e.elemTemp,n=l.find("i").width();l.children("li").each(function(e){var t=e+1,v=a(this);v.on("click",function(e){if(i.value=t,i.half){var o=e.pageX-a(this).offset().left;o<=n/2&&(i.value=i.value-.5)}i.text&&l.next("span").text(i.value+"星"),i.choose&&i.choose(i.value),i.setText&&i.setText(i.value)}),v.on("mousemove",function(e){if(l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+t+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half){var c=e.pageX-a(this).offset().left;c<=n/2&&v.children("i").addClass(u).removeClass(s)}}),v.on("mouseleave",function(){l.find("i").each(function(){a(this).addClass(o).removeClass(r)}),l.find("i:lt("+Math.floor(i.value)+")").each(function(){a(this).addClass(s).removeClass(f)}),i.half&&parseInt(i.value)!==i.value&&l.children("li:eq("+Math.floor(i.value)+")").children("i").addClass(u).removeClass(c)})})},v.prototype.events=function(){var e=this;e.config},i.render=function(e){var a=new v(e);return l.call(a)},e(n,i)});layui.define("jquery",function(t){"use strict";var e=layui.$,i={fixbar:function(t){var i,n,a="layui-fixbar",o="layui-fixbar-top",r=e(document),l=e("body");t=e.extend({showHeight:200},t),t.bar1=t.bar1===!0?"":t.bar1,t.bar2=t.bar2===!0?"":t.bar2,t.bgcolor=t.bgcolor?"background-color:"+t.bgcolor:"";var c=[t.bar1,t.bar2,""],g=e(['
              ',t.bar1?'
            • '+c[0]+"
            • ":"",t.bar2?'
            • '+c[1]+"
            • ":"",'
            • '+c[2]+"
            • ","
            "].join("")),s=g.find("."+o),u=function(){var e=r.scrollTop();e>=t.showHeight?i||(s.show(),i=1):i&&(s.hide(),i=0)};e("."+a)[0]||("object"==typeof t.css&&g.css(t.css),l.append(g),u(),g.find("li").on("click",function(){var i=e(this),n=i.attr("lay-type");"top"===n&&e("html,body").animate({scrollTop:0},200),t.click&&t.click.call(this,n)}),r.on("scroll",function(){clearTimeout(n),n=setTimeout(function(){u()},100)}))},countdown:function(t,e,i){var n=this,a="function"==typeof e,o=new Date(t).getTime(),r=new Date(!e||a?(new Date).getTime():e).getTime(),l=o-r,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=e);var g=setTimeout(function(){n.countdown(t,r+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],e,g),l<=0&&clearTimeout(g),g},timeAgo:function(t,e){var i=this,n=[[],[]],a=(new Date).getTime()-new Date(t).getTime();return a>6912e5?(a=new Date(t),n[0][0]=i.digit(a.getFullYear(),4),n[0][1]=i.digit(a.getMonth()+1),n[0][2]=i.digit(a.getDate()),e||(n[1][0]=i.digit(a.getHours()),n[1][1]=i.digit(a.getMinutes()),n[1][2]=i.digit(a.getSeconds())),n[0].join("-")+" "+n[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=12e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(t,e){var i="";t=String(t),e=e||2;for(var n=t.length;n/g,">").replace(/'/g,"'").replace(/"/g,""")},event:function(t,n,a){n=i.event[t]=e.extend(!0,i.event[t],n)||{},e("body").on(a||"click","*["+t+"]",function(){var i=e(this),a=i.attr(t);n[a]&&n[a].call(this,i)})}};!function(t,e,i){"$:nomunge";function n(){a=e[l](function(){o.each(function(){var e=t(this),i=e.width(),n=e.height(),a=t.data(this,g);(i!==a.w||n!==a.h)&&e.trigger(c,[a.w=i,a.h=n])}),n()},r[s])}var a,o=t([]),r=t.resize=t.extend(t.resize,{}),l="setTimeout",c="resize",g=c+"-special-event",s="delay",u="throttleWindow";r[s]=250,r[u]=!0,t.event.special[c]={setup:function(){if(!r[u]&&this[l])return!1;var e=t(this);o=o.add(e),t.data(this,g,{w:e.width(),h:e.height()}),1===o.length&&n()},teardown:function(){if(!r[u]&&this[l])return!1;var e=t(this);o=o.not(e),e.removeData(g),o.length||clearTimeout(a)},add:function(e){function n(e,n,o){var r=t(this),l=t.data(this,g)||{};l.w=n!==i?n:r.width(),l.h=o!==i?o:r.height(),a.apply(this,arguments)}if(!r[u]&&this[l])return!1;var a;return t.isFunction(e)?(a=e,n):(a=e.handler,void(e.handler=n))}}}(e,window),t("util",i)});layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="加载更多",h=l('");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;su)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});layui.define(["layer","form"],function(t){"use strict";var e=layui.$,i=layui.layer,a=layui.form,l=(layui.hint(),layui.device()),n="layedit",o="layui-show",r="layui-disabled",c=function(){var t=this;t.index=0,t.config={tool:["strong","italic","underline","del","|","left","center","right","|","link","unlink","face","image"],hideTool:[],height:280}};c.prototype.set=function(t){var i=this;return e.extend(!0,i.config,t),i},c.prototype.on=function(t,e){return layui.onevent(n,t,e)},c.prototype.build=function(t,i){i=i||{};var a=this,n=a.config,r="layui-layedit",c=e("string"==typeof t?"#"+t:t),u="LAY_layedit_"+ ++a.index,d=c.next("."+r),y=e.extend({},n,i),f=function(){var t=[],e={};return layui.each(y.hideTool,function(t,i){e[i]=!0}),layui.each(y.tool,function(i,a){C[a]&&!e[a]&&t.push(C[a])}),t.join("")}(),m=e(['
            ','
            '+f+"
            ",'
            ','',"
            ","
            "].join(""));return l.ie&&l.ie<8?c.removeClass("layui-hide").addClass(o):(d[0]&&d.remove(),s.call(a,m,c[0],y),c.addClass("layui-hide").after(m),a.index)},c.prototype.getContent=function(t){var e=u(t);if(e[0])return d(e[0].document.body.innerHTML)},c.prototype.getText=function(t){var i=u(t);if(i[0])return e(i[0].document.body).text()},c.prototype.setContent=function(t,i,a){var l=u(t);l[0]&&(a?e(l[0].document.body).append(i):e(l[0].document.body).html(i),layedit.sync(t))},c.prototype.sync=function(t){var i=u(t);if(i[0]){var a=e("#"+i[1].attr("textarea"));a.val(d(i[0].document.body.innerHTML))}},c.prototype.getSelection=function(t){var e=u(t);if(e[0]){var i=m(e[0].document);return document.selection?i.text:i.toString()}};var s=function(t,i,a){var l=this,n=t.find("iframe");n.css({height:a.height}).on("load",function(){var o=n.contents(),r=n.prop("contentWindow"),c=o.find("head"),s=e([""].join("")),u=o.find("body");c.append(s),u.attr("contenteditable","true").css({"min-height":a.height}).html(i.value||""),y.apply(l,[r,n,i,a]),g.call(l,r,t,a)})},u=function(t){var i=e("#LAY_layedit_"+t),a=i.prop("contentWindow");return[a,i]},d=function(t){return 8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),t},y=function(t,a,n,o){var r=t.document,c=e(r.body);c.on("keydown",function(t){var e=t.keyCode;if(13===e){var a=m(r),l=p(a),n=l.parentNode;if("pre"===n.tagName.toLowerCase()){if(t.shiftKey)return;return i.msg("请暂时用shift+enter"),!1}r.execCommand("formatBlock",!1,"

            ")}}),e(n).parents("form").on("submit",function(){var t=c.html();8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),n.value=t}),c.on("paste",function(e){r.execCommand("formatBlock",!1,"

            "),setTimeout(function(){f.call(t,c),n.value=c.html()},100)})},f=function(t){var i=this;i.document;t.find("*[style]").each(function(){var t=this.style.textAlign;this.removeAttribute("style"),e(this).css({"text-align":t||""})}),t.find("table").addClass("layui-table"),t.find("script,link").remove()},m=function(t){return t.selection?t.selection.createRange():t.getSelection().getRangeAt(0)},p=function(t){return t.endContainer||t.parentElement().childNodes[0]},v=function(t,i,a){var l=this.document,n=document.createElement(t);for(var o in i)n.setAttribute(o,i[o]);if(n.removeAttribute("text"),l.selection){var r=a.text||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.pasteHTML(e(n).prop("outerHTML")),a.select()}else{var r=a.toString()||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.deleteContents(),a.insertNode(n)}},h=function(t,i){var a=this.document,l="layedit-tool-active",n=p(m(a)),o=function(e){return t.find(".layedit-tool-"+e)};i&&i[i.hasClass(l)?"removeClass":"addClass"](l),t.find(">i").removeClass(l),o("unlink").addClass(r),e(n).parents().each(function(){var t=this.tagName.toLowerCase(),e=this.style.textAlign;"b"!==t&&"strong"!==t||o("b").addClass(l),"i"!==t&&"em"!==t||o("i").addClass(l),"u"===t&&o("u").addClass(l),"strike"===t&&o("d").addClass(l),"p"===t&&("center"===e?o("center").addClass(l):"right"===e?o("right").addClass(l):o("left").addClass(l)),"a"===t&&(o("link").addClass(l),o("unlink").removeClass(r))})},g=function(t,a,l){var n=t.document,o=e(n.body),c={link:function(i){var a=p(i),l=e(a).parent();b.call(o,{href:l.attr("href"),target:l.attr("target")},function(e){var a=l[0];"A"===a.tagName?a.href=e.url:v.call(t,"a",{target:e.target,href:e.url,text:e.url},i)})},unlink:function(t){n.execCommand("unlink")},face:function(e){x.call(this,function(i){v.call(t,"img",{src:i.src,alt:i.alt},e)})},image:function(a){var n=this;layui.use("upload",function(o){var r=l.uploadImage||{};o.render({url:r.url,method:r.type,elem:e(n).find("input")[0],done:function(e){0==e.code?(e.data=e.data||{},v.call(t,"img",{src:e.data.src,alt:e.data.title},a)):i.msg(e.msg||"上传失败")}})})},code:function(e){k.call(o,function(i){v.call(t,"pre",{text:i.code,"lay-lang":i.lang},e)})},help:function(){i.open({type:2,title:"帮助",area:["600px","380px"],shadeClose:!0,shade:.1,skin:"layui-layer-msg",content:["http://www.layui.com/about/layedit/help.html","no"]})}},s=a.find(".layui-layedit-tool"),u=function(){var i=e(this),a=i.attr("layedit-event"),l=i.attr("lay-command");if(!i.hasClass(r)){o.focus();var u=m(n);u.commonAncestorContainer;l?(n.execCommand(l),/justifyLeft|justifyCenter|justifyRight/.test(l)&&n.execCommand("formatBlock",!1,"

            "),setTimeout(function(){o.focus()},10)):c[a]&&c[a].call(this,u),h.call(t,s,i)}},d=/image/;s.find(">i").on("mousedown",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)||u.call(this)}).on("click",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)&&u.call(this)}),o.on("click",function(){h.call(t,s),i.close(x.index)})},b=function(t,e){var l=this,n=i.open({type:1,id:"LAY_layedit_link",area:"350px",shade:.05,shadeClose:!0,moveType:1,title:"超链接",skin:"layui-layer-msg",content:['

              ','
            • ','','
              ','',"
              ","
            • ",'
            • ','','
              ','",'","
              ","
            • ",'
            • ','','',"
            • ","
            "].join(""),success:function(t,n){var o="submit(layedit-link-yes)";a.render("radio"),t.find(".layui-btn-primary").on("click",function(){i.close(n),l.focus()}),a.on(o,function(t){i.close(b.index),e&&e(t.field)})}});b.index=n},x=function(t){var a=function(){var t=["[微笑]","[嘻嘻]","[哈哈]","[可爱]","[可怜]","[挖鼻]","[吃惊]","[害羞]","[挤眼]","[闭嘴]","[鄙视]","[爱你]","[泪]","[偷笑]","[亲亲]","[生病]","[太开心]","[白眼]","[右哼哼]","[左哼哼]","[嘘]","[衰]","[委屈]","[吐]","[哈欠]","[抱抱]","[怒]","[疑问]","[馋嘴]","[拜拜]","[思考]","[汗]","[困]","[睡]","[钱]","[失望]","[酷]","[色]","[哼]","[鼓掌]","[晕]","[悲伤]","[抓狂]","[黑线]","[阴险]","[怒骂]","[互粉]","[心]","[伤心]","[猪头]","[熊猫]","[兔子]","[ok]","[耶]","[good]","[NO]","[赞]","[来]","[弱]","[草泥马]","[神马]","[囧]","[浮云]","[给力]","[围观]","[威武]","[奥特曼]","[礼物]","[钟]","[话筒]","[蜡烛]","[蛋糕]"],e={};return layui.each(t,function(t,i){e[i]=layui.cache.dir+"images/face/"+t+".gif"}),e}();return x.hide=x.hide||function(t){"face"!==e(t.target).attr("layedit-event")&&i.close(x.index)},x.index=i.tips(function(){var t=[];return layui.each(a,function(e,i){t.push('
          • '+e+'
          • ')}),'
              '+t.join("")+"
            "}(),this,{tips:1,time:0,skin:"layui-box layui-util-face",maxWidth:500,success:function(l,n){l.css({marginTop:-4,marginLeft:-10}).find(".layui-clear>li").on("click",function(){t&&t({src:a[this.title],alt:this.title}),i.close(n)}),e(document).off("click",x.hide).on("click",x.hide)}})},k=function(t){var e=this,l=i.open({type:1,id:"LAY_layedit_code",area:"550px",shade:.05,shadeClose:!0,moveType:1,title:"插入代码",skin:"layui-layer-msg",content:['
              ','
            • ','','
              ','","
              ","
            • ",'
            • ','','
              ','',"
              ","
            • ",'
            • ','','',"
            • ","
            "].join(""),success:function(l,n){var o="submit(layedit-code-yes)";a.render("select"),l.find(".layui-btn-primary").on("click",function(){i.close(n),e.focus()}),a.on(o,function(e){i.close(k.index),t&&t(e.field)})}});k.index=l},C={html:'',strong:'',italic:'',underline:'',del:'',"|":'',left:'',center:'',right:'',link:'',unlink:'',face:'',image:'',code:'',help:''},w=new c;t(n,w)});layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('
            1. '+o.replace(/[\r\t\n]+/g,"
            2. ")+"
            "),c.find(">.layui-code-h3")[0]||c.prepend('

            '+(c.attr("lay-title")||e.title||"code")+(e.about?'layui.code':"")+"

            ");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss"); \ No newline at end of file diff --git a/public/static/lib/layui/layui.js b/public/static/lib/layui/layui.js new file mode 100644 index 00000000..4615b577 --- /dev/null +++ b/public/static/lib/layui/layui.js @@ -0,0 +1,2 @@ +/** layui-v2.5.5 MIT License By https://www.layui.com */ + ;!function(e){"use strict";var t=document,o={modules:{},status:{},timeout:10,event:{}},n=function(){this.v="2.5.5"},r=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,o=t.scripts,n=o.length-1,r=n;r>0;r--)if("interactive"===o[r].readyState){e=o[r].src;break}return e||o[n].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),i=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},a="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),u={layer:"modules/layer",laydate:"modules/laydate",laypage:"modules/laypage",laytpl:"modules/laytpl",layim:"modules/layim",layedit:"modules/layedit",form:"modules/form",upload:"modules/upload",transfer:"modules/transfer",tree:"modules/tree",table:"modules/table",element:"modules/element",rate:"modules/rate",colorpicker:"modules/colorpicker",slider:"modules/slider",carousel:"modules/carousel",flow:"modules/flow",util:"modules/util",code:"modules/code",jquery:"modules/jquery",mobile:"modules/mobile","layui.all":"../layui.all"};n.prototype.cache=o,n.prototype.define=function(e,t){var n=this,r="function"==typeof e,i=function(){var e=function(e,t){layui[e]=t,o.status[e]=!0};return"function"==typeof t&&t(function(n,r){e(n,r),o.callback[n]=function(){t(e)}}),this};return r&&(t=e,e=[]),!layui["layui.all"]&&layui["layui.mobile"]?i.call(n):(n.use(e,i),n)},n.prototype.use=function(e,n,l){function s(e,t){var n="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||n.test((e.currentTarget||e.srcElement).readyState))&&(o.modules[f]=t,d.removeChild(v),function r(){return++m>1e3*o.timeout/4?i(f+" is not a valid module"):void(o.status[f]?c():setTimeout(r,4))}())}function c(){l.push(layui[f]),e.length>1?y.use(e.slice(1),n,l):"function"==typeof n&&n.apply(layui,l)}var y=this,p=o.dir=o.dir?o.dir:r,d=t.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(y.each(e,function(t,o){"jquery"===o&&e.splice(t,1)}),layui.jquery=layui.$=jQuery);var f=e[0],m=0;if(l=l||[],o.host=o.host||(p.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&u[f]||!layui["layui.all"]&&layui["layui.mobile"]&&u[f])return c(),y;if(o.modules[f])!function g(){return++m>1e3*o.timeout/4?i(f+" is not a valid module"):void("string"==typeof o.modules[f]&&o.status[f]?c():setTimeout(g,4))}();else{var v=t.createElement("script"),h=(u[f]?p+"lay/":/^\{\/\}/.test(y.modules[f])?"":o.base||"")+(y.modules[f]||f)+".js";h=h.replace(/^\{\/\}/,""),v.async=!0,v.charset="utf-8",v.src=h+function(){var e=o.version===!0?o.v||(new Date).getTime():o.version||"";return e?"?v="+e:""}(),d.appendChild(v),!v.attachEvent||v.attachEvent.toString&&v.attachEvent.toString().indexOf("[native code")<0||a?v.addEventListener("load",function(e){s(e,h)},!1):v.attachEvent("onreadystatechange",function(e){s(e,h)}),o.modules[f]=h}return y},n.prototype.getStyle=function(t,o){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](o)},n.prototype.link=function(e,n,r){var a=this,u=t.createElement("link"),l=t.getElementsByTagName("head")[0];"string"==typeof n&&(r=n);var s=(r||e).replace(/\.|\//g,""),c=u.id="layuicss-"+s,y=0;return u.rel="stylesheet",u.href=e+(o.debug?"?v="+(new Date).getTime():""),u.media="all",t.getElementById(c)||l.appendChild(u),"function"!=typeof n?a:(function p(){return++y>1e3*o.timeout/100?i(e+" timeout"):void(1989===parseInt(a.getStyle(t.getElementById(c),"width"))?function(){n()}():setTimeout(p,100))}(),a)},o.callback={},n.prototype.factory=function(e){if(layui[e])return"function"==typeof o.callback[e]?o.callback[e]:null},n.prototype.addcss=function(e,t,n){return layui.link(o.dir+"css/"+e,t,n)},n.prototype.img=function(e,t,o){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,"function"==typeof t&&t(n)},void(n.onerror=function(e){n.onerror=null,"function"==typeof o&&o(e)}))},n.prototype.config=function(e){e=e||{};for(var t in e)o[t]=e[t];return this},n.prototype.modules=function(){var e={};for(var t in u)e[t]=u[t];return e}(),n.prototype.extend=function(e){var t=this;e=e||{};for(var o in e)t[o]||t.modules[o]?i("模块名 "+o+" 已被占用"):t.modules[o]=e[o];return t},n.prototype.router=function(e){var t=this,e=e||location.hash,o={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(e=e.replace(/^#\//,""),o.href="/"+e,e=e.replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),o.search[t[0]]=t[1]}():o.path.push(t)}),o):o},n.prototype.data=function(t,o,n){if(t=t||"layui",n=n||localStorage,e.JSON&&e.JSON.parse){if(null===o)return delete n[t];o="object"==typeof o?o:{key:o};try{var r=JSON.parse(n[t])}catch(i){var r={}}return"value"in o&&(r[o.key]=o.value),o.remove&&delete r[o.key],n[t]=JSON.stringify(r),o.key?r[o.key]:r}},n.prototype.sessionData=function(e,t){return this.data(e,t,sessionStorage)},n.prototype.device=function(t){var o=navigator.userAgent.toLowerCase(),n=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(o.match(t)||[])[1],e||!1},r={os:function(){return/windows/.test(o)?"windows":/linux/.test(o)?"linux":/iphone|ipod|ipad|ios/.test(o)?"ios":/mac/.test(o)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((o.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:n("micromessenger")};return t&&!r[t]&&(r[t]=n(t)),r.android=/android/.test(o),r.ios="ios"===r.os,r},n.prototype.hint=function(){return{error:i}},n.prototype.each=function(e,t){var o,n=this;if("function"!=typeof t)return n;if(e=e||[],e.constructor===Object){for(o in e)if(t.call(e[o],o,e[o]))break}else for(o=0;oi?1:rspan::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0}.CodeMirror{height:auto;min-height:300px;border:1px solid #ddd;border-bottom-left-radius:4px;border-bottom-right-radius:4px;padding:10px;font:inherit;z-index:1}.CodeMirror-scroll{min-height:300px}.CodeMirror-fullscreen{background:#fff;position:fixed!important;top:50px;left:0;right:0;bottom:0;height:auto;z-index:9}.CodeMirror-sided{width:50%!important}.editor-toolbar{position:relative;opacity:.6;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;padding:0 10px;border-top:1px solid #bbb;border-left:1px solid #bbb;border-right:1px solid #bbb;border-top-left-radius:4px;border-top-right-radius:4px}.editor-toolbar:after,.editor-toolbar:before{display:block;content:' ';height:1px}.editor-toolbar:before{margin-bottom:8px}.editor-toolbar:after{margin-top:8px}.editor-toolbar:hover,.editor-wrapper input.title:focus,.editor-wrapper input.title:hover{opacity:.8}.editor-toolbar.fullscreen{width:100%;height:50px;overflow-x:auto;overflow-y:hidden;white-space:nowrap;padding-top:10px;padding-bottom:10px;box-sizing:border-box;background:#fff;border:0;position:fixed;top:0;left:0;opacity:1;z-index:9}.editor-toolbar.fullscreen::before{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,1) 0,rgba(255,255,255,0) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,1)),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,rgba(255,255,255,1) 0,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,rgba(255,255,255,1) 0,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,rgba(255,255,255,1) 0,rgba(255,255,255,0) 100%);background:linear-gradient(to right,rgba(255,255,255,1) 0,rgba(255,255,255,0) 100%);position:fixed;top:0;left:0;margin:0;padding:0}.editor-toolbar.fullscreen::after{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,1) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(100%,rgba(255,255,255,1)));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,1) 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,1) 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,1) 100%);background:linear-gradient(to right,rgba(255,255,255,0) 0,rgba(255,255,255,1) 100%);position:fixed;top:0;right:0;margin:0;padding:0}.editor-toolbar a{display:inline-block;text-align:center;text-decoration:none!important;color:#2c3e50!important;width:30px;height:30px;margin:0;border:1px solid transparent;border-radius:3px;cursor:pointer}.editor-toolbar a.active,.editor-toolbar a:hover{background:#fcfcfc;border-color:#95a5a6}.editor-toolbar a:before{line-height:30px}.editor-toolbar i.separator{display:inline-block;width:0;border-left:1px solid #d9d9d9;border-right:1px solid #fff;color:transparent;text-indent:-10px;margin:0 6px}.editor-toolbar a.fa-header-x:after{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:65%;vertical-align:text-bottom;position:relative;top:2px}.editor-toolbar a.fa-header-1:after{content:"1"}.editor-toolbar a.fa-header-2:after{content:"2"}.editor-toolbar a.fa-header-3:after{content:"3"}.editor-toolbar a.fa-header-bigger:after{content:"▲"}.editor-toolbar a.fa-header-smaller:after{content:"▼"}.editor-toolbar.disabled-for-preview a:not(.no-disable){pointer-events:none;background:#fff;border-color:transparent;text-shadow:inherit}@media only screen and (max-width:700px){.editor-toolbar a.no-mobile{display:none}}.editor-statusbar{padding:8px 10px;font-size:12px;color:#959694;text-align:right}.editor-statusbar span{display:inline-block;min-width:4em;margin-left:1em}.editor-preview,.editor-preview-side{padding:10px;background:#fafafa;overflow:auto;display:none;box-sizing:border-box}.editor-statusbar .lines:before{content:'lines: '}.editor-statusbar .words:before{content:'words: '}.editor-statusbar .characters:before{content:'characters: '}.editor-preview{position:absolute;width:100%;height:100%;top:0;left:0;z-index:7}.editor-preview-side{position:fixed;bottom:0;width:50%;top:50px;right:0;z-index:9;border:1px solid #ddd}.editor-preview-active,.editor-preview-active-side{display:block}.editor-preview-side>p,.editor-preview>p{margin-top:0}.editor-preview pre,.editor-preview-side pre{background:#eee;margin-bottom:10px}.editor-preview table td,.editor-preview table th,.editor-preview-side table td,.editor-preview-side table th{border:1px solid #ddd;padding:5px}.CodeMirror .CodeMirror-code .cm-tag{color:#63a35c}.CodeMirror .CodeMirror-code .cm-attribute{color:#795da3}.CodeMirror .CodeMirror-code .cm-string{color:#183691}.CodeMirror .CodeMirror-selected{background:#d9d9d9}.CodeMirror .CodeMirror-code .cm-header-1{font-size:200%;line-height:200%}.CodeMirror .CodeMirror-code .cm-header-2{font-size:160%;line-height:160%}.CodeMirror .CodeMirror-code .cm-header-3{font-size:125%;line-height:125%}.CodeMirror .CodeMirror-code .cm-header-4{font-size:110%;line-height:110%}.CodeMirror .CodeMirror-code .cm-comment{background:rgba(0,0,0,.05);border-radius:2px}.CodeMirror .CodeMirror-code .cm-link{color:#7f8c8d}.CodeMirror .CodeMirror-code .cm-url{color:#aab2b3}.CodeMirror .CodeMirror-code .cm-strikethrough{text-decoration:line-through}.CodeMirror .CodeMirror-placeholder{opacity:.5}.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word){background:rgba(255,0,0,.15)} \ No newline at end of file diff --git a/public/static/lib/simplemde/simplemde.min.js b/public/static/lib/simplemde/simplemde.min.js new file mode 100644 index 00000000..50c624f2 --- /dev/null +++ b/public/static/lib/simplemde/simplemde.min.js @@ -0,0 +1,15 @@ +/** + * simplemde v1.11.2 + * Copyright Next Step Webs, Inc. + * @link https://github.com/NextStepWebs/simplemde-markdown-editor + * @license MIT + */ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.SimpleMDE=e()}}(function(){var e;return function t(e,n,r){function i(a,l){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!l&&s)return s(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return i(n?n:t)},u,u.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;at;++t)s[t]=e[t],c[e.charCodeAt(t)]=t;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63}function i(e){var t,n,r,i,o,a,l=e.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[l-2]?2:"="===e[l-1]?1:0,a=new u(3*l/4-o),r=o>0?l-4:l;var s=0;for(t=0,n=0;r>t;t+=4,n+=3)i=c[e.charCodeAt(t)]<<18|c[e.charCodeAt(t+1)]<<12|c[e.charCodeAt(t+2)]<<6|c[e.charCodeAt(t+3)],a[s++]=i>>16&255,a[s++]=i>>8&255,a[s++]=255&i;return 2===o?(i=c[e.charCodeAt(t)]<<2|c[e.charCodeAt(t+1)]>>4,a[s++]=255&i):1===o&&(i=c[e.charCodeAt(t)]<<10|c[e.charCodeAt(t+1)]<<4|c[e.charCodeAt(t+2)]>>2,a[s++]=i>>8&255,a[s++]=255&i),a}function o(e){return s[e>>18&63]+s[e>>12&63]+s[e>>6&63]+s[63&e]}function a(e,t,n){for(var r,i=[],a=t;n>a;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],i.push(o(r));return i.join("")}function l(e){for(var t,n=e.length,r=n%3,i="",o=[],l=16383,c=0,u=n-r;u>c;c+=l)o.push(a(e,c,c+l>u?u:c+l));return 1===r?(t=e[n-1],i+=s[t>>2],i+=s[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=s[t>>10],i+=s[t>>4&63],i+=s[t<<2&63],i+="="),o.push(i),o.join("")}n.toByteArray=i,n.fromByteArray=l;var s=[],c=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array;r()},{}],2:[function(e,t,n){},{}],3:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(i()=t?o(e,t):void 0!==n?"string"==typeof r?o(e,t).fill(n,r):o(e,t).fill(n):o(e,t)}function u(e,t){if(s(t),e=o(e,0>t?0:0|m(t)),!a.TYPED_ARRAY_SUPPORT)for(var n=0;t>n;n++)e[n]=0;return e}function f(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|v(t,n);return e=o(e,r),e.write(t,n),e}function h(e,t){var n=0|m(t.length);e=o(e,n);for(var r=0;n>r;r+=1)e[r]=255&t[r];return e}function d(e,t,n,r){if(t.byteLength,0>n||t.byteLength=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),a.alloc(+e)}function v(e,t){if(a.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"binary":case"raw":case"raws":return n;case"utf8":case"utf-8":case void 0:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return $(e).length;default:if(r)return q(e).length;t=(""+t).toLowerCase(),r=!0}}function y(e,t,n){var r=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),0>=n)return"";if(n>>>=0,t>>>=0,t>=n)return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return N(this,t,n);case"ascii":return E(this,t,n);case"binary":return O(this,t,n);case"base64":return M(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function x(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r){function i(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,a=e.length,l=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,n/=2}for(var s=-1,c=0;a>n+c;c++)if(i(e,n+c)===i(t,-1===s?0:c-s)){if(-1===s&&(s=c),c-s+1===l)return(n+s)*o}else-1!==s&&(c-=c-s),s=-1;return-1}function w(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new Error("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;r>a;a++){var l=parseInt(t.substr(2*a,2),16);if(isNaN(l))return a;e[n+a]=l}return a}function k(e,t,n,r){return V(q(t,e.length-n),e,n,r)}function S(e,t,n,r){return V(G(t),e,n,r)}function C(e,t,n,r){return S(e,t,n,r)}function L(e,t,n,r){return V($(t),e,n,r)}function T(e,t,n,r){return V(Y(t,e.length-n),e,n,r)}function M(e,t,n){return 0===t&&n===e.length?X.fromByteArray(e):X.fromByteArray(e.slice(t,n))}function N(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;n>i;){var o=e[i],a=null,l=o>239?4:o>223?3:o>191?2:1;if(n>=i+l){var s,c,u,f;switch(l){case 1:128>o&&(a=o);break;case 2:s=e[i+1],128===(192&s)&&(f=(31&o)<<6|63&s,f>127&&(a=f));break;case 3:s=e[i+1],c=e[i+2],128===(192&s)&&128===(192&c)&&(f=(15&o)<<12|(63&s)<<6|63&c,f>2047&&(55296>f||f>57343)&&(a=f));break;case 4:s=e[i+1],c=e[i+2],u=e[i+3],128===(192&s)&&128===(192&c)&&128===(192&u)&&(f=(15&o)<<18|(63&s)<<12|(63&c)<<6|63&u,f>65535&&1114112>f&&(a=f))}}null===a?(a=65533,l=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=l}return A(r)}function A(e){var t=e.length;if(Q>=t)return String.fromCharCode.apply(String,e);for(var n="",r=0;t>r;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Q));return n}function E(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;n>i;i++)r+=String.fromCharCode(127&e[i]);return r}function O(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;n>i;i++)r+=String.fromCharCode(e[i]);return r}function I(e,t,n){var r=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var i="",o=t;n>o;o++)i+=U(e[o]);return i}function P(e,t,n){for(var r=e.slice(t,n),i="",o=0;oe)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,r,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||o>t)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function H(e,t,n,r){0>t&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);o>i;i++)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function W(e,t,n,r){0>t&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);o>i;i++)e[n+i]=t>>>8*(r?i:3-i)&255}function B(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(0>n)throw new RangeError("Index out of range")}function _(e,t,n,r,i){return i||B(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,i){return i||B(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,n,r,52,8),n+8}function z(e){if(e=j(e).replace(ee,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function j(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function U(e){return 16>e?"0"+e.toString(16):e.toString(16)}function q(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;r>a;a++){if(n=e.charCodeAt(a),n>55295&&57344>n){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(56320>n){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,128>n){if((t-=1)<0)break;o.push(n)}else if(2048>n){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(65536>n){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(1114112>n))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function G(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function $(e){return X.toByteArray(z(e))}function V(e,t,n,r){for(var i=0;r>i&&!(i+n>=t.length||i>=e.length);i++)t[i+n]=e[i];return i}function K(e){return e!==e}var X=e("base64-js"),Z=e("ieee754"),J=e("isarray");n.Buffer=a,n.SlowBuffer=g,n.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),n.kMaxLength=i(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,n){return l(null,e,t,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,n){return c(null,e,t,n)},a.allocUnsafe=function(e){return u(null,e)},a.allocUnsafeSlow=function(e){return u(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);o>i;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return r>n?-1:n>r?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!J(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var n;if(void 0===t)for(t=0,n=0;nt;t+=2)x(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;e>t;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},a.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?N(this,0,e):y.apply(this,arguments)},a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===a.compare(this,e)},a.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},a.prototype.compare=function(e,t,n,r,i){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),0>t||n>e.length||0>r||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,l=n-t,s=Math.min(o,l),c=this.slice(r,i),u=e.slice(t,n),f=0;s>f;++f)if(c[f]!==u[f]){o=c[f],l=u[f];break}return l>o?-1:o>l?1:0},a.prototype.indexOf=function(e,t,n){if("string"==typeof t?(n=t,t=0):t>2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:b(this,e,t,n);if("number"==typeof e)return a.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,t):b(this,[e],t,n);throw new TypeError("val must be string, number or Buffer")},a.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},a.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t=0|t,isFinite(n)?(n=0|n,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(0>n||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return S(this,e,t,n);case"binary":return C(this,e,t,n);case"base64":return L(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;a.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),e>t&&(t=e);var r;if(a.TYPED_ARRAY_SUPPORT)r=this.subarray(e,t),r.__proto__=a.prototype;else{var i=t-e;r=new a(i,void 0);for(var o=0;i>o;o++)r[o]=this[o+e]}return r},a.prototype.readUIntLE=function(e,t,n){e=0|e,t=0|t,n||R(e,t,this.length);for(var r=this[e],i=1,o=0;++o0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,n){e=0|e,t=0|t,n||R(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e=0|e,t=0|t,n||R(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),Z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),Z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),Z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),Z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t=0|t,n=0|n,!r){var i=Math.pow(2,8*n)-1;D(this,e,t,n,i,0)}var o=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+o]=e/a&255;return t+n},a.prototype.writeUInt8=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):H(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):H(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):W(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):W(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}var o=0,a=1,l=0;for(this[t]=255&e;++oe&&0===l&&0!==this[t+o-1]&&(l=1),this[t+o]=(e/a>>0)-l&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t=0|t,!r){var i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}var o=n-1,a=1,l=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)0>e&&0===l&&0!==this[t+o+1]&&(l=1),this[t+o]=(e/a>>0)-l&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):H(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):H(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):W(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=0|t,n||D(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):W(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,n){return _(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return _(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&n>r&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-tn&&r>t)for(i=o-1;i>=0;i--)e[i+t]=this[i+n];else if(1e3>o||!a.TYPED_ARRAY_SUPPORT)for(i=0;o>i;i++)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},a.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);256>i&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e=255&e);if(0>t||this.length=n)return this;t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;n>o;o++)this[o]=e;else{var l=a.isBuffer(e)?e:q(new a(e,r).toString()),s=l.length;for(o=0;n-t>o;o++)this[o+t]=l[o%s]}return this};var ee=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":1,ieee754:15,isarray:16}],4:[function(e,t,n){"use strict";function r(e){return e=e||{},"function"!=typeof e.codeMirrorInstance||"function"!=typeof e.codeMirrorInstance.defineMode?void console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`"):(String.prototype.includes||(String.prototype.includes=function(){return-1!==String.prototype.indexOf.apply(this,arguments)}),void e.codeMirrorInstance.defineMode("spell-checker",function(t){if(!r.aff_loading){r.aff_loading=!0;var n=new XMLHttpRequest;n.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),n.onload=function(){4===n.readyState&&200===n.status&&(r.aff_data=n.responseText,r.num_loaded++,2==r.num_loaded&&(r.typo=new i("en_US",r.aff_data,r.dic_data,{platform:"any"})))},n.send(null)}if(!r.dic_loading){r.dic_loading=!0;var o=new XMLHttpRequest;o.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),o.onload=function(){4===o.readyState&&200===o.status&&(r.dic_data=o.responseText,r.num_loaded++,2==r.num_loaded&&(r.typo=new i("en_US",r.aff_data,r.dic_data,{platform:"any"})))},o.send(null)}var a='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',l={token:function(e){var t=e.peek(),n="";if(a.includes(t))return e.next(),null;for(;null!=(t=e.peek())&&!a.includes(t);)n+=t,e.next();return r.typo&&!r.typo.check(n)?"spell-error":null}},s=e.codeMirrorInstance.getMode(t,t.backdrop||"text/plain");return e.codeMirrorInstance.overlayMode(s,l,!0)}))}var i=e("typo-js");r.num_loaded=0,r.aff_loading=!1,r.dic_loading=!1,r.aff_data="",r.dic_data="",r.typo,t.exports=r},{"typo-js":18}],5:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";function t(e){var t=e.getWrapperElement();e.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",e.refresh()}function n(e){var t=e.getWrapperElement();t.className=t.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var n=e.state.fullScreenRestore;t.style.width=n.width,t.style.height=n.height,window.scrollTo(n.scrollLeft,n.scrollTop),e.refresh()}e.defineOption("fullScreen",!1,function(r,i,o){o==e.Init&&(o=!1),!o!=!i&&(i?t(r):n(r))})})},{"../../lib/codemirror":10}],6:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function n(e){t(e);var n=e.state.placeholder=document.createElement("pre");n.style.cssText="height: 0; overflow: visible",n.className="CodeMirror-placeholder";var r=e.getOption("placeholder");"string"==typeof r&&(r=document.createTextNode(r)),n.appendChild(r),e.display.lineSpace.insertBefore(n,e.display.lineSpace.firstChild)}function r(e){o(e)&&n(e)}function i(e){var r=e.getWrapperElement(),i=o(e);r.className=r.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?n(e):t(e)}function o(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",function(n,o,a){var l=a&&a!=e.Init;if(o&&!l)n.on("blur",r),n.on("change",i),n.on("swapDoc",i),i(n);else if(!o&&l){n.off("blur",r),n.off("change",i),n.off("swapDoc",i),t(n);var s=n.getWrapperElement();s.className=s.className.replace(" CodeMirror-empty","")}o&&!n.hasFocus()&&r(n)})})},{"../../lib/codemirror":10}],7:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";var t=/^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\s*)/,n=/^(\s*)(>[> ]*|[*+-]|(\d+)[.)])(\s*)$/,r=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],l=0;l")>=0?d[2]:parseInt(d[3],10)+1+d[4];a[l]="\n"+p+g+m}}i.replaceSelections(a)}})},{"../../lib/codemirror":10}],8:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,n,r){return{startState:function(){return{base:e.startState(t),overlay:e.startState(n),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(r){return{base:e.copyState(t,r.base),overlay:e.copyState(n,r.overlay),basePos:r.basePos,baseCur:null,overlayPos:r.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)=n.line,d=h?n:s(f,0),p=e.markText(u,d,{className:o});if(null==r?i.push(p):i.splice(r++,0,p),h)break;a=f}}function i(e){for(var t=e.state.markedSelection,n=0;n1)return o(e);var t=e.getCursor("start"),n=e.getCursor("end"),a=e.state.markedSelection;if(!a.length)return r(e,t,n);var s=a[0].find(),u=a[a.length-1].find();if(!s||!u||n.line-t.line=0||c(n,s.from)<=0)return o(e);for(;c(t,s.from)>0;)a.shift().clear(),s=a[0].find();for(c(t,s.from)<0&&(s.to.line-t.line0&&(n.line-u.from.linebo&&setTimeout(function(){s.display.input.reset(!0)},20),jt(this),Ki(),bt(this),this.curOp.forceUpdate=!0,Xr(this,i),r.autofocus&&!Ao||s.hasFocus()?setTimeout(Bi(vn,this),20):yn(this);for(var u in ta)ta.hasOwnProperty(u)&&ta[u](this,r[u],na);k(this),r.finishInit&&r.finishInit(this);for(var f=0;fbo&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),wo||go&&Ao||(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null, +r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,n.init(r)}function n(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),r(t)}function r(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,_e(e,100),e.state.modeGen++,e.curOp&&Dt(e)}function i(e){e.options.lineWrapping?(Ja(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Za(e.display.wrapper,"CodeMirror-wrap"),h(e)),a(e),Dt(e),lt(e),setTimeout(function(){y(e)},100)}function o(e){var t=yt(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/xt(e.display)-3);return function(i){if(kr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;at.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function d(e){var t=Pi(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function p(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+qe(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ye(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function m(e,t,n){this.cm=n;var r=this.vert=ji("div",[ji("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=ji("div",[ji("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(r),e(i),Ea(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ea(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,xo&&8>bo&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Za(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Ea(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?on(t,e):rn(t,e)},t),t.display.scrollbars.addClass&&Ja(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=p(e));var n=e.display.barWidth,r=e.display.barHeight;x(e,t);for(var i=0;4>i&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&O(e),x(e,p(e)),n=e.display.barWidth,r=e.display.barHeight}function x(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function b(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ue(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=ni(t,r),a=ni(t,i);if(n&&n.ensure){var l=n.ensure.from.line,s=n.ensure.to.line;o>l?(o=l,a=ni(t,ri(Zr(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=ni(t,ri(Zr(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function w(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==zt(e))return!1;k(e)&&(Wt(e),t.dims=P(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Wo&&(o=br(e.doc,o),a=wr(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ft(e,o,a),n.viewOffset=ri(Zr(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=zt(e);if(!l&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=Gi();return s>4&&(n.lineDiv.style.display="none"),R(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,c&&Gi()!=c&&c.offsetHeight&&c.focus(),Ui(n.cursorDiv),Ui(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,_e(e,400)),n.updateLineNumbers=null,!0}function N(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=$e(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+qe(e.display)-Ve(e),n.top)}),t.visible=b(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&M(e,t);r=!1){O(e);var i=p(e);Re(e),y(e,i),E(e,i)}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var n=new L(e,t);if(M(e,n)){O(e),N(e,n);var r=p(e);Re(e),y(e,r),E(e,r),n.finish()}}function E(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ye(e)+"px"}function O(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;rbo){var a=o.node.offsetTop+o.node.offsetHeight;i=a-n,n=a}else{var l=o.node.getBoundingClientRect();i=l.bottom-l.top}var s=o.line.height-i;if(2>i&&(i=yt(t)),(s>.001||-.001>s)&&(ei(o.line,i),I(o.line),o.rest))for(var c=0;c=t&&f.lineNumber;f.changes&&(Pi(f.changes,"gutter")>-1&&(h=!1),D(e,f,c,n)),h&&(Ui(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(S(e.options,c)))),l=f.node.nextSibling}else{var d=U(e,f,c,n);a.insertBefore(d,l)}c+=f.size}for(;l;)l=r(l)}function D(e,t,n,r){for(var i=0;ibo&&(e.node.style.zIndex=2)),e.node}function W(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=H(e);e.background=n.insertBefore(ji("div",null,t),n.firstChild)}}function B(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Br(e,t)}function _(e,t){var n=t.text.className,r=B(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,F(t)):n&&(t.text.className=n)}function F(e){W(e),e.line.wrapClass?H(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function z(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=H(t);t.gutterBackground=ji("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=H(t),a=t.gutter=ji("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(ji("div",S(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var l=0;l1)if(Fo&&Fo.text.join("\n")==t){if(r.ranges.length%Fo.text.length==0){s=[];for(var c=0;c=0;c--){var u=r.ranges[c],f=u.from(),h=u.to();u.empty()&&(n&&n>0?f=Bo(f.line,f.ch-n):e.state.overwrite&&!a?h=Bo(h.line,Math.min(Zr(o,h.line).text.length,h.ch+Ii(l).length)):Fo&&Fo.lineWise&&Fo.text.join("\n")==t&&(f=h=Bo(f.line,0)));var d=e.curOp.updateInput,p={from:f,to:h,text:s?s[c%s.length]:l,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Tn(e.doc,p),Ci(e,"inputRead",e,p)}t&&!a&&Q(e,t),Bn(e),e.curOp.updateInput=d,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function J(e,t){var n=e.clipboardData&&e.clipboardData.getData("text/plain");return n?(e.preventDefault(),t.isReadOnly()||t.options.disableInput||At(t,function(){Z(t,n,0,null,"paste")}),!0):void 0}function Q(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l-1){a=Fn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Zr(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Fn(e,i.head.line,"smart"));a&&Ci(e,"electricInput",e,i.head.line)}}}function ee(e){for(var t=[],n=[],r=0;ri?c.map:u[i],a=0;ai?e.line:e.rest[i]),f=o[a]+r;return(0>r||l!=t)&&(f=o[a+(r?1:0)]),Bo(s,f)}}}var i=e.text.firstChild,o=!1;if(!t||!Va(i,t))return ae(Bo(ti(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[n],n=0,!t)){var a=e.rest?Ii(e.rest):e.line;return ae(Bo(ti(a),a.text.length),o)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,n&&(n=l.nodeValue.length));s.parentNode!=i;)s=s.parentNode;var c=e.measure,u=c.maps,f=r(l,s,n);if(f)return ae(f,o);for(var h=s.nextSibling,d=l?l.nodeValue.length-n:0;h;h=h.nextSibling){if(f=r(h,h.firstChild,0))return ae(Bo(f.line,f.ch-d),o);d+=h.textContent.length}for(var p=s.previousSibling,d=n;p;p=p.previousSibling){if(f=r(p,p.firstChild,-1))return ae(Bo(f.line,f.ch+d),o);d+=h.textContent.length}}function ce(e,t,n,r,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return""==n&&(n=t.textContent.replace(/\u200b/g,"")),void(l+=n);var u,f=t.getAttribute("cm-marker");if(f){var h=e.findMarks(Bo(r,0),Bo(i+1,0),o(+f));return void(h.length&&(u=h[0].find())&&(l+=Jr(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var d=0;d=0){var a=K(o.from(),i.from()),l=V(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;t>=r&&--t,e.splice(--r,2,new fe(s?l:a,s?a:l))}}return new ue(e,t)}function de(e,t){return new ue([new fe(e,t||e)],0)}function pe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function me(e,t){if(t.linen?Bo(n,Zr(e,n).text.length):ge(t,Zr(e,t.line).text.length)}function ge(e,t){var n=e.ch;return null==n||n>t?Bo(e.line,t):0>n?Bo(e.line,0):e}function ve(e,t){return t>=e.first&&t=t.ch:l.to>t.ch))){if(i&&(Pa(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var c,u=s.find(0>r?1:-1);if((0>r?s.inclusiveRight:s.inclusiveLeft)&&(u=Pe(e,u,-r,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=_o(u,n))&&(0>r?0>c:c>0))return Oe(e,u,t,r,i)}var f=s.find(0>r?-1:1);return(0>r?s.inclusiveLeft:s.inclusiveRight)&&(f=Pe(e,f,r,f.line==t.line?o:null)),f?Oe(e,f,t,r,i):null}}return t}function Ie(e,t,n,r,i){var o=r||1,a=Oe(e,t,n,o,i)||!i&&Oe(e,t,n,o,!0)||Oe(e,t,n,-o,i)||!i&&Oe(e,t,n,-o,!0);return a?a:(e.cantEdit=!0,Bo(e.first,0))}function Pe(e,t,n,r){return 0>n&&0==t.ch?t.line>e.first?me(e,Bo(t.line-1)):null:n>0&&t.ch==(r||Zr(e,t.line)).text.length?t.line=e.display.viewTo||l.to().linet&&(t=0),t=Math.round(t),r=Math.round(r),l.appendChild(ji("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==n?u-e:n)+"px; height: "+(r-t)+"px"))}function i(t,n,i){function o(n,r){return ht(e,Bo(t,n),"div",f,r)}var l,s,f=Zr(a,t),h=f.text.length;return eo(ii(f),n||0,null==i?h:i,function(e,t,a){var f,d,p,m=o(e,"left");if(e==t)f=m,d=p=m.left;else{if(f=o(t-1,"right"),"rtl"==a){var g=m;m=f,f=g}d=m.left,p=f.right}null==n&&0==e&&(d=c),f.top-m.top>3&&(r(d,m.top,null,m.bottom),d=c,m.bottoms.bottom||f.bottom==s.bottom&&f.right>s.right)&&(s=f),c+1>d&&(d=c),r(d,f.top,p-d,f.bottom)}),{start:l,end:s}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=Ge(e.display),c=s.left,u=Math.max(o.sizerWidth,$e(e)-o.sizer.offsetLeft)-s.right,f=t.from(),h=t.to();if(f.line==h.line)i(f.line,f.ch,h.ch);else{var d=Zr(a,f.line),p=Zr(a,h.line),m=yr(d)==yr(p),g=i(f.line,f.ch,m?d.text.length+1:null).end,v=i(h.line,m?0:null,h.ch).start;m&&(g.top0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function _e(e,t){e.doc.mode.startState&&e.doc.frontier=e.display.viewTo)){var n=+new Date+e.options.workTime,r=sa(t.mode,je(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength,s=Rr(e,o,l?sa(t.mode,r):r,!0);o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var f=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!f&&hn?(_e(e,e.options.workDelay),!0):void 0}),i.length&&At(e,function(){for(var t=0;ta;--l){if(l<=o.first)return o.first;var s=Zr(o,l-1);if(s.stateAfter&&(!n||l<=o.frontier))return l;var c=Fa(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=l-1,r=c)}return i}function je(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var o=ze(e,t,n),a=o>r.first&&Zr(r,o-1).stateAfter;return a=a?sa(r.mode,a):ca(r.mode),r.iter(o,t,function(n){Hr(e,n.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o2&&o.push((s.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Xe(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Ze(e,t){t=yr(t);var n=ti(t),r=e.display.externalMeasured=new Pt(e.doc,t,n);r.lineN=n;var i=r.built=Br(e,r);return r.text=i.pre,qi(e.display.lineMeasure,i.pre),r}function Je(e,t,n,r){return tt(e,et(e,t),n,r)}function Qe(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt?(i=0,o=1,a="left"):c>t?(i=t-s,o=i+1):(l==e.length-3||t==c&&e[l+3]>t)&&(o=c-s,i=o-1,t>=c&&(a="right")),null!=i){if(r=e[l+2],s==c&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)r=e[(l-=3)+2],a="left";if("right"==n&&i==c-s)for(;lu;u++){for(;l&&zi(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+sbo&&0==l&&s==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(xo&&e.options.lineWrapping){var f=qa(a,l,s).getClientRects();i=f.length?f["right"==r?f.length-1:0]:qo}else i=qa(a,l,s).getBoundingClientRect()||qo;if(i.left||i.right||0==l)break;s=l,l-=1,c="right"}xo&&11>bo&&(i=it(e.display.measure,i))}else{l>0&&(c=r="right");var f;i=e.options.lineWrapping&&(f=a.getClientRects()).length>1?f["right"==r?f.length-1:0]:a.getBoundingClientRect()}if(xo&&9>bo&&!l&&(!i||!i.left&&!i.right)){var h=a.parentNode.getClientRects()[0];i=h?{left:h.left,right:h.left+xt(e.display),top:h.top,bottom:h.bottom}:qo}for(var d=i.top-t.rect.top,p=i.bottom-t.rect.top,m=(d+p)/2,g=t.view.measure.heights,u=0;un.from?a(e-1):a(e,r)}r=r||Zr(e.doc,t.line),i||(i=et(e,r));var s=ii(r),c=t.ch;if(!s)return a(c);var u=co(s,c),f=l(c,u);return null!=al&&(f.other=l(c,al)),f}function pt(e,t){var n=0,t=me(e.doc,t);e.options.lineWrapping||(n=xt(e.display)*t.ch);var r=Zr(e.doc,t.line),i=ri(r)+Ue(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function mt(e,t,n,r){var i=Bo(e,t);return i.xRel=r,n&&(i.outside=!0),i}function gt(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,0>n)return mt(r.first,0,!0,-1);var i=ni(r,n),o=r.first+r.size-1;if(i>o)return mt(r.first+r.size-1,Zr(r,o).text.length,!0,1);0>t&&(t=0);for(var a=Zr(r,i);;){var l=vt(e,a,i,t,n),s=gr(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=ti(a=c.to.line)}}function vt(e,t,n,r,i){function o(r){var i=dt(e,Bo(n,r),"line",t,c);return l=!0,a>i.bottom?i.left-s:ag)return mt(n,d,v,1);for(;;){if(u?d==h||d==fo(t,h,1):1>=d-h){for(var y=p>r||g-r>=r-p?h:d,x=r-(y==h?p:g);zi(t.text.charAt(y));)++y;var b=mt(n,y,y==h?m:v,-1>x?-1:x>1?1:0);return b}var w=Math.ceil(f/2),k=h+w;if(u){k=h;for(var S=0;w>S;++S)k=fo(t,k,1)}var C=o(k);C>r?(d=k,g=C,(v=l)&&(g+=1e3),f=w):(h=k,p=C,m=l,f-=w)}}function yt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==zo){zo=ji("pre");for(var t=0;49>t;++t)zo.appendChild(document.createTextNode("x")),zo.appendChild(ji("br"));zo.appendChild(document.createTextNode("x"))}qi(e.measure,zo);var n=zo.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),Ui(e.measure),n||1}function xt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=ji("span","xxxxxxxxxx"),n=ji("pre",[t]);qi(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function bt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Yo},Go?Go.ops.push(e.curOp):e.curOp.ownsGroup=Go={ops:[e.curOp],delayedCallbacks:[]}}function wt(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new L(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Lt(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function Tt(e){var t=e.cm,n=t.display;e.updatedDisplay&&O(t),e.barMeasure=p(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Je(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ye(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-$e(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection(e.focus))}function Mt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLefto;o=r){var a=new Pt(e.doc,Zr(e.doc,o),o);r=o+a.size,i.push(a)}return i}function Dt(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&nt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Wo&&br(e.doc,t)i.viewFrom?Wt(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Wt(e);else if(t<=i.viewFrom){var o=_t(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Wt(e)}else if(n>=i.viewTo){var o=_t(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Wt(e)}else{var a=_t(e,t,t,-1),l=_t(e,n,n+r,1);a&&l?(i.view=i.view.slice(0,a.index).concat(Rt(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):Wt(e)}var s=i.externalMeasured;s&&(n=i.lineN&&t=r.viewTo)){var o=r.view[Bt(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Pi(a,n)&&a.push(n)}}}function Wt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var n=e.display.view,r=0;rt)return r}function _t(e,t,n,r){var i,o=Bt(e,t),a=e.display.view;if(!Wo||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var l=0,s=e.display.viewFrom;o>l;l++)s+=a[l].size;if(s!=t){if(r>0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;br(e.doc,n)!=n;){if(o==(0>r?0:a.length-1))return null;n+=r*a[o-(0>r?1:0)].size,o+=r}return{index:o,lineN:n}}function Ft(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=Rt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Rt(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Bt(e,n)))),r.viewTo=n}function zt(e){for(var t=e.display.view,n=0,r=0;r400}var i=e.display;Ea(i.scroller,"mousedown",Et(e,$t)),xo&&11>bo?Ea(i.scroller,"dblclick",Et(e,function(t){if(!Ti(e,t)){var n=Yt(e,t);if(n&&!Jt(e,t)&&!Gt(e.display,t)){Ma(t);var r=e.findWordAt(n);be(e.doc,r.anchor,r.head)}}})):Ea(i.scroller,"dblclick",function(t){Ti(e,t)||Ma(t)}),Do||Ea(i.scroller,"contextmenu",function(t){xn(e,t)});var o,a={end:0};Ea(i.scroller,"touchstart",function(t){if(!Ti(e,t)&&!n(t)){clearTimeout(o);var r=+new Date;i.activeTouch={start:r,moved:!1,prev:r-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Ea(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Ea(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!Gt(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,l=e.coordsChar(i.activeTouch,"page");a=!o.prev||r(o,o.prev)?new fe(l,l):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(l):new fe(Bo(l.line,0),me(e.doc,Bo(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Ma(n)}t()}),Ea(i.scroller,"touchcancel",t),Ea(i.scroller,"scroll",function(){i.scroller.clientHeight&&(rn(e,i.scroller.scrollTop),on(e,i.scroller.scrollLeft,!0),Pa(e,"scroll",e))}),Ea(i.scroller,"mousewheel",function(t){an(e,t)}),Ea(i.scroller,"DOMMouseScroll",function(t){an(e,t)}),Ea(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Ti(e,t)||Aa(t)},over:function(t){Ti(e,t)||(tn(e,t),Aa(t))},start:function(t){en(e,t)},drop:Et(e,Qt),leave:function(t){Ti(e,t)||nn(e)}};var l=i.input.getField();Ea(l,"keyup",function(t){pn.call(e,t)}),Ea(l,"keydown",Et(e,hn)),Ea(l,"keypress",Et(e,mn)),Ea(l,"focus",Bi(vn,e)),Ea(l,"blur",Bi(yn,e))}function Ut(t,n,r){var i=r&&r!=e.Init;if(!n!=!i){var o=t.display.dragFunctions,a=n?Ea:Ia;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function qt(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Gt(e,t){for(var n=wi(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Yt(e,t,n,r){var i=e.display;if(!n&&"true"==wi(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=gt(e,o,a);if(r&&1==c.xRel&&(s=Zr(e.doc,c.line).text).length==c.ch){var u=Fa(s,s.length,e.options.tabSize)-s.length;c=Bo(c.line,Math.max(0,Math.round((o-Ge(e.display).left)/xt(e.display))-u))}return c}function $t(e){var t=this,n=t.display;if(!(Ti(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.shift=e.shiftKey,Gt(n,e))return void(wo||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100)));if(!Jt(t,e)){var r=Yt(t,e);switch(window.focus(),ki(e)){case 1:t.state.selectingText?t.state.selectingText(e):r?Vt(t,e,r):wi(e)==n.scroller&&Ma(e);break;case 2:wo&&(t.state.lastMiddleDown=+new Date),r&&be(t.doc,r),setTimeout(function(){n.input.focus()},20),Ma(e);break;case 3:Do?xn(t,e):gn(t)}}}}function Vt(e,t,n){xo?setTimeout(Bi(X,e),0):e.curOp.focus=Gi();var r,i=+new Date;Uo&&Uo.time>i-400&&0==_o(Uo.pos,n)?r="triple":jo&&jo.time>i-400&&0==_o(jo.pos,n)?(r="double",Uo={time:i,pos:n}):(r="single",jo={time:i,pos:n});var o,a=e.doc.sel,l=Eo?t.metaKey:t.ctrlKey;e.options.dragDrop&&el&&!e.isReadOnly()&&"single"==r&&(o=a.contains(n))>-1&&(_o((o=a.ranges[o]).from(),n)<0||n.xRel>0)&&(_o(o.to(),n)>0||n.xRel<0)?Kt(e,t,n,l):Xt(e,t,n,r,l)}function Kt(e,t,n,r){var i=e.display,o=+new Date,a=Et(e,function(l){wo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ia(document,"mouseup",a),Ia(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(Ma(l),!r&&+new Date-200=p;p++){var v=Zr(c,p).text,y=za(v,s,o);s==d?i.push(new fe(Bo(p,y),Bo(p,y))):v.length>y&&i.push(new fe(Bo(p,y),Bo(p,za(v,d,o))))}i.length||i.push(new fe(n,n)),Te(c,he(h.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var x=u,b=x.anchor,w=t;if("single"!=r){if("double"==r)var k=e.findWordAt(t);else var k=new fe(Bo(t.line,0),me(c,Bo(t.line+1,0)));_o(k.anchor,b)>0?(w=k.head,b=K(x.from(),k.anchor)):(w=k.anchor,b=V(x.to(),k.head))}var i=h.ranges.slice(0);i[f]=new fe(me(c,b),w),Te(c,he(i,f),Ba)}}function a(t){var n=++y,i=Yt(e,t,!0,"rect"==r);if(i)if(0!=_o(i,g)){e.curOp.focus=Gi(),o(i);var l=b(s,c);(i.line>=l.to||i.linev.bottom?20:0;u&&setTimeout(Et(e,function(){y==n&&(s.scroller.scrollTop+=u,a(t))}),50)}}function l(t){e.state.selectingText=!1,y=1/0,Ma(t),s.input.focus(),Ia(document,"mousemove",x),Ia(document,"mouseup",w),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;Ma(t);var u,f,h=c.sel,d=h.ranges;if(i&&!t.shiftKey?(f=c.sel.contains(n),u=f>-1?d[f]:new fe(n,n)):(u=c.sel.primary(),f=c.sel.primIndex),Oo?t.shiftKey&&t.metaKey:t.altKey)r="rect",i||(u=new fe(n,n)),n=Yt(e,t,!0,!0),f=-1;else if("double"==r){var p=e.findWordAt(n);u=e.display.shift||c.extend?xe(c,u,p.anchor,p.head):p}else if("triple"==r){var m=new fe(Bo(n.line,0),me(c,Bo(n.line+1,0)));u=e.display.shift||c.extend?xe(c,u,m.anchor,m.head):m}else u=xe(c,u,n);i?-1==f?(f=d.length,Te(c,he(d.concat([u]),f),{scroll:!1,origin:"*mouse"})):d.length>1&&d[f].empty()&&"single"==r&&!t.shiftKey?(Te(c,he(d.slice(0,f).concat(d.slice(f+1)),0),{scroll:!1,origin:"*mouse"}),h=c.sel):ke(c,f,u,Ba):(f=0,Te(c,new ue([u],0),Ba),h=c.sel);var g=n,v=s.wrapper.getBoundingClientRect(),y=0,x=Et(e,function(e){ki(e)?a(e):l(e)}),w=Et(e,l);e.state.selectingText=w,Ea(document,"mousemove",x),Ea(document,"mouseup",w)}function Zt(e,t,n,r){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Ma(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!Ni(e,n))return bi(t);o-=l.top-a.viewOffset;for(var s=0;s=i){var u=ni(e.doc,o),f=e.options.gutters[s];return Pa(e,n,e,u,f,t),bi(t)}}}function Jt(e,t){return Zt(e,t,"gutterClick",!0)}function Qt(e){var t=this;if(nn(t),!Ti(t,e)&&!Gt(t.display,e)){Ma(e),xo&&($o=+new Date);var n=Yt(t,e,!0),r=e.dataTransfer.files;if(n&&!t.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,l=function(e,r){if(!t.options.allowDropFileTypes||-1!=Pi(t.options.allowDropFileTypes,e.type)){var l=new FileReader;l.onload=Et(t,function(){var e=l.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[r]=e,++a==i){n=me(t.doc,n);var s={from:n,to:n,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Tn(t.doc,s),Le(t.doc,de(n,Qo(s)))}}),l.readAsText(e)}},s=0;i>s;++s)l(r[s],s);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(Eo?e.altKey:e.ctrlKey))var c=t.listSelections();if(Me(t.doc,de(n,n)),c)for(var s=0;sa.clientWidth,s=a.scrollHeight>a.clientHeight;if(r&&l||i&&s){if(i&&Eo&&wo)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var f=0;fh?d=Math.max(0,d+h-50):p=Math.min(e.doc.height,p+h+50),A(e,{top:d,bottom:p})}20>Vo&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,n=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,n&&(Ko=(Ko*Vo+n)/(Vo+1),++Vo)}},200)):(o.wheelDX+=r,o.wheelDY+=i))}}function ln(e,t,n){if("string"==typeof t&&(t=ua[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ha}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function sn(e,t,n){for(var r=0;rbo&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var r=un(t,e);Co&&(Jo=r?n:null,!r&&88==n&&!rl&&(Eo?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||dn(t)}}function dn(e){function t(e){18!=e.keyCode&&e.altKey||(Za(n,"CodeMirror-crosshair"),Ia(document,"keyup",t),Ia(document,"mouseover",t))}var n=e.display.lineDiv;Ja(n,"CodeMirror-crosshair"),Ea(document,"keyup",t),Ea(document,"mouseover",t)}function pn(e){16==e.keyCode&&(this.doc.sel.shift=!1),Ti(this,e)}function mn(e){var t=this;if(!(Gt(t.display,e)||Ti(t,e)||e.ctrlKey&&!e.altKey||Eo&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(Co&&n==Jo)return Jo=null,void Ma(e);if(!Co||e.which&&!(e.which<10)||!un(t,e)){var i=String.fromCharCode(null==r?n:r);fn(t,e,i)||t.display.input.onKeyPress(e)}}}function gn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,yn(e))},100)}function vn(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Pa(e,"focus",e),e.state.focused=!0,Ja(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),wo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Be(e))}function yn(e){e.state.delayingBlurEvent||(e.state.focused&&(Pa(e,"blur",e),e.state.focused=!1,Za(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function xn(e,t){Gt(e.display,t)||bn(e,t)||Ti(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function bn(e,t){return Ni(e,"gutterContextMenu")?Zt(e,t,"gutterContextMenu",!1):!1}function wn(e,t){if(_o(e,t.from)<0)return e;if(_o(e,t.to)<=0)return Qo(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Qo(t).ch-t.to.ch),Bo(n,r)}function kn(e,t){for(var n=[],r=0;r=0;--i)Mn(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Mn(e,t)}}function Mn(e,t){if(1!=t.text.length||""!=t.text[0]||0!=_o(t.from,t.to)){var n=kn(e,t);ci(e,t,n,e.cm?e.cm.curOp.id:NaN),En(e,t,n,or(e,t));var r=[];Kr(e,function(e,n){n||-1!=Pi(r,e.history)||(xi(e.history,t),r.push(e.history)),En(e,t,null,or(e,t))})}}function Nn(e,t,n){if(!e.cm||!e.cm.state.suppressEdits){for(var r,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s=0;--s){var f=r.changes[s];if(f.origin=t,u&&!Ln(e,f,!1))return void(a.length=0);c.push(ai(e,f));var h=s?kn(e,f):Ii(a);En(e,f,h,lr(e,f)),!s&&e.cm&&e.cm.scrollIntoView({from:f.from,to:Qo(f)});var d=[];Kr(e,function(e,t){t||-1!=Pi(d,e.history)||(xi(e.history,f),d.push(e.history)),En(e,f,null,lr(e,f))})}}}}function An(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Ri(e.sel.ranges,function(e){return new fe(Bo(e.anchor.line+t,e.anchor.ch),Bo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:Bo(o,Zr(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Jr(e,t.from,t.to),n||(n=kn(e,t)),e.cm?On(e.cm,t,r):Yr(e,t,r),Me(e,n,Wa)}}function On(e,t,n){var r=e.doc,i=e.display,a=t.from,l=t.to,s=!1,c=a.line;e.options.lineWrapping||(c=ti(yr(Zr(r,a.line))),r.iter(c,l.line+1,function(e){return e==i.maxLine?(s=!0,!0):void 0})),r.sel.contains(t.from,t.to)>-1&&Mi(e),Yr(r,t,n,o(e)),e.options.lineWrapping||(r.iter(c,a.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,a.line),_e(e,400);var u=t.text.length-(l.line-a.line)-1;t.full?Dt(e):a.line!=l.line||1!=t.text.length||Gr(e.doc,t)?Dt(e,a.line,l.line+1,u):Ht(e,a.line,"text");var h=Ni(e,"changes"),d=Ni(e,"change");if(d||h){var p={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};d&&Ci(e,"change",e,p),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function In(e,t,n,r,i){if(r||(r=n),_o(r,n)<0){var o=r;r=n,n=o}"string"==typeof t&&(t=e.splitLines(t)),Tn(e,{from:n,to:r,text:t,origin:i})}function Pn(e,t){if(!Ti(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!Mo){var o=ji("div","​",null,"position: absolute; top: "+(t.top-n.viewOffset-Ue(e.display))+"px; height: "+(t.bottom-t.top+Ye(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Rn(e,t,n,r){null==r&&(r=0);for(var i=0;5>i;i++){var o=!1,a=dt(e,t),l=n&&n!=t?dt(e,n):a,s=Hn(e,Math.min(a.left,l.left),Math.min(a.top,l.top)-r,Math.max(a.left,l.left),Math.max(a.bottom,l.bottom)+r),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=s.scrollTop&&(rn(e,s.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=s.scrollLeft&&(on(e,s.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function Dn(e,t,n,r,i){var o=Hn(e,t,n,r,i);null!=o.scrollTop&&rn(e,o.scrollTop),null!=o.scrollLeft&&on(e,o.scrollLeft)}function Hn(e,t,n,r,i){var o=e.display,a=yt(e.display);0>n&&(n=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=Ve(e),c={};i-n>s&&(i=n+s);var u=e.doc.height+qe(o),f=a>n,h=i>u-a;if(l>n)c.scrollTop=f?0:n;else if(i>l+s){var d=Math.min(n,(h?u:i)-s);d!=l&&(c.scrollTop=d)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=$e(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=r-t>m;return g&&(r=t+m),10>t?c.scrollLeft=0:p>t?c.scrollLeft=Math.max(0,t-(g?0:10)):r>m+p-3&&(c.scrollLeft=r+(g?0:10)-m),c}function Wn(e,t,n){null==t&&null==n||_n(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=n&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+n)}function Bn(e){_n(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?Bo(t.line,t.ch-1):t,r=Bo(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function _n(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=pt(e,t.from),r=pt(e,t.to),i=Hn(e,Math.min(n.left,r.left),Math.min(n.top,r.top)-t.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Fn(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=je(e,t):n="prev");var a=e.options.tabSize,l=Zr(o,t),s=Fa(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(r||/\S/.test(l.text)){if("smart"==n&&(c=o.mode.indent(i,l.text.slice(u.length),l.text),c==Ha||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?Fa(Zr(o,t-1).text,null,a):0:"add"==n?c=s+e.options.indentUnit:"subtract"==n?c=s-e.options.indentUnit:"number"==typeof n&&(c=s+n),c=Math.max(0,c);var f="",h=0;if(e.options.indentWithTabs)for(var d=Math.floor(c/a);d;--d)h+=a,f+=" ";if(c>h&&(f+=Oi(c-h)),f!=u)return In(o,f,Bo(t,0),Bo(t,u.length),"+input"),l.stateAfter=null,!0;for(var d=0;d=0;t--)In(e.doc,"",r[t].from,r[t].to,"+delete");Bn(e)})}function Un(e,t,n,r,i){function o(){var t=l+n;return t=e.first+e.size?!1:(l=t,u=Zr(e,t))}function a(e){var t=(i?fo:ho)(u,s,n,!0);if(null==t){if(e||!o())return!1;s=i?(0>n?io:ro)(u):0>n?u.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,c=n,u=Zr(e,l);if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var f=null,h="group"==r,d=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(0>n)||a(!p);p=!1){var m=u.text.charAt(s)||"\n",g=_i(m,d)?"w":h&&"\n"==m?"n":!h||/\s/.test(m)?null:"p";if(!h||p||g||(g="s"),f&&f!=g){0>n&&(n=1,a());break}if(g&&(f=g),n>0&&!a(!p))break}var v=Ie(e,Bo(l,s),t,c,!0);return _o(t,v)||(v.hitSide=!0),v}function qn(e,t,n,r){var i,o=e.doc,a=t.left;if("page"==r){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+n*(l-(0>n?1.5:.5)*yt(e.display))}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){var s=gt(e,a,i);if(!s.outside)break;if(0>n?0>=i:i>=o.height){s.hitSide=!0;break}i+=5*n}return s}function Gn(t,n,r,i){e.defaults[t]=n,r&&(ta[t]=i?function(e,t,n){n!=na&&r(e,t,n)}:r)}function Yn(e){for(var t,n,r,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=ji("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(vr(e,t.line,t,n,o)||t.line!=n.line&&vr(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Wo=!0}o.addToHistory&&ci(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l,s=t.line,c=e.cm;if(e.iter(s,n.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&yr(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&ei(e,0),nr(e,new Qn(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s}),o.collapsed&&e.iter(t.line,n.line+1,function(t){kr(e,t)&&ei(t,0)}),o.clearOnEnter&&Ea(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Ho=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ga,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)Dt(c,t.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=n.line;u++)Ht(c,u,"text");o.atomic&&Ae(c.doc),Ci(c,"markerAdded",c,o)}return o}function Kn(e,t,n,r,i){r=Wi(r),r.shared=!1;var o=[Vn(e,t,n,r,i)],a=o[0],l=r.widgetNode;return Kr(e,function(e){l&&(r.widgetNode=l.cloneNode(!0)),o.push(Vn(e,me(e,t),me(e,n),r,i));for(var s=0;s=t:o.to>t);(r||(r=[])).push(new Qn(a,o.from,s?null:o.to))}}return r}function ir(e,t,n){if(e)for(var r,i=0;i=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&l)for(var f=0;ff;++f)p.push(m);p.push(s)}return p}function ar(e){for(var t=0;t0)){var u=[s,1],f=_o(c.from,l.from),h=_o(c.to,l.to);(0>f||!a.inclusiveLeft&&!f)&&u.push({from:c.from,to:l.from}),(h>0||!a.inclusiveRight&&!h)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-1}}return i}function cr(e){var t=e.markedSpans;if(t){for(var n=0;n=0&&0>=f||0>=u&&f>=0)&&(0>=u&&(s.marker.inclusiveRight&&i.inclusiveLeft?_o(c.to,n)>=0:_o(c.to,n)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?_o(c.from,r)<=0:_o(c.from,r)<0)))return!0}}}function yr(e){for(var t;t=mr(e);)e=t.find(-1,!0).line;return e}function xr(e){for(var t,n;t=gr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function br(e,t){var n=Zr(e,t),r=yr(n);return n==r?t:ti(r)}function wr(e,t){if(t>e.lastLine())return t;var n,r=Zr(e,t);if(!kr(e,r))return t;for(;n=gr(r);)r=n.find(1,!0).line;return ti(r)+1}function kr(e,t){var n=Wo&&t.markedSpans;if(n)for(var r,i=0;io;o++){i&&(i[0]=e.innerMode(t,r).mode);var a=t.token(n,r);if(n.pos>n.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function Ir(e,t,n,r){function i(e){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:e?sa(a.mode,u):u}}var o,a=e.doc,l=a.mode;t=me(a,t);var s,c=Zr(a,t.line),u=je(e,t.line,n),f=new ma(c.text,e.options.tabSize);for(r&&(s=[]);(r||f.pose.options.maxHighlightLength?(l=!1,a&&Hr(e,t,r,f.pos),f.pos=t.length,s=null):s=Ar(Or(n,f,r,h),o),h){var d=h[0].name;d&&(s="m-"+(s?d+" "+s:d))}if(!l||u!=s){for(;cc;){var r=i[s];r>e&&i.splice(s,1,e,i[s+1],r),s+=2,c=Math.min(e,r)}if(t)if(l.opaque)i.splice(n,s-n,e,"cm-overlay "+t),s=n+2;else for(;s>n;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Dr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=je(e,ti(t)),i=Rr(e,t,t.text.length>e.options.maxHighlightLength?sa(e.doc.mode,r):r);t.stateAfter=r,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function Hr(e,t,n,r){var i=e.doc.mode,o=new ma(t,e.options.tabSize);for(o.start=o.pos=r||0,""==t&&Er(i,n);!o.eol();)Or(i,o,n),o.start=o.pos}function Wr(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?ka:wa;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Br(e,t){var n=ji("span",null,null,wo?"padding-right: .1px":null),r={pre:ji("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,splitSpaces:(xo||wo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;r.pos=0,r.addToken=Fr,Ji(e.display.measure)&&(o=ii(a))&&(r.addToken=jr(r.addToken,o)),r.map=[];var l=t!=e.display.externalMeasured&&ti(a);qr(a,r,Dr(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(r.bgClass=$i(a.styleClasses.bgClass,r.bgClass||"")),a.styleClasses.textClass&&(r.textClass=$i(a.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Zi(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(wo){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Pa(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=$i(r.pre.className,r.textClass||"")),r}function _r(e){var t=ji("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Fr(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?t.replace(/ {3,}/g,zr):t,s=e.cm.state.specialChars,c=!1;if(s.test(t))for(var u=document.createDocumentFragment(),f=0;;){s.lastIndex=f;var h=s.exec(t),d=h?h.index-f:t.length-f;if(d){var p=document.createTextNode(l.slice(f,f+d));xo&&9>bo?u.appendChild(ji("span",[p])):u.appendChild(p),e.map.push(e.pos,e.pos+d,p),e.col+=d,e.pos+=d}if(!h)break;if(f+=d+1," "==h[0]){var m=e.cm.options.tabSize,g=m-e.col%m,p=u.appendChild(ji("span",Oi(g),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text"," "),e.col+=g}else if("\r"==h[0]||"\n"==h[0]){var p=u.appendChild(ji("span","\r"==h[0]?"␍":"␤","cm-invalidchar"));p.setAttribute("cm-text",h[0]),e.col+=1}else{var p=e.cm.options.specialCharPlaceholder(h[0]);p.setAttribute("cm-text",h[0]),xo&&9>bo?u.appendChild(ji("span",[p])):u.appendChild(p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var u=document.createTextNode(l);e.map.push(e.pos,e.pos+t.length,u),xo&&9>bo&&(c=!0),e.pos+=t.length}if(n||r||i||c||a){var v=n||"";r&&(v+=r),i&&(v+=i);var y=ji("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function zr(e){for(var t=" ",n=0;nc&&h.from<=c)break}if(h.to>=u)return e(n,r,i,o,a,l,s);e(n,r.slice(0,h.to-c),i,o,null,l,s),o=null,r=r.slice(h.to-c),c=h.to}}}function Ur(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function qr(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,c,u,f,h,d=i.length,p=0,m=1,g="",v=0;;){if(v==p){s=c=u=f=l="",h=null,v=1/0;for(var y,x=[],b=0;bp||k.collapsed&&w.to==p&&w.from==p)?(null!=w.to&&w.to!=p&&v>w.to&&(v=w.to,c=""),k.className&&(s+=" "+k.className),k.css&&(l=(l?l+";":"")+k.css),k.startStyle&&w.from==p&&(u+=" "+k.startStyle),k.endStyle&&w.to==v&&(y||(y=[])).push(k.endStyle,w.to),k.title&&!f&&(f=k.title),k.collapsed&&(!h||dr(h.marker,k)<0)&&(h=w)):w.from>p&&v>w.from&&(v=w.from)}if(y)for(var b=0;b=d)break;for(var S=Math.min(d,v);;){if(g){var C=p+g.length;if(!h){var L=C>S?g.slice(0,S-p):g;t.addToken(t,L,a?a+s:s,u,p+L.length==v?c:"",f,l)}if(C>=S){g=g.slice(S-p),p=S;break}p=C,u=""}g=i.slice(o,o=n[m++]),a=Wr(n[m++],t.cm.options)}}else for(var m=1;mn;++n)o.push(new ba(c[n],i(n),r));return o}var l=t.from,s=t.to,c=t.text,u=Zr(e,l.line),f=Zr(e,s.line),h=Ii(c),d=i(c.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Gr(e,t)){var m=a(0,c.length-1);o(f,f.text,d),p&&e.remove(l.line,p),m.length&&e.insert(l.line,m)}else if(u==f)if(1==c.length)o(u,u.text.slice(0,l.ch)+h+u.text.slice(s.ch),d);else{var m=a(1,c.length-1);m.push(new ba(h+u.text.slice(s.ch),d,r)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+f.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(f,h+f.text.slice(s.ch),d);var m=a(1,c.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,m)}Ci(e,"change",e,t)}function $r(e){this.lines=e,this.parent=null;for(var t=0,n=0;tt||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(o>t){n=i;break}t-=o}return n.lines[t]}function Jr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function Qr(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function ei(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function ti(e){if(null==e.parent)return null;for(var t=e.parent,n=Pi(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function ni(e,t){var n=e.first;e:do{for(var r=0;rt){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var r=0;rt)break;t-=l}return n+r}function ri(e){e=yr(e);for(var t=0,n=e.parent,r=0;r1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ii(e.done)):void 0}function ci(e,t,n,r){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=si(i,i.lastOp==r))){var l=Ii(o.changes);0==_o(t.from,t.to)&&0==_o(t.from,l.to)?l.to=Qo(t):o.changes.push(ai(e,t))}else{var s=Ii(i.done);for(s&&s.ranges||hi(e.sel,i.done),o={changes:[ai(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||Pa(e,"historyAdded")}function ui(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function fi(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ui(e,o,Ii(i.done),t))?i.done[i.done.length-1]=t:hi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&li(i.undone)}function hi(e,t){var n=Ii(t);n&&n.ranges&&n.equals(e)||t.push(e)}function di(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function pi(e){if(!e)return null;for(var t,n=0;n-1&&(Ii(l)[f]=u[f],delete u[f])}}}return i}function vi(e,t,n,r){n0?r.slice():Oa:r||Oa}function Ci(e,t){function n(e){return function(){e.apply(null,o)}}var r=Si(e,t,!1);if(r.length){var i,o=Array.prototype.slice.call(arguments,2);Go?i=Go.delayedCallbacks:Ra?i=Ra:(i=Ra=[],setTimeout(Li,0));for(var a=0;a0}function Ai(e){e.prototype.on=function(e,t){Ea(this,e,t)},e.prototype.off=function(e,t){Ia(this,e,t)}}function Ei(){this.id=null}function Oi(e){for(;ja.length<=e;)ja.push(Ii(ja)+" ");return ja[e]}function Ii(e){return e[e.length-1]}function Pi(e,t){for(var n=0;n-1&&Ya(e)?!0:t.test(e):Ya(e)}function Fi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function zi(e){return e.charCodeAt(0)>=768&&$a.test(e)}function ji(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o0;--t)e.removeChild(e.firstChild);return e}function qi(e,t){return Ui(e).appendChild(t)}function Gi(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Yi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function $i(e,t){for(var n=e.split(" "),r=0;r2&&!(xo&&8>bo))}var n=Ka?ji("span","​"):ji("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Ji(e){if(null!=Xa)return Xa;var t=qi(e,document.createTextNode("AخA")),n=qa(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=qa(t,1,2).getBoundingClientRect();return Xa=r.right-n.right<3}function Qi(e){if(null!=il)return il;var t=qi(e,ji("span","x")),n=t.getBoundingClientRect(),r=qa(t,0,1).getBoundingClientRect();return il=Math.abs(n.left-r.left)>1}function eo(e,t,n,r){if(!e)return r(t,n,"ltr");for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr"),i=!0)}i||r(t,n,"ltr")}function to(e){return e.level%2?e.to:e.from}function no(e){return e.level%2?e.from:e.to}function ro(e){var t=ii(e);return t?to(t[0]):0}function io(e){var t=ii(e);return t?no(Ii(t)):e.text.length}function oo(e,t){var n=Zr(e.doc,t),r=yr(n);r!=n&&(t=ti(r));var i=ii(r),o=i?i[0].level%2?io(r):ro(r):0;return Bo(t,o)}function ao(e,t){for(var n,r=Zr(e.doc,t);n=gr(r);)r=n.find(1,!0).line,t=null;var i=ii(r),o=i?i[0].level%2?ro(r):io(r):r.text.length;return Bo(null==t?ti(r):t,o)}function lo(e,t){var n=oo(e,t.line),r=Zr(e.doc,n.line),i=ii(r);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return Bo(n.line,a?0:o)}return n}function so(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:n>t}function co(e,t){al=null;for(var n,r=0;rt)return r;if(i.from==t||i.to==t){if(null!=n)return so(e,i.level,e[n].level)?(i.from!=i.to&&(al=n),r):(i.from!=i.to&&(al=r),n);n=r}}return n}function uo(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&zi(e.text.charAt(t)));return t}function fo(e,t,n,r){var i=ii(e);if(!i)return ho(e,t,n,r);for(var o=co(i,t),a=i[o],l=uo(e,t,a.level%2?-n:n,r);;){if(l>a.from&&l0==a.level%2?a.to:a.from);if(a=i[o+=n],!a)return null;l=n>0==a.level%2?uo(e,a.to,-1,r):uo(e,a.from,1,r)}}function ho(e,t,n,r){var i=t+n;if(r)for(;i>0&&zi(e.text.charAt(i));)i+=n;return 0>i||i>e.text.length?null:i}var po=navigator.userAgent,mo=navigator.platform,go=/gecko\/\d/i.test(po),vo=/MSIE \d/.test(po),yo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(po),xo=vo||yo,bo=xo&&(vo?document.documentMode||6:yo[1]),wo=/WebKit\//.test(po),ko=wo&&/Qt\/\d+\.\d+/.test(po),So=/Chrome\//.test(po),Co=/Opera\//.test(po),Lo=/Apple Computer/.test(navigator.vendor),To=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(po),Mo=/PhantomJS/.test(po),No=/AppleWebKit/.test(po)&&/Mobile\/\w+/.test(po),Ao=No||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(po),Eo=No||/Mac/.test(mo),Oo=/\bCrOS\b/.test(po),Io=/win/i.test(mo),Po=Co&&po.match(/Version\/(\d*\.\d*)/);Po&&(Po=Number(Po[1])),Po&&Po>=15&&(Co=!1,wo=!0);var Ro=Eo&&(ko||Co&&(null==Po||12.11>Po)),Do=go||xo&&bo>=9,Ho=!1,Wo=!1;m.prototype=Wi({update:function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var e=Eo&&!To?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Ei,this.disableVert=new Ei},enableZeroWidthBar:function(e,t){function n(){var r=e.getBoundingClientRect(),i=document.elementFromPoint(r.left+1,r.bottom-1);i!=e?e.style.pointerEvents="none":t.set(1e3,n)}e.style.pointerEvents="auto",t.set(1e3,n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=Wi({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={"native":m,"null":g},L.prototype.signal=function(e,t){Ni(e,t)&&this.events.push(arguments)},L.prototype.finish=function(){for(var e=0;e=9&&n.hasSelection&&(n.hasSelection=null),n.poll()}),Ea(o,"paste",function(e){Ti(r,e)||J(e,r)||(r.state.pasteIncoming=!0,n.fastPoll())}),Ea(o,"cut",t),Ea(o,"copy",t),Ea(e.scroller,"paste",function(t){Gt(e,t)||Ti(r,t)||(r.state.pasteIncoming=!0,n.focus())}),Ea(e.lineSpace,"selectstart",function(t){Gt(e,t)||Ma(t)}),Ea(o,"compositionstart",function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ea(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,n=e.doc,r=De(e);if(e.options.moveInputWithCursor){var i=dt(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},showSelection:function(e){var t=this.cm,n=t.display;qi(n.cursorDiv,e.cursors),qi(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,n,r=this.cm,i=r.doc;if(r.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=rl&&(o.to().line-o.from().line>100||(n=r.getSelection()).length>1e3);var a=t?"-":n||r.getSelection();this.textarea.value=a,r.state.focused&&Ua(this.textarea),xo&&bo>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",xo&&bo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Ao||Gi()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0; +},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,n=this.prevInput;if(this.contextMenuPending||!e.state.focused||nl(t)&&!n&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=t.value;if(r==n&&!e.somethingSelected())return!1;if(xo&&bo>=9&&this.hasSelection===r||Eo&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=r.charCodeAt(0);if(8203!=i||n||(n="​"),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(n.length,r.length);a>o&&n.charCodeAt(o)==r.charCodeAt(o);)++o;var l=this;return At(e,function(){Z(e,r.slice(o),n.length-o,null,l.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?t.value=l.prevInput="":l.prevInput=r,l.composing&&(l.composing.range.clear(),l.composing.range=e.markText(l.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){xo&&bo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t="​"+(e?a.value:"");a.value="⇚",a.value=t,r.prevInput=e?"":"​",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function n(){if(r.contextMenuPending=!1,r.wrapper.style.cssText=f,a.style.cssText=u,xo&&9>bo&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=a.selectionStart){(!xo||xo&&9>bo)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==r.prevInput?Et(i,ua.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(n,500):o.input.reset()};o.detectingSelectAll=setTimeout(n,200)}}var r=this,i=r.cm,o=i.display,a=r.textarea,l=Yt(i,e),s=o.scroller.scrollTop;if(l&&!Co){var c=i.options.resetSelectionOnContextMenu;c&&-1==i.doc.sel.contains(l)&&Et(i,Te)(i.doc,de(l),Wa);var u=a.style.cssText,f=r.wrapper.style.cssText;r.wrapper.style.cssText="position: absolute";var h=r.wrapper.getBoundingClientRect();if(a.style.cssText="position: absolute; width: 30px; height: 30px; top: "+(e.clientY-h.top-5)+"px; left: "+(e.clientX-h.left-5)+"px; z-index: 1000; background: "+(xo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",wo)var d=window.scrollY;if(o.input.focus(),wo&&window.scrollTo(null,d),o.input.reset(),i.somethingSelected()||(a.value=r.prevInput=" "),r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),xo&&bo>=9&&t(),Do){Aa(e);var p=function(){Ia(window,"mouseup",p),setTimeout(n,20)};Ea(window,"mouseup",p)}else setTimeout(n,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Di,needsContentAttribute:!1},ne.prototype),ie.prototype=Wi({init:function(e){function t(e){if(!Ti(r,e)){if(r.somethingSelected())Fo={lineWise:!1,text:r.getSelections()},"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=ee(r);Fo={lineWise:!0,text:t.text},"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,Wa),r.replaceSelection("",null,"cut")})}if(e.clipboardData&&!No)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Fo.text.join("\n"));else{var n=re(),i=n.firstChild;r.display.lineSpace.insertBefore(n,r.display.lineSpace.firstChild),i.value=Fo.text.join("\n");var o=document.activeElement;Ua(i),setTimeout(function(){r.display.lineSpace.removeChild(n),o.focus()},50)}}}var n=this,r=n.cm,i=n.div=e.lineDiv;te(i),Ea(i,"paste",function(e){Ti(r,e)||J(e,r)}),Ea(i,"compositionstart",function(e){var t=e.data;if(n.composing={sel:r.doc.sel,data:t,startData:t},t){var i=r.doc.sel.primary(),o=r.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(n.composing.sel=de(Bo(i.head.line,a),Bo(i.head.line,a+t.length)))}}),Ea(i,"compositionupdate",function(e){n.composing.data=e.data}),Ea(i,"compositionend",function(e){var t=n.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||n.applyComposition(t),n.composing==t&&(n.composing=null)},50))}),Ea(i,"touchstart",function(){n.forceCompositionEnd()}),Ea(i,"input",function(){n.composing||!r.isReadOnly()&&n.pollContent()||At(n.cm,function(){Dt(r)})}),Ea(i,"copy",t),Ea(i,"cut",t)},prepareSelection:function(){var e=De(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),n=le(this.cm,e.anchorNode,e.anchorOffset),r=le(this.cm,e.focusNode,e.focusOffset);if(!n||n.bad||!r||r.bad||0!=_o(K(n,r),t.from())||0!=_o(V(n,r),t.to())){var i=oe(this.cm,t.from()),o=oe(this.cm,t.to());if(i||o){var a=this.cm.display.view,l=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var s=a[a.length-1].measure,c=s.maps?s.maps[s.maps.length-1]:s.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var u=qa(i.node,i.offset,o.offset,o.node)}catch(f){}u&&(!go&&this.cm.state.focused?(e.collapse(i.node,i.offset),u.collapsed||e.addRange(u)):(e.removeAllRanges(),e.addRange(u)),l&&null==e.anchorNode?e.addRange(l):go&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){qi(this.cm.display.cursorDiv,e.cursors),qi(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Va(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():At(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var n=le(t,e.anchorNode,e.anchorOffset),r=le(t,e.focusNode,e.focusOffset);n&&r&&At(t,function(){Te(t.doc,de(n,r),Wa),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.linet.viewTo-1)return!1;var o;if(r.line==t.viewFrom||0==(o=Bt(e,r.line)))var a=ti(t.view[0].line),l=t.view[0].node;else var a=ti(t.view[o].line),l=t.view[o-1].node.nextSibling;var s=Bt(e,i.line);if(s==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=ti(t.view[s+1].line)-1,u=t.view[s+1].node.previousSibling;for(var f=e.doc.splitLines(ce(e,l,u,a,c)),h=Jr(e.doc,Bo(a,0),Bo(c,Zr(e.doc,c).text.length));f.length>1&&h.length>1;)if(Ii(f)==Ii(h))f.pop(),h.pop(),c--;else{if(f[0]!=h[0])break;f.shift(),h.shift(),a++}for(var d=0,p=0,m=f[0],g=h[0],v=Math.min(m.length,g.length);v>d&&m.charCodeAt(d)==g.charCodeAt(d);)++d;for(var y=Ii(f),x=Ii(h),b=Math.min(y.length-(1==f.length?d:0),x.length-(1==h.length?d:0));b>p&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1);)++p;f[f.length-1]=y.slice(0,y.length-p),f[0]=f[0].slice(d);var w=Bo(a,d),k=Bo(c,h.length?Ii(h).length-p:0);return f.length>1||f[0]||_o(w,k)?(In(e.doc,f,w,k,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){this.cm.isReadOnly()?Et(this.cm,Dt)(this.cm):e.data&&e.data!=e.startData&&Et(this.cm,Z)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),this.cm.isReadOnly()||Et(this.cm,Z)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Di,resetPosition:Di,needsContentAttribute:!0},ie.prototype),e.inputStyles={textarea:ne,contenteditable:ie},ue.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t=0&&_o(e,r.to())<=0)return n}return-1}},fe.prototype={from:function(){return K(this.anchor,this.head)},to:function(){return V(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var zo,jo,Uo,qo={left:0,right:0,top:0,bottom:0},Go=null,Yo=0,$o=0,Vo=0,Ko=null;xo?Ko=-.53:go?Ko=15:So?Ko=-.7:Lo&&(Ko=-1/3);var Xo=function(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}};e.wheelEventPixels=function(e){var t=Xo(e);return t.x*=Ko,t.y*=Ko,t};var Zo=new Ei,Jo=null,Qo=e.changeEnd=function(e){return e.text?Bo(e.from.line+e.text.length-1,Ii(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];n[e]==t&&"mode"!=e||(n[e]=t,ta.hasOwnProperty(e)&&Et(this,ta[e])(this,t,r))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"]($n(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(Fn(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Bn(this));else{var o=i.from(),a=i.to(),l=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;n>s;++s)Fn(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[r].from().ch>0&&ke(this.doc,r,new fe(o,c[r].to()),Wa)}}}),getTokenAt:function(e,t){return Ir(this,e,t)},getLineTokens:function(e,t){return Ir(this,Bo(e),t,!0)},getTokenTypeAt:function(e){e=me(this.doc,e);var t,n=Dr(this,Zr(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]l?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!la.hasOwnProperty(t))return n;var r=la[t],i=this.getModeAt(e);if("string"==typeof i[t])r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var o=0;oi&&(e=i,r=!0),n=Zr(this.doc,e)}else n=e;return ut(this,n,{top:0,left:0},t||"page").top+(r?this.doc.height-ri(n):0)},defaultTextHeight:function(){return yt(this.display)},defaultCharWidth:function(){return xt(this.display)},setGutterMarker:Ot(function(e,t,n){return zn(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&Fi(r)&&(e.gutterMarkers=null),!0})}),clearGutter:Ot(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,Ht(t,r,"gutter"),Fi(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),lineInfo:function(e){if("number"==typeof e){if(!ve(this.doc,e))return null;var t=e;if(e=Zr(this.doc,e),!e)return null}else{var t=ti(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=dt(this,me(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),n&&Dn(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Ot(hn),triggerOnKeyPress:Ot(mn),triggerOnKeyUp:pn,execCommand:function(e){return ua.hasOwnProperty(e)?ua[e].call(null,this):void 0},triggerElectric:Ot(function(e){Q(this,e)}),findPosH:function(e,t,n,r){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=me(this.doc,e);t>o&&(a=Un(this.doc,a,i,n,r),!a.hitSide);++o);return a},moveH:Ot(function(e,t){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?Un(n.doc,r.head,e,t,n.options.rtlMoveVisually):0>e?r.from():r.to()},_a)}),deleteH:Ot(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):jn(this,function(n){var i=Un(r,n.head,e,t,!1);return 0>e?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=1,o=r;0>t&&(i=-1,t=-t);for(var a=0,l=me(this.doc,e);t>a;++a){var s=dt(this,l,"div");if(null==o?o=s.left:s.left=o,l=qn(this,s,i,n),l.hitSide)break}return l},moveV:Ot(function(e,t){var n=this,r=this.doc,i=[],o=!n.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var l=dt(n,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=qn(n,l,e,t);return"page"==t&&a==r.sel.primary()&&Wn(n,null,ht(n,s,"div").top-l.top),s},_a),i.length)for(var a=0;a0&&l(n.charAt(r-1));)--r;for(;i.5)&&a(this),Pa(this,"refresh",this)}),swapDoc:Ot(function(e){var t=this.doc;return t.cm=null,Xr(this,e),lt(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Ci(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ai(e);var ea=e.defaults={},ta=e.optionHandlers={},na=e.Init={toString:function(){return"CodeMirror.Init"}};Gn("value","",function(e,t){e.setValue(t)},!0),Gn("mode",null,function(e,t){e.doc.modeOption=t,n(e)},!0),Gn("indentUnit",2,n,!0),Gn("indentWithTabs",!1),Gn("smartIndent",!0),Gn("tabSize",4,function(e){r(e),lt(e),Dt(e)},!0),Gn("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(Bo(r,o))}r++});for(var i=n.length-1;i>=0;i--)In(e.doc,t,n[i],Bo(n[i].line,n[i].ch+t.length))}}),Gn("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,n,r){t.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),r!=e.Init&&t.refresh()}),Gn("specialCharPlaceholder",_r,function(e){e.refresh()},!0),Gn("electricChars",!0),Gn("inputStyle",Ao?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Gn("rtlMoveVisually",!Io),Gn("wholeLineUpdateBefore",!0),Gn("theme","default",function(e){l(e),s(e)},!0),Gn("keyMap","default",function(t,n,r){var i=$n(n),o=r!=e.Init&&$n(r);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Gn("extraKeys",null),Gn("lineWrapping",!1,i,!0),Gn("gutters",[],function(e){d(e.options),s(e)},!0),Gn("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),Gn("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Gn("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Gn("lineNumbers",!1,function(e){d(e.options),s(e)},!0),Gn("firstLineNumber",1,s,!0),Gn("lineNumberFormatter",function(e){return e},s,!0),Gn("showCursorWhenSelecting",!1,Re,!0),Gn("resetSelectionOnContextMenu",!0),Gn("lineWiseCopyCut",!0),Gn("readOnly",!1,function(e,t){"nocursor"==t?(yn(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),Gn("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Gn("dragDrop",!0,Ut),Gn("allowDropFileTypes",null),Gn("cursorBlinkRate",530),Gn("cursorScrollMargin",0),Gn("cursorHeight",1,Re,!0),Gn("singleCursorHeightPerLine",!0,Re,!0),Gn("workTime",100),Gn("workDelay",100),Gn("flattenSpans",!0,r,!0),Gn("addModeClass",!1,r,!0),Gn("pollInterval",100),Gn("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Gn("historyEventDelay",1250),Gn("viewportMargin",10,function(e){e.refresh()},!0),Gn("maxHighlightLength",1e4,r,!0),Gn("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Gn("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Gn("autofocus",null);var ra=e.modes={},ia=e.mimeModes={};e.defineMode=function(t,n){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),ra[t]=n},e.defineMIME=function(e,t){ia[e]=t},e.resolveMode=function(t){if("string"==typeof t&&ia.hasOwnProperty(t))t=ia[t];else if(t&&"string"==typeof t.name&&ia.hasOwnProperty(t.name)){var n=ia[t.name];"string"==typeof n&&(n={name:n}),t=Hi(n,t),t.name=n.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,n){var n=e.resolveMode(n),r=ra[n.name];if(!r)return e.getMode(t,"text/plain");var i=r(t,n);if(oa.hasOwnProperty(n.name)){var o=oa[n.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=n.name,n.helperType&&(i.helperType=n.helperType),n.modeProps)for(var a in n.modeProps)i[a]=n.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var oa=e.modeExtensions={};e.extendMode=function(e,t){var n=oa.hasOwnProperty(e)?oa[e]:oa[e]={};Wi(t,n)},e.defineExtension=function(t,n){e.prototype[t]=n},e.defineDocExtension=function(e,t){Ca.prototype[e]=t},e.defineOption=Gn;var aa=[];e.defineInitHook=function(e){aa.push(e)};var la=e.helpers={};e.registerHelper=function(t,n,r){la.hasOwnProperty(t)||(la[t]=e[t]={_global:[]}),la[t][n]=r},e.registerGlobalHelper=function(t,n,r,i){e.registerHelper(t,n,i),la[t]._global.push({pred:r,val:i})};var sa=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n},ca=e.startState=function(e,t,n){return e.startState?e.startState(t,n):!0};e.innerMode=function(e,t){for(;e.innerMode;){var n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}};var ua=e.commands={selectAll:function(e){e.setSelection(Bo(e.firstLine(),0),Bo(e.lastLine()),Wa)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Wa)},killLine:function(e){jn(e,function(t){if(t.empty()){var n=Zr(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new Bo(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Bo(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Zr(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),Bo(i.line-1,a.length-1),Bo(i.line,1),"+transpose")}n.push(new fe(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){At(e,function(){for(var t=e.listSelections().length,n=0;t>n;n++){var r=e.listSelections()[n];e.replaceRange(e.doc.lineSeparator(),r.anchor,r.head,"+input"),e.indentLine(r.from().line+1,null,!0)}Bn(e)})},openLine:function(e){e.replaceSelection("\n","start")},toggleOverwrite:function(e){e.toggleOverwrite()}},fa=e.keyMap={};fa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},fa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},fa.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},fa.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},fa["default"]=Eo?fa.macDefault:fa.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=Ri(n.split(" "),Yn),o=0;o=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.post},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var ga=0,va=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ga};Ai(va),va.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&bt(e),Ni(this,"clear")){var n=this.find();n&&Ci(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&Dt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ae(e.doc)),e&&Ci(e,"markerCleared",e,this),t&&kt(e),this.parent&&this.parent.clear()}},va.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var n,r,i=0;in;++n){var i=this.lines[n];this.height-=i.height,Nr(i),Ci(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;re;++e)if(n(this.lines[e]))return!0}},Vr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;ne){var o=Math.min(t,i-e),a=r.height;if(r.removeInner(e,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof $r))){var l=[];this.collapse(l),this.children=[new $r(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t=e){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var a=i.lines.length%25+25,l=a;l10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;re){var a=Math.min(t,o-e);if(i.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var Sa=0,Ca=e.Doc=function(e,t,n,r){if(!(this instanceof Ca))return new Ca(e,t,n,r);null==n&&(n=0),Vr.call(this,[new $r([new ba("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var i=Bo(n,0);this.sel=de(i),this.history=new oi(null),this.id=++Sa,this.modeOption=t,this.lineSep=r,this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Yr(this,{from:i,to:i,text:e}),Te(this,de(i),Wa)};Ca.prototype=Hi(Vr.prototype,{constructor:Ca,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r=0;o--)Tn(this,r[o]);l?Le(this,l):this.cm&&Bn(this.cm)}),undo:It(function(){Nn(this,"undo")}),redo:It(function(){Nn(this,"redo")}),undoSelection:It(function(){Nn(this,"undo",!0)}),redoSelection:It(function(){Nn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=me(this,e),t=me(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re?(t=e,!0):(e-=o,void++n)}),me(this,Bo(n,t))},indexFromPos:function(e){e=me(this,e);var t=e.ch;if(e.linet&&(t=e.from),null!=e.to&&e.tol||l>=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}},za=e.findColumn=function(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);-1==o&&(o=e.length);var a=o-r;if(o==e.length||i+a>=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}},ja=[""],Ua=function(e){e.select()};No?Ua=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:xo&&(Ua=function(e){try{e.select()}catch(t){}});var qa,Ga=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ya=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Ga.test(e))},$a=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;qa=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var Va=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};xo&&11>bo&&(Gi=function(){try{return document.activeElement}catch(e){return document.body}});var Ka,Xa,Za=e.rmClass=function(e,t){var n=e.className,r=Yi(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}},Ja=e.addClass=function(e,t){var n=e.className;Yi(t).test(n)||(e.className+=(n?" ":"")+t)},Qa=!1,el=function(){if(xo&&9>bo)return!1;var e=ji("div");return"draggable"in e||"dragDrop"in e}(),tl=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;r>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},nl=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},rl=function(){var e=ji("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),il=null,ol=e.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var e=0;10>e;e++)ol[e+48]=ol[e+96]=String(e);for(var e=65;90>=e;e++)ol[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)ol[e+111]=ol[e+63235]="F"+e}();var al,ll=function(){function e(e){return 247>=e?n.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?r.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,c="L";return function(n){if(!i.test(n))return!1;for(var r,u=n.length,f=[],h=0;u>h;++h)f.push(r=e(n.charCodeAt(h)));for(var h=0,d=c;u>h;++h){var r=f[h];"m"==r?f[h]=d:d=r}for(var h=0,p=c;u>h;++h){var r=f[h];"1"==r&&"r"==p?f[h]="n":a.test(r)&&(p=r,"r"==r&&(f[h]="R"))}for(var h=1,d=f[0];u-1>h;++h){var r=f[h];"+"==r&&"1"==d&&"1"==f[h+1]?f[h]="1":","!=r||d!=f[h+1]||"1"!=d&&"n"!=d||(f[h]=d),d=r}for(var h=0;u>h;++h){var r=f[h];if(","==r)f[h]="N";else if("%"==r){for(var m=h+1;u>m&&"%"==f[m];++m);for(var g=h&&"!"==f[h-1]||u>m&&"1"==f[m]?"1":"N",v=h;m>v;++v)f[v]=g;h=m-1}}for(var h=0,p=c;u>h;++h){var r=f[h];"L"==p&&"1"==r?f[h]="L":a.test(r)&&(p=r)}for(var h=0;u>h;++h)if(o.test(f[h])){for(var m=h+1;u>m&&o.test(f[m]);++m);for(var y="L"==(h?f[h-1]:c),x="L"==(u>m?f[m]:c),g=y||x?"L":"R",v=h;m>v;++v)f[v]=g;h=m-1}for(var b,w=[],h=0;u>h;)if(l.test(f[h])){var k=h;for(++h;u>h&&l.test(f[h]);++h);w.push(new t(0,k,h))}else{var S=h,C=w.length;for(++h;u>h&&"L"!=f[h];++h);for(var v=S;h>v;)if(s.test(f[v])){v>S&&w.splice(C,0,new t(1,S,v));var L=v;for(++v;h>v&&s.test(f[v]);++v);w.splice(C,0,new t(2,L,v)),S=v}else++v;h>S&&w.splice(C,0,new t(1,S,h))}return 1==w[0].level&&(b=n.match(/^\s+/))&&(w[0].from=b[0].length,w.unshift(new t(0,0,b[0].length))),1==Ii(w).level&&(b=n.match(/\s+$/))&&(Ii(w).to-=b[0].length,w.push(new t(0,u-b[0].length,u))),2==w[0].level&&w.unshift(new t(1,w[0].to,w[0].to)),w[0].level!=Ii(w).level&&w.push(new t(w[0].level,u,u)),w}}();return e.version="5.15.2",e})},{}],11:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror"),t("../markdown/markdown"),t("../../addon/mode/overlay")):"function"==typeof e&&e.amd?e(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],i):i(CodeMirror)}(function(e){"use strict";var t=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;e.defineMode("gfm",function(n,r){function i(e){return e.code=!1,null}var o=0,a={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,n){if(n.combineTokens=null,n.codeBlock)return e.match(/^```+/)?(n.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(n.code=!1),e.sol()&&e.match(/^```+/))return e.skipToEnd(),n.codeBlock=!0,null;if("`"===e.peek()){e.next();var i=e.pos;e.eatWhile("`");var a=1+e.pos-i;return n.code?a===o&&(n.code=!1):(o=a,n.code=!0),null}if(n.code)return e.next(),null;if(e.eatSpace())return n.ateSpace=!0,null;if((e.sol()||n.ateSpace)&&(n.ateSpace=!1,r.gitHubSpice!==!1)){if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return n.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return n.combineTokens=!0,"link"}return e.match(t)&&"]("!=e.string.slice(e.start-2,e.start)&&(0==e.start||/\W/.test(e.string.charAt(e.start-1)))?(n.combineTokens=!0,"link"):(e.next(),null)},blankLine:i},l={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:"```",strikethrough:!0};for(var s in r)l[s]=r[s];return l.name="markdown",e.overlayMode(e.getMode(n,l),a)},"markdown"),e.defineMIME("text/x-gfm","gfm")})},{"../../addon/mode/overlay":8,"../../lib/codemirror":10,"../markdown/markdown":12}],12:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../../lib/codemirror"),t("../xml/xml"),t("../meta")):"function"==typeof e&&e.amd?e(["../../lib/codemirror","../xml/xml","../meta"],i):i(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t,n){function r(n){if(e.findModeByName){var r=e.findModeByName(n);r&&(n=r.mime||r.mimes[0])}var i=e.getMode(t,n);return"null"==i.name?null:i}function i(e,t,n){return t.f=t.inline=n,n(e,t)}function o(e,t,n){return t.f=t.block=n,n(e,t)}function a(e){return!e||!/\S/.test(e.string)}function l(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,k&&e.f==c&&(e.f=p,e.block=s),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine=null,null}function s(t,o){var l=t.sol(),s=o.list!==!1,c=o.indentedCode;o.indentedCode=!1,s&&(o.indentationDiff>=0?(o.indentationDiff<4&&(o.indentation-=o.indentationDiff),o.list=null):o.indentation>0?o.list=null:o.list=!1);var f=null;if(o.indentationDiff>=4)return t.skipToEnd(),c||a(o.prevLine)?(o.indentation-=4,o.indentedCode=!0,S.code):null;if(t.eatSpace())return null;if((f=t.match(A))&&f[1].length<=6)return o.header=f[1].length,n.highlightFormatting&&(o.formatting="header"),o.f=o.inline,h(o);if(!(a(o.prevLine)||o.quote||s||c)&&(f=t.match(E)))return o.header="="==f[0].charAt(0)?1:2,n.highlightFormatting&&(o.formatting="header"),o.f=o.inline,h(o);if(t.eat(">"))return o.quote=l?1:o.quote+1,n.highlightFormatting&&(o.formatting="quote"),t.eatSpace(),h(o);if("["===t.peek())return i(t,o,y);if(t.match(L,!0))return o.hr=!0,S.hr;if((a(o.prevLine)||s)&&(t.match(T,!1)||t.match(M,!1))){var d=null;for(t.match(T,!0)?d="ul":(t.match(M,!0),d="ol"),o.indentation=t.column()+t.current().length,o.list=!0;o.listStack&&t.column()")>-1)&&(n.f=p,n.block=s,n.htmlState=null)}return r}function u(e,t){return t.fencedChars&&e.match(t.fencedChars,!1)?(t.localMode=t.localState=null,t.f=t.block=f,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),S.code)}function f(e,t){e.match(t.fencedChars),t.block=s,t.f=p,t.fencedChars=null,n.highlightFormatting&&(t.formatting="code-block"),t.code=1;var r=h(t);return t.code=0,r}function h(e){var t=[];if(e.formatting){t.push(S.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var r=0;r=e.quote?t.push(S.formatting+"-"+e.formatting[r]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(S.linkHref,"url"):(e.strong&&t.push(S.strong),e.em&&t.push(S.em),e.strikethrough&&t.push(S.strikethrough),e.linkText&&t.push(S.linkText),e.code&&t.push(S.code)),e.header&&t.push(S.header,S.header+"-"+e.header),e.quote&&(t.push(S.quote),!n.maxBlockquoteDepth||n.maxBlockquoteDepth>=e.quote?t.push(S.quote+"-"+e.quote):t.push(S.quote+"-"+n.maxBlockquoteDepth)),e.list!==!1){var i=(e.listStack.length-1)%3;i?1===i?t.push(S.list2):t.push(S.list3):t.push(S.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function d(e,t){return e.match(O,!0)?h(t):void 0}function p(t,r){var i=r.text(t,r);if("undefined"!=typeof i)return i;if(r.list)return r.list=null,h(r);if(r.taskList){var a="x"!==t.match(N,!0)[1];return a?r.taskOpen=!0:r.taskClosed=!0,n.highlightFormatting&&(r.formatting="task"),r.taskList=!1,h(r)}if(r.taskOpen=!1,r.taskClosed=!1,r.header&&t.match(/^#+$/,!0))return n.highlightFormatting&&(r.formatting="header"), +h(r);var l=t.sol(),s=t.next();if(r.linkTitle){r.linkTitle=!1;var u=s;"("===s&&(u=")"),u=(u+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var f="^\\s*(?:[^"+u+"\\\\]+|\\\\\\\\|\\\\.)"+u;if(t.match(new RegExp(f),!0))return S.linkHref}if("`"===s){var d=r.formatting;n.highlightFormatting&&(r.formatting="code"),t.eatWhile("`");var p=t.current().length;if(0==r.code)return r.code=p,h(r);if(p==r.code){var v=h(r);return r.code=0,v}return r.formatting=d,h(r)}if(r.code)return h(r);if("\\"===s&&(t.next(),n.highlightFormatting)){var y=h(r),x=S.formatting+"-escape";return y?y+" "+x:x}if("!"===s&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.match(/\[[^\]]*\]/),r.inline=r.f=g,S.image;if("["===s&&t.match(/[^\]]*\](\(.*\)| ?\[.*?\])/,!1))return r.linkText=!0,n.highlightFormatting&&(r.formatting="link"),h(r);if("]"===s&&r.linkText&&t.match(/\(.*?\)| ?\[.*?\]/,!1)){n.highlightFormatting&&(r.formatting="link");var y=h(r);return r.linkText=!1,r.inline=r.f=g,y}if("<"===s&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=m,n.highlightFormatting&&(r.formatting="link");var y=h(r);return y?y+=" ":y="",y+S.linkInline}if("<"===s&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){r.f=r.inline=m,n.highlightFormatting&&(r.formatting="link");var y=h(r);return y?y+=" ":y="",y+S.linkEmail}if("<"===s&&t.match(/^(!--|\w)/,!1)){var b=t.string.indexOf(">",t.pos);if(-1!=b){var k=t.string.substring(t.start,b);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(k)&&(r.md_inside=!0)}return t.backUp(1),r.htmlState=e.startState(w),o(t,r,c)}if("<"===s&&t.match(/^\/\w*?>/))return r.md_inside=!1,"tag";var C=!1;if(!n.underscoresBreakWords&&"_"===s&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var L=t.pos-2;if(L>=0){var T=t.string.charAt(L);"_"!==T&&T.match(/(\w)/,!1)&&(C=!0)}}if("*"===s||"_"===s&&!C)if(l&&" "===t.peek());else{if(r.strong===s&&t.eat(s)){n.highlightFormatting&&(r.formatting="strong");var v=h(r);return r.strong=!1,v}if(!r.strong&&t.eat(s))return r.strong=s,n.highlightFormatting&&(r.formatting="strong"),h(r);if(r.em===s){n.highlightFormatting&&(r.formatting="em");var v=h(r);return r.em=!1,v}if(!r.em)return r.em=s,n.highlightFormatting&&(r.formatting="em"),h(r)}else if(" "===s&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return h(r);t.backUp(1)}if(n.strikethrough)if("~"===s&&t.eatWhile(s)){if(r.strikethrough){n.highlightFormatting&&(r.formatting="strikethrough");var v=h(r);return r.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return r.strikethrough=!0,n.highlightFormatting&&(r.formatting="strikethrough"),h(r)}else if(" "===s&&t.match(/^~~/,!0)){if(" "===t.peek())return h(r);t.backUp(2)}return" "===s&&(t.match(/ +$/,!1)?r.trailingSpace++:r.trailingSpace&&(r.trailingSpaceNewLine=!0)),h(r)}function m(e,t){var r=e.next();if(">"===r){t.f=t.inline=p,n.highlightFormatting&&(t.formatting="link");var i=h(t);return i?i+=" ":i="",i+S.linkInline}return e.match(/^[^>]+/,!0),S.linkInline}function g(e,t){if(e.eatSpace())return null;var r=e.next();return"("===r||"["===r?(t.f=t.inline=v("("===r?")":"]",0),n.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,h(t)):"error"}function v(e){return function(t,r){var i=t.next();if(i===e){r.f=r.inline=p,n.highlightFormatting&&(r.formatting="link-string");var o=h(r);return r.linkHref=!1,o}return t.match(P[e]),r.linkHref=!0,h(r)}}function y(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=x,e.next(),n.highlightFormatting&&(t.formatting="link"),t.linkText=!0,h(t)):i(e,t,p)}function x(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=b,n.highlightFormatting&&(t.formatting="link");var r=h(t);return t.linkText=!1,r}return e.match(/^([^\]\\]|\\.)+/,!0),S.linkText}function b(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=p,S.linkHref+" url")}var w=e.getMode(t,"text/html"),k="null"==w.name;void 0===n.highlightFormatting&&(n.highlightFormatting=!1),void 0===n.maxBlockquoteDepth&&(n.maxBlockquoteDepth=0),void 0===n.underscoresBreakWords&&(n.underscoresBreakWords=!0),void 0===n.taskLists&&(n.taskLists=!1),void 0===n.strikethrough&&(n.strikethrough=!1),void 0===n.tokenTypeOverrides&&(n.tokenTypeOverrides={});var S={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"tag",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough"};for(var C in S)S.hasOwnProperty(C)&&n.tokenTypeOverrides[C]&&(S[C]=n.tokenTypeOverrides[C]);var L=/^([*\-_])(?:\s*\1){2,}\s*$/,T=/^[*\-+]\s+/,M=/^[0-9]+([.)])\s+/,N=/^\[(x| )\](?=\s)/,A=n.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,E=/^ *(?:\={1,}|-{1,})\s*$/,O=/^[^#!\[\]*_\\<>` "'(~]+/,I=new RegExp("^("+(n.fencedCodeBlocks===!0?"~~~+|```+":n.fencedCodeBlocks)+")[ \\t]*([\\w+#-]*)"),P={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/},R={startState:function(){return{f:s,prevLine:null,thisLine:null,block:s,htmlState:null,indentation:0,inline:p,text:d,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,fencedChars:null}},copyState:function(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&e.copyState(w,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkTitle:t.linkTitle,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,header:t.header,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedChars:t.fencedChars}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine){var n=t.header||t.hr;if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0)||n){if(l(t),!n)return null;t.prevLine=null}t.prevLine=t.thisLine,t.thisLine=e,t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var r=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(t.indentationDiff=Math.min(r-t.indentation,4),t.indentation=t.indentation+t.indentationDiff,r>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==c?{state:e.htmlState,mode:w}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:R}},blankLine:l,getType:h,fold:"markdown"};return R},"xml"),e.defineMIME("text/x-markdown","markdown")})},{"../../lib/codemirror":10,"../meta":13,"../xml/xml":14}],13:[function(t,n,r){!function(i){"object"==typeof r&&"object"==typeof n?i(t("../lib/codemirror")):"function"==typeof e&&e.amd?e(["../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";e.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["pgp"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists.txt$/},{name:"CoffeeScript",mime:"text/x-coffeescript",mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history).md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"]},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Jade",mime:"text/x-jade",mode:"jade",ext:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"null",mode:"jinja2"},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mime:"text/n-triples",mode:"ntriples",ext:["nt"]},{name:"Objective C",mime:"text/x-objectivec",mode:"clike",ext:["m","mm"],alias:["objective-c","objc"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mime:"application/x-httpd-php",mode:"php",ext:["php","php3","php4","php5","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mime:"text/x-sh",mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki ",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mime:"text/x-yaml",mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]}];for(var t=0;t-1&&t.substring(i+1,t.length);return o?e.findModeByExtension(o):void 0},e.findModeByName=function(t){t=t.toLowerCase();for(var n=0;n")):null:e.match("--")?n(s("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(c(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=s("meta","?>"),"meta"):(T=e.eat("/")?"closeTag":"openTag",t.tokenize=a,"tag bracket");if("&"==r){var i;return i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function a(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=o,T=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return T="equals",null;if("<"==n){t.tokenize=o,t.state=d,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=l(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function l(e){var t=function(t,n){for(;!t.eol();)if(t.next()==e){n.tokenize=a;break}return"string"};return t.isInAttribute=!0,t}function s(e,t){return function(n,r){for(;!n.eol();){if(n.match(t)){r.tokenize=o;break}n.next()}return e}}function c(e){return function(t,n){for(var r;null!=(r=t.next());){if("<"==r)return n.tokenize=c(e+1),n.tokenize(t,n);if(">"==r){if(1==e){n.tokenize=o;break}return n.tokenize=c(e-1),n.tokenize(t,n)}}return"meta"}}function u(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n,(S.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function f(e){e.context&&(e.context=e.context.prev)}function h(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!S.contextGrabbers.hasOwnProperty(n)||!S.contextGrabbers[n].hasOwnProperty(t))return;f(e)}}function d(e,t,n){return"openTag"==e?(n.tagStart=t.column(),p):"closeTag"==e?m:d}function p(e,t,n){return"word"==e?(n.tagName=t.current(),M="tag",y):(M="error",p)}function m(e,t,n){if("word"==e){var r=t.current();return n.context&&n.context.tagName!=r&&S.implicitlyClosed.hasOwnProperty(n.context.tagName)&&f(n),n.context&&n.context.tagName==r||S.matchClosing===!1?(M="tag",g):(M="tag error",v)}return M="error",v}function g(e,t,n){return"endTag"!=e?(M="error",g):(f(n),d)}function v(e,t,n){return M="error",g(e,t,n)}function y(e,t,n){if("word"==e)return M="attribute",x;if("endTag"==e||"selfcloseTag"==e){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||S.autoSelfClosers.hasOwnProperty(r)?h(n,r):(h(n,r),n.context=new u(n,r,i==n.indented)),d}return M="error",y}function x(e,t,n){return"equals"==e?b:(S.allowMissing||(M="error"),y(e,t,n))}function b(e,t,n){return"string"==e?w:"word"==e&&S.allowUnquoted?(M="string",y):(M="error",y(e,t,n))}function w(e,t,n){return"string"==e?w:y(e,t,n)}var k=r.indentUnit,S={},C=i.htmlMode?t:n;for(var L in C)S[L]=C[L];for(var L in i)S[L]=i[L];var T,M;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:d,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;T=null;var n=t.tokenize(e,t);return(n||T)&&"comment"!=n&&(M=null,t.state=t.state(T||n,e,t),M&&(n="error"==M?n+" error":M)),n},indent:function(t,n,r){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+k;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=a&&t.tokenize!=o)return r?r.match(/^(\s*)/)[0].length:0;if(t.tagName)return S.multilineTagIndentPastTag!==!1?t.tagStart+t.tagName.length+2:t.tagStart+k*(S.multilineTagIndentFactor||1);if(S.alignCDATA&&/$/,blockCommentStart:"",configuration:S.htmlMode?"html":"xml",helperType:S.htmlMode?"html":"xml",skipAttribute:function(e){e.state==b&&(e.state=y)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})})},{"../../lib/codemirror":10}],15:[function(e,t,n){n.read=function(e,t,n,r,i){var o,a,l=8*i-r-1,s=(1<>1,u=-7,f=n?i-1:0,h=n?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-u)-1,d>>=-u,u+=l;u>0;o=256*o+e[t+f],f+=h,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+e[t+f],f+=h,u-=8);if(0===o)o=1-c;else{if(o===s)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var a,l,s,c=8*o-i-1,u=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),t+=a+f>=1?h/s:h*Math.pow(2,1-f),t*s>=2&&(a++,s/=2),a+f>=u?(l=0,a=u):a+f>=1?(l=(t*s-1)*Math.pow(2,i),a+=f):(l=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&l,d+=p,l/=256,i-=8);for(a=a<0;e[n+d]=255&a,d+=p,a/=256,c-=8);e[n+d-p]|=128*m}},{}],16:[function(e,t,n){var r={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},{}],17:[function(t,n,r){(function(t){(function(){function t(e){this.tokens=[],this.tokens.links={},this.options=e||h.defaults,this.rules=d.normal,this.options.gfm&&(this.options.tables?this.rules=d.tables:this.rules=d.gfm)}function i(e,t){if(this.options=t||h.defaults,this.links=e,this.rules=p.normal,this.renderer=this.options.renderer||new o,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=p.breaks:this.rules=p.gfm:this.options.pedantic&&(this.rules=p.pedantic)}function o(e){this.options=e||{}}function a(e){this.tokens=[],this.token=null,this.options=e||h.defaults,this.options.renderer=this.options.renderer||new o,this.renderer=this.options.renderer,this.renderer.options=this.options}function l(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function s(e){return e.replace(/&([#\w]+);/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function c(e,t){return e=e.source,t=t||"",function n(r,i){return r?(i=i.source||i,i=i.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,i),n):new RegExp(e,t)}}function u(){}function f(e){for(var t,n,r=1;rAn error occured:

            "+l(u.message+"",!0)+"
            ";throw u}}var d={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:u,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:u,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:u,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};d.bullet=/(?:[*+-]|\d+\.)/,d.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,d.item=c(d.item,"gm")(/bull/g,d.bullet)(),d.list=c(d.list)(/bull/g,d.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+d.def.source+")")(),d.blockquote=c(d.blockquote)("def",d.def)(),d._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",d.html=c(d.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,d._tag)(),d.paragraph=c(d.paragraph)("hr",d.hr)("heading",d.heading)("lheading",d.lheading)("blockquote",d.blockquote)("tag","<"+d._tag)("def",d.def)(),d.normal=f({},d),d.gfm=f({},d.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),d.gfm.paragraph=c(d.paragraph)("(?!","(?!"+d.gfm.fences.source.replace("\\1","\\2")+"|"+d.list.source.replace("\\1","\\3")+"|")(),d.tables=f({},d.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=d,t.lex=function(e,n){var r=new t(n);return r.lex(e)},t.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},t.prototype.token=function(e,t,n){for(var r,i,o,a,l,s,c,u,f,e=e.replace(/^ +$/gm,"");e;)if((o=this.rules.newline.exec(e))&&(e=e.substring(o[0].length),o[0].length>1&&this.tokens.push({type:"space"})),o=this.rules.code.exec(e))e=e.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=this.rules.fences.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=this.rules.heading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(t&&(o=this.rules.nptable.exec(e))){for(e=e.substring(o[0].length),s={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},u=0;u ?/gm,""),this.token(o,t,!0),this.tokens.push({type:"blockquote_end"});else if(o=this.rules.list.exec(e)){for(e=e.substring(o[0].length),a=o[2],this.tokens.push({type:"list_start",ordered:a.length>1}),o=o[0].match(this.rules.item),r=!1,f=o.length,u=0;f>u;u++)s=o[u],c=s.length,s=s.replace(/^ *([*+-]|\d+\.) +/,""),~s.indexOf("\n ")&&(c-=s.length,s=this.options.pedantic?s.replace(/^ {1,4}/gm,""):s.replace(new RegExp("^ {1,"+c+"}","gm"),"")),this.options.smartLists&&u!==f-1&&(l=d.bullet.exec(o[u+1])[0],a===l||a.length>1&&l.length>1||(e=o.slice(u+1).join("\n")+e,u=f-1)),i=r||/\n\n(?!\s*$)/.test(s),u!==f-1&&(r="\n"===s.charAt(s.length-1),i||(i=r)),this.tokens.push({type:i?"loose_item_start":"list_item_start"}),this.token(s,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(e))e=e.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(!n&&t&&(o=this.rules.def.exec(e)))e=e.substring(o[0].length),this.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(t&&(o=this.rules.table.exec(e))){for(e=e.substring(o[0].length),s={type:"table", +header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},u=0;u])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:u,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:u,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,p.link=c(p.link)("inside",p._inside)("href",p._href)(),p.reflink=c(p.reflink)("inside",p._inside)(),p.normal=f({},p),p.pedantic=f({},p.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),p.gfm=f({},p.normal,{escape:c(p.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:c(p.text)("]|","~]|")("|","|https?://|")()}),p.breaks=f({},p.gfm,{br:c(p.br)("{2,}","*")(),text:c(p.gfm.text)("{2,}","*")()}),i.rules=p,i.output=function(e,t,n){var r=new i(t,n);return r.output(e)},i.prototype.output=function(e){for(var t,n,r,i,o="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),o+=i[1];else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(n=":"===i[1].charAt(6)?this.mangle(i[1].substring(7)):this.mangle(i[1]),r=this.mangle("mailto:")+n):(n=l(i[1]),r=n),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.tag.exec(e))!this.inLink&&/^/i.test(i[0])&&(this.inLink=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):l(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,o+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(l(i[2],!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),o+=this.renderer.text(l(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),n=l(i[1]),r=n,o+=this.renderer.link(r,null,n);return o},i.prototype.outputLink=function(e,t){var n=l(t.href),r=t.title?l(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,l(e[1]))},i.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},i.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;r>i;i++)t=e.charCodeAt(i),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},o.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'
            '+(n?e:l(e,!0))+"\n
            \n":"
            "+(n?e:l(e,!0))+"\n
            "},o.prototype.blockquote=function(e){return"
            \n"+e+"
            \n"},o.prototype.html=function(e){return e},o.prototype.heading=function(e,t,n){return"'+e+"\n"},o.prototype.hr=function(){return this.options.xhtml?"
            \n":"
            \n"},o.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"\n"},o.prototype.listitem=function(e){return"
          • "+e+"
          • \n"},o.prototype.paragraph=function(e){return"

            "+e+"

            \n"},o.prototype.table=function(e,t){return"\n\n"+e+"\n\n"+t+"\n
            \n"},o.prototype.tablerow=function(e){return"\n"+e+"\n"},o.prototype.tablecell=function(e,t){var n=t.header?"th":"td",r=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return r+e+"\n"},o.prototype.strong=function(e){return""+e+""},o.prototype.em=function(e){return""+e+""},o.prototype.codespan=function(e){return""+e+""},o.prototype.br=function(){return this.options.xhtml?"
            ":"
            "},o.prototype.del=function(e){return""+e+""},o.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(s(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(i){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var o='
            "},o.prototype.image=function(e,t,n){var r=''+n+'":">"},o.prototype.text=function(e){return e},a.parse=function(e,t,n){var r=new a(t,n);return r.parse(e)},a.prototype.parse=function(e){this.inline=new i(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},a.prototype.next=function(){return this.token=this.tokens.pop()},a.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},a.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},a.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,i,o="",a="";for(n="",e=0;ea;a++)for(var s=this.compoundRules[a],c=0,u=s.length;u>c;c++)this.compoundRuleCodes[s[c]]=[];"ONLYINCOMPOUND"in this.flags&&(this.compoundRuleCodes[this.flags.ONLYINCOMPOUND]=[]),this.dictionaryTable=this._parseDIC(n);for(var a in this.compoundRuleCodes)0==this.compoundRuleCodes[a].length&&delete this.compoundRuleCodes[a];for(var a=0,l=this.compoundRules.length;l>a;a++){for(var f=this.compoundRules[a],h="",c=0,u=f.length;u>c;c++){var d=f[c];h+=d in this.compoundRuleCodes?"("+this.compoundRuleCodes[d].join("|")+")":d}this.compoundRules[a]=new RegExp(h,"i")}}return this};i.prototype={load:function(e){for(var t in e)this[t]=e[t];return this},_readFile:function(t,r){if(r||(r="utf8"),"undefined"!=typeof XMLHttpRequest){var i=new XMLHttpRequest;return i.open("GET",t,!1),i.overrideMimeType&&i.overrideMimeType("text/plain; charset="+r),i.send(null),i.responseText}if("undefined"!=typeof e){var o=e("fs");try{if(o.existsSync(t)){var a=o.statSync(t),l=o.openSync(t,"r"),s=new n(a.size);return o.readSync(l,s,0,s.length,null),s.toString(r,0,s.length)}console.log("Path "+t+" does not exist.")}catch(c){return console.log(c),""}}},_parseAFF:function(e){var t={};e=this._removeAffixComments(e);for(var n=e.split("\n"),r=0,i=n.length;i>r;r++){var o=n[r],a=o.split(/\s+/),l=a[0];if("PFX"==l||"SFX"==l){for(var s=a[1],c=a[2],u=parseInt(a[3],10),f=[],h=r+1,d=r+1+u;d>h;h++){var o=n[h],p=o.split(/\s+/),m=p[2],g=p[3].split("/"),v=g[0];"0"===v&&(v="");var y=this.parseRuleCodes(g[1]),x=p[4],b={};b.add=v,y.length>0&&(b.continuationClasses=y),"."!==x&&("SFX"===l?b.match=new RegExp(x+"$"):b.match=new RegExp("^"+x)),"0"!=m&&("SFX"===l?b.remove=new RegExp(m+"$"):b.remove=m),f.push(b)}t[s]={type:l,combineable:"Y"==c,entries:f},r+=u}else if("COMPOUNDRULE"===l){for(var u=parseInt(a[1],10),h=r+1,d=r+1+u;d>h;h++){var o=n[h],p=o.split(/\s+/);this.compoundRules.push(p[1])}r+=u}else if("REP"===l){var p=o.split(/\s+/);3===p.length&&this.replacementTable.push([p[1],p[2]])}else this.flags[l]=a[1]}return t},_removeAffixComments:function(e){return e=e.replace(/#.*$/gm,""),e=e.replace(/^\s\s*/m,"").replace(/\s\s*$/m,""),e=e.replace(/\n{2,}/g,"\n"),e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},_parseDIC:function(e){function t(e,t){e in r&&"object"==typeof r[e]||(r[e]=[]),r[e].push(t)}e=this._removeDicComments(e);for(var n=e.split("\n"),r={},i=1,o=n.length;o>i;i++){var a=n[i],l=a.split("/",2),s=l[0];if(l.length>1){var c=this.parseRuleCodes(l[1]);"NEEDAFFIX"in this.flags&&-1!=c.indexOf(this.flags.NEEDAFFIX)||t(s,c);for(var u=0,f=c.length;f>u;u++){var h=c[u],d=this.rules[h];if(d)for(var p=this._applyRule(s,d),m=0,g=p.length;g>m;m++){var v=p[m];if(t(v,[]),d.combineable)for(var y=u+1;f>y;y++){var x=c[y],b=this.rules[x];if(b&&b.combineable&&d.type!=b.type)for(var w=this._applyRule(v,b),k=0,S=w.length;S>k;k++){var C=w[k];t(C,[])}}}h in this.compoundRuleCodes&&this.compoundRuleCodes[h].push(s)}}else t(s.trim(),[])}return r},_removeDicComments:function(e){return e=e.replace(/^\t.*$/gm,"")},parseRuleCodes:function(e){if(!e)return[];if(!("FLAG"in this.flags))return e.split("");if("long"===this.flags.FLAG){for(var t=[],n=0,r=e.length;r>n;n+=2)t.push(e.substr(n,2));return t}return"num"===this.flags.FLAG?textCode.split(","):void 0},_applyRule:function(e,t){for(var n=t.entries,r=[],i=0,o=n.length;o>i;i++){var a=n[i];if(!a.match||e.match(a.match)){var l=e;if(a.remove&&(l=l.replace(a.remove,"")),"SFX"===t.type?l+=a.add:l=a.add+l,r.push(l),"continuationClasses"in a)for(var s=0,c=a.continuationClasses.length;c>s;s++){var u=this.rules[a.continuationClasses[s]];u&&(r=r.concat(this._applyRule(l,u)))}}}return r},check:function(e){var t=e.replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(this.checkExact(t))return!0;if(t.toUpperCase()===t){var n=t[0]+t.substring(1).toLowerCase();if(this.hasFlag(n,"KEEPCASE"))return!1;if(this.checkExact(n))return!0}var r=t.toLowerCase();if(r!==t){if(this.hasFlag(r,"KEEPCASE"))return!1;if(this.checkExact(r))return!0}return!1},checkExact:function(e){var t=this.dictionaryTable[e];if("undefined"==typeof t){if("COMPOUNDMIN"in this.flags&&e.length>=this.flags.COMPOUNDMIN)for(var n=0,r=this.compoundRules.length;r>n;n++)if(e.match(this.compoundRules[n]))return!0;return!1}if("object"==typeof t){for(var n=0,r=t.length;r>n;n++)if(!this.hasFlag(e,"ONLYINCOMPOUND",t[n]))return!0;return!1}},hasFlag:function(e,t,n){if(t in this.flags){if("undefined"==typeof n)var n=Array.prototype.concat.apply([],this.dictionaryTable[e]);if(n&&-1!==n.indexOf(this.flags[t]))return!0}return!1},alphabet:"",suggest:function(e,t){function n(e){for(var t=[],n=0,r=e.length;r>n;n++){for(var i=e[n],o=[],a=0,l=i.length+1;l>a;a++)o.push([i.substring(0,a),i.substring(a,i.length)]);for(var s=[],a=0,l=o.length;l>a;a++){var u=o[a];u[1]&&s.push(u[0]+u[1].substring(1))}for(var f=[],a=0,l=o.length;l>a;a++){var u=o[a];u[1].length>1&&f.push(u[0]+u[1][1]+u[1][0]+u[1].substring(2))}for(var h=[],a=0,l=o.length;l>a;a++){var u=o[a];if(u[1])for(var d=0,p=c.alphabet.length;p>d;d++)h.push(u[0]+c.alphabet[d]+u[1].substring(1))}for(var m=[],a=0,l=o.length;l>a;a++){var u=o[a];if(u[1])for(var d=0,p=c.alphabet.length;p>d;d++)h.push(u[0]+c.alphabet[d]+u[1])}t=t.concat(s),t=t.concat(f),t=t.concat(h),t=t.concat(m)}return t}function r(e){for(var t=[],n=0;nu;u++)l[u]in s?s[l[u]]+=1:s[l[u]]=1;var h=[];for(var u in s)h.push([u,s[u]]);h.sort(i).reverse();for(var d=[],u=0,f=Math.min(t,h.length);f>u;u++)c.hasFlag(h[u][0],"NOSUGGEST")||d.push(h[u][0]);return d}if(t||(t=5),this.check(e))return[];for(var o=0,a=this.replacementTable.length;a>o;o++){var l=this.replacementTable[o];if(-1!==e.indexOf(l[0])){var s=e.replace(l[0],l[1]);if(this.check(s))return[s]}}var c=this;return c.alphabet="abcdefghijklmnopqrstuvwxyz",i(e)}},"undefined"!=typeof t&&(t.exports=i)}).call(this,e("buffer").Buffer,"/node_modules/typo-js")},{buffer:3,fs:2}],19:[function(e,t,n){var r=e("codemirror");r.commands.tabAndIndentMarkdownList=function(e){var t=e.listSelections(),n=t[0].head,r=e.getStateAfter(n.line),i=r.list!==!1;if(i)return void e.execCommand("indentMore");if(e.options.indentWithTabs)e.execCommand("insertTab");else{var o=Array(e.options.tabSize+1).join(" ");e.replaceSelection(o)}},r.commands.shiftTabAndUnindentMarkdownList=function(e){var t=e.listSelections(),n=t[0].head,r=e.getStateAfter(n.line),i=r.list!==!1;if(i)return void e.execCommand("indentLess");if(e.options.indentWithTabs)e.execCommand("insertTab");else{var o=Array(e.options.tabSize+1).join(" ");e.replaceSelection(o)}}},{codemirror:10}],20:[function(e,t,n){"use strict";function r(e){return e=U?e.replace("Ctrl","Cmd"):e.replace("Cmd","Ctrl")}function i(e,t,n){e=e||{};var r=document.createElement("a");return t=void 0==t?!0:t,e.title&&t&&(r.title=a(e.title,e.action,n),U&&(r.title=r.title.replace("Ctrl","⌘"),r.title=r.title.replace("Alt","⌥"))),r.tabIndex=-1,r.className=e.className,r}function o(){var e=document.createElement("i");return e.className="separator",e.innerHTML="|",e}function a(e,t,n){var i,o=e;return t&&(i=Y(t),n[i]&&(o+=" ("+r(n[i])+")")),o}function l(e,t){t=t||e.getCursor("start");var n=e.getTokenAt(t);if(!n.type)return{};for(var r,i,o=n.type.split(" "),a={},l=0;l=0&&(d=c.getLineHandle(o),!t(d));o--);var v,y,x,b,w=c.getTokenAt({line:o,ch:1}),k=n(w).fencedChars;t(c.getLineHandle(u.line))?(v="",y=u.line):t(c.getLineHandle(u.line-1))?(v="",y=u.line-1):(v=k+"\n",y=u.line),t(c.getLineHandle(f.line))?(x="",b=f.line,0===f.ch&&(b+=1)):0!==f.ch&&t(c.getLineHandle(f.line+1))?(x="",b=f.line+1):(x=k+"\n",b=f.line+1),0===f.ch&&(b-=1),c.operation(function(){c.replaceRange(x,{line:b,ch:0},{line:b+(x?0:1),ch:0}),c.replaceRange(v,{line:y,ch:0},{line:y+(v?0:1),ch:0})}),c.setSelection({line:y+(v?1:0),ch:0},{line:b+(v?1:-1),ch:0}),c.focus()}else{var S=u.line;if(t(c.getLineHandle(u.line))&&("fenced"===r(c,u.line+1)?(o=u.line,S=u.line+1):(a=u.line,S=u.line-1)),void 0===o)for(o=S;o>=0&&(d=c.getLineHandle(o),!t(d));o--);if(void 0===a)for(l=c.lineCount(),a=S;l>a&&(d=c.getLineHandle(a),!t(d));a++);c.operation(function(){c.replaceRange("",{line:o,ch:0},{line:o+1,ch:0}),c.replaceRange("",{line:a-1,ch:0},{line:a,ch:0})}),c.focus()}else if("indented"===p){if(u.line!==f.line||u.ch!==f.ch)o=u.line,a=f.line,0===f.ch&&a--;else{for(o=u.line;o>=0;o--)if(d=c.getLineHandle(o),!d.text.match(/^\s*$/)&&"indented"!==r(c,o,d)){o+=1;break}for(l=c.lineCount(),a=u.line;l>a;a++)if(d=c.getLineHandle(a),!d.text.match(/^\s*$/)&&"indented"!==r(c,a,d)){a-=1;break}}var C=c.getLineHandle(a+1),L=C&&c.getTokenAt({line:a+1,ch:C.text.length-1}),T=L&&n(L).indentedCode;T&&c.replaceRange("\n",{line:a+1,ch:0});for(var M=o;a>=M;M++)c.indentLine(M,"subtract");c.focus()}else{var N=u.line===f.line&&u.ch===f.ch&&0===u.ch,A=u.line!==f.line;N||A?i(c,u,f,s):E(c,!1,["`","`"])}}function d(e){var t=e.codemirror;I(t,"quote")}function p(e){var t=e.codemirror;O(t,"smaller")}function m(e){var t=e.codemirror;O(t,"bigger")}function g(e){var t=e.codemirror;O(t,void 0,1)}function v(e){var t=e.codemirror;O(t,void 0,2)}function y(e){var t=e.codemirror;O(t,void 0,3)}function x(e){var t=e.codemirror;I(t,"unordered-list")}function b(e){var t=e.codemirror;I(t,"ordered-list")}function w(e){var t=e.codemirror;R(t)}function k(e){var t=e.codemirror,n=l(t),r=e.options,i="http://";return r.promptURLs&&(i=prompt(r.promptTexts.link),!i)?!1:void E(t,n.link,r.insertTexts.link,i)}function S(e){var t=e.codemirror,n=l(t),r=e.options,i="http://";return r.promptURLs&&(i=prompt(r.promptTexts.image),!i)?!1:void E(t,n.image,r.insertTexts.image,i)}function C(e){var t=e.codemirror,n=l(t),r=e.options;E(t,n.table,r.insertTexts.table)}function L(e){var t=e.codemirror,n=l(t),r=e.options;E(t,n.image,r.insertTexts.horizontalRule)}function T(e){var t=e.codemirror;t.undo(),t.focus()}function M(e){var t=e.codemirror;t.redo(),t.focus()}function N(e){var t=e.codemirror,n=t.getWrapperElement(),r=n.nextSibling,i=e.toolbarElements["side-by-side"],o=!1;/editor-preview-active-side/.test(r.className)?(r.className=r.className.replace(/\s*editor-preview-active-side\s*/g,""),i.className=i.className.replace(/\s*active\s*/g,""),n.className=n.className.replace(/\s*CodeMirror-sided\s*/g," ")):(setTimeout(function(){t.getOption("fullScreen")||s(e),r.className+=" editor-preview-active-side"},1),i.className+=" active",n.className+=" CodeMirror-sided",o=!0);var a=n.lastChild;if(/editor-preview-active/.test(a.className)){a.className=a.className.replace(/\s*editor-preview-active\s*/g,"");var l=e.toolbarElements.preview,c=n.previousSibling;l.className=l.className.replace(/\s*active\s*/g,""),c.className=c.className.replace(/\s*disabled-for-preview*/g,"")}var u=function(){r.innerHTML=e.options.previewRender(e.value(),r)};t.sideBySideRenderingFunction||(t.sideBySideRenderingFunction=u),o?(r.innerHTML=e.options.previewRender(e.value(),r),t.on("update",t.sideBySideRenderingFunction)):t.off("update",t.sideBySideRenderingFunction),t.refresh()}function A(e){var t=e.codemirror,n=t.getWrapperElement(),r=n.previousSibling,i=e.options.toolbar?e.toolbarElements.preview:!1,o=n.lastChild;o&&/editor-preview/.test(o.className)||(o=document.createElement("div"),o.className="editor-preview",n.appendChild(o)),/editor-preview-active/.test(o.className)?(o.className=o.className.replace(/\s*editor-preview-active\s*/g,""),i&&(i.className=i.className.replace(/\s*active\s*/g,""),r.className=r.className.replace(/\s*disabled-for-preview*/g,""))):(setTimeout(function(){o.className+=" editor-preview-active"},1),i&&(i.className+=" active",r.className+=" disabled-for-preview")),o.innerHTML=e.options.previewRender(e.value(),o);var a=t.getWrapperElement().nextSibling;/editor-preview-active-side/.test(a.className)&&N(e)}function E(e,t,n,r){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){var i,o=n[0],a=n[1],l=e.getCursor("start"),s=e.getCursor("end");r&&(a=a.replace("#url#",r)),t?(i=e.getLine(l.line),o=i.slice(0,l.ch),a=i.slice(l.ch),e.replaceRange(o+a,{line:l.line,ch:0})):(i=e.getSelection(),e.replaceSelection(o+i+a),l.ch+=o.length,l!==s&&(s.ch+=o.length)),e.setSelection(l,s),e.focus()}}function O(e,t,n){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var r=e.getCursor("start"),i=e.getCursor("end"),o=r.line;o<=i.line;o++)!function(r){var i=e.getLine(r),o=i.search(/[^#]/);i=void 0!==t?0>=o?"bigger"==t?"###### "+i:"# "+i:6==o&&"smaller"==t?i.substr(7):1==o&&"bigger"==t?i.substr(2):"bigger"==t?i.substr(1):"#"+i:1==n?0>=o?"# "+i:o==n?i.substr(o+1):"# "+i.substr(o+1):2==n?0>=o?"## "+i:o==n?i.substr(o+1):"## "+i.substr(o+1):0>=o?"### "+i:o==n?i.substr(o+1):"### "+i.substr(o+1),e.replaceRange(i,{line:r,ch:0},{line:r,ch:99999999999999})}(o);e.focus()}}function I(e,t){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var n=l(e),r=e.getCursor("start"),i=e.getCursor("end"),o={quote:/^(\s*)\>\s+/,"unordered-list":/^(\s*)(\*|\-|\+)\s+/,"ordered-list":/^(\s*)\d+\.\s+/},a={quote:"> ","unordered-list":"* ","ordered-list":"1. "},s=r.line;s<=i.line;s++)!function(r){var i=e.getLine(r);i=n[t]?i.replace(o[t],"$1"):a[t]+i,e.replaceRange(i,{line:r,ch:0},{line:r,ch:99999999999999})}(s);e.focus()}}function P(e,t,n,r){if(!/editor-preview-active/.test(e.codemirror.getWrapperElement().lastChild.className)){r="undefined"==typeof r?n:r;var i,o=e.codemirror,a=l(o),s=n,c=r,u=o.getCursor("start"),f=o.getCursor("end");a[t]?(i=o.getLine(u.line),s=i.slice(0,u.ch),c=i.slice(u.ch),"bold"==t?(s=s.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),c=c.replace(/(\*\*|__)/,"")):"italic"==t?(s=s.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),c=c.replace(/(\*|_)/,"")):"strikethrough"==t&&(s=s.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),c=c.replace(/(\*\*|~~)/,"")),o.replaceRange(s+c,{line:u.line,ch:0},{line:u.line,ch:99999999999999}),"bold"==t||"strikethrough"==t?(u.ch-=2,u!==f&&(f.ch-=2)):"italic"==t&&(u.ch-=1,u!==f&&(f.ch-=1))):(i=o.getSelection(),"bold"==t?(i=i.split("**").join(""),i=i.split("__").join("")):"italic"==t?(i=i.split("*").join(""),i=i.split("_").join("")):"strikethrough"==t&&(i=i.split("~~").join("")),o.replaceSelection(s+i+c),u.ch+=n.length,f.ch=u.ch+i.length),o.setSelection(u,f),o.focus()}}function R(e){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className))for(var t,n=e.getCursor("start"),r=e.getCursor("end"),i=n.line;i<=r.line;i++)t=e.getLine(i),t=t.replace(/^[ ]*([# ]+|\*|\-|[> ]+|[0-9]+(.|\)))[ ]*/,""),e.replaceRange(t,{line:i,ch:0},{line:i,ch:99999999999999})}function D(e,t){for(var n in t)t.hasOwnProperty(n)&&(t[n]instanceof Array?e[n]=t[n].concat(e[n]instanceof Array?e[n]:[]):null!==t[n]&&"object"==typeof t[n]&&t[n].constructor===Object?e[n]=D(e[n]||{},t[n]):e[n]=t[n]);return e}function H(e){for(var t=1;t=19968?n[i].length:1;return r}function B(e){e=e||{},e.parent=this;var t=!0;if(e.autoDownloadFontAwesome===!1&&(t=!1),e.autoDownloadFontAwesome!==!0)for(var n=document.styleSheets,r=0;r-1&&(t=!1);if(t){var i=document.createElement("link");i.rel="stylesheet",i.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(i)}if(e.element)this.element=e.element;else if(null===e.element)return void console.log("SimpleMDE: Error. No element was found.");if(void 0===e.toolbar){e.toolbar=[];for(var o in K)K.hasOwnProperty(o)&&(-1!=o.indexOf("separator-")&&e.toolbar.push("|"),(K[o]["default"]===!0||e.showIcons&&e.showIcons.constructor===Array&&-1!=e.showIcons.indexOf(o))&&e.toolbar.push(o))}e.hasOwnProperty("status")||(e.status=["autosave","lines","words","cursor"]),e.previewRender||(e.previewRender=function(e){return this.parent.markdown(e)}),e.parsingConfig=H({highlightFormatting:!0},e.parsingConfig||{}),e.insertTexts=H({},X,e.insertTexts||{}),e.promptTexts=Z,e.blockStyles=H({},J,e.blockStyles||{}),e.shortcuts=H({},G,e.shortcuts||{}),void 0!=e.autosave&&void 0!=e.autosave.unique_id&&""!=e.autosave.unique_id&&(e.autosave.uniqueId=e.autosave.unique_id),this.options=e,this.render(),!e.initialValue||this.options.autosave&&this.options.autosave.foundSavedValue===!0||this.value(e.initialValue)}function _(){if("object"!=typeof localStorage)return!1;try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch(e){return!1}return!0}var F=e("codemirror");e("codemirror/addon/edit/continuelist.js"),e("./codemirror/tablist"),e("codemirror/addon/display/fullscreen.js"),e("codemirror/mode/markdown/markdown.js"),e("codemirror/addon/mode/overlay.js"),e("codemirror/addon/display/placeholder.js"),e("codemirror/addon/selection/mark-selection.js"),e("codemirror/mode/gfm/gfm.js"),e("codemirror/mode/xml/xml.js");var z=e("codemirror-spell-checker"),j=e("marked"),U=/Mac/.test(navigator.platform),q={toggleBold:c,toggleItalic:u,drawLink:k,toggleHeadingSmaller:p,toggleHeadingBigger:m,drawImage:S,toggleBlockquote:d,toggleOrderedList:b,toggleUnorderedList:x,toggleCodeBlock:h,togglePreview:A,toggleStrikethrough:f,toggleHeading1:g,toggleHeading2:v,toggleHeading3:y,cleanBlock:w,drawTable:C,drawHorizontalRule:L,undo:T,redo:M,toggleSideBySide:N,toggleFullScreen:s},G={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Y=function(e){for(var t in q)if(q[t]===e)return t;return null},$=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0); +}(navigator.userAgent||navigator.vendor||window.opera),e},V="",K={bold:{name:"bold",action:c,className:"fa fa-bold",title:"Bold","default":!0},italic:{name:"italic",action:u,className:"fa fa-italic",title:"Italic","default":!0},strikethrough:{name:"strikethrough",action:f,className:"fa fa-strikethrough",title:"Strikethrough"},heading:{name:"heading",action:p,className:"fa fa-header",title:"Heading","default":!0},"heading-smaller":{name:"heading-smaller",action:p,className:"fa fa-header fa-header-x fa-header-smaller",title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:m,className:"fa fa-header fa-header-x fa-header-bigger",title:"Bigger Heading"},"heading-1":{name:"heading-1",action:g,className:"fa fa-header fa-header-x fa-header-1",title:"Big Heading"},"heading-2":{name:"heading-2",action:v,className:"fa fa-header fa-header-x fa-header-2",title:"Medium Heading"},"heading-3":{name:"heading-3",action:y,className:"fa fa-header fa-header-x fa-header-3",title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:h,className:"fa fa-code",title:"Code"},quote:{name:"quote",action:d,className:"fa fa-quote-left",title:"Quote","default":!0},"unordered-list":{name:"unordered-list",action:x,className:"fa fa-list-ul",title:"Generic List","default":!0},"ordered-list":{name:"ordered-list",action:b,className:"fa fa-list-ol",title:"Numbered List","default":!0},"clean-block":{name:"clean-block",action:w,className:"fa fa-eraser fa-clean-block",title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:k,className:"fa fa-link",title:"Create Link","default":!0},image:{name:"image",action:S,className:"fa fa-picture-o",title:"Insert Image","default":!0},table:{name:"table",action:C,className:"fa fa-table",title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:L,className:"fa fa-minus",title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:A,className:"fa fa-eye no-disable",title:"Toggle Preview","default":!0},"side-by-side":{name:"side-by-side",action:N,className:"fa fa-columns no-disable no-mobile",title:"Toggle Side by Side","default":!0},fullscreen:{name:"fullscreen",action:s,className:"fa fa-arrows-alt no-disable no-mobile",title:"Toggle Fullscreen","default":!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://simplemde.com/markdown-guide",className:"fa fa-question-circle",title:"Markdown Guide","default":!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:T,className:"fa fa-undo no-disable",title:"Undo"},redo:{name:"redo",action:M,className:"fa fa-repeat no-disable",title:"Redo"}},X={link:["[","](#url#)"],image:["![](","#url#)"],table:["","\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],horizontalRule:["","\n\n-----\n\n"]},Z={link:"URL for the link:",image:"URL of the image:"},J={bold:"**",code:"```",italic:"*"};B.prototype.markdown=function(e){if(j){var t={};return this.options&&this.options.renderingConfig&&this.options.renderingConfig.singleLineBreaks===!1?t.breaks=!1:t.breaks=!0,this.options&&this.options.renderingConfig&&this.options.renderingConfig.codeSyntaxHighlighting===!0&&window.hljs&&(t.highlight=function(e){return window.hljs.highlightAuto(e).value}),j.setOptions(t),j(e)}},B.prototype.render=function(e){if(e||(e=this.element||document.getElementsByTagName("textarea")[0]),!this._rendered||this._rendered!==e){this.element=e;var t=this.options,n=this,i={};for(var o in t.shortcuts)null!==t.shortcuts[o]&&null!==q[o]&&!function(e){i[r(t.shortcuts[e])]=function(){q[e](n)}}(o);i.Enter="newlineAndIndentContinueMarkdownList",i.Tab="tabAndIndentMarkdownList",i["Shift-Tab"]="shiftTabAndUnindentMarkdownList",i.Esc=function(e){e.getOption("fullScreen")&&s(n)},document.addEventListener("keydown",function(e){e=e||window.event,27==e.keyCode&&n.codemirror.getOption("fullScreen")&&s(n)},!1);var a,l;if(t.spellChecker!==!1?(a="spell-checker",l=t.parsingConfig,l.name="gfm",l.gitHubSpice=!1,z({codeMirrorInstance:F})):(a=t.parsingConfig,a.name="gfm",a.gitHubSpice=!1),this.codemirror=F.fromTextArea(e,{mode:a,backdrop:l,theme:"paper",tabSize:void 0!=t.tabSize?t.tabSize:2,indentUnit:void 0!=t.tabSize?t.tabSize:2,indentWithTabs:t.indentWithTabs!==!1,lineNumbers:!1,autofocus:t.autofocus===!0,extraKeys:i,lineWrapping:t.lineWrapping!==!1,allowDropFileTypes:["text/plain"],placeholder:t.placeholder||e.getAttribute("placeholder")||"",styleSelectedText:void 0!=t.styleSelectedText?t.styleSelectedText:!0}),t.forceSync===!0){var c=this.codemirror;c.on("change",function(){c.save()})}this.gui={},t.toolbar!==!1&&(this.gui.toolbar=this.createToolbar()),t.status!==!1&&(this.gui.statusbar=this.createStatusbar()),void 0!=t.autosave&&t.autosave.enabled===!0&&this.autosave(),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element;var u=this.codemirror;setTimeout(function(){u.refresh()}.bind(u),0)}},B.prototype.autosave=function(){if(_()){var e=this;if(void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to use the autosave feature");null!=e.element.form&&void 0!=e.element.form&&e.element.form.addEventListener("submit",function(){localStorage.removeItem("smde_"+e.options.autosave.uniqueId)}),this.options.autosave.loaded!==!0&&("string"==typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&""!=localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0),localStorage.setItem("smde_"+this.options.autosave.uniqueId,e.value());var t=document.getElementById("autosaved");if(null!=t&&void 0!=t&&""!=t){var n=new Date,r=n.getHours(),i=n.getMinutes(),o="am",a=r;a>=12&&(a=r-12,o="pm"),0==a&&(a=12),i=10>i?"0"+i:i,t.innerHTML="Autosaved: "+a+":"+i+" "+o}this.autosaveTimeoutId=setTimeout(function(){e.autosave()},this.options.autosave.delay||1e4)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},B.prototype.clearAutosavedValue=function(){if(_()){if(void 0==this.options.autosave||void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to clear the autosave value");localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},B.prototype.createSideBySide=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.nextSibling;n&&/editor-preview-side/.test(n.className)||(n=document.createElement("div"),n.className="editor-preview-side",t.parentNode.insertBefore(n,t.nextSibling));var r=!1,i=!1;return e.on("scroll",function(e){if(r)return void(r=!1);i=!0;var t=e.getScrollInfo().height-e.getScrollInfo().clientHeight,o=parseFloat(e.getScrollInfo().top)/t,a=(n.scrollHeight-n.clientHeight)*o;n.scrollTop=a}),n.onscroll=function(){if(i)return void(i=!1);r=!0;var t=n.scrollHeight-n.clientHeight,o=parseFloat(n.scrollTop)/t,a=(e.getScrollInfo().height-e.getScrollInfo().clientHeight)*o;e.scrollTo(0,a)},n},B.prototype.createToolbar=function(e){if(e=e||this.options.toolbar,e&&0!==e.length){var t;for(t=0;t0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]\"\\\/|]/g.test(this.videoName))throw new Error('Cant use these chars in filename: \\ / : * ? " < > |');n=this.videoName}else n=e.name.substring(0,t);this.videoInfo={name:n,type:e.name.substring(t+1).toLowerCase(),size:e.size},this.sessionName+=e.name+"_"+e.size+";"}var r=this.coverFile;if(r){var o=r.name,i=o.lastIndexOf(".");this.coverInfo={name:o.substring(0,i),type:o.substring(i+1).toLowerCase(),size:r.size},this.sessionName+=r.name+"_"+r.size+";"}},t.prototype.applyUploadUGC=function(e){return void 0===e&&(e=0),a(this,void 0,void 0,function(){function t(t){return a(this,void 0,void 0,function(){return s(this,function(r){switch(r.label){case 0:if(n.emit(h.VodReportEvent.report_apply,{err:t,requestStartTime:l}),n.delStorage(n.sessionName),n.applyRequestRetryCount==e){if(t)throw t;throw new Error("apply upload failed")}return[4,f.default.delay(n.retryDelay)];case 1:return r.sent(),[2,n.applyUploadUGC(e+1)]}})})}var n,r,o,i,c,u,l,d,m,g,y,v;return s(this,function(e){switch(e.label){case 0:return n=this,[4,this.getSignature()];case 1:if(r=e.sent(),i=this.videoInfo,c=this.coverInfo,u=this.vodSessionKey||this.getStorage(this.sessionName))o={signature:r,vodSessionKey:u};else if(i)o={signature:r,videoName:i.name,videoType:i.type,videoSize:i.size},c&&(o.coverName=c.name,o.coverType=c.type,o.coverSize=c.size);else{if(!this.fileId||!c)throw"Wrong params, please check and try again";o={signature:r,fileId:this.fileId,coverName:c.name,coverType:c.type,coverSize:c.size}}l=new Date,e.label=2;case 2:return e.trys.push([2,4,,5]),[4,p.default.post("https://vod2.qcloud.com/v3/index.php?Action=ApplyUploadUGC",o,{timeout:this.applyRequestTimeout,withCredentials:!1})];case 3:return d=e.sent(),[3,5];case 4:return[2,t(e.sent())];case 5:return 0==(m=d.data).code?(g=m.data,y=g.vodSessionKey,this.setStorage(this.sessionName,y),this.vodSessionKey=y,this.appId=g.appId,this.emit(h.VodReportEvent.report_apply,{data:g,requestStartTime:l}),[2,g]):((v=new Error(m.message)).code=m.code,[2,t(v)])}})})},t.prototype.uploadToCos=function(e){return a(this,void 0,void 0,function(){var t,n,r,o,u,d,p,m;return s(this,function(g){switch(g.label){case 0:return t=this,n={bucket:e.storageBucket+"-"+e.storageAppId,region:e.storageRegionV5},r=new l({getAuthorization:function(e,n){return a(this,void 0,void 0,function(){var e;return s(this,function(r){switch(r.label){case 0:return[4,t.applyUploadUGC()];case 1:return e=r.sent(),n({TmpSecretId:e.tempCertificate.secretId,TmpSecretKey:e.tempCertificate.secretKey,XCosSecurityToken:e.tempCertificate.token,ExpiredTime:e.tempCertificate.expiredTime}),[2]}})})}}),this.cos=r,o=[],this.videoFile&&(u=i({},n,{file:this.videoFile,key:e.video.storagePath,onProgress:function(e){t.emit(c.video_progress,e),t.emit(c.media_progress,e)},onUpload:function(e){t.emit(c.video_upload,e),t.emit(c.media_upload,e)},onTaskReady:function(e){t.taskId=e}}),o.push(u)),this.coverFile&&(d=i({},n,{file:this.coverFile,key:e.cover.storagePath,onProgress:function(e){t.emit(c.cover_progress,e)},onUpload:function(e){t.emit(c.cover_upload,e)},onTaskReady:f.default.noop}),o.push(d)),p=new Date,m=o.map(function(e){return new Promise(function(n,o){r.sliceUploadFile({Bucket:e.bucket,Region:e.region,Key:e.key,Body:e.file,onTaskReady:e.onTaskReady,onProgress:e.onProgress},function(r,i){if(e.file===t.videoFile&&t.emit(h.VodReportEvent.report_cos_upload,{err:r,requestStartTime:p}),!r)return e.onUpload(i),n();t.delStorage(t.sessionName),o(r)})})}),[4,Promise.all(m)];case 1:return[2,g.sent()]}})})},t.prototype.commitUploadUGC=function(e){return void 0===e&&(e=0),a(this,void 0,void 0,function(){function t(t){return a(this,void 0,void 0,function(){return s(this,function(r){switch(r.label){case 0:if(n.emit(h.VodReportEvent.report_commit,{err:t,requestStartTime:i}),n.commitRequestRetryCount==e){if(t)throw t;throw new Error("commit upload failed")}return[4,f.default.delay(n.retryDelay)];case 1:return r.sent(),[2,n.commitUploadUGC(e+1)]}})})}var n,r,o,i,c,u,l;return s(this,function(e){switch(e.label){case 0:return n=this,[4,this.getSignature()];case 1:r=e.sent(),this.delStorage(this.sessionName),o=this.vodSessionKey,i=new Date,e.label=2;case 2:return e.trys.push([2,4,,5]),[4,p.default.post("https://vod2.qcloud.com/v3/index.php?Action=CommitUploadUGC",{signature:r,vodSessionKey:o},{timeout:this.commitRequestTimeout,withCredentials:!1})];case 3:return c=e.sent(),[3,5];case 4:return[2,t(e.sent())];case 5:return 0==(u=c.data).code?(this.emit(h.VodReportEvent.report_commit,{data:u.data,requestStartTime:i}),[2,u.data]):((l=new Error(u.message)).code=u.code,[2,t(l)])}})})},t.prototype.start=function(){var e=this,t=new Date;this.donePromise=this._start().then(function(n){return e.emit(h.VodReportEvent.report_done,{err:{code:0},requestStartTime:t}),n}).catch(function(n){throw e.emit(h.VodReportEvent.report_done,{err:{code:n&&n.code||f.default.CLIENT_ERROR_CODE.UPLOAD_FAIL},requestStartTime:t}),n})},t.prototype._start=function(){return a(this,void 0,void 0,function(){var e;return s(this,function(t){switch(t.label){case 0:return[4,this.applyUploadUGC()];case 1:return e=t.sent(),[4,this.uploadToCos(e)];case 2:return t.sent(),[4,this.commitUploadUGC()];case 3:return[2,t.sent()]}})})},t.prototype.done=function(){return this.donePromise},t.prototype.cancel=function(){this.cos.cancelTask(this.taskId)},t}(d.EventEmitter);t.default=g},function(module,exports,__webpack_require__){(function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__; + /* + * [js-sha1]{@link https://github.com/emn178/js-sha1} + * + * @version 0.6.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2014-2017 + * @license MIT + */ + /* + * [js-sha1]{@link https://github.com/emn178/js-sha1} + * + * @version 0.6.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2014-2017 + * @license MIT + */ + !function(){"use strict";var root="object"==typeof window?window:{},NODE_JS=!root.JS_SHA1_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS&&(root=global);var COMMON_JS=!root.JS_SHA1_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD=__webpack_require__(5),HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[],createOutputMethod=function(e){return function(t){return new Sha1(!0).update(t)[e]()}},createMethod=function(){var e=createOutputMethod("hex");NODE_JS&&(e=nodeWrap(e)),e.create=function(){return new Sha1},e.update=function(t){return e.create().update(t)};for(var t=0;t>2]|=e[o]<>2]|=n<>2]|=(192|n>>6)<>2]|=(128|63&n)<=57344?(a[r>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<=64?(this.block=a[16],this.start=r-64,this.hash(),this.hashed=!0):this.start=r}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha1.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=EXTRA[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},Sha1.prototype.hash=function(){var e,t,n=this.h0,r=this.h1,o=this.h2,i=this.h3,a=this.h4,s=this.blocks;for(e=16;e<80;++e)t=s[e-3]^s[e-8]^s[e-14]^s[e-16],s[e]=t<<1|t>>>31;for(e=0;e<20;e+=5)n=(t=(r=(t=(o=(t=(i=(t=(a=(t=n<<5|n>>>27)+(r&o|~r&i)+a+1518500249+s[e]<<0)<<5|a>>>27)+(n&(r=r<<30|r>>>2)|~n&o)+i+1518500249+s[e+1]<<0)<<5|i>>>27)+(a&(n=n<<30|n>>>2)|~a&r)+o+1518500249+s[e+2]<<0)<<5|o>>>27)+(i&(a=a<<30|a>>>2)|~i&n)+r+1518500249+s[e+3]<<0)<<5|r>>>27)+(o&(i=i<<30|i>>>2)|~o&a)+n+1518500249+s[e+4]<<0,o=o<<30|o>>>2;for(;e<40;e+=5)n=(t=(r=(t=(o=(t=(i=(t=(a=(t=n<<5|n>>>27)+(r^o^i)+a+1859775393+s[e]<<0)<<5|a>>>27)+(n^(r=r<<30|r>>>2)^o)+i+1859775393+s[e+1]<<0)<<5|i>>>27)+(a^(n=n<<30|n>>>2)^r)+o+1859775393+s[e+2]<<0)<<5|o>>>27)+(i^(a=a<<30|a>>>2)^n)+r+1859775393+s[e+3]<<0)<<5|r>>>27)+(o^(i=i<<30|i>>>2)^a)+n+1859775393+s[e+4]<<0,o=o<<30|o>>>2;for(;e<60;e+=5)n=(t=(r=(t=(o=(t=(i=(t=(a=(t=n<<5|n>>>27)+(r&o|r&i|o&i)+a-1894007588+s[e]<<0)<<5|a>>>27)+(n&(r=r<<30|r>>>2)|n&o|r&o)+i-1894007588+s[e+1]<<0)<<5|i>>>27)+(a&(n=n<<30|n>>>2)|a&r|n&r)+o-1894007588+s[e+2]<<0)<<5|o>>>27)+(i&(a=a<<30|a>>>2)|i&n|a&n)+r-1894007588+s[e+3]<<0)<<5|r>>>27)+(o&(i=i<<30|i>>>2)|o&a|i&a)+n-1894007588+s[e+4]<<0,o=o<<30|o>>>2;for(;e<80;e+=5)n=(t=(r=(t=(o=(t=(i=(t=(a=(t=n<<5|n>>>27)+(r^o^i)+a-899497514+s[e]<<0)<<5|a>>>27)+(n^(r=r<<30|r>>>2)^o)+i-899497514+s[e+1]<<0)<<5|i>>>27)+(a^(n=n<<30|n>>>2)^r)+o-899497514+s[e+2]<<0)<<5|o>>>27)+(i^(a=a<<30|a>>>2)^n)+r-899497514+s[e+3]<<0)<<5|r>>>27)+(o^(i=i<<30|i>>>2)^a)+n-899497514+s[e+4]<<0,o=o<<30|o>>>2;this.h0=this.h0+n<<0,this.h1=this.h1+r<<0,this.h2=this.h2+o<<0,this.h3=this.h3+i<<0,this.h4=this.h4+a<<0},Sha1.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,o=this.h4;return HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o]},Sha1.prototype.toString=Sha1.prototype.hex,Sha1.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,o=this.h4;return[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,r>>24&255,r>>16&255,r>>8&255,255&r,o>>24&255,o>>16&255,o>>8&255,255&o]},Sha1.prototype.array=Sha1.prototype.digest,Sha1.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(20),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),e};var exports=createMethod();COMMON_JS?module.exports=exports:(root.sha1=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))}()}).call(this,__webpack_require__(3),__webpack_require__(4))},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],l=!1,d=-1;function p(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&f())}function f(){if(!l){var e=s(p);l=!0;for(var t=u.length;t;){for(c=u,u=[];++d1)for(var n=1;n-1&&(n[e]=t[e])}();w.each({"x-cos-mfa":"MFA","Content-MD5":"ContentMD5","Content-Length":"ContentLength","Content-Type":"ContentType",Expect:"Expect",Expires:"Expires","Cache-Control":"CacheControl","Content-Disposition":"ContentDisposition","Content-Encoding":"ContentEncoding",Range:"Range","If-Modified-Since":"IfModifiedSince","If-Unmodified-Since":"IfUnmodifiedSince","If-Match":"IfMatch","If-None-Match":"IfNoneMatch","x-cos-copy-source":"CopySource","x-cos-copy-source-Range":"CopySourceRange","x-cos-metadata-directive":"MetadataDirective","x-cos-copy-source-If-Modified-Since":"CopySourceIfModifiedSince","x-cos-copy-source-If-Unmodified-Since":"CopySourceIfUnmodifiedSince","x-cos-copy-source-If-Match":"CopySourceIfMatch","x-cos-copy-source-If-None-Match":"CopySourceIfNoneMatch","x-cos-acl":"ACL","x-cos-grant-read":"GrantRead","x-cos-grant-write":"GrantWrite","x-cos-grant-full-control":"GrantFullControl","x-cos-grant-read-acp":"GrantReadAcp","x-cos-grant-write-acp":"GrantWriteAcp","x-cos-storage-class":"StorageClass","x-cos-server-side-encryption-customer-algorithm":"SSECustomerAlgorithm","x-cos-server-side-encryption-customer-key":"SSECustomerKey","x-cos-server-side-encryption-customer-key-MD5":"SSECustomerKeyMD5","x-cos-server-side-encryption":"ServerSideEncryption","x-cos-server-side-encryption-cos-kms-key-id":"SSEKMSKeyId","x-cos-server-side-encryption-context":"SSEContext"},function(e,r){void 0!==t[e]&&(n[r]=t[e])}),t.Headers=u(n)}}return t},S=function(e){return Date.now()+(e||0)},w={noop:c,formatParams:b,apiWrapper:function(e,t){return function(n,r){"function"==typeof n&&(r=n,n={}),n=b(e,n);var o=function(e){return e&&e.headers&&(e.headers["x-cos-version-id"]&&(e.VersionId=e.headers["x-cos-version-id"]),e.headers["x-cos-delete-marker"]&&(e.DeleteMarker=e.headers["x-cos-delete-marker"])),e},i=function(e,t){r&&r(o(e),o(t))};if("getService"!==e&&"abortUploadTask"!==e){var a;if(a=function(e,t){var n=t.Bucket,r=t.Region,o=t.Key;if(e.indexOf("Bucket")>-1||"deleteMultipleObject"===e||"multipartList"===e||"listObjectVersions"===e){if(!n)return"Bucket";if(!r)return"Region"}else if(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e){if(!n)return"Bucket";if(!r)return"Region";if(!o)return"Key"}return!1}(e,n))return void i({error:"missing param "+a});if(n.Region){if(n.Region.indexOf("cos.")>-1)return void i({error:'param Region should not be start with "cos."'});if(!/^([a-z\d-]+)$/.test(n.Region))return void i({error:"Region format error."});this.options.CompatibilityMode||-1!==n.Region.indexOf("-")||"yfb"===n.Region||"default"===n.Region||console.warn("warning: param Region format error, find help here: https://cloud.tencent.com/document/product/436/6224")}if(n.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(n.Bucket))if(n.AppId)n.Bucket=n.Bucket+"-"+n.AppId;else{if(!this.options.AppId)return void i({error:'Bucket should format as "test-1250000000".'});n.Bucket=n.Bucket+"-"+this.options.AppId}n.AppId&&(console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'),delete n.AppId)}!this.options.UseRawKey&&n.Key&&"/"===n.Key.substr(0,1)&&(n.Key=n.Key.substr(1))}var s=t.call(this,n,i);if("getAuth"===e||"getObjectUrl"===e)return s}},xml2json:i,json2xml:a,md5:r,clearKey:u,getFileMd5:function(e,t){!function(e,t){var n,r=new FileReader;FileReader.prototype.readAsBinaryString?(n=FileReader.prototype.readAsBinaryString,r.onload=function(){t(this.result)}):FileReader.prototype.readAsArrayBuffer?n=function(e){var n="",r=new FileReader;r.onload=function(e){for(var o=new Uint8Array(r.result),i=o.byteLength,a=0;at?1:-1})},p=function(e){var t,n,r,o=[],i=d(e);for(t=0;tparseInt(t[n])?1:-1;return 0},m=navigator&&navigator.userAgent,g=(m.match(/Chrome\/([.\d]+)/)||[])[1],y=(m.match(/QBCore\/([.\d]+)/)||[])[1],v=(m.match(/QQBrowser\/([.\d]+)/)||[])[1],g&&C(g,"53.0.2785.116")<0&&y&&C(y,"3.53.991.400")<0&&v&&C(v,"9.0.2524.400")<=0||!1);w.fileSlice=function(e,t,n,r,o){var i;if(e.slice?i=e.slice(t,n):e.mozSlice?i=e.mozSlice(t,n):e.webkitSlice&&(i=e.webkitSlice(t,n)),r&&x){var a=new FileReader;a.onload=function(e){i=null,o(new Blob([a.result]))},a.readAsArrayBuffer(i)}else o(i)},w.getFileUUID=function(e,t){return e.name&&e.size&&e.lastModifiedDate&&t?w.md5([e.name,e.size,e.lastModifiedDate,t].join("::")):null},w.getBodyMd5=function(e,t,n){n=n||c,e?"string"==typeof t?n(w.md5(t,!0)):Blob&&t instanceof Blob?w.getFileMd5(t,function(e,t){n(t)}):n():n()},e.exports=w},function(e,t){function n(e,t){var n=e[0],r=e[1],c=e[2],u=e[3];n=o(n,r,c,u,t[0],7,-680876936),u=o(u,n,r,c,t[1],12,-389564586),c=o(c,u,n,r,t[2],17,606105819),r=o(r,c,u,n,t[3],22,-1044525330),n=o(n,r,c,u,t[4],7,-176418897),u=o(u,n,r,c,t[5],12,1200080426),c=o(c,u,n,r,t[6],17,-1473231341),r=o(r,c,u,n,t[7],22,-45705983),n=o(n,r,c,u,t[8],7,1770035416),u=o(u,n,r,c,t[9],12,-1958414417),c=o(c,u,n,r,t[10],17,-42063),r=o(r,c,u,n,t[11],22,-1990404162),n=o(n,r,c,u,t[12],7,1804603682),u=o(u,n,r,c,t[13],12,-40341101),c=o(c,u,n,r,t[14],17,-1502002290),n=i(n,r=o(r,c,u,n,t[15],22,1236535329),c,u,t[1],5,-165796510),u=i(u,n,r,c,t[6],9,-1069501632),c=i(c,u,n,r,t[11],14,643717713),r=i(r,c,u,n,t[0],20,-373897302),n=i(n,r,c,u,t[5],5,-701558691),u=i(u,n,r,c,t[10],9,38016083),c=i(c,u,n,r,t[15],14,-660478335),r=i(r,c,u,n,t[4],20,-405537848),n=i(n,r,c,u,t[9],5,568446438),u=i(u,n,r,c,t[14],9,-1019803690),c=i(c,u,n,r,t[3],14,-187363961),r=i(r,c,u,n,t[8],20,1163531501),n=i(n,r,c,u,t[13],5,-1444681467),u=i(u,n,r,c,t[2],9,-51403784),c=i(c,u,n,r,t[7],14,1735328473),n=a(n,r=i(r,c,u,n,t[12],20,-1926607734),c,u,t[5],4,-378558),u=a(u,n,r,c,t[8],11,-2022574463),c=a(c,u,n,r,t[11],16,1839030562),r=a(r,c,u,n,t[14],23,-35309556),n=a(n,r,c,u,t[1],4,-1530992060),u=a(u,n,r,c,t[4],11,1272893353),c=a(c,u,n,r,t[7],16,-155497632),r=a(r,c,u,n,t[10],23,-1094730640),n=a(n,r,c,u,t[13],4,681279174),u=a(u,n,r,c,t[0],11,-358537222),c=a(c,u,n,r,t[3],16,-722521979),r=a(r,c,u,n,t[6],23,76029189),n=a(n,r,c,u,t[9],4,-640364487),u=a(u,n,r,c,t[12],11,-421815835),c=a(c,u,n,r,t[15],16,530742520),n=s(n,r=a(r,c,u,n,t[2],23,-995338651),c,u,t[0],6,-198630844),u=s(u,n,r,c,t[7],10,1126891415),c=s(c,u,n,r,t[14],15,-1416354905),r=s(r,c,u,n,t[5],21,-57434055),n=s(n,r,c,u,t[12],6,1700485571),u=s(u,n,r,c,t[3],10,-1894986606),c=s(c,u,n,r,t[10],15,-1051523),r=s(r,c,u,n,t[1],21,-2054922799),n=s(n,r,c,u,t[8],6,1873313359),u=s(u,n,r,c,t[15],10,-30611744),c=s(c,u,n,r,t[6],15,-1560198380),r=s(r,c,u,n,t[13],21,1309151649),n=s(n,r,c,u,t[4],6,-145523070),u=s(u,n,r,c,t[11],10,-1120210379),c=s(c,u,n,r,t[2],15,718787259),r=s(r,c,u,n,t[9],21,-343485551),e[0]=p(n,e[0]),e[1]=p(r,e[1]),e[2]=p(c,e[2]),e[3]=p(u,e[3])}function r(e,t,n,r,o,i){return t=p(p(t,e),p(r,i)),p(t<>>32-o,n)}function o(e,t,n,o,i,a,s){return r(t&n|~t&o,e,t,i,a,s)}function i(e,t,n,o,i,a,s){return r(t&o|n&~o,e,t,i,a,s)}function a(e,t,n,o,i,a,s){return r(t^n^o,e,t,i,a,s)}function s(e,t,n,o,i,a,s){return r(n^(t|~o),e,t,i,a,s)}function c(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}var u="0123456789abcdef".split("");function l(e){for(var t="",n=0;n<4;n++)t+=u[e>>8*n+4&15]+u[e>>8*n&15];return t}function d(e,t){return t||(e=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e)),function(e){for(var t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(o,i),t=0;t<16;t++)i[t]=0;return i[14]=8*r,n(o,i),o}(e))}var p=function(e,t){return e+t&4294967295};"5d41402abc4b2a76b9719d911017c592"!=d("hello")&&(p=function(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}),e.exports=d},function(e,t,n){var r,o,i,a,s,c,u,l=l||function(e,t){var n={},r=n.lib={},o=function(){},i=r.Base={extend:function(e){o.prototype=this;var t=new o;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes;if(e=e.sigBytes,this.clamp(),r%4)for(var o=0;o>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(r+o)%4*8;else if(65535>>2]=n[o>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r>>2]>>>24-r%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},u=s.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new a.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},d=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i);if(t=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,o=e.min(4*t,o),t){for(var c=0;cu;u++){if(16>u)a[u]=0|e[t+u];else{var l=a[u-3]^a[u-8]^a[u-14]^a[u-16];a[u]=l<<1|l>>>31}l=(r<<5|r>>>27)+c+a[u],l=20>u?l+(1518500249+(o&i|~o&s)):40>u?l+(1859775393+(o^i^s)):60>u?l+((o&i|o&s|i&s)-1894007588):l+((o^i^s)-899497514),c=s,s=i,i=o<<30|o>>>2,o=r,r=l}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+s|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=i._createHelper(s),r.HmacSHA1=i._createHmacHelper(s),function(){var e=l,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,o=4*r;n.sigBytes>o&&(n=e.finalize(n)),n.clamp();for(var i=this._oKey=n.clone(),a=this._iKey=n.clone(),s=i.words,c=a.words,u=0;u>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s>>6*(3-s)&63));var c=r.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,n=this._map,r=n.charAt(64);if(r){var o=e.indexOf(r);-1!=o&&(t=o)}for(var i=[],a=0,s=0;s>>6-s%4*2;i[a>>>2]|=(c|l)<<24-a%4*8,a++}return u.create(i,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.exports=l},function(e,t,n){var r=n(12).DOMParser,o=function(){this.version="1.3.5";var e={mergeCDATA:!0,normalize:!0,stripElemPrefix:!0},t=new RegExp(/(?!xmlns)^.*:/);new RegExp(/^\s+|\s+$/g);return this.grokType=function(e){return/^\s*$/.test(e)?null:/^(?:true|false)$/i.test(e)?"true"===e.toLowerCase():isFinite(e)?parseFloat(e):e},this.parseString=function(e,t){if(e){var n=this.stringToXML(e);return n.getElementsByTagName("parsererror").length?null:this.parseXML(n,t)}return null},this.parseXML=function(n,r){for(var i in r)e[i]=r[i];var a={},s=0,c="";if(n.childNodes.length)for(var u,l,d,p=0;p=t+n||t?new java.lang.String(e,t,n)+"":e}function c(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}r.prototype.parseFromString=function(e,t){var n=this.options,r=new u,i=n.domBuilder||new o,s=n.errorHandler,c=n.locator,l=n.xmlns||{},d={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return c&&i.setDocumentLocator(c),r.errorHandler=function(e,t,n){if(!e){if(t instanceof o)return t;e=t}var r={},i=e instanceof Function;function s(t){var o=e[t];!o&&i&&(o=2==e.length?function(n){e(t,n)}:e),r[t]=o&&function(e){o("[xmldom "+t+"]\t"+e+a(n))}||function(){}}return n=n||{},s("warning"),s("error"),s("fatalError"),r}(s,i,c),r.domBuilder=n.domBuilder||i,/\/x?html?$/.test(t)&&(d.nbsp=" ",d.copy="©",l[""]="http://www.w3.org/1999/xhtml"),l.xml=l.xml||"http://www.w3.org/XML/1998/namespace",e?r.parse(e,l,d):r.errorHandler.error("invalid doc source"),i.doc},o.prototype={startDocument:function(){this.doc=(new l).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var o=this.doc,a=o.createElementNS(e,n||t),s=r.length;c(this,a),this.currentElement=a,this.locator&&i(this.locator,a);for(var u=0;u":switch(g){case i:n.setTagName(e.slice(t,m));case l:case d:case p:break;case u:case a:"/"===(v=e.slice(t,m)).slice(-1)&&(n.closed=!0,v=v.slice(0,-1));case s:g===s&&(v=h),g==u?(f.warning('attribute "'+v+'" missed quot(")!!'),n.add(h,v.replace(/&#?\w+;/g,o),t)):("http://www.w3.org/1999/xhtml"===r[""]&&v.match(/^(?:disabled|checked|selected)$/i)||f.warning('attribute "'+v+'" missed value!! "'+v+'" instead!!'),n.add(v,v,t));break;case c:throw new Error("attribute value missed!!")}return m;case"€":y=" ";default:if(y<=" ")switch(g){case i:n.setTagName(e.slice(t,m)),g=d;break;case a:h=e.slice(t,m),g=s;break;case u:var v=e.slice(t,m).replace(/&#?\w+;/g,o);f.warning('attribute "'+v+'" missed quot(")!!'),n.add(h,v,t);case l:g=d}else switch(g){case s:n.tagName;"http://www.w3.org/1999/xhtml"===r[""]&&h.match(/^(?:disabled|checked|selected)$/i)||f.warning('attribute "'+h+'" missed value!! "'+h+'" instead2!!'),n.add(h,h,t),t=m,g=a;break;case l:f.warning('attribute space is required"'+h+'"!!');case d:g=a,t=m;break;case c:g=u,t=m;break;case p:throw new Error("elements closed character '/' and '>' must be connected to")}}m++}}function g(e,t,n){for(var r=e.tagName,o=null,i=e.length;i--;){var a=e[i],s=a.qName,c=a.value;if((p=s.indexOf(":"))>0)var u=a.prefix=s.slice(0,p),l=s.slice(p+1),d="xmlns"===u&&l;else l=s,u=null,d="xmlns"===s&&"";a.localName=l,!1!==d&&(null==o&&(o={},C(n,n={})),n[d]=o[d]=c,a.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(d,c))}for(i=e.length;i--;){(u=(a=e[i]).prefix)&&("xml"===u&&(a.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==u&&(a.uri=n[u||""]))}var p;(p=r.indexOf(":"))>0?(u=e.prefix=r.slice(0,p),l=e.localName=r.slice(p+1)):(u=null,l=e.localName=r);var f=e.uri=n[u||""];if(t.startElement(f,l,r,e),!e.closed)return e.currentNSMap=n,e.localNSMap=o,!0;if(t.endElement(f,l,r),o)for(u in o)t.endPrefixMapping(u)}function y(e,t,n,r,o){if(/^(?:script|textarea)$/i.test(n)){var i=e.indexOf("",t),a=e.substring(t+1,i);if(/[&<]/.test(a))return/^script$/i.test(n)?(o.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,r),o.characters(a,0,a.length),i)}return t+1}function v(e,t,n,r){var o=r[n];return null==o&&((o=e.lastIndexOf(""))t?(n.comment(e,t+4,o-t-4),o+3):(r.error("Unclosed comment"),-1):-1;default:if("CDATA["==e.substr(t+3,6)){var o=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,o-t-9),n.endCDATA(),o+3}var i=function(e,t){var n,r=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;o.lastIndex=t,o.exec(e);for(;n=o.exec(e);)if(r.push(n),n[1])return r}(e,t),a=i.length;if(a>1&&/!doctype/i.test(i[0][0])){var s=i[1][0],c=a>3&&/^public$/i.test(i[2][0])&&i[3][0],u=a>4&&i[4][0],l=i[a-1];return n.startDTD(s,c&&c.replace(/^(['"])(.*?)\1$/,"$2"),u&&u.replace(/^(['"])(.*?)\1$/,"$2")),n.endDTD(),l.index+l[0].length}}return-1}function S(e,t,n){var r=e.indexOf("?>",t);if(r){var o=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(o){o[0].length;return n.processingInstruction(o[1],o[2]),r+2}return-1}return-1}function w(e){}function x(e,t){return e.__proto__=t,e}f.prototype={parse:function(e,t,n){var r=this.domBuilder;r.startDocument(),C(t,t={}),function(e,t,n,r,o){function i(e){var t=e.slice(1,-1);return t in n?n[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(o.error("entity not found:"+e),e)}function a(t){if(t>C){var n=e.substring(C,t).replace(/&#?\w+;/g,i);d&&s(C),r.characters(n,0,t-C),C=t}}function s(t,n){for(;t>=u&&(n=l.exec(e));)c=n.index,u=c+n[0].length,d.lineNumber++;d.columnNumber=t-c+1}var c=0,u=0,l=/.*(?:\r\n?|\n)|.*$/g,d=r.locator,p=[{currentNSMap:t}],f={},C=0;for(;;){try{var x=e.indexOf("<",C);if(x<0){if(!e.substr(C).match(/^\s*$/)){var k=r.doc,T=k.createTextNode(e.substr(C));k.appendChild(T),r.currentElement=T}return}switch(x>C&&a(x),e.charAt(x+1)){case"/":var R=e.indexOf(">",x+3),_=e.substring(x+2,R),E=p.pop();R<0?(_=e.substring(x+2).replace(/[\s<].*/,""),o.error("end tag name: "+_+" is not complete:"+E.tagName),R=x+1+_.length):_.match(/\sC?C=R:a(Math.max(x,C)+1)}}(e,t,n,r,this.errorHandler),r.endDocument()}},w.prototype={setTagName:function(e){if(!o.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},add:function(e,t,n){if(!o.test(e))throw new Error("invalid attribute:"+e);this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},x({},x.prototype)instanceof x||(x=function(e,t){function n(){}for(t in n.prototype=t,n=new n,e)n[t]=e[t];return n}),t.XMLReader=f},function(e,t){function n(e,t){for(var n in e)t[n]=e[n]}function r(e,t){var r=e.prototype;if(Object.create){var o=Object.create(t.prototype);r.__proto__=o}if(!(r instanceof t)){function i(){}i.prototype=t.prototype,n(r,i=new i),e.prototype=r=i}r.constructor!=e&&("function"!=typeof e&&console.error("unknow Class:"+e),r.constructor=e)}var o="http://www.w3.org/1999/xhtml",i={},a=i.ELEMENT_NODE=1,s=i.ATTRIBUTE_NODE=2,c=i.TEXT_NODE=3,u=i.CDATA_SECTION_NODE=4,l=i.ENTITY_REFERENCE_NODE=5,d=i.ENTITY_NODE=6,p=i.PROCESSING_INSTRUCTION_NODE=7,f=i.COMMENT_NODE=8,h=i.DOCUMENT_NODE=9,m=i.DOCUMENT_TYPE_NODE=10,g=i.DOCUMENT_FRAGMENT_NODE=11,y=i.NOTATION_NODE=12,v={},C={},b=(v.INDEX_SIZE_ERR=(C[1]="Index size error",1),v.DOMSTRING_SIZE_ERR=(C[2]="DOMString size error",2),v.HIERARCHY_REQUEST_ERR=(C[3]="Hierarchy request error",3)),S=(v.WRONG_DOCUMENT_ERR=(C[4]="Wrong document",4),v.INVALID_CHARACTER_ERR=(C[5]="Invalid character",5),v.NO_DATA_ALLOWED_ERR=(C[6]="No data allowed",6),v.NO_MODIFICATION_ALLOWED_ERR=(C[7]="No modification allowed",7),v.NOT_FOUND_ERR=(C[8]="Not found",8)),w=(v.NOT_SUPPORTED_ERR=(C[9]="Not supported",9),v.INUSE_ATTRIBUTE_ERR=(C[10]="Attribute in use",10));v.INVALID_STATE_ERR=(C[11]="Invalid state",11),v.SYNTAX_ERR=(C[12]="Syntax error",12),v.INVALID_MODIFICATION_ERR=(C[13]="Invalid modification",13),v.NAMESPACE_ERR=(C[14]="Invalid namespace",14),v.INVALID_ACCESS_ERR=(C[15]="Invalid access",15);function x(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,C[e]),this.message=C[e],Error.captureStackTrace&&Error.captureStackTrace(this,x);return n.code=e,t&&(this.message=this.message+": "+t),n}function k(){}function T(e,t){this._node=e,this._refresh=t,R(this)}function R(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var r=e._refresh(e._node);ne(e,"length",r.length),n(r,e),e._inc=t}}function _(){}function E(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function A(e,t,n,r){if(r?t[E(t,r)]=n:t[t.length++]=n,e){n.ownerElement=e;var o=e.ownerDocument;o&&(r&&j(o,e,r),function(e,t,n){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&(t._nsMap[n.prefix?n.localName:""]=n.value)}(o,e,n))}}function N(e,t,n){var r=E(t,n);if(!(r>=0))throw x(S,new Error(e.tagName+"@"+n));for(var o=t.length-1;r"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function D(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(D(e,t))return!0}while(e=e.nextSibling)}function O(){}function j(e,t,n,r){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&delete t._nsMap[n.prefix?n.localName:""]}function L(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var o=t.firstChild,i=0;o;)r[i++]=o,o=o.nextSibling;r.length=i}}}function U(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,L(e.ownerDocument,e),t}function M(e,t,n){var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===g){var o=t.firstChild;if(null==o)return t;var i=t.lastChild}else o=i=t;var a=n?n.previousSibling:e.lastChild;o.previousSibling=a,i.nextSibling=n,a?a.nextSibling=o:e.firstChild=o,null==n?e.lastChild=i:n.previousSibling=i;do{o.parentNode=e}while(o!==i&&(o=o.nextSibling));return L(e.ownerDocument||e,e),t.nodeType==g&&(t.firstChild=t.lastChild=null),t}function H(){this._nsMap={}}function F(){}function K(){}function q(){}function z(){}function X(){}function G(){}function V(){}function W(){}function $(){}function J(){}function Q(){}function Y(){}function Z(e,t){var n=[],r=9==this.nodeType?this.documentElement:this,o=r.prefix,i=r.namespaceURI;if(i&&null==o&&null==(o=r.lookupPrefix(i)))var a=[{namespace:i,prefix:null}];return te(this,n,e,t,a),n.join("")}function ee(e,t,n){var r=e.prefix||"",o=e.namespaceURI;if(!r&&!o)return!1;if("xml"===r&&"http://www.w3.org/XML/1998/namespace"===o||"http://www.w3.org/2000/xmlns/"==o)return!1;for(var i=n.length;i--;){var a=n[i];if(a.prefix==r)return a.namespace!=o}return!0}function te(e,t,n,r,i){if(r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case a:i||(i=[]);i.length;var d=e.attributes,y=d.length,v=e.firstChild,C=e.tagName;n=o===e.namespaceURI||n,t.push("<",C);for(var b=0;b"),n&&/^script$/i.test(C))for(;v;)v.data?t.push(v.data):te(v,t,n,r,i),v=v.nextSibling;else for(;v;)te(v,t,n,r,i),v=v.nextSibling;t.push("")}else t.push("/>");return;case h:case g:for(v=e.firstChild;v;)te(v,t,n,r,i),v=v.nextSibling;return;case s:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,P),'"');case c:return t.push(e.data.replace(/[<&]/g,P));case u:return t.push("");case f:return t.push("\x3c!--",e.data,"--\x3e");case m:var T=e.publicId,R=e.systemId;if(t.push("');else if(R&&"."!=R)t.push(' SYSTEM "',R,'">');else{var _=e.internalSubset;_&&t.push(" [",_,"]"),t.push(">")}return;case p:return t.push("");case l:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function ne(e,t,n){e[t]=n}x.prototype=Error.prototype,n(v,x),k.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var n=[],r=0;r0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var r in n)if(n[r]==e)return r;t=t.nodeType==s?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==s?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},n(i,I),n(i,I.prototype),O.prototype={nodeName:"#document",nodeType:h,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==g){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return null==this.documentElement&&e.nodeType==a&&(this.documentElement=e),M(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),U(this,e)},importNode:function(e,t){return function e(t,n,r){var o;switch(n.nodeType){case a:(o=n.cloneNode(!1)).ownerDocument=t;case g:break;case s:r=!0}o||(o=n.cloneNode(!1));o.ownerDocument=t;o.parentNode=null;if(r)for(var i=n.firstChild;i;)o.appendChild(e(t,i,r)),i=i.nextSibling;return o}(this,e,t)},getElementById:function(e){var t=null;return D(this.documentElement,function(n){if(n.nodeType==a&&n.getAttribute("id")==e)return t=n,!0}),t},createElement:function(e){var t=new H;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new k,(t.attributes=new _)._ownerElement=t,t},createDocumentFragment:function(){var e=new J;return e.ownerDocument=this,e.childNodes=new k,e},createTextNode:function(e){var t=new q;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new z;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new X;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new Q;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new F;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new $;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new H,r=t.split(":"),o=n.attributes=new _;return n.childNodes=new k,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,o._ownerElement=n,n},createAttributeNS:function(e,t){var n=new F,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},r(O,I),H.prototype={nodeType:a,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===g?this.insertBefore(e,null):function(e,t){var n=t.parentNode;if(n){var r=e.lastChild;n.removeChild(t),r=e.lastChild}return r=e.lastChild,t.parentNode=e,t.previousSibling=r,t.nextSibling=null,r?r.nextSibling=t:e.firstChild=t,e.lastChild=t,L(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new T(this,function(t){var n=[];return D(t,function(r){r===t||r.nodeType!=a||"*"!==e&&r.tagName!=e||n.push(r)}),n})},getElementsByTagNameNS:function(e,t){return new T(this,function(n){var r=[];return D(n,function(o){o===n||o.nodeType!==a||"*"!==e&&o.namespaceURI!==e||"*"!==t&&o.localName!=t||r.push(o)}),r})}},O.prototype.getElementsByTagName=H.prototype.getElementsByTagName,O.prototype.getElementsByTagNameNS=H.prototype.getElementsByTagNameNS,r(H,I),F.prototype.nodeType=s,r(F,I),K.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(C[b])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},r(K,I),q.prototype={nodeName:"#text",nodeType:c,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},r(q,K),z.prototype={nodeName:"#comment",nodeType:f},r(z,K),X.prototype={nodeName:"#cdata-section",nodeType:u},r(X,K),G.prototype.nodeType=m,r(G,I),V.prototype.nodeType=y,r(V,I),W.prototype.nodeType=d,r(W,I),$.prototype.nodeType=l,r($,I),J.prototype.nodeName="#document-fragment",J.prototype.nodeType=g,r(J,I),Q.prototype.nodeType=p,r(Q,I),Y.prototype.serializeToString=function(e,t,n){return Z.call(e,t,n)},I.prototype.toString=Z;try{if(Object.defineProperty){Object.defineProperty(T.prototype,"length",{get:function(){return R(this),this.$$length}}),Object.defineProperty(I.prototype,"textContent",{get:function(){return function e(t){switch(t.nodeType){case a:case g:var n=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&n.push(e(t)),t=t.nextSibling;return n.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case a:case g:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ne=function(e,t,n){e["$$"+t]=n}}}catch(e){}t.DOMImplementation=B,t.XMLSerializer=Y},function(e,t){var n=new RegExp("^([^a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿿、-퟿豈-﷏ﷰ-�])|^((x|X)(m|M)(l|L))|([^a-zA-Z_À-ÖØ-öø-ÿͰ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿿、-퟿豈-﷏ﷰ-�-.0-9·̀-ͯ‿⁀])","g"),r=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,o=function(e){var t=[];if(e instanceof Object)for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},i=function(e,t){var i=function(e,r,o,i,a){var s=void 0!==t.indent?t.indent:"\t",c=t.prettyPrint?"\n"+new Array(i).join(s):"";t.removeIllegalNameCharacters&&(e=e.replace(n,"_"));var u=[c,"<",e,o||""];return r&&r.length>0?(u.push(">"),u.push(r),a&&u.push(c),u.push("")):u.push("/>"),u.join("")};return function e(n,a,s){var c=typeof n;switch((Array.isArray?Array.isArray(n):n instanceof Array)?c="array":n instanceof Date&&(c="date"),c){case"array":var u=[];return n.map(function(t){u.push(e(t,1,s+1))}),t.prettyPrint&&u.push("\n"),u.join("");case"date":return n.toJSON?n.toJSON():n+"";case"object":var l=[];for(var d in n)if(n.hasOwnProperty(d))if(n[d]instanceof Array)for(var p=0;p0&&l.push("\n"),l.join("");case"function":return n();default:return t.escape?(""+n).replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""").replace(r,""):""+n}}(e,0,0)},a=function(e){var t=['"),t.join("")};e.exports=function(e,t){if(t||(t={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" ",escape:!0}),"string"==typeof e)try{e=JSON.parse(e.toString())}catch(e){return!1}var n="",r="";return t&&("object"==typeof t?(t.xmlHeader&&(n=a(!!t.xmlHeader.standalone)),void 0!==t.docType&&(r="")):n=a()),[n,(t=t||{}).prettyPrint&&r?"\n":"",r,i(e,t)].join("").replace(/\n{2,}/g,"\n").replace(/\s+$/g,"")}},function(e,t){var n=function(e){var t={},n=function(e){return!t[e]&&(t[e]=[]),t[e]};e.on=function(e,t){"task-list-update"===e&&console.warn('warning: Event "'+e+'" has been deprecated. Please use "list-update" instead.'),n(e).push(t)},e.off=function(e,t){for(var r=n(e),o=r.length-1;o>=0;o--)t===r[o]&&r.splice(o,1)},e.emit=function(e,t){for(var r=n(e).map(function(e){return e}),o=0;oe.options.UploadQueueSize;){var o="waiting"===t[r].state||"checking"===t[r].state||"uploading"===t[r].state;t[r]&&o?r++:(n[t[r].id]&&delete n[t[r].id],t.splice(r,1),a--)}c()}},l=function(){if(a-1?"{Region}.myqcloud.com":"cos.{Region}.myqcloud.com",e.ForcePathStyle||(i="{Bucket}."+i)),i=(i=i.replace(/\{\{AppId\}\}/gi,r).replace(/\{\{Bucket\}\}/gi,n).replace(/\{\{Region\}\}/gi,a).replace(/\{\{.*?\}\}/gi,"")).replace(/\{AppId\}/gi,r).replace(/\{BucketName\}/gi,n).replace(/\{Bucket\}/gi,t).replace(/\{Region\}/gi,a).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(i)||(i=c+"//"+i),"/"===i.slice(-1)&&(i=i.slice(0,-1));var u=i;return e.ForcePathStyle&&(u+="/"+t),u+="/",s&&(u+=o.camSafeUrlEncode(s).replace(/%2F/g,"/")),e.isLocation&&(u=u.replace(/^https?:\/\//,"")),u}function c(e,t){var n=o.clone(e.Headers);delete n["Content-Type"],delete n["Cache-Control"],o.each(n,function(e,t){""===e&&delete n[t]});var r=function(e){var n=!1,r=e.Authorization;if(r)if(r.indexOf(" ")>-1)n=!1;else if(r.indexOf("q-sign-algorithm=")>-1&&r.indexOf("q-ak=")>-1&&r.indexOf("q-sign-time=")>-1&&r.indexOf("q-key-time=")>-1&&r.indexOf("q-url-param-list=")>-1)n=!0;else try{(r=atob(r)).indexOf("a=")>-1&&r.indexOf("k=")>-1&&r.indexOf("t=")>-1&&r.indexOf("r=")>-1&&r.indexOf("b=")>-1&&(n=!0)}catch(e){}n?t&&t(null,e):t&&t("authorization error")},i=this,a=e.Bucket||"",s=e.Region||"",c=e.Key||"";i.options.ForcePathStyle&&a&&(c=a+"/"+c);var u="/"+c,l={},d=e.Scope;if(!d){var p=e.Action||"",f=e.ResourceKey||e.Key||"";d=e.Scope||[{action:p,bucket:a,region:s,prefix:f}]}var h=o.md5(JSON.stringify(d));i._StsCache=i._StsCache||[],function(){var e,t;for(e=i._StsCache.length-1;e>=0;e--){t=i._StsCache[e];var n=Math.round(o.getSkewTime(i.options.SystemClockOffset)/1e3)+30;if(t.StartTime&&n=t.ExpiredTime)i._StsCache.splice(e,1);else if(!t.ScopeLimit||t.ScopeLimit&&t.ScopeKey===h){l=t;break}}}();var m,g=function(){var t={Authorization:o.getAuth({SecretId:l.TmpSecretId,SecretKey:l.TmpSecretKey,Method:e.Method,Pathname:u,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:i.options.UseRawKey,SystemClockOffset:i.options.SystemClockOffset}),XCosSecurityToken:l.XCosSecurityToken||"",Token:l.Token||"",ClientIP:l.ClientIP||"",ClientUA:l.ClientUA||""};r(t)};if(l.ExpiredTime&&l.ExpiredTime-o.getSkewTime(i.options.SystemClockOffset)/1e3>60)g();else if(i.options.getAuthorization)i.options.getAuthorization.call(i,{Bucket:a,Region:s,Method:e.Method,Key:c,Pathname:u,Query:e.Query,Headers:n,Scope:d},function(e){"string"==typeof e&&(e={Authorization:e}),e.TmpSecretId&&e.TmpSecretKey&&e.XCosSecurityToken&&e.ExpiredTime?((l=e||{}).Scope=d,l.ScopeKey=h,i._StsCache.push(l),g()):r(e)});else{if(!i.options.getSTS)return m={Authorization:o.getAuth({SecretId:e.SecretId||i.options.SecretId,SecretKey:e.SecretKey||i.options.SecretKey,Method:e.Method,Pathname:u,Query:e.Query,Headers:n,Expires:e.Expires,UseRawKey:i.options.UseRawKey,SystemClockOffset:i.options.SystemClockOffset}),XCosSecurityToken:i.options.XCosSecurityToken},r(m),m;i.options.getSTS.call(i,{Bucket:a,Region:s},function(e){(l=e||{}).Scope=d,l.ScopeKey=h,l.TmpSecretId=l.SecretId,l.TmpSecretKey=l.SecretKey,i._StsCache.push(l),g()})}return""}function u(e,t){var n=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=o.clearKey(e.qs),e.headers&&(e.headers=o.clearKey(e.headers)),e.qs&&(e.qs=o.clearKey(e.qs));var i=o.clone(e.qs);e.action&&(i[e.action]="");var a=function(u){var l=n.options.SystemClockOffset;c.call(n,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:i,Headers:e.headers,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope},function(i,c){i?t(i):(e.AuthData=c,function(e,t){var n=this,i=e.TaskId;if(i&&!n._isRunningTask(i))return;var a=e.Bucket,c=e.Region,u=e.Key,l=e.method||"GET",d=e.url,p=e.body,f=e.json,h=e.rawBody;d=d||s({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:a,region:c,object:u}),e.action&&(d=d+"?"+e.action);var m={method:l,url:d,headers:e.headers,qs:e.qs,body:p,json:f};if(m.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(m.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(m.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(m.headers.clientUA=e.AuthData.ClientUA),e.AuthData.XCosSecurityToken&&(m.headers["x-cos-security-token"]=e.AuthData.XCosSecurityToken),m.headers&&(m.headers=o.clearKey(m.headers)),m=o.clearKey(m),e.onProgress&&"function"==typeof e.onProgress){var g=p&&(p.size||p.length)||0;m.onProgress=function(t){if(!i||n._isRunningTask(i)){var r=t?t.loaded:0;e.onProgress({loaded:r,total:g})}}}this.options.Timeout&&(m.timeout=this.options.Timeout);n.emit("before-send",m);var y=r(m,function(e,r,a){if("abort"!==e){var s,c=function(e,a){if(i&&n.off("inner-kill-task",v),!s){s=!0;var c={};r&&r.statusCode&&(c.statusCode=r.statusCode),r&&r.headers&&(c.headers=r.headers),e?(e=o.extend(e||{},c),t(e,null)):(a=o.extend(a||{},c),t(null,a)),y=null}};if(e)c({error:e});else{var u;try{u=a&&a.indexOf("<")>-1&&a.indexOf(">")>-1&&o.xml2json(a)||{}}catch(e){u=a||{}}var l=r.statusCode,d=2===Math.floor(l/100);d?(h&&((u={}).body=a),u.Error?c({error:u.Error}):c(null,u)):c({error:u.Error||u})}}}),v=function(e){e.TaskId===i&&(y&&y.abort&&y.abort(),n.off("inner-kill-task",v))};i&&n.on("inner-kill-task",v)}.call(n,e,function(r,i){r&&u<2&&(l!==n.options.SystemClockOffset||function(e){var t=!1,n=!1,r=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var i=e.error.Code,a=e.error.Message;("RequestTimeTooSkewed"===i||"AccessDenied"===i&&"Request has expired"===a)&&(n=!0)}catch(e){}if(e)if(n&&r){var s=Date.parse(r);this.options.CorrectClockSkew&&Math.abs(o.getSkewTime(this.options.SystemClockOffset)-s)>=3e4&&(console.error("error: Local time is too skewed."),this.options.SystemClockOffset=s-Date.now(),t=!0)}else 5===Math.round(e.statusCode/100)&&(t=!0);return t}.call(n,r))?(e.headers&&(delete e.headers.Authorization,delete e.headers.token,delete e.headers.clientIP,delete e.headers.clientUA,delete e.headers["x-cos-security-token"]),a(u+1)):t(r,i)}))})};a(0)}var l={getBucket:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n.marker=e.Marker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,u.call(this,{Action:"name/cos:GetBucket",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n},function(e,n){if(e)return t(e);var r=n.ListBucketResult||{},i=r.Contents||[],a=r.CommonPrefixes||[];i=o.isArray(i)?i:[i],a=o.isArray(a)?a:[a];var s=o.clone(r);o.extend(s,{Contents:i,CommonPrefixes:a,statusCode:n.statusCode,headers:n.headers}),t(null,s)})},headBucket:function(e,t){u.call(this,{Action:"name/cos:HeadBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"HEAD"},function(e,n){t(e,n)})},deleteBucket:function(e,t){u.call(this,{Action:"name/cos:DeleteBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"DELETE"},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})},getBucketAcl:function(e,t){u.call(this,{Action:"name/cos:GetBucketACL",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"acl"},function(e,n){if(e)return t(e);var r=n.AccessControlPolicy||{},a=r.Owner||{},s=r.AccessControlList.Grant||[];s=o.isArray(s)?s:[s];var c=i(r);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:a,Grants:s,statusCode:n.statusCode,headers:n.headers}),t(null,c)})},putBucketAcl:function(e,t){var n=e.Headers,r="";if(e.AccessControlPolicy){var i=o.clone(e.AccessControlPolicy||{}),s=i.Grants||i.Grant;s=o.isArray(s)?s:[s],delete i.Grant,delete i.Grants,i.AccessControlList={Grant:s},r=o.json2xml({AccessControlPolicy:i}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(r))}o.each(n,function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=a(n[t]))}),u.call(this,{Action:"name/cos:PutBucketACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:n,action:"acl",body:r},function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})})},getBucketCors:function(e,t){u.call(this,{Action:"name/cos:GetBucketCORS",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors"},function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchCORSConfiguration"===e.error.Code){var r={CORSRules:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=n.CORSConfiguration||{},a=i.CORSRules||i.CORSRule||[];a=o.clone(o.isArray(a)?a:[a]),o.each(a,function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],function(t,n){var r=t+"s",i=e[r]||e[t]||[];delete e[t],e[r]=o.isArray(i)?i:[i]})}),t(null,{CORSRules:a,statusCode:n.statusCode,headers:n.headers})}})},putBucketCors:function(e,t){var n=(e.CORSConfiguration||{}).CORSRules||e.CORSRules||[];n=o.clone(o.isArray(n)?n:[n]),o.each(n,function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],function(t,n){var r=t+"s",i=e[r]||e[t]||[];delete e[r],e[t]=o.isArray(i)?i:[i]})});var r=o.json2xml({CORSConfiguration:{CORSRule:n}}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),u.call(this,{Action:"name/cos:PutBucketCORS",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"cors",headers:i},function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})})},deleteBucketCors:function(e,t){u.call(this,{Action:"name/cos:DeleteBucketCORS",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors"},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})})},getBucketLocation:function(e,t){u.call(this,{Action:"name/cos:GetBucketLocation",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"location"},function(e,n){if(e)return t(e);t(null,n)})},putBucketTagging:function(e,t){var n=e.Tagging||{},r=n.TagSet||n.Tags||e.Tags||[];r=o.clone(o.isArray(r)?r:[r]);var i=o.json2xml({Tagging:{TagSet:{Tag:r}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i)),u.call(this,{Action:"name/cos:PutBucketTagging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"tagging",headers:a},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})},getBucketTagging:function(e,t){u.call(this,{Action:"name/cos:GetBucketTagging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging"},function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var r={Tags:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else{var i=[];try{i=n.Tagging.TagSet.Tag||[]}catch(e){}i=o.clone(o.isArray(i)?i:[i]),t(null,{Tags:i,statusCode:n.statusCode,headers:n.headers})}})},deleteBucketTagging:function(e,t){u.call(this,{Action:"name/cos:DeleteBucketTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging"},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})},getBucketPolicy:function(e,t){u.call(this,{Action:"name/cos:GetBucketPolicy",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",rawBody:!0},function(e,n){if(e)return e.statusCode&&403===e.statusCode?t({ErrorStatus:"Access Denied"}):e.statusCode&&405===e.statusCode?t({ErrorStatus:"Method Not Allowed"}):e.statusCode&&404===e.statusCode?t({ErrorStatus:"Policy Not Found"}):t(e);var r={};try{r=JSON.parse(n.body)}catch(e){}t(null,{Policy:r,statusCode:n.statusCode,headers:n.headers})})},putBucketPolicy:function(e,t){var n=e.Policy,r=n;try{"string"==typeof n?n=JSON.parse(r):r=JSON.stringify(n)}catch(e){t({error:"Policy format error"})}var i=e.Headers;i["Content-Type"]="application/json",i["Content-MD5"]=o.binaryBase64(o.md5(r)),u.call(this,{Action:"name/cos:PutBucketPolicy",method:"PUT",Bucket:e.Bucket,Region:e.Region,action:"policy",body:o.isBrowser?r:n,headers:i,json:!0},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})},deleteBucketPolicy:function(e,t){u.call(this,{Action:"name/cos:DeleteBucketPolicy",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy"},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})})},getBucketLifecycle:function(e,t){u.call(this,{Action:"name/cos:GetBucketLifecycle",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle"},function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchLifecycleConfiguration"===e.error.Code){var r={Rules:[],statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else t(e);else{var i=[];try{i=n.LifecycleConfiguration.Rule||[]}catch(e){}i=o.clone(o.isArray(i)?i:[i]),t(null,{Rules:i,statusCode:n.statusCode,headers:n.headers})}})},putBucketLifecycle:function(e,t){var n=(e.LifecycleConfiguration||{}).Rules||[];n=o.clone(n);var r=o.json2xml({LifecycleConfiguration:{Rule:n}}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),u.call(this,{Action:"name/cos:PutBucketLifecycle",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"lifecycle",headers:i},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})},deleteBucketLifecycle:function(e,t){u.call(this,{Action:"name/cos:DeleteBucketLifecycle",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle"},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})},putBucketVersioning:function(e,t){if(e.VersioningConfiguration){var n=e.VersioningConfiguration||{},r=o.json2xml({VersioningConfiguration:n}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),u.call(this,{Action:"name/cos:PutBucketVersioning",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"versioning",headers:i},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})}else t({error:"missing param VersioningConfiguration"})},getBucketVersioning:function(e,t){u.call(this,{Action:"name/cos:GetBucketVersioning",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"versioning"},function(e,n){e||!n.VersioningConfiguration&&(n.VersioningConfiguration={}),t(e,n)})},putBucketReplication:function(e,t){var n=o.clone(e.ReplicationConfiguration),r=o.json2xml({ReplicationConfiguration:n});r=(r=r.replace(/<(\/?)Rules>/gi,"<$1Rule>")).replace(/<(\/?)Tags>/gi,"<$1Tag>");var i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(r)),u.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"replication",headers:i},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})},getBucketReplication:function(e,t){u.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"ReplicationConfigurationnotFoundError"!==e.error.Code)t(e);else{var r={ReplicationConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(r.headers=e.headers),t(null,r)}else e||!n.ReplicationConfiguration&&(n.ReplicationConfiguration={}),n.ReplicationConfiguration.Rule&&(n.ReplicationConfiguration.Rules=n.ReplicationConfiguration.Rule,delete n.ReplicationConfiguration.Rule),t(e,n)})},deleteBucketReplication:function(e,t){u.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication"},function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})})},getObject:function(e,t){var n={};n["response-content-type"]=e.ResponseContentType,n["response-content-language"]=e.ResponseContentLanguage,n["response-expires"]=e.ResponseExpires,n["response-cache-control"]=e.ResponseCacheControl,n["response-content-disposition"]=e.ResponseContentDisposition,n["response-content-encoding"]=e.ResponseContentEncoding,u.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,qs:n,rawBody:!0},function(n,r){if(n){var i=n.statusCode;return e.Headers["If-Modified-Since"]&&i&&304===i?t(null,{NotModified:!0}):t(n)}var a={};a.Body=r.body,r.headers&&r.headers.etag&&(a.ETag=r.headers&&r.headers.etag),o.extend(a,{statusCode:r.statusCode,headers:r.headers}),t(null,a)})},headObject:function(e,t){u.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},function(n,r){if(n){var o=n.statusCode;return e.Headers["If-Modified-Since"]&&o&&304===o?t(null,{NotModified:!0,statusCode:o}):t(n)}r.headers&&r.headers.etag&&(r.ETag=r.headers&&r.headers.etag),t(null,r)})},listObjectVersions:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n["key-marker"]=e.KeyMarker,n["version-id-marker"]=e.VersionIdMarker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,u.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"versions"},function(e,n){if(e)return t(e);var r=n.ListVersionsResult||{},i=r.DeleteMarker||[];i=o.isArray(i)?i:[i];var a=r.Version||[];a=o.isArray(a)?a:[a];var s=o.clone(r);delete s.DeleteMarker,delete s.Version,o.extend(s,{DeleteMarkers:i,Versions:a,statusCode:n.statusCode,headers:n.headers}),t(null,s)})},putObject:function(e,t){var n=this,r=e.ContentLength,i=o.throttleOnProgress.call(n,r,e.onProgress),a=e.Headers;!a["Cache-Control"]&&(a["Cache-Control"]="");var c=a["Content-Type"]||e.Body&&e.Body.type;!a["Content-Type"]&&c&&(a["Content-Type"]=c),o.getBodyMd5(n.options.UploadCheckContentMd5,e.Body,function(a){a&&(e.Headers["Content-MD5"]=o.binaryBase64(a)),void 0!==e.ContentLength&&(e.Headers["Content-Length"]=e.ContentLength),u.call(n,{Action:"name/cos:PutObject",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,body:e.Body,onProgress:i},function(o,a){if(o)return i(null,!0),t(o);if(i({loaded:r,total:r},!0),a&&a.headers&&a.headers.etag){var c=s({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key});return c=c.substr(c.indexOf("://")+3),t(null,{Location:c,ETag:a.headers.etag,statusCode:a.statusCode,headers:a.headers})}t(null,a)})})},deleteObject:function(e,t){u.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,VersionId:e.VersionId},function(e,n){if(e){var r=e.statusCode;return r&&204===r?t(null,{statusCode:r}):r&&404===r?t(null,{BucketNotFound:!0,statusCode:r}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})})},getObjectAcl:function(e,t){u.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"acl"},function(e,n){if(e)return t(e);var r=n.AccessControlPolicy||{},a=r.Owner||{},s=r.AccessControlList&&r.AccessControlList.Grant||[];s=o.isArray(s)?s:[s];var c=i(r);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:a,Grants:s,statusCode:n.statusCode,headers:n.headers}),t(null,c)})},putObjectAcl:function(e,t){var n=e.Headers,r="";if(e.AccessControlPolicy){var i=o.clone(e.AccessControlPolicy||{}),s=i.Grants||i.Grant;s=o.isArray(s)?s:[s],delete i.Grant,delete i.Grants,i.AccessControlList={Grant:s},r=o.json2xml({AccessControlPolicy:i}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(r))}o.each(n,function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=a(n[t]))}),u.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"acl",headers:n,body:r},function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})})},optionsObject:function(e,t){var n=e.Headers;n.Origin=e.Origin,n["Access-Control-Request-Method"]=e.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,u.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:n},function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(null,{OptionsForbidden:!0,statusCode:e.statusCode}):t(e);var r=n.headers||{};t(null,{AccessControlAllowOrigin:r["access-control-allow-origin"],AccessControlAllowMethods:r["access-control-allow-methods"],AccessControlAllowHeaders:r["access-control-allow-headers"],AccessControlExposeHeaders:r["access-control-expose-headers"],AccessControlMaxAge:r["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})})},putObjectCopy:function(e,t){var n=e.Headers;!n["Cache-Control"]&&(n["Cache-Control"]="");var r=(e.CopySource||"").match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(r){var i=r[1],a=r[3],s=decodeURIComponent(r[4]);u.call(this,{Scope:[{action:"name/cos:GetObject",bucket:i,region:a,prefix:s},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers},function(e,n){if(e)return t(e);var r=o.clone(n.CopyObjectResult||{});o.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}else t({error:"CopySource format error"})},deleteMultipleObject:function(e,t){var n=e.Objects||[],r=e.Quiet;n=o.isArray(n)?n:[n];var i=o.json2xml({Delete:{Object:n,Quiet:r||!1}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(i));var s=o.map(n,function(t){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:t.Key}});u.call(this,{Scope:s,method:"POST",Bucket:e.Bucket,Region:e.Region,body:i,action:"delete",headers:a},function(e,n){if(e)return t(e);var r=n.DeleteResult||{},i=r.Deleted||[],a=r.Error||[];i=o.isArray(i)?i:[i],a=o.isArray(a)?a:[a];var s=o.clone(r);o.extend(s,{Error:a,Deleted:i,statusCode:n.statusCode,headers:n.headers}),t(null,s)})},restoreObject:function(e,t){var n=e.Headers;if(e.RestoreRequest){var r=e.RestoreRequest||{},i=o.json2xml({RestoreRequest:r});n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(i)),u.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:i,action:"restore",headers:n},function(e,n){t(e,n)})}else t({error:"missing param RestoreRequest"})},uploadPartCopy:function(e,t){var n=(e.CopySource||"").match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(n){var r=n[1],i=n[3],a=decodeURIComponent(n[4]);u.call(this,{Scope:[{action:"name/cos:GetObject",bucket:r,region:i,prefix:a},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers},function(e,n){if(e)return t(e);var r=o.clone(n.CopyPartResult||{});o.extend(r,{statusCode:n.statusCode,headers:n.headers}),t(null,r)})}else t({error:"CopySource format error"})},multipartInit:function(e,t){var n,r=e.Headers,i=(navigator&&navigator.userAgent||"").match(/ TBS\/(\d{6}) /);"http:"===location.protocol&&i&&i[1].length<=6&&i[1]<"044429"&&(n=o.json2xml({}),r["Content-MD5"]=o.binaryBase64(o.md5(n)),r["Content-Type"]||(r["Content-Type"]=e.Body&&e.Body.type||"application/octet-stream")),!r["Cache-Control"]&&(r["Cache-Control"]=""),u.call(this,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers,body:n},function(e,n){return e?t(e):(n=o.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,o.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)})},multipartUpload:function(e,t){var n=this;o.getFileSize("multipartUpload",e,function(){o.getBodyMd5(n.options.UploadCheckContentMd5,e.Body,function(r){r&&(e.Headers["Content-MD5"]=o.binaryBase64(r)),u.call(n,{Action:"name/cos:UploadPart",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers,onProgress:e.onProgress,body:e.Body||null},function(e,n){if(e)return t(e);n.headers=n.headers||{},t(null,{ETag:n.headers.etag||"",statusCode:n.statusCode,headers:n.headers})})})})},multipartComplete:function(e,t){for(var n=this,r=e.UploadId,i=e.Parts,a=0,c=i.length;a-1?r.Authorization:"sign="+encodeURIComponent(r.Authorization)),r.XCosSecurityToken&&(o+="&x-cos-security-token="+r.XCosSecurityToken),r.ClientIP&&(o+="&clientIP="+r.ClientIP),r.ClientUA&&(o+="&clientUA="+r.ClientUA),r.Token&&(o+="&token="+r.Token),setTimeout(function(){t(null,{Url:o})})}});return r?n+"?"+r.Authorization+(r.XCosSecurityToken?"&x-cos-security-token="+r.XCosSecurityToken:""):n},getAuth:function(e){return o.getAuth({SecretId:e.SecretId||this.options.SecretId||"",SecretKey:e.SecretKey||this.options.SecretKey||"",Method:e.Method,Key:e.Key,Query:e.Query,Headers:e.Headers,Expires:e.Expires,UseRawKey:this.options.UseRawKey,SystemClockOffset:this.options.SystemClockOffset})}};e.exports.init=function(e,t){t.transferToTaskMethod(l,"putObject"),o.each(l,function(t,n){e.prototype[n]=o.apiWrapper(n,t),function(e,t,n){o.each(["Cors","Acl"],function(r){if(e.slice(-r.length)===r){var i=e.slice(0,-r.length)+r.toUpperCase(),a=o.apiWrapper(e,t),s=!1;n[i]=function(){!s&&console.warn("warning: cos."+i+" has been deprecated. Please Use cos."+e+" instead."),s=!0,a.apply(this,arguments)}}})}(n,t,e.prototype)})}},function(e,t,n){var r=n(20),o=function(){var e=[],t=e.slice,n=e.concat,r=e.push,o=e.indexOf,i={},a=i.toString,s=i.hasOwnProperty,c={},u="1.11.1 -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-effects/support,-dimensions,-offset,-deprecated,-event-alias,-wrap",l=function(e,t){return new l.fn.init(e,t)},d=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,f=/-([\da-z])/gi,h=function(e,t){return t.toUpperCase()};function m(e){var t=e.length,n=l.type(e);return"function"!==n&&!l.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e))}l.fn=l.prototype={jquery:u,constructor:l,selector:"",length:0,toArray:function(){return t.call(this)},get:function(e){return null!=e?e<0?this[e+this.length]:this[e]:t.call(this)},pushStack:function(e){var t=l.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return l.each(this,e,t)},map:function(e){return this.pushStack(l.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(t.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==l.type(e)||e.nodeType||l.isWindow(e))return!1;try{if(e.constructor&&!s.call(e,"constructor")&&!s.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}if(c.ownLast)for(t in e)return s.call(e,t);for(t in e);return void 0===t||s.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?i[a.call(e)]||"object":typeof e},globalEval:function(e){e&&l.trim(e)&&(window.execScript||function(e){window.eval.call(window,e)})(e)},camelCase:function(e){return e.replace(p,"ms-").replace(f,h)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r=0,o=e.length,i=m(e);if(n){if(i)for(;r)[^>]*|#([\w-]*))$/;(l.fn.init=function(e,t){var n,r;if(!e)return this;if("string"==typeof e){if(!(n="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:v.exec(e))||!n[1]&&t)return!t||t.jquery?(t||g).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof l?t[0]:t,l.merge(this,l.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:y,!0)),rsingleTag.test(n[1])&&l.isPlainObject(t))for(n in t)l.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}if((r=y.getElementById(n[2]))&&r.parentNode){if(r.id!==n[2])return g.find(e);this.length=1,this[0]=r}return this.context=y,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):l.isFunction(e)?void 0!==g.ready?g.ready(e):e(l):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),l.makeArray(e,this))}).prototype=l.fn,g=l(y);var C,b=/\S+/g,S={};function w(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",x,!1),window.removeEventListener("load",x,!1)):(y.detachEvent("onreadystatechange",x),window.detachEvent("onload",x))}function x(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(w(),l.ready())}l.Callbacks=function(e){e="string"==typeof e?S[e]||function(e){var t=S[e]={};return l.each(e.match(b)||[],function(e,n){t[n]=!0}),t}(e):l.extend({},e);var t,n,r,o,i,a,s=[],c=!e.once&&[],u=function(l){for(n=e.memory&&l,r=!0,i=a||0,a=0,o=s.length,t=!0;s&&i-1;)s.splice(r,1),t&&(r<=o&&o--,r<=i&&i--)}),this},has:function(e){return e?l.inArray(e,s)>-1:!(!s||!s.length)},empty:function(){return s=[],o=0,this},disable:function(){return s=c=n=void 0,this},disabled:function(){return!s},lock:function(){return c=void 0,n||d.disable(),this},locked:function(){return!c},fireWith:function(e,n){return!s||r&&!c||(n=[e,(n=n||[]).slice?n.slice():n],t?c.push(n):u(n)),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!r}};return d},l.extend({Deferred:function(e){var t=[["resolve","done",l.Callbacks("once memory"),"resolved"],["reject","fail",l.Callbacks("once memory"),"rejected"],["notify","progress",l.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return l.Deferred(function(n){l.each(t,function(t,i){var a=l.isFunction(e[t])&&e[t];o[i[1]](function(){var e=a&&a.apply(this,arguments);e&&l.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[i[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?l.extend(e,r):r}},o={};return r.pipe=r.then,l.each(t,function(e,i){var a=i[2],s=i[3];r[i[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),o[i[0]]=function(){return o[i[0]+"With"](this===o?r:this,arguments),this},o[i[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(e){var n,r,o,i=0,a=t.call(arguments),s=a.length,c=1!==s||e&&l.isFunction(e.promise)?s:0,u=1===c?e:l.Deferred(),d=function(e,r,o){return function(i){r[e]=this,o[e]=arguments.length>1?t.call(arguments):i,o===n?u.notifyWith(r,o):--c||u.resolveWith(r,o)}};if(s>1)for(n=new Array(s),r=new Array(s),o=new Array(s);i0||(C.resolveWith(y,[l]),l.fn.triggerHandler&&(l(y).triggerHandler("ready"),l(y).off("ready")))}}}),l.ready.promise=function(e){if(!C)if(C=l.Deferred(),"complete"===y.readyState)setTimeout(l.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",x,!1),window.addEventListener("load",x,!1);else{y.attachEvent("onreadystatechange",x),window.attachEvent("onload",x);var t=!1;try{t=null==window.frameElement&&y.documentElement}catch(e){}t&&t.doScroll&&function e(){if(!l.isReady){try{t.doScroll("left")}catch(t){return setTimeout(e,50)}w(),l.ready()}}()}return C.promise(e)};var k;for(k in l(c))break;c.ownLast="0"!==k,c.inlineBlockNeedsLayout=!1,l(function(){var e,t,n,r;(n=y.getElementsByTagName("body")[0])&&n.style&&(t=y.createElement("div"),(r=y.createElement("div")).style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),void 0!==t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",c.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=y.createElement("div");if(null==c.deleteExpando){c.deleteExpando=!0;try{delete e.test}catch(e){c.deleteExpando=!1}}e=null}(),l.acceptData=function(e){var t=l.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||!0!==t&&e.getAttribute("classid")===t)};var T=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,R=/([A-Z])/g;function _(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(R,"-$1").toLowerCase();if("string"==typeof(n=e.getAttribute(r))){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:T.test(n)?l.parseJSON(n):n)}catch(e){}l.data(e,t,n)}else n=void 0}return n}function E(e){var t;for(t in e)if(("data"!==t||!l.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function A(t,n,r,o){if(l.acceptData(t)){var i,a,s=l.expando,c=t.nodeType,u=c?l.cache:t,d=c?t[s]:t[s]&&s;if(d&&u[d]&&(o||u[d].data)||void 0!==r||"string"!=typeof n)return d||(d=c?t[s]=e.pop()||l.guid++:s),u[d]||(u[d]=c?{}:{toJSON:l.noop}),"object"!=typeof n&&"function"!=typeof n||(o?u[d]=l.extend(u[d],n):u[d].data=l.extend(u[d].data,n)),a=u[d],o||(a.data||(a.data={}),a=a.data),void 0!==r&&(a[l.camelCase(n)]=r),"string"==typeof n?null==(i=a[n])&&(i=a[l.camelCase(n)]):i=a,i}}function N(e,t,n){if(l.acceptData(e)){var r,o,i=e.nodeType,a=i?l.cache:e,s=i?e[l.expando]:l.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){o=(t=l.isArray(t)?t.concat(l.map(t,l.camelCase)):t in r?[t]:(t=l.camelCase(t))in r?[t]:t.split(" ")).length;for(;o--;)delete r[t[o]];if(n?!E(r):!l.isEmptyObject(r))return}(n||(delete a[s].data,E(a[s])))&&(i?l.cleanData([e],!0):c.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}l.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return!!(e=e.nodeType?l.cache[e[l.expando]]:e[l.expando])&&!E(e)},data:function(e,t,n){return A(e,t,n)},removeData:function(e,t){return N(e,t)},_data:function(e,t,n){return A(e,t,n,!0)},_removeData:function(e,t){return N(e,t,!0)}}),l.fn.extend({data:function(e,t){var n,r,o,i=this[0],a=i&&i.attributes;if(void 0===e){if(this.length&&(o=l.data(i),1===i.nodeType&&!l._data(i,"parsedAttrs"))){for(n=a.length;n--;)a[n]&&0===(r=a[n].name).indexOf("data-")&&_(i,r=l.camelCase(r.slice(5)),o[r]);l._data(i,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){l.data(this,e)}):arguments.length>1?this.each(function(){l.data(this,e,t)}):i?_(i,e,l.data(i,e)):void 0},removeData:function(e){return this.each(function(){l.removeData(this,e)})}}),l.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=l._data(e,t),n&&(!r||l.isArray(n)?r=l._data(e,t,l.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=l.queue(e,t),r=n.length,o=n.shift(),i=l._queueHooks(e,t);"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,function(){l.dequeue(e,t)},i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return l._data(e,n)||l._data(e,n,{empty:l.Callbacks("once memory").add(function(){l._removeData(e,t+"queue"),l._removeData(e,n)})})}}),l.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length=0&&(m=h.split("."),h=m.shift(),m.sort()),i=h.indexOf(":")<0&&"on"+h,(e=e[l.expando]?e:new l.Event(h,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=m.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:l.makeArray(t,[e]),u=l.event.special[h]||{},r||!u.trigger||!1!==u.trigger.apply(n,t))){if(!r&&!u.noBubble&&!l.isWindow(n)){for(c=u.delegateType||h,D.test(c+h)||(a=a.parentNode);a;a=a.parentNode)f.push(a),d=a;d===(n.ownerDocument||y)&&f.push(d.defaultView||d.parentWindow||window)}for(p=0;(a=f[p++])&&!e.isPropagationStopped();)e.type=p>1?c:u.bindType||h,(o=(l._data(a,"events")||{})[e.type]&&l._data(a,"handle"))&&o.apply(a,t),(o=i&&a[i])&&o.apply&&l.acceptData(a)&&(e.result=o.apply(a,t),!1===e.result&&e.preventDefault());if(e.type=h,!r&&!e.isDefaultPrevented()&&(!u._default||!1===u._default.apply(f.pop(),t))&&l.acceptData(n)&&i&&n[h]&&!l.isWindow(n)){(d=n[i])&&(n[i]=null),l.event.triggered=h;try{n[h]()}catch(e){}l.event.triggered=void 0,d&&(n[i]=d)}return e.result}},dispatch:function(e){e=l.event.fix(e);var n,r,o,i,a,s,c=t.call(arguments),u=(l._data(this,"events")||{})[e.type]||[],d=l.event.special[e.type]||{};if(c[0]=e,e.delegateTarget=this,!d.preDispatch||!1!==d.preDispatch.call(this,e)){for(s=l.event.handlers.call(this,e,u),n=0;(i=s[n++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,a=0;(o=i.handlers[a++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(o.namespace)||(e.handleObj=o,e.data=o.data,void 0!==(r=((l.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,c))&&!1===(e.result=r)&&(e.preventDefault(),e.stopPropagation()));return d.postDispatch&&d.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,o,i,a=[],s=t.delegateCount,c=e.target;if(s&&c.nodeType&&(!e.button||"click"!==e.type))for(;c!=this;c=c.parentNode||this)if(1===c.nodeType&&(!0!==c.disabled||"click"!==e.type)){for(o=[],i=0;i=0:l.find(n,this,null,[c]).length),o[n]&&o.push(r);o.length&&a.push({elem:c,handlers:o})}return s0&&(a=setTimeout(function(){w.abort("timeout")},d.timeout));try{C=1,c.send(y,x)}catch(e){if(!(C<2))throw e;x(-1,e)}}else x(-1,"No Transport");function x(e,t,n,r){var u,y,v,b,S,x=t;2!==C&&(C=2,a&&clearTimeout(a),c=void 0,i=r||"",w.readyState=e>0?4:0,u=e>=200&&e<300||304===e,n&&(b=function(e,t,n){for(var r,o,i,a,s=e.contents,c=e.dataTypes;"*"===c[0];)c.shift(),void 0===o&&(o=e.mimeType||t.getResponseHeader("Content-Type"));if(o)for(a in s)if(s[a]&&s[a].test(o)){c.unshift(a);break}if(c[0]in n)i=c[0];else{for(a in n){if(!c[0]||e.converters[a+" "+c[0]]){i=a;break}r||(r=a)}i=i||r}if(i)return i!==c[0]&&c.unshift(i),n[i]}(d,w,n)),b=function(e,t,n,r){var o,i,a,s,c,u={},l=e.dataTypes.slice();if(l[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];for(i=l.shift();i;)if(e.responseFields[i]&&(n[e.responseFields[i]]=t),!c&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),c=i,i=l.shift())if("*"===i)i=c;else if("*"!==c&&c!==i){if(!(a=u[c+" "+i]||u["* "+i]))for(o in u)if((s=o.split(" "))[1]===i&&(a=u[c+" "+s[0]]||u["* "+s[0]])){!0===a?a=u[o]:!0!==u[o]&&(i=s[0],l.unshift(s[1]));break}if(!0!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+c+" to "+i}}}return{state:"success",data:t}}(d,b,w,u),u?(d.ifModified&&((S=w.getResponseHeader("Last-Modified"))&&(l.lastModified[o]=S),(S=w.getResponseHeader("etag"))&&(l.etag[o]=S)),204===e||"HEAD"===d.type?x="nocontent":304===e?x="notmodified":(x=b.state,y=b.data,u=!(v=b.error))):(v=x,!e&&x||(x="error",e<0&&(e=0))),w.status=e,w.statusText=(t||x)+"",u?h.resolveWith(p,[y,x,w]):h.rejectWith(p,[w,x,v]),w.statusCode(g),g=void 0,s&&f.trigger(u?"ajaxSuccess":"ajaxError",[w,d,u?y:v]),m.fireWith(p,[w,x]),s&&(f.trigger("ajaxComplete",[w,d]),--l.active||l.event.trigger("ajaxStop")))}return w},getJSON:function(e,t,n){return l.get(e,t,n,"json")},getScript:function(e,t){return l.get(e,void 0,t,"script")}}),l.each(["get","post"],function(e,t){l[t]=function(e,n,r,o){return l.isFunction(n)&&(o=o||r,r=n,n=void 0),l.ajax({url:e,type:t,dataType:o,data:n,success:r})}}),l.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){l.fn[t]=function(e){return this.on(t,e)}}),l._evalUrl=function(e){return l.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})};var te=/%20/g,ne=/\[\]$/,re=/\r?\n/g,oe=/^(?:submit|button|image|reset|file)$/i,ie=/^(?:input|select|textarea|keygen)/i;function ae(e,t,n,r){var o;if(l.isArray(t))l.each(t,function(t,o){n||ne.test(e)?r(e,o):ae(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==l.type(t))r(e,t);else for(o in t)ae(e+"["+o+"]",t[o],n,r)}l.param=function(e,t){var n,r=[],o=function(e,t){t=l.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=l.ajaxSettings&&l.ajaxSettings.traditional),l.isArray(e)||e.jquery&&!l.isPlainObject(e))l.each(e,function(){o(this.name,this.value)});else for(n in e)ae(n,e[n],t,o);return r.join("&").replace(te,"+")},l.fn.extend({serialize:function(){return l.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=l.prop(this,"elements");return e?l.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!l(this).is(":disabled")&&ie.test(this.nodeName)&&!oe.test(e)&&(this.checked||!rcheckableType.test(e))}).map(function(e,t){var n=l(this).val();return null==n?null:l.isArray(n)?l.map(n,function(e){return{name:t.name,value:e.replace(re,"\r\n")}}):{name:t.name,value:n.replace(re,"\r\n")}}).get()}}),l.ajaxSettings.xhr=void 0!==window.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&le()||function(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}()}:le;var se=0,ce={},ue=l.ajaxSettings.xhr();function le(){try{return new window.XMLHttpRequest}catch(e){}}window.ActiveXObject&&l(window).on("unload",function(){for(var e in ce)ce[e](void 0,!0)}),c.cors=!!ue&&"withCredentials"in ue,(ue=c.ajax=!!ue)&&l.ajaxTransport(function(e){var t;if(!e.crossDomain||c.cors)return{send:function(n,r){var o,i=e.xhr(),a=++se;if(i.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)i[o]=e.xhrFields[o];for(o in e.mimeType&&i.overrideMimeType&&i.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest"),n)void 0!==n[o]&&i.setRequestHeader(o,n[o]+"");i.upload&&e.progress&&(i.upload.onprogress=e.progress),i.send(e.hasContent&&(e.body||e.data)||null),t=function(n,o){var s,c,u;if(t&&(o||4===i.readyState))if(delete ce[a],t=void 0,i.onreadystatechange=l.noop,o)4!==i.readyState&&i.abort();else{u={},s=i.status,"string"==typeof i.responseText&&(u.text=i.responseText);try{c=i.statusText}catch(e){c=""}s||!e.isLocal||e.crossDomain?1223===s&&(s=204):s=u.text?200:404}u&&r(s,c,u,i.getAllResponseHeaders())},e.async?4===i.readyState?setTimeout(t):i.onreadystatechange=ce[a]=t:t()},abort:function(){t&&t(void 0,!0)}}}),l.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return l.globalEval(e),e}}}),l.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),l.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=y.head||l("head")[0]||y.documentElement;return{send:function(r,o){(t=y.createElement("script")).async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||o(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var de=[],pe=/(=)\?(?=&|$)|\?\?/;return l.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=de.pop()||l.expando+"_"+U++;return this[e]=!0,e}}),l.ajaxPrefilter("json jsonp",function(e,t,n){var r,o,i,a=!1!==e.jsonp&&(pe.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&pe.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=l.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(pe,"$1"+r):!1!==e.jsonp&&(e.url+=(M.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return i||l.error(r+" was not called"),i[0]},e.dataTypes[0]="json",o=window[r],window[r]=function(){i=arguments},n.always(function(){window[r]=o,e[r]&&(e.jsonpCallback=t.jsonpCallback,de.push(r)),i&&l.isFunction(o)&&o(i[0]),i=o=void 0}),"script"}),l.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||y;var r=rsingleTag.exec(e),o=!n&&[];return r?[t.createElement(r[1])]:(r=l.buildFragment([e],t,o),o&&o.length&&l(o).remove(),l.merge([],r.childNodes))},l}();e.exports=function(e,t){if((e=o.extend(!0,{headers:{},qs:{}},e)).type=e.method,delete e.method,e.onProgress&&(e.progress=e.onProgress,delete e.onProgress),e.qs){var n=r.stringify(e.qs);n&&(e.url+=(-1===e.url.indexOf("?")?"?":"&")+n),delete e.qs}if(e.json&&(e.data=e.body,delete e.json,delete e.body,!e.headers&&(e.headers={}),e.headers["Content-Type"]="application/json"),e.body&&(e.body instanceof Blob||"[object File]"===e.body.toString()||"[object Blob]"===e.body.toString()||(e.data=e.body,delete e.body)),e.headers){var i=e.headers;delete e.headers,e.beforeSend=function(e){for(var t in i)i.hasOwnProperty(t)&&"content-length"!==t.toLowerCase()&&"user-agent"!==t.toLowerCase()&&"origin"!==t.toLowerCase()&&"host"!==t.toLowerCase()&&e.setRequestHeader(t,i[t])}}var a=function(e){var t={};return e.getAllResponseHeaders().trim().split("\n").forEach(function(e){if(e){var n=e.indexOf(":"),r=e.substr(0,n).trim().toLowerCase(),o=e.substr(n+1).trim();t[r]=o}}),{statusCode:e.status,statusMessage:e.statusText,headers:t}};return e.success=function(e,n,r){t(null,a(r),e)},e.error=function(e){e.responseText?t(null,a(e),e.responseText):t(e.statusText,a(e),e.responseText)},e.dataType="text",o.ajax(e)}},function(e,t,n){"use strict";t.decode=t.parse=n(21),t.encode=t.stringify=n(22)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var c=1e3;i&&"number"==typeof i.maxKeys&&(c=i.maxKeys);var u=e.length;c>0&&u>c&&(u=c);for(var l=0;l=0?(d=m.substr(0,g),p=m.substr(g+1)):(d=m,p=""),f=decodeURIComponent(d),h=decodeURIComponent(p),r(a,f)?o(a[f])?a[f].push(h):a[f]=[a[f],h]:a[f]=h}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?i(a(e),function(a){var s=encodeURIComponent(r(a))+n;return o(e[a])?i(e[a],function(e){return s+encodeURIComponent(r(e))}).join(t):s+encodeURIComponent(r(e[a]))}).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r=0;t--)r[t][1]===e&&r.splice(t,1);var n=this.options.UploadIdCacheLimit;r.length>n&&r.splice(n),n&&setTimeout(function(){try{r.length?localStorage.setItem(c,JSON.stringify(r)):localStorage.removeItem(c)}catch(e){}})}function d(e){u.call(this);for(var t=[],n=0;n=0;o--)r[o][0]===e&&r[o][1]===t&&r.splice(o,1);r.unshift([e,t]);var i=this.options.UploadIdCacheLimit;r.length>i&&r.splice(i),i&&setTimeout(function(){try{localStorage.setItem(c,JSON.stringify(r))}catch(e){}})}.call(m,i,t.UploadId),s[t.UploadId]=!0,y&&m.on("inner-kill-task",function(e){e.TaskId===y&&"canceled"===e.toState&&delete s[t.UploadId]}),function(e,t){var n=this,r=e.TaskId,i=e.Bucket,s=e.Region,c=e.Key,u=e.UploadData,l=e.FileSize,d=e.SliceSize,p=Math.min(e.AsyncLimit||n.options.ChunkParallelLimit||1,256),f=e.Body,h=Math.ceil(l/d),m=0,g=e.ServerSideEncryption,y=a.filter(u.PartList,function(e){return e.Uploaded&&(m+=e.PartNumber>=h&&l%d||d),!e.Uploaded}),v=e.onProgress;o.eachLimit(y,p,function(e,t){if(n._isRunningTask(r)){var p=e.PartNumber,h=Math.min(l,e.PartNumber*d)-(e.PartNumber-1)*d,y=0;(function(e,t){var n=this,r=e.TaskId,i=e.Bucket,s=e.Region,c=e.Key,u=e.FileSize,l=e.Body,d=1*e.PartNumber,p=e.SliceSize,f=e.ServerSideEncryption,h=e.UploadData,m=n.options.ChunkRetryTimes+1,g=p*(d-1),y=p,v=g+p;v>u&&(y=(v=u)-g);var C=h.PartList[d-1];o.retry(m,function(t){n._isRunningTask(r)&&a.fileSlice(l,g,v,!0,function(o){n.multipartUpload({TaskId:r,Bucket:i,Region:s,Key:c,ContentLength:y,PartNumber:d,UploadId:h.UploadId,ServerSideEncryption:f,Body:o,onProgress:e.onProgress},function(e,o){if(n._isRunningTask(r))return e?t(e):(C.Uploaded=!0,t(null,o))})})},function(e,o){if(n._isRunningTask(r))return t(e,o)})}).call(n,{TaskId:r,Bucket:i,Region:s,Key:c,SliceSize:d,FileSize:l,PartNumber:p,ServerSideEncryption:g,Body:f,UploadData:u,onProgress:function(e){m+=e.loaded-y,y=e.loaded,v({loaded:m,total:l})}},function(o,i){n._isRunningTask(r)&&(!a.isBrowser||o||i.ETag||(o='get ETag error, please add "ETag" to CORS ExposeHeader setting.'),o?m-=y:(m+=h-y,e.ETag=i.ETag),t(o||null,i))})}},function(e){if(n._isRunningTask(r))return e?t(e):void t(null,{UploadId:u.UploadId,SliceList:u.PartList})})}.call(m,{TaskId:y,Bucket:v,Region:C,Key:b,Body:S,FileSize:n,SliceSize:w,AsyncLimit:x,ServerSideEncryption:T,UploadData:t,onProgress:h},function(e,t){if(m._isRunningTask(y))return e?(h(null,!0),g.emit("error",e)):void g.emit("upload_slice_complete",t)})}),g.on("get_file_size_finish",function(){if(h=a.throttleOnProgress.call(m,n,e.onProgress),e.UploadData.UploadId)g.emit("get_upload_data_finish",e.UploadData);else{var t=a.extend({TaskId:y,Bucket:v,Region:C,Key:b,Headers:e.Headers,StorageClass:k,Body:S,FileSize:n,SliceSize:w,onHashProgress:R},e);(function(e,t){var n=e.TaskId,r=e.Bucket,c=e.Region,u=e.Key,h=e.StorageClass,m=this,g={},y=e.FileSize,v=e.SliceSize,C=Math.ceil(y/v),b=0,S=a.throttleOnProgress.call(m,y,e.onHashProgress),w=function(t,n){var r=t.length;if(0===r)return n(null,!0);if(r>C)return n(null,!1);if(r>1){var o=Math.max(t[0].Size,t[1].Size);if(o!==v)return n(null,!1)}var i=function(o){if(o=o.length)x.emit("has_upload_id",t);else{var i=o[e];if(!a.isInArray(t,i))return l.call(m,i),void p(e+1);s[i]?p(e+1):f.call(m,{Bucket:r,Region:c,Key:u,UploadId:i},function(t,r){m._isRunningTask(n)&&(t?(l.call(m,i),p(e+1)):x.emit("upload_id_ready",{UploadId:i,PartList:r.PartList}))})}};p(0)}else x.emit("has_upload_id",t)}),x.on("get_remote_upload_id_list",function(t){p.call(m,{Bucket:r,Region:c,Key:u},function(t,r){if(m._isRunningTask(n)){if(t)return x.emit("error",t);var o=a.filter(r.UploadList,function(e){return e.Key===u&&(!h||e.StorageClass.toUpperCase()===h.toUpperCase())}).reverse().map(function(e){return e.UploadId||e.UploadID});if(o.length)x.emit("seek_local_avail_upload_id",o);else{var i,s=a.getFileUUID(e.Body,e.ChunkSize);s&&(i=d.call(m,s))&&a.each(i,function(e){l.call(m,e)}),x.emit("no_available_upload_id")}}})}),x.emit("get_remote_upload_id_list")}).call(m,t,function(t,n){if(m._isRunningTask(y)){if(t)return g.emit("error",t);e.UploadData.UploadId=n.UploadId,e.UploadData.PartList=n.PartList,g.emit("get_upload_data_finish",e.UploadData)}})}}),n=e.ContentLength,delete e.ContentLength,!e.Headers&&(e.Headers={}),a.each(e.Headers,function(t,n){"content-length"===n.toLowerCase()&&delete e.Headers[n]}),function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],r=1048576,o=0;o=n?"sliceUploadFile":"putObject";d.push({api:g,params:e,callback:function(e,t){m&&m(e,t),l&&l(e,t,u)}})}()}),this._addTasks(d)},sliceCopyFile:function(e,t){var n=new i,r=this,s=e.Bucket,c=e.Region,u=e.Key,l=e.CopySource,d=l.match(/^([^.]+-\d+)\.cos(v6)?\.([^.]+)\.[^\/]+\/(.+)$/);if(d){var p=d[1],f=d[3],h=decodeURIComponent(d[4]),m=void 0===e.SliceSize?r.options.CopySliceSize:e.SliceSize;m=Math.max(0,Math.min(m,5368709120));var g,y,v=e.ChunkSize||this.options.CopyChunkSize,C=this.options.CopyChunkParallelLimit,b=0;n.on("copy_slice_complete",function(e){r.multipartComplete({Bucket:s,Region:c,Key:u,UploadId:e.UploadId,Parts:e.PartList},function(e,n){if(e)return y(null,!0),t(e);y({loaded:g,total:g},!0),t(null,n)})}),n.on("get_copy_data_finish",function(e){o.eachLimit(e.PartList,C,function(t,n){var i=t.PartNumber,a=t.CopySourceRange,d=t.end-t.start,p=0;(function(e,t){var n=e.TaskId,r=e.Bucket,i=e.Region,a=e.Key,s=e.CopySource,c=e.UploadId,u=1*e.PartNumber,l=e.CopySourceRange,d=this.options.ChunkRetryTimes+1,p=this;o.retry(d,function(t){p.uploadPartCopy({TaskId:n,Bucket:r,Region:i,Key:a,CopySource:s,UploadId:c,PartNumber:u,CopySourceRange:l,onProgress:e.onProgress},function(e,n){t(e||null,n)})},function(e,n){return t(e,n)})}).call(r,{Bucket:s,Region:c,Key:u,CopySource:l,UploadId:e.UploadId,PartNumber:i,CopySourceRange:a,onProgress:function(e){b+=e.loaded-p,p=e.loaded,y({loaded:b,total:g})}},function(e,r){if(e)return n(e);y({loaded:b,total:g}),b+=d-p,t.ETag=r.ETag,n(e||null,r)})},function(r){if(r)return y(null,!0),t(r);n.emit("copy_slice_complete",e)})}),n.on("get_file_size_finish",function(o){var i;!function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],n=1048576,o=0;o"x-cos-meta-".length&&(c[t]=e)}),n.emit("get_file_size_finish",c)}else t({error:'get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.'})})}else t({error:"CopySource format error"})}};e.exports.init=function(e,t){t.transferToTaskMethod(h,"sliceUploadFile"),a.each(h,function(t,n){e.prototype[n]=a.apiWrapper(n,t)})}},function(e,t){var n={eachLimit:function(e,t,n,r){if(r=r||function(){},!e.length||t<=0)return r();var o=0,i=0,a=0;!function s(){if(o>=e.length)return r();for(;a=e.length?r():s())})}()},retry:function(e,t,n){var r=function(o){t(function(t,i){t&&o0&&a.length>o&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return e}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=function(){for(var e=[],t=0;t0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,l=h(c,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){e.exports=n(27)},function(e,t,n){"use strict";var r=n(28),o=n(29),i=n(31),a=n(32);function s(e){var t=new i(e),n=o(i.prototype.request,t);return r.extend(n,i.prototype,t),r.extend(n,t),n}var c=s(a);c.Axios=i,c.create=function(e){return s(r.merge(a,e))},c.Cancel=n(49),c.CancelToken=n(50),c.isCancel=n(46),c.all=function(e){return Promise.all(e)},c.spread=n(51),e.exports=c,e.exports.default=c},function(e,t,n){"use strict";var r=n(29),o=n(30),i=Object.prototype.toString;function a(e){return"[object Array]"===i.call(e)}function s(e){return null!==e&&"object"==typeof e}function c(e){return"[object Function]"===i.call(e)}function u(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),a(e))for(var n=0,r=e.length;n + * @license MIT + */ + e.exports=function(e){return null!=e&&(n(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t,n){"use strict";var r=n(32),o=n(28),i=n(43),a=n(44);function s(e){this.defaults=e,this.interceptors={request:new i,response:new i}}s.prototype.request=function(e){"string"==typeof e&&(e=o.merge({url:arguments[0]},arguments[1])),(e=o.merge(r,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},o.forEach(["delete","get","head","options"],function(e){s.prototype[e]=function(t,n){return this.request(o.merge(n||{},{method:e,url:t}))}}),o.forEach(["post","put","patch"],function(e){s.prototype[e]=function(t,n,r){return this.request(o.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=s},function(e,t,n){"use strict";(function(t){var r=n(28),o=n(33),i={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var s,c={adapter:("undefined"!=typeof XMLHttpRequest?s=n(34):void 0!==t&&(s=n(34)),s),transformRequest:[function(e,t){return o(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)?(a(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(e){c.headers[e]={}}),r.forEach(["post","put","patch"],function(e){c.headers[e]=r.merge(i)}),e.exports=c}).call(this,n(3))},function(e,t,n){"use strict";var r=n(28);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(28),o=n(35),i=n(38),a=n(39),s=n(40),c=n(36),u="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(41);e.exports=function(e){return new Promise(function(t,l){var d=e.data,p=e.headers;r.isFormData(d)&&delete p["Content-Type"];var f=new XMLHttpRequest,h="onreadystatechange",m=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in f||s(e.url)||(f=new window.XDomainRequest,h="onload",m=!0,f.onprogress=function(){},f.ontimeout=function(){}),e.auth){var g=e.auth.username||"",y=e.auth.password||"";p.Authorization="Basic "+u(g+":"+y)}if(f.open(e.method.toUpperCase(),i(e.url,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,f[h]=function(){if(f&&(4===f.readyState||m)&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in f?a(f.getAllResponseHeaders()):null,r={data:e.responseType&&"text"!==e.responseType?f.response:f.responseText,status:1223===f.status?204:f.status,statusText:1223===f.status?"No Content":f.statusText,headers:n,config:e,request:f};o(t,l,r),f=null}},f.onerror=function(){l(c("Network Error",e,null,f)),f=null},f.ontimeout=function(){l(c("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",f)),f=null},r.isStandardBrowserEnv()){var v=n(42),C=(e.withCredentials||s(e.url))&&e.xsrfCookieName?v.read(e.xsrfCookieName):void 0;C&&(p[e.xsrfHeaderName]=C)}if("setRequestHeader"in f&&r.forEach(p,function(e,t){void 0===d&&"content-type"===t.toLowerCase()?delete p[t]:f.setRequestHeader(t,e)}),e.withCredentials&&(f.withCredentials=!0),e.responseType)try{f.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){f&&(f.abort(),l(e),f=null)}),void 0===d&&(d=null),f.send(d)})}},function(e,t,n){"use strict";var r=n(36);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(37);e.exports=function(e,t,n,o,i){var a=new Error(e);return r(a,t,n,o,i)}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e}},function(e,t,n){"use strict";var r=n(28);function o(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(r.isURLSearchParams(t))i=t.toString();else{var a=[];r.forEach(t,function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),a.push(o(t)+"="+o(e))}))}),i=a.join("&")}return i&&(e+=(-1===e.indexOf("?")?"?":"&")+i),e}},function(e,t,n){"use strict";var r=n(28),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,a={};return e?(r.forEach(e.split("\n"),function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(a[t]&&o.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}}),a):a}},function(e,t,n){"use strict";var r=n(28);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=o(window.location.href),function(t){var n=r.isString(t)?o(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function o(){this.message="String contains an invalid character"}o.prototype=new Error,o.prototype.code=5,o.prototype.name="InvalidCharacterError",e.exports=function(e){for(var t,n,i=String(e),a="",s=0,c=r;i.charAt(0|s)||(c="=",s%1);a+=c.charAt(63&t>>8-s%1*8)){if((n=i.charCodeAt(s+=.75))>255)throw new o;t=t<<8|n}return a}},function(e,t,n){"use strict";var r=n(28);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,o,i,a){var s=[];s.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),r.isString(o)&&s.push("path="+o),r.isString(i)&&s.push("domain="+i),!0===a&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(28);function o(){this.handlers=[]}o.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){r.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=o},function(e,t,n){"use strict";var r=n(28),o=n(45),i=n(46),a=n(32),s=n(47),c=n(48);function u(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return u(e),e.baseURL&&!s(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),r.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||a.adapter)(e).then(function(t){return u(e),t.data=o(t.data,t.headers,e.transformResponse),t},function(t){return i(t)||(u(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(28);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){"use strict";var r=n(49);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new r(e),t(n.reason))})}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o(function(t){e=t}),cancel:e}},e.exports=o},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.UPLOAD_FAIL=1]="UPLOAD_FAIL"}(r||(r={})),t.default={isFile:function(e){return"[object File]"==Object.prototype.toString.call(e)},isFunction:function(e){return"function"==typeof e},isString:function(e){return"string"==typeof e},noop:function(){},delay:function(e){return new Promise(function(t){setTimeout(function(){t()},e)})},isTest:!1,isDev:!1,CLIENT_ERROR_CODE:r}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n",license:"MIT",bugs:{url:"https://github.com/tencentyun/vod-js-sdk-v6/issues"},homepage:"https://github.com/tencentyun/vod-js-sdk-v6#readme",dependencies:{axios:"^0.18.0","cos-js-sdk-v5":"0.5.16","js-sha1":"^0.6.0",uuid:"^3.3.2"},devDependencies:{"@types/uuid":"^3.4.4","@types/mocha":"^5.2.5","@types/semver":"^6.0.0","@types/sha1":"^1.1.1","@typescript-eslint/eslint-plugin":"^1.9.0","@typescript-eslint/parser":"^1.9.0",eslint:"^5.16.0","eslint-config-prettier":"^4.3.0","eslint-plugin-prettier":"^3.1.0","espower-typescript":"^9.0.1",jsdom:"^13.1.0","jsdom-global":"^3.0.2",mm:"^2.4.1",mocha:"^5.2.0",nyc:"^13.1.0","power-assert":"^1.6.1",prettier:"^1.17.1",semver:"^6.1.1","ts-loader":"^5.3.3",typescript:"^3.5.3",webpack:"^4.28.1","webpack-cli":"^3.2.1"},nyc:{extension:[".ts",".tsx"],include:["src"],reporter:["html"],all:!0}}},function(e,t,n){var r=n(56),o=n(57);e.exports=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var s=0;s<16;++s)t[i+s]=a[s];return t||o(a)}},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var o=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}}])}); +//# sourceMappingURL=vod-js-sdk-v6.js.map \ No newline at end of file diff --git a/public/static/lib/xm-select.js b/public/static/lib/xm-select.js new file mode 100644 index 00000000..8220d63c --- /dev/null +++ b/public/static/lib/xm-select.js @@ -0,0 +1,8 @@ +/*! + * @Title: xm-select + * @Version: 1.1.0 + * @Description:基于layui的多选解决方案 + * @Site: https://gitee.com/maplemei/xm-select + * @Author: maplemei + * @License:Apache License 2.0 + */!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="./",n(n.s=213)}({104:function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,o=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var r,i=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?e:(r=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:o+i.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")}))}},20:function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=function(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),n="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(t);return"/*# ".concat(n," */")}(o),i=o.sources.map((function(e){return"/*# sourceURL=".concat(o.sourceRoot).concat(e," */")}));return[n].concat(i).concat([r]).join("\n")}return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2],"{").concat(n,"}"):n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},r=0;r=0&&p.splice(t,1)}function x(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var o=function(){0;return n.nc}();o&&(e.attrs.nonce=o)}return y(t,e.attrs),m(e,t),t}function y(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function g(e,t){var n,o,r,i;if(t.transform&&e.css){if(!(i="function"==typeof t.transform?t.transform(e.css):t.transform.default(e.css)))return function(){};e.css=i}if(t.singleton){var l=u++;n=c||(c=x(t)),o=w.bind(null,n,l,!1),r=w.bind(null,n,l,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",y(t,e.attrs),m(e,t),t}(t),o=C.bind(null,n,t),r=function(){b(n),n.href&&URL.revokeObjectURL(n.href)}):(n=x(t),o=k.bind(null,n),r=function(){b(n)});return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else r()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=l()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=h(e,t);return d(n,t),function(e){for(var o=[],r=0;r>>0;for(t&&(n=t),o=new Array(l),r=0;r>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),o=0;o>>0;if("function"!=typeof e)throw new TypeError;for(var o=[],r=arguments[1],i=0;i>>0,r=arguments[1],i=0;i .xm-tips {\n color: #999999;\n padding: 0 10px;\n position: absolute;\n display: flex;\n height: 100%;\n align-items: center;\n}\nxm-select > .xm-icon {\n display: inline-block;\n overflow: hidden;\n position: absolute;\n width: 0;\n height: 0;\n right: 10px;\n top: 50%;\n margin-top: -3px;\n cursor: pointer;\n border: 6px dashed transparent;\n border-top-color: #C2C2C2;\n border-top-style: solid;\n transition: all 0.3s;\n -webkit-transition: all 0.3s;\n}\nxm-select > .xm-icon-expand {\n margin-top: -9px;\n transform: rotate(180deg);\n}\nxm-select > .xm-label.single-row {\n position: absolute;\n top: 0;\n bottom: 0px;\n left: 0px;\n right: 30px;\n overflow: auto hidden;\n}\nxm-select > .xm-label.single-row .scroll {\n overflow-y: hidden;\n}\nxm-select > .xm-label.single-row .label-content {\n flex-wrap: nowrap;\n}\nxm-select > .xm-label.auto-row .label-content {\n flex-wrap: wrap;\n}\nxm-select > .xm-label .scroll .label-content {\n display: flex;\n padding: 3px 30px 3px 10px;\n}\nxm-select > .xm-label .xm-label-block {\n display: flex;\n position: relative;\n padding: 0px 5px;\n margin: 2px 5px 2px 0;\n border-radius: 3px;\n align-items: baseline;\n color: #FFF;\n}\nxm-select > .xm-label .xm-label-block > span {\n display: flex;\n color: #FFF;\n white-space: nowrap;\n}\nxm-select > .xm-label .xm-label-block > i {\n color: #FFF;\n margin-left: 8px;\n font-size: 12px;\n cursor: pointer;\n display: flex;\n}\nxm-select > .xm-label .xm-label-block.disabled {\n background-color: #C2C2C2 !important;\n cursor: no-drop !important;\n}\nxm-select > .xm-label .xm-label-block.disabled > i {\n cursor: no-drop !important;\n}\nxm-select > .xm-body {\n position: absolute;\n left: 0;\n top: 42px;\n padding: 5px 0;\n z-index: 999;\n width: 100%;\n min-width: fit-content;\n border: 1px solid #E6E6E6;\n background-color: #fff;\n border-radius: 2px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);\n animation-name: xm-upbit;\n animation-duration: 0.3s;\n animation-fill-mode: both;\n}\nxm-select > .xm-body .scroll-body {\n overflow: auto;\n}\nxm-select > .xm-body .scroll-body::-webkit-scrollbar {\n width: 8px;\n}\nxm-select > .xm-body .scroll-body::-webkit-scrollbar-track {\n -webkit-border-radius: 2em;\n -moz-border-radius: 2em;\n -ms-border-radius: 2em;\n border-radius: 2em;\n background-color: #FFF;\n}\nxm-select > .xm-body .scroll-body::-webkit-scrollbar-thumb {\n -webkit-border-radius: 2em;\n -moz-border-radius: 2em;\n -ms-border-radius: 2em;\n border-radius: 2em;\n background-color: #C2C2C2;\n}\nxm-select > .xm-body.up {\n top: auto;\n bottom: 42px;\n}\nxm-select > .xm-body .xm-group {\n cursor: default;\n}\nxm-select > .xm-body .xm-group-item {\n display: inline-block;\n cursor: pointer;\n padding: 0 10px;\n color: #999;\n font-size: 12px;\n}\nxm-select > .xm-body .xm-option {\n display: flex;\n align-items: center;\n position: relative;\n padding: 0 10px;\n cursor: pointer;\n}\nxm-select > .xm-body .xm-option:hover {\n background-color: #f2f2f2;\n}\nxm-select > .xm-body .xm-option-icon {\n color: transparent;\n display: flex;\n border: 1px solid #E6E6E6;\n border-radius: 3px;\n justify-content: center;\n align-items: center;\n}\nxm-select > .xm-body .xm-option-icon.xm-icon-danx {\n border-radius: 100%;\n}\nxm-select > .xm-body .xm-option-content {\n display: flex;\n position: relative;\n padding-left: 15px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n color: #666;\n width: calc(100% - 20px);\n}\nxm-select > .xm-body .xm-option.hide-icon .xm-option-content {\n padding-left: 0;\n}\nxm-select > .xm-body .xm-option.selected.hide-icon .xm-option-content {\n color: #FFF !important;\n}\nxm-select > .xm-body .xm-select-empty {\n text-align: center;\n color: #999;\n}\nxm-select > .xm-body .disabled {\n cursor: no-drop;\n}\nxm-select > .xm-body .disabled:hover {\n background-color: #FFF;\n}\nxm-select > .xm-body .disabled .xm-option-icon {\n border-color: #C2C2C2 !important;\n}\nxm-select > .xm-body .disabled .xm-option-content {\n color: #C2C2C2 !important;\n}\nxm-select > .xm-body .disabled.selected > .xm-option-icon {\n color: #C2C2C2 !important;\n}\nxm-select > .xm-body .xm-search {\n background-color: #FFF !important;\n position: relative;\n padding: 0 10px;\n margin-bottom: 5px;\n cursor: pointer;\n}\nxm-select > .xm-body .xm-search > i {\n position: absolute;\n color: #666;\n}\nxm-select > .xm-body .xm-search-input {\n border: none;\n border-bottom: 1px solid #E6E6E6;\n padding-left: 27px;\n cursor: text;\n}\nxm-select > .xm-body .xm-paging {\n padding: 0 10px;\n display: flex;\n margin-top: 5px;\n}\nxm-select > .xm-body .xm-paging > span:first-child {\n border-radius: 2px 0 0 2px;\n}\nxm-select > .xm-body .xm-paging > span:last-child {\n border-radius: 0 2px 2px 0;\n}\nxm-select > .xm-body .xm-paging > span {\n display: flex;\n flex: auto;\n justify-content: center;\n vertical-align: middle;\n padding: 0 15px;\n margin: 0 -1px 0 0;\n background-color: #fff;\n color: #333;\n font-size: 12px;\n border: 1px solid #e2e2e2;\n}\nxm-select > .xm-body .xm-toolbar {\n padding: 0 10px;\n display: flex;\n margin: -3px 0;\n cursor: default;\n}\nxm-select > .xm-body .xm-toolbar .toolbar-tag {\n cursor: pointer;\n display: flex;\n margin-right: 20px;\n color: #666;\n align-items: baseline;\n}\nxm-select > .xm-body .xm-toolbar .toolbar-tag:hover {\n opacity: 0.8;\n}\nxm-select > .xm-body .xm-toolbar .toolbar-tag:active {\n opacity: 1;\n}\nxm-select > .xm-body .xm-toolbar .toolbar-tag > i {\n margin-right: 2px;\n font-size: 14px;\n}\nxm-select > .xm-body .xm-toolbar .toolbar-tag:last-child {\n margin-right: 0;\n}\nxm-select > .xm-body .xm-body-custom {\n line-height: initial;\n cursor: default;\n}\nxm-select > .xm-body .xm-body-custom * {\n box-sizing: initial;\n}\nxm-select > .xm-body .xm-tree {\n position: relative;\n}\nxm-select > .xm-body .xm-tree-icon {\n display: inline-block;\n margin-right: 3px;\n cursor: pointer;\n border: 6px dashed transparent;\n border-left-color: #C2C2C2;\n border-left-style: solid;\n transition: all 0.3s;\n -webkit-transition: all 0.3s;\n z-index: 2;\n visibility: hidden;\n}\nxm-select > .xm-body .xm-tree-icon.expand {\n margin-top: 3px;\n margin-right: 5px;\n margin-left: -2px;\n transform: rotate(90deg);\n}\nxm-select > .xm-body .xm-tree-icon.visible {\n visibility: visible;\n}\nxm-select > .xm-body .xm-tree .left-line {\n position: absolute;\n left: 13px;\n width: 0;\n z-index: 1;\n border-left: 1px dotted #c0c4cc !important;\n}\nxm-select > .xm-body .xm-tree .top-line {\n position: absolute;\n left: 13px;\n height: 0;\n z-index: 1;\n border-top: 1px dotted #c0c4cc !important;\n}\nxm-select > .xm-body .scroll-body > .xm-tree > .xm-option > .top-line {\n width: 0 !important;\n}\nxm-select .xm-input {\n cursor: pointer;\n border-radius: 2px;\n border-width: 1px;\n border-style: solid;\n border-color: #E6E6E6;\n display: block;\n width: 100%;\n box-sizing: border-box;\n background-color: #FFF;\n line-height: 1.3;\n padding-left: 10px;\n outline: 0;\n user-select: text;\n -ms-user-select: text;\n -moz-user-select: text;\n -webkit-user-select: text;\n}\nxm-select .dis {\n display: none;\n}\nxm-select .loading {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(255, 255, 255, 0.6);\n display: flex;\n align-items: center;\n justify-content: center;\n}\nxm-select .loading .loader {\n border: 0.2em dotted currentcolor;\n border-radius: 50%;\n -webkit-animation: 1s loader linear infinite;\n animation: 1s loader linear infinite;\n display: inline-block;\n width: 1em;\n height: 1em;\n color: inherit;\n vertical-align: middle;\n pointer-events: none;\n}\nxm-select .xm-select-default {\n display: none !important;\n}\nxm-select .xm-select-disabled {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n cursor: no-drop;\n z-index: 2;\n opacity: 0.3;\n background-color: #FFF;\n}\nxm-select[size='large'] {\n min-height: 40px;\n line-height: 40px;\n}\nxm-select[size='large'] .xm-input {\n height: 40px;\n}\nxm-select[size='large'] .xm-label .scroll .label-content {\n line-height: 34px;\n}\nxm-select[size='large'] .xm-label .xm-label-block {\n height: 30px;\n line-height: 30px;\n}\nxm-select[size='large'] .xm-body .xm-option .xm-option-icon {\n height: 20px;\n width: 20px;\n font-size: 20px;\n}\nxm-select[size='large'] .xm-paging > span {\n height: 34px;\n line-height: 34px;\n}\nxm-select[size='large'] .xm-tree .left-line {\n height: calc(100% - 40px);\n top: 20px;\n bottom: 20px;\n}\nxm-select[size='large'] .xm-tree .left-line.expand {\n height: 100%;\n bottom: 0;\n}\nxm-select[size='large'] .xm-tree:last-child .left-line {\n height: calc(100% - 40px);\n}\nxm-select[size='large'] .xm-tree .xm-tree-icon.hidden + .top-line {\n top: 19px;\n}\nxm-select[size='large'] .xm-tree .xm-tree-icon + .top-line {\n margin-left: 1px;\n}\nxm-select {\n min-height: 36px;\n line-height: 36px;\n}\nxm-select .xm-input {\n height: 36px;\n}\nxm-select .xm-label .scroll .label-content {\n line-height: 30px;\n}\nxm-select .xm-label .xm-label-block {\n height: 26px;\n line-height: 26px;\n}\nxm-select .xm-body .xm-option .xm-option-icon {\n height: 18px;\n width: 18px;\n font-size: 18px;\n}\nxm-select .xm-paging > span {\n height: 30px;\n line-height: 30px;\n}\nxm-select .xm-tree .left-line {\n height: calc(100% - 36px);\n top: 18px;\n bottom: 18px;\n}\nxm-select .xm-tree .left-line.expand {\n height: 100%;\n bottom: 0;\n}\nxm-select .xm-tree:last-child .left-line {\n height: calc(100% - 36px);\n}\nxm-select .xm-tree .xm-tree-icon.hidden + .top-line {\n top: 17px;\n}\nxm-select .xm-tree .xm-tree-icon + .top-line {\n margin-left: 1px;\n}\nxm-select[size='small'] {\n min-height: 32px;\n line-height: 32px;\n}\nxm-select[size='small'] .xm-input {\n height: 32px;\n}\nxm-select[size='small'] .xm-label .scroll .label-content {\n line-height: 26px;\n}\nxm-select[size='small'] .xm-label .xm-label-block {\n height: 22px;\n line-height: 22px;\n}\nxm-select[size='small'] .xm-body .xm-option .xm-option-icon {\n height: 16px;\n width: 16px;\n font-size: 16px;\n}\nxm-select[size='small'] .xm-paging > span {\n height: 26px;\n line-height: 26px;\n}\nxm-select[size='small'] .xm-tree .left-line {\n height: calc(100% - 32px);\n top: 16px;\n bottom: 16px;\n}\nxm-select[size='small'] .xm-tree .left-line.expand {\n height: 100%;\n bottom: 0;\n}\nxm-select[size='small'] .xm-tree:last-child .left-line {\n height: calc(100% - 32px);\n}\nxm-select[size='small'] .xm-tree .xm-tree-icon.hidden + .top-line {\n top: 15px;\n}\nxm-select[size='small'] .xm-tree .xm-tree-icon + .top-line {\n margin-left: 1px;\n}\nxm-select[size='mini'] {\n min-height: 28px;\n line-height: 28px;\n}\nxm-select[size='mini'] .xm-input {\n height: 28px;\n}\nxm-select[size='mini'] .xm-label .scroll .label-content {\n line-height: 22px;\n}\nxm-select[size='mini'] .xm-label .xm-label-block {\n height: 18px;\n line-height: 18px;\n}\nxm-select[size='mini'] .xm-body .xm-option .xm-option-icon {\n height: 14px;\n width: 14px;\n font-size: 14px;\n}\nxm-select[size='mini'] .xm-paging > span {\n height: 22px;\n line-height: 22px;\n}\nxm-select[size='mini'] .xm-tree .left-line {\n height: calc(100% - 28px);\n top: 14px;\n bottom: 14px;\n}\nxm-select[size='mini'] .xm-tree .left-line.expand {\n height: 100%;\n bottom: 0;\n}\nxm-select[size='mini'] .xm-tree:last-child .left-line {\n height: calc(100% - 28px);\n}\nxm-select[size='mini'] .xm-tree .xm-tree-icon.hidden + .top-line {\n top: 13px;\n}\nxm-select[size='mini'] .xm-tree .xm-tree-icon + .top-line {\n margin-left: 1px;\n}\n.layui-form-pane xm-select {\n margin: -1px -1px -1px 0;\n}\n",""])},218:function(e,t,n){var o=n(219);"string"==typeof o&&(o=[[e.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(21)(o,r);o.locals&&(e.exports=o.locals)},219:function(e,t,n){(e.exports=n(20)(!1)).push([e.i,'@font-face {\n font-family: "xm-iconfont";\n src: url(\'//at.alicdn.com/t/font_792691_qxv28s6g1l9.eot?t=1534240067831\');\n src: url(\'//at.alicdn.com/t/font_792691_qxv28s6g1l9.eot?t=1534240067831#iefix\') format(\'embedded-opentype\'), url(\'data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAksAAsAAAAAEYAAAAjdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCEUgqTXI8lATYCJAM0CxwABCAFhG0HgTwbZQ4jEbaCkVIj+4sD3pR1GFAIp4fcnExVznDkY6poTaP8+woHw+EnHMKNfx8836/9zn2yu1/EgGTS1ROhmYfkmVCZjoeiFUKEJB4yw9Op/w7VIXHBVNhnuwzCYWJuctqf/TUplM2JBwVtNxeeFQx2AiDNB/4P17SEuttU1NxT62pHHh0FLvkr5IKlv59TW4obkWUQatb9n+IL9BoYMarW7aYmNPmkDAMFbkZvwqsJoWdiWzFhTVpHrPQCa/bkkkMAP2WakcHXARTwMAhKsGENuYnAqwmYSLbgmZ1AUINAq/HDU6XqEcCx/335AZ3iARRWA5HS7ELPKaD3HXzK2/3fHaMPOHq+bmAhBxpoBsyCvQ5aTkHLLlfj346yC0gTpY847xAcSUAsQydd36d9yv8doE36aWJRSJOVRP6fPPBhcQmi0BiEAB5+HBAHgA6mV05q4jvQHL4dA4HDgsHB4YIhoeUyAnAoMGJwaDDp4DBgMkBxLqYTKMB0BYcHZhrq4IdPOcPXUYe254F20C7YVxCTvQ7224IspxVBtMQtU1AoRFlCNJYt4AWdhkSIBEQDkSCCUIBajocT8z+QgxgIAbq6bO3aSk0FRpQ51eXzie22O5F0tOgRJY1Hhv+jGMNySErrQ+SzskZNRdmIlkXF6NhTKKc6lS7XprOVmjSKYek5RFkdgNXNF5A/EIFYWpJQYnsTgM0NtTYLm4wpQwk8miQV6nJRPI+H8fN6Wb7bPcLjYnVdDWWoU27ae0Pleki5H9HeJ6zncfYf8GyZ2027XOMGgPuwxct6PAtZhpJFIymaHVEZyiS32SOR6JY9thDj3HcwizEbL7fmVV2MhDdcysKBmebXXolBOt43C8bsLRCiOZBM2prDYomqi4tNzgTCXhGOWHff4e2dYbOvCeNPZO50flUHoEy1jnptCEtD574hRkkaHRje9z2dWk8VclIcxkaOxpDZhG6Nz4qDaRRGMhxMwNQ2h8a+fSIWs8W17VM43eMvup6dXH6ZazFT0ZDgvc54llOuPNp9jzXtTaWbtZ0PaCa5ljOefNa7gnbnzb4H7/ZgQ0WwJQLRSXQ1wYbgQWkaOYRZgyXEWvmepBwhyfLaRL1NqpcqRMttiYnaEIejG0lTMk0n4lqp7Z1qIyYzeQFmk4TSORO224Nhia6c0VVNmqhlboeQ9ql6vcMYcjo+GLpAV0Uw4/B7gB6fBctt26sStgcn2ZNCENw3jEnKdGchu5EiT0yiK3WoXuATzaS3hdX66wH+6r6XBEQOjhCAzMZgEiJUOExA5IyOFN2BoTqxTGdaVe2O8l/vyhTUeKIDNnnlIwEfujH2m0iZoBRZKS6BwxK/Cbh4TpBMKeOVwpz5iCKBE8WiXZL+gTEYWKY0PC7MzHGN7983OuylYZW1QXkGI8uWdK1oePeuweEAH5TPJGnSxE1rwBtBp8vlR492lw8/dDRTnnX48HB59yNHEuXxH98fOXzksPA66oQs6s+ouOjYg7KDsaSMsCaZiiUlWkLSFyXReYSM0EQ/ge5eFOXTl6OlUbD3IroIeuEzBmjA1KkDIAMhZwMNqH2Ks3dEz8Cl/l33zTs3Szy6tmWJZ31e/3HtZ78NAzJEfQ2VydBrEllsjOUWctuBA+jv3yhMB1KMI+mSp8tghwOGaVmKYUx3g765v3717fvrF00Lfz3rOxYIsn3B30N3c6HKY0dHsPM3nlWGKBcvVggXbmHu3OJCFW0eDwHDcdNmaLMJ983m1kOpiqRiCpe1Ojb8ZHjs6lN4a1Dg7M2mEmGAz7nn+QLOB7wNdYe+DQCkvBb5+BGtldzHD6YH/fChlP7wkUxjBEwjLaT/XyqGpwqmNh5hKcgAJpShEO7R7eRAWH3xHl+IjygmrDAZlIkNJt6EvNmzvMh5ZNDhQY4izZziPb9D+2fufuP2O47fc6fpaFREJP/A7pjdB2ZYVjQR/olR4ZGCA7tlu1pmWHlFgpZdss8EtzeX/mHgDSa7dldNn67q3pUcwDNmHFqTnRP7bg2dG5o6Z6FGReWpVHmUim7B7NRQNR0K4nKy/xn/T/y40TWzuMgki5sVacj/HuDicBnHv3JikWgA5Tdr2LBPU78bFTE9jSWNU+/0S6Qjeo2uX9KjZh/NqyocKug2NLT7DS2U+Wxh8Lq//TWLGq6LMkfUp39Ur45LeJLetMlaaqww91TcHegXIL1FK6ZYT/SAbfoiNPKx8fnUgn/mg6A1i7qnjJvkV25+Gv8qO27ShLJg/9YlCvPflo0WcyG0VzBvnk2U2cfxZ27Vv5dkD3OqVmuF0+j9Xe4GGJSVDrqHQuFsCYVgidx0U6lUyHoWXul6rLlnZl1AEhM7bHUCyPV1EWMgEwLeFu5SHw6hzhbTcSMB2jxQv+3ShR/JTzrfRuYxzD++oM0CwL0FAPg6oACJ9LHlohCSDwAASB/4JMDXjBxBuiXFJzqApC95WDP8wZeCmtNc4/t9JZqADJ9XowDpMsV0Bq40ht8ez+/wKRD/Jzpx7WvWAI/5yg7k+eegHgp2uukjZ+ojio17gxBDZtuPEX+6xuPwaENde4b+EA/TGqUCv7SCKeNgnJfrsCm2bnLMpspyhUsJdMhwX2CIaC63BOgGh4iecj9NjIQOkGAHjZggAI0coVyIclGuCHMDGsQTGBDP5ZY0fyYH6aLL/cxJIsoARzwKzp4C8ASKiStDSVarjjTLNr6DyQceyDBz9w0hIlnWlPVx4Q0shHP4iCezTkkzHejIXhMvcDgQc4F2IFPZYt5tq0qvfJaSjp0ZTwF4stUVQ1xboySr706z1s+/g8kHHiIn7lp/Q4j4cEZDSc1QvtGWdeK9bI8nsyZRt2Z6f6Aj45W64SBnieHCjnYgU0k7YtptqegmzaXL67PH35zu/Hynii9YihItRqw44oonPvFLQIISkjCT7cztRbscSY6K25XKdGkmfWvJGpH3YDg+1JuN5HTL9Kcixqjvvsw0PwMK5JSwKAZ1L80ILo5bNY6UY5vIDRzqPPFozZ4tjsVQvtMBAAA=\') format(\'woff2\'), url(\'//at.alicdn.com/t/font_792691_qxv28s6g1l9.ttf?t=1534240067831\') format(\'truetype\'), url(\'//at.alicdn.com/t/font_792691_qxv28s6g1l9.svg?t=1534240067831#iconfont\') format(\'svg\');\n}\n.xm-iconfont {\n font-family: "xm-iconfont" !important;\n font-size: 16px;\n font-style: normal;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.xm-icon-quanxuan:before {\n content: "\\e62c";\n}\n.xm-icon-caidan:before {\n content: "\\e610";\n}\n.xm-icon-fanxuan:before {\n content: "\\e837";\n}\n.xm-icon-pifu:before {\n content: "\\e668";\n}\n.xm-icon-qingkong:before {\n content: "\\e63e";\n}\n.xm-icon-sousuo:before {\n content: "\\e600";\n}\n.xm-icon-danx:before {\n content: "\\e62b";\n}\n.xm-icon-duox:before {\n content: "\\e613";\n}\n.xm-icon-close:before {\n content: "\\e601";\n}\n.xm-icon-expand:before {\n content: "\\e641";\n}\n.xm-icon-banxuan:before {\n content: "\\e60d";\n}\n',""])},220:function(e,t){(function(t){e.exports=t}).call(this,{})},64:function(e){e.exports=JSON.parse('{"a":"xm-select","b":"1.1.0"}')},74:function(e,t,n){"use strict";var o=n(64);function r(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t3)for(n=[n],o=3;or?n-r:r,l=this.labelRef.scrollLeft+e.deltaY;l<0&&(l=0),l>i&&(l=i),this.labelRef.scrollLeft=l}}},{key:"componentDidMount",value:function(){this.labelRef.addEventListener&&this.labelRef.addEventListener("DOMMouseScroll",this.scrollFunc.bind(this),!1),this.labelRef.attachEvent&&this.labelRef.attachEvent("onmousewheel",this.scrollFunc.bind(this)),this.labelRef.onmousewheel=this.scrollFunc.bind(this)}},{key:"render",value:function(e){var t=this,n=e.data,o=e.prop,r=e.theme,i=e.model,l=e.sels,a=e.autoRow,s=o.name,c=o.disabled,u=i.label,p=u.type,f=u[p],d="",h=!0;if("text"===p)d=l.map((function(e){return"".concat(f.left).concat(e[s]).concat(f.right)})).join(f.separator);else if("block"===p){h=!1;var m=N(l),b={backgroundColor:r.color},x=f.showCount<=0?m.length:f.showCount;d=m.splice(0,x).map((function(e){var n={width:f.showIcon?"calc(100% - 20px)":"100%"};return _("div",{class:["xm-label-block",e[c]?"disabled":""].join(" "),style:b},_("span",{style:n},e[s]),f.showIcon&&_("i",{class:"xm-iconfont xm-icon-close",onClick:t.iconClick.bind(t,e,!0,e[c])}))})),m.length&&d.push(_("div",{class:"xm-label-block",style:b},"+ ",m.length))}else d=l.length&&f&&f.template?f.template(n,l):l.map((function(e){return e[s]})).join(",");return _("div",{class:["xm-label",a?"auto-row":"single-row"].join(" ")},_("div",{class:"scroll",ref:function(e){return t.labelRef=e}},h?_("div",{class:"label-content",dangerouslySetInnerHTML:{__html:d}}):_("div",{class:"label-content"},d)))}}])&&U(n.prototype,o),r&&U(n,r),t}(C);function K(e){return(K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function J(e,t){for(var n=0;n=t||this.changePageIndex(n+1)}},{key:"changePageIndex",value:function(e){this.setState({pageIndex:e})}},{key:"searchInput",value:function(e){var t=this,n=e.target.value;n!==this.__value&&(clearTimeout(this.searchCid),this.inputOver&&(this.__value=n,this.searchCid=setTimeout((function(){t.callback=!0,t.setState({filterValue:t.__value,remote:!0})}),this.props.delay)))}},{key:"focus",value:function(){this.searchInputRef&&this.searchInputRef.focus()}},{key:"blur",value:function(){this.searchInputRef&&this.searchInputRef.blur()}},{key:"handleComposition",value:function(e){var t=e.type;"compositionstart"===t?(this.inputOver=!1,clearTimeout(this.searchCid)):"compositionend"===t&&(this.inputOver=!0,this.searchInput(e))}},{key:"componentWillReceiveProps",value:function(e){var t=this;this.props.show!=e.show&&(e.show?setTimeout((function(){return t.focus()}),0):(this.setState({filterValue:""}),this.__value="",this.searchInputRef&&(this.searchInputRef.value="")))}},{key:"componentDidUpdate",value:function(){if(this.callback){this.callback=!1;var e=this.props.filterDone;s(e)&&e(this.state.filterValue,this.tempData||[])}}},{key:"render",value:function(e){var t,n=this,o=e.data,r=e.flatData,i=e.prop,l=e.template,a=e.theme,p=e.radio,f=e.sels,d=e.empty,h=e.filterable,m=e.filterMethod,b=e.remoteSearch,x=e.remoteMethod,y=(e.delay,e.searchTips),g=e.create,v=i.name,w=i.value,k=i.disabled,C=i.children,S=i.optgroup,j=c([],r);if(h)if(b)this.state.remote&&(this.callback=!1,this.setState({loading:!0,remote:!1}),this.blur(),x(this.state.filterValue,(function(e){n.focus(),n.callback=!0,n.setState({loading:!1}),n.props.onReset(e,"data")}),this.props.show));else{j=j.filter((function(e,t){return e[S]?(delete e.__del,!0):m(n.state.filterValue,e,t,i)}));for(var A=0;AI&&(T=I),I>0&&T<=0&&(T=1);var L=(T-1)*e.pageSize,H=L+e.pageSize;j=j.slice(L,H);var M={cursor:"no-drop",color:"#d2d2d2"},D={},V={};T<=1&&(D=M),T==I&&(V=M),this.state.pageIndex!==T&&this.changePageIndex(T),z=_("div",{class:"xm-paging"},_("span",{style:D,onClick:this.pagePrevClick.bind(this)},"上一页"),_("span",null,this.state.pageIndex," / ",I),_("span",{style:V,onClick:function(e){return n.pageNextClick.bind(n,e,I)()}},"下一页"))}else e.showCount>0&&(j=j.slice(0,e.showCount));var F,B=[];j.forEach((function(e){var t=P[e[w]];t!=F&&(F=t,B.push(F)),B.push(e)})),j=B,t&&(t=g(this.state.filterValue,c([],j)))&&j.splice(0,0,t);var N=c([],j);this.tempData=N;var U=_("div",{class:"xm-toolbar"},e.toolbar.list.map((function(t){var o,r={},l=e.languageProp.toolbar[t];"ALL"===t?o={icon:"xm-iconfont xm-icon-quanxuan",name:l,method:function(e){var t=i.optgroup,o=i.disabled,r=e.filter((function(e){return!e[t]})).filter((function(e){return!e[o]}));n.props.onReset(u(r,f,i),"sels")}}:"CLEAR"===t?o={icon:"xm-iconfont xm-icon-qingkong",name:l,method:function(e){n.props.onReset(f.filter((function(e){return e[i.disabled]})),"sels")}}:"REVERSE"===t?o={icon:"xm-iconfont xm-icon-fanxuan",name:l,method:function(e){var t=i.optgroup,o=i.disabled,r=e.filter((function(e){return!e[t]})).filter((function(e){return!e[o]})),l=[];f.forEach((function(e){var t=r.findIndex((function(t){return t[w]===e[w]}));-1==t?l.push(e):r.splice(t,1)})),n.props.onReset(u(r,l,i),"sels")}}:"SEARCH"===t?(r.color=a.color,o={icon:"xm-iconfont xm-icon-sousuo",name:l,method:function(e){}}):o=t;var c=function(e){"mouseenter"===e.type&&(e.target.style.color=a.color),"mouseleave"===e.type&&(e.target.style.color="")};return _("div",{class:"toolbar-tag",style:r,onClick:function(){s(o.method)&&o.method(N)},onMouseEnter:c,onMouseLeave:c},e.toolbar.showIcon&&_("i",{class:o.icon}),_("span",null,o.name))})).filter((function(e){return e}))),W="hidden"!=e.model.icon;return(j=j.map((function(e){return e[S]?_("div",{class:"xm-group"},_("div",{class:"xm-group-item",onClick:n.groupClick.bind(n,e)},e[v])):function(e){var t=!!f.find((function(t){return t[w]==e[w]})),r=t?{color:a.color,border:"none"}:{borderColor:a.color},i={};!W&&t&&(i.backgroundColor=a.color,e[k]&&(i.backgroundColor="#C2C2C2"));var s=["xm-option",e[k]?" disabled":"",t?" selected":"",W?"show-icon":"hide-icon"].join(" "),c=["xm-option-icon xm-iconfont",p?"xm-icon-danx":"xm-icon-duox"].join(" ");return _("div",{class:s,style:i,value:e[w],onClick:n.optionClick.bind(n,e,t,e[k])},W&&_("i",{class:c,style:r}),_("div",{class:"xm-option-content",dangerouslySetInnerHTML:{__html:l({data:o,item:e,arr:f,name:e[v],value:e[w]})}}))}(e)}))).length||(!e.pageEmptyShow&&(z=""),j.push(_("div",{class:"xm-select-empty"},d))),_("div",{onClick:this.blockClick},_("div",null,e.toolbar.show&&U,h&&R,_("div",{class:"scroll-body",style:{maxHeight:e.height}},j),e.paging&&z),this.state.loading&&_("div",{class:"loading"},_("span",{class:"loader"})))}}])&&J(n.prototype,o),r&&J(n,r),t}(C);function ee(e){return(ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function te(e,t){for(var n=0;n0?"visible":"hidden"].join(" ");return _("div",{class:v,style:g,value:e[f],onClick:n.optionClick.bind(n,e,b,e[d],"line")},u.showFolderIcon&&_("i",{class:k}),u.showFolderIcon&&u.showLine&&_("i",{class:o?"top-line expand":"top-line",style:{left:t-u.indent+3+"px",width:u.indent+(0===o?10:-2)+"px"}}),m&&_("i",{class:w,style:y,onClick:n.optionClick.bind(n,e,b,e[d],"checkbox")}),_("div",{class:"xm-option-content",dangerouslySetInnerHTML:{__html:s({data:c,item:e,arr:i,name:e[p],value:e[f]})}}))},x=c.map((function(e){return function e(t,o){var r=t[h];if(o+=u.indent,r&&r.length>0){var i=-1!==n.state.expandedKeys.findIndex((function(e){return t[f]===e}));return _("div",{class:"xm-tree"},u.showFolderIcon&&u.showLine&&_("i",{class:i?"left-line expand":"left-line",style:{left:o+3+"px"}}),b(t,o,i),i&&_("div",{class:"xm-tree-box"},r.map((function(t){return e(t,o)}))))}return b(t,o,0)}(e,10-u.indent)}));return x.length||x.push(_("div",{class:"xm-select-empty"},r)),_("div",{onClick:this.blockClick,class:"xm-body-tree"},_("div",{class:"scroll-body",style:{maxHeight:e.height}},x))}}])&&ae(n.prototype,o),r&&ae(n,r),t}(C);function fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function de(e){for(var t=1;t1&&void 0!==arguments[1])||arguments[1],o=e.map((function(e){return"object"===be(e)?e:t.state.dataObj[e]})).filter((function(e){return e}));return n&&(o=o.filter((function(e){return!0!==e[t.props.prop.optgroup]}))),o}},{key:"value",value:function(e,t,n){!1!==t&&!0!==t&&(t=this.state.show);var o=this.props,r=o.prop,i=o.tree,l=this.exchangeValue(e,!i.show);if(i.show){var a=this.state.data;this.clearAndReset(a,l),l=this.init({data:a,prop:r},!0)}this.resetSelectValue(l,l,!0,n),this.setState({show:t})}},{key:"clearAndReset",value:function(e,t){var n=this,o=this.props.prop,r=o.selected,i=o.children,l=o.value;e.forEach((function(e){e[r]=-1!=t.findIndex((function(t){return t[l]===e[l]}));var o=e[i];o&&a(o)&&n.clearAndReset(o,t)}))}},{key:"load",value:function(e,t,n,o){var r=this,i=this.props.prop,l=i.children,s=i.optgroup,c=i.value,u=i.selected,p=i.disabled;e.forEach((function(e){e.__node={parent:o},t[e[c]]=e,n.push(e);var i=e[l];if(i&&a(i)){var f=i.length;if(f>0){r.load(i,t,n,e),e[s]=!0,!0===e[u]&&(delete e[u],i.forEach((function(e){return e[u]=!0}))),!0===e[p]&&(delete e[p],i.forEach((function(e){return e[p]=!0})));var d=i.filter((function(e){return!0===e[u]||!0===e.__node.selected})).length;e.__node.selected=d===f,e.__node.half=d>0&&d0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=this.props.on;s(r)&&this.prepare&&o&&r({arr:e,change:t,isAdd:n}),this.setState({sels:e})}},{key:"updateBorderColor",value:function(e){this.setState({tmpColor:e})}},{key:"treeHandler",value:function(e,t,n,o){var r=this,i=this.props.prop,l=i.value,a=(i.selected,i.disabled),s=i.children,c=i.optgroup,u=t[s];u.filter((function(e){return!(e[a]||e.__node.disabled)})).forEach((function(t){if(t[c])r.treeHandler(e,t,n,o);else{var i=e.findIndex((function(e){return e[l]==t[l]}));"del"===o?-1!=i&&(e.splice(i,1),n.push(t)):"half"!==o&&"add"!==o||-1==i&&(e.push(t),n.push(t))}}));var p=u.length,f=u.filter((function(t){return-1!==e.findIndex((function(e){return e[l]===t[l]}))||!0===t.__node.selected})).length;t.__node.selected=f===p,t.__node.half=f>0&&f0&&d.length>=g)return this.updateBorderColor(i.maxColor),void(f&&s(f)&&f(d,e));d=a?[e]:[].concat(me(d),[e]),this.resetSelectValue(d,[e],!t)}else{var v=d.findIndex((function(t){return t[h]==e[h]}));-1!=v&&(d.splice(v,1),this.resetSelectValue(d,[e],!t))}var _=e.__node.parent;if(_){for(;_;){var w=_[m],k=w.length,C=w.filter((function(e){return-1!==d.findIndex((function(t){return t[h]===e[h]}))||!0===e.__node.selected})).length;_.__node.selected=C===k,_.__node.half=C>0&&Cn||o0&&void 0!==arguments[0]?arguments[0]:"zn",t=ke[e]||we;return{language:e,languageProp:t,data:[],content:"",name:"select",size:"medium",disabled:!1,initValue:null,create:null,tips:t.tips,empty:t.empty,delay:500,searchTips:t.searchTips,filterable:!1,filterMethod:function(e,t,n,o){return!e||-1!=t[o.name].indexOf(e)},remoteSearch:!1,remoteMethod:function(e,t){t([])},direction:"auto",style:{},height:"200px",autoRow:!1,paging:!1,pageSize:10,pageEmptyShow:!0,radio:!1,repeat:!1,clickClose:!1,max:0,maxMethod:function(e,t){},showCount:0,toolbar:{show:!1,showIcon:!0,list:["ALL","CLEAR"]},tree:{show:!1,showFolderIcon:!0,showLine:!0,indent:20,expandedKeys:[]},prop:{name:"name",value:"value",selected:"selected",disabled:"disabled",children:"children",optgroup:"optgroup",click:"click"},theme:{color:"#009688",maxColor:"#e54d42"},model:{label:{type:"block",text:{left:"",right:"",separator:", "},block:{showCount:0,showIcon:!0},count:{template:function(e,t){return"已选中 ".concat(t.length," 项, 共 ").concat(e.length," 项")}}},icon:"show"},show:function(){},hide:function(){},template:function(e){e.item,e.sels;var t=e.name;return e.value,t},on:function(e){e.arr,e.item,e.selected}}}(e.language),this.update(e)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!!e.data;this.options=c(this.options,e);var n=i(this.options.el);if(n){var o=this.options.data||[];if("function"==typeof o&&(o=o(),this.options.data=o),a(o))return F(_(_e,Ce({},this.options,{updateData:t})),n),this;l("data数据必须为数组类型, 不能是".concat("undefined"==typeof data?"undefined":Se(data),"类型"))}else l("没有找到渲染对象: ".concat(e.el,", 请检查"))}},{key:"reset",value:function(){var e=this.options.el;return this.init(Re[e]),Pe[e].init(this.options,!0),this}},{key:"opened",value:function(){var e=Pe[this.options.el];return!e.state.show&&e.onClick(),this}},{key:"closed",value:function(){var e=Pe[this.options.el];return e.state.show&&e.onClick(),this}},{key:"getValue",value:function(e){var t=this,n=c([],Pe[this.options.el].state.sels);return"name"===e?n.map((function(e){return e[t.options.prop.name]})):"nameStr"===e?n.map((function(e){return e[t.options.prop.name]})).join(","):"value"===e?n.map((function(e){return e[t.options.prop.value]})):"valueStr"===e?n.map((function(e){return e[t.options.prop.value]})).join(","):n}},{key:"setValue",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(a(e))return Pe[this.options.el].value(e,t,n),this;l("请传入数组结构...")}},{key:"append",value:function(e){if(a(e))return Pe[this.options.el].append(e),this;l("请传入数组结构...")}},{key:"delete",value:function(e){if(a(e))return Pe[this.options.el].del(e),this;l("请传入数组结构...")}},{key:"warning",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e||this.options.theme.maxColor;return!0===t?Pe[this.options.el].base.style.borderColor=n:Pe[this.options.el].updateBorderColor(n),this}}])&&je(t.prototype,n),o&&je(t,o),e}();function Oe(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);tphp($script, $bin, ['--task' => 'vod_event', '--action' => 'main']) + ->at('*/5 * * * *'); + +$scheduler->php($script, $bin, ['--task' => 'close_trade', '--action' => 'main']) + ->at('*/15 * * * *'); + +$scheduler->php($script, $bin, ['--task' => 'close_order', '--action' => 'main']) + ->at('* */6 * * *'); + +$scheduler->php($script, $bin, ['--task' => 'learning', '--action' => 'main']) + ->at('*/10 * * * *'); + +$scheduler->php($script, $bin, ['--task' => 'refund', '--action' => 'main']) + ->hourly(15); + +$scheduler->php($script, $bin, ['--task' => 'clean_log', '--action' => 'main']) + ->daily(3, 10); + +$scheduler->php($script, $bin, ['--task' => 'course_count', '--action' => 'main']) + ->daily(3, 20); + +$scheduler->php($script, $bin, ['--task' => 'unlock_user', '--action' => 'main']) + ->daily(3, 30); + +$scheduler->run(); \ No newline at end of file diff --git a/storage/cache/annotations/.gitignore b/storage/cache/annotations/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/storage/cache/annotations/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/storage/cache/metadata/.gitignore b/storage/cache/metadata/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/storage/cache/metadata/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/storage/cache/volt/.gitignore b/storage/cache/volt/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/storage/cache/volt/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/storage/log/.gitignore b/storage/log/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/storage/log/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/storage/tmp/.gitignore b/storage/tmp/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/storage/tmp/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/websocket/Events.php b/websocket/Events.php new file mode 100644 index 00000000..e6ad77cd --- /dev/null +++ b/websocket/Events.php @@ -0,0 +1,87 @@ + + * @copyright walkor + * @link http://www.workerman.net/ + * @license http://www.opensource.org/licenses/mit-license.php MIT License + */ + +/** + * 用于检测业务代码死循环或者长时间阻塞等问题 + * 如果发现业务卡死,可以将下面declare打开(去掉//注释),并执行php start.php reload + * 然后观察一段时间workerman.log看是否有process_timeout异常 + */ + +//declare(ticks=1); + +use GatewayWorker\Lib\Gateway; + +/** + * 主逻辑 + * 主要是处理 onConnect onMessage onClose 三个方法 + * onConnect 和 onClose 如果不需要可以不用实现并删除 + */ +class Events +{ + /** + * 当客户端连接时触发 + * 如果业务不需此回调可以删除onConnect + * @param int $clientId 连接id + * @throws Exception + */ + public static function onConnect($clientId) + { + $message = json_encode([ + 'type' => 'welcome', + 'message' => 'just enjoy it', + ]); + + Gateway::sendToClient($clientId, $message); + } + + /** + * 当客户端发来消息时触发 + * @param int $clientId 连接id + * @param mixed $message 具体消息 + * @throws Exception + */ + public static function onMessage($clientId, $message) + { + $content = json_decode($message, true); + + if (!isset($content['type'])) return; + + if ($content['type'] == 'join_group') { + + $_SESSION['group'] = $content['group']; + + Gateway::joinGroup($clientId, $content['group']); + + } elseif ($content['type'] == 'send_danmaku') { + + $message = [ + 'type' => 'show_danmaku', + 'danmaku' => $content['danmaku'], + ]; + + Gateway::sendToGroup($_SESSION['group'], json_encode($message), [$clientId]); + } + } + + /** + * 当用户断开连接时触发 + * @param int $clientId 连接id + * @throws Exception + */ + public static function onClose($clientId) + { + + } + +} diff --git a/websocket/start.php b/websocket/start.php new file mode 100644 index 00000000..0be3596f --- /dev/null +++ b/websocket/start.php @@ -0,0 +1,37 @@ + + * @copyright walkor + * @link http://www.workerman.net/ + * @license http://www.opensource.org/licenses/mit-license.php MIT License + */ + +use \GatewayWorker\BusinessWorker; +use \Workerman\Worker; + +// 自动加载类 +require_once dirname(__DIR__) . '/vendor/autoload.php'; + +// businessWorker 进程 +$worker = new BusinessWorker(); + +// worker名称 +$worker->name = 'DanmakuBusinessWorker'; + +// businessWorker进程数量 +$worker->count = 4; + +// 服务注册地址 +$worker->registerAddress = '127.0.0.1:1238'; + +// 如果不是在根目录启动,则运行runAll方法 +if (!defined('GLOBAL_START')) { + Worker::runAll(); +} + diff --git a/websocket/start_gateway.php b/websocket/start_gateway.php new file mode 100644 index 00000000..aaa59b75 --- /dev/null +++ b/websocket/start_gateway.php @@ -0,0 +1,70 @@ + + * @copyright walkor + * @link http://www.workerman.net/ + * @license http://www.opensource.org/licenses/mit-license.php MIT License + */ + +use \GatewayWorker\Gateway; +use \Workerman\Worker; + +// 自动加载类 +require_once dirname(__DIR__) . '/vendor/autoload.php'; + +// gateway 进程,这里使用Text协议,可以用telnet测试 +$gateway = new Gateway("websocket://0.0.0.0:8282"); + +// gateway名称,status方便查看 +$gateway->name = 'DanmakuGateway'; + +// gateway进程数 +$gateway->count = 4; + +// 本机ip,分布式部署时使用内网ip +$gateway->lanIp = '127.0.0.1'; + +// 内部通讯起始端口,假如$gateway->count=4,起始端口为4000 +// 则一般会使用4000 4001 4002 4003 4个端口作为内部通讯端口 +$gateway->startPort = 2900; + +// 服务注册地址 +$gateway->registerAddress = '127.0.0.1:1238'; + +// 心跳间隔 +$gateway->pingInterval = 55; + +$gateway->pingNotResponseLimit = 1; + +// 心跳数据 +$gateway->pingData = '{"type":"ping"}'; + +/* +// 当客户端连接上来时,设置连接的onWebSocketConnect,即在websocket握手时的回调 +$gateway->onConnect = function($connection) +{ + $connection->onWebSocketConnect = function($connection , $http_header) + { + // 可以在这里判断连接来源是否合法,不合法就关掉连接 + // $_SERVER['HTTP_ORIGIN']标识来自哪个站点的页面发起的websocket链接 + if($_SERVER['HTTP_ORIGIN'] != 'http://kedou.workerman.net') + { + $connection->close(); + } + // onWebSocketConnect 里面$_GET $_SERVER是可用的 + // var_dump($_GET, $_SERVER); + }; +}; +*/ + +// 如果不是在根目录启动,则运行runAll方法 +if (!defined('GLOBAL_START')) { + Worker::runAll(); +} diff --git a/websocket/start_register.php b/websocket/start_register.php new file mode 100644 index 00000000..c477d4d1 --- /dev/null +++ b/websocket/start_register.php @@ -0,0 +1,29 @@ + + * @copyright walkor + * @link http://www.workerman.net/ + * @license http://www.opensource.org/licenses/mit-license.php MIT License + */ + +use \GatewayWorker\Register; +use \Workerman\Worker; + +// 自动加载类 +require_once dirname(__DIR__) . '/vendor/autoload.php'; + +// register 必须是text协议 +$register = new Register('text://0.0.0.0:1238'); + +// 如果不是在根目录启动,则运行runAll方法 +if (!defined('GLOBAL_START')) { + Worker::runAll(); +} +