{"version":3,"file":"static/chunks/pages/protection/uci-f188508fb563b941.js","mappings":"AACA","sources":["webpack://_N_E/?26c9","webpack://_N_E/./src/api/uci.ts","webpack://_N_E/./src/pages/protection/uci.tsx","webpack://_N_E/"],"sourcesContent":["\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/protection/uci\",\n function () {\n return require(\"private-next-pages/protection/uci.tsx\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/protection/uci\"])\n });\n }\n ","import { toQueryString } from \"src/utils/misc\";\nimport { api } from \".\";\nexport const fetchUCI = async (param)=>{\n let { id , type } = param;\n const { data } = await api.get(\"/uci\".concat(toQueryString({\n id,\n type\n })));\n return data;\n};\nexport const fetchUCIList = async (params)=>{\n const { data } = await api.get(\"/uci/list\".concat(toQueryString({\n ...params\n })));\n return data;\n};\n","import { _ as _tagged_template_literal } from \"@swc/helpers/_/_tagged_template_literal\";\nfunction _templateObject() {\n const data = _tagged_template_literal([\n \"\\n display: flex;\\n flex-direction: column;\\n align-items: center;\\n justify-content: center;\\n\\n > div {\\n width: 100%;\\n display: flex;\\n align-items: center;\\n flex-direction: column;\\n }\\n\\n > div:first-child {\\n gap: 20px;\\n padding: 80px 0;\\n background-color: \",\n \";\\n\\n > h1 {\\n font-size: 48px;\\n font-weight: 700;\\n color: \",\n \";\\n }\\n }\\n\\n > div:nth-child(2) {\\n background-color: \",\n \";\\n padding: 80px 30px;\\n gap: 40px;\\n font-size: 24px;\\n font-weight: 700;\\n text-align: center;\\n }\\n\\n > div:last-child {\\n background-color: \",\n \";\\n max-width: 1200px;\\n padding: 0 30px;\\n > p {\\n font-size: 24px;\\n font-weight: 600;\\n }\\n }\\n form {\\n width: 100%;\\n max-width: 996px;\\n display: flex;\\n align-items: center;\\n flex-direction: column;\\n background-color: #fff;\\n position: relative;\\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);\\n padding: 32px 20px;\\n p {\\n font-size: 24px;\\n margin-bottom: 52px;\\n }\\n input {\\n width: 100%;\\n max-width: 680px;\\n border: unset;\\n border-bottom: 2px solid \",\n \";\\n display: inline-block;\\n margin-bottom: 36px;\\n text-align: center;\\n padding-bottom: 16px;\\n font-size: 24px;\\n &:focus {\\n outline: none !important;\\n border-bottom: 2px solid \",\n \";\\n }\\n ::placeholder {\\n text-align: center;\\n color: #d1d3d6;\\n font-weight: 700;\\n }\\n }\\n button {\\n max-width: 384px;\\n width: 100%;\\n font-size: 24px;\\n height: 56px;\\n }\\n }\\n @media (max-width: 768px) {\\n > div:first-child > h1 {\\n font-size: 32px;\\n }\\n > div:nth-child(2) {\\n font-size: 18px;\\n }\\n form > p {\\n font-size: 18px;\\n }\\n form > input {\\n font-size: 18px;\\n }\\n form > button {\\n font-size: 18px;\\n height: 36px;\\n }\\n }\\n\"\n ]);\n _templateObject = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject1() {\n const data = _tagged_template_literal([\n \"\\n //border-bottom: 1px solid \",\n \";\\n margin-bottom: 80px;\\n width: 100%;\\n min-width: 996px;\\n thead {\\n font-weight: 600;\\n background-color: \",\n \";\\n border-bottom: 1px solid \",\n \";\\n border-top: 1px solid \",\n \";\\n tr {\\n text-align: center;\\n }\\n }\\n\\n th,\\n td {\\n text-align: center;\\n font-size: 16px;\\n padding: 16px 24px;\\n line-height: 1.5;\\n }\\n\\n tbody {\\n td {\\n vertical-align: top;\\n }\\n }\\n .empty {\\n text-align: center;\\n width: 100%;\\n background-color: rgba(27, 27, 41, 0.03);\\n color: \",\n \";\\n }\\n\"\n ]);\n _templateObject1 = function() {\n return data;\n };\n return data;\n}\nfunction _templateObject2() {\n const data = _tagged_template_literal([\n \"\\n overflow: auto;\\n width: 100%;\\n\"\n ]);\n _templateObject2 = function() {\n return data;\n };\n return data;\n}\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport styled from \"styled-components\";\nimport { View } from \"@/components\";\nimport Icon from \"@/components/icon/Icon\";\nimport { UCILogo_w } from \"@/components/icon/IconList\";\nimport { Button } from \"antd\";\nimport { useForm } from \"../../utils/form\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { fetchUCI } from \"../../api/uci\";\nimport { useState } from \"react\";\nconst uciType = {\n handout: \"수업자료\",\n quiz: \"문제\"\n};\nconst UciPage = ()=>{\n const [item, setItem] = useState(null);\n const queryClient = useQueryClient();\n const CODE_LENGTH = 21;\n const { values , setValue , submit , isSubmitting , isValidated , reset } = useForm({\n code: \"\"\n }, {\n validator: (values)=>{\n const isValid = values.code.length === CODE_LENGTH;\n return [\n isValid,\n isValid ? undefined : \"UCI 코드는 21자리 입니다.\"\n ];\n },\n onSubmit: async (done, param)=>{\n let { isValid , message } = param;\n if (isValid) {\n try {\n await fetchUciCode(values.code);\n alert(\"UCI코드가 조회되었습니다.\");\n reset();\n } catch (e) {\n var _e_response, _e_response_data;\n alert(\"\".concat((e === null || e === void 0 ? void 0 : (_e_response = e.response) === null || _e_response === void 0 ? void 0 : (_e_response_data = _e_response.data) === null || _e_response_data === void 0 ? void 0 : _e_response_data.message) || e.message));\n done();\n }\n } else {\n alert(\"\".concat(message));\n }\n done();\n }\n });\n const fetchUciCode = async (code)=>{\n const data = await queryClient.fetchQuery([\n \"fetchUciCode\",\n code\n ], ()=>fetchUCI({\n id: code.split(\"-\")[1],\n type: \"uci\"\n }));\n setItem(data.uci);\n };\n return /*#__PURE__*/ _jsxs(UciPageWrapper, {\n children: [\n /*#__PURE__*/ _jsxs(\"div\", {\n children: [\n /*#__PURE__*/ _jsx(Icon, {\n icon: UCILogo_w\n }),\n /*#__PURE__*/ _jsx(\"h1\", {\n children: \"UCI 코드를 조회해보세요\"\n })\n ]\n }),\n /*#__PURE__*/ _jsxs(\"div\", {\n children: [\n /*#__PURE__*/ _jsxs(\"p\", {\n children: [\n \"UCI 코드를 조회하여 \",\n /*#__PURE__*/ _jsx(\"br\", {}),\n \"정당한 저작권 이용 여부를 확인하세요.\"\n ]\n }),\n /*#__PURE__*/ _jsxs(\"form\", {\n onSubmit: (e)=>{\n e.preventDefault();\n submit();\n },\n children: [\n /*#__PURE__*/ _jsx(\"p\", {\n children: \"UCI 코드 조회\"\n }),\n /*#__PURE__*/ _jsx(\"input\", {\n onChange: (e)=>setValue(\"code\", e.target.value),\n name: \"code\",\n maxLength: CODE_LENGTH,\n value: values.code,\n type: \"text\",\n placeholder: \"UCI 코드를 입력하세요\"\n }),\n /*#__PURE__*/ _jsx(Button, {\n loading: isSubmitting,\n disabled: !isValidated,\n onClick: submit,\n type: \"primary\",\n children: \"조회\"\n })\n ]\n })\n ]\n }),\n /*#__PURE__*/ _jsxs(\"div\", {\n children: [\n /*#__PURE__*/ _jsx(\"p\", {\n children: \"조회 결과\"\n }),\n /*#__PURE__*/ _jsx(ScrollArea, {\n children: /*#__PURE__*/ _jsxs(UciResultTable, {\n children: [\n /*#__PURE__*/ _jsx(\"thead\", {\n children: /*#__PURE__*/ _jsxs(\"tr\", {\n children: [\n /*#__PURE__*/ _jsx(\"th\", {\n children: \"UCI 코드\"\n }),\n /*#__PURE__*/ _jsx(\"th\", {\n children: \"구분\"\n }),\n (item === null || item === void 0 ? void 0 : item.data_type) === \"quiz\" && /*#__PURE__*/ _jsx(\"th\", {\n children: \"문제번호\"\n }),\n /*#__PURE__*/ _jsx(\"th\", {\n children: \"자료명\"\n })\n ]\n })\n }),\n /*#__PURE__*/ _jsx(\"tbody\", {\n children: item ? /*#__PURE__*/ _jsxs(\"tr\", {\n children: [\n /*#__PURE__*/ _jsx(\"td\", {\n children: item.uci_code\n }),\n /*#__PURE__*/ _jsx(\"td\", {\n children: uciType[item.data_type]\n }),\n item.data_type === \"quiz\" && /*#__PURE__*/ _jsx(\"th\", {\n children: item.total_quiz\n }),\n /*#__PURE__*/ _jsx(\"td\", {\n children: item.title\n })\n ]\n }) : /*#__PURE__*/ _jsx(\"tr\", {\n children: /*#__PURE__*/ _jsx(\"td\", {\n className: \"empty\",\n colSpan: 3,\n children: \"조회결과가 없습니다.\"\n })\n })\n })\n ]\n })\n })\n ]\n })\n ]\n });\n};\nexport default UciPage;\nconst UciPageWrapper = styled(View).withConfig({\n componentId: \"sc-70afe9d7-0\"\n})(_templateObject(), (props)=>props.theme.new.colors.gray900, (props)=>props.theme.new.colors.white, (props)=>props.theme.new.colors.gray30, (props)=>props.theme.new.colors.gray30, (props)=>props.theme.new.colors.black, (props)=>props.theme.new.colors.primary);\nconst UciResultTable = styled.table.withConfig({\n componentId: \"sc-70afe9d7-1\"\n})(_templateObject1(), (props)=>props.theme.new.colors.gray200, (props)=>props.theme.new.colors.bg.gray, (props)=>props.theme.new.colors.gray100, (props)=>props.theme.new.colors.gray100, (props)=>props.theme.new.colors.gray600);\nconst ScrollArea = styled.div.withConfig({\n componentId: \"sc-70afe9d7-2\"\n})(_templateObject2());\n"],"names":[],"sourceRoot":""}