"use strict";
exports.id = 7712;
exports.ids = [7712];
exports.modules = {

/***/ 237712:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "D": () => (/* binding */ Type),
/* harmony export */   "Z": () => (/* binding */ Tickets)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(545725);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(antd__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var lib_hooks_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(375698);
/* harmony import */ var components_share_loading__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(976087);
/* harmony import */ var components_misc_A__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(940981);
/* harmony import */ var _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(477389);
/* harmony import */ var _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _cocalc_frontend_editors_slate_static_markdown__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(695379);
/* harmony import */ var _cocalc_frontend_editors_slate_static_markdown__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_cocalc_frontend_editors_slate_static_markdown__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(807772);
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(296768);
/* harmony import */ var lib_customize__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(400054);
/* harmony import */ var lib_config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(774872);











function Tickets() {
    let { result , error  } = (0,lib_hooks_api__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)("support/tickets");
    const { zendesk  } = (0,lib_customize__WEBPACK_IMPORTED_MODULE_9__/* .useCustomize */ .i)();
    if (!zendesk) {
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_util__WEBPACK_IMPORTED_MODULE_8__/* .NoZendesk */ .f, {});
    }
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Layout.Content, {
        style: {
            backgroundColor: "white"
        },
        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
            style: {
                maxWidth: lib_config__WEBPACK_IMPORTED_MODULE_10__/* .MAX_WIDTH */ .d,
                margin: "15px auto",
                padding: "15px",
                backgroundColor: "white",
                color: "#555"
            },
            children: [
                " ",
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h1", {
                    style: {
                        textAlign: "center",
                        fontSize: "24pt"
                    },
                    children: "Support Tickets"
                }),
                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p", {
                    style: {
                        fontSize: "12pt"
                    },
                    children: [
                        "Check the status of your support tickets here or",
                        " ",
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_A__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
                            href: "/support/new",
                            children: "create a new ticket"
                        }),
                        ". Newly created tickets do not appear here for a few minutes."
                    ]
                }),
                error && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Alert, {
                    style: {
                        margin: "30px 0"
                    },
                    type: "error",
                    message: "Error loading support tickets",
                    description: error
                }),
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Divider, {
                    children: "Tickets"
                }),
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("br", {}),
                result ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(SupportTimeline, {
                    tickets: result.tickets
                }) : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_share_loading__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
                    style: {
                        fontSize: "20pt"
                    }
                })
            ]
        })
    });
}
function SupportTimeline({ tickets  }) {
    const v = [];
    for (const ticket of tickets ?? []){
        v.push(/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Timeline.Item, {
            color: statusToColor(ticket.status),
            children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Ticket, {
                ticket: ticket
            })
        }, ticket.id));
    }
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Timeline, {
        children: v
    });
}
const COLOR = {
    new: "orange",
    open: "orange",
    pending: "red",
    solved: "#666"
};
function statusToColor(status) {
    return COLOR[status] ?? "#f5ca00";
}
function Ticket({ ticket  }) {
    const { id , userURL , created_at , updated_at , description , status , subject , type ,  } = ticket;
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        style: {
            marginBottom: "15px"
        },
        children: [
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                style: {
                    float: "right"
                },
                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Type, {
                    type: type,
                    status: status
                })
            }),
            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(components_misc_A__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
                href: userURL,
                children: [
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Status, {
                        status: status
                    }),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("b", {
                        style: {
                            fontSize: "13pt"
                        },
                        children: (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_5__.trunc)(subject, 80)
                    })
                ]
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("br", {}),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                style: {
                    float: "right"
                },
                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Tooltip, {
                    title: "Click to visit Zendesk and see all responses to your support request.",
                    children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(components_misc_A__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
                        href: userURL,
                        children: [
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_7__.Icon, {
                                name: "external-link"
                            }),
                            " Ticket: ",
                            id
                        ]
                    })
                })
            }),
            "(created: ",
            dateToString(created_at),
            ", updated: ",
            dateToString(updated_at),
            ")",
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("br", {}),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                style: {
                    overflow: "auto",
                    maxHeight: "30vh",
                    border: "1px solid lightgrey",
                    padding: "15px",
                    marginTop: "5px",
                    backgroundColor: "#fdfdfd",
                    borderRadius: "3px"
                },
                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((_cocalc_frontend_editors_slate_static_markdown__WEBPACK_IMPORTED_MODULE_6___default()), {
                    value: description
                })
            })
        ]
    });
}
const STATUS = {
    pending: {
        title: "We are waiting for your response.",
        label: "AWAITING YOUR REPLY",
        color: "#f5ca00"
    },
    new: {
        title: "We are looking at your support request but have not responded yet.",
        label: "NEW",
        color: "#59bbe0" /* blue */ 
    },
    open: {
        title: "We are trying to solve your support request.",
        label: "OPEN",
        color: "#59bbe0"
    },
    solved: {
        title: "This support request has been solved.",
        label: "SOLVED",
        color: "#666"
    }
};
function Status({ status  }) {
    const { title , label , color  } = STATUS[status] ?? {
        title: "",
        label: "Status",
        color: "blue"
    };
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Tooltip, {
        title: title,
        children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Tag, {
            color: color,
            style: {
                fontSize: "12pt",
                color: "white"
            },
            children: label
        })
    });
}
const TYPE_COLOR = {
    problem: "red",
    question: "blue",
    task: "orange"
};
function Type({ status , type  }) {
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Tag, {
        color: status == "solved" ? "#666" : TYPE_COLOR[type],
        style: {
            fontSize: "12pt"
        },
        children: (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_5__.capitalize)(type)
    });
}
function dateToString(d) {
    try {
        return new Date(d).toLocaleString();
    } catch (_err) {
        return d;
    }
}


/***/ }),

/***/ 296768:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "V": () => (/* binding */ Placeholder),
/* harmony export */   "f": () => (/* binding */ NoZendesk)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(545725);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(antd__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var components_landing_contact__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(892771);
/* harmony import */ var lib_customize__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(400054);




function NoZendesk() {
    const { contactEmail  } = (0,lib_customize__WEBPACK_IMPORTED_MODULE_3__/* .useCustomize */ .i)();
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Alert, {
        type: "error",
        message: "Zendesk Support is not configured.",
        style: {
            margin: "30px auto",
            maxWidth: "400px",
            fontSize: "13pt"
        },
        description: contactEmail && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
            children: [
                "You can still ",
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_landing_contact__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
                    lower: true
                }),
                "."
            ]
        })
    });
}
function Placeholder({ children  }) {
    // This is because the placeholder text that antd uses is WAY
    // too light, according to Google's Lighthouse accessibility score.
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
        style: {
            color: "#888"
        },
        children: children
    });
}


/***/ }),

/***/ 774872:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "d": () => (/* binding */ MAX_WIDTH),
/* harmony export */   "r": () => (/* binding */ SHARE_MAX_WIDTH)
/* harmony export */ });
/*
Constants and other configuration that impact the overall
look of all of the pages.
*/ const MAX_WIDTH = "900px";
const SHARE_MAX_WIDTH = "1100px";


/***/ })

};
;