diff --git a/data/picture/2d0553b0-6333-44bd-adae-90e4546a0660 b/data/picture/2d0553b0-6333-44bd-adae-90e4546a0660
new file mode 100644
index 0000000..4b0e3c3
Binary files /dev/null and b/data/picture/2d0553b0-6333-44bd-adae-90e4546a0660 differ
diff --git a/pom.xml b/pom.xml
index e74163a..8cc0169 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,10 +61,6 @@
org.jetbrains.kotlin
kotlin-stdlib
-
- com.fasterxml.jackson.core
- jackson-databind
-
com.fasterxml.jackson.module
jackson-module-kotlin
diff --git a/src/main/kotlin/team8/fruitable/controller/action/Account.kt b/src/main/kotlin/team8/fruitable/controller/action/Account.kt
index ca1503b..7e495e5 100644
--- a/src/main/kotlin/team8/fruitable/controller/action/Account.kt
+++ b/src/main/kotlin/team8/fruitable/controller/action/Account.kt
@@ -32,7 +32,8 @@ class Account(private val repository: AccountRepository) {
attributes: RedirectAttributes,
@CookieValue("TOKEN", required = false) token: String?,
@RequestParam("name") name: String,
- @RequestParam("password") password: String
+ @RequestParam("password") password: String,
+ @RequestParam("redirect", required = false) redirect: String?
): String {
if (this.getCurrentUser(token) != null) return error(attributes, "登录", "当前已登录账户")
val user = repository.findByName(name) ?: return error(attributes, "登录", "账户不存在", "/login")
@@ -41,6 +42,7 @@ class Account(private val repository: AccountRepository) {
user.updateLoginTime()
repository.save(user)
updateToken(response, user.token)
+ redirect?.let { return "redirect:/${it}" }
return "redirect:/"
}
@@ -51,15 +53,21 @@ class Account(private val repository: AccountRepository) {
@CookieValue("TOKEN", required = false) token: String?,
@RequestParam("name") name: String,
@RequestParam("password") password: String,
+ @RequestParam("password_confirm") passwordConfirm: String,
@RequestParam("age", required = false) age: Int?,
@RequestParam("gender", required = false) gender: String?,
@RequestParam("phone", required = false) phone: String?,
@RequestParam("email", required = false) email: String?,
- @RequestParam("address", required = false) address: String?
+ @RequestParam("address", required = false) address: String?,
+ @RequestParam("redirect", required = false) redirect: String?
): String {
if (this.getCurrentUser(token) != null) return error(attributes, "注册", "当前已登录账户")
- val user = repository.save(User(name, password, age, gender, phone, email, address))
+ if (name.isBlank()) return error(attributes, "注册", "用户名不能为空", "/register")
+ if (password.isBlank()) return error(attributes, "注册", "密码不能为空", "/register")
+ if (password != passwordConfirm) return error(attributes, "更新", "密码与确认密码不相同", "/register")
+ val user = repository.save(User(name, password, age, gender, phone, email, address, false))
updateToken(response, user.token)
+ redirect?.let { return "redirect:/${it}" }
return "redirect:/"
}
@@ -85,6 +93,7 @@ class Account(private val repository: AccountRepository) {
user.update(name, password, age, gender, phone, email, address)
repository.save(user)
updateToken(response, user.token)
+ redirect?.let { return "redirect:/${it}" }
return "redirect:/account"
}
@@ -94,7 +103,7 @@ class Account(private val repository: AccountRepository) {
@RequestParam("redirect", required = false) redirect: String?
): String {
updateToken(response, "", age = 0)
- redirect?.let { return it }
+ redirect?.let { return "redirect:/${it}" }
return "redirect:/"
}
}
diff --git a/src/main/kotlin/team8/fruitable/controller/action/ItemEditor.kt b/src/main/kotlin/team8/fruitable/controller/action/ItemEditor.kt
index ba86270..b498b78 100644
--- a/src/main/kotlin/team8/fruitable/controller/action/ItemEditor.kt
+++ b/src/main/kotlin/team8/fruitable/controller/action/ItemEditor.kt
@@ -1,9 +1,120 @@
package team8.fruitable.controller.action
+import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Controller
-import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.*
+import org.springframework.web.multipart.MultipartFile
+import org.springframework.web.servlet.mvc.support.RedirectAttributes
+import team8.fruitable.controller.util.Util.Companion.error
+import team8.fruitable.datebase.entity.Item
+import team8.fruitable.datebase.entity.Tag
+import team8.fruitable.datebase.entity.User
+import team8.fruitable.datebase.repository.AccountRepository
+import team8.fruitable.datebase.repository.ItemRepository
+import team8.fruitable.datebase.repository.TagRepository
+import java.io.File
+import java.util.*
@Controller
@RequestMapping("/action/edit/item")
-class ItemEditor {
+class ItemEditor(
+ private val accountRepository: AccountRepository,
+ private val itemRepository: ItemRepository,
+ private val tagRepository: TagRepository
+) {
+ @Value("\${data.picture}")
+ lateinit var pictureUploadPath: String
+
+ private fun getCurrentUser(token: String?): User? {
+ return token?.let(accountRepository::findByToken)
+ }
+
+ private fun hasAdminPermissions(user: User?): Boolean {
+ return user?.isAdmin ?: false
+ }
+
+ private fun hasAdminPermissions(token: String?): Boolean {
+ return this.hasAdminPermissions(this.getCurrentUser(token))
+ }
+
+ private fun autoCreateTag(tags: List): MutableList {
+ val result: MutableList = mutableListOf()
+ for (i in tags) {
+ val oldTag = tagRepository.findByName(i);
+ if (oldTag != null) {
+ result.add(oldTag)
+ } else {
+ val newTag = Tag(i)
+ tagRepository.save(newTag)
+ result.add(newTag)
+ }
+ }
+ return result
+ }
+
+ private fun autoCreateTag(tags: String): MutableList {
+ return this.autoCreateTag(tags.split(" "))
+ }
+
+ private fun uploadPicture(file: MultipartFile): String {
+ val uuid = UUID.randomUUID().toString()
+ file.transferTo(File("${pictureUploadPath}${File.separator}${uuid}"))
+ return uuid
+ }
+
+ @PostMapping("/create")
+ fun create(
+ attributes: RedirectAttributes,
+ @CookieValue("TOKEN", required = false) token: String?,
+ @RequestParam("name") name: String,
+ @RequestParam("price") price: Double,
+ @RequestParam("description", required = false) description: String?,
+ @RequestParam("picture") picture: MultipartFile,
+ @RequestParam("tag", required = false) tag: String?,
+ @RequestParam("redirect", required = false) redirect: String?
+ ): String {
+ if (!this.hasAdminPermissions(token)) return error(attributes, "创建商品", "账户无权限")
+ if (name.isBlank()) return error(attributes, "更新商品", "商品名不能为空")
+ if (price == 0.0) return error(attributes, "更新商品", "商品价格不能为0")
+ itemRepository.save(Item(name, price, description, uploadPicture(picture), tag?.let { this.autoCreateTag(it) }))
+ redirect?.let { return "redirect:/${it}" }
+ return "redirect:/editor?use=item"
+ }
+
+ @PostMapping("/update/{id}")
+ fun update(
+ attributes: RedirectAttributes,
+ @CookieValue("TOKEN", required = false) token: String?,
+ @PathVariable("id") id: Long,
+ @RequestParam("name") name: String,
+ @RequestParam("price") price: Double,
+ @RequestParam("description", required = false) description: String?,
+ @RequestParam("picture", required = false) picture: MultipartFile?,
+ @RequestParam("tag", required = false) tag: String?,
+ @RequestParam("redirect", required = false) redirect: String?
+ ): String {
+ if (!this.hasAdminPermissions(token)) return error(attributes, "更新商品", "账户无权限")
+ if (name.isBlank()) return error(attributes, "更新商品", "商品名不能为空")
+ if (price == 0.0) return error(attributes, "更新商品", "商品价格不能为0")
+ val item = itemRepository.findById(id).orElse(null) ?: return error(attributes, "更新商品", "未找到目标商品")
+ item.update(name, price, description, picture?.let { uploadPicture(it) }, tag?.let { this.autoCreateTag(it) })
+ itemRepository.save(item)
+ redirect?.let { return "redirect:/${it}" }
+ return "redirect:/editor?use=item"
+ }
+
+ @PostMapping("/delete/{id}")
+ fun delete(
+ attributes: RedirectAttributes,
+ @CookieValue("TOKEN", required = false) token: String?,
+ @PathVariable("id") id: Long,
+ @RequestParam("redirect", required = false) redirect: String?
+ ): String {
+ if (!this.hasAdminPermissions(token)) return error(attributes, "删除商品", "账户无权限")
+ val item = itemRepository.findById(id).orElse(null) ?: return error(attributes, "删除商品", "未找到目标商品")
+ item.update(isRemoved = true)
+ itemRepository.save(item)
+ redirect?.let { return "redirect:/${it}" }
+ return "redirect:/editor?use=item"
+ }
}
diff --git a/src/main/kotlin/team8/fruitable/controller/action/UserEditor.kt b/src/main/kotlin/team8/fruitable/controller/action/UserEditor.kt
index f78265e..670fb9b 100644
--- a/src/main/kotlin/team8/fruitable/controller/action/UserEditor.kt
+++ b/src/main/kotlin/team8/fruitable/controller/action/UserEditor.kt
@@ -1,9 +1,94 @@
package team8.fruitable.controller.action
+import jakarta.servlet.http.Cookie
+import jakarta.servlet.http.HttpServletResponse
import org.springframework.stereotype.Controller
-import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.*
+import org.springframework.web.servlet.mvc.support.RedirectAttributes
+import team8.fruitable.controller.util.Util.Companion.error
+import team8.fruitable.datebase.entity.User
+import team8.fruitable.datebase.repository.AccountRepository
@Controller
@RequestMapping("/action/edit/user")
-class UserEditor {
+class UserEditor(private val accountRepository: AccountRepository) {
+ private fun getCurrentUser(token: String?): User? {
+ return token?.let(accountRepository::findByToken)
+ }
+
+ private fun hasAdminPermissions(user: User?): Boolean {
+ return user?.isAdmin ?: false
+ }
+
+ private fun hasAdminPermissions(token: String?): Boolean {
+ return this.hasAdminPermissions(this.getCurrentUser(token))
+ }
+
+ @PostMapping("/create")
+ fun create(
+ attributes: RedirectAttributes,
+ @CookieValue("TOKEN", required = false) token: String?,
+ @RequestParam("name") name: String,
+ @RequestParam("password") password: String,
+ @RequestParam("age", required = false) age: Int?,
+ @RequestParam("gender", required = false) gender: String?,
+ @RequestParam("phone", required = false) phone: String?,
+ @RequestParam("email", required = false) email: String?,
+ @RequestParam("address", required = false) address: String?,
+ @RequestParam("is_admin", required = false) isAdmin: Boolean?,
+ @RequestParam("redirect", required = false) redirect: String?
+ ): String {
+ if (!this.hasAdminPermissions(token)) return error(attributes, "创建用户", "账户无权限")
+ if (name.isBlank()) return error(attributes, "创建用户", "用户名不能为空", "/editor?use=user")
+ if (password.isBlank()) return error(attributes, "创建用户", "密码不能为空", "/editor?use=user")
+ accountRepository.save(User(name, password, age, gender, phone, email, address, isAdmin))
+ redirect?.let { return "redirect:/${it}" }
+ return "redirect:/editor?use=user"
+ }
+
+ @PostMapping("/update/{id}")
+ fun update(
+ response: HttpServletResponse,
+ attributes: RedirectAttributes,
+ @CookieValue("TOKEN", required = false) token: String?,
+ @PathVariable("id") id: Long,
+ @RequestParam("name") name: String,
+ @RequestParam("password") password: String,
+ @RequestParam("age", required = false) age: Int?,
+ @RequestParam("gender", required = false) gender: String?,
+ @RequestParam("phone", required = false) phone: String?,
+ @RequestParam("email", required = false) email: String?,
+ @RequestParam("address", required = false) address: String?,
+ @RequestParam("is_admin", required = false) isAdmin: Boolean?,
+ @RequestParam("redirect", required = false) redirect: String?
+ ): String {
+ val currentUser = this.getCurrentUser(token) ?: return error(attributes, "更新用户", "账户未登录")
+ if (!this.hasAdminPermissions(currentUser)) return error(attributes, "更新用户", "账户无权限")
+ val user = accountRepository.findById(id).orElse(null) ?: return error(attributes, "更新用户", "未找到此用户", "/editor?use=user")
+ user.update(name, password, age, gender, phone, email, address, isAdmin)
+ if (currentUser.id == id) {
+ val cookie = Cookie("TOKEN", user.token)
+ cookie.path = "/"
+ cookie.maxAge = 2678400
+ response.addCookie(cookie)
+ }
+ redirect?.let { return "redirect:/${it}" }
+ return "redirect:/editor?use=user"
+ }
+
+ @PostMapping("/delete/{id}")
+ fun delete(
+ attributes: RedirectAttributes,
+ @CookieValue("TOKEN", required = false) token: String?,
+ @PathVariable("id") id: Long,
+ @RequestParam("redirect", required = false) redirect: String?
+ ): String {
+ val currentUser = this.getCurrentUser(token) ?: return error(attributes, "删除用户", "账户未登录")
+ if (!this.hasAdminPermissions(currentUser)) return error(attributes, "删除用户", "账户无权限")
+ if (currentUser.id == id) return error(attributes, "删除用户", "无法删除当前使用的账户", "/editor?use=user")
+ val user = accountRepository.findById(id).orElse(null) ?: return error(attributes, "删除用户", "未找到此用户", "/editor?use=user")
+ accountRepository.delete(user)
+ redirect?.let { return "redirect:/${it}" }
+ return "redirect:/editor?use=user"
+ }
}
diff --git a/src/main/kotlin/team8/fruitable/controller/page/Editor.kt b/src/main/kotlin/team8/fruitable/controller/page/Editor.kt
index 6100525..2dd5c10 100644
--- a/src/main/kotlin/team8/fruitable/controller/page/Editor.kt
+++ b/src/main/kotlin/team8/fruitable/controller/page/Editor.kt
@@ -11,13 +11,17 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes
import team8.fruitable.controller.util.Util
import team8.fruitable.datebase.entity.User
import team8.fruitable.datebase.repository.AccountRepository
+import team8.fruitable.datebase.repository.ItemRepository
import team8.fruitable.datebase.repository.PagebleAccountRepository
+import team8.fruitable.datebase.repository.PagebleItemRepository
@Controller
class Editor(
private val accountRepository: AccountRepository,
- private val pagebleAccountRepository: PagebleAccountRepository
+ private val itemRepository: ItemRepository,
+ private val pagebleAccountRepository: PagebleAccountRepository,
+ private val pagebleItemRepository: PagebleItemRepository
) {
private fun getCurrentUser(token: String?): User? {
return token?.let(accountRepository::findByToken)
@@ -40,8 +44,8 @@ class Editor(
"ALL" to "全部",
"ID" to "ID",
"NAME" to "名称",
- "CREATE_DATE" to "注册时间",
- "LAST_LOGIN_DATE" to "最后登录时间",
+ "TIME_CREATE" to "注册时间",
+ "TIME_LOGIN" to "最后登录时间",
"AGE" to "年龄",
"GENDER" to "性别",
"PHONE" to "手机号码",
@@ -64,14 +68,31 @@ class Editor(
attributes: RedirectAttributes,
@CookieValue("TOKEN", required = false) token: String?,
@RequestParam("use", defaultValue = "user") use: String,
+ @RequestParam("action", defaultValue = "nothing") action: String,
+ @RequestParam("target", required = false) target: Long?,
@RequestParam("search_type", required = false) searchType: String?,
@RequestParam("search_content", required = false) searchContent: String?,
@RequestParam("page", required = false) page: Int?,
): String {
val user = this.getCurrentUser(token) ?: return Util.error(attributes, "更新", "账户未登录", "/login")
if (!this.hasAdminPermissions(user)) return Util.error(attributes, "编辑", "账户无权限编辑网站")
+ model["using"] = use
model["tabs"] = editorTabs
if (searchContent != null) model["searching"] = searchContent
+ val pageRequested = PageRequest.of(page ?: 0, 15)
+ val data = when (use) {
+ "item" -> pagebleItemRepository.findAll(pageRequested)
+ else -> pagebleAccountRepository.findAll(pageRequested)
+ }
+ model["data"] = data
+ model["pages"] = (page ?: 0).let {
+ var result: Array> = emptyArray()
+ for (i in (it - 5)..(it + 5)) {
+ if (i < 0 || i >= data.totalPages) continue
+ result += (i == it) to i
+ }
+ result
+ }
when (use) {
"item" -> {
model["useItemEditor"] = true
@@ -81,9 +102,37 @@ class Editor(
else -> {
model["useUserEditor"] = true
model["selects"] = editorSearchTypesForUser
- model["data"] = pagebleAccountRepository.findAll(PageRequest.of(page ?: 0, 10))
+ }
+ }
+ when (action) {
+ "creating" -> model["isCreating"] = true
+ "updating" -> model["isUpdating"] = true
+ "deleting" -> model["isDeleting"] = true
+ else -> model["isNothing"] = true
+ }
+ if (action == "updating" || action == "deleting") {
+ model["target"] = when (use) {
+ "item" -> {
+ target?.let {
+ itemRepository.findById(it)
+ .orElse(null) ?: return Util.error(attributes, "编辑", "无法找到目标商品")
+ } ?: return Util.error(attributes, "编辑", "目标商品为空")
+ }
+
+ else -> {
+ val targetUser = target?.let {
+ accountRepository.findById(it)
+ .orElse(null) ?: return Util.error(attributes, "编辑", "无法找到目标用户")
+ } ?: return Util.error(attributes, "编辑", "目标用户为空")
+ if (action == "updating") when (targetUser.gender) {
+ "M" -> model["isGenderAsMale"] = true
+ "F" -> model["isGenderAsFemale"] = true
+ else -> model["isGenderAsUnknown"] = true
+ }
+ targetUser
+ }
}
}
return "editor"
}
-}
\ No newline at end of file
+}
diff --git a/src/main/kotlin/team8/fruitable/controller/page/Pages.kt b/src/main/kotlin/team8/fruitable/controller/page/Pages.kt
index ae41598..500f33e 100644
--- a/src/main/kotlin/team8/fruitable/controller/page/Pages.kt
+++ b/src/main/kotlin/team8/fruitable/controller/page/Pages.kt
@@ -5,7 +5,6 @@ import org.springframework.ui.Model
import org.springframework.ui.set
import org.springframework.web.bind.annotation.CookieValue
import org.springframework.web.bind.annotation.RequestMapping
-import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.servlet.mvc.support.RedirectAttributes
import team8.fruitable.controller.util.Util.Companion.error
import team8.fruitable.datebase.entity.User
diff --git a/src/main/kotlin/team8/fruitable/datebase/entity/Item.kt b/src/main/kotlin/team8/fruitable/datebase/entity/Item.kt
index 03ea6fb..9d4a078 100644
--- a/src/main/kotlin/team8/fruitable/datebase/entity/Item.kt
+++ b/src/main/kotlin/team8/fruitable/datebase/entity/Item.kt
@@ -1,6 +1,7 @@
package team8.fruitable.datebase.entity
import jakarta.persistence.*
+import java.time.LocalDateTime
@Entity
@Table(name = "items")
@@ -10,15 +11,27 @@ class Item(
@Column(name = "id", nullable = false)
var id: Long? = null,
- @Column(name= "name", length = 32, nullable = false)
+ @Column(name = "name", length = 32, nullable = false)
var name: String? = null,
- @Column(name="price", nullable = false)
+ @Column(name = "price", nullable = false)
var price: Double? = null,
- @Column(name="description", length=320, nullable = true)
+ @Column(name = "time_create", nullable = false)
+ var createTime: LocalDateTime = LocalDateTime.now(),
+
+ @Column(name = "time_edit", nullable = false)
+ var editTime: LocalDateTime = LocalDateTime.now(),
+
+ @Column(name = "description", length = 320, nullable = true)
var description: String? = null,
+ @Column(name = "picture", length = 36, nullable = true)
+ var picture: String? = null,
+
+ @Column(name = "is_removed", nullable = false)
+ var isRemoved: Boolean? = false,
+
@ManyToOne
@JoinColumn(name = "carts")
var carted: User? = null,
@@ -28,8 +41,48 @@ class Item(
var ordered: Order? = null,
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.LAZY, mappedBy = "tagedItem")
- var tags: MutableList = mutableListOf(),
+ var tags: MutableList = mutableListOf(),
@OneToOne(mappedBy = "item")
var recommend: Recommend? = null,
-)
+) {
+ constructor(name: String, price: Double) : this() {
+ this.name = name
+ this.price = price
+ }
+
+ constructor(
+ name: String,
+ price: Double,
+ description: String? = null,
+ picture: String? = null,
+ tags: MutableList? = null,
+ isRemoved: Boolean? = null
+ ) : this(name, price) {
+ if (!description.isNullOrBlank()) this.description = description
+ if (!picture.isNullOrBlank()) this.picture = picture
+ tags?.let { this.tags.addAll(it) }
+ isRemoved?.let { this.isRemoved = it }
+ }
+
+ fun update(
+ name: String? = null,
+ price: Double? = null,
+ description: String? = null,
+ picture: String? = null,
+ tags: MutableList? = null,
+ isRemoved: Boolean? = null
+ ) {
+ if (!name.isNullOrBlank()) this.name = name
+ this.price = price?.let { if (it <= 0) null else it }
+ if (!description.isNullOrBlank()) this.description = description
+ if (!picture.isNullOrBlank()) this.picture = picture
+ tags?.let { this.tags.addAll(it) }
+ isRemoved?.let { this.isRemoved = it }
+ this.updateEditTime()
+ }
+
+ fun updateEditTime() {
+ this.editTime = LocalDateTime.now()
+ }
+}
diff --git a/src/main/kotlin/team8/fruitable/datebase/entity/Recommend.kt b/src/main/kotlin/team8/fruitable/datebase/entity/Recommend.kt
index 4a3a12e..880402f 100644
--- a/src/main/kotlin/team8/fruitable/datebase/entity/Recommend.kt
+++ b/src/main/kotlin/team8/fruitable/datebase/entity/Recommend.kt
@@ -16,4 +16,4 @@ class Recommend (
@Column(name="description", length=32, nullable = false)
var description: String? = null,
-)
\ No newline at end of file
+)
diff --git a/src/main/kotlin/team8/fruitable/datebase/entity/Tag.kt b/src/main/kotlin/team8/fruitable/datebase/entity/Tag.kt
index 95eaff9..f0c7070 100644
--- a/src/main/kotlin/team8/fruitable/datebase/entity/Tag.kt
+++ b/src/main/kotlin/team8/fruitable/datebase/entity/Tag.kt
@@ -16,4 +16,8 @@ class Tag(
@ManyToOne
@JoinColumn(name = "taged")
var tagedItem: Item? = null
-)
+) {
+ constructor(name: String) : this() {
+ this.name = name
+ }
+}
diff --git a/src/main/kotlin/team8/fruitable/datebase/entity/User.kt b/src/main/kotlin/team8/fruitable/datebase/entity/User.kt
index c8cbf75..763ed14 100644
--- a/src/main/kotlin/team8/fruitable/datebase/entity/User.kt
+++ b/src/main/kotlin/team8/fruitable/datebase/entity/User.kt
@@ -1,6 +1,5 @@
package team8.fruitable.datebase.entity
-import com.fasterxml.jackson.annotation.JsonView
import jakarta.persistence.*
import team8.fruitable.util.Util
import java.time.LocalDateTime
@@ -12,65 +11,47 @@ class User(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
- @JsonView(UserView::class)
var id: Long? = null,
@Column(name = "name", length = 16, nullable = false)
- @JsonView(GuestView::class)
var name: String? = null,
@Column(name = "password", length = 64, nullable = false)
- @JsonView(AdminView::class)
var password: String? = null,
@Column(name = "time_create", nullable = false)
- @JsonView(UserView::class)
var createTime: LocalDateTime = LocalDateTime.now(),
@Column(name = "time_login", nullable = false)
- @JsonView(UserView::class)
var loginTime: LocalDateTime = LocalDateTime.now(),
@Column(name = "token", length = 36)
- @JsonView(AdminView::class)
var token: String = UUID.randomUUID().toString(),
@Column(name = "age")
- @JsonView(GuestView::class)
var age: Int? = null,
@Column(name = "gender", length = 1)
- @JsonView(GuestView::class)
var gender: String? = null,
@Column(name = "phone", length = 11)
- @JsonView(UserView::class)
var phone: String? = null,
@Column(name = "email", length = 64)
- @JsonView(GuestView::class)
var email: String? = null,
@Column(name = "address", length = 64)
- @JsonView(UserView::class)
var address: String? = null,
@Column(name = "is_admin", nullable = false)
- @JsonView(AdminView::class)
var isAdmin: Boolean = false,
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.LAZY, mappedBy = "carted")
- @JsonView(UserView::class)
var carts: MutableList- = mutableListOf(),
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.LAZY, mappedBy = "user")
- @JsonView(UserView::class)
var orders: MutableList = mutableListOf()
) {
- interface GuestView
- interface UserView : GuestView
- interface AdminView : UserView
-
constructor(name: String, password: String) : this() {
this.name = name
this.password = this.genPassword(password)
@@ -83,13 +64,15 @@ class User(
gender: String?,
phone: String?,
email: String?,
- address: String?
+ address: String?,
+ isAdmin: Boolean?
) : this(name, password) {
- this.age = age
- this.gender = gender
- this.phone = phone
- this.email = email
- this.address = address
+ this.age = age?.let { if (it <= 0) null else it }
+ if (!gender.isNullOrBlank()) this.gender = gender
+ if (!phone.isNullOrBlank()) this.phone = phone
+ if (!email.isNullOrBlank()) this.email = email
+ if (!address.isNullOrBlank()) this.address = address
+ isAdmin?.let { this.isAdmin = it }
}
private final fun genPassword(password: String): String {
@@ -108,11 +91,11 @@ class User(
) {
if (!name.isNullOrBlank()) this.name = name
if (!password.isNullOrBlank()) this.updatePassword(password)
- this.age = age
+ this.age = age?.let { if (it <= 0) null else it }
if (!gender.isNullOrBlank()) this.gender = gender
- this.phone = phone
- this.email = email
- this.address = address
+ if (!phone.isNullOrBlank()) this.phone = phone
+ if (!email.isNullOrBlank()) this.email = email
+ if (!address.isNullOrBlank()) this.address = address
isAdmin?.let { this.isAdmin = it }
this.updateToken()
}
diff --git a/src/main/kotlin/team8/fruitable/datebase/repository/PagebleAccountRepository.kt b/src/main/kotlin/team8/fruitable/datebase/repository/PagebleAccountRepository.kt
index bf79361..17af7fb 100644
--- a/src/main/kotlin/team8/fruitable/datebase/repository/PagebleAccountRepository.kt
+++ b/src/main/kotlin/team8/fruitable/datebase/repository/PagebleAccountRepository.kt
@@ -1,6 +1,5 @@
package team8.fruitable.datebase.repository
-import org.springframework.data.repository.CrudRepository
import org.springframework.data.repository.PagingAndSortingRepository
import team8.fruitable.datebase.entity.User
diff --git a/src/main/kotlin/team8/fruitable/datebase/repository/PagebleItemRepository.kt b/src/main/kotlin/team8/fruitable/datebase/repository/PagebleItemRepository.kt
new file mode 100644
index 0000000..44af11e
--- /dev/null
+++ b/src/main/kotlin/team8/fruitable/datebase/repository/PagebleItemRepository.kt
@@ -0,0 +1,8 @@
+package team8.fruitable.datebase.repository
+
+import org.springframework.data.repository.PagingAndSortingRepository
+import team8.fruitable.datebase.entity.Item
+
+interface PagebleItemRepository : PagingAndSortingRepository
- {
+ fun findByName(name: String): Item?
+}
diff --git a/src/main/kotlin/team8/fruitable/datebase/repository/TagRepository.kt b/src/main/kotlin/team8/fruitable/datebase/repository/TagRepository.kt
new file mode 100644
index 0000000..ac74797
--- /dev/null
+++ b/src/main/kotlin/team8/fruitable/datebase/repository/TagRepository.kt
@@ -0,0 +1,8 @@
+package team8.fruitable.datebase.repository
+
+import org.springframework.data.repository.CrudRepository
+import team8.fruitable.datebase.entity.Tag
+
+interface TagRepository : CrudRepository {
+ fun findByName(name: String): Tag?
+}
diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml
index 2ceac68..5f80d39 100644
--- a/src/main/resources/application.yaml
+++ b/src/main/resources/application.yaml
@@ -1,3 +1,4 @@
+debug: true
spring:
datasource:
url: jdbc:mariadb://localhost:3306/fruitable
@@ -12,3 +13,5 @@ server:
encoding:
charset: UTF-8
force-response: true
+data:
+ picture: /home/puqns67/IdeaProjects/fruitable/data/picture
diff --git a/src/main/resources/static/scripts/edit.js b/src/main/resources/static/scripts/edit.js
deleted file mode 100644
index f110995..0000000
--- a/src/main/resources/static/scripts/edit.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * edit.js by Puqns_67
- */
-
-function getID(element) {
- return element.parentElement.parentElement.getAttribute("id");
-}
-
-window.addEventListener("DOMContentLoaded", () => {
- let displayer = document.getElementById("Displayer");
-
- Array.from(document.getElementsByClassName("update")).forEach((v) => {
- v.addEventListener("click", function () {
- displayer.src = `info.action?as=update.jsp&id=${getID(this)}`;
- });
- });
-
- Array.from(document.getElementsByClassName("remove")).forEach((v) => {
- v.addEventListener("click", function () {
- displayer.src = `info.action?as=remove.jsp&id=${getID(this)}`;
- });
- });
-});
diff --git a/src/main/resources/static/scripts/lib/less.min.js b/src/main/resources/static/scripts/lib/less.min.js
new file mode 100644
index 0000000..44a6df8
--- /dev/null
+++ b/src/main/resources/static/scripts/lib/less.min.js
@@ -0,0 +1,11 @@
+/**
+ * Less - Leaner CSS v4.2.0
+ * http://lesscss.org
+ *
+ * Copyright (c) 2009-2023, Alexis Sellier
+ * Licensed under the Apache-2.0 License.
+ *
+ * @license Apache-2.0
+ */
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).less=t()}(this,(function(){"use strict";function e(e){return e.replace(/^[a-z-]+:\/+?[^/]+/,"").replace(/[?&]livereload=\w+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^.\w-]+/g,"-").replace(/\./g,":")}function t(e,t){if(t)for(var i in t.dataset)if(Object.prototype.hasOwnProperty.call(t.dataset,i))if("env"===i||"dumpLineNumbers"===i||"rootpath"===i||"errorReporting"===i)e[i]=t.dataset[i];else try{e[i]=JSON.parse(t.dataset[i])}catch(e){}}var i=function(t,i,n){var r=n.href||"",s="less:"+(n.title||e(r)),o=t.getElementById(s),a=!1,l=t.createElement("style");l.setAttribute("type","text/css"),n.media&&l.setAttribute("media",n.media),l.id=s,l.styleSheet||(l.appendChild(t.createTextNode(i)),a=null!==o&&o.childNodes.length>0&&l.childNodes.length>0&&o.firstChild.nodeValue===l.firstChild.nodeValue);var u=t.getElementsByTagName("head")[0];if(null===o||!1===a){var c=n&&n.nextSibling||null;c?c.parentNode.insertBefore(l,c):u.appendChild(l)}if(o&&!1===a&&o.parentNode.removeChild(o),l.styleSheet)try{l.styleSheet.cssText=i}catch(e){throw new Error("Couldn't reassign styleSheet.cssText.")}},n=function(e){var t,i=e.document;return i.currentScript||(t=i.getElementsByTagName("script"))[t.length-1]},r={error:function(e){this._fireEvent("error",e)},warn:function(e){this._fireEvent("warn",e)},info:function(e){this._fireEvent("info",e)},debug:function(e){this._fireEvent("debug",e)},addListener:function(e){this._listeners.push(e)},removeListener:function(e){for(var t=0;t=0;a--){var l=o[a];if(l[s?"supportsSync":"supports"](e,t,i,n))return l}return null},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},e}(),o={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},a={length:{m:1,cm:.01,mm:.001,in:.0254,px:.0254/96,pt:.0254/72,pc:.0254/72*12},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:1/400,turn:1}},l={colors:o,unitConversions:a},u=function(){function e(){this.parent=null,this.visibilityBlocks=void 0,this.nodeVisible=void 0,this.rootNode=null,this.parsed=null}return Object.defineProperty(e.prototype,"currentFileInfo",{get:function(){return this.fileInfo()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.getIndex()},enumerable:!1,configurable:!0}),e.prototype.setParent=function(t,i){function n(t){t&&t instanceof e&&(t.parent=i)}Array.isArray(t)?t.forEach(n):n(t)},e.prototype.getIndex=function(){return this._index||this.parent&&this.parent.getIndex()||0},e.prototype.fileInfo=function(){return this._fileInfo||this.parent&&this.parent.fileInfo()||{}},e.prototype.isRulesetLike=function(){return!1},e.prototype.toCSS=function(e){var t=[];return this.genCSS(e,{add:function(e,i,n){t.push(e)},isEmpty:function(){return 0===t.length}}),t.join("")},e.prototype.genCSS=function(e,t){t.add(this.value)},e.prototype.accept=function(e){this.value=e.visit(this.value)},e.prototype.eval=function(){return this},e.prototype._operate=function(e,t,i,n){switch(t){case"+":return i+n;case"-":return i-n;case"*":return i*n;case"/":return i/n}},e.prototype.fround=function(e,t){var i=e&&e.numPrecision;return i?Number((t+2e-16).toFixed(i)):t},e.compare=function(t,i){if(t.compare&&"Quoted"!==i.type&&"Anonymous"!==i.type)return t.compare(i);if(i.compare)return-i.compare(t);if(t.type===i.type){if(t=t.value,i=i.value,!Array.isArray(t))return t===i?0:void 0;if(t.length===i.length){for(var n=0;nt?1:void 0},e.prototype.blocksVisibility=function(){return void 0===this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},e.prototype.addVisibilityBlock=function(){void 0===this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},e.prototype.removeVisibilityBlock=function(){void 0===this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},e.prototype.ensureVisibility=function(){this.nodeVisible=!0},e.prototype.ensureInvisibility=function(){this.nodeVisible=!1},e.prototype.isVisible=function(){return this.nodeVisible},e.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},e.prototype.copyVisibilityInfo=function(e){e&&(this.visibilityBlocks=e.visibilityBlocks,this.nodeVisible=e.nodeVisible)},e}(),c=function(e,t,i){var n=this;Array.isArray(e)?this.rgb=e:e.length>=6?(this.rgb=[],e.match(/.{2}/g).map((function(e,t){t<3?n.rgb.push(parseInt(e,16)):n.alpha=parseInt(e,16)/255}))):(this.rgb=[],e.split("").map((function(e,t){t<3?n.rgb.push(parseInt(e+e,16)):n.alpha=parseInt(e+e,16)/255}))),this.alpha=this.alpha||("number"==typeof t?t:1),void 0!==i&&(this.value=i)};function h(e,t){return Math.min(Math.max(e,0),t)}function f(e){return"#"+e.map((function(e){return((e=h(Math.round(e),255))<16?"0":"")+e.toString(16)})).join("")}c.prototype=Object.assign(new u,{type:"Color",luma:function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,i=this.rgb[2]/255;return.2126*(e=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(i=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))},genCSS:function(e,t){t.add(this.toCSS(e))},toCSS:function(e,t){var i,n,r,s=e&&e.compress&&!t,o=[];if(n=this.fround(e,this.alpha),this.value)if(0===this.value.indexOf("rgb"))n<1&&(r="rgba");else{if(0!==this.value.indexOf("hsl"))return this.value;r=n<1?"hsla":"hsl"}else n<1&&(r="rgba");switch(r){case"rgba":o=this.rgb.map((function(e){return h(Math.round(e),255)})).concat(h(n,1));break;case"hsla":o.push(h(n,1));case"hsl":i=this.toHSL(),o=[this.fround(e,i.h),this.fround(e,100*i.s)+"%",this.fround(e,100*i.l)+"%"].concat(o)}if(r)return r+"("+o.join(","+(s?"":" "))+")";if(i=this.toRGB(),s){var a=i.split("");a[1]===a[2]&&a[3]===a[4]&&a[5]===a[6]&&(i="#"+a[1]+a[3]+a[5])}return i},operate:function(e,t,i){for(var n=new Array(3),r=this.alpha*(1-i.alpha)+i.alpha,s=0;s<3;s++)n[s]=this._operate(e,t,this.rgb[s],i.rgb[s]);return new c(n,r)},toRGB:function(){return f(this.rgb)},toHSL:function(){var e,t,i=this.rgb[0]/255,n=this.rgb[1]/255,r=this.rgb[2]/255,s=this.alpha,o=Math.max(i,n,r),a=Math.min(i,n,r),l=(o+a)/2,u=o-a;if(o===a)e=t=0;else{switch(t=l>.5?u/(2-o-a):u/(o+a),o){case i:e=(n-r)/u+(n=0&&"\n"!==t.charAt(i);)r++;return"number"==typeof e&&(n=(t.slice(0,e).match(/\n/g)||"").length),{line:n,column:r}}function k(e){var t,i=e.length,n=new Array(i);for(t=0;t|Function):(\d+):(\d+)/,V=function(e,t,i){Error.call(this);var n=e.filename||i;if(this.message=e.message,this.stack=e.stack,t&&n){var r=t.contents[n],s=C(e.index,r),o=s.line,a=s.column,l=e.call&&C(e.call,r).line,u=r?r.split("\n"):"";if(this.type=e.type||"Syntax",this.filename=n,this.index=e.index,this.line="number"==typeof o?o+1:null,this.column=a,!this.line&&this.stack){var c=this.stack.match(O),h=new Function("a","throw new Error()"),f=0;try{h()}catch(e){var p=e.stack.match(O);f=1-parseInt(p[2])}c&&(c[2]&&(this.line=parseInt(c[2])+f),c[3]&&(this.column=parseInt(c[3])))}this.callLine=l+1,this.callExtract=u[l],this.extract=[u[this.line-2],u[this.line-1],u[this.line]]}};if(void 0===Object.create){var F=function(){};F.prototype=Error.prototype,V.prototype=new F}else V.prototype=Object.create(Error.prototype);V.prototype.constructor=V,V.prototype.toString=function(e){e=e||{};var t="",i=this.extract||[],n=[],r=function(e){return e};if(e.stylize){var s=typeof e.stylize;if("function"!==s)throw Error("options.stylize should be a function, got a "+s+"!");r=e.stylize}if(null!==this.line){if("string"==typeof i[0]&&n.push(r(this.line-1+" "+i[0],"grey")),"string"==typeof i[1]){var o=this.line+" ";i[1]&&(o+=i[1].slice(0,this.column)+r(r(r(i[1].substr(this.column,1),"bold")+i[1].slice(this.column+1),"red"),"inverse")),n.push(o)}"string"==typeof i[2]&&n.push(r(this.line+1+" "+i[2],"grey")),n=n.join("\n")+r("","reset")+"\n"}return t+=r(this.type+"Error: "+this.message,"red"),this.filename&&(t+=r(" in ","red")+this.filename),this.line&&(t+=r(" on line "+this.line+", column "+(this.column+1)+":","grey")),t+="\n"+n,this.callLine&&(t+=r("from ","red")+(this.filename||"")+"/n",t+=r(this.callLine,"grey")+" "+this.callExtract+"/n"),t};var $={visitDeeper:!0},L=!1;function j(e){return e}var N=function(){function e(e){this._implementation=e,this._visitInCache={},this._visitOutCache={},L||(!function e(t,i){var n,r;for(n in t)switch(typeof(r=t[n])){case"function":r.prototype&&r.prototype.type&&(r.prototype.typeIndex=i++);break;case"object":i=e(r,i)}return i}(He,1),L=!0)}return e.prototype.visit=function(e){if(!e)return e;var t=e.typeIndex;if(!t)return e.value&&e.value.typeIndex&&this.visit(e.value),e;var i,n=this._implementation,r=this._visitInCache[t],s=this._visitOutCache[t],o=$;if(o.visitDeeper=!0,r||(r=n[i="visit"+e.type]||j,s=n[i+"Out"]||j,this._visitInCache[t]=r,this._visitOutCache[t]=s),r!==j){var a=r.call(n,e,o);e&&n.isReplacing&&(e=a)}if(o.visitDeeper&&e)if(e.length)for(var l=0,u=e.length;lg.PARENS_DIVISION)||this.parensStack&&this.parensStack.length))},D.Eval.prototype.pathRequiresRewrite=function(e){return(this.rewriteUrls===b?z:T)(e)},D.Eval.prototype.rewritePath=function(e,t){var i;return t=t||"",i=this.normalizePath(t+e),z(e)&&T(t)&&!1===z(i)&&(i="./"+i),i},D.Eval.prototype.normalizePath=function(e){var t,i=e.split("/").reverse();for(e=[];0!==i.length;)switch(t=i.pop()){case".":break;case"..":0===e.length||".."===e[e.length-1]?e.push(t):e.pop();break;default:e.push(t)}return e.join("/")};var G=function(){function e(e){this.imports=[],this.variableImports=[],this._onSequencerEmpty=e,this._currentDepth=0}return e.prototype.addImport=function(e){var t=this,i={callback:e,args:null,isReady:!1};return this.imports.push(i),function(){i.args=Array.prototype.slice.call(arguments,0),i.isReady=!0,t.tryRun()}},e.prototype.addVariableImport=function(e){this.variableImports.push(e)},e.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var e=this.imports[0];if(!e.isReady)return;this.imports=this.imports.slice(1),e.callback.apply(null,e.args)}if(0===this.variableImports.length)break;var t=this.variableImports[0];this.variableImports=this.variableImports.slice(1),t()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},e}(),W=function(e,t){this._visitor=new N(this),this._importer=e,this._finish=t,this.context=new D.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new G(this._onSequencerEmpty.bind(this))};W.prototype={isReplacing:!1,run:function(e){try{this._visitor.visit(e)}catch(e){this.error=e}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(e,t){var i=e.options.inline;if(!e.css||i){var n=new D.Eval(this.context,k(this.context.frames)),r=n.frames[0];this.importCount++,e.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,e,n,r)):this.processImportNode(e,n,r)}t.visitDeeper=!1},processImportNode:function(e,t,i){var n,r=e.options.inline;try{n=e.evalForImport(t)}catch(t){t.filename||(t.index=e.getIndex(),t.filename=e.fileInfo().filename),e.css=!0,e.error=t}if(!n||n.css&&!r)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{n.options.multiple&&(t.importMultiple=!0);for(var s=void 0===n.css,o=0;o=0||(a=[u.selfSelectors[0]],(s=f.findMatch(l,a)).length&&(l.hasFoundMatches=!0,l.selfSelectors.forEach((function(e){var t=u.visibilityInfo();o=f.extendSelector(s,a,e,l.isVisible()),(c=new He.Extend(u.selector,u.option,0,u.fileInfo(),t)).selfSelectors=o,o[o.length-1].extendList=[c],h.push(c),c.ruleset=u.ruleset,c.parent_ids=c.parent_ids.concat(u.parent_ids,l.parent_ids),u.firstExtendOnThisSelectorPath&&(c.firstExtendOnThisSelectorPath=!0,u.ruleset.paths.push(o))}))));if(h.length){if(this.extendChainCount++,i>100){var p="{unable to calculate}",v="{unable to calculate}";try{p=h[0].selfSelectors[0].toCSS(),v=h[0].selector.toCSS()}catch(e){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+p+":extend("+v+")"}}return h.concat(f.doExtendChaining(h,t,i+1))}return h},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitSelector=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){if(!e.root){var i,n,r,s,o=this.allExtendsStack[this.allExtendsStack.length-1],a=[],l=this;for(r=0;r0&&u[l.matched].combinator.value!==o?l=null:l.matched++,l&&(l.finished=l.matched===u.length,l.finished&&!e.allowAfter&&(r+1u&&c>0&&(h[h.length-1].elements=h[h.length-1].elements.concat(t[u].elements.slice(c)),c=0,u++),l=s.elements.slice(c,a.index).concat([o]).concat(i.elements.slice(1)),u===a.pathIndex&&r>0?h[h.length-1].elements=h[h.length-1].elements.concat(l):(h=h.concat(t.slice(u,a.pathIndex))).push(new He.Selector(l)),u=a.endPathIndex,(c=a.endPathElementIndex)>=t[u].elements.length&&(c=0,u++);return u0&&(h[h.length-1].elements=h[h.length-1].elements.concat(t[u].elements.slice(c)),u++),h=(h=h.concat(t.slice(u,t.length))).map((function(e){var t=e.createDerived(e.elements);return n?t.ensureVisibility():t.ensureInvisibility(),t}))},e.prototype.visitMedia=function(e,t){var i=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);i=i.concat(this.doExtendChaining(i,e.allExtends)),this.allExtendsStack.push(i)},e.prototype.visitMediaOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e.prototype.visitAtRule=function(e,t){var i=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);i=i.concat(this.doExtendChaining(i,e.allExtends)),this.allExtendsStack.push(i)},e.prototype.visitAtRuleOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e}(),K=function(){function e(){this.contexts=[[]],this._visitor=new N(this)}return e.prototype.run=function(e){return this._visitor.visit(e)},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){var i,n=this.contexts[this.contexts.length-1],r=[];this.contexts.push(r),e.root||((i=e.selectors)&&(i=i.filter((function(e){return e.getIsOutput()})),e.selectors=i.length?i:i=null,i&&e.joinSelectors(r,n,i)),i||(e.rules=null),e.paths=r)},e.prototype.visitRulesetOut=function(e){this.contexts.length=this.contexts.length-1},e.prototype.visitMedia=function(e,t){var i=this.contexts[this.contexts.length-1];e.rules[0].root=0===i.length||i[0].multiMedia},e.prototype.visitAtRule=function(e,t){var i=this.contexts[this.contexts.length-1];e.rules&&e.rules.length&&(e.rules[0].root=e.isRooted||0===i.length||null)},e}(),Z=function(){function e(e){this._visitor=new N(this),this._context=e}return e.prototype.containsSilentNonBlockedChild=function(e){var t;if(!e)return!1;for(var i=0;i0},e.prototype.resolveVisibility=function(e){if(!e.blocksVisibility()){if(this.isEmpty(e))return;return e}var t=e.rules[0];if(this.keepOnlyVisibleChilds(t),!this.isEmpty(t))return e.ensureVisibility(),e.removeVisibilityBlock(),e},e.prototype.isVisibleRuleset=function(e){return!!e.firstRoot||!this.isEmpty(e)&&!(!e.root&&!this.hasVisibleSelector(e))},e}(),X=function(e){this._visitor=new N(this),this._context=e,this.utils=new Z(e)};X.prototype={isReplacing:!0,run:function(e){return this._visitor.visit(e)},visitDeclaration:function(e,t){if(!e.blocksVisibility()&&!e.variable)return e},visitMixinDefinition:function(e,t){e.frames=[]},visitExtend:function(e,t){},visitComment:function(e,t){if(!e.blocksVisibility()&&!e.isSilent(this._context))return e},visitMedia:function(e,t){var i=e.rules[0].rules;return e.accept(this._visitor),t.visitDeeper=!1,this.utils.resolveVisibility(e,i)},visitImport:function(e,t){if(!e.blocksVisibility())return e},visitAtRule:function(e,t){return e.rules&&e.rules.length?this.visitAtRuleWithBody(e,t):this.visitAtRuleWithoutBody(e,t)},visitAnonymous:function(e,t){if(!e.blocksVisibility())return e.accept(this._visitor),e},visitAtRuleWithBody:function(e,t){var i=function(e){var t=e.rules;return function(e){var t=e.rules;return 1===t.length&&(!t[0].paths||0===t[0].paths.length)}(e)?t[0].rules:t}(e);return e.accept(this._visitor),t.visitDeeper=!1,this.utils.isEmpty(e)||this._mergeRules(e.rules[0].rules),this.utils.resolveVisibility(e,i)},visitAtRuleWithoutBody:function(e,t){if(!e.blocksVisibility()){if("@charset"===e.name){if(this.charset){if(e.debugInfo){var i=new He.Comment("/* "+e.toCSS(this._context).replace(/\n/g,"")+" */\n");return i.debugInfo=e.debugInfo,this._visitor.visit(i)}return}this.charset=!0}return e}},checkValidNodes:function(e,t){if(e)for(var i=0;i0?e.accept(this._visitor):e.rules=null,t.visitDeeper=!1}return e.rules&&(this._mergeRules(e.rules),this._removeDuplicateRules(e.rules)),this.utils.isVisibleRuleset(e)&&(e.ensureVisibility(),n.splice(0,0,e)),1===n.length?n[0]:n},_compileRulesetPaths:function(e){e.paths&&(e.paths=e.paths.filter((function(e){var t;for(" "===e[0].elements[0].combinator.value&&(e[0].elements[0].combinator=new He.Combinator("")),t=0;t=0;n--)if((i=e[n])instanceof He.Declaration)if(r[i.name]){(t=r[i.name])instanceof He.Declaration&&(t=r[i.name]=[r[i.name].toCSS(this._context)]);var s=i.toCSS(this._context);-1!==t.indexOf(s)?e.splice(n,1):t.push(s)}else r[i.name]=i}},_mergeRules:function(e){if(e){for(var t={},i=[],n=0;n0){var t=e[0],i=[],n=[new He.Expression(i)];e.forEach((function(e){"+"===e.merge&&i.length>0&&n.push(new He.Expression(i=[])),i.push(e.value),t.important=t.important||e.important})),t.value=new He.Value(n)}}))}}};var Y={Visitor:N,ImportVisitor:W,MarkVisibleSelectorsVisitor:J,ExtendVisitor:Q,JoinSelectorVisitor:K,ToCSSVisitor:X};var ee=function(){var e,t,i,n,r,s,o,a=[],l={};function u(i){for(var n,a,c,h=l.i,f=t,p=l.i-o,v=l.i+s.length-p,d=l.i+=i,m=e;l.i=0){c={index:l.i,text:m.substr(l.i,y+2-l.i),isLineComment:!1},l.i+=c.text.length-1,l.commentStore.push(c);continue}}break}if(32!==n&&10!==n&&9!==n&&13!==n)break}if(s=s.slice(i+l.i-d+p),o=l.i,!s.length){if(ti||l.i===i&&e&&!n)&&(i=l.i,n=e);var r=a.pop();s=r.current,o=l.i=r.i,t=r.j},l.forget=function(){a.pop()},l.isWhitespace=function(t){var i=l.i+(t||0),n=e.charCodeAt(i);return 32===n||13===n||9===n||10===n},l.$re=function(e){l.i>o&&(s=s.slice(l.i-o),o=l.i);var t=e.exec(s);return t?(u(t[0].length),"string"==typeof t?t:1===t.length?t[0]:t):null},l.$char=function(t){return e.charAt(l.i)!==t?null:(u(1),t)},l.$peekChar=function(t){return e.charAt(l.i)!==t?null:t},l.$str=function(t){for(var i=t.length,n=0;nh&&(d=!1)}}while(d);return r||null},l.autoCommentAbsorb=!0,l.commentStore=[],l.finished=!1,l.peek=function(t){if("string"==typeof t){for(var i=0;i57||t<43||47===t||44===t},l.start=function(n,a,c){e=n,l.i=t=o=i=0,r=a?function(e,t){var i,n,r,s,o,a,l,u,c,h=e.length,f=0,p=0,v=[],d=0;function m(t){var i=o-d;i<512&&!t||!i||(v.push(e.slice(d,o+1)),d=o+1)}for(o=0;o=97&&l<=122||l<34))switch(l){case 40:p++,n=o;continue;case 41:if(--p<0)return t("missing opening `(`",o);continue;case 59:p||m();continue;case 123:f++,i=o;continue;case 125:if(--f<0)return t("missing opening `{`",o);f||p||m();continue;case 92:if(o96)){if(u==l){c=1;break}if(92==u){if(o==h-1)return t("unescaped `\\`",o);o++}}if(c)continue;return t("unmatched `"+String.fromCharCode(l)+"`",a);case 47:if(p||o==h-1)continue;if(47==(u=e.charCodeAt(o+1)))for(o+=2;oi&&s>r?"missing closing `}` or `*/`":"missing closing `}`",i):0!==p?t("missing closing `)`",n):(m(!0),v)}(n,c):[n],s=r[0],u(0)},l.end=function(){var t,r=l.i>=e.length;return l.i=e.length-1,furthestChar:e[l.i]}},l};var te=function e(t){return{_data:{},add:function(e,t){e=e.toLowerCase(),this._data.hasOwnProperty(e),this._data[e]=t},addMultiple:function(e){var t=this;Object.keys(e).forEach((function(i){t.add(i,e[i])}))},get:function(e){return this._data[e]||t&&t.get(e)},getLocalFunctions:function(){return this._data},inherit:function(){return e(this)},create:function(t){return e(t)}}}(null),ie={queryInParens:!0},ne={queryInParens:!0},re=function e(t,i,n,r){var s;r=r||0;var o=ee();function a(e,t){throw new V({index:o.i,filename:n.filename,type:t||"Syntax",message:e},i)}function l(e,t){var i=e instanceof Function?e.call(s):o.$re(e);if(i)return i;a(t||("string"==typeof e?"expected '"+e+"' got '"+o.currentChar()+"'":"unexpected token"))}function u(e,t){if(o.$char(e))return e;a(t||"expected '"+e+"' got '"+o.currentChar()+"'")}function c(e){var t=n.filename;return{lineNumber:C(e,o.getInput()).line+1,fileName:t}}return{parserInput:o,imports:i,fileInfo:n,parseNode:function(e,t,a){var l,u=[],c=o;try{c.start(e,!1,(function(e,t){a({message:e,index:t+r})}));for(var h=0,f=void 0;f=t[h];h++)l=s[f](),u.push(l||null);c.end().isFinished?a(null,u):a(!0,null)}catch(e){throw new V({index:e.index+r,message:e.message},i,n.filename)}},parse:function(r,l,u){var c,h,f,p,v=null,d="";if(u&&u.disablePluginRule&&(s.plugin=function(){o.$re(/^@plugin?\s+/)&&a("@plugin statements are not allowed when disablePluginRule is set to true")}),h=u&&u.globalVars?e.serializeVars(u.globalVars)+"\n":"",f=u&&u.modifyVars?"\n"+e.serializeVars(u.modifyVars):"",t.pluginManager)for(var m=t.pluginManager.getPreProcessors(),g=0;g");return e},args:function(e){var t,i,n,r,l,u,c,h=s.entities,f={args:null,variadic:!1},p=[],v=[],d=[],m=!0;for(o.save();;){if(e)u=s.detachedRuleset()||s.expression();else{if(o.commentStore.length=0,o.$str("...")){f.variadic=!0,o.$char(";")&&!t&&(t=!0),(t?v:d).push({variadic:!0});break}u=h.variable()||h.property()||h.literal()||h.keyword()||this.call(!0)}if(!u||!m)break;r=null,u.throwAwayComments&&u.throwAwayComments(),l=u;var g=null;if(e?u.value&&1==u.value.length&&(g=u.value[0]):g=u,g&&(g instanceof He.Variable||g instanceof He.Property))if(o.$char(":")){if(p.length>0&&(t&&a("Cannot mix ; and , as delimiter types"),i=!0),!(l=s.detachedRuleset()||s.expression())){if(!e)return o.restore(),f.args=[],f;a("could not understand value for named argument")}r=n=g.name}else if(o.$str("...")){if(!e){f.variadic=!0,o.$char(";")&&!t&&(t=!0),(t?v:d).push({name:u.name,variadic:!0});break}c=!0}else e||(n=r=g.name,l=null);l&&p.push(l),d.push({name:r,value:l,expand:c}),o.$char(",")?m=!0:((m=";"===o.$char(";"))||t)&&(i&&a("Cannot mix ; and , as delimiter types"),t=!0,p.length>1&&(l=new He.Value(p)),v.push({name:n,value:l,expand:c}),n=null,p=[],i=!1)}return o.forget(),f.args=t?v:d,f},definition:function(){var e,t,i,n,r=[],a=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),t=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){e=t[1];var u=this.args(!1);if(r=u.args,a=u.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(n=l(s.conditions,"expected condition")),i=s.block())return o.forget(),new He.mixin.Definition(e,r,i,n,a);o.restore()}else o.restore()},ruleLookups:function(){var e,t=[];if("["===o.currentChar()){for(;;){if(o.save(),!(e=this.lookupValue())&&""!==e){o.restore();break}t.push(e),o.forget()}return t.length>0?t:void 0}},lookupValue:function(){if(o.save(),o.$char("[")){var e=o.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/);if(o.$char("]"))return e||""===e?(o.forget(),e):void o.restore();o.restore()}else o.restore()}},entity:function(){var e=this.entities;return this.comment()||e.literal()||e.variable()||e.url()||e.property()||e.call()||e.keyword()||this.mixin.call(!0)||e.javascript()},end:function(){return o.$char(";")||o.peek("}")},ieAlpha:function(){var e;if(o.$re(/^opacity=/i))return(e=o.$re(/^\d+/))||(e="@{"+(e=l(s.entities.variable,"Could not parse alpha")).name.slice(1)+"}"),u(")"),new He.Quoted("","alpha(opacity="+e+")")},element:function(){var e,t,i,s=o.i;if(t=this.combinator(),(e=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[.#:](?=@)/)||this.entities.variableCurly())||(o.save(),o.$char("(")?(i=this.selector(!1))&&o.$char(")")?(e=new He.Paren(i),o.forget()):o.restore("Missing closing ')'"):o.forget()),e)return new He.Element(t,e,e instanceof He.Variable,s+r,n)},combinator:function(){var e=o.currentChar();if("/"===e){o.save();var t=o.$re(/^\/[a-z]+\//i);if(t)return o.forget(),new He.Combinator(t);o.restore()}if(">"===e||"+"===e||"~"===e||"|"===e||"^"===e){for(o.i++,"^"===e&&"^"===o.currentChar()&&(e="^^",o.i++);o.isWhitespace();)o.i++;return new He.Combinator(e)}return o.isWhitespace(-1)?new He.Combinator(" "):new He.Combinator(null)},selector:function(e){var t,i,s,u,c,h,f,p=o.i;for(e=!1!==e;(e&&(i=this.extend())||e&&(h=o.$str("when"))||(u=this.element()))&&(h?f=l(this.conditions,"expected condition"):f?a("CSS guard can only be used at the end of selector"):i?c=c?c.concat(i):i:(c&&a("Extend can only be used at the end of selector"),s=o.currentChar(),t?t.push(u):t=[u],u=null),"{"!==s&&"}"!==s&&";"!==s&&","!==s&&")"!==s););if(t)return new He.Selector(t,c,f,p+r,n);c&&a("Extend must be used to extend a selector, it cannot be used on its own")},selectors:function(){for(var e,t;(e=this.selector())&&(t?t.push(e):t=[e],o.commentStore.length=0,e.condition&&t.length>1&&a("Guards are only currently allowed on a single selector."),o.$char(","));)e.condition&&a("Guards are only currently allowed on a single selector."),o.commentStore.length=0;return t},attribute:function(){if(o.$char("[")){var e,t,i,n,r=this.entities;return(e=r.variableCurly())||(e=l(/^(?:[_A-Za-z0-9-*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),(i=o.$re(/^[|~*$^]?=/))&&(t=r.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||r.variableCurly())&&(n=o.$re(/^[iIsS]/)),u("]"),new He.Attribute(e,i,t,n)}},block:function(){var e;if(o.$char("{")&&(e=this.primary())&&o.$char("}"))return e},blockRuleset:function(){var e=this.block();return e&&(e=new He.Ruleset(null,e)),e},detachedRuleset:function(){var e,t,i;if(o.save(),!o.$re(/^[.#]\(/)||(t=(e=this.mixin.args(!1)).args,i=e.variadic,o.$char(")"))){var n=this.blockRuleset();if(n)return o.forget(),t?new He.mixin.Definition(null,t,n,null,i):new He.DetachedRuleset(n);o.restore()}else o.restore()},ruleset:function(){var e,i,n;if(o.save(),t.dumpLineNumbers&&(n=c(o.i)),(e=this.selectors())&&(i=this.block())){o.forget();var r=new He.Ruleset(e,i,t.strictImports);return t.dumpLineNumbers&&(r.debugInfo=n),r}o.restore()},declaration:function(){var e,t,i,s,a,l,u=o.i,c=o.currentChar();if("."!==c&&"#"!==c&&"&"!==c&&":"!==c)if(o.save(),e=this.variable()||this.ruleProperty()){if((l="string"==typeof e)&&(t=this.detachedRuleset())&&(i=!0),o.commentStore.length=0,!t){if(a=!l&&e.length>1&&e.pop().value,t=e[0].value&&"--"===e[0].value.slice(0,2)?this.permissiveValue(/[;}]/):this.anonymousValue())return o.forget(),new He.Declaration(e,t,!1,a,u+r,n);t||(t=this.value()),t?s=this.important():l&&(t=this.permissiveValue())}if(t&&(this.end()||i))return o.forget(),new He.Declaration(e,t,s,a,u+r,n);o.restore()}else o.restore()},anonymousValue:function(){var e=o.i,t=o.$re(/^([^.#@$+/'"*`(;{}-]*);/);if(t)return new He.Anonymous(t[1],e+r)},permissiveValue:function(e){var t,i,r,s,l=e||";",u=o.i,c=[];function h(){var e=o.currentChar();return"string"==typeof l?e===l:l.test(e)}if(!h()){s=[];do{((i=this.comment())||(i=this.entity()))&&s.push(i)}while(i);if(r=h(),s.length>0){if(s=new He.Expression(s),r)return s;c.push(s)," "===o.prevChar()&&c.push(new He.Anonymous(" ",u))}if(o.save(),s=o.$parseUntil(l)){if("string"==typeof s&&a("Expected '"+s+"'","Parse"),1===s.length&&" "===s[0])return o.forget(),new He.Anonymous("",u);var f=void 0;for(t=0;t]=|<=|>=|[<>]|=)/)?(o.restore(),i=this.condition(),o.save(),(s=this.atomicCondition(null,i.rvalue))||o.restore()):(o.restore(),t=this.value()),o.$char(")")?i&&!t?(u.push(new He.Paren(new He.QueryInParens(i.op,i.lvalue,i.rvalue,s?s.op:null,s?s.rvalue:null,i._index))),t=i):i&&t?u.push(new He.Paren(new He.Declaration(i,t,null,null,o.i+r,n,!0))):t?u.push(new He.Paren(t)):a("badly formed media feature definition"):a("Missing closing ')'","Parse"))}while(t);if(o.forget(),u.length>0)return new He.Expression(u)},mediaFeatures:function(e){var t,i=this.entities,n=[];do{if(t=this.mediaFeature(e)){if(n.push(t),!o.$char(","))break}else if((t=i.variable()||i.mixinLookup())&&(n.push(t),!o.$char(",")))break}while(t);return n.length>0?n:null},prepareAndGetNestableAtRule:function(e,i,s,l){var u=this.mediaFeatures(l),c=this.block();c||a("media definitions require block statements after any features"),o.forget();var h=new e(c,u,i+r,n);return t.dumpLineNumbers&&(h.debugInfo=s),h},nestableAtRule:function(){var e,i=o.i;if(t.dumpLineNumbers&&(e=c(i)),o.save(),o.$peekChar("@")){if(o.$str("@media"))return this.prepareAndGetNestableAtRule(He.Media,i,e,ie);if(o.$str("@container"))return this.prepareAndGetNestableAtRule(He.Container,i,e,ne)}o.restore()},plugin:function(){var e,t,i,s=o.i;if(o.$re(/^@plugin\s+/)){if(i=(t=this.pluginArgs())?{pluginArgs:t,isPlugin:!0}:{isPlugin:!0},e=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=s,a("missing semi-colon on @plugin")),new He.Import(e,null,i,s+r,n);o.i=s,a("malformed @plugin statement")}},pluginArgs:function(){if(o.save(),!o.$char("("))return o.restore(),null;var e=o.$re(/^\s*([^);]+)\)\s*/);return e[1]?(o.forget(),e[1].trim()):(o.restore(),null)},atrule:function(){var e,i,s,l,u,h,f,p=o.i,v=!0,d=!0;if("@"===o.currentChar()){if(i=this.import()||this.plugin()||this.nestableAtRule())return i;if(o.save(),e=o.$re(/^@[a-z-]+/)){switch(l=e,"-"==e.charAt(1)&&e.indexOf("-",2)>0&&(l="@"+e.slice(e.indexOf("-",2)+1)),l){case"@charset":u=!0,v=!1;break;case"@namespace":h=!0,v=!1;break;case"@keyframes":case"@counter-style":u=!0;break;case"@document":case"@supports":f=!0,d=!1;break;default:f=!0}if(o.commentStore.length=0,u?(i=this.entity())||a("expected "+e+" identifier"):h?(i=this.expression())||a("expected "+e+" expression"):f&&(i=this.permissiveValue(/^[{;]/),v="{"===o.currentChar(),i?i.value||(i=null):v||";"===o.currentChar()||a(e+" rule is missing block or ending semi-colon")),v&&(s=this.blockRuleset()),s||!v&&i&&o.$char(";"))return o.forget(),new He.AtRule(e,i,s,p+r,n,t.dumpLineNumbers?c(p):null,d);o.restore("at-rule options not recognised")}}},value:function(){var e,t=[],i=o.i;do{if((e=this.expression())&&(t.push(e),!o.$char(",")))break}while(e);if(t.length>0)return new He.Value(t,i+r)},important:function(){if("!"===o.currentChar())return o.$re(/^! *important/)},sub:function(){var e,t;if(o.save(),o.$char("("))return(e=this.addition())&&o.$char(")")?(o.forget(),(t=new He.Expression([e])).parens=!0,t):void o.restore("Expected ')'");o.restore()},multiplication:function(){var e,t,i,n,r;if(e=this.operand()){for(r=o.isWhitespace(-1);!o.peek(/^\/[*/]/);){if(o.save(),!(i=o.$char("/")||o.$char("*")||o.$str("./"))){o.forget();break}if(!(t=this.operand())){o.restore();break}o.forget(),e.parensInOp=!0,t.parensInOp=!0,n=new He.Operation(i,[n||e,t],r),r=o.isWhitespace(-1)}return n||e}},addition:function(){var e,t,i,n,r;if(e=this.multiplication()){for(r=o.isWhitespace(-1);(i=o.$re(/^[-+]\s+/)||!r&&(o.$char("+")||o.$char("-")))&&(t=this.multiplication());)e.parensInOp=!0,t.parensInOp=!0,n=new He.Operation(i,[n||e,t],r),r=o.isWhitespace(-1);return n||e}},conditions:function(){var e,t,i,n=o.i;if(e=this.condition(!0)){for(;o.peek(/^,\s*(not\s*)?\(/)&&o.$char(",")&&(t=this.condition(!0));)i=new He.Condition("or",i||e,t,n+r);return i||e}},condition:function(e){var t,i,n;if(t=this.conditionAnd(e)){if(i=o.$str("or")){if(!(n=this.condition(e)))return;t=new He.Condition(i,t,n)}return t}},conditionAnd:function(e){var t,i,n,r,s=this;if(t=(r=s.negatedCondition(e)||s.parenthesisCondition(e))||e?r:s.atomicCondition(e)){if(i=o.$str("and")){if(!(n=this.conditionAnd(e)))return;t=new He.Condition(i,t,n)}return t}},negatedCondition:function(e){if(o.$str("not")){var t=this.parenthesisCondition(e);return t&&(t.negate=!t.negate),t}},parenthesisCondition:function(e){var t;if(o.save(),o.$str("(")){if(t=function(t){var i;if(o.save(),i=t.condition(e)){if(o.$char(")"))return o.forget(),i;o.restore()}else o.restore()}(this))return o.forget(),t;if(t=this.atomicCondition(e)){if(o.$char(")"))return o.forget(),t;o.restore("expected ')' got '"+o.currentChar()+"'")}else o.restore()}else o.restore()},atomicCondition:function(e,t){var i,n,s,l,u=this.entities,c=o.i,h=function(){return this.addition()||u.keyword()||u.quoted()||u.mixinLookup()}.bind(this);if(i=t||h())return o.$char(">")?l=o.$char("=")?">=":">":o.$char("<")?l=o.$char("=")?"<=":"<":o.$char("=")&&(l=o.$char(">")?"=>":o.$char("<")?"=<":"="),l?(n=h())?s=new He.Condition(l,i,n,c+r,!1):a("expected expression"):t||(s=new He.Condition("=",i,new He.Keyword("true"),c+r,!1)),s},operand:function(){var e,t=this.entities;o.peek(/^-[@$(]/)&&(e=o.$char("-"));var i=this.sub()||t.dimension()||t.color()||t.variable()||t.property()||t.call()||t.quoted(!0)||t.colorKeyword()||t.mixinLookup();return e&&(i.parensInOp=!0,i=new He.Negative(i)),i},expression:function(){var e,t,i=[],n=o.i;do{(e=this.comment())?i.push(e):((e=this.addition()||this.entity())instanceof He.Comment&&(e=null),e&&(i.push(e),o.peek(/^\/[/*]/)||(t=o.$char("/"))&&i.push(new He.Anonymous(t,n+r))))}while(e);if(i.length>0)return new He.Expression(i)},property:function(){var e=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(e)return e[1]},ruleProperty:function(){var e,t,i=[],s=[];o.save();var a=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(a)return i=[new He.Keyword(a[1])],o.forget(),i;function l(e){var t=o.i,n=o.$re(e);if(n)return s.push(t),i.push(n[1])}for(l(/^(\*?)/);l(/^((?:[\w-]+)|(?:[@$]\{[\w-]+\}))/););if(i.length>1&&l(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===i[0]&&(i.shift(),s.shift()),t=0;t0;e--){var t=this.rules[e-1];if(t instanceof ce)return this.parseValue(t)}},parseValue:function(e){var t=this;function i(e){return e.value instanceof le&&!e.parsed?("string"==typeof e.value.value?new re(this.parse.context,this.parse.importManager,e.fileInfo(),e.value.getIndex()).parseNode(e.value.value,["value","important"],(function(t,i){t&&(e.parsed=!0),i&&(e.value=i[0],e.important=i[1]||"",e.parsed=!0)})):e.parsed=!0,e):e}if(Array.isArray(e)){var n=[];return e.forEach((function(e){n.push(i.call(t,e))})),n}return i.call(t,e)},rulesets:function(){if(!this.rules)return[];var e,t,i=[],n=this.rules;for(e=0;t=n[e];e++)t.isRuleset&&i.push(t);return i},prependRule:function(e){var t=this.rules;t?t.unshift(e):this.rules=[e],this.setParent(e,this)},find:function(e,t,i){t=t||this;var n,r,s=[],o=e.toCSS();return o in this._lookups?this._lookups[o]:(this.rulesets().forEach((function(o){if(o!==t)for(var a=0;an){if(!i||i(o)){r=o.find(new se(e.elements.slice(n)),t,i);for(var l=0;l0&&t.add(l),e.firstSelector=!0,o[0].genCSS(e,t),e.firstSelector=!1,n=1;n0?(s=(r=k(e)).pop(),o=n.createDerived(k(s.elements))):o=n.createDerived([]),t.length>0){var a=i.combinator,l=t[0].elements[0];a.emptyOrWhitespace&&!l.combinator.emptyOrWhitespace&&(a=l.combinator),o.elements.push(new m(a,l.value,i.isVariable,i._index,i._fileInfo)),o.elements=o.elements.concat(t[0].elements.slice(1))}if(0!==o.elements.length&&r.push(o),t.length>1){var u=t.slice(1);u=u.map((function(e){return e.createDerived(e.elements,[])})),r=r.concat(u)}return r}function o(e,t,i,n,r){var o;for(o=0;o0?n[n.length-1]=n[n.length-1].createDerived(n[n.length-1].elements.concat(e)):n.push(new se(e));else t.push([new se(e)])}function l(e,t){var i=t.createDerived(t.elements,t.extendList,t.evaldCondition);return i.copyVisibilityInfo(e),i}var u,c;if(!function e(t,i,l){var u,c,h,f,v,d,g,y,b,w,x,S,I=!1;for(f=[],v=[[]],u=0;y=l.elements[u];u++)if("&"!==y.value){var C=(S=void 0,(x=y).value instanceof p&&(S=x.value.value)instanceof se?S:null);if(null!==C){a(f,v);var k,_=[],A=[];for(k=e(_,i,C),I=I||k,h=0;h<_.length;h++){o(v,[r(n(_[h],y),y)],y,l,A)}v=A,f=[]}else f.push(y)}else{for(I=!0,d=[],a(f,v),c=0;c0&&g[0].elements.push(new m(y.combinator,"",y.isVariable,y._index,y._fileInfo)),d.push(g);else for(h=0;h0&&(t.push(v[u]),w=v[u][b-1],v[u][b-1]=w.createDerived(w.elements,l.extendList));return I}(c=[],t,i))if(t.length>0)for(c=[],u=0;u0)for(t=0;t-1e-6&&(n=i.toFixed(20).replace(/0+$/,"")),e&&e.compress){if(0===i&&this.unit.isLength())return void t.add(n);i>0&&i<1&&(n=n.substr(1))}t.add(n),this.unit.genCSS(e,t)},operate:function(e,t,i){var n=this._operate(e,t,this.value,i.value),r=this.unit.clone();if("+"===t||"-"===t)if(0===r.numerator.length&&0===r.denominator.length)r=i.unit.clone(),this.unit.backupUnit&&(r.backupUnit=this.unit.backupUnit);else if(0===i.unit.numerator.length&&0===r.denominator.length);else{if(i=i.convertTo(this.unit.usedUnits()),e.strictUnits&&i.unit.toString()!==r.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+r.toString()+"' and '"+i.unit.toString()+"'.");n=this._operate(e,t,this.value,i.value)}else"*"===t?(r.numerator=r.numerator.concat(i.unit.numerator).sort(),r.denominator=r.denominator.concat(i.unit.denominator).sort(),r.cancel()):"/"===t&&(r.numerator=r.numerator.concat(i.unit.denominator).sort(),r.denominator=r.denominator.concat(i.unit.numerator).sort(),r.cancel());return new we(n,r)},compare:function(e){var t,i;if(e instanceof we){if(this.unit.isEmpty()||e.unit.isEmpty())t=this,i=e;else if(t=this.unify(),i=e.unify(),0!==t.unit.compare(i.unit))return;return u.numericCompare(t.value,i.value)}},unify:function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},convertTo:function(e){var t,i,n,r,s,o=this.value,l=this.unit.clone(),u={};if("string"==typeof e){for(t in a)a[t].hasOwnProperty(e)&&((u={})[t]=e);e=u}for(i in s=function(e,t){return n.hasOwnProperty(e)?(t?o/=n[e]/n[r]:o*=n[e]/n[r],r):e},e)e.hasOwnProperty(i)&&(r=e[i],n=a[i],l.map(s));return l.cancel(),new we(o,l)}});var xe=g,Se=function(e,t,i){this.op=e.trim(),this.operands=t,this.isSpaced=i};Se.prototype=Object.assign(new u,{type:"Operation",accept:function(e){this.operands=e.visitArray(this.operands)},eval:function(e){var t,i=this.operands[0].eval(e),n=this.operands[1].eval(e);if(e.isMathOn(this.op)){if(t="./"===this.op?"/":this.op,i instanceof we&&n instanceof c&&(i=i.toColor()),n instanceof we&&i instanceof c&&(n=n.toColor()),!i.operate||!n.operate){if((i instanceof Se||n instanceof Se)&&"/"===i.op&&e.math===xe.PARENS_DIVISION)return new Se(this.op,[i,n],this.isSpaced);throw{type:"Operation",message:"Operation on an invalid type"}}return i.operate(e,t,n)}return new Se(this.op,[i,n],this.isSpaced)},genCSS:function(e,t){this.operands[0].genCSS(e,t),this.isSpaced&&t.add(" "),t.add(this.op),this.isSpaced&&t.add(" "),this.operands[1].genCSS(e,t)}});var Ie=function(){return(Ie=Object.assign||function(e){for(var t,i=1,n=arguments.length;i1?t=new Ce(this.value.map((function(t){return t.eval?t.eval(e):t})),this.noSpacing):1===this.value.length?(!this.value[0].parens||this.value[0].parensInOp||e.inCalc||(r=!0),t=this.value[0].eval(e)):t=this,n&&e.outOfParenthesis(),!this.parens||!this.parensInOp||i||r||t instanceof we||(t=new p(t)),t},genCSS:function(e,t){for(var i=0;i1){var i=new se([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();(t=new me(i,e.mediaBlocks)).multiMedia=!0,t.copyVisibilityInfo(this.visibilityInfo()),this.setParent(t,this)}return delete e.mediaBlocks,delete e.mediaPath,t},evalNested:function(e){var t,i,n=e.mediaPath.concat([this]);for(t=0;t0;t--)e.splice(t,0,new le("and"));return new Ce(e)}))),this.setParent(this.features,this),new me([],[])},permute:function(e){if(0===e.length)return[];if(1===e.length)return e[0];for(var t=[],i=this.permute(e.slice(1)),n=0;n1?"["+e.value.map((function(e){return e.toCSS()})).join(", ")+"]":e.toCSS()}});var Le=function(e,t,i,n){this.escaped=t,this.expression=e,this._index=i,this._fileInfo=n};Le.prototype=Object.assign(new $e,{type:"JavaScript",eval:function(e){var t=this.evaluateJavaScript(this.expression,e),i=typeof t;return"number"!==i||isNaN(t)?"string"===i?new Ee('"'+t+'"',t,this.escaped,this._index):Array.isArray(t)?new le(t.join(", ")):new le(t):new we(t)}});var je=function(e,t){this.key=e,this.value=t};je.prototype=Object.assign(new u,{type:"Assignment",accept:function(e){this.value=e.visit(this.value)},eval:function(e){return this.value.eval?new je(this.key,this.value.eval(e)):this},genCSS:function(e,t){t.add(this.key+"="),this.value.genCSS?this.value.genCSS(e,t):t.add(this.value)}});var Ne=function(e,t,i,n,r){this.op=e.trim(),this.lvalue=t,this.rvalue=i,this._index=n,this.negate=r};Ne.prototype=Object.assign(new u,{type:"Condition",accept:function(e){this.lvalue=e.visit(this.lvalue),this.rvalue=e.visit(this.rvalue)},eval:function(e){var t=function(e,t,i){switch(e){case"and":return t&&i;case"or":return t||i;default:switch(u.compare(t,i)){case-1:return"<"===e||"=<"===e||"<="===e;case 0:return"="===e||">="===e||"=<"===e||"<="===e;case 1:return">"===e||">="===e;default:return!1}}}(this.op,this.lvalue.eval(e),this.rvalue.eval(e));return this.negate?!t:t}});var De=function(e,t,i,n,r,s){this.op=e.trim(),this.lvalue=t,this.mvalue=i,this.op2=n?n.trim():null,this.rvalue=r,this._index=s};De.prototype=Object.assign(new u,{type:"QueryInParens",accept:function(e){this.lvalue=e.visit(this.lvalue),this.mvalue=e.visit(this.mvalue),this.rvalue&&(this.rvalue=e.visit(this.rvalue))},eval:function(e){return this.lvalue=this.lvalue.eval(e),this.mvalue=this.mvalue.eval(e),this.rvalue&&(this.rvalue=this.rvalue.eval(e)),this},genCSS:function(e,t){this.lvalue.genCSS(e,t),t.add(" "+this.op+" "),this.mvalue.genCSS(e,t),this.rvalue&&(t.add(" "+this.op2+" "),this.rvalue.genCSS(e,t))}});var Be=function(e,t,i,n,r){this._index=i,this._fileInfo=n;var s=new se([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new oe(t),this.rules=[new me(s,e)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(r),this.allowRoot=!0,this.setParent(s,this),this.setParent(this.features,this),this.setParent(this.rules,this)};Be.prototype=Object.assign(new ge,Ie(Ie({type:"Container"},Oe),{genCSS:function(e,t){t.add("@container ",this._fileInfo,this._index),this.features.genCSS(e,t),this.outputRuleset(e,t,this.rules)},eval:function(e){e.mediaBlocks||(e.mediaBlocks=[],e.mediaPath=[]);var t=new Be(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,t.debugInfo=this.debugInfo),t.features=this.features.eval(e),e.mediaPath.push(t),e.mediaBlocks.push(t),this.rules[0].functionRegistry=e.frames[0].functionRegistry.inherit(),e.frames.unshift(this.rules[0]),t.rules=[this.rules[0].eval(e)],e.frames.shift(),e.mediaPath.pop(),0===e.mediaPath.length?t.evalTop(e):t.evalNested(e)}}));var Ue=function(e){this.value=e};Ue.prototype=Object.assign(new u,{type:"UnicodeDescriptor"});var qe=function(e){this.value=e};qe.prototype=Object.assign(new u,{type:"Negative",genCSS:function(e,t){t.add("-"),this.value.genCSS(e,t)},eval:function(e){return e.isMathOn()?new Se("*",[new we(-1),this.value]).eval(e):new qe(this.value.eval(e))}});var Te=function(e,t,i,n,r){switch(this.selector=e,this.option=t,this.object_id=Te.next_id++,this.parent_ids=[this.object_id],this._index=i,this._fileInfo=n,this.copyVisibilityInfo(r),this.allowRoot=!0,t){case"all":this.allowBefore=!0,this.allowAfter=!0;break;default:this.allowBefore=!1,this.allowAfter=!1}this.setParent(this.selector,this)};Te.prototype=Object.assign(new u,{type:"Extend",accept:function(e){this.selector=e.visit(this.selector)},eval:function(e){return new Te(this.selector.eval(e),this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},clone:function(e){return new Te(this.selector,this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},findSelfSelectors:function(e){var t,i,n=[];for(t=0;t0&&i.length&&""===i[0].combinator.value&&(i[0].combinator.value=" "),n=n.concat(e[t].elements);this.selfSelectors=[new se(n)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())}}),Te.next_id=0;var ze=function(e,t,i){this.variable=e,this._index=t,this._fileInfo=i,this.allowRoot=!0};ze.prototype=Object.assign(new u,{type:"VariableCall",eval:function(e){var t,i=new Ae(this.variable,this.getIndex(),this.fileInfo()).eval(e),n=new V({message:"Could not evaluate variable call "+this.variable});if(!i.ruleset){if(i.rules)t=i;else if(Array.isArray(i))t=new me("",i);else{if(!Array.isArray(i.value))throw n;t=new me("",i.value)}i=new ye(t)}if(i.ruleset)return i.callEval(e);throw n}});var Ge=function(e,t,i,n){this.value=e,this.lookups=t,this._index=i,this._fileInfo=n};Ge.prototype=Object.assign(new u,{type:"NamespaceValue",eval:function(e){var t,i,n=this.value.eval(e);for(t=0;tthis.params.length)return!1}i=Math.min(s,this.arity);for(var o=0;o0){for(c=!0,a=0;a0)f=2;else if(f=1,p[1]+p[2]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(m)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(a=0;a0&&(e=e.slice(0,t)),(t=e.lastIndexOf("/"))<0&&(t=e.lastIndexOf("\\")),t<0?"":e.slice(0,t+1)},e.prototype.tryAppendExtension=function(e,t){return/(\.[a-z]*$)|([?;].*)$/.test(e)?e:e+t},e.prototype.tryAppendLessExtension=function(e){return this.tryAppendExtension(e,".less")},e.prototype.supportsSync=function(){return!1},e.prototype.alwaysMakePathsAbsolute=function(){return!1},e.prototype.isPathAbsolute=function(e){return/^(?:[a-z-]+:|\/|\\|#)/i.test(e)},e.prototype.join=function(e,t){return e?e+t:t},e.prototype.pathDiff=function(e,t){var i,n,r,s,o=this.extractUrlParts(e),a=this.extractUrlParts(t),l="";if(o.hostPart!==a.hostPart)return"";for(n=Math.max(a.directories.length,o.directories.length),i=0;iparseInt(t[i])?-1:1;return 0},e.prototype.versionToString=function(e){for(var t="",i=0;i1?e-1:e)<1?r+(s-r)*e*6:2*e<1?s:3*e<2?r+(s-r)*(2/3-e)*6:r}try{if(e instanceof c)return n=t?st(t):e.alpha,new c(e.rgb,n,"hsla");e=st(e)%360/360,t=tt(st(t)),i=tt(st(i)),n=tt(st(n)),r=2*i-(s=i<=.5?i*(t+1):i+t-i*t);var a=[255*o(e+1/3),255*o(e),255*o(e-1/3)];return n=st(n),new c(a,n,"hsla")}catch(e){}},hsv:function(e,t,i){return Ye.hsva(e,t,i,1)},hsva:function(e,t,i,n){var r,s;e=st(e)%360/360*360,t=st(t),i=st(i),n=st(n);var o=[i,i*(1-t),i*(1-(s=e/60-(r=Math.floor(e/60%6)))*t),i*(1-(1-s)*t)],a=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return Ye.rgba(255*o[a[r][0]],255*o[a[r][1]],255*o[a[r][2]],n)},hue:function(e){return new we(nt(e).h)},saturation:function(e){return new we(100*nt(e).s,"%")},lightness:function(e){return new we(100*nt(e).l,"%")},hsvhue:function(e){return new we(rt(e).h)},hsvsaturation:function(e){return new we(100*rt(e).s,"%")},hsvvalue:function(e){return new we(100*rt(e).v,"%")},red:function(e){return new we(e.rgb[0])},green:function(e){return new we(e.rgb[1])},blue:function(e){return new we(e.rgb[2])},alpha:function(e){return new we(nt(e).a)},luma:function(e){return new we(e.luma()*e.alpha*100,"%")},luminance:function(e){var t=.2126*e.rgb[0]/255+.7152*e.rgb[1]/255+.0722*e.rgb[2]/255;return new we(t*e.alpha*100,"%")},saturate:function(e,t,i){if(!e.rgb)return null;var n=nt(e);return void 0!==i&&"relative"===i.value?n.s+=n.s*t.value/100:n.s+=t.value/100,n.s=tt(n.s),it(e,n)},desaturate:function(e,t,i){var n=nt(e);return void 0!==i&&"relative"===i.value?n.s-=n.s*t.value/100:n.s-=t.value/100,n.s=tt(n.s),it(e,n)},lighten:function(e,t,i){var n=nt(e);return void 0!==i&&"relative"===i.value?n.l+=n.l*t.value/100:n.l+=t.value/100,n.l=tt(n.l),it(e,n)},darken:function(e,t,i){var n=nt(e);return void 0!==i&&"relative"===i.value?n.l-=n.l*t.value/100:n.l-=t.value/100,n.l=tt(n.l),it(e,n)},fadein:function(e,t,i){var n=nt(e);return void 0!==i&&"relative"===i.value?n.a+=n.a*t.value/100:n.a+=t.value/100,n.a=tt(n.a),it(e,n)},fadeout:function(e,t,i){var n=nt(e);return void 0!==i&&"relative"===i.value?n.a-=n.a*t.value/100:n.a-=t.value/100,n.a=tt(n.a),it(e,n)},fade:function(e,t){var i=nt(e);return i.a=t.value/100,i.a=tt(i.a),it(e,i)},spin:function(e,t){var i=nt(e),n=(i.h+t.value)%360;return i.h=n<0?360+n:n,it(e,i)},mix:function(e,t,i){i||(i=new we(50));var n=i.value/100,r=2*n-1,s=nt(e).a-nt(t).a,o=((r*s==-1?r:(r+s)/(1+r*s))+1)/2,a=1-o,l=[e.rgb[0]*o+t.rgb[0]*a,e.rgb[1]*o+t.rgb[1]*a,e.rgb[2]*o+t.rgb[2]*a],u=e.alpha*n+t.alpha*(1-n);return new c(l,u)},greyscale:function(e){return Ye.desaturate(e,new we(100))},contrast:function(e,t,i,n){if(!e.rgb)return null;if(void 0===i&&(i=Ye.rgba(255,255,255,1)),void 0===t&&(t=Ye.rgba(0,0,0,1)),t.luma()>i.luma()){var r=i;i=t,t=r}return n=void 0===n?.43:st(n),e.luma().5&&(n=1,i=e>.25?Math.sqrt(e):((16*e-12)*e+4)*e),e-(1-2*t)*n*(i-e)},hardlight:function(e,t){return lt.overlay(t,e)},difference:function(e,t){return Math.abs(e-t)},exclusion:function(e,t){return e+t-2*e*t},average:function(e,t){return(e+t)/2},negation:function(e,t){return 1-Math.abs(e+t-1)}};for(var ut in lt)lt.hasOwnProperty(ut)&&(at[ut]=at.bind(null,lt[ut]));var ct=function(e){return Array.isArray(e.value)?e.value:Array(e)},ht={_SELF:function(e){return e},"~":function(){for(var e=[],t=0;to.value)&&(h[n]=r);else{if(void 0!==l&&a!==l)throw{type:"Argument",message:"incompatible types"};f[a]=h.length,h.push(r)}else Array.isArray(t[i].value)&&Array.prototype.push.apply(t,Array.prototype.slice.call(t[i].value));return 1==h.length?h[0]:(t=h.map((function(e){return e.toCSS(c.context)})).join(this.context.compress?",":", "),new le((e?"min":"max")+"("+t+")"))},mt={min:function(){for(var e=[],t=0;t<'+u+'Gradient id="g" '+i+">",r=0;r";return n+=""+u+"Gradient>',n=encodeURIComponent(n),new Re(new Ee("'"+(n="data:image/svg+xml,"+n)+"'",n,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)}}),te.addMultiple(wt),t};function St(e,t){var i,n=(t=t||{}).variables,r=new D.Eval(t);"object"!=typeof n||Array.isArray(n)||(n=Object.keys(n).map((function(e){var t=n[e];return t instanceof He.Value||(t instanceof He.Expression||(t=new He.Expression([t])),t=new He.Value([t])),new He.Declaration("@"+e,t,!1,null,0)})),r.frames=[new He.Ruleset(null,n)]);var s,o,a=[new Y.JoinSelectorVisitor,new Y.MarkVisibleSelectorsVisitor(!0),new Y.ExtendVisitor,new Y.ToCSSVisitor({compress:Boolean(t.compress)})],l=[];if(t.pluginManager){o=t.pluginManager.visitor();for(var u=0;u<2;u++)for(o.first();s=o.get();)s.isPreEvalVisitor?0!==u&&-1!==l.indexOf(s)||(l.push(s),s.run(e)):0!==u&&-1!==a.indexOf(s)||(s.isPreVisitor?a.unshift(s):a.push(s))}i=e.eval(r);for(var c=0;c=t);i++);this.preProcessors.splice(i,0,{preProcessor:e,priority:t})},e.prototype.addPostProcessor=function(e,t){var i;for(i=0;i=t);i++);this.postProcessors.splice(i,0,{postProcessor:e,priority:t})},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.getPreProcessors=function(){for(var e=[],t=0;t0){var n=void 0,r=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?n=this.sourceMapURL:this._sourceMapFilename&&(n=this._sourceMapFilename),this.sourceMapURL=n,this.sourceMap=r}return this._css.join("")},t}()}(e=new s(e,t)),e)),a=function(e){return function(){function t(e,t,i){this.less=e,this.rootFilename=i.filename,this.paths=t.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=t.mime,this.error=null,this.context=t,this.queue=[],this.files={}}return t.prototype.push=function(t,i,n,s,o){var a=this,l=this.context.pluginManager.Loader;this.queue.push(t);var u=function(e,i,n){a.queue.splice(a.queue.indexOf(t),1);var l=n===a.rootFilename;s.optional&&e?(o(null,{rules:[]},!1,null),r.info("The file "+n+" was skipped because it was not found and the import was marked optional.")):(a.files[n]||s.inline||(a.files[n]={root:i,options:s}),e&&!a.error&&(a.error=e),o(e,i,l,n))},c={rewriteUrls:this.context.rewriteUrls,entryPath:n.entryPath,rootpath:n.rootpath,rootFilename:n.rootFilename},h=e.getFileManager(t,n.currentDirectory,this.context,e);if(h){var f,p,v=function(e){var t,i=e.filename,r=e.contents.replace(/^\uFEFF/,"");c.currentDirectory=h.getPath(i),c.rewriteUrls&&(c.rootpath=h.join(a.context.rootpath||"",h.pathDiff(c.currentDirectory,c.entryPath)),!h.isPathAbsolute(c.rootpath)&&h.alwaysMakePathsAbsolute()&&(c.rootpath=h.join(c.entryPath,c.rootpath))),c.filename=i;var o=new D.Parse(a.context);o.processImports=!1,a.contents[i]=r,(n.reference||s.reference)&&(c.reference=!0),s.isPlugin?(t=l.evalPlugin(r,o,a,s.pluginArgs,c))instanceof V?u(t,null,i):u(null,t,i):s.inline?u(null,r,i):!a.files[i]||a.files[i].options.multiple||s.multiple?new re(o,a,c).parse(r,(function(e,t){u(e,t,i)})):u(null,a.files[i].root,i)},d=_(this.context);i&&(d.ext=s.isPlugin?".js":".less"),s.isPlugin?(d.mime="application/javascript",d.syncImport?f=l.loadPluginSync(t,n.currentDirectory,d,e,h):p=l.loadPlugin(t,n.currentDirectory,d,e,h)):d.syncImport?f=h.loadFileSync(t,n.currentDirectory,d,e):p=h.loadFile(t,n.currentDirectory,d,e,(function(e,t){e?u(e):v(t)})),f?f.filename?v(f):u(f):p&&p.then(v,u)}else u({message:"Could not find a file-manager for "+t})},t}()}(e);var u,c=function(e,t){var i=function(e,n,r){if("function"==typeof n?(r=n,n=P(this.options,{})):n=P(this.options,n||{}),!r){var s=this;return new Promise((function(t,r){i.call(s,e,n,(function(e,i){e?r(e):t(i)}))}))}this.parse(e,n,(function(e,i,n,s){if(e)return r(e);var o;try{o=new t(i,n).toCSS(s)}catch(e){return r(e)}r(null,o)}))};return i}(0,o),h=function(e,t,i){var n=function(e,t,r){if("function"==typeof t?(r=t,t=P(this.options,{})):t=P(this.options,t||{}),!r){var s=this;return new Promise((function(i,r){n.call(s,e,t,(function(e,t){e?r(e):i(t)}))}))}var o,a=void 0,l=new kt(this,!t.reUsePluginManager);if(t.pluginManager=l,o=new D.Parse(t),t.rootFileInfo)a=t.rootFileInfo;else{var u=t.filename||"input",c=u.replace(/[^/\\]*$/,"");(a={filename:u,rewriteUrls:o.rewriteUrls,rootpath:o.rootpath||"",currentDirectory:c,entryPath:c,rootFilename:u}).rootpath&&"/"!==a.rootpath.slice(-1)&&(a.rootpath+="/")}var h=new i(this,o,a);this.importManager=h,t.plugins&&t.plugins.forEach((function(e){var t,i;if(e.fileContent){if(i=e.fileContent.replace(/^\uFEFF/,""),(t=l.Loader.evalPlugin(i,o,h,e.options,e.filename))instanceof V)return r(t)}else l.addPlugin(e)})),new re(o,h,a).parse(e,(function(e,i){if(e)return r(e);r(null,i,h,t)}),t)};return n}(0,0,a),f=Pt("v4.2.0"),p={version:[f.major,f.minor,f.patch],data:l,tree:He,Environment:s,AbstractFileManager:Qe,AbstractPluginLoader:Ke,environment:e,visitors:Y,Parser:re,functions:xt(e),contexts:D,SourceMapOutput:i,SourceMapBuilder:n,ParseTree:o,ImportManager:a,render:c,parse:h,LessError:V,transformTree:St,utils:R,PluginManager:kt,logger:r},v=function(e){return function(){var t=Object.create(e.prototype);return e.apply(t,Array.prototype.slice.call(arguments,0)),t}},d=Object.create(p);for(var m in p.tree)if("function"==typeof(u=p.tree[m]))d[m.toLowerCase()]=v(u);else for(var g in d[m]=Object.create(null),u)d[m][g.toLowerCase()]=v(u[g]);return p.parse=p.parse.bind(d),p.render=p.render.bind(d),d}var Et={},Rt=function(){};Rt.prototype=Object.assign(new Qe,{alwaysMakePathsAbsolute:function(){return!0},join:function(e,t){return e?this.extractUrlParts(t,e).path:t},doXHR:function(e,t,i,n){var r=new XMLHttpRequest,s=!_t.isFileProtocol||_t.fileAsync;function o(t,i,n){t.status>=200&&t.status<300?i(t.responseText,t.getResponseHeader("Last-Modified")):"function"==typeof n&&n(t.status,e)}"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/css"),At.debug("XHR: Getting '"+e+"'"),r.open("GET",e,s),r.setRequestHeader("Accept",t||"text/x-less, text/css; q=0.9, */*; q=0.5"),r.send(null),_t.isFileProtocol&&!_t.fileAsync?0===r.status||r.status>=200&&r.status<300?i(r.responseText):n(r.status,e):s?r.onreadystatechange=function(){4==r.readyState&&o(r,i,n)}:o(r,i,n)},supports:function(){return!0},clearFileCache:function(){Et={}},loadFile:function(e,t,i){t&&!this.isPathAbsolute(e)&&(e=t+e),e=i.ext?this.tryAppendExtension(e,i.ext):e,i=i||{};var n=this.extractUrlParts(e,window.location.href).url,r=this;return new Promise((function(e,t){if(i.useFileCache&&Et[n])try{var s=Et[n];return e({contents:s,filename:n,webInfo:{lastModified:new Date}})}catch(e){return t({filename:n,message:"Error loading file "+n+" error was "+e.message})}r.doXHR(n,i.mime,(function(t,i){Et[n]=t,e({contents:t,filename:n,webInfo:{lastModified:i}})}),(function(e,i){t({type:"File",message:"'"+i+"' wasn't found ("+e+")",href:n})}))}))}});var Ot=function(e,t){return _t=e,At=t,Rt},Vt=function(e){this.less=e};Vt.prototype=Object.assign(new Ke,{loadPlugin:function(e,t,i,n,r){return new Promise((function(s,o){r.loadFile(e,t,i,n).then(s).catch(o)}))}});var Ft=function(t,n,r){return{add:function(s,o){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting?function(e,t){var i=e.filename||t,s=[],o=(e.type||"Syntax")+"Error: "+(e.message||"There is an error in your .less file")+" in "+i,a=function(e,t,i){void 0!==e.extract[t]&&s.push("{line} {content}".replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,i).replace(/\{content\}/,e.extract[t]))};e.line&&(a(e,0,""),a(e,1,"line"),a(e,2,""),o+=" on line "+e.line+", column "+(e.column+1)+":\n"+s.join("\n")),e.stack&&(e.extract||r.logLevel>=4)&&(o+="\nStack Trace\n"+e.stack),n.logger.error(o)}(s,o):"function"==typeof r.errorReporting&&r.errorReporting("add",s,o):function(n,s){var o,a,l="less-error-message:"+e(s||""),u=t.document.createElement("div"),c=[],h=n.filename||s,f=h.match(/([^/]+(\?.*)?)$/)[1];u.id=l,u.className="less-error-message",a="
"+(n.type||"Syntax")+"Error: "+(n.message||"There is an error in your .less file")+'
in '+f+" ";var p=function(e,t,i){void 0!==e.extract[t]&&c.push('
{content}
'.replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,i).replace(/\{content\}/,e.extract[t]))};n.line&&(p(n,0,""),p(n,1,"line"),p(n,2,""),a+="on line "+n.line+", column "+(n.column+1)+":
"),n.stack&&(n.extract||r.logLevel>=4)&&(a+="
Stack Trace"+n.stack.split("\n").slice(1).join("
")),u.innerHTML=a,i(t.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),u.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===r.env&&(o=setInterval((function(){var e=t.document,i=e.body;i&&(e.getElementById(l)?i.replaceChild(u,e.getElementById(l)):i.insertBefore(u,i.firstChild),clearInterval(o))}),10))}(s,o)},remove:function(i){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting||"function"==typeof r.errorReporting&&r.errorReporting("remove",i):function(i){var n=t.document.getElementById("less-error-message:"+e(i));n&&n.parentNode.removeChild(n)}(i)}}},$t={javascriptEnabled:!1,depends:!1,compress:!1,lint:!1,paths:[],color:!0,strictImports:!1,insecure:!1,rootpath:"",rewriteUrls:!1,math:1,strictUnits:!1,globalVars:null,modifyVars:null,urlArgs:""};if(window.less)for(var Lt in window.less)Object.prototype.hasOwnProperty.call(window.less,Lt)&&($t[Lt]=window.less[Lt]);!function(e,i){t(i,n(e)),void 0===i.isFileProtocol&&(i.isFileProtocol=/^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(e.location.protocol)),i.async=i.async||!1,i.fileAsync=i.fileAsync||!1,i.poll=i.poll||(i.isFileProtocol?1e3:1500),i.env=i.env||("127.0.0.1"==e.location.hostname||"0.0.0.0"==e.location.hostname||"localhost"==e.location.hostname||e.location.port&&e.location.port.length>0||i.isFileProtocol?"development":"production");var r=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(e.location.hash);r&&(i.dumpLineNumbers=r[1]),void 0===i.useFileCache&&(i.useFileCache=!0),void 0===i.onReady&&(i.onReady=!0),i.relativeUrls&&(i.rewriteUrls="all")}(window,$t),$t.plugins=$t.plugins||[],window.LESS_PLUGINS&&($t.plugins=$t.plugins.concat(window.LESS_PLUGINS));var jt,Nt,Dt,Bt=function(e,n){var r=e.document,s=Mt();s.options=n;var o=s.environment,a=Ot(n,s.logger),l=new a;o.addFileManager(l),s.FileManager=a,s.PluginLoader=Vt,function(e,t){t.logLevel=void 0!==t.logLevel?t.logLevel:"development"===t.env?3:1,t.loggers||(t.loggers=[{debug:function(e){t.logLevel>=4&&console.log(e)},info:function(e){t.logLevel>=3&&console.log(e)},warn:function(e){t.logLevel>=2&&console.warn(e)},error:function(e){t.logLevel>=1&&console.error(e)}}]);for(var i=0;i .Title {
- justify-content: space-between;
-}
-
-#Contents > .Editors {
- flex: 4 0 0;
- flex-direction: row;
- justify-content: space-between;
- width: auto;
- margin: 5px;
- padding: 5px;
- background-color: rgba(0, 60, 130, 0.8);
- border: 3px solid rgba(0, 120, 255, 0.8);
- border-radius: 15px;
-}
-
-#Contents > .Editors > .ResultPanel {
- color: wheat;
- border: 3px solid skyblue;
- border-spacing: 0;
- border-radius: 10px;
-}
-
-#Contents > .Editors > .ResultPanel td {
- white-space: nowrap;
- border: 1px solid cornflowerblue;
-}
-
-#Contents > .Editors > .ResultPanel > thead {
- background-color: #044488;
-}
-
-#Contents > .Editors > .ResultPanel > tbody {
- background-color: #008080;
-}
-
-#Contents > .Editors > .EditPanel {
- flex: 1 0 0;
- margin: 5px;
- padding: 5px;
- background-color: rgba(0, 60, 130, 0.8);
- border: 3px solid rgba(0, 120, 255, 0.8);
- border-radius: 15px;
-}
-
-#Contents > .Editors > .EditPanel > .Panel {
- border: 0;
-}
-
-#Contents > .Pages > * {
- color: wheat;
- margin-right: 3px;
- border: 3px solid skyblue;
- border-radius: 10px;
- background-color: cadetblue;
-}
-
-#Contents > .Pages > *:last-child {
- margin-right: inherit;
-}
-
-#Contents > .Pages > span {
- color: green;
-}
-
-@media (min-width: 1280px) {
- #Contents {
- width: 1280px;
- }
-}
diff --git a/src/main/resources/static/styles/edit.less b/src/main/resources/static/styles/edit.less
new file mode 100644
index 0000000..2f8b90a
--- /dev/null
+++ b/src/main/resources/static/styles/edit.less
@@ -0,0 +1,96 @@
+@font-face {
+ font-family: "Normal";
+ src: url("../fonts/华文圆体-Regular.ttf") format("ttf");
+}
+
+body {
+ display: flex;
+ margin: auto;
+ flex-direction: column;
+ align-items: center;
+}
+
+div {
+ display: flex;
+}
+
+#Contents {
+ flex-direction: column;
+ width: 100%;
+ height: 500px;
+
+ > .Title {
+ justify-content: space-between;
+ margin: 5px;
+ padding: 5px;
+ color: wheat;
+ background-color: rgba(0, 60, 130, 0.8);
+ border: 3px solid rgba(0, 120, 255, 0.8);
+ border-spacing: 0;
+ border-radius: 15px;
+ }
+
+ > .Editors {
+ flex-direction: row;
+ justify-content: space-between;
+ width: auto;
+
+ > * {
+ justify-content: center;
+ margin: 5px;
+ padding: 5px;
+ color: wheat;
+ background-color: rgba(0, 60, 130, 0.8);
+ border: 3px solid rgba(0, 120, 255, 0.8);
+ border-spacing: 0;
+ border-radius: 15px;
+ font-family: "Normal", system-ui;
+ }
+
+ > .ResultPanel {
+ flex: 2 auto;
+
+ td {
+ border: 1px solid cornflowerblue;
+ }
+
+ > thead {
+ background-color: #044488;
+ }
+
+ > tbody {
+ background-color: #008080;
+ }
+ }
+
+ > .EditPanel {
+ flex: 1 auto;
+ }
+ }
+
+ > .Pages {
+ margin: 5px;
+ padding: 5px;
+ color: wheat;
+ background-color: rgba(0, 60, 130, 0.8);
+ border: 3px solid rgba(0, 120, 255, 0.8);
+ border-spacing: 0;
+ border-radius: 15px;
+
+ > * {
+ color: wheat;
+ margin-right: 3px;
+ border: 3px solid skyblue;
+ border-radius: 10px;
+ background-color: cadetblue;
+ }
+
+ > *:last-child {
+ margin-right: inherit;
+ }
+
+ > span {
+ color: green;
+ }
+ }
+}
diff --git a/src/main/resources/static/styles/success.css b/src/main/resources/static/styles/success.css
deleted file mode 100644
index 6d58562..0000000
--- a/src/main/resources/static/styles/success.css
+++ /dev/null
@@ -1,9 +0,0 @@
-@font-face {
- font-family: "Normal";
- src: url("../fonts/华文圆体-Regular.ttf") format("ttf");
-}
-
-h2 {
- font: "Normal";
- color: wheat;
-}
diff --git a/src/main/resources/templates/account.mustache b/src/main/resources/templates/account.mustache
index 954228a..046786d 100644
--- a/src/main/resources/templates/account.mustache
+++ b/src/main/resources/templates/account.mustache
@@ -3,25 +3,25 @@
账户 - 67购物网站
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-{{> header }}
+{{>header}}
@@ -38,7 +38,7 @@
+ value="{{user.name}}"/>
@@ -95,7 +95,7 @@
-{{> footer }}
+{{>footer}}