@easyv/biz-components 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ai-model-select/ai-model-select-panel.d.ts +2 -0
- package/dist/components/ai-model-select/ai-model-select-panel.es.js +41 -4
- package/dist/components/ai-model-select/ai-model-select-panel.es.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/tailwindcss.pkg.css +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InputRef } from 'antd';
|
|
1
2
|
import { AiModel, AiModelServiceProvider } from './types';
|
|
2
3
|
|
|
3
4
|
export interface AiModelSelectPanelProps {
|
|
@@ -16,6 +17,7 @@ export interface AiModelSelectPanelProps {
|
|
|
16
17
|
onChange: (value: string) => void;
|
|
17
18
|
onPressEnter: () => void;
|
|
18
19
|
onBlur: () => void;
|
|
20
|
+
ref: React.Ref<InputRef>;
|
|
19
21
|
}) => React.ReactNode;
|
|
20
22
|
}
|
|
21
23
|
export declare const AiModelSelectPanel: (props: AiModelSelectPanelProps) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useRef, useState, useEffect } from "react";
|
|
3
3
|
import { PlusOutlined, EditOutlined } from "../../node_modules/.pnpm/@easyv_react-icons@6.3.0/node_modules/@easyv/react-icons/dist/index.esm.es.js";
|
|
4
4
|
import classNames from "../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js";
|
|
5
5
|
import { produce } from "../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/dist/immer.es.js";
|
|
@@ -15,14 +15,44 @@ const AiModelSelectPanel = (props) => {
|
|
|
15
15
|
itemClassName,
|
|
16
16
|
renderInput
|
|
17
17
|
} = props;
|
|
18
|
+
const inputRef = useRef(null);
|
|
18
19
|
const [customModelServiceProviderList, setCustomModelServiceProviderList] = useState(
|
|
19
20
|
modelServiceProviderList.filter((item) => item.isCustom)
|
|
20
21
|
);
|
|
21
22
|
const [showInputProviderId, setShowInputProviderId] = useState("");
|
|
22
23
|
const [inputValue, setInputValue] = useState("");
|
|
23
24
|
const otherModelServiceProviderList = modelServiceProviderList.filter((item) => !item.isCustom);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!showInputProviderId) return;
|
|
27
|
+
const focusTimer = setTimeout(() => {
|
|
28
|
+
var _a;
|
|
29
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
30
|
+
}, 0);
|
|
31
|
+
const scrollTimer = setTimeout(() => {
|
|
32
|
+
const targetElement = document.querySelector(`[data-provider-id="${showInputProviderId}"]`);
|
|
33
|
+
if (targetElement) {
|
|
34
|
+
targetElement.scrollIntoView({
|
|
35
|
+
behavior: "smooth",
|
|
36
|
+
block: "nearest",
|
|
37
|
+
inline: "nearest"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, 0);
|
|
41
|
+
return () => {
|
|
42
|
+
clearTimeout(focusTimer);
|
|
43
|
+
clearTimeout(scrollTimer);
|
|
44
|
+
};
|
|
45
|
+
}, [showInputProviderId]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
return () => {
|
|
48
|
+
setShowInputProviderId("");
|
|
49
|
+
setInputValue("");
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
24
52
|
const handleSelect = (modelProvider, model) => {
|
|
25
53
|
onSelect == null ? void 0 : onSelect(modelProvider, model);
|
|
54
|
+
setShowInputProviderId("");
|
|
55
|
+
setInputValue("");
|
|
26
56
|
};
|
|
27
57
|
const renderTitle = (modelProvider) => {
|
|
28
58
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -87,10 +117,16 @@ const AiModelSelectPanel = (props) => {
|
|
|
87
117
|
setInputValue("");
|
|
88
118
|
}
|
|
89
119
|
};
|
|
120
|
+
const handleBlur = () => {
|
|
121
|
+
if (!inputValue) {
|
|
122
|
+
setShowInputProviderId("");
|
|
123
|
+
}
|
|
124
|
+
};
|
|
90
125
|
const isSelected = (value == null ? void 0 : value.modelProviderId) === modelProvider.id && (value == null ? void 0 : value.modelId) === (model == null ? void 0 : model.id);
|
|
91
126
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
92
127
|
"div",
|
|
93
128
|
{
|
|
129
|
+
"data-provider-id": modelProvider.id,
|
|
94
130
|
className: classNames(
|
|
95
131
|
"biz-px-3 biz-py-[3px] biz-flex biz-items-center biz-gap-2",
|
|
96
132
|
"biz-text-text-2 biz-h-8 biz-w-full biz-box-border",
|
|
@@ -107,10 +143,11 @@ const AiModelSelectPanel = (props) => {
|
|
|
107
143
|
value: inputValue,
|
|
108
144
|
onChange: (value2) => setInputValue(value2),
|
|
109
145
|
onPressEnter: handlePressEnter,
|
|
110
|
-
onBlur:
|
|
146
|
+
onBlur: handleBlur,
|
|
147
|
+
ref: inputRef
|
|
111
148
|
}) : normalContent
|
|
112
149
|
},
|
|
113
|
-
model == null ? void 0 : model.id
|
|
150
|
+
(model == null ? void 0 : model.id) || `input-${modelProvider.id}`
|
|
114
151
|
);
|
|
115
152
|
};
|
|
116
153
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -118,7 +155,7 @@ const AiModelSelectPanel = (props) => {
|
|
|
118
155
|
{
|
|
119
156
|
style,
|
|
120
157
|
className: classNames(
|
|
121
|
-
"biz-bg-[#181B22] biz-border-one biz-rounded-[4px] biz-py-1",
|
|
158
|
+
"biz-bg-[#181B22] biz-border-one biz-rounded-[4px] biz-py-1 biz-h-[200px]",
|
|
122
159
|
"biz-flex biz-flex-col gap-1 biz-w-[160px] biz-max-h-[450px] biz-overflow-auto",
|
|
123
160
|
className
|
|
124
161
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-model-select-panel.es.js","sources":["../../../src/components/ai-model-select/ai-model-select-panel.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { EditOutlined, PlusOutlined } from '@easyv/react-icons';\nimport classNames from 'classnames';\nimport { produce } from 'immer';\nimport { IconBtn } from './iconBtn';\nimport { AiModel, AiModelServiceProvider } from './types';\n\nexport interface AiModelSelectPanelProps {\n className?: string;\n modelServiceProviderList: AiModelServiceProvider[];\n value?: {\n modelProviderId: string;\n modelId: string;\n };\n onSelect?: (AiModelServiceProvider: AiModelServiceProvider, model: AiModel) => void;\n style?: React.CSSProperties;\n titleClassName?: string;\n itemClassName?: string;\n renderInput: (props: {\n value: string;\n onChange: (value: string) => void;\n onPressEnter: () => void;\n onBlur: () => void;\n }) => React.ReactNode;\n}\n\nexport const AiModelSelectPanel = (props: AiModelSelectPanelProps) => {\n const {\n className = '',\n modelServiceProviderList,\n value,\n onSelect,\n style,\n titleClassName,\n itemClassName,\n renderInput,\n } = props;\n\n const [customModelServiceProviderList, setCustomModelServiceProviderList] = useState(\n modelServiceProviderList.filter((item) => item.isCustom),\n );\n const [showInputProviderId, setShowInputProviderId] = useState<string>('');\n const [inputValue, setInputValue] = useState<string>('');\n\n const otherModelServiceProviderList = modelServiceProviderList.filter((item) => !item.isCustom);\n\n const handleSelect = (modelProvider: AiModelServiceProvider, model: AiModel) => {\n onSelect?.(modelProvider, model);\n };\n\n const renderTitle = (modelProvider: AiModelServiceProvider) => {\n return (\n <div\n className={classNames(\n 'biz-h-6 biz-text-text-3 biz-px-3 biz-pt-1 biz-w-full',\n 'biz-flex biz-items-center biz-box-border biz-gap-2.5 biz-text-[14px]',\n titleClassName,\n )}\n title={modelProvider.name}\n >\n <div className='biz-w-0 biz-flex-1 biz-truncate'>{modelProvider.name}</div>\n {modelProvider.isCustom && modelProvider.modelList.length === 0 && (\n <IconBtn\n onClick={() => {\n setShowInputProviderId(modelProvider.id);\n }}\n icon={\n <PlusOutlined className='biz-w-3 biz-h-3 biz-text-text-2 hover:biz-text-text-1 biz-flex-center' />\n }\n />\n )}\n </div>\n );\n };\n\n const renderItem = (modelProvider: AiModelServiceProvider, model?: AiModel) => {\n if (modelProvider.isCustom) {\n if (modelProvider.id !== showInputProviderId && !modelProvider.modelList?.length) {\n return null;\n }\n }\n const normalContent = (\n <>\n <img src={modelProvider.iconSrc} className='biz-w-4 biz-h-4' />\n <div className='biz-truncate biz-w-0 biz-flex-1 biz-text-[14px]' title={model?.name}>\n {model?.name}\n </div>\n {modelProvider.isCustom && (\n <IconBtn\n onClick={(e) => {\n setShowInputProviderId(modelProvider.id);\n setInputValue(model?.name || '');\n e.stopPropagation();\n }}\n className='biz-hidden group-hover:!biz-flex'\n style={{ display: 'none' }}\n icon={\n <EditOutlined className='biz-w-3 biz-h-3 biz-text-text-2 hover:biz-text-text-1 biz-flex-center' />\n }\n />\n )}\n </>\n );\n\n const handlePressEnter = () => {\n if (inputValue) {\n setCustomModelServiceProviderList(\n produce(customModelServiceProviderList, (draft) => {\n const index = draft.findIndex((i) => i.id === modelProvider.id);\n if (index !== -1) {\n draft[index].modelList = [{ id: inputValue, name: inputValue }];\n }\n }),\n );\n setShowInputProviderId('');\n setInputValue('');\n }\n };\n\n const isSelected = value?.modelProviderId === modelProvider.id && value?.modelId === model?.id;\n return (\n <div\n key={model?.id}\n className={classNames(\n 'biz-px-3 biz-py-[3px] biz-flex biz-items-center biz-gap-2',\n 'biz-text-text-2 biz-h-8 biz-w-full biz-box-border',\n 'hover:biz-bg-bg-white biz-cursor-pointer biz-group',\n isSelected && 'biz-bg-bg-white',\n itemClassName,\n )}\n onClick={() => {\n if (model && !showInputProviderId) {\n handleSelect(modelProvider, model);\n }\n }}\n >\n {showInputProviderId === modelProvider.id\n ? renderInput({\n value: inputValue,\n onChange: (value) => setInputValue(value),\n onPressEnter: handlePressEnter,\n onBlur: handlePressEnter,\n })\n : normalContent}\n </div>\n );\n };\n\n return (\n <div\n style={style}\n className={classNames(\n 'biz-bg-[#181B22] biz-border-one biz-rounded-[4px] biz-py-1',\n 'biz-flex biz-flex-col gap-1 biz-w-[160px] biz-max-h-[450px] biz-overflow-auto',\n className,\n )}\n >\n {otherModelServiceProviderList.map((provider) => (\n <div\n key={provider.id}\n className='biz-flex biz-flex-col biz-gap-1 biz-w-full biz-box-border'\n >\n {renderTitle(provider)}\n <div className='biz-flex biz-flex-col gap-1 biz-w-full'>\n {provider.modelList.map((model) => renderItem(provider, model))}\n </div>\n </div>\n ))}\n {customModelServiceProviderList.map((provider) => (\n <div\n key={provider.id}\n className='biz-flex biz-flex-col biz-gap-1 biz-w-full biz-box-border'\n >\n {renderTitle(provider)}\n <div className='biz-flex biz-flex-col gap-1 biz-w-full'>\n {renderItem(provider, provider.modelList[0])}\n </div>\n </div>\n ))}\n </div>\n );\n};\n"],"names":["jsxs","jsx","Fragment","value"],"mappings":";;;;;;AA0Ba,MAAA,qBAAqB,CAAC,UAAmC;AAC9D,QAAA;AAAA,IACJ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAEE,QAAA,CAAC,gCAAgC,iCAAiC,IAAI;AAAA,IAC1E,yBAAyB,OAAO,CAAC,SAAS,KAAK,QAAQ;AAAA,EACzD;AACA,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAiB,EAAE;AACzE,QAAM,CAAC,YAAY,aAAa,IAAI,SAAiB,EAAE;AAEvD,QAAM,gCAAgC,yBAAyB,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ;AAExF,QAAA,eAAe,CAAC,eAAuC,UAAmB;AAC9E,yCAAW,eAAe;AAAA,EAC5B;AAEM,QAAA,cAAc,CAAC,kBAA0C;AAE3D,WAAAA,kCAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA,OAAO,cAAc;AAAA,QAErB,UAAA;AAAA,UAAAC,kCAAA,IAAC,OAAI,EAAA,WAAU,mCAAm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AAA,cAAA,YAAY,QAAQ;AAAA,cACrBC,kCAAAA,IAAC,OAAI,EAAA,WAAU,0CACZ,UAAA,WAAW,UAAU,SAAS,UAAU,CAAC,CAAC,EAC7C,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UANK,SAAS;AAAA,QAQjB,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ai-model-select-panel.es.js","sources":["../../../src/components/ai-model-select/ai-model-select-panel.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { EditOutlined, PlusOutlined } from '@easyv/react-icons';\nimport { InputRef } from 'antd';\nimport classNames from 'classnames';\nimport { produce } from 'immer';\nimport { IconBtn } from './iconBtn';\nimport { AiModel, AiModelServiceProvider } from './types';\n\nexport interface AiModelSelectPanelProps {\n className?: string;\n modelServiceProviderList: AiModelServiceProvider[];\n value?: {\n modelProviderId: string;\n modelId: string;\n };\n onSelect?: (AiModelServiceProvider: AiModelServiceProvider, model: AiModel) => void;\n style?: React.CSSProperties;\n titleClassName?: string;\n itemClassName?: string;\n renderInput: (props: {\n value: string;\n onChange: (value: string) => void;\n onPressEnter: () => void;\n onBlur: () => void;\n ref: React.Ref<InputRef>;\n }) => React.ReactNode;\n}\n\nexport const AiModelSelectPanel = (props: AiModelSelectPanelProps) => {\n const {\n className = '',\n modelServiceProviderList,\n value,\n onSelect,\n style,\n titleClassName,\n itemClassName,\n renderInput,\n } = props;\n\n const inputRef = useRef<InputRef>(null);\n\n const [customModelServiceProviderList, setCustomModelServiceProviderList] = useState(\n modelServiceProviderList.filter((item) => item.isCustom),\n );\n const [showInputProviderId, setShowInputProviderId] = useState<string>('');\n const [inputValue, setInputValue] = useState<string>('');\n\n const otherModelServiceProviderList = modelServiceProviderList.filter((item) => !item.isCustom);\n\n useEffect(() => {\n if (!showInputProviderId) return;\n\n // 聚焦到输入框\n const focusTimer = setTimeout(() => {\n inputRef.current?.focus();\n }, 0);\n\n // 滚动到输入框位置\n const scrollTimer = setTimeout(() => {\n // 使用唯一选择器查找包含输入框的元素\n const targetElement = document.querySelector(`[data-provider-id=\"${showInputProviderId}\"]`);\n if (targetElement) {\n targetElement.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n }\n }, 0);\n\n return () => {\n clearTimeout(focusTimer);\n clearTimeout(scrollTimer);\n };\n }, [showInputProviderId]);\n\n useEffect(() => {\n return () => {\n setShowInputProviderId('');\n setInputValue('');\n };\n }, []);\n\n const handleSelect = (modelProvider: AiModelServiceProvider, model: AiModel) => {\n onSelect?.(modelProvider, model);\n setShowInputProviderId('');\n setInputValue('');\n };\n\n const renderTitle = (modelProvider: AiModelServiceProvider) => {\n return (\n <div\n className={classNames(\n 'biz-h-6 biz-text-text-3 biz-px-3 biz-pt-1 biz-w-full',\n 'biz-flex biz-items-center biz-box-border biz-gap-2.5 biz-text-[14px]',\n titleClassName,\n )}\n title={modelProvider.name}\n >\n <div className='biz-w-0 biz-flex-1 biz-truncate'>{modelProvider.name}</div>\n {modelProvider.isCustom && modelProvider.modelList.length === 0 && (\n <IconBtn\n onClick={() => {\n setShowInputProviderId(modelProvider.id);\n }}\n icon={\n <PlusOutlined className='biz-w-3 biz-h-3 biz-text-text-2 hover:biz-text-text-1 biz-flex-center' />\n }\n />\n )}\n </div>\n );\n };\n\n const renderItem = (modelProvider: AiModelServiceProvider, model?: AiModel) => {\n if (modelProvider.isCustom) {\n if (modelProvider.id !== showInputProviderId && !modelProvider.modelList?.length) {\n return null;\n }\n }\n const normalContent = (\n <>\n <img src={modelProvider.iconSrc} className='biz-w-4 biz-h-4' />\n <div className='biz-truncate biz-w-0 biz-flex-1 biz-text-[14px]' title={model?.name}>\n {model?.name}\n </div>\n {modelProvider.isCustom && (\n <IconBtn\n onClick={(e) => {\n setShowInputProviderId(modelProvider.id);\n setInputValue(model?.name || '');\n e.stopPropagation();\n }}\n className='biz-hidden group-hover:!biz-flex'\n style={{ display: 'none' }}\n icon={\n <EditOutlined className='biz-w-3 biz-h-3 biz-text-text-2 hover:biz-text-text-1 biz-flex-center' />\n }\n />\n )}\n </>\n );\n\n const handlePressEnter = () => {\n if (inputValue) {\n setCustomModelServiceProviderList(\n produce(customModelServiceProviderList, (draft) => {\n const index = draft.findIndex((i) => i.id === modelProvider.id);\n if (index !== -1) {\n draft[index].modelList = [{ id: inputValue, name: inputValue }];\n }\n }),\n );\n setShowInputProviderId('');\n setInputValue('');\n }\n };\n\n const handleBlur = () => {\n if (!inputValue) {\n setShowInputProviderId('');\n }\n };\n\n const isSelected = value?.modelProviderId === modelProvider.id && value?.modelId === model?.id;\n\n return (\n <div\n key={model?.id || `input-${modelProvider.id}`}\n data-provider-id={modelProvider.id}\n className={classNames(\n 'biz-px-3 biz-py-[3px] biz-flex biz-items-center biz-gap-2',\n 'biz-text-text-2 biz-h-8 biz-w-full biz-box-border',\n 'hover:biz-bg-bg-white biz-cursor-pointer biz-group',\n isSelected && 'biz-bg-bg-white',\n itemClassName,\n )}\n onClick={() => {\n if (model && !showInputProviderId) {\n handleSelect(modelProvider, model);\n }\n }}\n >\n {showInputProviderId === modelProvider.id\n ? renderInput({\n value: inputValue,\n onChange: (value) => setInputValue(value),\n onPressEnter: handlePressEnter,\n onBlur: handleBlur,\n ref: inputRef,\n })\n : normalContent}\n </div>\n );\n };\n\n return (\n <div\n style={style}\n className={classNames(\n 'biz-bg-[#181B22] biz-border-one biz-rounded-[4px] biz-py-1 biz-h-[200px]',\n 'biz-flex biz-flex-col gap-1 biz-w-[160px] biz-max-h-[450px] biz-overflow-auto',\n className,\n )}\n >\n {otherModelServiceProviderList.map((provider) => (\n <div\n key={provider.id}\n className='biz-flex biz-flex-col biz-gap-1 biz-w-full biz-box-border'\n >\n {renderTitle(provider)}\n <div className='biz-flex biz-flex-col gap-1 biz-w-full'>\n {provider.modelList.map((model) => renderItem(provider, model))}\n </div>\n </div>\n ))}\n {customModelServiceProviderList.map((provider) => (\n <div\n key={provider.id}\n className='biz-flex biz-flex-col biz-gap-1 biz-w-full biz-box-border'\n >\n {renderTitle(provider)}\n <div className='biz-flex biz-flex-col gap-1 biz-w-full'>\n {renderItem(provider, provider.modelList[0])}\n </div>\n </div>\n ))}\n </div>\n );\n};\n"],"names":["jsxs","jsx","Fragment","value"],"mappings":";;;;;;AA4Ba,MAAA,qBAAqB,CAAC,UAAmC;AAC9D,QAAA;AAAA,IACJ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAEE,QAAA,WAAW,OAAiB,IAAI;AAEhC,QAAA,CAAC,gCAAgC,iCAAiC,IAAI;AAAA,IAC1E,yBAAyB,OAAO,CAAC,SAAS,KAAK,QAAQ;AAAA,EACzD;AACA,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAiB,EAAE;AACzE,QAAM,CAAC,YAAY,aAAa,IAAI,SAAiB,EAAE;AAEvD,QAAM,gCAAgC,yBAAyB,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ;AAE9F,YAAU,MAAM;AACd,QAAI,CAAC,oBAAqB;AAGpB,UAAA,aAAa,WAAW,MAAM;;AAClC,qBAAS,YAAT,mBAAkB;AAAA,OACjB,CAAC;AAGE,UAAA,cAAc,WAAW,MAAM;AAEnC,YAAM,gBAAgB,SAAS,cAAc,sBAAsB,mBAAmB,IAAI;AAC1F,UAAI,eAAe;AACjB,sBAAc,eAAe;AAAA,UAC3B,UAAU;AAAA,UACV,OAAO;AAAA,UACP,QAAQ;AAAA,QAAA,CACT;AAAA,MAAA;AAAA,OAEF,CAAC;AAEJ,WAAO,MAAM;AACX,mBAAa,UAAU;AACvB,mBAAa,WAAW;AAAA,IAC1B;AAAA,EAAA,GACC,CAAC,mBAAmB,CAAC;AAExB,YAAU,MAAM;AACd,WAAO,MAAM;AACX,6BAAuB,EAAE;AACzB,oBAAc,EAAE;AAAA,IAClB;AAAA,EACF,GAAG,EAAE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