"use strict";
(() => {
var exports = {};
exports.id = 5405;
exports.ids = [5405,7206];
exports.modules = {

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

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ Badge)
/* 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__);


function Badge({ count , style  }) {
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Badge, {
        overflowCount: 1e8,
        count: count ?? 0,
        style: {
            backgroundColor: "#e6f7ff",
            color: "black",
            minWidth: "30px",
            ...style
        }
    });
};


/***/ }),

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

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ ProxyInput)
/* 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 react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(616689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(545725);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(antd__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var components_misc_A__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(940981);
/* harmony import */ var components_share_site_name__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(535358);
/* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(371853);
/* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(next_router__WEBPACK_IMPORTED_MODULE_5__);
/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */ 





function ProxyInput() {
    const router = (0,next_router__WEBPACK_IMPORTED_MODULE_5__.useRouter)();
    const { 0: error , 1: setError  } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)("");
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        style: {
            margin: "15px 0"
        },
        children: [
            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(components_misc_A__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
                href: "https://doc.cocalc.com/share.html",
                children: [
                    "Share what you create in ",
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_share_site_name__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {})
                ]
            }),
            " ",
            "or paste a URL to a ",
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_A__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
                href: "http://github.com/",
                children: "GitHub"
            }),
            " repository or",
            " ",
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_A__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
                href: "https://gist.github.com/",
                children: "Gist"
            }),
            ":",
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_2__.Input.Search, {
                style: {
                    marginTop: "10px"
                },
                placeholder: "URL to GitHub repository or Gist",
                allowClear: true,
                enterButton: "View GitHub Repository or Gist",
                onSearch: (url)=>{
                    try {
                        router.push(urlToProxyURL(url));
                    } catch (err) {
                        setError(`${err}`);
                    }
                }
            }),
            error && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_2__.Alert, {
                style: {
                    marginTop: "15px"
                },
                type: "error",
                message: error,
                showIcon: true
            })
        ]
    });
};
// INPUT: a URL to something on the internet
// OUTPUT: a URL on the share serve (without the http, host stuff)
//         that proxies that input URL.
// The cases we treat are:
//     - gist
//     - github user or repo
//     - general URL fallback, if none of the above apply
//
// NOTE: we implemented general URL's.  HOWEVER spammers use this to
// automate creating large numbers of links from cocalc to their bullshit
// pages to improve their SEO ranking.  Thus we restrict only to github.
//
function urlToProxyURL(url) {
    const { host , pathname  } = new URL(url);
    if (host == new URL(document.URL).host) {
        // URL on this very server - just go to it
        return url;
    } else if (host == "github.com") {
        return `/github${pathname}`;
    } else if (host == "gist.github.com") {
        return `/gist${pathname}`;
    } else {
        throw Error("The URL most be to content on github.com.");
    }
}


/***/ }),

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

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ PublicPaths)
/* 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_misc_badge__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(982072);
/* harmony import */ var components_misc_A__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(940981);
/* harmony import */ var components_misc_sanitized_markdown__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(543128);
/* harmony import */ var _cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(807772);
/* harmony import */ var _cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(477389);
/* harmony import */ var _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _cocalc_util_consts_ui__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(883996);
/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */ /*
A table of a list of public paths.
*/ 







function Description({ description , maxWidth  }) {
    if (!description?.trim()) return null;
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
        style: {
            maxWidth,
            maxHeight: "4em",
            overflow: "auto",
            border: "1px solid #eee",
            borderRadius: "3px",
            padding: "5px"
        },
        children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_sanitized_markdown__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
            value: description
        })
    });
}
function LastEdited({ last_edited  }) {
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
        children: `${new Date(parseFloat(last_edited)).toLocaleString()}`
    });
}
function Title({ id , title , url , avatar_image_tiny  }) {
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(components_misc_A__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
        href: url ? `/${url}` : `/share/public_paths/${id}`,
        children: [
            avatar_image_tiny && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Avatar, {
                size: 24,
                shape: "square",
                icon: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
                    src: avatar_image_tiny
                }),
                style: {
                    marginRight: "5px",
                    marginTop: "-4px"
                }
            }),
            (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_6__.trunc_middle)(title, 48)
        ]
    });
}
function Visibility({ disabled , unlisted , vhost , authenticated  }) {
    if (disabled) {
        return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_5__.Icon, {
                    name: "lock"
                }),
                " Private"
            ]
        });
    }
    if (authenticated) {
        return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_5__.Icon, {
                    name: _cocalc_util_consts_ui__WEBPACK_IMPORTED_MODULE_7__/* .SHARE_AUTHENTICATED_ICON */ .rD
                }),
                " Authenticated"
            ]
        });
    }
    if (unlisted) {
        return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_5__.Icon, {
                    name: "eye-slash"
                }),
                " Unlisted"
            ]
        });
    }
    if (vhost) {
        return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
            children: [
                "Virtual Host: ",
                vhost
            ]
        });
    }
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
        children: [
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_5__.Icon, {
                name: "eye"
            }),
            " Listed"
        ]
    });
}
function ViewsAndStars({ stars , views  }) {
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        style: {
            display: "flex"
        },
        children: [
            views > 0 && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                style: {
                    marginRight: "30px"
                },
                children: [
                    "Views ",
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_badge__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
                        count: views
                    })
                ]
            }),
            stars > 0 && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                children: [
                    "Stars ",
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_badge__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
                        count: stars
                    })
                ]
            })
        ]
    });
}
// I'm using any[]'s below since it's too much of a pain dealing with TS for this.
const COLUMNS0 = [
    {
        title: "Path",
        dataIndex: "path",
        key: "path",
        render: (title, record)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Title, {
                id: record.id,
                title: title,
                url: record.url,
                avatar_image_tiny: record.avatar_image_tiny
            }),
        responsive: [
            "sm"
        ],
        sorter: (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_6__.field_cmp)("path")
    },
    {
        title: "Description",
        dataIndex: "description",
        key: "description",
        render: (description)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Description, {
                description: description,
                maxWidth: "250px"
            }),
        responsive: [
            "sm"
        ],
        sorter: (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_6__.field_cmp)("description")
    },
    {
        title: "Last Modified",
        dataIndex: "last_edited",
        key: "last_edited",
        render: (last_edited)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(LastEdited, {
                last_edited: last_edited
            }),
        responsive: [
            "sm"
        ],
        sorter: (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_6__.field_cmp)("last_edited")
    },
    {
        title: "Stars",
        dataIndex: "stars",
        key: "stars",
        render: (stars)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_badge__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
                count: stars
            }),
        responsive: [
            "sm"
        ],
        sorter: (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_6__.field_cmp)("stars")
    },
    {
        title: "Views",
        dataIndex: "counter",
        key: "counter",
        render: (counter)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_badge__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
                count: counter
            }),
        responsive: [
            "sm"
        ],
        sorter: (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_6__.field_cmp)("counter")
    }, 
];
const COLUMNS = COLUMNS0.concat([
    {
        title: "Documents",
        responsive: [
            "xs"
        ],
        key: "path",
        render: (_, record)=>{
            const { path , url , last_edited , id , description , stars , counter  } = record;
            return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_1__.Space, {
                direction: "vertical",
                style: {
                    width: "100%"
                },
                children: [
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Title, {
                        title: path,
                        id: id,
                        url: url
                    }),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Description, {
                        description: description
                    }),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(LastEdited, {
                        last_edited: last_edited
                    }),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(ViewsAndStars, {
                        stars: stars,
                        views: counter
                    })
                ]
            });
        }
    }, 
]);
const COLUMNS_WITH_VISIBILITY = COLUMNS0.concat([
    {
        title: "Visibility",
        dataIndex: "disabled",
        key: "disabled",
        render: (_, record)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Visibility, {
                disabled: record.disabled,
                unlisted: record.unlisted,
                authenticated: record.authenticated,
                vhost: record.vhost
            }),
        responsive: [
            "sm"
        ],
        sorter: (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_6__.field_cmp)([
            "disabled",
            "unlisted",
            "vhost",
            "authenticated"
        ])
    },
    {
        title: "Documents",
        responsive: [
            "xs"
        ],
        key: "path",
        render: (_, record)=>{
            const { path , last_edited , id , description , stars , counter , url  } = record;
            return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_1__.Space, {
                direction: "vertical",
                style: {
                    width: "100%"
                },
                children: [
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Title, {
                        title: path,
                        id: id,
                        url: url
                    }),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Description, {
                        description: description
                    }),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(LastEdited, {
                        last_edited: last_edited
                    }),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Visibility, {
                        disabled: record.disabled,
                        unlisted: record.unlisted,
                        authenticated: record.authenticated,
                        vhost: record.vhost
                    }),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(ViewsAndStars, {
                        stars: stars,
                        views: counter
                    })
                ]
            });
        }
    }, 
]);
function PublicPaths({ publicPaths  }) {
    let showVisibility = false;
    if (publicPaths) {
        for (const path of publicPaths){
            const { disabled , unlisted , authenticated  } = path;
            if (disabled || unlisted || authenticated) {
                showVisibility = true;
                break;
            }
        }
    }
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Table, {
        pagination: false,
        rowKey: "id",
        loading: publicPaths == null,
        dataSource: publicPaths,
        columns: showVisibility ? COLUMNS_WITH_VISIBILITY : COLUMNS,
        style: {
            overflowX: "auto"
        }
    });
};


/***/ }),

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

// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "default": () => (/* binding */ Home),
  "getServerSideProps": () => (/* binding */ getServerSideProps)
});

// EXTERNAL MODULE: external "react/jsx-runtime"
var jsx_runtime_ = __webpack_require__(920997);
// EXTERNAL MODULE: ../database/dist/pool/index.js
var dist_pool = __webpack_require__(17763);
var pool_default = /*#__PURE__*/__webpack_require__.n(dist_pool);
// EXTERNAL MODULE: external "antd"
var external_antd_ = __webpack_require__(545725);
// EXTERNAL MODULE: ./components/app/path.tsx + 1 modules
var path = __webpack_require__(566213);
// EXTERNAL MODULE: ./components/landing/content.tsx
var content = __webpack_require__(499270);
// EXTERNAL MODULE: ./components/landing/footer.tsx + 1 modules
var footer = __webpack_require__(831910);
// EXTERNAL MODULE: ./components/landing/head.tsx
var head = __webpack_require__(373306);
// EXTERNAL MODULE: ./components/landing/header.tsx + 2 modules
var header = __webpack_require__(131498);
// EXTERNAL MODULE: ./components/logo-square.tsx
var logo_square = __webpack_require__(961429);
// EXTERNAL MODULE: ./components/misc/A.tsx
var A = __webpack_require__(940981);
// EXTERNAL MODULE: ./components/share/proxy-input.tsx
var proxy_input = __webpack_require__(709711);
// EXTERNAL MODULE: ./components/share/public-paths.tsx
var public_paths = __webpack_require__(113419);
// EXTERNAL MODULE: ./lib/account/get-account.ts
var get_account = __webpack_require__(661879);
// EXTERNAL MODULE: ./lib/base-path.ts
var base_path = __webpack_require__(348397);
// EXTERNAL MODULE: ./lib/customize.ts
var lib_customize = __webpack_require__(400054);
// EXTERNAL MODULE: ./lib/with-customize.ts
var with_customize = __webpack_require__(601880);
// EXTERNAL MODULE: external "path"
var external_path_ = __webpack_require__(371017);
;// CONCATENATED MODULE: ./public/cocalc-screenshot-20200128-nq8.png
/* harmony default export */ const cocalc_screenshot_20200128_nq8 = ({"src":"/_next/static/media/cocalc-screenshot-20200128-nq8.4f8c25fa.png","height":793,"width":1241,"blurDataURL":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAMAAABPT11nAAAAGFBMVEX+/v75+frk7PHa6PH19vfu8vTh5uXG1eMGa9HtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAJklEQVQImU3GuQEAMAjEMN8D7L9x2qgSm9yNl3ErSahtBeA48+UBC30Aa2B69LcAAAAASUVORK5CYII=","blurWidth":8,"blurHeight":5});
;// CONCATENATED MODULE: ./pages/index.tsx
/*
 *  This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */ 

















const topLinkStyle = {
    marginRight: "20px"
};
function Home(props) {
    const { customize , publicPaths  } = props;
    const { shareServer , siteName , siteDescription , organizationName , organizationURL , splashImage , indexInfo , sandboxProjectId , onCoCalcCom ,  } = customize;
    function renderAboveImage() {
        return /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
            children: [
                sandboxProjectId && /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
                    style: {
                        marginBottom: "30px"
                    },
                    children: [
                        /*#__PURE__*/ (0,jsx_runtime_.jsxs)("h3", {
                            style: {
                                textAlign: "center",
                                color: "#666"
                            },
                            children: [
                                "The Public ",
                                siteName,
                                " Sandbox"
                            ]
                        }),
                        /*#__PURE__*/ jsx_runtime_.jsx(path/* default */.Z, {
                            style: {
                                marginRight: "15px",
                                marginBottom: "15px"
                            },
                            project_id: sandboxProjectId,
                            description: "Public Sandbox"
                        })
                    ]
                }),
                shareServer && onCoCalcCom && /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
                    children: [
                        /*#__PURE__*/ jsx_runtime_.jsx("h3", {
                            style: {
                                textAlign: "center"
                            },
                            children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)(A/* default */.Z, {
                                href: "/share/public_paths/page/1",
                                children: [
                                    "Explore what people have shared using ",
                                    siteName,
                                    "!"
                                ]
                            })
                        }),
                        publicPaths && /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
                            style: {
                                maxHeight: "60vh",
                                overflow: "auto",
                                marginRight: "15px"
                            },
                            children: [
                                /*#__PURE__*/ jsx_runtime_.jsx(proxy_input/* default */.Z, {}),
                                /*#__PURE__*/ jsx_runtime_.jsx(public_paths/* default */.Z, {
                                    publicPaths: publicPaths
                                })
                            ]
                        })
                    ]
                })
            ]
        });
    }
    return /*#__PURE__*/ (0,jsx_runtime_.jsxs)(lib_customize/* Customize */.l, {
        value: customize,
        children: [
            /*#__PURE__*/ jsx_runtime_.jsx(head/* default */.Z, {
                title: "Collaborative Calculation"
            }),
            /*#__PURE__*/ (0,jsx_runtime_.jsxs)(external_antd_.Layout, {
                children: [
                    /*#__PURE__*/ jsx_runtime_.jsx(header/* default */.Z, {}),
                    /*#__PURE__*/ (0,jsx_runtime_.jsxs)(external_antd_.Layout.Content, {
                        style: {
                            backgroundColor: "white"
                        },
                        children: [
                            customize.account && /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
                                style: {
                                    textAlign: "center",
                                    margin: "30px 0 -15px 0",
                                    color: "#666",
                                    fontSize: "30pt",
                                    fontWeight: 500
                                },
                                children: [
                                    "Signed in as",
                                    " ",
                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                        href: "/config",
                                        children: `${customize.account.first_name} ${customize.account.last_name} ${customize.account.name ? "(@" + customize.account.name + ")" : ""}`
                                    }),
                                    /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
                                        style: {
                                            fontSize: "11pt",
                                            margin: "15px 0"
                                        },
                                        children: [
                                            customize.isCommercial && customize.account && !customize.account.is_anonymous && /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
                                                children: [
                                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                        href: "/store",
                                                        style: topLinkStyle,
                                                        children: "Store"
                                                    }),
                                                    " ",
                                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                        href: "/licenses",
                                                        style: topLinkStyle,
                                                        children: "Licenses"
                                                    }),
                                                    " ",
                                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                        href: "/billing",
                                                        style: topLinkStyle,
                                                        children: "Billing"
                                                    }),
                                                    " "
                                                ]
                                            }),
                                            customize.account != null && /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
                                                children: [
                                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                        href: (0,external_path_.join)(base_path/* default */.Z, "projects"),
                                                        external: true,
                                                        style: topLinkStyle,
                                                        children: "Projects"
                                                    }),
                                                    " "
                                                ]
                                            }),
                                            customize.landingPages && /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
                                                children: [
                                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                        href: "/features/",
                                                        style: topLinkStyle,
                                                        children: "Features"
                                                    }),
                                                    " ",
                                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                        href: "/software",
                                                        style: topLinkStyle,
                                                        children: "Software"
                                                    }),
                                                    " ",
                                                    customize.isCommercial && /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
                                                        children: [
                                                            /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                                href: "/pricing",
                                                                style: topLinkStyle,
                                                                children: "Pricing"
                                                            }),
                                                            " "
                                                        ]
                                                    })
                                                ]
                                            }),
                                            customize.account != null && /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
                                                children: [
                                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                        href: "/config",
                                                        style: topLinkStyle,
                                                        children: "Config"
                                                    }),
                                                    " "
                                                ]
                                            }),
                                            customize.shareServer && /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
                                                children: [
                                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                        style: topLinkStyle,
                                                        href: "/share/public_paths/page/1",
                                                        children: "Share"
                                                    }),
                                                    " "
                                                ]
                                            }),
                                            /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
                                                children: [
                                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                        style: topLinkStyle,
                                                        href: "/support",
                                                        children: "Support"
                                                    }),
                                                    " ",
                                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                        style: topLinkStyle,
                                                        href: "/info/status",
                                                        children: "Status"
                                                    }),
                                                    " ",
                                                    /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                        style: topLinkStyle,
                                                        href: "https://doc.cocalc.com",
                                                        children: "Docs"
                                                    })
                                                ]
                                            })
                                        ]
                                    })
                                ]
                            }),
                            /*#__PURE__*/ jsx_runtime_.jsx(content/* default */.Z, {
                                logo: /*#__PURE__*/ jsx_runtime_.jsx(logo_square/* default */.Z, {
                                    style: {
                                        width: "120px",
                                        height: "120px"
                                    }
                                }),
                                title: siteName,
                                subtitle: siteDescription,
                                description: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
                                    children: [
                                        "An instance of ",
                                        /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                            href: "https://cocalc.com",
                                            children: "CoCalc"
                                        }),
                                        " ",
                                        organizationName && organizationURL && /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
                                            children: [
                                                "hosted by ",
                                                /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                    href: organizationURL,
                                                    children: organizationName
                                                })
                                            ]
                                        }),
                                        onCoCalcCom && /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
                                            style: {
                                                marginTop: "15px"
                                            },
                                            children: [
                                                /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                                                    href: "https://about.cocalc.com",
                                                    children: "Mission and Features of CoCalc"
                                                }),
                                                /*#__PURE__*/ jsx_runtime_.jsx("br", {}),
                                                /*#__PURE__*/ jsx_runtime_.jsx("br", {}),
                                                /*#__PURE__*/ jsx_runtime_.jsx("iframe", {
                                                    width: "210",
                                                    height: "300",
                                                    src: "https://www.youtube.com/embed/PQ5p92DN0bs",
                                                    title: "YouTube video player",
                                                    frameBorder: 0,
                                                    allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
                                                    allowFullScreen: true
                                                }),
                                                /*#__PURE__*/ jsx_runtime_.jsx("br", {})
                                            ]
                                        })
                                    ]
                                }),
                                image: sandboxProjectId ? undefined : splashImage ? splashImage : cocalc_screenshot_20200128_nq8,
                                aboveImage: renderAboveImage(),
                                alt: "Screenshot showing CoCalc in action!",
                                indexInfo: indexInfo
                            }),
                            /*#__PURE__*/ jsx_runtime_.jsx(footer/* default */.Z, {})
                        ]
                    })
                ]
            })
        ]
    });
};
async function getServerSideProps(context) {
    const isAuthenticated = await (0,get_account/* default */.Z)(context.req) != null;
    const pool = pool_default()("long");
    const { rows  } = await pool.query("select value from server_settings where name='share_server'");
    let publicPaths;
    if (rows.length > 0 && rows[0].value == "yes") {
        const { rows: rows1  } = await pool.query(`SELECT id, path, url, description, ${(0,dist_pool.timeInSeconds)("last_edited")},
    counter::INT,
     (SELECT COUNT(*)::INT FROM public_path_stars WHERE public_path_id=id) AS stars
    FROM public_paths
    WHERE vhost IS NULL AND disabled IS NOT TRUE AND unlisted IS NOT TRUE AND
    ((authenticated IS TRUE AND $1 IS TRUE) OR (authenticated IS NOT TRUE))
    ORDER BY stars DESC,last_edited DESC LIMIT $2`, [
            isAuthenticated,
            150
        ]);
        publicPaths = rows1;
    } else {
        publicPaths = null;
    }
    return await (0,with_customize/* default */.Z)({
        context,
        props: {
            publicPaths
        }
    }, {
        name: true
    });
}


/***/ }),

/***/ 883996:
/***/ ((__unused_webpack_module, exports) => {

var __webpack_unused_export__;

/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
__webpack_unused_export__ = ({ value: true });
exports.Le = exports.h1 = exports.rD = void 0;
/**
 * User Interface specific constants
 */
// icon name used for shared files, only accessible for authenticated users
exports.rD = "user";
exports.h1 = "only visible to those who are signed in";
// boolean flags for various shared files visibility modes
exports.Le = {
    LISTED: { unlisted: false, disabled: false, authenticated: false },
    UNLISTED: { unlisted: true, disabled: false, authenticated: false },
    DISABLED: { unlisted: false, disabled: true, authenticated: false },
    AUTHENTICATED: { unlisted: false, disabled: false, authenticated: true },
};
//# sourceMappingURL=ui.js.map

/***/ }),

/***/ 545725:
/***/ ((module) => {

module.exports = require("antd");

/***/ }),

/***/ 770640:
/***/ ((module) => {

module.exports = require("cookies");

/***/ }),

/***/ 65680:
/***/ ((module) => {

module.exports = require("lru-cache");

/***/ }),

/***/ 903280:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/app-router-context.js");

/***/ }),

/***/ 492796:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/head-manager-context.js");

/***/ }),

/***/ 294957:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/head.js");

/***/ }),

/***/ 703539:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/i18n/detect-domain-locale.js");

/***/ }),

/***/ 734014:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/i18n/normalize-locale-path.js");

/***/ }),

/***/ 450744:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/image-config-context.js");

/***/ }),

/***/ 435843:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/image-config.js");

/***/ }),

/***/ 278524:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/is-plain-object.js");

/***/ }),

/***/ 878020:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/mitt.js");

/***/ }),

/***/ 664406:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/page-path/denormalize-page-path.js");

/***/ }),

/***/ 424964:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router-context.js");

/***/ }),

/***/ 493431:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/add-locale.js");

/***/ }),

/***/ 611751:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/add-path-prefix.js");

/***/ }),

/***/ 746220:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/compare-states.js");

/***/ }),

/***/ 110299:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/format-next-pathname-info.js");

/***/ }),

/***/ 623938:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/format-url.js");

/***/ }),

/***/ 329565:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/get-asset-path-from-route.js");

/***/ }),

/***/ 735789:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/get-next-pathname-info.js");

/***/ }),

/***/ 901428:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/is-dynamic.js");

/***/ }),

/***/ 528854:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/parse-path.js");

/***/ }),

/***/ 491292:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/parse-relative-url.js");

/***/ }),

/***/ 734567:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/path-has-prefix.js");

/***/ }),

/***/ 980979:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/querystring.js");

/***/ }),

/***/ 393297:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/remove-trailing-slash.js");

/***/ }),

/***/ 836052:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/resolve-rewrites.js");

/***/ }),

/***/ 584226:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/route-matcher.js");

/***/ }),

/***/ 95052:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/router/utils/route-regex.js");

/***/ }),

/***/ 359232:
/***/ ((module) => {

module.exports = require("next/dist/shared/lib/utils.js");

/***/ }),

/***/ 40968:
/***/ ((module) => {

module.exports = require("next/head");

/***/ }),

/***/ 371853:
/***/ ((module) => {

module.exports = require("next/router");

/***/ }),

/***/ 616689:
/***/ ((module) => {

module.exports = require("react");

/***/ }),

/***/ 566405:
/***/ ((module) => {

module.exports = require("react-dom");

/***/ }),

/***/ 271704:
/***/ ((module) => {

module.exports = require("react-google-recaptcha-v3");

/***/ }),

/***/ 920997:
/***/ ((module) => {

module.exports = require("react/jsx-runtime");

/***/ }),

/***/ 439491:
/***/ ((module) => {

module.exports = require("assert");

/***/ }),

/***/ 714300:
/***/ ((module) => {

module.exports = require("buffer");

/***/ }),

/***/ 706113:
/***/ ((module) => {

module.exports = require("crypto");

/***/ }),

/***/ 809523:
/***/ ((module) => {

module.exports = require("dns");

/***/ }),

/***/ 582361:
/***/ ((module) => {

module.exports = require("events");

/***/ }),

/***/ 657147:
/***/ ((module) => {

module.exports = require("fs");

/***/ }),

/***/ 241808:
/***/ ((module) => {

module.exports = require("net");

/***/ }),

/***/ 822037:
/***/ ((module) => {

module.exports = require("os");

/***/ }),

/***/ 371017:
/***/ ((module) => {

module.exports = require("path");

/***/ }),

/***/ 677282:
/***/ ((module) => {

module.exports = require("process");

/***/ }),

/***/ 285477:
/***/ ((module) => {

module.exports = require("punycode");

/***/ }),

/***/ 12781:
/***/ ((module) => {

module.exports = require("stream");

/***/ }),

/***/ 371576:
/***/ ((module) => {

module.exports = require("string_decoder");

/***/ }),

/***/ 924404:
/***/ ((module) => {

module.exports = require("tls");

/***/ }),

/***/ 76224:
/***/ ((module) => {

module.exports = require("tty");

/***/ }),

/***/ 257310:
/***/ ((module) => {

module.exports = require("url");

/***/ }),

/***/ 473837:
/***/ ((module) => {

module.exports = require("util");

/***/ })

};
;

// load runtime
var __webpack_require__ = require("../webpack-runtime.js");
__webpack_require__.C(exports);
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
var __webpack_exports__ = __webpack_require__.X(0, [6918,582,676,1746,1664,7545,3734,5373,6975,9715,9554,9066,981,5997,6202,7264,722,9924,5379,6087,6009,6952,5863,8572,4868,5123,3722,9270], () => (__webpack_exec__(650923)));
module.exports = __webpack_exports__;

})();