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AS,CACxBC,MAAOkF,EAAAA,EAAoBA,GAEvB,CAAEC,UAAAA,CAAS,CAAE,CAAGnJ,CAAAA,EAAAA,EAAAA,CAAAA,IAChBoJ,EAAetF,GAAMuF,aAAaC,gBACxC,GAAsBF,EAAaG,QAAQ,CAACC,EAAAA,EAAWA,CAACC,KAAK,EAKtD,UAAC9B,EAAAA,CAAAA,IAJNwB,IACO,KAIX,C","sources":["webpack://@affine/web/../core/src/components/admin-panel/index.css.ts","webpack://@affine/web/../core/src/components/admin-panel/admin-panel-header.tsx","webpack://@affine/web/../core/src/components/admin-panel/collapsible-item.tsx","webpack://@affine/web/../core/src/components/admin-panel/runtime-setting-row.tsx","webpack://@affine/web/../core/src/components/admin-panel/use-get-server-runtime-config.ts","webpack://@affine/web/../core/src/components/admin-panel/utils.tsx","webpack://@affine/web/../core/src/components/admin-panel/use-update-server-runtime-config.ts","webpack://@affine/web/../core/src/pages/admin-panel.tsx","webpack://@affine/web/../core/src/pages/admin-panel.css.ts"],"sourcesContent":["import \"../core/src/components/admin-panel/index.css.ts.vanilla.css!=!../../../../../../node_modules/@vanilla-extract/webpack-plugin/virtualFileLoader/dist/vanilla-extract-webpack-plugin-virtualFileLoader.cjs.js?{\\\"fileName\\\":\\\"../core/src/components/admin-panel/index.css.ts.vanilla.css\\\",\\\"source\\\":\\\"#H4sIAAAAAAAAA7VWTY/bIBC976/gUil7ILKT3XSXVf9Hq6oHYsY2jQ0USOyk2v9eGQix8+VkV70k8sA8Ho83DNOdTf88Nwn6+4BQw5ktCUqT5MvbA0KMG1XRLUF5BW0X+L02ludbnElhQViCjKIZ4CXYBkB0M2jFC4G5hdoQlIGwoLuwooxxURCUzlSL0oVycEupGWi8lNbKmqBUtcjIijO0oXqCMc1zLgCHWZmspH7s0gqqCHrxEEoabrkUBBnLs9XWwdJsVWi5FswnkSO8w7DSvKZ628PeYS4YtATN3h7eH6ZenNSJk0thseE7IGg+86tna206fCW532lMmR2nDCi4eInnbkn30QAvSkvQUlbsrPQXhO1r0ZTcAnZHQpDSgBtNVTdgobXYAfRTTw5zPxQ3Mb/JFN0/ZlxD5g8ik9W6FnGkI0GQpxKRnxzyCdTRUifyXpShkZrhpQa6Isj9YVpVccBT8PEu8DZ2NEtq4PLZODmtpsLkUtcEZVRxSyu+A0f6jOVcxqnZgrM1ZXxtCHoKlt7XSviuqS64iFXiogchSSk3oJ2cI753E+PqPYQNN9wCcxg3sz/k/2TUUkwzyzfwzeo1/DpicxuPZ5fVk1VLSy1M8GvCoHB6ucFQ7nEiSqYz08fxfKQC0WNziutQfbyiFn5M5qrtfX+f4C7QA17c5NnL1XCvR+PCX8fvElM/XiiYcY+hNNwfdzj3WgkceH/amy/nLqA7aA62mQwK5+WTtn91eTVtcaD3ukhCvXKBy3BlpEkInthm0MRid1x0PM+0xmT6fFNzjPToebNedqfjE9wRdrTo9I6Iyw8hhh1eNW9rHu8810DwyRti0BMcHxD9+snG6+f6hX9/dzm6sxcD67FxPmOSGMikYLd0k75Bjh9Cxw+r2x9O59aPLu6eeHsn9ZRbASgvXFQC/ocSET2/3odGtvPB2ulX/2J4Bpfu4PgmDj+zQd+38lBG3S2ZV7IhqOSM+Rf3HWUz3kKidsX1a7HkRVl1m8S51BBU1MCObHQ9dT/fhRlkUlOvbOUml1qui7KnhPaqzgbFVH6AaKEBxF1U9xnv/wBpQptfLw0AAA==\\\"}!../../../../../../node_modules/@vanilla-extract/webpack-plugin/extracted.js\"\nexport var LeftItem = 'zt1q5wa';\nexport var RightItem = 'zt1q5wb';\nexport var arrowIcon = 'zt1q5w5';\nexport var changedValues = 'zt1q5wf';\nexport var collapsibleContainer = 'zt1q5w6';\nexport var expiredValue = 'zt1q5wg';\nexport var header = 'zt1q5w0';\nexport var logo = 'zt1q5w1';\nexport var navText = 'zt1q5w8';\nexport var newValue = 'zt1q5wh';\nexport var outLine = 'zt1q5w3';\nexport var outLineContent = 'zt1q5w7';\nexport var outLineHeader = 'zt1q5w4';\nexport var settingItem = 'zt1q5w9';\nexport var settingItemDescription = 'zt1q5we';\nexport var settingItemId = 'zt1q5wd';\nexport var settingItemTitle = 'zt1q5wc';\nexport var title = 'zt1q5w2';","import { Button, useConfirmModal } from '@affine/component';\nimport { useNavigateHelper } from '@affine/core/hooks/use-navigate-helper';\nimport { ArrowRightBigIcon, Logo1Icon } from '@blocksuite/icons/rc';\nimport { useCallback } from 'react';\n\nimport * as styles from './index.css';\n\nexport type ModifiedValues = {\n id: string;\n expiredValue: any;\n newValue: any;\n};\n\nexport const AdminPanelHeader = ({\n modifiedValues,\n onConfirm,\n}: {\n modifiedValues: ModifiedValues[];\n onConfirm: () => void;\n}) => {\n const { openConfirmModal } = useConfirmModal();\n const { jumpToIndex } = useNavigateHelper();\n\n const handleJumpToIndex = useCallback(() => jumpToIndex(), [jumpToIndex]);\n\n return (\n
\n \n
\n After editing, please click the Save button on the right.\n \n
\n
\n {\n openConfirmModal({\n title: 'Save Runtime Configurations ?',\n description:\n 'Are you sure you want to save the following changes?',\n confirmText: 'Save',\n confirmButtonOptions: {\n variant: 'primary',\n },\n onConfirm: onConfirm,\n children:\n modifiedValues.length > 0 ? (\n
\n                    

{'{'}

\n {modifiedValues.map(({ id, expiredValue, newValue }) => (\n

\n {' '} {id}:{' '}\n \n {JSON.stringify(expiredValue)}\n \n \n {JSON.stringify(newValue)}\n \n ,\n

\n ))}\n

{'}'}

\n
\n ) : (\n 'There is no change.'\n ),\n });\n }}\n >\n Save\n \n
\n
\n );\n};\n","import { ArrowDownSmallIcon } from '@blocksuite/icons/rc';\nimport * as Collapsible from '@radix-ui/react-collapsible';\nimport { useCallback, useState } from 'react';\n\nimport * as styles from './index.css';\n\nexport const CollapsibleItem = ({\n items,\n initialOpen = false,\n title,\n currentModule,\n changeModule,\n}: {\n title: string;\n items: string[];\n initialOpen?: boolean;\n currentModule?: string;\n changeModule?: (module: string) => void;\n}) => {\n const [open, setOpen] = useState(initialOpen);\n\n const handleClick = useCallback(\n (id: string, event?: React.MouseEvent) => {\n event?.preventDefault();\n const targetElement = document.getElementById(id);\n if (targetElement) {\n targetElement.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n });\n }\n changeModule?.(title);\n },\n [changeModule, title]\n );\n\n return (\n \n \n \n \n \n handleClick(title, e)}\n >\n {title}\n \n \n\n
\n {items.map((item, index) => (\n handleClick(item)}\n >\n \n {item}\n \n \n ))}\n
\n \n );\n};\n","import { type ReactNode } from 'react';\n\nimport * as styles from './index.css';\n\nexport const RuntimeSettingRow = ({\n id,\n description,\n lastUpdatedTime,\n operation,\n children,\n}: {\n id: string;\n description: string;\n lastUpdatedTime: string;\n operation: ReactNode;\n children: ReactNode;\n}) => {\n const formatTime = new Date(lastUpdatedTime).toLocaleString();\n return (\n
\n
\n
{description}
\n
\n {id}\n
\n
\n last updated at: {formatTime}\n
\n
\n
\n {operation}\n {children}\n
\n
\n );\n};\n","import { useQuery } from '@affine/core/hooks/use-query';\nimport { getServerRuntimeConfigQuery } from '@affine/graphql';\nimport { useMemo } from 'react';\n\nexport const useGetServerRuntimeConfig = () => {\n const { data } = useQuery({\n query: getServerRuntimeConfigQuery,\n });\n\n const serverRuntimeConfig = useMemo(\n () =>\n data?.serverRuntimeConfig.sort((a, b) => a.id.localeCompare(b.id)) ?? [],\n [data]\n );\n\n // collect all the modules and config keys in each module\n const moduleList = useMemo(() => {\n const moduleMap: { [key: string]: string[] } = {};\n\n serverRuntimeConfig.forEach(config => {\n if (!moduleMap[config.module]) {\n moduleMap[config.module] = [];\n }\n moduleMap[config.module].push(config.key);\n });\n\n return Object.keys(moduleMap)\n .sort((a, b) => a.localeCompare(b))\n .map(moduleName => ({\n moduleName,\n keys: moduleMap[moduleName].sort((a, b) => a.localeCompare(b)),\n }));\n }, [serverRuntimeConfig]);\n\n // group config by module name\n const configGroup = useMemo(() => {\n const configMap = new Map();\n\n serverRuntimeConfig.forEach(config => {\n if (!configMap.has(config.module)) {\n configMap.set(config.module, []);\n }\n configMap.get(config.module)?.push(config);\n });\n\n return Array.from(configMap.entries()).map(([moduleName, configs]) => ({\n moduleName,\n configs,\n }));\n }, [serverRuntimeConfig]);\n\n return {\n serverRuntimeConfig,\n moduleList,\n configGroup,\n };\n};\n","import { Input, Switch } from '@affine/component';\nimport type { RuntimeConfigType } from '@affine/graphql';\n\nexport const renderInput = (\n type: RuntimeConfigType,\n value: any,\n onChange: (value?: any) => void\n) => {\n switch (type) {\n case 'Boolean':\n return ;\n case 'String':\n return (\n \n );\n case 'Number':\n return (\n
\n \n
\n );\n // TODO(@JimmFly): add more types\n default:\n return null;\n }\n};\n\nexport const isEqual = (a: any, b: any) => {\n if (typeof a !== typeof b) return false;\n if (typeof a === 'object') return JSON.stringify(a) === JSON.stringify(b);\n return a === b;\n};\n\nexport const formatValue = (value: any) => {\n if (typeof value === 'object') return JSON.stringify(value);\n return value.toString();\n};\n\nexport const formatValueForInput = (value: any, type: RuntimeConfigType) => {\n let newValue = null;\n switch (type) {\n case 'Boolean':\n newValue = !!value;\n break;\n case 'String':\n newValue = value;\n break;\n case 'Number':\n newValue = Number(value);\n break;\n case 'Array':\n newValue = value.split(',');\n break;\n case 'Object':\n newValue = JSON.parse(value);\n break;\n default:\n break;\n }\n return newValue;\n};\n","import { notify } from '@affine/component';\nimport { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';\nimport {\n useMutateQueryResource,\n useMutation,\n} from '@affine/core/hooks/use-mutation';\nimport {\n getServerRuntimeConfigQuery,\n updateServerRuntimeConfigsMutation,\n} from '@affine/graphql';\n\nexport const useUpdateServerRuntimeConfigs = () => {\n const { trigger, isMutating } = useMutation({\n mutation: updateServerRuntimeConfigsMutation,\n });\n const revalidate = useMutateQueryResource();\n\n return {\n trigger: useAsyncCallback(\n async (values: any) => {\n try {\n await trigger(values);\n await revalidate(getServerRuntimeConfigQuery);\n notify.success({\n title: 'Saved successfully',\n message: 'Runtime configurations have been saved successfully.',\n });\n } catch (e) {\n notify.error({\n title: 'Failed to save',\n message:\n 'Failed to save runtime configurations, please try again later.',\n });\n console.error(e);\n }\n },\n [revalidate, trigger]\n ),\n isMutating,\n };\n};\n","import { Scrollable } from '@affine/component';\nimport type { RuntimeConfigType } from '@affine/graphql';\nimport { FeatureType, getUserFeaturesQuery } from '@affine/graphql';\nimport { useCallback, useMemo, useState } from 'react';\n\nimport {\n AdminPanelHeader,\n CollapsibleItem,\n formatValue,\n formatValueForInput,\n isEqual,\n type ModifiedValues,\n renderInput,\n RuntimeSettingRow,\n useGetServerRuntimeConfig,\n} from '../components/admin-panel';\nimport { useUpdateServerRuntimeConfigs } from '../components/admin-panel/use-update-server-runtime-config';\nimport { useNavigateHelper } from '../hooks/use-navigate-helper';\nimport { useQuery } from '../hooks/use-query';\nimport * as styles from './admin-panel.css';\n\nexport const AdminPanel = () => {\n const { serverRuntimeConfig, moduleList, configGroup } =\n useGetServerRuntimeConfig();\n\n const [currentModule, setCurrentModule] = useState(\n moduleList[0].moduleName\n );\n\n const { trigger } = useUpdateServerRuntimeConfigs();\n\n const [configValues, setConfigValues] = useState(\n serverRuntimeConfig.reduce(\n (acc, config) => {\n acc[config.id] = config.value;\n return acc;\n },\n {} as Record\n )\n );\n\n const handleInputChange = useCallback(\n (key: string, value: any, type: RuntimeConfigType) => {\n const newValue = formatValueForInput(value, type);\n setConfigValues(prevValues => ({\n ...prevValues,\n [key]: newValue,\n }));\n },\n []\n );\n\n const modifiedValues: ModifiedValues[] = useMemo(() => {\n return serverRuntimeConfig\n .filter(config => !isEqual(config.value, configValues[config.id]))\n .map(config => ({\n id: config.id,\n key: config.key,\n expiredValue: config.value,\n newValue: configValues[config.id],\n }));\n }, [configValues, serverRuntimeConfig]);\n\n const handleSave = useCallback(() => {\n // post value example: { \"key1\": \"newValue1\",\"key2\": \"newValue2\"}\n const updates: Record = {};\n\n modifiedValues.forEach(item => {\n if (item.id && item.newValue !== undefined) {\n updates[item.id] = item.newValue;\n }\n });\n trigger({ updates });\n }, [modifiedValues, trigger]);\n\n return (\n
\n
\n
\n {moduleList.map(module => (\n \n ))}\n
\n
\n \n \n \n
\n {configGroup\n .filter(group => group.moduleName === currentModule)\n .map(group => {\n const { moduleName, configs } = group;\n return (\n \n
{moduleName}
\n {configs?.map(config => {\n const { id, type, description, updatedAt } = config;\n const isValueEqual = isEqual(\n config.value,\n configValues[id]\n );\n const formatServerValue = formatValue(config.value);\n const formatCurrentValue = formatValue(\n configValues[id]\n );\n return (\n handleInputChange(id, value, type)\n )}\n >\n
\n {formatServerValue} => {formatCurrentValue}\n
\n \n );\n })}\n
\n );\n })}\n
\n \n \n \n
\n
\n \n );\n};\n\nexport const Component = () => {\n const { data } = useQuery({\n query: getUserFeaturesQuery,\n });\n const { jumpTo404 } = useNavigateHelper();\n const userFeatures = data?.currentUser?.features;\n if (!userFeatures || !userFeatures.includes(FeatureType.Admin)) {\n jumpTo404();\n return null;\n }\n\n return ;\n};\n","import \"../core/src/pages/admin-panel.css.ts.vanilla.css!=!../../../../../node_modules/@vanilla-extract/webpack-plugin/virtualFileLoader/dist/vanilla-extract-webpack-plugin-virtualFileLoader.cjs.js?{\\\"fileName\\\":\\\"../core/src/pages/admin-panel.css.ts.vanilla.css\\\",\\\"source\\\":\\\"LndpZjl5dTAgewogIGhlaWdodDogMTAwdmg7CiAgd2lkdGg6IDEwMHZ3OwogIGRpc3BsYXk6IGZsZXg7CiAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjsKICBmb250LXNpemU6IHZhcigtLWFmZmluZS1mb250LWJhc2UpOwogIHBvc2l0aW9uOiByZWxhdGl2ZTsKfQoud2lmOXl1MSB7CiAgZGlzcGxheTogZmxleDsKICB3aWR0aDogMTAwJTsKICBoZWlnaHQ6IDEwMCU7Cn0KLndpZjl5dTIgewogIHdpZHRoOiAzMDBweDsKICBkaXNwbGF5OiBmbGV4OwogIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47CiAgYm9yZGVyLXJpZ2h0OiAxcHggc29saWQgdmFyKC0tYWZmaW5lLWJvcmRlci1jb2xvcik7CiAgcGFkZGluZzogMTJweCA4cHg7CiAgaGVpZ2h0OiAxMDAlOwogIGJhY2tncm91bmQ6IHZhcigtLWFmZmluZS1iYWNrZ3JvdW5kLXByaW1hcnktY29sb3IpOwogIHotaW5kZXg6IDM7Cn0KLndpZjl5dTMgewogIHBhZGRpbmc6IDI0cHggMCAxNjBweDsKICBiYWNrZ3JvdW5kOiB2YXIoLS1hZmZpbmUtYmFja2dyb3VuZC1wcmltYXJ5LWNvbG9yKTsKfQoud2lmOXl1NCB7CiAgZGlzcGxheTogZmxleDsKICB3aWR0aDogMTAwJTsKICBmbGV4LWRpcmVjdGlvbjogY29sdW1uOwogIG92ZXJmbG93OiBhdXRvOwogIGFsaWduLWl0ZW1zOiBjZW50ZXI7Cn0KLndpZjl5dTUgewogIHdpZHRoOiAxMDAlOwogIGRpc3BsYXk6IGZsZXg7CiAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjsKICBwYWRkaW5nOiAxNnB4OwogIG1heC13aWR0aDogOTYwcHg7CiAgbWFyZ2luOiBhdXRvOwogIGdhcDogMTZweDsKfQoud2lmOXl1NiB7CiAgZm9udC1zaXplOiB2YXIoLS1hZmZpbmUtZm9udC1oLTUpOwogIGZvbnQtd2VpZ2h0OiBib2xkOwogIG1hcmdpbi1ib3R0b206IDhweDsKICB0ZXh0LXRyYW5zZm9ybTogY2FwaXRhbGl6ZTsKICBwYWRkaW5nOiAxNnB4IDA7CiAgYm9yZGVyLWJvdHRvbTogMC41cHggc29saWQgdmFyKC0tYWZmaW5lLWJvcmRlci1jb2xvcik7Cn0=\\\"}!../../../../../node_modules/@vanilla-extract/webpack-plugin/extracted.js\"\nexport var container = 'wif9yu1';\nexport var main = 'wif9yu4';\nexport var module = 'wif9yu6';\nexport var moduleContainer = 'wif9yu5';\nexport var root = 'wif9yu0';\nexport var scrollArea = 'wif9yu3';\nexport var sideBar = 'wif9yu2';"],"names":["navText","AdminPanelHeader","modifiedValues","onConfirm","openConfirmModal","useConfirmModal","jumpToIndex","useNavigateHelper","handleJumpToIndex","useCallback","div","className","Logo1Icon","onClick","span","ArrowRightBigIcon","Button","variant","disabled","length","title","description","confirmText","confirmButtonOptions","children","pre","p","map","id","expiredValue","newValue","JSON","stringify","CollapsibleItem","items","initialOpen","currentModule","changeModule","open","setOpen","useState","handleClick","event","preventDefault","targetElement","document","getElementById","scrollIntoView","behavior","block","Collapsible","onOpenChange","data-active","data-open","ArrowDownSmallIcon","a","styles","href","e","item","index","RuntimeSettingRow","lastUpdatedTime","operation","formatTime","Date","toLocaleString","code","useGetServerRuntimeConfig","data","useQuery","query","getServerRuntimeConfigQuery","serverRuntimeConfig","useMemo","sort","b","localeCompare","moduleList","moduleMap","forEach","config","module","push","key","Object","keys","moduleName","configGroup","configMap","Map","has","set","get","Array","from","entries","configs","renderInput","type","value","onChange","Switch","checked","Input","minLength","style","width","isEqual","formatValue","toString","formatValueForInput","Number","split","parse","useUpdateServerRuntimeConfigs","trigger","isMutating","useMutation","mutation","updateServerRuntimeConfigsMutation","revalidate","useMutateQueryResource","useAsyncCallback","values","notify","success","message","error","console","AdminPanel","setCurrentModule","configValues","setConfigValues","reduce","acc","handleInputChange","prevValues","filter","handleSave","updates","undefined","Scrollable","Root","Viewport","group","updatedAt","isValueEqual","formatServerValue","formatCurrentValue","opacity","Scrollbar","Component","getUserFeaturesQuery","jumpTo404","userFeatures","currentUser","features","includes","FeatureType","Admin"],"sourceRoot":""}