@blocklet/pages-kit-inner-components 0.5.43 → 0.5.45

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.
@@ -1,3 +1,3 @@
1
1
  "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("flat"),t=e.flatten({cannotFindPropertyKey:"Cannot find property key: {key}",deleteProjectAlertPrefix:"This will permanently delete the project named",resetProjectAlertPrefix:"This will reset the project named",deleteProjectAlertSuffix:"project",resetProjectAlertSuffix:"project",confirmTip:"Please enter the project name",confirmDelete:"Please enter {name} to confirm deletion",confirmReset:"Please enter {name} to confirm reset",uploadNewIcon:"Upload new icon",requiredKey:"Key cannot be empty, please set a unique key, so that it can be referenced and configured in the component",duplicateKey:"Key already exists, please set a unique key",clickToGenerateNpmLink:"Click to generate link",projects:{project:"Project",myProjects:"My Projects",projectToGetStart:"Create Project",unnamed:"Unnamed Project",noDescription:"No description",lastUpdated:"Last updated",edit:"Edit",delete:"Delete",pin:"Pin",unpin:"Unpin",name:"Name",slug:"Slug",projectSlug:"Please enter your project slug",projectName:"Please enter your project name",newProjectDescriptionPlaceholder:"Please describe your project",description:"Description",chooseTemplate:"Choose Template",chooseTemplateTip:"Choose a template to start, or select Blank Template to create your own",blankTemplate:"Blank Template",welcomeTemplate:"Welcome Template",limitReached:"Expand Project Count",limitReachedTip:"You have reached the limit of <b>{limit}</b> projects. Please delete the unused projects and try again.<br/>You can also launch your own Pages Kit to create more projects.",limitReachedConfirm:"Launch My Pages Kit",topToggle:{sitemap:"Sitemap",data:"Data Source",template:"Templates",page:"Pages"},dataSourceEmpty:'No data sources yet, click "Add" button to create',selectDataSource:"Please select a data source from the list",createDataSourceFirst:"Please create a data source first"},alert:{delete:"Delete"},common:{goToHome:"Go to Home",delete:"Delete",cancel:"Cancel",add:"Add",addMultiple:"Add ({count})",create:"Create",language:"Language",pageNotFound:"Page Not Found",confirmDialogTitle:"Confirm",all:"All",back:"Back Home",retry:"Retry",defaultLanguage:"default",close:"Close",saveSuccess:"Save Success",resourceBlocklet:"Resource Blocklet",select:"Select ",ok:"OK",refreshData:"Refresh Data",clear:"Clear",confirm:"Confirm"},section:{card:{type:"Card Type",title:"Cards",addCard:"Add Card",align:"Card align",textAlign:"Text align"},list:{columns:"Columns",gap:"Gap",align:"Align"}},maker:{sections:{empty:"No Sections",emptySubItems:"No Sub Sections",dropHere:"Drop here"},layoutBlock:{draftPlaceholder:`Use grid to arrange sections layout \r
2
- ( this tip only show in draft mode)`},pageTitle:"Pages Editor",save:"Save",publish:"Publish",publishToProduction:"Publish to production",publishToProductionTip:"Anyone can see production version",publishConfirmContent:"Publish to",publishSelectPagesMessage:"Please select the pages to publish",publishSuccessMessage:"Published",importSuccessMessage:"Imported successfully",preview:"Preview",pagePreview:"Preview",livePreview:"Live Preview",production:"Production",draft:"Draft",previewRouteWithDynamicParams:"Cannot preview a route with dynamic parameters. Please select or configure parameter options in the Site Map first.",configColor:"Config color",configColorMuiTheme:"Theme Color",configColorCustomColor:"Custom Color",configColorMuiThemeInfo:"Use theme color, it will automatically adapt to the theme color and dark mode",configColorMuiThemeWithAlternateColor:" (includes light and dark modes)",configColorLightMode:"Light Mode",configColorDarkMode:"Dark Mode",import:"Import",importDialog:{upload:{title:"Import from file",description:"Import from local file",tip:"Please select the file to import"},resource:{description:"Import from resource"}},error:{dataSourceNotFound:"Please configure the page data source in Site Map first",refreshDataFailed:"Failed to refresh data, please try again later",missingRouteOrProject:"Missing route or project information"},export:"Export",noPreviewAvailable:"No preview available",networkStatus:{online:"Network connected - Your changes will sync to server in real-time",offline:"Network disconnected - Your changes will sync automatically when connection is restored"},routePreview:{loading:"Loading...",generatingPageStructure:"Generating page content structure...",generatingSectionContent:"Generating section content...",routePreview:"Preview",noDisplayTemplate:"This route has no display template",templateNotFound:"Display template not found",noSectionsAvailable:"No sections available",optimizeContent:"Optimize Content",optimizeContentButton:"Use AI to optimize content",sectionRule:"Section Rule",sectionRulePlaceholder:"Enter your section rule or instructions for AI generation",confirmOptimize:"Confirm",cancelOptimize:"Cancel"},pages:{addPage:"Create Page",createResource:"Create Resource",addResource:"Add Resource from Store",pages:"Pages",template:"Templates",sections:"Sections",deleteTitle:"Delete {name} page?",deleteSectionTitle:"Delete {name} section?",empty:"No pages",needPublish:"This page has unpublished changes",notPublic:"This page is not public",expandAllRoutes:"Expand all associated routes",collapseAllRoutes:"Collapse all associated routes",addPageDialog:{title:"Create New Page",templateName:"Template Name",templateNamePlaceholder:"Enter page template name",autoCreateRoute:"Auto create route",create:"Create",cancel:"Cancel"}},components:{components:"Components",addComponent:"Add Component",basicGroup:"Basic",customGroup:"Custom",resourceGroup:"Resource",deleteTitle:"Delete {name} component?",noComponents:"No Components",needAddResource:"Please select resource components in project settings",searchComponent:"Please enter component name to search"},outline:{outline:"Outline"},properties:{addArrayItem:"Add Row",arrayEmpty:"No Row",subProperties:"Sub Properties",addSubProperty:"Add Sub Property",noSubProperties:"No Sub properties",noProperties:"No properties",noParameters:"No configurable parameters",properties:"Properties",setDefaultLocale:"Set default",copyDefault:"Copy over default",copyFull:"Full copy",migrateFromOld:"Full copy from old version",path:"Path",title:"Title",description:"Description",icon:"Icon",iconSize:"Icon size",image:"Image",imageOptimization:"Image Optimization",imageOptimizationFast:"Best for speed",imageOptimizationQuality:"Best for visual quality",imageMode:"Image Mode",hoverStyle:"Hover Style",videoPoster:"Video Poster",imageSize:"Image size",hasImage:"Has Image",fullSizeImage:"Full Size Image",src:"Source",dark:"Dark",reverse:"Reverse",background:"Background",badge:"Badge",buttons:"Buttons",button:"Button",border:"Border",shadow:"Shadow",color:"Color",variant:"Variant",isPageLink:"Is page link?",link:"Link",style:"Style",card:"Card",list:"List",center:"Center",sort:"Order by",asc:"Ascending",desc:"Descending",createdAt:"Create Time",updatedAt:"Update Time",pathCheckRequired:"Path is required",pathCheckStartWithSlash:"Path must start with /",pathCheckEndWithoutSlash:"Path cannot end with /",pathCheckConsecutiveSlash:"Path cannot contain consecutive /",pathCheckWhitespace:"Path cannot contain whitespace",pathCheckInvalid:"Invalid path format",pathCheckAlreadyExist:"Path is already exist",pathCheckHelper:"This field now manages template names. To modify page access paths, please navigate to Site Map settings.",embedUrl:"Embed url",chooseEmbed:"Choose embed",translateFrom:"Translate from",backgroundColor:"Color",backgroundImage:"Image/Video",customColor:"Custom color",customImage:"Custom image/video",boxed:"Nested box mode",bigMode:"Big title mode",paddingY:"Vertical Padding",paddingX:"Horizontal Padding",maxWidth:"Max Width",maxWidthCustomTip:"For example: 1200px, 80%, 50vw",customValue:"Custom Value",stickyHeader:"Sticky Header",translucent:"Translucent Mode",hideNavMenus:"Hide Navigation Menus",hideFooter:"Hide Footer",size:"Size",autoWidth:"Auto Width",iframeHeight:"Content Height",translucentTextColor:"Translucent Text Color",copyFromOtherLanguage:"Copy from other language",useCache:"Use Cache",cacheDuration:"Cache Duration (seconds)",customComponent:"Custom Component",parameters:"Parameters",buttonTitle:"Button {index} Title",cardTitle:"Card {index} Title",cardDescription:"Card {index} Description",cardButtonTitle:"Card {index} Button {actionIndex} Title",copyLanguageDescription:"All properties will be copied from the selected language to the current language, which will override the existing content in the current language.",isPublic:"Public Access",isTemplate:"Use as template page",isTemplateSection:"Template dynamic card",templateDescription:"Card description, used to generate card content when using AIGNE to generate page content",templateSectionNameRequired:"Name is required for template section to set values when using dynamic templates",templateSectionNameHelper:"Section name is used to identify the section in the template, please use a meaningful and unique name, so that the section can be set content later",templateSectionNameDuplicated:"Section name must be unique among all template sections in the page",propertyNotFound:"Failed to modify parameter, reason: component does not exist `{key}` property",configDetailedDescription:"Configure detailed description",llmConfigTitle:"LLM Configuration Details",llmConfigLabel:"LLM Configuration Information",llmConfigPlaceholder:"Enter additional configuration information for LLM",llmConfigInstructions:"Configure which properties should be processed by AI and provide detailed descriptions.",llmPropertyDescribe:"Description for AI",loading:"Loading...",componentNotFound:"Component not found",templateName:"Template Name",mobile:"Mobile",desktop:"Desktop",columns:"Columns",visualGridLayout:"Configure Grid Layout",dragResizeInstructions:"Drag and resize cards to set layout, you can set different layouts for desktop and mobile",setAsBackgroundElement:"Set as background element (cannot drag and resize)",setAsNormalElement:"Set as normal element (can drag and resize)"},siteMap:{routes:"Routes",empty:"No Routes",pageProperties:"Route Properties",handler:"Handler",data:"Data Source",noDataSource:"No data source",loading:"Loading",unknownSource:"Unknown Source",question:"Page Rules",questionPlaceholder:"Enter page rules, describe your requirements",pageTemplate:"Page Template",selectPageTemplate:"Select a page template",agent:"Agent",noAgent:"No Agent",noRouteSelected:"No route selected. Please select a route from the list or create a new one.",enableGenerate:"Enable AI Generate",path:"Path",generate:"Generate Page Content",generating:"Generating...",deleteRouteTitle:"Delete Route",deleteRouteConfirm:"Are you sure you want to delete this route? This action cannot be undone.",routeDeleted:"Route deleted successfully",confirmRemoveParamsTitle:"Remove Dynamic Parameters",confirmRemoveParamsDescription:"The following dynamic parameters will be removed from the route:",paramOptionsTitle:"Parameter Options",paramOptionsDescription:"Configure options for dynamic parameters in the route",paramOptionName:"Option name",deleteOption:"Delete option",addChildOption:"Add child option",noParamOptions:"No parameter options yet, click the button below to add",addParamOption:"Add parameter option",errorEmptyValue:"Value cannot be empty",errorContainsSlash:"Value cannot contain slash (/)",errorInvalidChars:"Value contains invalid characters, please use only URL-safe characters"},datasource:{autoSaveSuccess:"Auto save success"}},error:{embedUrl:"Embed url error",notFoundEmbed:"Not Found Embed",noBackground:"No background",notConfig:"Not config",slugAlreadyExists:"Slug already exists",slugRequired:"Slug cannot be empty",invalidJson:"Invalid JSON format"},fabric:{fontFamily:"Font Family (Deprecated)",basicComponent:{titleFontFamily:"Title Font Family",titleFontFamilyHelper:"* Globally modify the paragraph heading font",descFontFamily:"Description Font Family",descFontFamilyHelper:"* Globally modify the paragraph description font"}},ai:{list:{noTemplatesInStudio:"You haven't create any prompt template in AI Studio yet.",createNow:"Create Now",noTemplates:"No template has been provided yet"},output:{errorMessage:"Something wrong with me, please try it later.",words:"Words",characters:"Characters",copied:"Copied!"},generate:"Generate",text:{title:"Text Assistant",description:"Use AI to help with write text",theme:"Content",themeHelper:"Organize the input to make it more suitable for the web page",language:"Language",languageHelper:"Output text language",size:"Size",sizeHelper:"Output text size",original:"Original",improve:"Improve"},status:{install:"Check whether the ai-kit is installed",unavailable:"Check whether the openai key is set properly"}},translate:{translate:"Translate",title:"Translation page",into:"Translate into",ing:"Translating",ingTip:"Translating content to {targetLanguage}. please wait a moment..",confirm:"Confirm",confirmTitle:"Confirm translation information",confirmContent:"Are you sure to translate to {target} and add {target} content after translation?",overlay:"Are you sure to continue the translation and override the {target} content after translation?",success:"Translation success",fail:"Translation failed, please try again",failed:"Translation failed. Please check and try again",localInput:"Local input",abort:"Cancel translation",sameLanguage:"Source language and target language cannot be the same",noTargetLanguage:"Please select target language",noValidTargetLanguage:"Source and target languages cannot be the same. Please select different target languages",noSourceData:"No source data found for translation",failedFor:"Translation failed for",translating:"Translating...",field:"Field",unsavedChanges:"You have unsaved changes. Do you want to save before closing?",templateSyncTip:"You only need to maintain one language version of your page template. We will automatically sync the template configuration while handling translations."},aiRuntime:{aiSettings:"AI Settings",unnamed:"Unnamed",project:"Project",assistant:"Assistant",widget:"Widget",all:"All",form:"Form",result:"Result",submitButton:"Submit Button",submitIcon:"Submit Icon",submitBackground:"Submit Background",placeholder:"Placeholder",loadingIndicator:"Loading Indicator"},basicInfo:"Basic Info",name:"Name",description:"Description",tags:"Tags",previewImage:"Preview Image",properties:"Properties",property:"Property",addObject:"New {object}",key:"Key",label:"Label",type:"Type",defaultValue:"Default Value",renderer:"Renderer",parameters:"Parameters",i18nEditorTitle:"I18N Editor",close:"Close",component:"Component",delete:"Delete",duplicate:"Duplicate",move:{up:"Move up",down:"Move down"},show:"Show",hide:"Hide",showParameter:"Show Parameter Config",hideParameter:"Hide Parameter Config",dragSort:"Drag sort",saved:"Saved",supportMarkdownSyntaxPlaceholder:"support markdown syntax",settings:{appearanceTip:"Appearance settings have been migrated to the Blocklet management page, users with admin access can click the link below to configure",appearanceLink:"Go to Appearance Settings >",tabs:{basic:"Basic",appearance:"Appearance",resources:"Resources",integration:"Integration"},basic:{title:"Basic Information",avatar:"Project Avatar",name:"Project Name",namePlaceholder:"Please enter project name",description:"Project Description",descriptionPlaceholder:"Please describe your project",slug:"Project Slug",slugPlaceholder:"Please enter project slug",slugHelper:"Project slug can only contain letters, numbers, hyphens and underscores",changeAvatar:"Change Avatar"},resources:{all:"Enable all resource components",resourceBlocklet:"Selected resource components",addResource:"Select resource components",needInstallResourceByAdmin:"Please install resource components by admin",noSelectedResources:"No selected any resource components"},integration:{packageSetting:"Package Setting",migrateToComponentStudio:"Migrate Component Settings"}},edit:{modified:"Modified",new:"New",deleted:"Deleted",undo:"Undo",redo:"Redo"},style:{title:"Global Style"}}),a=e.flatten({cannotFindPropertyKey:"无法找到属性键:{key}",deleteProjectAlertPrefix:"这将永久删除名称为",resetProjectAlertPrefix:"这将重置名称为",deleteProjectAlertSuffix:"的项目",resetProjectAlertSuffix:"的项目",confirmTip:"请输入项目名称",confirmDelete:"请输入 {name} 以确认删除",confirmReset:"请输入 {name} 以确认重置",uploadNewIcon:"上传新图标",requiredKey:"键不能为空,请设置一个唯一的键,以便在组件中引用和配置参数",duplicateKey:"键已存在,请设置一个唯一的键",clickToGenerateNpmLink:"点击生成链接",projects:{project:"项目",myProjects:"我的项目",projectToGetStart:"创建项目",unnamed:"未命名项目",noDescription:"暂无描述",lastUpdated:"最后更新",edit:"编辑",delete:"删除",pin:"置顶",unpin:"取消置顶",name:"名称",slug:"路径",projectSlug:"请输入项目路径",projectName:"请输入项目名称",newProjectDescriptionPlaceholder:"请输入项目描述",description:"描述",chooseTemplate:"选择模板",chooseTemplateTip:"选择模板快速开始,或开创您的独特项目 - 点击创建您的专属之旅!",blankTemplate:"空白模板",welcomeTemplate:"欢迎模板",limitReached:"扩展项目数量",limitReachedTip:"你已经达到了项目数量上限 <b>{limit}</b>,请删除未使用的项目并重试。<br/>你也可以部署自己的 Pages Kit 来创建更多项目。",limitReachedConfirm:"部署我的 Pages Kit",topToggle:{sitemap:"站点地图",data:"数据源",template:"模板",page:"页面"},dataSourceEmpty:'暂无数据源,点击"添加"按钮创建',selectDataSource:"请选择左侧的数据源进行操作",createDataSourceFirst:"请先创建一个数据源"},alert:{delete:"删除"},common:{goToHome:"返回首页",delete:"删除",cancel:"取消",add:"添加",addMultiple:"添加 ({count})",create:"创建",language:"语言",pageNotFound:"页面未找到",confirmDialogTitle:"确认",all:"全部",back:"返回首页",retry:"重试",defaultLanguage:"默认语言",close:"关闭",saveSuccess:"保存成功",resourceBlocklet:"资源 Blocklet",select:"选择",ok:"确定",refreshData:"刷新数据",clear:"清除",confirm:"确认"},section:{card:{type:"卡片类型",title:"卡片",addCard:"新增卡片",align:"卡片对齐方式",textAlign:"文本对齐方式"},list:{columns:"列数",gap:"间距",align:"对齐方式"}},maker:{sections:{empty:"暂无卡片",emptySubItems:"暂无子卡片",dropHere:"拖拽到这里"},layoutBlock:{draftPlaceholder:`使用网格布局对卡片进行排版 \r
3
- (此提示仅在草稿模式下显示)`},pageTitle:"页面编辑器",save:"保存",publish:"发布",publishToProduction:"发布到正式版",publishToProductionTip:"任何人都可以看到正式版",publishConfirmContent:"发布到",publishSelectPagesMessage:"请选择要发布的页面",publishSuccessMessage:"发布成功",importSuccessMessage:"导入成功",preview:"预览",pagePreview:"页面预览",livePreview:"实时预览",production:"正式版",draft:"草稿",previewRouteWithDynamicParams:"无法预览含动态参数的路由。请先在站点地图中选择或配置参数选项。",configColor:"设置颜色",configColorMuiTheme:"主题色",configColorCustomColor:"自定义颜色",configColorMuiThemeInfo:"使用主题色会自动适应主题配色及亮暗模式",configColorMuiThemeWithAlternateColor:" (包含亮/暗两种模式)",configColorLightMode:"亮色模式",configColorDarkMode:"暗黑模式",import:"导入",importDialog:{upload:{title:"从文件导入",description:"从本地文件导入",tip:"请选择要导入的文件"},resource:{description:"从资源导入"}},error:{dataSourceNotFound:"未找到数据源配置,请先在站点地图中配置页面数据源",refreshDataFailed:"数据刷新失败,请稍后重试",missingRouteOrProject:"缺少路由或项目信息"},export:"导出",noPreviewAvailable:"无可用预览",networkStatus:{online:"网络连接正常 - 您的修改将实时同步到服务器",offline:"网络连接中断 - 您的修改将在网络恢复后自动同步"},routePreview:{loading:"加载中...",generatingPageStructure:"正在生成页面内容结构...",generatingSectionContent:"正在生成卡片内容...",routePreview:"路由预览",noDisplayTemplate:"该路由没有显示模板",templateNotFound:"未找到显示模板",noSectionsAvailable:"没有可用内容",optimizeContent:"内容优化",optimizeContentButton:"使用 AI 优化内容",sectionRule:"卡片规则",sectionRulePlaceholder:"输入卡片规则",confirmOptimize:"确认",cancelOptimize:"取消"},pages:{addPage:"创建页面",createResource:"创建资源",addResource:"从商店添加资源",pages:"页面",template:"模板",sections:"卡片",deleteTitle:"删除 {name} 页面?",deleteSectionTitle:"删除 {name} 卡片?",empty:"暂无页面",needPublish:"此页面有可发布的新修改",notPublic:"此页面未公开",expandAllRoutes:"展开所有关联路由",collapseAllRoutes:"折叠所有关联路由",addPageDialog:{title:"创建新页面",templateName:"模板名称",templateNamePlaceholder:"输入页面模板名称",autoCreateRoute:"自动创建路由",create:"创建",cancel:"取消"}},components:{components:"组件",addComponent:"添加组件",basicGroup:"基础组件",customGroup:"自定义组件",resourceGroup:"资源组件",deleteTitle:"删除 {name} 组件?",noComponents:"暂无组件",needAddResource:"请在项目设置中选择资源组件",searchComponent:"请输入组件名称进行搜索"},outline:{outline:"概览"},properties:{addArrayItem:"添加一行",arrayEmpty:"暂无行",subProperties:"子属性",addSubProperty:"添加子属性",noSubProperties:"暂无子属性",noProperties:"暂无属性",noParameters:"暂无可配置参数",properties:"属性",setDefaultLocale:"设为默认语言",copyDefault:"设为默认值",copyFull:"复制全部",migrateFromOld:"从老版本复制默认值",path:"路径",title:"标题",description:"描述",icon:"图标",iconSize:"图标大小",image:"图片",imageOptimization:"图片优化",imageOptimizationFast:"速度优先",imageOptimizationQuality:"质量优先",imageMode:"图片模式",hoverStyle:"鼠标悬停样式",videoPoster:"视频封面",imageSize:"图片大小",hasImage:"包含图片",fullSizeImage:"大图模式",src:"源地址",dark:"暗黑",reverse:"反转",background:"背景",badge:"标签",buttons:"按钮",button:"按钮",border:"边框",shadow:"阴影",color:"颜色",variant:"样式",isPageLink:"是否内部链接?",link:"链接",style:"样式",card:"卡片",list:"列表",center:"居中",sort:"排序",asc:"升序",desc:"降序",createdAt:"创建时间",updatedAt:"更新时间",pathCheckRequired:"请输入路径",pathCheckStartWithSlash:"路径开头必须是 /",pathCheckEndWithoutSlash:"路径结尾不能是 /",pathCheckConsecutiveSlash:"路径中不能包含连续的 /",pathCheckWhitespace:"路径中不能包含空白字符",pathCheckInvalid:"非法的路径",pathCheckAlreadyExist:"路径已存在",pathCheckHelper:'此处用于设置模板名称,如需修改页面访问路径,请前往"站点地图"进行设置',embedUrl:"部件地址",chooseEmbed:"选择部件",translateFrom:"翻译来自",backgroundColor:"颜色",backgroundImage:"图片/视频",customColor:"自定义颜色",customImage:"自定义图片/视频",boxed:"嵌套盒子模式",bigMode:"大标题模式",paddingY:"上下内边距",paddingX:"左右内边距",maxWidth:"最大宽度",maxWidthCustomTip:"例如: 1200px, 80%, 50vw",customValue:"自定义值",stickyHeader:"固定导航栏",translucent:"沉浸式",hideNavMenus:"隐藏导航菜单",hideFooter:"隐藏页脚",size:"大小",autoWidth:"宽度自适应",iframeHeight:"定义内容高度",translucentTextColor:"沉浸式文本颜色",copyFromOtherLanguage:"从其他语言复制",useCache:"使用缓存",cacheDuration:"缓存时间 (秒)",customComponent:"自定义组件",parameters:"参数",buttonTitle:"第 {index} 个按钮的标题",cardTitle:"第 {index} 个卡片标题",cardDescription:"第 {index} 个卡片描述",cardButtonTitle:"第 {index} 个卡片中第 {actionIndex} 个按钮标题",copyLanguageDescription:"将从选择的语言复制所有属性到当前语言,这将覆盖当前语言的已有内容。",isPublic:"是否公开",isTemplate:"作为模版页面使用",isTemplateSection:"模板动态卡片",templateDescription:"卡片描述,使用 AIGNE 生成页面内容时,会根据卡片描述生成卡片内容",templateSectionNameRequired:"模板卡片需要设置名称,以便在使用动态模板时为卡片设置对应的值",templateSectionNameHelper:"卡片名称用于标识模板中的卡片,请使用有意义且唯一的名称,以便后续为卡片设置内容",templateSectionNameDuplicated:"模板卡片名称在页面中必须唯一,当前名称已被其他模板卡片使用",propertyNotFound:"修改参数失败,原因:组件不存在 `{key}` 属性",configDetailedDescription:"配置详细描述",llmConfigTitle:"LLM 配置详情",llmConfigLabel:"LLM 配置信息",llmConfigPlaceholder:"输入用于LLM的额外配置信息",llmConfigInstructions:"配置需要AI处理的属性并提供详细描述",llmPropertyDescribe:"AI提示描述",loading:"加载中...",componentNotFound:"未找到组件",templateName:"模板名称",mobile:"移动端",desktop:"桌面端",columns:"列数",visualGridLayout:"配置网格布局",dragResizeInstructions:"通过调整卡片位置和大小调整布局,可以分别设置桌面端和移动端两种布局",setAsBackgroundElement:"设置为背景卡片(无法拖拽排序、无法设置大小)",setAsNormalElement:"设置为普通卡片(可拖拽排序、可设置大小)"},siteMap:{routes:"路由列表",pageProperties:"路由属性",handler:"处理器",parameters:"参数",parametersHelper:"来自 URL、请求头等参数",data:"数据源",dataPlaceholder:"请输入页面数据",pageTemplate:"页面模板",selectPageTemplate:"选择页面模板",empty:"暂无路由",noDataSource:"无数据源",loading:"加载中...",unknownSource:"未知数据源",question:"页面规则",questionPlaceholder:"输入页面规则,描述您的要求",agent:"Agent",noAgent:"无 Agent",noRouteSelected:"未选择路由,请从左侧列表选择一个路由或创建新路由。",enableGenerate:"启用 AI 生成",path:"路径",generate:"生成页面内容",generating:"生成中...",deleteRouteTitle:"删除路由",deleteRouteConfirm:"你确定要删除此路由吗?此操作无法撤销。",routeDeleted:"路由删除成功",confirmRemoveParamsTitle:"删除动态参数",confirmRemoveParamsDescription:"以下动态参数将从路由中删除:",paramOptionsTitle:"参数可选值",paramOptionsDescription:"配置路由中动态参数的可选值",paramOptionName:"选项名称",deleteOption:"删除选项",addChildOption:"添加子选项",noParamOptions:"暂无参数可选值,点击下方按钮添加",addParamOption:"添加参数可选值",errorEmptyValue:"值不能为空",errorContainsSlash:"值不能包含斜杠 (/)",errorInvalidChars:"值包含无效字符,请仅使用URL安全字符",templates:{default:"默认模板",blog:"博客模板",landing:"落地页模板",form:"表单模板"}},datasource:{autoSaveSuccess:"自动保存成功"}},error:{embedUrl:"Embed 地址有误",notFoundEmbed:"未找到组件",noBackground:"无背景",notConfig:"未设置",slugAlreadyExists:"路径已存在",slugRequired:"路径不能为空",invalidJson:"JSON格式无效"},fabric:{fontFamily:"全局字体(已废弃)",basicComponent:{titleFontFamily:"段落标题字体",titleFontFamilyHelper:"* 全局修改段落标题字体",descFontFamily:"段落描述字体",descFontFamilyHelper:"* 全局修改段落描述字体"}},ai:{list:{noTemplatesInStudio:"目前您还没有在 AI Studio 里创建任何模版",createNow:"现在创建",noTemplates:"还没有任何模版"},output:{errorMessage:"出错了,请稍后再试",words:"字",characters:"字符",copied:"已复制!"},generate:"生成",text:{title:"文案助手",description:"使用 AI 帮助编写文案",theme:"内容",themeHelper:"整理内容,使描述更加合适网页",language:"语言",languageHelper:"输出文本语言",size:"大小",sizeHelper:"输出内容大小",original:"原文",improve:"改良"},status:{install:"请先检查 ai-kit 是否安装",unavailable:"请先检查 openai key 是否正常设置"}},translate:{title:"翻译页面",translate:"翻译",into:"翻译成",ing:"翻译中",ingTip:"将内容翻译为 {targetLanguage}。请稍等...",confirm:"翻译",confirmTitle:"确认翻译信息",confirmContent:"你确认翻译成 {target},并且翻译后新增 {target} 内容吗?",overlay:"确认继续翻译,并且翻译后覆盖 {target} 内容吗?",success:"翻译成功",fail:"翻译失败,请重试",failed:"翻译失败,请检查后重试",localInput:"本地输入",abort:"取消翻译成功",sameLanguage:"源语言和目标语言不能相同",noTargetLanguage:"请选择目标语言",noValidTargetLanguage:"源语言和目标语言不能相同,请选择不同的目标语言",noSourceData:"未找到用于翻译的源数据",failedFor:"翻译失败语言:",translating:"翻译中...",field:"字段",unsavedChanges:"你有未保存的更改。是否在关闭前保存?",templateSyncTip:"您只需维护一种语言版本的页面模板,我们会在处理翻译的同时,自动同步页面模板的配置。"},aiRuntime:{aiSettings:"AI 设置",unnamed:"未命名",project:"项目",assistant:"助手",widget:"部件",all:"全部",form:"仅表单",result:"仅输出",submitButton:"提交按钮",submitIcon:"提交按钮图标",submitBackground:"提交按钮背景色",placeholder:"占位提示",loadingIndicator:"加载提示"},basicInfo:"基础信息",name:"名称",description:"描述",tags:"标签",previewImage:"预览图片",properties:"属性",property:"属性",addObject:"添加{object}",key:"键",label:"标签",type:"类型",defaultValue:"默认值",renderer:"渲染方式",parameters:"参数",i18nEditorTitle:"国际化编辑",close:"关闭",component:"组件",delete:"删除",duplicate:"复制",move:{up:"上移",down:"下移"},show:"显示",hide:"隐藏",showParameter:"显示参数配置",hideParameter:"隐藏参数配置",dragSort:"拖拽排序",saved:"保存成功",supportMarkdownSyntaxPlaceholder:"支持输入 markdown",settings:{appearanceTip:"外观设置已迁移至 Blocklet 管理页面,持有管理员通行证的用户,可点击下方链接配置",appearanceLink:"前往外观设置 >",tabs:{basic:"基础设置",appearance:"外观设置",resources:"资源组件",integration:"集成设置"},basic:{title:"基础信息",avatar:"项目头像",name:"项目名称",namePlaceholder:"请输入项目名称",description:"项目描述",descriptionPlaceholder:"请输入项目描述",slug:"项目路径",slugPlaceholder:"请输入项目路径",slugHelper:"项目路径只能包含字母、数字、中划线和下划线",changeAvatar:"更换头像"},resources:{all:"启用所有资源组件",resourceBlocklet:"已选择的资源组件",addResource:"选择资源组件",needInstallResourceByAdmin:"请联系管理员安装资源组件",noSelectedResources:"未选择任何资源组件"},integration:{packageSetting:"包设置",migrateToComponentStudio:"迁移组件设置"}},edit:{modified:"已修改",new:"新增",deleted:"已删除",undo:"撤销",redo:"重做"},style:{title:"公共样式"}}),o={en:t,zh:a};exports.translations=o;
2
+ ( this tip only show in draft mode)`},pageTitle:"Pages Editor",save:"Save",publish:"Publish",publishToProduction:"Publish to production",publishToProductionTip:"Anyone can see production version",publishConfirmContent:"Publish to",publishSelectPagesMessage:"Please select the pages to publish",publishSuccessMessage:"Published",importSuccessMessage:"Imported successfully",preview:"Preview",pagePreview:"Preview",livePreview:"Live Preview",production:"Production",draft:"Draft",previewRouteWithDynamicParams:"Cannot preview a route with dynamic parameters. Please select or configure parameter options in the Site Map first.",configColor:"Config color",configColorMuiTheme:"Theme Color",configColorCustomColor:"Custom Color",configColorMuiThemeInfo:"Use theme color, it will automatically adapt to the theme color and dark mode",configColorMuiThemeWithAlternateColor:" (includes light and dark modes)",configColorLightMode:"Light Mode",configColorDarkMode:"Dark Mode",import:"Import",importDialog:{upload:{title:"Import from file",description:"Import from local file",tip:"Please select the file to import"},resource:{description:"Import from resource"}},error:{dataSourceNotFound:"Please configure the page data source in Site Map first",refreshDataFailed:"Failed to refresh data, please try again later",missingRouteOrProject:"Missing route or project information"},export:"Export",noPreviewAvailable:"No preview available",networkStatus:{online:"Network connected - Your changes will sync to server in real-time",offline:"Network disconnected - Your changes will sync automatically when connection is restored"},routePreview:{loading:"Loading...",generatingPageStructure:"Generating page content structure...",generatingSectionContent:"Generating section content...",routePreview:"Preview",noDisplayTemplate:"This route has no display template",templateNotFound:"Display template not found",noSectionsAvailable:"No sections available",optimizeContent:"Optimize Content",optimizeContentButton:"Use AI to optimize content",sectionRule:"Section Rule",sectionRulePlaceholder:"Enter your section rule or instructions for AI generation",confirmOptimize:"Confirm",cancelOptimize:"Cancel"},pages:{addPage:"Create Page",createResource:"Create Resource",addResource:"Add Resource from Store",pages:"Pages",template:"Templates",sections:"Sections",deleteTitle:"Delete {name} page?",deleteSectionTitle:"Delete {name} section?",empty:"No pages",needPublish:"This page has unpublished changes",notPublic:"This page is not public",expandAllRoutes:"Expand all associated routes",collapseAllRoutes:"Collapse all associated routes",addPageDialog:{title:"Create New Page",templateName:"Template Name",templateNamePlaceholder:"Enter page template name",autoCreateRoute:"Auto create route",create:"Create",cancel:"Cancel"}},components:{components:"Components",addComponent:"Add Component",basicGroup:"Basic",customGroup:"Custom",resourceGroup:"Resource",deleteTitle:"Delete {name} component?",noComponents:"No Components",needAddResource:"Please select resource components in project settings",searchComponent:"Please enter component name to search"},outline:{outline:"Outline"},properties:{addArrayItem:"Add Row",arrayEmpty:"No Row",subProperties:"Sub Properties",addSubProperty:"Add Sub Property",noSubProperties:"No Sub properties",noProperties:"No properties",noParameters:"No configurable parameters",properties:"Properties",setDefaultLocale:"Set default",copyDefault:"Copy over default",copyFull:"Full copy",migrateFromOld:"Full copy from old version",path:"Path",title:"Title",description:"Description",icon:"Icon",iconSize:"Icon size",image:"Image",imageOptimization:"Image Optimization",imageOptimizationFast:"Best for speed",imageOptimizationQuality:"Best for visual quality",imageMode:"Image Mode",hoverStyle:"Hover Style",videoPoster:"Video Poster",imageSize:"Image size",hasImage:"Has Image",fullSizeImage:"Full Size Image",src:"Source",dark:"Dark",reverse:"Reverse",background:"Background",badge:"Badge",buttons:"Buttons",button:"Button",border:"Border",shadow:"Shadow",color:"Color",variant:"Variant",isPageLink:"Is page link?",link:"Link",style:"Style",card:"Card",list:"List",center:"Center",sort:"Order by",asc:"Ascending",desc:"Descending",createdAt:"Create Time",updatedAt:"Update Time",pathCheckRequired:"Path is required",pathCheckStartWithSlash:"Path must start with /",pathCheckEndWithoutSlash:"Path cannot end with /",pathCheckConsecutiveSlash:"Path cannot contain consecutive /",pathCheckWhitespace:"Path cannot contain whitespace",pathCheckInvalid:"Invalid path format",pathCheckAlreadyExist:"Path is already exist",pathCheckHelper:"This field now manages template names. To modify page access paths, please navigate to Site Map settings.",embedUrl:"Embed url",chooseEmbed:"Choose embed",translateFrom:"Translate from",backgroundColor:"Color",backgroundImage:"Image/Video",customColor:"Custom color",customImage:"Custom image/video",boxed:"Nested box mode",bigMode:"Big title mode",paddingY:"Vertical Padding",paddingX:"Horizontal Padding",maxWidth:"Max Width",maxWidthCustomTip:"For example: 1200px, 80%, 50vw",customValue:"Custom Value",stickyHeader:"Sticky Header",translucent:"Translucent Mode",hideNavMenus:"Hide Navigation Menus",hideFooter:"Hide Footer",size:"Size",autoWidth:"Auto Width",iframeHeight:"Content Height",translucentTextColor:"Translucent Text Color",copyFromOtherLanguage:"Copy from other language",useCache:"Use Cache",cacheDuration:"Cache Duration (seconds)",customComponent:"Custom Component",parameters:"Parameters",buttonTitle:"Button {index} Title",cardTitle:"Card {index} Title",cardDescription:"Card {index} Description",cardButtonTitle:"Card {index} Button {actionIndex} Title",copyLanguageDescription:"All properties will be copied from the selected language to the current language, which will override the existing content in the current language.",isPublic:"Public Access",isTemplate:"Use as template page",isTemplateSection:"Template dynamic card",templateDescription:"Card description, used to generate card content when using AIGNE to generate page content",templateSectionNameRequired:"Name is required for template section to set values when using dynamic templates",templateSectionNameHelper:"Section name is used to identify the section in the template, please use a meaningful and unique name, so that the section can be set content later",templateSectionNameDuplicated:"Section name must be unique among all template sections in the page",propertyNotFound:"Failed to modify parameter, reason: component does not exist `{key}` property",configLLMDescription:"Configure LLM description",llmConfigTitle:"LLM Configuration Details",llmConfigLabel:"LLM Configuration Information",llmConfigPlaceholder:"Enter additional configuration information for LLM",llmConfigInstructions:"Configure which properties should be processed by AI and provide detailed descriptions.",llmPropertyDescribe:"Description for AI",loading:"Loading...",componentNotFound:"Component not found",templateName:"Template Name",mobile:"Mobile",desktop:"Desktop",columns:"Columns",visualGridLayout:"Configure Grid Layout",dragResizeInstructions:"Drag and resize cards to set layout, you can set different layouts for desktop and mobile",setAsBackgroundElement:"Set as background element (cannot drag and resize)",setAsNormalElement:"Set as normal element (can drag and resize)"},siteMap:{routes:"Routes",empty:"No Routes",pageProperties:"Route Properties",handler:"Handler",data:"Data Source",noDataSource:"No data source",loading:"Loading",unknownSource:"Unknown Source",question:"Page Rules",questionPlaceholder:"Enter page rules, describe your requirements",pageTemplate:"Page Template",selectPageTemplate:"Select a page template",agent:"Agent",noAgent:"No Agent",noRouteSelected:"No route selected. Please select a route from the list or create a new one.",enableGenerate:"Enable AI Generate",path:"Path",generate:"Generate Page Content",generating:"Generating...",deleteRouteTitle:"Delete Route",deleteRouteConfirm:"Are you sure you want to delete this route? This action cannot be undone.",routeDeleted:"Route deleted successfully",confirmRemoveParamsTitle:"Remove Dynamic Parameters",confirmRemoveParamsDescription:"The following dynamic parameters will be removed from the route:",paramOptionsTitle:"Parameter Options",paramOptionsDescription:"Configure options for dynamic parameters in the route",paramOptionName:"Option name",deleteOption:"Delete option",addChildOption:"Add child option",noParamOptions:"No parameter options yet, click the button below to add",addParamOption:"Add parameter option",errorEmptyValue:"Value cannot be empty",errorContainsSlash:"Value cannot contain slash (/)",errorInvalidChars:"Value contains invalid characters, please use only URL-safe characters"},datasource:{autoSaveSuccess:"Auto save success"}},error:{embedUrl:"Embed url error",notFoundEmbed:"Not Found Embed",noBackground:"No background",notConfig:"Not config",slugAlreadyExists:"Slug already exists",slugRequired:"Slug cannot be empty",invalidJson:"Invalid JSON format"},fabric:{fontFamily:"Font Family (Deprecated)",basicComponent:{titleFontFamily:"Title Font Family",titleFontFamilyHelper:"* Globally modify the paragraph heading font",descFontFamily:"Description Font Family",descFontFamilyHelper:"* Globally modify the paragraph description font"}},ai:{list:{noTemplatesInStudio:"You haven't create any prompt template in AI Studio yet.",createNow:"Create Now",noTemplates:"No template has been provided yet"},output:{errorMessage:"Something wrong with me, please try it later.",words:"Words",characters:"Characters",copied:"Copied!"},generate:"Generate",text:{title:"Text Assistant",description:"Use AI to help with write text",theme:"Content",themeHelper:"Organize the input to make it more suitable for the web page",language:"Language",languageHelper:"Output text language",size:"Size",sizeHelper:"Output text size",original:"Original",improve:"Improve"},status:{install:"Check whether the ai-kit is installed",unavailable:"Check whether the openai key is set properly"}},translate:{translate:"Translate",title:"Translation page",into:"Translate into",ing:"Translating",ingTip:"Translating content to {targetLanguage}. please wait a moment..",confirm:"Confirm",confirmTitle:"Confirm translation information",confirmContent:"Are you sure to translate to {target} and add {target} content after translation?",overlay:"Are you sure to continue the translation and override the {target} content after translation?",success:"Translation success",fail:"Translation failed, please try again",failed:"Translation failed. Please check and try again",localInput:"Local input",abort:"Cancel translation",sameLanguage:"Source language and target language cannot be the same",noTargetLanguage:"Please select target language",noValidTargetLanguage:"Source and target languages cannot be the same. Please select different target languages",noSourceData:"No source data found for translation",failedFor:"Translation failed for",translating:"Translating...",field:"Field",unsavedChanges:"You have unsaved changes. Do you want to save before closing?",templateSyncTip:"You only need to maintain one language version of your page template. We will automatically sync the template configuration while handling translations."},aiRuntime:{aiSettings:"AI Settings",unnamed:"Unnamed",project:"Project",assistant:"Assistant",widget:"Widget",all:"All",form:"Form",result:"Result",submitButton:"Submit Button",submitIcon:"Submit Icon",submitBackground:"Submit Background",placeholder:"Placeholder",loadingIndicator:"Loading Indicator"},basicInfo:"Basic Info",name:"Name",description:"Description",tags:"Tags",previewImage:"Preview Image",properties:"Properties",property:"Property",addObject:"New {object}",key:"Key",label:"Label",type:"Type",defaultValue:"Default Value",renderer:"Renderer",parameters:"Parameters",i18nEditorTitle:"I18N Editor",close:"Close",component:"Component",delete:"Delete",duplicate:"Duplicate",move:{up:"Move up",down:"Move down"},show:"Show",hide:"Hide",showParameter:"Show Parameter Config",hideParameter:"Hide Parameter Config",dragSort:"Drag sort",saved:"Saved",supportMarkdownSyntaxPlaceholder:"support markdown syntax",settings:{appearanceTip:"Appearance settings have been migrated to the Blocklet management page, users with admin access can click the link below to configure",appearanceLink:"Go to Appearance Settings >",tabs:{basic:"Basic",appearance:"Appearance",resources:"Resources",integration:"Integration"},basic:{title:"Basic Information",avatar:"Project Avatar",name:"Project Name",namePlaceholder:"Please enter project name",description:"Project Description",descriptionPlaceholder:"Please describe your project",slug:"Project Slug",slugPlaceholder:"Please enter project slug",slugHelper:"Project slug can only contain letters, numbers, hyphens and underscores",changeAvatar:"Change Avatar"},resources:{all:"Enable all resource components",resourceBlocklet:"Selected resource components",addResource:"Select resource components",needInstallResourceByAdmin:"Please install resource components by admin",noSelectedResources:"No selected any resource components"},integration:{packageSetting:"Package Setting",migrateToComponentStudio:"Migrate Component Settings"}},edit:{modified:"Modified",new:"New",deleted:"Deleted",undo:"Undo",redo:"Redo"},style:{title:"Global Style"}}),a=e.flatten({cannotFindPropertyKey:"无法找到属性键:{key}",deleteProjectAlertPrefix:"这将永久删除名称为",resetProjectAlertPrefix:"这将重置名称为",deleteProjectAlertSuffix:"的项目",resetProjectAlertSuffix:"的项目",confirmTip:"请输入项目名称",confirmDelete:"请输入 {name} 以确认删除",confirmReset:"请输入 {name} 以确认重置",uploadNewIcon:"上传新图标",requiredKey:"键不能为空,请设置一个唯一的键,以便在组件中引用和配置参数",duplicateKey:"键已存在,请设置一个唯一的键",clickToGenerateNpmLink:"点击生成链接",projects:{project:"项目",myProjects:"我的项目",projectToGetStart:"创建项目",unnamed:"未命名项目",noDescription:"暂无描述",lastUpdated:"最后更新",edit:"编辑",delete:"删除",pin:"置顶",unpin:"取消置顶",name:"名称",slug:"路径",projectSlug:"请输入项目路径",projectName:"请输入项目名称",newProjectDescriptionPlaceholder:"请输入项目描述",description:"描述",chooseTemplate:"选择模板",chooseTemplateTip:"选择模板快速开始,或开创您的独特项目 - 点击创建您的专属之旅!",blankTemplate:"空白模板",welcomeTemplate:"欢迎模板",limitReached:"扩展项目数量",limitReachedTip:"你已经达到了项目数量上限 <b>{limit}</b>,请删除未使用的项目并重试。<br/>你也可以部署自己的 Pages Kit 来创建更多项目。",limitReachedConfirm:"部署我的 Pages Kit",topToggle:{sitemap:"站点地图",data:"数据源",template:"模板",page:"页面"},dataSourceEmpty:'暂无数据源,点击"添加"按钮创建',selectDataSource:"请选择左侧的数据源进行操作",createDataSourceFirst:"请先创建一个数据源"},alert:{delete:"删除"},common:{goToHome:"返回首页",delete:"删除",cancel:"取消",add:"添加",addMultiple:"添加 ({count})",create:"创建",language:"语言",pageNotFound:"页面未找到",confirmDialogTitle:"确认",all:"全部",back:"返回首页",retry:"重试",defaultLanguage:"默认语言",close:"关闭",saveSuccess:"保存成功",resourceBlocklet:"资源 Blocklet",select:"选择",ok:"确定",refreshData:"刷新数据",clear:"清除",confirm:"确认"},section:{card:{type:"卡片类型",title:"卡片",addCard:"新增卡片",align:"卡片对齐方式",textAlign:"文本对齐方式"},list:{columns:"列数",gap:"间距",align:"对齐方式"}},maker:{sections:{empty:"暂无卡片",emptySubItems:"暂无子卡片",dropHere:"拖拽到这里"},layoutBlock:{draftPlaceholder:`使用网格布局对卡片进行排版 \r
3
+ (此提示仅在草稿模式下显示)`},pageTitle:"页面编辑器",save:"保存",publish:"发布",publishToProduction:"发布到正式版",publishToProductionTip:"任何人都可以看到正式版",publishConfirmContent:"发布到",publishSelectPagesMessage:"请选择要发布的页面",publishSuccessMessage:"发布成功",importSuccessMessage:"导入成功",preview:"预览",pagePreview:"页面预览",livePreview:"实时预览",production:"正式版",draft:"草稿",previewRouteWithDynamicParams:"无法预览含动态参数的路由。请先在站点地图中选择或配置参数选项。",configColor:"设置颜色",configColorMuiTheme:"主题色",configColorCustomColor:"自定义颜色",configColorMuiThemeInfo:"使用主题色会自动适应主题配色及亮暗模式",configColorMuiThemeWithAlternateColor:" (包含亮/暗两种模式)",configColorLightMode:"亮色模式",configColorDarkMode:"暗黑模式",import:"导入",importDialog:{upload:{title:"从文件导入",description:"从本地文件导入",tip:"请选择要导入的文件"},resource:{description:"从资源导入"}},error:{dataSourceNotFound:"未找到数据源配置,请先在站点地图中配置页面数据源",refreshDataFailed:"数据刷新失败,请稍后重试",missingRouteOrProject:"缺少路由或项目信息"},export:"导出",noPreviewAvailable:"无可用预览",networkStatus:{online:"网络连接正常 - 您的修改将实时同步到服务器",offline:"网络连接中断 - 您的修改将在网络恢复后自动同步"},routePreview:{loading:"加载中...",generatingPageStructure:"正在生成页面内容结构...",generatingSectionContent:"正在生成卡片内容...",routePreview:"路由预览",noDisplayTemplate:"该路由没有显示模板",templateNotFound:"未找到显示模板",noSectionsAvailable:"没有可用内容",optimizeContent:"内容优化",optimizeContentButton:"使用 AI 优化内容",sectionRule:"卡片规则",sectionRulePlaceholder:"输入卡片规则",confirmOptimize:"确认",cancelOptimize:"取消"},pages:{addPage:"创建页面",createResource:"创建资源",addResource:"从商店添加资源",pages:"页面",template:"模板",sections:"卡片",deleteTitle:"删除 {name} 页面?",deleteSectionTitle:"删除 {name} 卡片?",empty:"暂无页面",needPublish:"此页面有可发布的新修改",notPublic:"此页面未公开",expandAllRoutes:"展开所有关联路由",collapseAllRoutes:"折叠所有关联路由",addPageDialog:{title:"创建新页面",templateName:"模板名称",templateNamePlaceholder:"输入页面模板名称",autoCreateRoute:"自动创建路由",create:"创建",cancel:"取消"}},components:{components:"组件",addComponent:"添加组件",basicGroup:"基础组件",customGroup:"自定义组件",resourceGroup:"资源组件",deleteTitle:"删除 {name} 组件?",noComponents:"暂无组件",needAddResource:"请在项目设置中选择资源组件",searchComponent:"请输入组件名称进行搜索"},outline:{outline:"概览"},properties:{addArrayItem:"添加一行",arrayEmpty:"暂无行",subProperties:"子属性",addSubProperty:"添加子属性",noSubProperties:"暂无子属性",noProperties:"暂无属性",noParameters:"暂无可配置参数",properties:"属性",setDefaultLocale:"设为默认语言",copyDefault:"设为默认值",copyFull:"复制全部",migrateFromOld:"从老版本复制默认值",path:"路径",title:"标题",description:"描述",icon:"图标",iconSize:"图标大小",image:"图片",imageOptimization:"图片优化",imageOptimizationFast:"速度优先",imageOptimizationQuality:"质量优先",imageMode:"图片模式",hoverStyle:"鼠标悬停样式",videoPoster:"视频封面",imageSize:"图片大小",hasImage:"包含图片",fullSizeImage:"大图模式",src:"源地址",dark:"暗黑",reverse:"反转",background:"背景",badge:"标签",buttons:"按钮",button:"按钮",border:"边框",shadow:"阴影",color:"颜色",variant:"样式",isPageLink:"是否内部链接?",link:"链接",style:"样式",card:"卡片",list:"列表",center:"居中",sort:"排序",asc:"升序",desc:"降序",createdAt:"创建时间",updatedAt:"更新时间",pathCheckRequired:"请输入路径",pathCheckStartWithSlash:"路径开头必须是 /",pathCheckEndWithoutSlash:"路径结尾不能是 /",pathCheckConsecutiveSlash:"路径中不能包含连续的 /",pathCheckWhitespace:"路径中不能包含空白字符",pathCheckInvalid:"非法的路径",pathCheckAlreadyExist:"路径已存在",pathCheckHelper:'此处用于设置模板名称,如需修改页面访问路径,请前往"站点地图"进行设置',embedUrl:"部件地址",chooseEmbed:"选择部件",translateFrom:"翻译来自",backgroundColor:"颜色",backgroundImage:"图片/视频",customColor:"自定义颜色",customImage:"自定义图片/视频",boxed:"嵌套盒子模式",bigMode:"大标题模式",paddingY:"上下内边距",paddingX:"左右内边距",maxWidth:"最大宽度",maxWidthCustomTip:"例如: 1200px, 80%, 50vw",customValue:"自定义值",stickyHeader:"固定导航栏",translucent:"沉浸式",hideNavMenus:"隐藏导航菜单",hideFooter:"隐藏页脚",size:"大小",autoWidth:"宽度自适应",iframeHeight:"定义内容高度",translucentTextColor:"沉浸式文本颜色",copyFromOtherLanguage:"从其他语言复制",useCache:"使用缓存",cacheDuration:"缓存时间 (秒)",customComponent:"自定义组件",parameters:"参数",buttonTitle:"第 {index} 个按钮的标题",cardTitle:"第 {index} 个卡片标题",cardDescription:"第 {index} 个卡片描述",cardButtonTitle:"第 {index} 个卡片中第 {actionIndex} 个按钮标题",copyLanguageDescription:"将从选择的语言复制所有属性到当前语言,这将覆盖当前语言的已有内容。",isPublic:"是否公开",isTemplate:"作为模版页面使用",isTemplateSection:"模板动态卡片",templateDescription:"卡片描述,使用 AIGNE 生成页面内容时,会根据卡片描述生成卡片内容",templateSectionNameRequired:"模板卡片需要设置名称,以便在使用动态模板时为卡片设置对应的值",templateSectionNameHelper:"卡片名称用于标识模板中的卡片,请使用有意义且唯一的名称,以便后续为卡片设置内容",templateSectionNameDuplicated:"模板卡片名称在页面中必须唯一,当前名称已被其他模板卡片使用",propertyNotFound:"修改参数失败,原因:组件不存在 `{key}` 属性",configLLMDescription:"配置 LLM 描述",llmConfigTitle:"LLM 配置详情",llmConfigLabel:"LLM 配置信息",llmConfigPlaceholder:"输入用于LLM的额外配置信息",llmConfigInstructions:"配置需要AI处理的属性并提供详细描述",llmPropertyDescribe:"AI提示描述",loading:"加载中...",componentNotFound:"未找到组件",templateName:"模板名称",mobile:"移动端",desktop:"桌面端",columns:"列数",visualGridLayout:"配置网格布局",dragResizeInstructions:"通过调整卡片位置和大小调整布局,可以分别设置桌面端和移动端两种布局",setAsBackgroundElement:"设置为背景卡片(无法拖拽排序、无法设置大小)",setAsNormalElement:"设置为普通卡片(可拖拽排序、可设置大小)"},siteMap:{routes:"路由列表",pageProperties:"路由属性",handler:"处理器",parameters:"参数",parametersHelper:"来自 URL、请求头等参数",data:"数据源",dataPlaceholder:"请输入页面数据",pageTemplate:"页面模板",selectPageTemplate:"选择页面模板",empty:"暂无路由",noDataSource:"无数据源",loading:"加载中...",unknownSource:"未知数据源",question:"页面规则",questionPlaceholder:"输入页面规则,描述您的要求",agent:"Agent",noAgent:"无 Agent",noRouteSelected:"未选择路由,请从左侧列表选择一个路由或创建新路由。",enableGenerate:"启用 AI 生成",path:"路径",generate:"生成页面内容",generating:"生成中...",deleteRouteTitle:"删除路由",deleteRouteConfirm:"你确定要删除此路由吗?此操作无法撤销。",routeDeleted:"路由删除成功",confirmRemoveParamsTitle:"删除动态参数",confirmRemoveParamsDescription:"以下动态参数将从路由中删除:",paramOptionsTitle:"参数可选值",paramOptionsDescription:"配置路由中动态参数的可选值",paramOptionName:"选项名称",deleteOption:"删除选项",addChildOption:"添加子选项",noParamOptions:"暂无参数可选值,点击下方按钮添加",addParamOption:"添加参数可选值",errorEmptyValue:"值不能为空",errorContainsSlash:"值不能包含斜杠 (/)",errorInvalidChars:"值包含无效字符,请仅使用URL安全字符",templates:{default:"默认模板",blog:"博客模板",landing:"落地页模板",form:"表单模板"}},datasource:{autoSaveSuccess:"自动保存成功"}},error:{embedUrl:"Embed 地址有误",notFoundEmbed:"未找到组件",noBackground:"无背景",notConfig:"未设置",slugAlreadyExists:"路径已存在",slugRequired:"路径不能为空",invalidJson:"JSON格式无效"},fabric:{fontFamily:"全局字体(已废弃)",basicComponent:{titleFontFamily:"段落标题字体",titleFontFamilyHelper:"* 全局修改段落标题字体",descFontFamily:"段落描述字体",descFontFamilyHelper:"* 全局修改段落描述字体"}},ai:{list:{noTemplatesInStudio:"目前您还没有在 AI Studio 里创建任何模版",createNow:"现在创建",noTemplates:"还没有任何模版"},output:{errorMessage:"出错了,请稍后再试",words:"字",characters:"字符",copied:"已复制!"},generate:"生成",text:{title:"文案助手",description:"使用 AI 帮助编写文案",theme:"内容",themeHelper:"整理内容,使描述更加合适网页",language:"语言",languageHelper:"输出文本语言",size:"大小",sizeHelper:"输出内容大小",original:"原文",improve:"改良"},status:{install:"请先检查 ai-kit 是否安装",unavailable:"请先检查 openai key 是否正常设置"}},translate:{title:"翻译页面",translate:"翻译",into:"翻译成",ing:"翻译中",ingTip:"将内容翻译为 {targetLanguage}。请稍等...",confirm:"翻译",confirmTitle:"确认翻译信息",confirmContent:"你确认翻译成 {target},并且翻译后新增 {target} 内容吗?",overlay:"确认继续翻译,并且翻译后覆盖 {target} 内容吗?",success:"翻译成功",fail:"翻译失败,请重试",failed:"翻译失败,请检查后重试",localInput:"本地输入",abort:"取消翻译成功",sameLanguage:"源语言和目标语言不能相同",noTargetLanguage:"请选择目标语言",noValidTargetLanguage:"源语言和目标语言不能相同,请选择不同的目标语言",noSourceData:"未找到用于翻译的源数据",failedFor:"翻译失败语言:",translating:"翻译中...",field:"字段",unsavedChanges:"你有未保存的更改。是否在关闭前保存?",templateSyncTip:"您只需维护一种语言版本的页面模板,我们会在处理翻译的同时,自动同步页面模板的配置。"},aiRuntime:{aiSettings:"AI 设置",unnamed:"未命名",project:"项目",assistant:"助手",widget:"部件",all:"全部",form:"仅表单",result:"仅输出",submitButton:"提交按钮",submitIcon:"提交按钮图标",submitBackground:"提交按钮背景色",placeholder:"占位提示",loadingIndicator:"加载提示"},basicInfo:"基础信息",name:"名称",description:"描述",tags:"标签",previewImage:"预览图片",properties:"属性",property:"属性",addObject:"添加{object}",key:"键",label:"标签",type:"类型",defaultValue:"默认值",renderer:"渲染方式",parameters:"参数",i18nEditorTitle:"国际化编辑",close:"关闭",component:"组件",delete:"删除",duplicate:"复制",move:{up:"上移",down:"下移"},show:"显示",hide:"隐藏",showParameter:"显示参数配置",hideParameter:"隐藏参数配置",dragSort:"拖拽排序",saved:"保存成功",supportMarkdownSyntaxPlaceholder:"支持输入 markdown",settings:{appearanceTip:"外观设置已迁移至 Blocklet 管理页面,持有管理员通行证的用户,可点击下方链接配置",appearanceLink:"前往外观设置 >",tabs:{basic:"基础设置",appearance:"外观设置",resources:"资源组件",integration:"集成设置"},basic:{title:"基础信息",avatar:"项目头像",name:"项目名称",namePlaceholder:"请输入项目名称",description:"项目描述",descriptionPlaceholder:"请输入项目描述",slug:"项目路径",slugPlaceholder:"请输入项目路径",slugHelper:"项目路径只能包含字母、数字、中划线和下划线",changeAvatar:"更换头像"},resources:{all:"启用所有资源组件",resourceBlocklet:"已选择的资源组件",addResource:"选择资源组件",needInstallResourceByAdmin:"请联系管理员安装资源组件",noSelectedResources:"未选择任何资源组件"},integration:{packageSetting:"包设置",migrateToComponentStudio:"迁移组件设置"}},edit:{modified:"已修改",new:"新增",deleted:"已删除",undo:"撤销",redo:"重做"},style:{title:"公共样式"}}),o={en:t,zh:a};exports.translations=o;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),E=require("./chunks/state-UwRWAZRe.js"),Ee=require("@arcblock/ux/lib/Empty"),N=require("@arcblock/ux/lib/Locale/context"),ne=require("@blocklet/code-editor"),De=require("@mui/icons-material/AddRounded"),Ve=require("@mui/icons-material/ArrowDownward"),ze=require("@mui/icons-material/ArrowUpward"),Ae=require("@mui/icons-material/DeleteOutline"),r=require("@mui/material"),Fe=require("lodash/sortBy"),T=require("react"),ve=require("react-use"),ye=require("@blocklet/pages-kit/builtin/color-picker"),qe=require("./chunks/config-string-CEipCOnU.js"),Ue=require("lodash/isEmpty"),Me=require("lodash/set"),We=require("yaml"),q=require("@blocklet/pages-kit/builtin/uploader"),Le=require("lodash/cloneDeep"),Ke=require("@arcblock/ux/lib/Toast"),X=require("@blocklet/pages-kit/components"),Je=require("@blocklet/pages-kit/utils/property"),Se=require("@mui/base"),D=require("@mui/icons-material"),G=require("@syncedstore/core"),Pe=require("ahooks"),He=require("lodash/assign"),Ye=require("lodash/get"),$e=require("lodash/has"),Ge=require("lodash/isEqual"),Qe=require("lodash/isNil"),Xe=require("lodash/isObject"),Ze=require("lodash/keyBy"),et=require("lodash/omit"),tt=require("lodash/pick"),rt=require("lodash/reduce"),U=require("material-ui-popup-state/hooks"),st=require("react-error-boundary"),it=require("@emotion/css"),re=require("react-dnd"),O=t=>t&&t.__esModule?t:{default:t};function lt(t){if(t&&t.__esModule)return t;const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(s,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return s.default=t,Object.freeze(s)}const ee=O(Ee),ot=O(De),nt=O(Ve),ct=O(ze),at=O(Ae),V=O(Fe),W=O(Ue),we=O(Me),se=lt(We),ut=O(Le),ie=O(Ke),dt=O(He),pt=O(Ye),xt=O($e),mt=O(Ge),Z=O(Qe),ft=O(Xe),bt=O(Ze),ht=O(et),jt=O(tt),yt=O(rt);function gt({onClick:t,disabled:s,sx:i,...l}){return e.jsx(r.IconButton,{size:"small",color:"warning",variant:"outlined",disabled:s,onClick:t,...l,children:e.jsx(at.default,{fontSize:"small"})})}function kt({onClick:t,disabled:s,sx:i,...l}){return e.jsx(r.IconButton,{size:"small",color:"primary",disabled:s,onClick:t,...l,children:e.jsx(ct.default,{fontSize:"small"})})}function vt({onClick:t,disabled:s,sx:i,...l}){return e.jsx(r.IconButton,{size:"small",color:"primary",disabled:s,onClick:t,...l,children:e.jsx(nt.default,{fontSize:"small"})})}function St({label:t,value:s,onChange:i,disabled:l=!1,itemLabel:f="",emptyHeight:g=40,property:x,renderItem:P,...v}){const{t:h,locale:k}=N.useLocaleContext(),y=ve.useUpdate(),o=T.useCallback(p=>{i(E.transformValue(p,x.type))},[i,x.type]),a=T.useMemo(()=>Array.isArray(s)?s:[],[s]),c=T.useCallback(()=>{const p=[...a,""];o(p),y()},[a,o,y]),d=T.useCallback(()=>{if(!x||!x.subProperties)return c();const p={};V.default(Object.values(x.subProperties),"index").forEach(({data:B})=>{var _,z;if(!B.key)return;const R=((z=(_=B.locales)==null?void 0:_[k])==null?void 0:z.defaultValue)??"";p[B.key]=R});const I=[...a,p];o(I),y()},[a,o,y,x,k,c]),u=T.useCallback(p=>{try{const w=JSON.parse(p);Array.isArray(w)?o(w):console.error("JSON解析结果不是数组")}catch(w){console.error("JSON解析错误:",w)}},[o]),S=T.useCallback(p=>{const w=a.filter((I,B)=>B!==p);o(w),y()},[a,o,y]),n=T.useCallback(p=>{if(p<=0)return;const w=[...a],I=w[p];w[p]=w[p-1],w[p-1]=I,o(w),y()},[a,o,y]),b=T.useCallback(p=>{if(p>=a.length-1)return;const w=[...a],I=w[p];w[p]=w[p+1],w[p+1]=I,o(w),y()},[a,o,y]),m=T.useCallback((p,w)=>{const I=[...a];I[p]=w,o(I)},[a,o]),j=x&&x.subProperties&&Object.keys(x.subProperties).length>0,C=T.useMemo(()=>[{field:"index",headerName:"#",width:40,align:"center",renderCell:({index:p})=>e.jsx(r.Typography,{variant:"body1",sx:{bgcolor:"action.hover",borderRadius:"50%",width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:p+1})},{field:"content",headerName:"",renderCell:({row:p,index:w})=>P&&j?P({item:p,index:w,property:x,onChange:I=>m(w,I)}):e.jsx(r.TextField,{fullWidth:!0,size:"small",disabled:l,value:p,placeholder:f||`${h("item")} ${w+1}`,onChange:I=>m(w,I.target.value),...v})},{field:"actions",headerName:"",width:30,align:"center",renderCell:({index:p})=>e.jsxs(r.Stack,{direction:"column",spacing:.25,children:[e.jsx(kt,{disabled:l||p===0,onClick:()=>n(p)}),e.jsx(vt,{disabled:l||p===a.length-1,onClick:()=>b(p)}),e.jsx(gt,{disabled:l,onClick:()=>S(p)})]})}],[P,j,x,m,f,h,l,v,S,n,b,a.length]);return j?e.jsxs(r.Stack,{width:"100%",gap:1,children:[t&&e.jsx(r.FormLabel,{children:t}),a.length>0?e.jsx(r.TableContainer,{component:r.Paper,variant:"outlined",sx:{borderRadius:1,mb:1},children:e.jsxs(r.Table,{size:"small",sx:{"& .MuiTableCell-root":{py:.25,px:1,whiteSpace:"nowrap"},"& .MuiTableCell-head":{backgroundColor:"action.hover",py:.25,px:1},borderCollapse:"collapse"},children:[e.jsx(r.TableHead,{sx:{display:"none"},children:e.jsx(r.TableRow,{children:C.map(p=>e.jsx(r.TableCell,{width:p.width,align:p.align||"left",sx:{fontWeight:"bold"},children:p.renderHeader?p.renderHeader():p.headerName},p.field))})}),e.jsx(r.TableBody,{children:a.map((p,w,I)=>e.jsx(r.TableRow,{sx:{borderBottom:w<I.length-1?"1px solid":"none",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:C.map(B=>e.jsx(r.TableCell,{width:B.width,align:B.align||"left",sx:{borderBottom:"none"},children:B.renderCell({row:p,index:w,onChange:R=>m(w,R)})},`${w}-${B.field}`))},w))})]})}):e.jsx(ee.default,{style:{fontSize:12,height:g},children:h("maker.properties.arrayEmpty")}),e.jsx(r.Button,{fullWidth:!0,size:"small",variant:"outlined",disabled:l,startIcon:e.jsx(ot.default,{}),onClick:d,children:h("maker.properties.addArrayItem")})]}):e.jsxs(r.Stack,{width:"100%",gap:1,children:[t&&e.jsx(r.FormLabel,{children:t}),e.jsx(r.Box,{sx:{border:1,borderColor:"divider",borderRadius:1,minHeight:150},children:e.jsx(ne.CodeEditor,{keyId:x.id,locale:k,language:"json",value:JSON.stringify(a,null,2),onChange:p=>u(p||""),fullScreenOptions:{enableEscExit:!0,targetContainer:()=>document.getElementById("parameters-config-dialog")||null}},x.id)})]})}function Pt({value:t,onChange:s,...i}){const l=T.useRef(null);return e.jsxs(e.Fragment,{children:[e.jsx(qe.ConfigString,{...i,value:t,onChange:s,InputProps:{endAdornment:e.jsx(r.InputAdornment,{position:"end",children:e.jsx(ye.ColorItem,{color:t??"",style:{width:"1.5rem",height:"1.5rem",padding:0},onClick:()=>{var f;(f=l.current)==null||f.open({value:t??""})}})})}}),e.jsx(ye.ConfigColorDialog,{ref:l,onSave:({value:f},g)=>{s(f),g()}})]})}function wt({label:t,value:s,onChange:i,property:l,component:f,defaultLocale:g,allComponents:x,PropertyValueField:P,onUpload:v}){const{locale:h}=N.useLocaleContext(),k=T.useRef(null);if(!W.default(l.subProperties)){const o=V.default(Object.values(l.subProperties||{}),"index").filter(a=>a.data.visible!==!1&&a.data.key);return e.jsxs(r.Stack,{width:"100%",children:[e.jsx(r.FormLabel,{sx:{px:.25,py:.5},children:t}),e.jsx(r.Box,{children:e.jsx(r.Box,{sx:{position:"relative"},children:o.map((a,c)=>{const{data:d}=a,u=d.key??d.id,S=c===o.length-1;let n=null;try{s&&typeof s=="object"?n=s[u]:typeof s=="string"&&(n=(l.type==="yaml"?se.parse(s||""):JSON.parse(s||"{}"))[u])}catch{}n==null&&(d.locales&&h&&d.locales[h]?n=d.locales[h].defaultValue:d.locales&&g&&d.locales[g]&&(n=d.locales[g].defaultValue));const b=j=>{try{let C={};if(typeof s=="string")try{C=l.type==="yaml"?se.parse(s||""):JSON.parse(s||"{}")}catch{}else typeof s=="object"&&s!==null&&(C={...s});we.default(C,u,j);const p=E.transformValue(C,l.type);i==null||i(p)}catch(C){console.error("Error updating property:",C)}},m=8;return e.jsxs(r.Box,{sx:{mb:S?0:1,display:"flex",flexDirection:"row"},children:[e.jsxs(r.Box,{sx:{position:"relative",width:24,flexShrink:0},children:[e.jsx(r.Box,{sx:{position:"absolute",left:m,top:0,height:16,width:0,borderLeft:"1px dashed",borderColor:"divider"}}),e.jsx(r.Box,{sx:{position:"absolute",left:m,top:16,width:12,height:0,borderTop:"1px dashed",borderColor:"divider"}}),!S&&e.jsx(r.Box,{sx:{position:"absolute",left:m,top:16,bottom:-8,width:0,borderLeft:"1px dashed",borderColor:"divider"}})]}),e.jsx(r.Box,{sx:{flexGrow:1},children:e.jsx(P,{component:f,property:d,value:n,onChange:b,size:"small",fullWidth:!0,defaultLocale:g,allComponents:x})})]},d.id)})})})]})}return e.jsx(r.Stack,{width:"100%",gap:2,children:e.jsxs(r.Stack,{sx:{width:"100%",position:"relative",pt:1,pb:"6px",px:"1px",minHeight:50,".monaco-editor,.overflow-guard":{borderRadius:1}},children:[e.jsx(r.FormLabel,{sx:{position:"absolute",left:0,top:0,transform:"translate(0px, -7px) scale(0.75)"},children:t}),e.jsx(ne.CodeEditor,{keyId:l.id,locale:h,language:l.type==="yaml"?"yaml":"json",value:typeof s=="string"?s:"",onChange:o=>{i==null||i(o)},onUpload:o=>{k.current=o,v&&v(o)},fullScreenOptions:{enableEscExit:!0,targetContainer:()=>document.getElementById("parameters-config-dialog")||null}},l.id),e.jsx(r.Box,{component:"fieldset",sx:{pointerEvents:"none",position:"absolute",left:0,top:-5,width:"100%",height:"100%",border:1,borderColor:"rgba(0, 0, 0, 0.23)",borderRadius:1,px:1,py:0},children:e.jsx(r.Box,{component:"legend",sx:{fontSize:"0.75em"},children:e.jsx(r.Box,{component:"span",sx:{opacity:0},children:t})})})]})})}const Ct=["string","multiline","json","yaml","url","component","custom","array"];function ge(t){return t.type?!Ct.includes(t.type):!1}function Ce({disabled:t,list:s,renderItem:i,...l}){const f=T.useRef(null),g=T.useId(),x=Pe.useUpdate(),P=V.default(Object.entries(s),a=>a[1].index).map(a=>a[0]),v=T.useRef(P),h=T.useCallback(a=>{v.current=a,x()},[x]),k=T.useCallback(({index:a},{index:c})=>{const d=[...v.current];d.splice(c,0,...d.splice(a,1)),h(d)},[h]);T.useEffect(()=>{h(P)},[P.join("-")]);const[{isOver:y},o]=re.useDrop({accept:g,collect:a=>({isOver:a.isOver()}),canDrop:()=>!t,drop:()=>{var d;const a=()=>{v.current.forEach((u,S)=>{const n=s[u];n&&(n.index=S)})},c=(d=G.getYjsValue(s))==null?void 0:d.doc;c?c.transact(()=>{a()}):a()}});return T.useEffect(()=>{y||h(P)},[y]),o(f),e.jsx(r.Box,{...l,ref:f,className:it.cx(y&&"isDragging"),children:v.current.map((a,c)=>e.jsx(It,{type:g,disabled:t,id:a,index:c,itemIndex:d=>v.current.indexOf(d),move:k,children:d=>{const u=s[a];return u?i(u.data,c,d):null}},a))})}function It({disabled:t,id:s,index:i,type:l,children:f,itemIndex:g,move:x}){const P=T.useRef(),[{isDragging:v},h,k]=re.useDrag({type:l,item:()=>({id:s}),canDrag:()=>!t,collect:o=>({isDragging:o.isDragging()})}),[,y]=re.useDrop({accept:l,canDrop:()=>!t,hover(o,a){var m;if(!P.current)return;const c=g(o.id),d=i;if(c===d)return;const u=(m=P.current)==null?void 0:m.getBoundingClientRect(),S=(u.bottom-u.top)/2,b=a.getClientOffset().y-u.top;c<d&&b<S||c>d&&b>S||x({id:o.id,index:c},{id:s,index:i})}});return typeof f=="function"?f({isDragging:v,drag:h,drop:o=>(P.current=o,y(o)),preview:k}):(h(y(k(P))),e.jsx(r.Box,{ref:P,children:f}))}function Tt({drop:t,preview:s,drag:i,disabled:l,isDragging:f,children:g,onDelete:x,onVisibilityChange:P,visible:v=!0,actions:h,alwaysShowActions:k=!1}){const{t:y}=N.useLocaleContext();return e.jsx(r.Box,{ref:t,sx:{":hover .hover-visible":{maxWidth:"100%"},opacity:v?1:.5},children:e.jsxs(r.Box,{sx:{position:"relative"},children:[e.jsx(r.Box,{ref:s,sx:{flex:1,borderRadius:.5,bgcolor:f?"action.hover":"background.paper",opacity:.9999},children:g}),!l&&e.jsx(r.Box,{className:k?"":"hover-visible",sx:{maxWidth:k?"100%":0,overflow:"hidden",position:"absolute",right:2,top:2,transition:"max-width 0.3s ease-in-out"},children:e.jsxs(r.Stack,{direction:"row",sx:{bgcolor:o=>r.alpha(o.palette.grey[200],.9),borderRadius:1,p:.5,[`.${r.buttonClasses.root}`]:{minWidth:24,width:24,height:24,p:0}},children:[h,P&&e.jsx(r.Tooltip,{title:y(v?"hideParameter":"showParameter"),disableInteractive:!0,placement:"top",children:e.jsx(r.Button,{onClick:()=>P(!v),children:v?e.jsx(D.VisibilityOffRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}}):e.jsx(D.VisibilityRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}})})}),x&&e.jsx(r.Tooltip,{title:y("delete"),disableInteractive:!0,placement:"top",children:e.jsx(r.Button,{onClick:x,children:e.jsx(D.DeleteOutlineRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}})})}),e.jsx(r.Tooltip,{title:y("dragSort"),disableInteractive:!0,placement:"top",children:e.jsx(r.Button,{ref:i,children:e.jsx(D.DragIndicatorRounded,{sx:{color:"grey.500"}})})})]})})]})})}function Bt(t){const s=["string","json","array","url","multiline"],i=["style","fontSize","color","content","type"];return!!(s.includes(t.type||"")&&!i.includes(t.key||""))}function Ot(t,s,i){return t.locales&&t.locales[s]&&t.locales[s].name?t.locales[s].name:i&&t.locales&&t.locales[i]&&t.locales[i].name?t.locales[i].name:t.key?t.key:t.id}const Ie=(t,s,i,l)=>{const f={};return V.default(Object.entries(t),([,x])=>x.index).forEach(([x,P])=>{const v=P.data;if(!v)return;const h=v.key||v.id,k=i?Ot(v,i,l||""):h,y=s==null?void 0:s[v.id],o={key:h,isNeedGenerate:(y==null?void 0:y.isNeedGenerate)??Bt(v),describe:(y==null?void 0:y.describe)??"",displayName:k};v.subProperties&&!W.default(v.subProperties)&&(o.subProperties=Ie(v.subProperties,y==null?void 0:y.subProperties,i,l)),f[v.id]=o}),f};function Nt({open:t,onClose:s,onConfirm:i,component:l,initialConfig:f,locale:g,defaultLocale:x,title:P,loading:v=!1}){const{t:h}=N.useLocaleContext(),[k,y]=T.useState(null);T.useEffect(()=>{if(t&&l){const u={properties:{}};if(l.properties){const S=f==null?void 0:f.properties;u.properties=Ie(l.properties,S,g,x)}y(u)}},[t,l,f,g,x]);const o=()=>{s()},a=()=>{k&&(i(k),s())},c=(u,S,n)=>{if(!k||!u.length)return;const b=JSON.parse(JSON.stringify(k));let m=b.properties,j=null;for(let p=0;p<u.length-1;p++){const w=u[p];if(!w||!m[w])return;j=m;const I=m[w];I.subProperties||(I.subProperties={}),m=I.subProperties}const C=u[u.length-1];if(C){if("isNeedGenerate"in n){const p=n.isNeedGenerate,w={...S,...n};if(S.subProperties&&!W.default(S.subProperties)){const I=(B,R)=>{const _={};return Object.entries(B).forEach(([z,A])=>{const F={...A};R!==null&&(F.isNeedGenerate=R),A.subProperties&&!W.default(A.subProperties)&&(F.subProperties=I(A.subProperties,R!==null?R:null)),_[z]=F}),_};w.subProperties=I(S.subProperties,p===!1?!1:null)}if(u.length===1)b.properties[C]=w;else if(j&&u.length>=2){const I=u[u.length-2];I&&j[I]&&(j[I].subProperties||(j[I].subProperties={}),j[I].subProperties[C]=w)}}else if(u.length===1)b.properties[C]={...S,...n};else if(j&&u.length>=2){const p=u[u.length-2];p&&j[p]&&j[p].subProperties&&(j[p].subProperties[C]={...S,...n})}y(b)}},d=(u,S=[],n=!0)=>{if(!u||W.default(u))return null;const b=V.default(Object.entries(u),([,m])=>m.displayName);return e.jsx(r.Stack,{spacing:1.5,children:b.map(([m,j],C)=>{const p=[...S,m],w=C===b.length-1,I=j.subProperties&&!W.default(j.subProperties),B=j.displayName||m,R=!n;return e.jsx(r.Box,{sx:{position:"relative"},children:e.jsxs(r.Stack,{direction:"row",children:[S.length>0&&e.jsxs(r.Box,{sx:{position:"relative",width:24,flexShrink:0},children:[e.jsx(r.Box,{sx:{position:"absolute",left:8,top:0,height:16,width:0,borderLeft:"1px dashed",borderColor:"divider"}}),e.jsx(r.Box,{sx:{position:"absolute",left:8,top:16,width:12,height:0,borderTop:"1px dashed",borderColor:"divider"}}),!w&&e.jsx(r.Box,{sx:{position:"absolute",left:8,top:16,bottom:-12,width:0,borderLeft:"1px dashed",borderColor:"divider"}})]}),e.jsxs(r.Stack,{spacing:1.5,sx:{flexGrow:1},children:[e.jsxs(r.Stack,{direction:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},spacing:1.5,width:"100%",children:[e.jsx(r.FormControlLabel,{control:e.jsx(r.Checkbox,{checked:j.isNeedGenerate,disabled:R,onChange:_=>{c(p,j,{isNeedGenerate:_.target.checked})}}),label:B,sx:{minWidth:"180px",maxWidth:"280px",mr:2,"& .MuiFormControlLabel-label":{wordBreak:"break-word"}}}),e.jsx(r.TextField,{size:"small",fullWidth:!0,label:h("maker.properties.llmPropertyDescribe"),value:j.describe,onChange:_=>{c(p,j,{describe:_.target.value})},disabled:!j.isNeedGenerate})]}),I&&e.jsx(r.Box,{sx:{ml:3},children:d(j.subProperties,p,j.isNeedGenerate&&n)})]})]})},m)})})};return e.jsxs(r.Dialog,{open:t,onClose:o,maxWidth:"lg",fullWidth:!0,children:[e.jsx(r.DialogTitle,{children:P||h("maker.properties.llmConfigTitle")}),e.jsx(r.DialogContent,{children:e.jsx(r.Box,{my:3,children:v?e.jsx(r.Typography,{children:h("maker.properties.loading")}):l?k?e.jsxs(r.Stack,{spacing:3,children:[e.jsx(r.Typography,{variant:"subtitle2",children:h("maker.properties.llmConfigInstructions")}),d(k.properties)]}):e.jsx(r.Typography,{children:h("maker.properties.loading")}):e.jsx(r.Typography,{color:"error",children:h("maker.properties.componentNotFound")})})}),e.jsxs(r.DialogActions,{children:[e.jsx(r.Button,{onClick:o,children:h("common.cancel")}),e.jsx(r.Button,{variant:"contained",onClick:a,disabled:!k||v,children:h("common.confirm")})]})]})}function Rt({label:t,value:s,onChange:i}){const[l,f]=T.useState(!1);return e.jsxs(r.Stack,{gap:1,children:[e.jsx(r.TextField,{label:t,size:"small",value:s,onChange:g=>i==null?void 0:i(g.target.value),InputProps:{endAdornment:e.jsx(q.UploaderButton,{onChange:({response:g})=>{var P;const x=(P=g==null?void 0:g.data)==null?void 0:P.filename;x&&(i==null||i(x))}})}}),s&&e.jsx(r.Box,{component:"img",sx:{objectFit:"contain",borderRadius:1,cursor:"pointer"},src:E.getImageAbsoluteUrl(s),alt:t,maxWidth:100,maxHeight:100,width:"100%",onClick:()=>f(!0)}),e.jsx(r.Dialog,{open:l,onClose:()=>f(!1),children:e.jsx(r.Box,{component:"img",sx:{objectFit:"contain"},src:E.getImageAbsoluteUrl(s),alt:t})})]})}function le(t,s=""){return yt.default(t,(i,l,f)=>{const g=s?`${s}.${f}`:f;return ft.default(l)?dt.default(i,le(l,g)):i[g]=l,i},{})}const _t=[{value:"string",label:"Text"},{value:"multiline",label:"Text (Multiline)"},{value:"number",label:"Number"},{value:"decimal",label:"Decimal"},{value:"boolean",label:"Boolean"},{value:"color",label:"Color"},{value:"url",label:"URL (Upload)"},{value:"json",label:"JSON"},{value:"yaml",label:"YAML"},{value:"array",label:"Array"},{value:"component",label:"Component"},{value:"custom",label:"Custom (Render by a Component)"}];function Q(t,s,i){return!t||!i?!1:Object.values(t).some(({data:l})=>l.id!==s&&l.key===i)}function oe(t,s){var i;return!t||!s?!1:((i=t[s])==null?void 0:i.data.visible)??!0}function Et({componentId:t}){const{state:{components:s}}=E.useStore(),i=s[t],l=i==null?void 0:i.data;return l?e.jsx(r.Stack,{maxHeight:"100%",overflow:"auto",children:e.jsx(r.Box,{p:2,children:e.jsx(st.ErrorBoundary,{FallbackComponent:E.ErrorView,resetKeys:[t],children:e.jsx(Dt,{value:l,componentId:t})})})}):null}function Dt({value:t,componentId:s}){var y,o,a;const{t:i}=N.useLocaleContext(),{localState:{currentLocale:l,customComponentPreviewerProperties:f},state:{config:{defaultLocale:g}},localActions:{setCustomComponentPreviewerProperties:x}}=E.useStore(),P=G.getYjsValue(t).doc,v=E.useAllComponents(),h=T.useMemo(()=>(f==null?void 0:f[s])??{},[s,f]),k=Pe.useReactive({componentId:s,propertiesValue:{...h}});return T.useEffect(()=>{k.componentId!==s&&(k.componentId=s,k.propertiesValue={...h})},[s,h,k]),T.useEffect(()=>{if(k.componentId!==s)return;const c=Object.fromEntries(Object.values(t.properties??{}).map(({data:d})=>{var u,S,n,b,m;return[d.id,{value:((u=k.propertiesValue[d.id])==null?void 0:u.value)??Je.parsePropertyValue(d,((n=(S=d.locales)==null?void 0:S[l])==null?void 0:n.defaultValue)??((m=(b=d.locales)==null?void 0:b[g])==null?void 0:m.defaultValue),{locale:l,defaultLocale:g})}]}));x(s,c)},[JSON.stringify(k.propertiesValue),s,k.componentId]),e.jsx(r.Stack,{height:"100%",children:e.jsxs(r.Stack,{gap:2,children:[e.jsx(Te,{config:t}),e.jsx(Oe,{config:t,currentLocale:l,defaultLocale:g,allComponents:v,onUpdateConfig:c=>{P.transact(()=>{c(t)})}}),e.jsxs(r.Stack,{gap:2,direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(r.Typography,{variant:"subtitle1",children:i("renderer")}),e.jsxs(r.TextField,{hiddenLabel:!0,size:"small",select:!0,SelectProps:{autoWidth:!0},value:((y=t.renderer)==null?void 0:y.type)||"react-component",onChange:c=>{P.transact(()=>{const d=c.target.value;t.renderer??(t.renderer={type:d}),t.renderer.type=d})},children:[e.jsx(r.MenuItem,{value:"react-component",children:"React Component"}),e.jsx(r.MenuItem,{value:"component",children:"Custom Component"})]})]}),((o=t.renderer)==null?void 0:o.type)==="component"&&e.jsx(Mt,{value:t}),((a=t.renderer)==null?void 0:a.type)==="react-component"&&e.jsx(Ut,{value:t}),e.jsx(ce,{config:t,currentLocale:l,defaultLocale:g,allComponents:v,propertiesValue:k.propertiesValue,onChange:({value:c,id:d,path:u})=>{const S=[...u,"data"];if(!pt.default(t,S)){ie.default.warning(i("cannotFindPropertyKey",{key:S.join(".")}));return}k.propertiesValue[d]={value:c.value}}})]})})}function Te({config:t}){const{t:s}=N.useLocaleContext();return e.jsx(q.UploaderProvider,{children:e.jsxs(r.Stack,{gap:2,children:[e.jsx(r.Typography,{variant:"subtitle1",children:s("basicInfo")}),e.jsx(r.TextField,{label:s("name"),size:"small",value:t.name||"",onChange:i=>t.name=i.target.value}),e.jsx(r.TextField,{label:s("description"),size:"small",multiline:!0,minRows:2,maxRows:10,inputProps:{maxLength:200},value:t.description||"",onChange:i=>t.description=i.target.value,InputProps:{endAdornment:e.jsx(r.InputAdornment,{position:"end",sx:{mt:-1.5},children:e.jsx(Wt,{config:t})})}}),e.jsx(r.Autocomplete,{size:"small",options:[],multiple:!0,freeSolo:!0,value:t.tags??[],onChange:(i,l)=>t.tags=l,renderInput:i=>e.jsx(r.TextField,{label:s("tags"),...i})}),e.jsx(Rt,{label:s("previewImage"),value:t.previewImage||"",onChange:i=>t.previewImage=i})]})})}function Be({data:t,params:s,visible:i,config:l,currentLocale:f,defaultLocale:g,allComponents:x,onUpdateConfig:P}){var k,y,o,a,c,d;const{t:v}=N.useLocaleContext(),h=T.useMemo(()=>t.type==="json"||t.type==="yaml"||t.type==="array"?Ft:L,[t.type]);return e.jsx(Tt,{preview:s.preview,drop:s.drop,drag:s.drag,isDragging:s.isDragging,onDelete:()=>{P(u=>{if(u.properties){const n=Object.entries(u.properties).sort(([,m],[,j])=>m.index-j.index);delete u.properties[t.id],n.filter(([m])=>m!==t.id).forEach(([,m],j)=>{m.index=j})}})},visible:i,onVisibilityChange:u=>{P(S=>{const n=S.properties[t.id].data;n.visible=u})},alwaysShowActions:!0,children:e.jsxs(r.Stack,{direction:"column",gap:2,children:[e.jsx(r.TextField,{label:v("key"),size:"small",required:!0,sx:{width:"calc(100% - 80px - 8px)",flex:1,"& .MuiOutlinedInput-root":{borderColor:t.key?Q(l.properties,t.id,t.key)?"warning.main":void 0:"error.main"},"& .MuiFormLabel-root":{color:t.key?Q(l.properties,t.id,t.key)?"warning.main":"text.secondary":"error.main"},"& .MuiFormLabel-root.Mui-focused":{color:t.key?Q(l.properties,t.id,t.key)?"warning.main":"primary.main":"error.main"}},value:t.key||"",onChange:u=>{P(S=>{const n=S.properties[t.id].data;n.key=u.target.value.trim()})},InputProps:{endAdornment:!t.key||t.key&&Q(l.properties,t.id,t.key)?e.jsx(r.InputAdornment,{position:"end",sx:{width:16,ml:0},children:e.jsx(r.Tooltip,{title:t.key?v("duplicateKey"):v("requiredKey"),children:e.jsx(D.InfoRounded,{sx:{color:t.key?"warning.main":"error.main",fontSize:16}})})}):null}}),e.jsxs(r.Stack,{direction:"row",gap:1,children:[e.jsx(r.TextField,{label:v("label"),size:"small",sx:{flex:1},value:(((y=(k=t.locales)==null?void 0:k[f])==null?void 0:y.name)??((a=(o=t.locales)==null?void 0:o[g])==null?void 0:a.name))||"",onChange:u=>{P(S=>{var b;const n=S.properties[t.id].data;n.locales??(n.locales={}),(b=n.locales)[f]??(b[f]={}),n.locales[f].name=u.target.value})}}),e.jsx(r.TextField,{label:v("type"),size:"small",select:!0,sx:{flex:1},value:t.type==="string"&&t.multiline?"multiline":t.type||"string",onChange:u=>{P(S=>{const n=S.properties[t.id].data;if(n.locales)for(const m of Object.keys(n.locales))n.locales[m].defaultValue=void 0;const b=u.target.value;b==="multiline"?(n.type="string",n.multiline=!0):(typeof n.multiline<"u"&&delete n.multiline,n.type=b)})},children:_t.map(u=>e.jsx(r.MenuItem,{value:u.value,children:u.label},u.value))})]}),e.jsxs(r.Stack,{direction:"row",gap:1,children:[e.jsx(h,{allComponents:x,defaultLocale:g,component:l,property:t,label:v("defaultValue"),size:"small",fullWidth:!0,value:(d=(c=t.locales)==null?void 0:c[f])==null?void 0:d.defaultValue,onChange:(u,S)=>{P(n=>{var m;const b=n.properties[t.id].data;if(S!=null&&S.forceUpdateProperty){const j=le(b),C=le(u);Object.keys(C).forEach(p=>{j[p]||we.default(b,p,C[p])})}else b.locales??(b.locales={}),(m=b.locales)[f]??(m[f]={}),b.locales[f].defaultValue=u})}}),t.type==="custom"?e.jsx(r.Box,{children:e.jsx(zt,{property:t,allComponents:x})}):null]})]})})}function Vt(t,s){const[i,l]=T.useState(0);return T.useEffect(()=>{const g=setTimeout(()=>{if(t.current){let x=t.current.parentElement,P=0;for(;x;)x.classList.contains("property-container")&&P++,x=x.parentElement;l(P)}},100);return()=>clearTimeout(g)},[t,s]),i}function Oe({config:t,currentLocale:s,defaultLocale:i,allComponents:l,onUpdateConfig:f,useI18nEditor:g=!0}){const{t:x}=N.useLocaleContext(),P=U.usePopupState({variant:"dialog"}),v=t.properties&&V.default(Object.values(t.properties),"index");return e.jsx(q.UploaderProvider,{children:e.jsxs(r.Stack,{gap:2,children:[e.jsxs(r.Stack,{direction:"row",gap:1,alignItems:"center",justifyContent:"space-between",children:[e.jsx(r.Typography,{variant:"subtitle1",children:x("properties")}),e.jsx(r.Box,{flex:1}),g&&e.jsx(r.Button,{sx:{minWidth:32,minHeight:32,p:0},...U.bindTrigger(P),children:e.jsx(D.TranslateRounded,{fontSize:"small"})})]}),t.properties&&Object.keys(t.properties).length>0?e.jsx(Ce,{component:r.Stack,gap:2,list:t.properties,renderItem:(h,k,y)=>{const o=oe(t.properties,h.id);return e.jsx(r.Paper,{elevation:0,className:"property-container",sx:{p:1.25,borderRadius:1,border:o?"1px solid":"1px dashed",borderColor:"divider"},children:e.jsx(r.Stack,{gap:2,children:e.jsx(Be,{data:h,params:y,visible:o,config:t,currentLocale:s,defaultLocale:i,allComponents:l,onUpdateConfig:f})})},h.id)}}):e.jsx(ee.default,{style:{fontSize:12},children:x("maker.properties.noProperties")}),e.jsx(r.Button,{fullWidth:!0,variant:"outlined",className:"ignore-style-override",onClick:()=>{f(h=>{var y;const k=E.nextId();h.properties??(h.properties={}),(y=h.properties)[k]??(y[k]={index:(v==null?void 0:v.length)||0,data:{id:k}})})},startIcon:e.jsx(D.AddRounded,{}),children:x("addObject",{object:x("property")})}),g&&e.jsx(Ne,{...U.bindDialog(P),component:t})]})})}function zt({property:t,allComponents:s}){const i=U.usePopupState({variant:"popper"});return e.jsxs(e.Fragment,{children:[e.jsx(r.Button,{sx:{minWidth:0},...U.bindTrigger(i),children:e.jsx(D.SettingsRounded,{fontSize:"small"})}),e.jsx(r.Popper,{...U.bindPopper(i),children:e.jsx(Se.ClickAwayListener,{onClickAway:i.close,children:e.jsx(r.Paper,{children:e.jsx(r.Box,{width:500,p:2,children:e.jsx(te,{value:t.componentId,onChange:(l,f)=>t.componentId=f,allComponents:s})})})})})]})}function At({value:t,valueImmutable:s,onChange:i,defaultLocale:l,allComponents:f}){var k;const[g,x]=T.useState(!1),{t:P,locale:v}=N.useLocaleContext(),h=typeof(t==null?void 0:t.componentId)=="string"?(k=f[t.componentId])==null?void 0:k.data:void 0;return h?e.jsxs(r.Box,{sx:{width:"100%",position:"relative"},children:[e.jsx(r.IconButton,{sx:{minWidth:0},disabled:!h,size:"small",onClick:()=>x(!g),color:g?"primary":"default",children:e.jsx(D.SettingsRounded,{fontSize:"small"})}),g&&e.jsx(r.Collapse,{in:g,timeout:"auto",unmountOnExit:!0,sx:{width:"100%",zIndex:10},children:e.jsxs(r.Paper,{elevation:1,sx:{mt:1,p:2,borderRadius:1,border:"1px solid",borderColor:"divider",width:"100%"},children:[e.jsx(r.Box,{width:"100%",mb:2,children:e.jsx(ce,{config:h,currentLocale:v,defaultLocale:l,allComponents:f,propertiesValue:t==null?void 0:t.properties,onChange:({id:y,value:o})=>{const a=ut.default(o.value),c=JSON.parse(JSON.stringify(t));c!=null&&c.componentId&&(s?i==null||i({...c,properties:{...c.properties,[y]:{value:a}}}):(c.properties=c.properties??{},c.properties[y]={value:a},i==null||i(c)))}})}),e.jsx(r.Button,{size:"small",onClick:()=>x(!1),sx:{mt:1},children:P("close")})]})})]}):null}function Ne({type:t="properties",component:s,...i}){var y,o,a;const{t:l}=N.useLocaleContext(),{state:{components:f,supportedLocales:g,config:{defaultLocale:x}}}=E.useStore(),P=E.useAllComponents(),v=G.getYjsValue(s).doc,h=t==="properties"?s.properties:t==="parameters"&&((y=s.renderer)==null?void 0:y.type)==="component"?(o=f[s.renderer.componentId])==null?void 0:o.data.properties:void 0,k=((a=s.renderer)==null?void 0:a.type)==="component"?s:void 0;return e.jsxs(r.Dialog,{...i,fullWidth:!0,maxWidth:"lg",children:[e.jsx(r.DialogTitle,{children:l("i18nEditorTitle")}),e.jsx(r.DialogContent,{children:h&&e.jsx(r.Stack,{children:e.jsxs(r.Table,{stickyHeader:!0,sx:{td:{verticalAlign:"top"}},children:[e.jsx(r.TableHead,{children:e.jsx(r.TableRow,{children:g.map(({locale:c,name:d})=>e.jsx(r.TableCell,{children:e.jsxs(r.Typography,{color:"text.primary",children:[d,x===c&&e.jsx(D.StarRounded,{sx:{fontSize:12}})]})},c))})}),e.jsx(r.TableBody,{children:V.default(Object.values(h),"index").map(({data:c})=>e.jsx(r.TableRow,{children:g.map(({locale:d})=>{var u,S,n,b,m,j,C,p,w,I,B,R,_,z,A,F,J,H,Y,$,ae,ue,de,pe,xe,me;return e.jsx(r.TableCell,{children:e.jsx(r.Stack,{gap:1,children:t==="properties"?e.jsxs(e.Fragment,{children:[e.jsx(r.TextField,{size:"small",label:"Key",value:c.key||"",onChange:K=>{v.transact(()=>{c.key=K.target.value.trim()})}}),e.jsx(r.TextField,{size:"small",label:l("label"),value:(((S=(u=c.locales)==null?void 0:u[d])==null?void 0:S.name)??((b=(n=c.locales)==null?void 0:n[x])==null?void 0:b.name))||"",onChange:K=>{v.transact(()=>{var M;c.locales??(c.locales={}),(M=c.locales)[d]??(M[d]={}),c.locales[d].name=K.target.value})}}),e.jsx(r.Box,{children:e.jsx(L,{allComponents:P,defaultLocale:x,component:s,property:c,size:"small",fullWidth:!0,label:"Default Value",valueImmutable:Z.default((j=(m=c.locales)==null?void 0:m[d])==null?void 0:j.defaultValue),value:((p=(C=c.locales)==null?void 0:C[d])==null?void 0:p.defaultValue)??((I=(w=c.locales)==null?void 0:w[x])==null?void 0:I.defaultValue),onChange:K=>{v.transact(()=>{var M;c.locales??(c.locales={}),(M=c.locales)[d]??(M[d]={}),c.locales[d].defaultValue=K})}})})]}):t==="parameters"&&k?e.jsx(r.Box,{children:e.jsx(L,{allComponents:P,defaultLocale:x,component:s,property:c,size:"small",fullWidth:!0,valueImmutable:Z.default((z=(_=(R=(B=k.renderer.properties)==null?void 0:B[c.id])==null?void 0:R.locales)==null?void 0:_[d])==null?void 0:z.value),value:((H=(J=(F=(A=k.renderer.properties)==null?void 0:A[c.id])==null?void 0:F.locales)==null?void 0:J[d])==null?void 0:H.value)??((ue=(ae=($=(Y=k.renderer.properties)==null?void 0:Y[c.id])==null?void 0:$.locales)==null?void 0:ae[x])==null?void 0:ue.value)??((pe=(de=c.locales)==null?void 0:de[d])==null?void 0:pe.defaultValue)??((me=(xe=c.locales)==null?void 0:xe[x])==null?void 0:me.defaultValue),onChange:K=>{v.transact(()=>{var M,fe,be,he,je;(M=k.renderer).properties??(M.properties={}),(fe=k.renderer.properties)[be=c.id]??(fe[be]={}),(he=k.renderer.properties[c.id]).locales??(he.locales={}),(je=k.renderer.properties[c.id].locales)[d]??(je[d]={}),k.renderer.properties[c.id].locales[d].value=K})}})}):null},c.id)},d)})},c.id))})]})})}),e.jsx(r.DialogActions,{children:e.jsx(r.Button,{onClick:c=>{var d;return(d=i.onClose)==null?void 0:d.call(i,c,"escapeKeyDown")},children:l("close")})})]})}const ke=(t,s)=>i=>{const l=[i.palette.info.main,i.palette.primary.main,i.palette.secondary.main,i.palette.success.main,i.palette.warning.main],f=Math.min(l.length-1,t),g=l[f],x=r.alpha(g,.5),P=r.alpha(g,1);return{borderColor:`${x} !important`,borderLeft:"3px solid !important",borderLeftColor:x,color:P,...s}};function Ft({property:t,onChange:s,defaultLocale:i,allComponents:l}){const{t:f,locale:g}=N.useLocaleContext(),x=T.useRef(null),P=Vt(x,t),v=T.useCallback(()=>{if(!(t.type!=="json"&&t.type!=="yaml"&&t.type!=="array")&&t.subProperties)try{let h={};V.default(Object.values(t.subProperties),"index").filter(o=>o.data.visible!==!1&&o.data.key).forEach(({data:o})=>{var c,d,u,S;if(!o.key)return;let a=((d=(c=o.locales)==null?void 0:c[g])==null?void 0:d.defaultValue)??((S=(u=o.locales)==null?void 0:u[i])==null?void 0:S.defaultValue);if(o.type==="number")a=Number(a);else if(o.type==="boolean")a=a===!0||a==="true";else if((o.type==="json"||o.type==="yaml")&&typeof a=="string")try{o.type==="json"?a=JSON.parse(a):a=se.parse(a)}catch(n){console.error("Error parsing nested value",a,n),a={}}h[o.key]=a}),t.type==="array"&&!Array.isArray(h)&&(h=W.default(h)?[]:[h]);const y=E.transformValue(h,t.type);s==null||s(y)}catch(h){console.error("Error converting structure to text:",h)}},[t,g,i,s]);return t.type!=="json"&&t.type!=="yaml"&&t.type!=="array"?null:e.jsxs(r.Stack,{direction:"column",gap:1.5,sx:{width:"100%"},ref:x,children:[e.jsx(r.Divider,{sx:{mt:-1},children:e.jsx(r.Typography,{variant:"caption",color:"text.secondary",children:f("maker.properties.subProperties")})}),t.subProperties&&Object.keys(t.subProperties).length>0?e.jsx(Ce,{component:r.Stack,gap:2,list:t.subProperties,renderItem:(h,k,y)=>{const o=h.visible!==!1;return e.jsx(r.Paper,{elevation:0,className:"property-container",sx:{p:1.25,borderRadius:1,border:o?"1px solid":"1px dashed","&":ke(P)},children:e.jsx(r.Stack,{gap:2,children:e.jsx(Be,{data:h,params:y,visible:o,config:{properties:t.subProperties},currentLocale:g,defaultLocale:i,allComponents:l,onUpdateConfig:a=>{try{const c={properties:t.subProperties||{}};a(c);const d={...t,subProperties:c.properties};s==null||s(d,{forceUpdateProperty:!0}),v()}catch(c){console.error("Error updating property:",c)}}})})},h.id)}}):e.jsx(ee.default,{style:{fontSize:12,height:100},children:f("maker.properties.noSubProperties")}),e.jsx(r.Button,{fullWidth:!0,variant:"outlined",className:"ignore-style-override",size:"small",startIcon:e.jsx(D.AddRounded,{}),onClick:()=>{try{const h=t.subProperties||{},k=E.nextId(),o={index:Object.values(h).length,data:{id:k,key:"",type:"string",visible:!0,locales:{[g]:{name:"",defaultValue:""}},subProperties:{}}},a={...t,subProperties:{...h,[k]:o}};s==null||s(a,{forceUpdateProperty:!0}),v()}catch(h){console.error("Error adding property:",h)}},sx:{"&":ke(P,{})},children:f("maker.properties.addSubProperty")})]})}function L({component:t,property:s,value:i,onChange:l,valueImmutable:f,defaultLocale:g,allComponents:x,...P}){var a,c,d,u,S;const{locale:v}=N.useLocaleContext(),h=q.useUploader(),k=T.useRef(null),y=()=>{var b;const n=(b=h==null?void 0:h.current)==null?void 0:b.getUploader();n==null||n.open(),k.current&&n.onceUploadSuccess(({response:m})=>{var C,p;let j=((C=m==null?void 0:m.data)==null?void 0:C.filename)||"";j&&(j=`mediakit://${j}`,i&&!i.includes("mediakit://")&&(j+=" # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")),(p=k.current)==null||p.call(k,j)})},o=P.label??(((c=(a=s.locales)==null?void 0:a[v])==null?void 0:c.name)||((u=(d=s.locales)==null?void 0:d[g])==null?void 0:u.name)||s.key||s.id);if(s.type==="number")return e.jsx(qt,{...P,label:o,NumberProps:{value:["number","string"].includes(typeof i)?i:null,onChange:(n,b)=>l==null?void 0:l(b)}});if(s.type==="decimal")return e.jsx(r.TextField,{...P,label:o,type:"text",value:i??"",onChange:n=>{const b=n.target.value;if(b===""||b==="-"){l==null||l(b);return}if(/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(b)){let j=b;/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(j)&&(j=Number(j)),l==null||l(j)}}});if(s.type==="boolean")return e.jsx(r.FormControlLabel,{label:o,labelPlacement:"start",control:e.jsx(r.Switch,{checked:i===!0,onChange:(n,b)=>l==null?void 0:l(b)})});if(s.type==="color")return e.jsx(Pt,{label:o,value:i,onChange:n=>{l==null||l(n)}});if(s.type==="json"||s.type==="yaml")return e.jsx(wt,{label:o,value:i,onChange:n=>{l==null||l(n)},property:s,component:t,defaultLocale:g,allComponents:x,PropertyValueField:L,onUpload:n=>{k.current=n,y()}});if(s.type==="custom"){const n=(S=x[s.componentId])==null?void 0:S.data;return n?e.jsx(r.Box,{width:"100%",children:e.jsx(X.CustomComponentRenderer,{componentId:n.id,props:{label:o,value:i,onChange:l},locale:v,dev:{mode:"draft",components:x,defaultLocale:g}})}):e.jsx(r.TextField,{...P,label:o,disabled:!0,placeholder:"Click right button select a component"})}if(s.type==="component")return e.jsxs(r.Stack,{width:"100%",direction:"column",gap:1,children:[e.jsx(te,{allComponents:x,label:o,value:i==null?void 0:i.componentId,onChange:(n,b)=>{f||!i?l==null||l({...i&&JSON.parse(JSON.stringify(i)),componentId:b}):typeof i=="object"&&(i.componentId=b,l==null||l({...i&&JSON.parse(JSON.stringify(i)),componentId:b}))}}),(i==null?void 0:i.componentId)&&e.jsx(At,{value:i,valueImmutable:f,onChange:l,defaultLocale:g,allComponents:x})]});if(!s.type||["string","url","multiline"].includes(s.type)){let n=s.type==="string"?s.multiline:void 0;s.type==="multiline"&&(n=!0);const b=s.type==="url"?i==null?void 0:i.url:i;return e.jsx(r.TextField,{...P,label:o,value:typeof b=="string"?b:"",multiline:n,minRows:n?2:void 0,maxRows:n?10:void 0,onChange:m=>l==null?void 0:l(s.type==="url"?{...i,url:m.target.value,mediaKitUrl:m.target.value}:m.target.value),InputProps:s.type==="url"?{sx:{pr:0},endAdornment:e.jsxs(r.InputAdornment,{position:"end",children:[e.jsx(q.UploaderButton,{onChange:async({response:m})=>{var w,I,B;const j=((w=m==null?void 0:m.data)==null?void 0:w.url)||((I=m==null?void 0:m.data)==null?void 0:I.fileUrl);let C;j&&(C=await q.getImageSize(j).catch(()=>q.getVideoSize(j)).catch(()=>{}));let p=((B=m==null?void 0:m.data)==null?void 0:B.filename)||"";p&&(p=`mediakit://${p}`),l==null||l({url:j,mediaKitUrl:p,width:C==null?void 0:C.naturalWidth,height:C==null?void 0:C.naturalHeight})}}),e.jsx(r.Tooltip,{title:"If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.",children:e.jsx(D.InfoRounded,{sx:{cursor:"default",mr:1},fontSize:"small"})})]})}:void 0})}return s.type==="array"?e.jsx(St,{label:o,value:Array.isArray(i)?i:[],onChange:n=>l==null?void 0:l(n),property:s,renderItem:({item:n,index:b,onChange:m})=>s.subProperties&&Object.keys(s.subProperties).length>0?e.jsx(r.Stack,{gap:1,width:"100%",children:V.default(Object.values(s.subProperties),"index").filter(j=>j.data.visible!==!1).map(({data:j})=>j.key?e.jsx(L,{component:t,property:j,value:n[j.key],onChange:C=>{const p={...n,[j.key]:C};m(p)},size:"small",fullWidth:!0,defaultLocale:g,allComponents:x},j.id):null)},b):e.jsx(r.TextField,{size:P.size,fullWidth:!0,value:n,onChange:j=>m(j.target.value)})}):(console.error("Unsupported property type",s.type),null)}function qt({NumberProps:t,...s}){const{getInputProps:i}=Se.unstable_useNumberInput(t),l=i();return e.jsx(r.TextField,{...s,inputProps:l})}const Re=`import React from '@blocklet/pages-kit/builtin/react'
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),E=require("./chunks/state-UwRWAZRe.js"),Ee=require("@arcblock/ux/lib/Empty"),N=require("@arcblock/ux/lib/Locale/context"),ne=require("@blocklet/code-editor"),Ae=require("@mui/icons-material/AddRounded"),Ve=require("@mui/icons-material/ArrowDownward"),De=require("@mui/icons-material/ArrowUpward"),ze=require("@mui/icons-material/DeleteOutline"),r=require("@mui/material"),Fe=require("lodash/sortBy"),T=require("react"),ve=require("react-use"),ye=require("@blocklet/pages-kit/builtin/color-picker"),qe=require("./chunks/config-string-CEipCOnU.js"),Ue=require("lodash/isEmpty"),Me=require("lodash/set"),We=require("yaml"),q=require("@blocklet/pages-kit/builtin/uploader"),Le=require("lodash/cloneDeep"),Ke=require("@arcblock/ux/lib/Toast"),X=require("@blocklet/pages-kit/components"),Je=require("@blocklet/pages-kit/utils/property"),Pe=require("@mui/base"),A=require("@mui/icons-material"),G=require("@syncedstore/core"),Se=require("ahooks"),He=require("lodash/assign"),Ye=require("lodash/get"),$e=require("lodash/has"),Ge=require("lodash/isEqual"),Qe=require("lodash/isNil"),Xe=require("lodash/isObject"),Ze=require("lodash/keyBy"),et=require("lodash/omit"),tt=require("lodash/pick"),rt=require("lodash/reduce"),U=require("material-ui-popup-state/hooks"),st=require("react-error-boundary"),it=require("@emotion/css"),re=require("react-dnd"),O=t=>t&&t.__esModule?t:{default:t};function lt(t){if(t&&t.__esModule)return t;const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(s,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return s.default=t,Object.freeze(s)}const ee=O(Ee),ot=O(Ae),nt=O(Ve),ct=O(De),ut=O(ze),V=O(Fe),W=O(Ue),we=O(Me),se=lt(We),at=O(Le),ie=O(Ke),dt=O(He),pt=O(Ye),xt=O($e),mt=O(Ge),Z=O(Qe),ft=O(Xe),bt=O(Ze),ht=O(et),jt=O(tt),yt=O(rt);function gt({onClick:t,disabled:s,sx:i,...l}){return e.jsx(r.IconButton,{size:"small",color:"warning",variant:"outlined",disabled:s,onClick:t,...l,children:e.jsx(ut.default,{fontSize:"small"})})}function kt({onClick:t,disabled:s,sx:i,...l}){return e.jsx(r.IconButton,{size:"small",color:"primary",disabled:s,onClick:t,...l,children:e.jsx(ct.default,{fontSize:"small"})})}function vt({onClick:t,disabled:s,sx:i,...l}){return e.jsx(r.IconButton,{size:"small",color:"primary",disabled:s,onClick:t,...l,children:e.jsx(nt.default,{fontSize:"small"})})}function Pt({label:t,value:s,onChange:i,disabled:l=!1,itemLabel:f="",emptyHeight:g=40,property:x,renderItem:S,...v}){const{t:h,locale:k}=N.useLocaleContext(),y=ve.useUpdate(),o=T.useCallback(p=>{i(E.transformValue(p,x.type))},[i,x.type]),u=T.useMemo(()=>Array.isArray(s)?s:[],[s]),c=T.useCallback(()=>{const p=[...u,""];o(p),y()},[u,o,y]),d=T.useCallback(()=>{if(!x||!x.subProperties)return c();const p={};V.default(Object.values(x.subProperties),"index").forEach(({data:B})=>{var _,D;if(!B.key)return;const R=((D=(_=B.locales)==null?void 0:_[k])==null?void 0:D.defaultValue)??"";p[B.key]=R});const I=[...u,p];o(I),y()},[u,o,y,x,k,c]),a=T.useCallback(p=>{try{const w=JSON.parse(p);Array.isArray(w)?o(w):console.error("JSON解析结果不是数组")}catch(w){console.error("JSON解析错误:",w)}},[o]),P=T.useCallback(p=>{const w=u.filter((I,B)=>B!==p);o(w),y()},[u,o,y]),n=T.useCallback(p=>{if(p<=0)return;const w=[...u],I=w[p];w[p]=w[p-1],w[p-1]=I,o(w),y()},[u,o,y]),b=T.useCallback(p=>{if(p>=u.length-1)return;const w=[...u],I=w[p];w[p]=w[p+1],w[p+1]=I,o(w),y()},[u,o,y]),m=T.useCallback((p,w)=>{const I=[...u];I[p]=w,o(I)},[u,o]),j=x&&x.subProperties&&Object.keys(x.subProperties).length>0,C=T.useMemo(()=>[{field:"index",headerName:"#",width:40,align:"center",renderCell:({index:p})=>e.jsx(r.Typography,{variant:"body1",sx:{bgcolor:"action.hover",borderRadius:"50%",width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:p+1})},{field:"content",headerName:"",renderCell:({row:p,index:w})=>S&&j?S({item:p,index:w,property:x,onChange:I=>m(w,I)}):e.jsx(r.TextField,{fullWidth:!0,size:"small",disabled:l,value:p,placeholder:f||`${h("item")} ${w+1}`,onChange:I=>m(w,I.target.value),...v})},{field:"actions",headerName:"",width:30,align:"center",renderCell:({index:p})=>e.jsxs(r.Stack,{direction:"column",spacing:.25,children:[e.jsx(kt,{disabled:l||p===0,onClick:()=>n(p)}),e.jsx(vt,{disabled:l||p===u.length-1,onClick:()=>b(p)}),e.jsx(gt,{disabled:l,onClick:()=>P(p)})]})}],[S,j,x,m,f,h,l,v,P,n,b,u.length]);return j?e.jsxs(r.Stack,{width:"100%",gap:1,children:[t&&e.jsx(r.FormLabel,{children:t}),u.length>0?e.jsx(r.TableContainer,{component:r.Paper,variant:"outlined",sx:{borderRadius:1,mb:1},children:e.jsxs(r.Table,{size:"small",sx:{"& .MuiTableCell-root":{py:.25,px:1,whiteSpace:"nowrap"},"& .MuiTableCell-head":{backgroundColor:"action.hover",py:.25,px:1},borderCollapse:"collapse"},children:[e.jsx(r.TableHead,{sx:{display:"none"},children:e.jsx(r.TableRow,{children:C.map(p=>e.jsx(r.TableCell,{width:p.width,align:p.align||"left",sx:{fontWeight:"bold"},children:p.renderHeader?p.renderHeader():p.headerName},p.field))})}),e.jsx(r.TableBody,{children:u.map((p,w,I)=>e.jsx(r.TableRow,{sx:{borderBottom:w<I.length-1?"1px solid":"none",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:C.map(B=>e.jsx(r.TableCell,{width:B.width,align:B.align||"left",sx:{borderBottom:"none"},children:B.renderCell({row:p,index:w,onChange:R=>m(w,R)})},`${w}-${B.field}`))},w))})]})}):e.jsx(ee.default,{style:{fontSize:12,height:g},children:h("maker.properties.arrayEmpty")}),e.jsx(r.Button,{fullWidth:!0,size:"small",variant:"outlined",disabled:l,startIcon:e.jsx(ot.default,{}),onClick:d,children:h("maker.properties.addArrayItem")})]}):e.jsxs(r.Stack,{width:"100%",gap:1,children:[t&&e.jsx(r.FormLabel,{children:t}),e.jsx(r.Box,{sx:{border:1,borderColor:"divider",borderRadius:1,minHeight:150},children:e.jsx(ne.CodeEditor,{keyId:x.id,locale:k,language:"json",value:JSON.stringify(u,null,2),onChange:p=>a(p||""),fullScreenOptions:{enableEscExit:!0,targetContainer:()=>document.getElementById("parameters-config-dialog")||null}},x.id)})]})}function St({value:t,onChange:s,...i}){const l=T.useRef(null);return e.jsxs(e.Fragment,{children:[e.jsx(qe.ConfigString,{...i,value:t,onChange:s,InputProps:{endAdornment:e.jsx(r.InputAdornment,{position:"end",children:e.jsx(ye.ColorItem,{color:t??"",style:{width:"1.5rem",height:"1.5rem",padding:0},onClick:()=>{var f;(f=l.current)==null||f.open({value:t??""})}})})}}),e.jsx(ye.ConfigColorDialog,{ref:l,onSave:({value:f},g)=>{s(f),g()}})]})}function wt({label:t,value:s,onChange:i,property:l,component:f,defaultLocale:g,allComponents:x,PropertyValueField:S,onUpload:v}){const{locale:h}=N.useLocaleContext(),k=T.useRef(null);if(!W.default(l.subProperties)){const o=V.default(Object.values(l.subProperties||{}),"index").filter(u=>u.data.visible!==!1&&u.data.key);return e.jsxs(r.Stack,{width:"100%",children:[e.jsx(r.FormLabel,{sx:{px:.25,py:.5},children:t}),e.jsx(r.Box,{children:e.jsx(r.Box,{sx:{position:"relative"},children:o.map((u,c)=>{const{data:d}=u,a=d.key??d.id,P=c===o.length-1;let n=null;try{s&&typeof s=="object"?n=s[a]:typeof s=="string"&&(n=(l.type==="yaml"?se.parse(s||""):JSON.parse(s||"{}"))[a])}catch{}n==null&&(d.locales&&h&&d.locales[h]?n=d.locales[h].defaultValue:d.locales&&g&&d.locales[g]&&(n=d.locales[g].defaultValue));const b=j=>{try{let C={};if(typeof s=="string")try{C=l.type==="yaml"?se.parse(s||""):JSON.parse(s||"{}")}catch{}else typeof s=="object"&&s!==null&&(C={...s});we.default(C,a,j);const p=E.transformValue(C,l.type);i==null||i(p)}catch(C){console.error("Error updating property:",C)}},m=8;return e.jsxs(r.Box,{sx:{mb:P?0:1,display:"flex",flexDirection:"row"},children:[e.jsxs(r.Box,{sx:{position:"relative",width:24,flexShrink:0},children:[e.jsx(r.Box,{sx:{position:"absolute",left:m,top:0,height:16,width:0,borderLeft:"1px dashed",borderColor:"divider"}}),e.jsx(r.Box,{sx:{position:"absolute",left:m,top:16,width:12,height:0,borderTop:"1px dashed",borderColor:"divider"}}),!P&&e.jsx(r.Box,{sx:{position:"absolute",left:m,top:16,bottom:-8,width:0,borderLeft:"1px dashed",borderColor:"divider"}})]}),e.jsx(r.Box,{sx:{flexGrow:1},children:e.jsx(S,{component:f,property:d,value:n,onChange:b,size:"small",fullWidth:!0,defaultLocale:g,allComponents:x})})]},d.id)})})})]})}return e.jsx(r.Stack,{width:"100%",gap:2,children:e.jsxs(r.Stack,{sx:{width:"100%",position:"relative",pt:1,pb:"6px",px:"1px",minHeight:50,".monaco-editor,.overflow-guard":{borderRadius:1}},children:[e.jsx(r.FormLabel,{sx:{position:"absolute",left:0,top:0,transform:"translate(0px, -7px) scale(0.75)"},children:t}),e.jsx(ne.CodeEditor,{keyId:l.id,locale:h,language:l.type==="yaml"?"yaml":"json",value:typeof s=="string"?s:"",onChange:o=>{i==null||i(o)},onUpload:o=>{k.current=o,v&&v(o)},fullScreenOptions:{enableEscExit:!0,targetContainer:()=>document.getElementById("parameters-config-dialog")||null}},l.id),e.jsx(r.Box,{component:"fieldset",sx:{pointerEvents:"none",position:"absolute",left:0,top:-5,width:"100%",height:"100%",border:1,borderColor:"rgba(0, 0, 0, 0.23)",borderRadius:1,px:1,py:0},children:e.jsx(r.Box,{component:"legend",sx:{fontSize:"0.75em"},children:e.jsx(r.Box,{component:"span",sx:{opacity:0},children:t})})})]})})}const Ct=["string","multiline","json","yaml","url","component","custom","array"];function ge(t){return t.type?!Ct.includes(t.type):!1}function Ce({disabled:t,list:s,renderItem:i,...l}){const f=T.useRef(null),g=T.useId(),x=Se.useUpdate(),S=V.default(Object.entries(s),u=>u[1].index).map(u=>u[0]),v=T.useRef(S),h=T.useCallback(u=>{v.current=u,x()},[x]),k=T.useCallback(({index:u},{index:c})=>{const d=[...v.current];d.splice(c,0,...d.splice(u,1)),h(d)},[h]);T.useEffect(()=>{h(S)},[S.join("-")]);const[{isOver:y},o]=re.useDrop({accept:g,collect:u=>({isOver:u.isOver()}),canDrop:()=>!t,drop:()=>{var d;const u=()=>{v.current.forEach((a,P)=>{const n=s[a];n&&(n.index=P)})},c=(d=G.getYjsValue(s))==null?void 0:d.doc;c?c.transact(()=>{u()}):u()}});return T.useEffect(()=>{y||h(S)},[y]),o(f),e.jsx(r.Box,{...l,ref:f,className:it.cx(y&&"isDragging"),children:v.current.map((u,c)=>e.jsx(It,{type:g,disabled:t,id:u,index:c,itemIndex:d=>v.current.indexOf(d),move:k,children:d=>{const a=s[u];return a?i(a.data,c,d):null}},u))})}function It({disabled:t,id:s,index:i,type:l,children:f,itemIndex:g,move:x}){const S=T.useRef(),[{isDragging:v},h,k]=re.useDrag({type:l,item:()=>({id:s}),canDrag:()=>!t,collect:o=>({isDragging:o.isDragging()})}),[,y]=re.useDrop({accept:l,canDrop:()=>!t,hover(o,u){var m;if(!S.current)return;const c=g(o.id),d=i;if(c===d)return;const a=(m=S.current)==null?void 0:m.getBoundingClientRect(),P=(a.bottom-a.top)/2,b=u.getClientOffset().y-a.top;c<d&&b<P||c>d&&b>P||x({id:o.id,index:c},{id:s,index:i})}});return typeof f=="function"?f({isDragging:v,drag:h,drop:o=>(S.current=o,y(o)),preview:k}):(h(y(k(S))),e.jsx(r.Box,{ref:S,children:f}))}function Tt({drop:t,preview:s,drag:i,disabled:l,isDragging:f,children:g,onDelete:x,onVisibilityChange:S,visible:v=!0,actions:h,alwaysShowActions:k=!1}){const{t:y}=N.useLocaleContext();return e.jsx(r.Box,{ref:t,sx:{":hover .hover-visible":{maxWidth:"100%"},opacity:v?1:.5},children:e.jsxs(r.Box,{sx:{position:"relative"},children:[e.jsx(r.Box,{ref:s,sx:{flex:1,borderRadius:.5,bgcolor:f?"action.hover":"background.paper",opacity:.9999},children:g}),!l&&e.jsx(r.Box,{className:k?"":"hover-visible",sx:{maxWidth:k?"100%":0,overflow:"hidden",position:"absolute",right:2,top:2,transition:"max-width 0.3s ease-in-out"},children:e.jsxs(r.Stack,{direction:"row",sx:{bgcolor:o=>r.alpha(o.palette.grey[200],.9),borderRadius:1,p:.5,[`.${r.buttonClasses.root}`]:{minWidth:24,width:24,height:24,p:0}},children:[h,S&&e.jsx(r.Tooltip,{title:y(v?"hideParameter":"showParameter"),disableInteractive:!0,placement:"top",children:e.jsx(r.Button,{onClick:()=>S(!v),children:v?e.jsx(A.VisibilityOffRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}}):e.jsx(A.VisibilityRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}})})}),x&&e.jsx(r.Tooltip,{title:y("delete"),disableInteractive:!0,placement:"top",children:e.jsx(r.Button,{onClick:x,children:e.jsx(A.DeleteOutlineRounded,{sx:{fontSize:"1.25rem",color:"grey.500"}})})}),e.jsx(r.Tooltip,{title:y("dragSort"),disableInteractive:!0,placement:"top",children:e.jsx(r.Button,{ref:i,children:e.jsx(A.DragIndicatorRounded,{sx:{color:"grey.500"}})})})]})})]})})}function Bt(t){const s=["string","json","array","url","multiline"],i=["style","fontSize","color","content","type"];return!!(s.includes(t.type||"")&&!i.includes(t.key||""))}function Ot(t,s,i){return t.locales&&t.locales[s]&&t.locales[s].name?t.locales[s].name:i&&t.locales&&t.locales[i]&&t.locales[i].name?t.locales[i].name:t.key?t.key:t.id}const Ie=(t,s,i,l)=>{const f={};return V.default(Object.entries(t),([,x])=>x.index).forEach(([x,S])=>{const v=S.data;if(!v)return;const h=v.key||v.id,k=i?Ot(v,i,l||""):h,y=s==null?void 0:s[v.id],o={key:h,isNeedGenerate:(y==null?void 0:y.isNeedGenerate)??Bt(v),describe:(y==null?void 0:y.describe)??"",displayName:k};v.subProperties&&!W.default(v.subProperties)&&(o.subProperties=Ie(v.subProperties,y==null?void 0:y.subProperties,i,l)),f[v.id]=o}),f};function Nt({open:t,onClose:s,onConfirm:i,component:l,initialConfig:f,locale:g,defaultLocale:x,title:S,loading:v=!1}){const{t:h}=N.useLocaleContext(),[k,y]=T.useState(null);T.useEffect(()=>{if(t&&l){const a={properties:{}};if(l.properties){const P=f==null?void 0:f.properties;a.properties=Ie(l.properties,P,g,x)}y(a)}},[t,l,f,g,x]);const o=()=>{s()},u=()=>{k&&(i(k),s())},c=(a,P,n)=>{if(!k||!a.length)return;const b=JSON.parse(JSON.stringify(k));let m=b.properties,j=null;for(let p=0;p<a.length-1;p++){const w=a[p];if(!w||!m[w])return;j=m;const I=m[w];I.subProperties||(I.subProperties={}),m=I.subProperties}const C=a[a.length-1];if(C){if("isNeedGenerate"in n){const p=n.isNeedGenerate,w={...P,...n};if(P.subProperties&&!W.default(P.subProperties)){const I=(B,R)=>{const _={};return Object.entries(B).forEach(([D,z])=>{const F={...z};R!==null&&(F.isNeedGenerate=R),z.subProperties&&!W.default(z.subProperties)&&(F.subProperties=I(z.subProperties,R!==null?R:null)),_[D]=F}),_};w.subProperties=I(P.subProperties,p===!1?!1:null)}if(a.length===1)b.properties[C]=w;else if(j&&a.length>=2){const I=a[a.length-2];I&&j[I]&&(j[I].subProperties||(j[I].subProperties={}),j[I].subProperties[C]=w)}}else if(a.length===1)b.properties[C]={...P,...n};else if(j&&a.length>=2){const p=a[a.length-2];p&&j[p]&&j[p].subProperties&&(j[p].subProperties[C]={...P,...n})}y(b)}},d=(a,P=[],n=!0)=>{if(!a||W.default(a))return null;const b=V.default(Object.entries(a),([,m])=>m.displayName);return e.jsx(r.Stack,{spacing:1.5,children:b.map(([m,j],C)=>{const p=[...P,m],w=C===b.length-1,I=j.subProperties&&!W.default(j.subProperties),B=j.displayName||m,R=!n;return e.jsx(r.Box,{sx:{position:"relative"},children:e.jsxs(r.Stack,{direction:"row",children:[P.length>0&&e.jsxs(r.Box,{sx:{position:"relative",width:24,flexShrink:0},children:[e.jsx(r.Box,{sx:{position:"absolute",left:8,top:0,height:16,width:0,borderLeft:"1px dashed",borderColor:"divider"}}),e.jsx(r.Box,{sx:{position:"absolute",left:8,top:16,width:12,height:0,borderTop:"1px dashed",borderColor:"divider"}}),!w&&e.jsx(r.Box,{sx:{position:"absolute",left:8,top:16,bottom:-12,width:0,borderLeft:"1px dashed",borderColor:"divider"}})]}),e.jsxs(r.Stack,{spacing:1.5,sx:{flexGrow:1},children:[e.jsxs(r.Stack,{direction:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},spacing:1.5,width:"100%",children:[e.jsx(r.FormControlLabel,{control:e.jsx(r.Checkbox,{checked:j.isNeedGenerate,disabled:R,onChange:_=>{c(p,j,{isNeedGenerate:_.target.checked})}}),label:B,sx:{minWidth:"180px",maxWidth:"280px",mr:2,"& .MuiFormControlLabel-label":{wordBreak:"break-word"}}}),e.jsx(r.TextField,{size:"small",fullWidth:!0,label:h("maker.properties.llmPropertyDescribe"),value:j.describe,onChange:_=>{c(p,j,{describe:_.target.value})},disabled:!j.isNeedGenerate})]}),I&&e.jsx(r.Box,{sx:{ml:3},children:d(j.subProperties,p,j.isNeedGenerate&&n)})]})]})},m)})})};return e.jsxs(r.Dialog,{open:t,onClose:o,maxWidth:"lg",fullWidth:!0,children:[e.jsx(r.DialogTitle,{children:S||h("maker.properties.llmConfigTitle")}),e.jsx(r.DialogContent,{children:e.jsx(r.Box,{my:3,children:v?e.jsx(r.Typography,{children:h("maker.properties.loading")}):l?k?e.jsxs(r.Stack,{spacing:3,children:[e.jsx(r.Typography,{variant:"subtitle2",children:h("maker.properties.llmConfigInstructions")}),d(k.properties)]}):e.jsx(r.Typography,{children:h("maker.properties.loading")}):e.jsx(r.Typography,{color:"error",children:h("maker.properties.componentNotFound")})})}),e.jsxs(r.DialogActions,{children:[e.jsx(r.Button,{onClick:o,children:h("common.cancel")}),e.jsx(r.Button,{variant:"contained",onClick:u,disabled:!k||v,children:h("common.confirm")})]})]})}function Rt({label:t,value:s,onChange:i}){const[l,f]=T.useState(!1);return e.jsxs(r.Stack,{gap:1,children:[e.jsx(r.TextField,{label:t,size:"small",value:s,onChange:g=>i==null?void 0:i(g.target.value),InputProps:{sx:{pr:0},endAdornment:e.jsx(r.InputAdornment,{position:"end",children:e.jsx(q.UploaderButton,{onChange:({response:g})=>{var S;const x=(S=g==null?void 0:g.data)==null?void 0:S.filename;x&&(i==null||i(x))}})})}}),s&&e.jsx(r.Box,{component:"img",sx:{objectFit:"contain",borderRadius:1,cursor:"pointer"},src:E.getImageAbsoluteUrl(s),alt:t,maxWidth:100,maxHeight:100,width:"100%",onClick:()=>f(!0)}),e.jsx(r.Dialog,{open:l,onClose:()=>f(!1),children:e.jsx(r.Box,{component:"img",sx:{objectFit:"contain"},src:E.getImageAbsoluteUrl(s),alt:t})})]})}function le(t,s=""){return yt.default(t,(i,l,f)=>{const g=s?`${s}.${f}`:f;return ft.default(l)?dt.default(i,le(l,g)):i[g]=l,i},{})}const _t=[{value:"string",label:"Text"},{value:"multiline",label:"Text (Multiline)"},{value:"number",label:"Number"},{value:"decimal",label:"Decimal"},{value:"boolean",label:"Boolean"},{value:"color",label:"Color"},{value:"url",label:"URL (Upload)"},{value:"json",label:"JSON"},{value:"yaml",label:"YAML"},{value:"array",label:"Array"},{value:"component",label:"Component"},{value:"custom",label:"Custom (Render by a Component)"}];function Q(t,s,i){return!t||!i?!1:Object.values(t).some(({data:l})=>l.id!==s&&l.key===i)}function oe(t,s){var i;return!t||!s?!1:((i=t[s])==null?void 0:i.data.visible)??!0}function Et({componentId:t}){const{state:{components:s}}=E.useStore(),i=s[t],l=i==null?void 0:i.data;return l?e.jsx(r.Stack,{maxHeight:"100%",overflow:"auto",children:e.jsx(r.Box,{p:2,children:e.jsx(st.ErrorBoundary,{FallbackComponent:E.ErrorView,resetKeys:[t],children:e.jsx(At,{value:l,componentId:t})})})}):null}function At({value:t,componentId:s}){var y,o,u;const{t:i}=N.useLocaleContext(),{localState:{currentLocale:l,customComponentPreviewerProperties:f},state:{config:{defaultLocale:g}},localActions:{setCustomComponentPreviewerProperties:x}}=E.useStore(),S=G.getYjsValue(t).doc,v=E.useAllComponents(),h=T.useMemo(()=>(f==null?void 0:f[s])??{},[s,f]),k=Se.useReactive({componentId:s,propertiesValue:{...h}});return T.useEffect(()=>{k.componentId!==s&&(k.componentId=s,k.propertiesValue={...h})},[s,h,k]),T.useEffect(()=>{if(k.componentId!==s)return;const c=Object.fromEntries(Object.values(t.properties??{}).map(({data:d})=>{var a,P,n,b,m;return[d.id,{value:((a=k.propertiesValue[d.id])==null?void 0:a.value)??Je.parsePropertyValue(d,((n=(P=d.locales)==null?void 0:P[l])==null?void 0:n.defaultValue)??((m=(b=d.locales)==null?void 0:b[g])==null?void 0:m.defaultValue),{locale:l,defaultLocale:g})}]}));x(s,c)},[JSON.stringify(k.propertiesValue),s,k.componentId]),e.jsx(r.Stack,{height:"100%",children:e.jsxs(r.Stack,{gap:2,children:[e.jsx(Te,{config:t}),e.jsx(Oe,{config:t,currentLocale:l,defaultLocale:g,allComponents:v,onUpdateConfig:c=>{S.transact(()=>{c(t)})}}),e.jsxs(r.Stack,{gap:2,direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(r.Typography,{variant:"subtitle1",children:i("renderer")}),e.jsxs(r.TextField,{hiddenLabel:!0,size:"small",select:!0,SelectProps:{autoWidth:!0},value:((y=t.renderer)==null?void 0:y.type)||"react-component",onChange:c=>{S.transact(()=>{const d=c.target.value;t.renderer??(t.renderer={type:d}),t.renderer.type=d})},children:[e.jsx(r.MenuItem,{value:"react-component",children:"React Component"}),e.jsx(r.MenuItem,{value:"component",children:"Custom Component"})]})]}),((o=t.renderer)==null?void 0:o.type)==="component"&&e.jsx(Mt,{value:t}),((u=t.renderer)==null?void 0:u.type)==="react-component"&&e.jsx(Ut,{value:t}),e.jsx(ce,{config:t,currentLocale:l,defaultLocale:g,allComponents:v,propertiesValue:k.propertiesValue,onChange:({value:c,id:d,path:a})=>{const P=[...a,"data"];if(!pt.default(t,P)){ie.default.warning(i("cannotFindPropertyKey",{key:P.join(".")}));return}k.propertiesValue[d]={value:c.value}}})]})})}function Te({config:t}){const{t:s}=N.useLocaleContext();return e.jsx(q.UploaderProvider,{children:e.jsxs(r.Stack,{gap:2,children:[e.jsx(r.Typography,{variant:"subtitle1",children:s("basicInfo")}),e.jsx(r.TextField,{label:s("name"),size:"small",value:t.name||"",onChange:i=>t.name=i.target.value}),e.jsx(r.TextField,{label:s("description"),size:"small",multiline:!0,minRows:2,maxRows:10,inputProps:{maxLength:200},value:t.description||"",onChange:i=>t.description=i.target.value,InputProps:{endAdornment:e.jsx(r.InputAdornment,{position:"end",sx:{mt:-1.5},children:e.jsx(Wt,{config:t})})}}),e.jsx(r.Autocomplete,{size:"small",options:[],multiple:!0,freeSolo:!0,value:t.tags??[],onChange:(i,l)=>t.tags=l,renderInput:i=>e.jsx(r.TextField,{label:s("tags"),...i})}),e.jsx(Rt,{label:s("previewImage"),value:t.previewImage||"",onChange:i=>t.previewImage=i})]})})}function Be({data:t,params:s,visible:i,config:l,currentLocale:f,defaultLocale:g,allComponents:x,onUpdateConfig:S}){var k,y,o,u,c,d;const{t:v}=N.useLocaleContext(),h=T.useMemo(()=>t.type==="json"||t.type==="yaml"||t.type==="array"?Ft:L,[t.type]);return e.jsx(Tt,{preview:s.preview,drop:s.drop,drag:s.drag,isDragging:s.isDragging,onDelete:()=>{S(a=>{if(a.properties){const n=Object.entries(a.properties).sort(([,m],[,j])=>m.index-j.index);delete a.properties[t.id],n.filter(([m])=>m!==t.id).forEach(([,m],j)=>{m.index=j})}})},visible:i,onVisibilityChange:a=>{S(P=>{const n=P.properties[t.id].data;n.visible=a})},alwaysShowActions:!0,children:e.jsxs(r.Stack,{direction:"column",gap:2,children:[e.jsx(r.TextField,{label:v("key"),size:"small",required:!0,sx:{width:"calc(100% - 80px - 8px)",flex:1,"& .MuiOutlinedInput-root":{borderColor:t.key?Q(l.properties,t.id,t.key)?"warning.main":void 0:"error.main"},"& .MuiFormLabel-root":{color:t.key?Q(l.properties,t.id,t.key)?"warning.main":"text.secondary":"error.main"},"& .MuiFormLabel-root.Mui-focused":{color:t.key?Q(l.properties,t.id,t.key)?"warning.main":"primary.main":"error.main"}},value:t.key||"",onChange:a=>{S(P=>{const n=P.properties[t.id].data;n.key=a.target.value.trim()})},InputProps:{endAdornment:!t.key||t.key&&Q(l.properties,t.id,t.key)?e.jsx(r.InputAdornment,{position:"end",sx:{width:16,ml:0},children:e.jsx(r.Tooltip,{title:t.key?v("duplicateKey"):v("requiredKey"),children:e.jsx(A.InfoRounded,{sx:{color:t.key?"warning.main":"error.main",fontSize:16}})})}):null}}),e.jsxs(r.Stack,{direction:"row",gap:1,children:[e.jsx(r.TextField,{label:v("label"),size:"small",sx:{flex:1},value:(((y=(k=t.locales)==null?void 0:k[f])==null?void 0:y.name)??((u=(o=t.locales)==null?void 0:o[g])==null?void 0:u.name))||"",onChange:a=>{S(P=>{var b;const n=P.properties[t.id].data;n.locales??(n.locales={}),(b=n.locales)[f]??(b[f]={}),n.locales[f].name=a.target.value})}}),e.jsx(r.TextField,{label:v("type"),size:"small",select:!0,sx:{flex:1},value:t.type==="string"&&t.multiline?"multiline":t.type||"string",onChange:a=>{S(P=>{const n=P.properties[t.id].data;if(n.locales)for(const m of Object.keys(n.locales))n.locales[m].defaultValue=void 0;const b=a.target.value;b==="multiline"?(n.type="string",n.multiline=!0):(typeof n.multiline<"u"&&delete n.multiline,n.type=b)})},children:_t.map(a=>e.jsx(r.MenuItem,{value:a.value,children:a.label},a.value))})]}),e.jsxs(r.Stack,{direction:"row",gap:1,children:[e.jsx(h,{allComponents:x,defaultLocale:g,component:l,property:t,label:v("defaultValue"),size:"small",fullWidth:!0,value:(d=(c=t.locales)==null?void 0:c[f])==null?void 0:d.defaultValue,onChange:(a,P)=>{S(n=>{var m;const b=n.properties[t.id].data;if(P!=null&&P.forceUpdateProperty){const j=le(b),C=le(a);Object.keys(C).forEach(p=>{j[p]||we.default(b,p,C[p])})}else b.locales??(b.locales={}),(m=b.locales)[f]??(m[f]={}),b.locales[f].defaultValue=a})}}),t.type==="custom"?e.jsx(r.Box,{children:e.jsx(Dt,{property:t,allComponents:x})}):null]})]})})}function Vt(t,s){const[i,l]=T.useState(0);return T.useEffect(()=>{const g=setTimeout(()=>{if(t.current){let x=t.current.parentElement,S=0;for(;x;)x.classList.contains("property-container")&&S++,x=x.parentElement;l(S)}},100);return()=>clearTimeout(g)},[t,s]),i}function Oe({config:t,currentLocale:s,defaultLocale:i,allComponents:l,onUpdateConfig:f,useI18nEditor:g=!0}){const{t:x}=N.useLocaleContext(),S=U.usePopupState({variant:"dialog"}),v=t.properties&&V.default(Object.values(t.properties),"index");return e.jsx(q.UploaderProvider,{children:e.jsxs(r.Stack,{gap:2,children:[e.jsxs(r.Stack,{direction:"row",gap:1,alignItems:"center",justifyContent:"space-between",children:[e.jsx(r.Typography,{variant:"subtitle1",children:x("properties")}),e.jsx(r.Box,{flex:1}),g&&e.jsx(r.Button,{sx:{minWidth:32,minHeight:32,p:0},...U.bindTrigger(S),children:e.jsx(A.TranslateRounded,{fontSize:"small"})})]}),t.properties&&Object.keys(t.properties).length>0?e.jsx(Ce,{component:r.Stack,gap:2,list:t.properties,renderItem:(h,k,y)=>{const o=oe(t.properties,h.id);return e.jsx(r.Paper,{elevation:0,className:"property-container",sx:{p:1.25,borderRadius:1,border:o?"1px solid":"1px dashed",borderColor:"divider"},children:e.jsx(r.Stack,{gap:2,children:e.jsx(Be,{data:h,params:y,visible:o,config:t,currentLocale:s,defaultLocale:i,allComponents:l,onUpdateConfig:f})})},h.id)}}):e.jsx(ee.default,{style:{fontSize:12},children:x("maker.properties.noProperties")}),e.jsx(r.Button,{fullWidth:!0,variant:"outlined",className:"ignore-style-override",onClick:()=>{f(h=>{var y;const k=E.nextId();h.properties??(h.properties={}),(y=h.properties)[k]??(y[k]={index:(v==null?void 0:v.length)||0,data:{id:k}})})},startIcon:e.jsx(A.AddRounded,{}),children:x("addObject",{object:x("property")})}),g&&e.jsx(Ne,{...U.bindDialog(S),component:t})]})})}function Dt({property:t,allComponents:s}){const i=U.usePopupState({variant:"popper"});return e.jsxs(e.Fragment,{children:[e.jsx(r.Button,{sx:{minWidth:0},...U.bindTrigger(i),children:e.jsx(A.SettingsRounded,{fontSize:"small"})}),e.jsx(r.Popper,{...U.bindPopper(i),children:e.jsx(Pe.ClickAwayListener,{onClickAway:i.close,children:e.jsx(r.Paper,{children:e.jsx(r.Box,{width:500,p:2,children:e.jsx(te,{value:t.componentId,onChange:(l,f)=>t.componentId=f,allComponents:s})})})})})]})}function zt({value:t,valueImmutable:s,onChange:i,defaultLocale:l,allComponents:f}){var k;const[g,x]=T.useState(!1),{t:S,locale:v}=N.useLocaleContext(),h=typeof(t==null?void 0:t.componentId)=="string"?(k=f[t.componentId])==null?void 0:k.data:void 0;return h?e.jsxs(r.Box,{sx:{width:"100%",position:"relative"},children:[e.jsx(r.IconButton,{sx:{minWidth:0},disabled:!h,size:"small",onClick:()=>x(!g),color:g?"primary":"default",children:e.jsx(A.SettingsRounded,{fontSize:"small"})}),g&&e.jsx(r.Collapse,{in:g,timeout:"auto",unmountOnExit:!0,sx:{width:"100%",zIndex:10},children:e.jsxs(r.Paper,{elevation:1,sx:{mt:1,p:2,borderRadius:1,border:"1px solid",borderColor:"divider",width:"100%"},children:[e.jsx(r.Box,{width:"100%",mb:2,children:e.jsx(ce,{config:h,currentLocale:v,defaultLocale:l,allComponents:f,propertiesValue:t==null?void 0:t.properties,onChange:({id:y,value:o})=>{const u=at.default(o.value),c=JSON.parse(JSON.stringify(t));c!=null&&c.componentId&&(s?i==null||i({...c,properties:{...c.properties,[y]:{value:u}}}):(c.properties=c.properties??{},c.properties[y]={value:u},i==null||i(c)))}})}),e.jsx(r.Button,{size:"small",onClick:()=>x(!1),sx:{mt:1},children:S("close")})]})})]}):null}function Ne({type:t="properties",component:s,...i}){var y,o,u;const{t:l}=N.useLocaleContext(),{state:{components:f,supportedLocales:g,config:{defaultLocale:x}}}=E.useStore(),S=E.useAllComponents(),v=G.getYjsValue(s).doc,h=t==="properties"?s.properties:t==="parameters"&&((y=s.renderer)==null?void 0:y.type)==="component"?(o=f[s.renderer.componentId])==null?void 0:o.data.properties:void 0,k=((u=s.renderer)==null?void 0:u.type)==="component"?s:void 0;return e.jsxs(r.Dialog,{...i,fullWidth:!0,maxWidth:"lg",children:[e.jsx(r.DialogTitle,{children:l("i18nEditorTitle")}),e.jsx(r.DialogContent,{children:h&&e.jsx(r.Stack,{children:e.jsxs(r.Table,{stickyHeader:!0,sx:{td:{verticalAlign:"top"}},children:[e.jsx(r.TableHead,{children:e.jsx(r.TableRow,{children:g.map(({locale:c,name:d})=>e.jsx(r.TableCell,{children:e.jsxs(r.Typography,{color:"text.primary",children:[d,x===c&&e.jsx(A.StarRounded,{sx:{fontSize:12}})]})},c))})}),e.jsx(r.TableBody,{children:V.default(Object.values(h),"index").map(({data:c})=>e.jsx(r.TableRow,{children:g.map(({locale:d})=>{var a,P,n,b,m,j,C,p,w,I,B,R,_,D,z,F,J,H,Y,$,ue,ae,de,pe,xe,me;return e.jsx(r.TableCell,{children:e.jsx(r.Stack,{gap:1,children:t==="properties"?e.jsxs(e.Fragment,{children:[e.jsx(r.TextField,{size:"small",label:"Key",value:c.key||"",onChange:K=>{v.transact(()=>{c.key=K.target.value.trim()})}}),e.jsx(r.TextField,{size:"small",label:l("label"),value:(((P=(a=c.locales)==null?void 0:a[d])==null?void 0:P.name)??((b=(n=c.locales)==null?void 0:n[x])==null?void 0:b.name))||"",onChange:K=>{v.transact(()=>{var M;c.locales??(c.locales={}),(M=c.locales)[d]??(M[d]={}),c.locales[d].name=K.target.value})}}),e.jsx(r.Box,{children:e.jsx(L,{allComponents:S,defaultLocale:x,component:s,property:c,size:"small",fullWidth:!0,label:"Default Value",valueImmutable:Z.default((j=(m=c.locales)==null?void 0:m[d])==null?void 0:j.defaultValue),value:((p=(C=c.locales)==null?void 0:C[d])==null?void 0:p.defaultValue)??((I=(w=c.locales)==null?void 0:w[x])==null?void 0:I.defaultValue),onChange:K=>{v.transact(()=>{var M;c.locales??(c.locales={}),(M=c.locales)[d]??(M[d]={}),c.locales[d].defaultValue=K})}})})]}):t==="parameters"&&k?e.jsx(r.Box,{children:e.jsx(L,{allComponents:S,defaultLocale:x,component:s,property:c,size:"small",fullWidth:!0,valueImmutable:Z.default((D=(_=(R=(B=k.renderer.properties)==null?void 0:B[c.id])==null?void 0:R.locales)==null?void 0:_[d])==null?void 0:D.value),value:((H=(J=(F=(z=k.renderer.properties)==null?void 0:z[c.id])==null?void 0:F.locales)==null?void 0:J[d])==null?void 0:H.value)??((ae=(ue=($=(Y=k.renderer.properties)==null?void 0:Y[c.id])==null?void 0:$.locales)==null?void 0:ue[x])==null?void 0:ae.value)??((pe=(de=c.locales)==null?void 0:de[d])==null?void 0:pe.defaultValue)??((me=(xe=c.locales)==null?void 0:xe[x])==null?void 0:me.defaultValue),onChange:K=>{v.transact(()=>{var M,fe,be,he,je;(M=k.renderer).properties??(M.properties={}),(fe=k.renderer.properties)[be=c.id]??(fe[be]={}),(he=k.renderer.properties[c.id]).locales??(he.locales={}),(je=k.renderer.properties[c.id].locales)[d]??(je[d]={}),k.renderer.properties[c.id].locales[d].value=K})}})}):null},c.id)},d)})},c.id))})]})})}),e.jsx(r.DialogActions,{children:e.jsx(r.Button,{onClick:c=>{var d;return(d=i.onClose)==null?void 0:d.call(i,c,"escapeKeyDown")},children:l("close")})})]})}const ke=(t,s)=>i=>{const l=[i.palette.info.main,i.palette.primary.main,i.palette.secondary.main,i.palette.success.main,i.palette.warning.main],f=Math.min(l.length-1,t),g=l[f],x=r.alpha(g,.5),S=r.alpha(g,1);return{borderColor:`${x} !important`,borderLeft:"3px solid !important",borderLeftColor:x,color:S,...s}};function Ft({property:t,onChange:s,defaultLocale:i,allComponents:l}){const{t:f,locale:g}=N.useLocaleContext(),x=T.useRef(null),S=Vt(x,t),v=T.useCallback(()=>{if(!(t.type!=="json"&&t.type!=="yaml"&&t.type!=="array")&&t.subProperties)try{let h={};V.default(Object.values(t.subProperties),"index").filter(o=>o.data.visible!==!1&&o.data.key).forEach(({data:o})=>{var c,d,a,P;if(!o.key)return;let u=((d=(c=o.locales)==null?void 0:c[g])==null?void 0:d.defaultValue)??((P=(a=o.locales)==null?void 0:a[i])==null?void 0:P.defaultValue);if(o.type==="number")u=Number(u);else if(o.type==="boolean")u=u===!0||u==="true";else if((o.type==="json"||o.type==="yaml")&&typeof u=="string")try{o.type==="json"?u=JSON.parse(u):u=se.parse(u)}catch(n){console.error("Error parsing nested value",u,n),u={}}h[o.key]=u}),t.type==="array"&&!Array.isArray(h)&&(h=W.default(h)?[]:[h]);const y=E.transformValue(h,t.type);s==null||s(y)}catch(h){console.error("Error converting structure to text:",h)}},[t,g,i,s]);return t.type!=="json"&&t.type!=="yaml"&&t.type!=="array"?null:e.jsxs(r.Stack,{direction:"column",gap:1.5,sx:{width:"100%"},ref:x,children:[e.jsx(r.Divider,{sx:{mt:-1},children:e.jsx(r.Typography,{variant:"caption",color:"text.secondary",children:f("maker.properties.subProperties")})}),t.subProperties&&Object.keys(t.subProperties).length>0?e.jsx(Ce,{component:r.Stack,gap:2,list:t.subProperties,renderItem:(h,k,y)=>{const o=h.visible!==!1;return e.jsx(r.Paper,{elevation:0,className:"property-container",sx:{p:1.25,borderRadius:1,border:o?"1px solid":"1px dashed","&":ke(S)},children:e.jsx(r.Stack,{gap:2,children:e.jsx(Be,{data:h,params:y,visible:o,config:{properties:t.subProperties},currentLocale:g,defaultLocale:i,allComponents:l,onUpdateConfig:u=>{try{const c={properties:t.subProperties||{}};u(c);const d={...t,subProperties:c.properties};s==null||s(d,{forceUpdateProperty:!0}),v()}catch(c){console.error("Error updating property:",c)}}})})},h.id)}}):e.jsx(ee.default,{style:{fontSize:12,height:100},children:f("maker.properties.noSubProperties")}),e.jsx(r.Button,{fullWidth:!0,variant:"outlined",className:"ignore-style-override",size:"small",startIcon:e.jsx(A.AddRounded,{}),onClick:()=>{try{const h=t.subProperties||{},k=E.nextId(),o={index:Object.values(h).length,data:{id:k,key:"",type:"string",visible:!0,locales:{[g]:{name:"",defaultValue:""}},subProperties:{}}},u={...t,subProperties:{...h,[k]:o}};s==null||s(u,{forceUpdateProperty:!0}),v()}catch(h){console.error("Error adding property:",h)}},sx:{"&":ke(S,{})},children:f("maker.properties.addSubProperty")})]})}function L({component:t,property:s,value:i,onChange:l,valueImmutable:f,defaultLocale:g,allComponents:x,...S}){var u,c,d,a,P;const{locale:v}=N.useLocaleContext(),h=q.useUploader(),k=T.useRef(null),y=()=>{var b;const n=(b=h==null?void 0:h.current)==null?void 0:b.getUploader();n==null||n.open(),k.current&&n.onceUploadSuccess(({response:m})=>{var C,p;let j=((C=m==null?void 0:m.data)==null?void 0:C.filename)||"";j&&(j=`mediakit://${j}`,i&&!i.includes("mediakit://")&&(j+=" # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")),(p=k.current)==null||p.call(k,j)})},o=S.label??(((c=(u=s.locales)==null?void 0:u[v])==null?void 0:c.name)||((a=(d=s.locales)==null?void 0:d[g])==null?void 0:a.name)||s.key||s.id);if(s.type==="number")return e.jsx(qt,{...S,label:o,NumberProps:{value:["number","string"].includes(typeof i)?i:null,onChange:(n,b)=>l==null?void 0:l(b)}});if(s.type==="decimal")return e.jsx(r.TextField,{...S,label:o,type:"text",value:i??"",onChange:n=>{const b=n.target.value;if(b===""||b==="-"){l==null||l(b);return}if(/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(b)){let j=b;/^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(j)&&(j=Number(j)),l==null||l(j)}}});if(s.type==="boolean")return e.jsx(r.FormControlLabel,{label:o,labelPlacement:"start",control:e.jsx(r.Switch,{checked:i===!0,onChange:(n,b)=>l==null?void 0:l(b)})});if(s.type==="color")return e.jsx(St,{label:o,value:i,onChange:n=>{l==null||l(n)}});if(s.type==="json"||s.type==="yaml")return e.jsx(wt,{label:o,value:i,onChange:n=>{l==null||l(n)},property:s,component:t,defaultLocale:g,allComponents:x,PropertyValueField:L,onUpload:n=>{k.current=n,y()}});if(s.type==="custom"){const n=(P=x[s.componentId])==null?void 0:P.data;return n?e.jsx(r.Box,{width:"100%",children:e.jsx(X.CustomComponentRenderer,{componentId:n.id,props:{label:o,value:i,onChange:l},locale:v,dev:{mode:"draft",components:x,defaultLocale:g}})}):e.jsx(r.TextField,{...S,label:o,disabled:!0,placeholder:"Click right button select a component"})}if(s.type==="component")return e.jsxs(r.Stack,{width:"100%",direction:"column",gap:1,children:[e.jsx(te,{allComponents:x,label:o,value:i==null?void 0:i.componentId,onChange:(n,b)=>{f||!i?l==null||l({...i&&JSON.parse(JSON.stringify(i)),componentId:b}):typeof i=="object"&&(i.componentId=b,l==null||l({...i&&JSON.parse(JSON.stringify(i)),componentId:b}))}}),(i==null?void 0:i.componentId)&&e.jsx(zt,{value:i,valueImmutable:f,onChange:l,defaultLocale:g,allComponents:x})]});if(!s.type||["string","url","multiline"].includes(s.type)){let n=s.type==="string"?s.multiline:void 0;s.type==="multiline"&&(n=!0);const b=s.type==="url"?i==null?void 0:i.url:i;return e.jsx(r.TextField,{...S,label:o,value:typeof b=="string"?b:"",multiline:n,minRows:n?2:void 0,maxRows:n?10:void 0,onChange:m=>l==null?void 0:l(s.type==="url"?{...i,url:m.target.value,mediaKitUrl:m.target.value}:m.target.value),InputProps:s.type==="url"?{sx:{pr:0},endAdornment:e.jsxs(r.InputAdornment,{position:"end",sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(q.UploaderButton,{onChange:async({response:m})=>{var w,I,B;const j=((w=m==null?void 0:m.data)==null?void 0:w.url)||((I=m==null?void 0:m.data)==null?void 0:I.fileUrl);let C;j&&(C=await q.getImageSize(j).catch(()=>q.getVideoSize(j)).catch(()=>{}));let p=((B=m==null?void 0:m.data)==null?void 0:B.filename)||"";p&&(p=`mediakit://${p}`),l==null||l({url:j,mediaKitUrl:p,width:C==null?void 0:C.naturalWidth,height:C==null?void 0:C.naturalHeight})}}),e.jsx(r.Tooltip,{title:"If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.",children:e.jsx(A.InfoRounded,{sx:{cursor:"default",mr:1},fontSize:"small"})})]})}:void 0})}return s.type==="array"?e.jsx(Pt,{label:o,value:Array.isArray(i)?i:[],onChange:n=>l==null?void 0:l(n),property:s,renderItem:({item:n,index:b,onChange:m})=>s.subProperties&&Object.keys(s.subProperties).length>0?e.jsx(r.Stack,{gap:1,width:"100%",children:V.default(Object.values(s.subProperties),"index").filter(j=>j.data.visible!==!1).map(({data:j})=>j.key?e.jsx(L,{component:t,property:j,value:n[j.key],onChange:C=>{const p={...n,[j.key]:C};m(p)},size:"small",fullWidth:!0,defaultLocale:g,allComponents:x},j.id):null)},b):e.jsx(r.TextField,{size:S.size,fullWidth:!0,value:n,onChange:j=>m(j.target.value)})}):(console.error("Unsupported property type",s.type),null)}function qt({NumberProps:t,...s}){const{getInputProps:i}=Pe.unstable_useNumberInput(t),l=i();return e.jsx(r.TextField,{...s,inputProps:l})}const Re=`import React from '@blocklet/pages-kit/builtin/react'
2
2
  import { Box } from '@blocklet/pages-kit/builtin/mui/material'
3
3
 
4
4
  export default function () {
@@ -8,4 +8,4 @@ export default function () {
8
8
  </Box>
9
9
  )
10
10
  }`,_e=`console.log('hello')
11
- `;function Ut({value:t}){const{locale:s}=N.useLocaleContext(),i=ve.useUpdate(),l=G.getYjsValue(t).doc;return T.useEffect(()=>{var f;(f=t.renderer)!=null&&f.script||(l.transact(()=>{t.renderer.script=t.renderer.type==="react-component"?Re:_e}),i())},[t]),e.jsx(r.Box,{sx:{border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:e.jsx(ne.CodeEditor,{keyId:t.id,locale:s,language:"typescript",value:t.renderer.script||"",onChange:f=>t.renderer.script=f,typeScriptNoValidation:!1,fullScreenOptions:{enableEscExit:!0}},t.id)})}function Mt({value:t}){var k,y,o;const{t:s}=N.useLocaleContext(),i=G.getYjsValue(t).doc,{state:{components:l,config:{defaultLocale:f},resources:g},localState:{currentLocale:x}}=E.useStore(),P=E.useAllComponents(),v=((k=l[t.renderer.componentId])==null?void 0:k.data)??((o=(y=g.components)==null?void 0:y[t.renderer.componentId])==null?void 0:o.component),h=U.usePopupState({variant:"dialog"});return e.jsx(q.UploaderProvider,{children:e.jsxs(r.Stack,{gap:1,children:[e.jsx(te,{allComponents:P,excludes:[t.id],value:t.renderer.componentId,onChange:(a,c)=>t.renderer.componentId=c}),v&&e.jsxs(e.Fragment,{children:[e.jsxs(r.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(r.Typography,{variant:"subtitle2",children:s("parameters")}),e.jsx(r.Button,{sx:{minWidth:32,minHeight:32,p:0},...U.bindTrigger(h),children:e.jsx(D.TranslateRounded,{fontSize:"small"})})]}),v.properties&&V.default(Object.values(v.properties),"index").map(({data:a})=>{var c,d,u,S,n,b,m,j,C,p,w,I,B,R,_,z;return e.jsx(r.Box,{children:e.jsx(L,{allComponents:P,defaultLocale:f,component:v,property:a,fullWidth:!0,size:"small",valueImmutable:Z.default((S=(u=(d=(c=t.renderer.properties)==null?void 0:c[a.id])==null?void 0:d.locales)==null?void 0:u[x])==null?void 0:S.value),value:((j=(m=(b=(n=t.renderer.properties)==null?void 0:n[a.id])==null?void 0:b.locales)==null?void 0:m[x])==null?void 0:j.value)??((I=(w=(p=(C=t.renderer.properties)==null?void 0:C[a.id])==null?void 0:p.locales)==null?void 0:w[f])==null?void 0:I.value)??((R=(B=a.locales)==null?void 0:B[x])==null?void 0:R.defaultValue)??((z=(_=a.locales)==null?void 0:_[f])==null?void 0:z.defaultValue),onChange:A=>{i.transact(()=>{var F,J,H,Y,$;(F=t.renderer).properties??(F.properties={}),(J=t.renderer.properties)[H=a.id]??(J[H]={}),(Y=t.renderer.properties[a.id]).locales??(Y.locales={}),($=t.renderer.properties[a.id].locales)[x]??($[x]={}),t.renderer.properties[a.id].locales[x].value=A})}})},a.id)}),e.jsx(Ne,{...U.bindDialog(h),component:t,type:"parameters"})]})]})})}function te({label:t,options:s,excludes:i,value:l,onChange:f,allComponents:g,...x}){var k;const{t:P}=N.useLocaleContext(),v=s??V.default(Object.values(ht.default(g,...i??[])),"index").map(y=>y.data),h=(typeof l=="string"?(k=g[l])==null?void 0:k.data:void 0)??null;return e.jsx(r.Autocomplete,{...x,size:"small",options:v,autoHighlight:!0,isOptionEqualToValue:(y,o)=>y.id===o.id,getOptionKey:y=>y.id,getOptionLabel:y=>y.name||y.id,renderInput:y=>e.jsx(r.TextField,{label:t||P("component"),...y}),value:h,onChange:(y,o)=>{var c,d,u,S,n,b;let a={};o&&(a={blockletId:(c=g[o==null?void 0:o.id])==null?void 0:c.blockletId,blockletTitle:(d=g[o==null?void 0:o.id])==null?void 0:d.blockletTitle,componentName:((S=(u=g[o==null?void 0:o.id])==null?void 0:u.data)==null?void 0:S.name)||((b=(n=g[o==null?void 0:o.id])==null?void 0:n.data)==null?void 0:b.id)}),f==null||f(y,o==null?void 0:o.id,a)}})}function ce({config:t,allComponents:s,defaultLocale:i,propertiesValue:l,currentLocale:f,onChange:g,props:x}){const{t:P}=N.useLocaleContext(),[v,h]=T.useState(t==null?void 0:t.properties),[k,y]=T.useState(null);T.useEffect(()=>{(()=>{var S,n;((S=t==null?void 0:t.renderer)==null?void 0:S.type)==="react-component"&&W.default(t==null?void 0:t.properties)?X.transpileAndLoadScript((n=t==null?void 0:t.renderer)==null?void 0:n.script).then(b=>{const m=X.getPropertiesFromCode(b);h(m)}):h(t==null?void 0:t.properties)})()},[JSON.stringify(t)]);const o=T.useCallback(()=>!t||!v?{}:Object.values(v).reduce((u,{data:S})=>{var b,m,j,C,p;const n=S.key||S.id;return u[S.id]={key:n,value:(x==null?void 0:x[n])??((b=l==null?void 0:l[S.id])==null?void 0:b.value)??((j=(m=S.locales)==null?void 0:m[f])==null?void 0:j.defaultValue)??((p=(C=S.locales)==null?void 0:C[i])==null?void 0:p.defaultValue),id:S.id,type:S.type},u},{}),[JSON.stringify(v),t,l,f,i]),a=T.useMemo(()=>{if(!v)return{canUseProperties:[],visibleProperties:[],canUsePropertiesKeys:[]};const u=V.default(Object.values(v),"index"),S=u.filter(({data:m})=>m.key&&oe(v,m.id)),n=u.filter(({data:m})=>m.key&&m.type!=="component"),b=n.map(({data:m})=>m.key);return{canUseProperties:n,visibleProperties:S,canUsePropertiesKeys:b}},[JSON.stringify(v)]),c=o(),d=bt.default(c,"key");return e.jsx(q.UploaderProvider,{children:e.jsxs(r.Stack,{gap:2,children:[e.jsx(r.Typography,{variant:"subtitle1",children:P("maker.properties.parameters")}),!t||a.canUsePropertiesKeys.length===0?e.jsx(ee.default,{style:{fontSize:12},children:P("maker.properties.noParameters")}):e.jsxs(e.Fragment,{children:[e.jsx(r.Stack,{gap:2,children:a.visibleProperties.map(({data:u})=>{var S,n;return e.jsx(r.Box,{children:e.jsx(L,{allComponents:s,defaultLocale:i,size:"small",fullWidth:!0,component:t,property:u,valueImmutable:Z.default((S=l==null?void 0:l[u.id])==null?void 0:S.value),value:(x==null?void 0:x[u.key||u.id])??((n=c[u.id])==null?void 0:n.value),onChange:b=>{g({path:["properties",u.id],id:u.id,value:{value:b},shouldSync:ge(u),excludeKeys:[],key:u.key||u.id})}})},u.id)})}),e.jsx(r.Stack,{gap:2,sx:{width:"100%"},children:e.jsx(X.CustomComponentRenderer,{componentId:(t==null?void 0:t.id)||"",renderType:"setting",locale:f,properties:c,dev:{mode:"draft",components:s,defaultLocale:i},props:{...jt.default(x??{},a.canUsePropertiesKeys),onChange:u=>{const{canUsePropertiesKeys:S}=a;Object.keys(u).filter(b=>{var m;return!mt.default(u[b],(m=d==null?void 0:d[b])==null?void 0:m.value)}).filter(b=>{var m,j,C,p;return!(b==="locale"&&!xt.default(d[b],"locale")||((m=d[b])==null?void 0:m.type)==="component"||(((j=d[b])==null?void 0:j.type)==="yaml"||((C=d[b])==null?void 0:C.type)==="json")&&oe(v,(p=d[b])==null?void 0:p.id))}).reduce((b,m)=>b.then(()=>{const j=d[m],C=S.includes(m);if(j!=null&&j.id&&C)return g({path:["properties",j.id],id:j.id,value:{value:u[m]},shouldSync:ge(j),excludeKeys:[],key:j.key||j.id}),Promise.resolve();const p=`propertyNotFound${m}`;if(k===p)return Promise.resolve();ie.default.close(k);const w=ie.default.warning(P("maker.properties.propertyNotFound",{key:m}),{key:p});return y(w),Promise.resolve()}),Promise.resolve())}}})})]})]})})}function Wt({config:t}){const{t:s,locale:i}=N.useLocaleContext(),[l,f]=T.useState(!1),g=x=>{t.llmConfig=x};return e.jsxs(e.Fragment,{children:[e.jsx(r.Tooltip,{title:s("maker.properties.configDetailedDescription"),children:e.jsx(r.IconButton,{size:"small",color:"primary",onClick:()=>f(!0),children:e.jsx(D.PsychologyAlt,{fontSize:"small"})})}),l&&e.jsx(Nt,{open:l,onClose:()=>f(!1),onConfirm:g,component:t,initialConfig:t.llmConfig,locale:i,defaultLocale:"en",title:s("maker.properties.llmConfigTitle")})]})}exports.BasicInfo=Te;exports.CustomComponentAutocomplete=te;exports.CustomComponentSettings=Et;exports.DefaultReactComponentScriptTemplate=Re;exports.DefaultWebComponentScriptTemplate=_e;exports.ParametersConfig=ce;exports.PropertiesConfig=Oe;exports.PropertyValueField=L;
11
+ `;function Ut({value:t}){const{locale:s}=N.useLocaleContext(),i=ve.useUpdate(),l=G.getYjsValue(t).doc;return T.useEffect(()=>{var f;(f=t.renderer)!=null&&f.script||(l.transact(()=>{t.renderer.script=t.renderer.type==="react-component"?Re:_e}),i())},[t]),e.jsx(r.Box,{sx:{border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:e.jsx(ne.CodeEditor,{keyId:t.id,locale:s,language:"typescript",value:t.renderer.script||"",onChange:f=>t.renderer.script=f,typeScriptNoValidation:!1,fullScreenOptions:{enableEscExit:!0}},t.id)})}function Mt({value:t}){var k,y,o;const{t:s}=N.useLocaleContext(),i=G.getYjsValue(t).doc,{state:{components:l,config:{defaultLocale:f},resources:g},localState:{currentLocale:x}}=E.useStore(),S=E.useAllComponents(),v=((k=l[t.renderer.componentId])==null?void 0:k.data)??((o=(y=g.components)==null?void 0:y[t.renderer.componentId])==null?void 0:o.component),h=U.usePopupState({variant:"dialog"});return e.jsx(q.UploaderProvider,{children:e.jsxs(r.Stack,{gap:1,children:[e.jsx(te,{allComponents:S,excludes:[t.id],value:t.renderer.componentId,onChange:(u,c)=>t.renderer.componentId=c}),v&&e.jsxs(e.Fragment,{children:[e.jsxs(r.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(r.Typography,{variant:"subtitle2",children:s("parameters")}),e.jsx(r.Button,{sx:{minWidth:32,minHeight:32,p:0},...U.bindTrigger(h),children:e.jsx(A.TranslateRounded,{fontSize:"small"})})]}),v.properties&&V.default(Object.values(v.properties),"index").map(({data:u})=>{var c,d,a,P,n,b,m,j,C,p,w,I,B,R,_,D;return e.jsx(r.Box,{children:e.jsx(L,{allComponents:S,defaultLocale:f,component:v,property:u,fullWidth:!0,size:"small",valueImmutable:Z.default((P=(a=(d=(c=t.renderer.properties)==null?void 0:c[u.id])==null?void 0:d.locales)==null?void 0:a[x])==null?void 0:P.value),value:((j=(m=(b=(n=t.renderer.properties)==null?void 0:n[u.id])==null?void 0:b.locales)==null?void 0:m[x])==null?void 0:j.value)??((I=(w=(p=(C=t.renderer.properties)==null?void 0:C[u.id])==null?void 0:p.locales)==null?void 0:w[f])==null?void 0:I.value)??((R=(B=u.locales)==null?void 0:B[x])==null?void 0:R.defaultValue)??((D=(_=u.locales)==null?void 0:_[f])==null?void 0:D.defaultValue),onChange:z=>{i.transact(()=>{var F,J,H,Y,$;(F=t.renderer).properties??(F.properties={}),(J=t.renderer.properties)[H=u.id]??(J[H]={}),(Y=t.renderer.properties[u.id]).locales??(Y.locales={}),($=t.renderer.properties[u.id].locales)[x]??($[x]={}),t.renderer.properties[u.id].locales[x].value=z})}})},u.id)}),e.jsx(Ne,{...U.bindDialog(h),component:t,type:"parameters"})]})]})})}function te({label:t,options:s,excludes:i,value:l,onChange:f,allComponents:g,...x}){var k;const{t:S}=N.useLocaleContext(),v=s??V.default(Object.values(ht.default(g,...i??[])),"index").map(y=>y.data),h=(typeof l=="string"?(k=g[l])==null?void 0:k.data:void 0)??null;return e.jsx(r.Autocomplete,{...x,size:"small",options:v,autoHighlight:!0,isOptionEqualToValue:(y,o)=>y.id===o.id,getOptionKey:y=>y.id,getOptionLabel:y=>y.name||y.id,renderInput:y=>e.jsx(r.TextField,{label:t||S("component"),...y}),value:h,onChange:(y,o)=>{var c,d,a,P,n,b;let u={};o&&(u={blockletId:(c=g[o==null?void 0:o.id])==null?void 0:c.blockletId,blockletTitle:(d=g[o==null?void 0:o.id])==null?void 0:d.blockletTitle,componentName:((P=(a=g[o==null?void 0:o.id])==null?void 0:a.data)==null?void 0:P.name)||((b=(n=g[o==null?void 0:o.id])==null?void 0:n.data)==null?void 0:b.id)}),f==null||f(y,o==null?void 0:o.id,u)}})}function ce({config:t,allComponents:s,defaultLocale:i,propertiesValue:l,currentLocale:f,onChange:g,props:x}){const{t:S}=N.useLocaleContext(),[v,h]=T.useState(t==null?void 0:t.properties),[k,y]=T.useState(null);T.useEffect(()=>{(()=>{var P,n;((P=t==null?void 0:t.renderer)==null?void 0:P.type)==="react-component"&&W.default(t==null?void 0:t.properties)?X.transpileAndLoadScript((n=t==null?void 0:t.renderer)==null?void 0:n.script).then(b=>{const m=X.getPropertiesFromCode(b);h(m)}):h(t==null?void 0:t.properties)})()},[JSON.stringify(t)]);const o=T.useCallback(()=>!t||!v?{}:Object.values(v).reduce((a,{data:P})=>{var b,m,j,C,p;const n=P.key||P.id;return a[P.id]={key:n,value:(x==null?void 0:x[n])??((b=l==null?void 0:l[P.id])==null?void 0:b.value)??((j=(m=P.locales)==null?void 0:m[f])==null?void 0:j.defaultValue)??((p=(C=P.locales)==null?void 0:C[i])==null?void 0:p.defaultValue),id:P.id,type:P.type},a},{}),[JSON.stringify(v),t,l,f,i]),u=T.useMemo(()=>{if(!v)return{canUseProperties:[],visibleProperties:[],canUsePropertiesKeys:[]};const a=V.default(Object.values(v),"index"),P=a.filter(({data:m})=>m.key&&oe(v,m.id)),n=a.filter(({data:m})=>m.key&&m.type!=="component"),b=n.map(({data:m})=>m.key);return{canUseProperties:n,visibleProperties:P,canUsePropertiesKeys:b}},[JSON.stringify(v)]),c=o(),d=bt.default(c,"key");return e.jsx(q.UploaderProvider,{children:e.jsxs(r.Stack,{gap:2,children:[e.jsx(r.Typography,{variant:"subtitle1",children:S("maker.properties.parameters")}),!t||u.canUsePropertiesKeys.length===0?e.jsx(ee.default,{style:{fontSize:12},children:S("maker.properties.noParameters")}):e.jsxs(e.Fragment,{children:[e.jsx(r.Stack,{gap:2,children:u.visibleProperties.map(({data:a})=>{var P,n;return e.jsx(r.Box,{children:e.jsx(L,{allComponents:s,defaultLocale:i,size:"small",fullWidth:!0,component:t,property:a,valueImmutable:Z.default((P=l==null?void 0:l[a.id])==null?void 0:P.value),value:(x==null?void 0:x[a.key||a.id])??((n=c[a.id])==null?void 0:n.value),onChange:b=>{g({path:["properties",a.id],id:a.id,value:{value:b},shouldSync:ge(a),excludeKeys:[],key:a.key||a.id})}})},a.id)})}),e.jsx(r.Stack,{gap:2,sx:{width:"100%"},children:e.jsx(X.CustomComponentRenderer,{componentId:(t==null?void 0:t.id)||"",renderType:"setting",locale:f,properties:c,dev:{mode:"draft",components:s,defaultLocale:i},props:{...jt.default(x??{},u.canUsePropertiesKeys),onChange:a=>{const{canUsePropertiesKeys:P}=u;Object.keys(a).filter(b=>{var m;return!mt.default(a[b],(m=d==null?void 0:d[b])==null?void 0:m.value)}).filter(b=>{var m,j,C,p;return!(b==="locale"&&!xt.default(d[b],"locale")||((m=d[b])==null?void 0:m.type)==="component"||(((j=d[b])==null?void 0:j.type)==="yaml"||((C=d[b])==null?void 0:C.type)==="json")&&oe(v,(p=d[b])==null?void 0:p.id))}).reduce((b,m)=>b.then(()=>{const j=d[m],C=P.includes(m);if(j!=null&&j.id&&C)return g({path:["properties",j.id],id:j.id,value:{value:a[m]},shouldSync:ge(j),excludeKeys:[],key:j.key||j.id}),Promise.resolve();const p=`propertyNotFound${m}`;if(k===p)return Promise.resolve();ie.default.close(k);const w=ie.default.warning(S("maker.properties.propertyNotFound",{key:m}),{key:p});return y(w),Promise.resolve()}),Promise.resolve())}}})})]})]})})}function Wt({config:t}){const{t:s,locale:i}=N.useLocaleContext(),[l,f]=T.useState(!1),g=x=>{t.llmConfig=x};return e.jsxs(e.Fragment,{children:[e.jsx(r.Tooltip,{title:s("maker.properties.configLLMDescription"),children:e.jsx(r.IconButton,{color:"primary",onClick:()=>f(!0),size:"small",children:e.jsx(A.PsychologyAlt,{})})}),l&&e.jsx(Nt,{open:l,onClose:()=>f(!1),onConfirm:g,component:t,initialConfig:t.llmConfig,locale:i,defaultLocale:"en",title:s("maker.properties.llmConfigTitle")})]})}exports.BasicInfo=Te;exports.CustomComponentAutocomplete=te;exports.CustomComponentSettings=Et;exports.DefaultReactComponentScriptTemplate=Re;exports.DefaultWebComponentScriptTemplate=_e;exports.ParametersConfig=ce;exports.PropertiesConfig=Oe;exports.PropertyValueField=L;
package/lib/es/locales.js CHANGED
@@ -290,7 +290,7 @@ const t = e({
290
290
  templateSectionNameHelper: "Section name is used to identify the section in the template, please use a meaningful and unique name, so that the section can be set content later",
291
291
  templateSectionNameDuplicated: "Section name must be unique among all template sections in the page",
292
292
  propertyNotFound: "Failed to modify parameter, reason: component does not exist `{key}` property",
293
- configDetailedDescription: "Configure detailed description",
293
+ configLLMDescription: "Configure LLM description",
294
294
  llmConfigTitle: "LLM Configuration Details",
295
295
  llmConfigLabel: "LLM Configuration Information",
296
296
  llmConfigPlaceholder: "Enter additional configuration information for LLM",
@@ -799,7 +799,7 @@ const t = e({
799
799
  templateSectionNameHelper: "卡片名称用于标识模板中的卡片,请使用有意义且唯一的名称,以便后续为卡片设置内容",
800
800
  templateSectionNameDuplicated: "模板卡片名称在页面中必须唯一,当前名称已被其他模板卡片使用",
801
801
  propertyNotFound: "修改参数失败,原因:组件不存在 `{key}` 属性",
802
- configDetailedDescription: "配置详细描述",
802
+ configLLMDescription: "配置 LLM 描述",
803
803
  llmConfigTitle: "LLM 配置详情",
804
804
  llmConfigLabel: "LLM 配置信息",
805
805
  llmConfigPlaceholder: "输入用于LLM的额外配置信息",
package/lib/es/setting.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { jsx as r, jsxs as O, Fragment as q } from "react/jsx-runtime";
2
- import { t as ge, g as We, b as ue, E as ur, n as Ke, h as Pe } from "./chunks/state-COB6reM7.js";
3
- import ae from "@arcblock/ux/lib/Empty";
2
+ import { t as ge, g as We, b as ae, E as ur, n as Ke, h as Pe } from "./chunks/state-COB6reM7.js";
3
+ import pe from "@arcblock/ux/lib/Empty";
4
4
  import { useLocaleContext as V } from "@arcblock/ux/lib/Locale/context";
5
5
  import { CodeEditor as ke } from "@blocklet/code-editor";
6
6
  import ar from "@mui/icons-material/AddRounded";
7
7
  import pr from "@mui/icons-material/ArrowDownward";
8
8
  import mr from "@mui/icons-material/ArrowUpward";
9
9
  import fr from "@mui/icons-material/DeleteOutline";
10
- import { Typography as W, TextField as R, Stack as j, FormLabel as oe, Box as N, TableContainer as hr, Paper as te, Table as Fe, TableHead as Me, TableRow as se, TableCell as ce, TableBody as Je, Button as A, IconButton as ie, InputAdornment as pe, alpha as fe, Tooltip as Y, buttonClasses as br, Dialog as we, DialogTitle as _e, DialogContent as $e, DialogActions as He, FormControlLabel as Ge, Checkbox as yr, Autocomplete as Le, Switch as vr, MenuItem as he, Collapse as xr, Divider as gr, Popper as Pr } from "@mui/material";
10
+ import { Typography as W, TextField as R, Stack as j, FormLabel as se, Box as N, TableContainer as hr, Paper as te, Table as Me, TableHead as Fe, TableRow as ce, TableCell as de, TableBody as Je, Button as A, IconButton as ie, InputAdornment as ne, alpha as fe, Tooltip as Y, buttonClasses as br, Dialog as we, DialogTitle as _e, DialogContent as $e, DialogActions as He, FormControlLabel as Ge, Checkbox as yr, Autocomplete as Le, Switch as vr, MenuItem as he, Collapse as xr, Divider as gr, Popper as Pr } from "@mui/material";
11
11
  import U from "lodash/sortBy";
12
12
  import { useCallback as D, useMemo as re, useRef as H, useId as kr, useEffect as _, useState as G } from "react";
13
13
  import { useUpdate as Ye } from "react-use";
@@ -23,13 +23,13 @@ import { CustomComponentRenderer as Xe, transpileAndLoadScript as zr, getPropert
23
23
  import { parsePropertyValue as Vr } from "@blocklet/pages-kit/utils/property";
24
24
  import { unstable_useNumberInput as Er, ClickAwayListener as Tr } from "@mui/base";
25
25
  import { VisibilityOffRounded as Ar, VisibilityRounded as Dr, DeleteOutlineRounded as Wr, DragIndicatorRounded as Ur, TranslateRounded as Ze, AddRounded as er, InfoRounded as rr, PsychologyAlt as Br, StarRounded as Kr, SettingsRounded as tr } from "@mui/icons-material";
26
- import { getYjsValue as ne } from "@syncedstore/core";
27
- import { useUpdate as Fr, useReactive as Mr } from "ahooks";
26
+ import { getYjsValue as le } from "@syncedstore/core";
27
+ import { useUpdate as Mr, useReactive as Fr } from "ahooks";
28
28
  import Jr from "lodash/assign";
29
29
  import _r from "lodash/get";
30
30
  import $r from "lodash/has";
31
31
  import Hr from "lodash/isEqual";
32
- import de from "lodash/isNil";
32
+ import ue from "lodash/isNil";
33
33
  import Gr from "lodash/isObject";
34
34
  import Lr from "lodash/keyBy";
35
35
  import Yr from "lodash/omit";
@@ -208,9 +208,9 @@ function lt({
208
208
  c.length
209
209
  ]);
210
210
  return y ? /* @__PURE__ */ O(j, { width: "100%", gap: 1, children: [
211
- e && /* @__PURE__ */ r(oe, { children: e }),
211
+ e && /* @__PURE__ */ r(se, { children: e }),
212
212
  c.length > 0 ? /* @__PURE__ */ r(hr, { component: te, variant: "outlined", sx: { borderRadius: 1, mb: 1 }, children: /* @__PURE__ */ O(
213
- Fe,
213
+ Me,
214
214
  {
215
215
  size: "small",
216
216
  sx: {
@@ -227,8 +227,8 @@ function lt({
227
227
  borderCollapse: "collapse"
228
228
  },
229
229
  children: [
230
- /* @__PURE__ */ r(Me, { sx: { display: "none" }, children: /* @__PURE__ */ r(se, { children: I.map((a) => /* @__PURE__ */ r(
231
- ce,
230
+ /* @__PURE__ */ r(Fe, { sx: { display: "none" }, children: /* @__PURE__ */ r(ce, { children: I.map((a) => /* @__PURE__ */ r(
231
+ de,
232
232
  {
233
233
  width: a.width,
234
234
  align: a.align || "left",
@@ -238,7 +238,7 @@ function lt({
238
238
  a.field
239
239
  )) }) }),
240
240
  /* @__PURE__ */ r(Je, { children: c.map((a, S, C) => /* @__PURE__ */ r(
241
- se,
241
+ ce,
242
242
  {
243
243
  sx: {
244
244
  borderBottom: S < C.length - 1 ? "1px solid" : "none",
@@ -248,7 +248,7 @@ function lt({
248
248
  }
249
249
  },
250
250
  children: I.map((z) => /* @__PURE__ */ r(
251
- ce,
251
+ de,
252
252
  {
253
253
  width: z.width,
254
254
  align: z.align || "left",
@@ -268,7 +268,7 @@ function lt({
268
268
  )) })
269
269
  ]
270
270
  }
271
- ) }) : /* @__PURE__ */ r(ae, { style: { fontSize: 12, height: x }, children: b("maker.properties.arrayEmpty") }),
271
+ ) }) : /* @__PURE__ */ r(pe, { style: { fontSize: 12, height: x }, children: b("maker.properties.arrayEmpty") }),
272
272
  /* @__PURE__ */ r(
273
273
  A,
274
274
  {
@@ -282,7 +282,7 @@ function lt({
282
282
  }
283
283
  )
284
284
  ] }) : /* @__PURE__ */ O(j, { width: "100%", gap: 1, children: [
285
- e && /* @__PURE__ */ r(oe, { children: e }),
285
+ e && /* @__PURE__ */ r(se, { children: e }),
286
286
  /* @__PURE__ */ r(N, { sx: { border: 1, borderColor: "divider", borderRadius: 1, minHeight: 150 }, children: /* @__PURE__ */ r(
287
287
  ke,
288
288
  {
@@ -314,7 +314,7 @@ function ot({
314
314
  value: e,
315
315
  onChange: t,
316
316
  InputProps: {
317
- endAdornment: /* @__PURE__ */ r(pe, { position: "end", children: /* @__PURE__ */ r(
317
+ endAdornment: /* @__PURE__ */ r(ne, { position: "end", children: /* @__PURE__ */ r(
318
318
  wr,
319
319
  {
320
320
  color: e ?? "",
@@ -356,7 +356,7 @@ function st({
356
356
  (c) => c.data.visible !== !1 && c.data.key
357
357
  );
358
358
  return /* @__PURE__ */ O(j, { width: "100%", children: [
359
- /* @__PURE__ */ r(oe, { sx: { px: 0.25, py: 0.5 }, children: e }),
359
+ /* @__PURE__ */ r(se, { sx: { px: 0.25, py: 0.5 }, children: e }),
360
360
  /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(N, { sx: { position: "relative" }, children: l.map((c, s) => {
361
361
  const { data: u } = c, d = u.key ?? u.id, k = s === l.length - 1;
362
362
  let o = null;
@@ -483,7 +483,7 @@ function st({
483
483
  },
484
484
  children: [
485
485
  /* @__PURE__ */ r(
486
- oe,
486
+ se,
487
487
  {
488
488
  sx: {
489
489
  position: "absolute",
@@ -548,7 +548,7 @@ function lr({
548
548
  renderItem: i,
549
549
  ...n
550
550
  }) {
551
- const f = H(null), x = kr(), p = Fr(), w = U(Object.entries(t), (c) => c[1].index).map((c) => c[0]), P = H(w), b = D(
551
+ const f = H(null), x = kr(), p = Mr(), w = U(Object.entries(t), (c) => c[1].index).map((c) => c[0]), P = H(w), b = D(
552
552
  (c) => {
553
553
  P.current = c, p();
554
554
  },
@@ -576,7 +576,7 @@ function lr({
576
576
  const o = t[d];
577
577
  o && (o.index = k);
578
578
  });
579
- }, s = (u = ne(t)) == null ? void 0 : u.doc;
579
+ }, s = (u = le(t)) == null ? void 0 : u.doc;
580
580
  s ? s.transact(() => {
581
581
  c();
582
582
  }) : c();
@@ -790,11 +790,11 @@ function mt({
790
790
  const C = (z, E) => {
791
791
  const T = {};
792
792
  return Object.entries(z).forEach(([B, K]) => {
793
- const F = { ...K };
794
- E !== null && (F.isNeedGenerate = E), K.subProperties && !J(K.subProperties) && (F.subProperties = C(
793
+ const M = { ...K };
794
+ E !== null && (M.isNeedGenerate = E), K.subProperties && !J(K.subProperties) && (M.subProperties = C(
795
795
  K.subProperties,
796
796
  E !== null ? E : null
797
- )), T[B] = F;
797
+ )), T[B] = M;
798
798
  }), T;
799
799
  };
800
800
  S.subProperties = C(
@@ -972,7 +972,10 @@ function ft({
972
972
  value: t,
973
973
  onChange: (x) => i == null ? void 0 : i(x.target.value),
974
974
  InputProps: {
975
- endAdornment: /* @__PURE__ */ r(
975
+ sx: {
976
+ pr: 0
977
+ },
978
+ endAdornment: /* @__PURE__ */ r(ne, { position: "end", children: /* @__PURE__ */ r(
976
979
  Qe,
977
980
  {
978
981
  onChange: ({ response: x }) => {
@@ -981,7 +984,7 @@ function ft({
981
984
  p && (i == null || i(p));
982
985
  }
983
986
  }
984
- )
987
+ ) })
985
988
  }
986
989
  }
987
990
  ),
@@ -1021,7 +1024,7 @@ const ht = [
1021
1024
  { value: "component", label: "Component" },
1022
1025
  { value: "custom", label: "Custom (Render by a Component)" }
1023
1026
  ];
1024
- function le(e, t, i) {
1027
+ function oe(e, t, i) {
1025
1028
  return !e || !i ? !1 : Object.values(e).some(({ data: n }) => n.id !== t && n.key === i);
1026
1029
  }
1027
1030
  function xe(e, t) {
@@ -1029,12 +1032,12 @@ function xe(e, t) {
1029
1032
  return !e || !t ? !1 : ((i = e[t]) == null ? void 0 : i.data.visible) ?? !0;
1030
1033
  }
1031
1034
  function hi({ componentId: e }) {
1032
- const { state: { components: t } } = ue(), i = t[e], n = i == null ? void 0 : i.data;
1035
+ const { state: { components: t } } = ae(), i = t[e], n = i == null ? void 0 : i.data;
1033
1036
  return n ? /* @__PURE__ */ r(j, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ r(N, { p: 2, children: /* @__PURE__ */ r(Zr, { FallbackComponent: ur, resetKeys: [e], children: /* @__PURE__ */ r(bt, { value: n, componentId: e }) }) }) }) : null;
1034
1037
  }
1035
1038
  function bt({ value: e, componentId: t }) {
1036
1039
  var v, l, c;
1037
- const { t: i } = V(), { localState: { currentLocale: n, customComponentPreviewerProperties: f }, state: { config: { defaultLocale: x } }, localActions: { setCustomComponentPreviewerProperties: p } } = ue(), w = ne(e).doc, P = Pe(), b = re(() => (f == null ? void 0 : f[t]) ?? {}, [t, f]), g = Mr({
1040
+ const { t: i } = V(), { localState: { currentLocale: n, customComponentPreviewerProperties: f }, state: { config: { defaultLocale: x } }, localActions: { setCustomComponentPreviewerProperties: p } } = ae(), w = le(e).doc, P = Pe(), b = re(() => (f == null ? void 0 : f[t]) ?? {}, [t, f]), g = Fr({
1038
1041
  componentId: t,
1039
1042
  propertiesValue: {
1040
1043
  ...b
@@ -1136,7 +1139,7 @@ function yt({ config: e }) {
1136
1139
  value: e.description || "",
1137
1140
  onChange: (i) => e.description = i.target.value,
1138
1141
  InputProps: {
1139
- endAdornment: /* @__PURE__ */ r(pe, { position: "end", sx: { mt: -1.5 }, children: /* @__PURE__ */ r(Nt, { config: e }) })
1142
+ endAdornment: /* @__PURE__ */ r(ne, { position: "end", sx: { mt: -1.5 }, children: /* @__PURE__ */ r(Nt, { config: e }) })
1140
1143
  }
1141
1144
  }),
1142
1145
  /* @__PURE__ */ r(Le, {
@@ -1190,13 +1193,13 @@ function sr({ data: e, params: t, visible: i, config: n, currentLocale: f, defau
1190
1193
  width: "calc(100% - 80px - 8px)",
1191
1194
  flex: 1,
1192
1195
  "& .MuiOutlinedInput-root": {
1193
- borderColor: e.key ? le(n.properties, e.id, e.key) ? "warning.main" : void 0 : "error.main"
1196
+ borderColor: e.key ? oe(n.properties, e.id, e.key) ? "warning.main" : void 0 : "error.main"
1194
1197
  },
1195
1198
  "& .MuiFormLabel-root": {
1196
- color: e.key ? le(n.properties, e.id, e.key) ? "warning.main" : "text.secondary" : "error.main"
1199
+ color: e.key ? oe(n.properties, e.id, e.key) ? "warning.main" : "text.secondary" : "error.main"
1197
1200
  },
1198
1201
  "& .MuiFormLabel-root.Mui-focused": {
1199
- color: e.key ? le(n.properties, e.id, e.key) ? "warning.main" : "primary.main" : "error.main"
1202
+ color: e.key ? oe(n.properties, e.id, e.key) ? "warning.main" : "primary.main" : "error.main"
1200
1203
  }
1201
1204
  },
1202
1205
  value: e.key || "",
@@ -1207,7 +1210,7 @@ function sr({ data: e, params: t, visible: i, config: n, currentLocale: f, defau
1207
1210
  });
1208
1211
  },
1209
1212
  InputProps: {
1210
- endAdornment: !e.key || e.key && le(n.properties, e.id, e.key) ? /* @__PURE__ */ r(pe, {
1213
+ endAdornment: !e.key || e.key && oe(n.properties, e.id, e.key) ? /* @__PURE__ */ r(ne, {
1211
1214
  position: "end",
1212
1215
  sx: {
1213
1216
  width: 16,
@@ -1333,7 +1336,7 @@ function xt({ config: e, currentLocale: t, defaultLocale: i, allComponents: n, o
1333
1336
  }) })
1334
1337
  }, b.id);
1335
1338
  }
1336
- }) : /* @__PURE__ */ r(ae, { style: { fontSize: 12 }, children: p("maker.properties.noProperties") }),
1339
+ }) : /* @__PURE__ */ r(pe, { style: { fontSize: 12 }, children: p("maker.properties.noProperties") }),
1337
1340
  /* @__PURE__ */ r(A, {
1338
1341
  fullWidth: !0,
1339
1342
  variant: "outlined",
@@ -1403,17 +1406,17 @@ function Pt({ value: e, valueImmutable: t, onChange: i, defaultLocale: n, allCom
1403
1406
  }
1404
1407
  function cr({ type: e = "properties", component: t, ...i }) {
1405
1408
  var v, l, c;
1406
- const { t: n } = V(), { state: { components: f, supportedLocales: x, config: { defaultLocale: p } } } = ue(), w = Pe(), P = ne(t).doc, b = e === "properties" ? t.properties : e === "parameters" && ((v = t.renderer) == null ? void 0 : v.type) === "component" ? (l = f[t.renderer.componentId]) == null ? void 0 : l.data.properties : void 0, g = ((c = t.renderer) == null ? void 0 : c.type) === "component" ? t : void 0;
1409
+ const { t: n } = V(), { state: { components: f, supportedLocales: x, config: { defaultLocale: p } } } = ae(), w = Pe(), P = le(t).doc, b = e === "properties" ? t.properties : e === "parameters" && ((v = t.renderer) == null ? void 0 : v.type) === "component" ? (l = f[t.renderer.componentId]) == null ? void 0 : l.data.properties : void 0, g = ((c = t.renderer) == null ? void 0 : c.type) === "component" ? t : void 0;
1407
1410
  return /* @__PURE__ */ O(we, { ...i, fullWidth: !0, maxWidth: "lg", children: [
1408
1411
  /* @__PURE__ */ r(_e, { children: n("i18nEditorTitle") }),
1409
- /* @__PURE__ */ r($e, { children: b && /* @__PURE__ */ r(j, { children: /* @__PURE__ */ O(Fe, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
1410
- /* @__PURE__ */ r(Me, { children: /* @__PURE__ */ r(se, { children: x.map(({ locale: s, name: u }) => /* @__PURE__ */ r(ce, { children: /* @__PURE__ */ O(W, { color: "text.primary", children: [
1412
+ /* @__PURE__ */ r($e, { children: b && /* @__PURE__ */ r(j, { children: /* @__PURE__ */ O(Me, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
1413
+ /* @__PURE__ */ r(Fe, { children: /* @__PURE__ */ r(ce, { children: x.map(({ locale: s, name: u }) => /* @__PURE__ */ r(de, { children: /* @__PURE__ */ O(W, { color: "text.primary", children: [
1411
1414
  u,
1412
1415
  p === s && /* @__PURE__ */ r(Kr, { sx: { fontSize: 12 } })
1413
1416
  ] }) }, s)) }) }),
1414
- /* @__PURE__ */ r(Je, { children: U(Object.values(b), "index").map(({ data: s }) => /* @__PURE__ */ r(se, { children: x.map(({ locale: u }) => {
1415
- var d, k, o, h, m, y, I, a, S, C, z, E, T, B, K, F, Q, X, Z, ee, Ce, Ne, je, ze, Re, Ve;
1416
- return /* @__PURE__ */ r(ce, { children: /* @__PURE__ */ r(j, { gap: 1, children: e === "properties" ? /* @__PURE__ */ O(q, { children: [
1417
+ /* @__PURE__ */ r(Je, { children: U(Object.values(b), "index").map(({ data: s }) => /* @__PURE__ */ r(ce, { children: x.map(({ locale: u }) => {
1418
+ var d, k, o, h, m, y, I, a, S, C, z, E, T, B, K, M, Q, X, Z, ee, Ce, Ne, je, ze, Re, Ve;
1419
+ return /* @__PURE__ */ r(de, { children: /* @__PURE__ */ r(j, { gap: 1, children: e === "properties" ? /* @__PURE__ */ O(q, { children: [
1417
1420
  /* @__PURE__ */ r(R, {
1418
1421
  size: "small",
1419
1422
  label: "Key",
@@ -1430,8 +1433,8 @@ function cr({ type: e = "properties", component: t, ...i }) {
1430
1433
  value: (((k = (d = s.locales) == null ? void 0 : d[u]) == null ? void 0 : k.name) ?? ((h = (o = s.locales) == null ? void 0 : o[p]) == null ? void 0 : h.name)) || "",
1431
1434
  onChange: ($) => {
1432
1435
  P.transact(() => {
1433
- var M;
1434
- s.locales ?? (s.locales = {}), (M = s.locales)[u] ?? (M[u] = {}), s.locales[u].name = $.target.value;
1436
+ var F;
1437
+ s.locales ?? (s.locales = {}), (F = s.locales)[u] ?? (F[u] = {}), s.locales[u].name = $.target.value;
1435
1438
  });
1436
1439
  }
1437
1440
  }),
@@ -1443,12 +1446,12 @@ function cr({ type: e = "properties", component: t, ...i }) {
1443
1446
  size: "small",
1444
1447
  fullWidth: !0,
1445
1448
  label: "Default Value",
1446
- valueImmutable: de((y = (m = s.locales) == null ? void 0 : m[u]) == null ? void 0 : y.defaultValue),
1449
+ valueImmutable: ue((y = (m = s.locales) == null ? void 0 : m[u]) == null ? void 0 : y.defaultValue),
1447
1450
  value: ((a = (I = s.locales) == null ? void 0 : I[u]) == null ? void 0 : a.defaultValue) ?? ((C = (S = s.locales) == null ? void 0 : S[p]) == null ? void 0 : C.defaultValue),
1448
1451
  onChange: ($) => {
1449
1452
  P.transact(() => {
1450
- var M;
1451
- s.locales ?? (s.locales = {}), (M = s.locales)[u] ?? (M[u] = {}), s.locales[u].defaultValue = $;
1453
+ var F;
1454
+ s.locales ?? (s.locales = {}), (F = s.locales)[u] ?? (F[u] = {}), s.locales[u].defaultValue = $;
1452
1455
  });
1453
1456
  }
1454
1457
  }) })
@@ -1459,12 +1462,12 @@ function cr({ type: e = "properties", component: t, ...i }) {
1459
1462
  property: s,
1460
1463
  size: "small",
1461
1464
  fullWidth: !0,
1462
- valueImmutable: de((B = (T = (E = (z = g.renderer.properties) == null ? void 0 : z[s.id]) == null ? void 0 : E.locales) == null ? void 0 : T[u]) == null ? void 0 : B.value),
1463
- value: ((X = (Q = (F = (K = g.renderer.properties) == null ? void 0 : K[s.id]) == null ? void 0 : F.locales) == null ? void 0 : Q[u]) == null ? void 0 : X.value) ?? ((Ne = (Ce = (ee = (Z = g.renderer.properties) == null ? void 0 : Z[s.id]) == null ? void 0 : ee.locales) == null ? void 0 : Ce[p]) == null ? void 0 : Ne.value) ?? ((ze = (je = s.locales) == null ? void 0 : je[u]) == null ? void 0 : ze.defaultValue) ?? ((Ve = (Re = s.locales) == null ? void 0 : Re[p]) == null ? void 0 : Ve.defaultValue),
1465
+ valueImmutable: ue((B = (T = (E = (z = g.renderer.properties) == null ? void 0 : z[s.id]) == null ? void 0 : E.locales) == null ? void 0 : T[u]) == null ? void 0 : B.value),
1466
+ value: ((X = (Q = (M = (K = g.renderer.properties) == null ? void 0 : K[s.id]) == null ? void 0 : M.locales) == null ? void 0 : Q[u]) == null ? void 0 : X.value) ?? ((Ne = (Ce = (ee = (Z = g.renderer.properties) == null ? void 0 : Z[s.id]) == null ? void 0 : ee.locales) == null ? void 0 : Ce[p]) == null ? void 0 : Ne.value) ?? ((ze = (je = s.locales) == null ? void 0 : je[u]) == null ? void 0 : ze.defaultValue) ?? ((Ve = (Re = s.locales) == null ? void 0 : Re[p]) == null ? void 0 : Ve.defaultValue),
1464
1467
  onChange: ($) => {
1465
1468
  P.transact(() => {
1466
- var M, Ee, Te, Ae, De;
1467
- (M = g.renderer).properties ?? (M.properties = {}), (Ee = g.renderer.properties)[Te = s.id] ?? (Ee[Te] = {}), (Ae = g.renderer.properties[s.id]).locales ?? (Ae.locales = {}), (De = g.renderer.properties[s.id].locales)[u] ?? (De[u] = {}), g.renderer.properties[s.id].locales[u].value = $;
1469
+ var F, Ee, Te, Ae, De;
1470
+ (F = g.renderer).properties ?? (F.properties = {}), (Ee = g.renderer.properties)[Te = s.id] ?? (Ee[Te] = {}), (Ae = g.renderer.properties[s.id]).locales ?? (Ae.locales = {}), (De = g.renderer.properties[s.id].locales)[u] ?? (De[u] = {}), g.renderer.properties[s.id].locales[u].value = $;
1468
1471
  });
1469
1472
  }
1470
1473
  }) }) : null }, s.id) }, u);
@@ -1566,7 +1569,7 @@ function kt({ property: e, onChange: t, defaultLocale: i, allComponents: n }) {
1566
1569
  }) })
1567
1570
  }, b.id);
1568
1571
  }
1569
- }) : /* @__PURE__ */ r(ae, { style: { fontSize: 12, height: 100 }, children: f("maker.properties.noSubProperties") }),
1572
+ }) : /* @__PURE__ */ r(pe, { style: { fontSize: 12, height: 100 }, children: f("maker.properties.noSubProperties") }),
1570
1573
  /* @__PURE__ */ r(A, {
1571
1574
  fullWidth: !0,
1572
1575
  variant: "outlined",
@@ -1727,25 +1730,33 @@ function L({ component: e, property: t, value: i, onChange: n, valueImmutable: f
1727
1730
  sx: {
1728
1731
  pr: 0
1729
1732
  },
1730
- endAdornment: /* @__PURE__ */ O(pe, { position: "end", children: [
1731
- /* @__PURE__ */ r(Qe, {
1732
- onChange: async ({ response: m }) => {
1733
- var S, C, z;
1734
- const y = ((S = m == null ? void 0 : m.data) == null ? void 0 : S.url) || ((C = m == null ? void 0 : m.data) == null ? void 0 : C.fileUrl);
1735
- let I;
1736
- y && (I = await Cr(y).catch(() => Nr(y)).catch(() => {
1737
- }));
1738
- let a = ((z = m == null ? void 0 : m.data) == null ? void 0 : z.filename) || "";
1739
- a && (a = `mediakit://${a}`), n == null || n({
1740
- url: y,
1741
- mediaKitUrl: a,
1742
- width: I == null ? void 0 : I.naturalWidth,
1743
- height: I == null ? void 0 : I.naturalHeight
1744
- });
1745
- }
1746
- }),
1747
- /* @__PURE__ */ r(Y, { title: "If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.", children: /* @__PURE__ */ r(rr, { sx: { cursor: "default", mr: 1 }, fontSize: "small" }) })
1748
- ] })
1733
+ endAdornment: /* @__PURE__ */ O(ne, {
1734
+ position: "end",
1735
+ sx: {
1736
+ display: "flex",
1737
+ alignItems: "center",
1738
+ justifyContent: "center"
1739
+ },
1740
+ children: [
1741
+ /* @__PURE__ */ r(Qe, {
1742
+ onChange: async ({ response: m }) => {
1743
+ var S, C, z;
1744
+ const y = ((S = m == null ? void 0 : m.data) == null ? void 0 : S.url) || ((C = m == null ? void 0 : m.data) == null ? void 0 : C.fileUrl);
1745
+ let I;
1746
+ y && (I = await Cr(y).catch(() => Nr(y)).catch(() => {
1747
+ }));
1748
+ let a = ((z = m == null ? void 0 : m.data) == null ? void 0 : z.filename) || "";
1749
+ a && (a = `mediakit://${a}`), n == null || n({
1750
+ url: y,
1751
+ mediaKitUrl: a,
1752
+ width: I == null ? void 0 : I.naturalWidth,
1753
+ height: I == null ? void 0 : I.naturalHeight
1754
+ });
1755
+ }
1756
+ }),
1757
+ /* @__PURE__ */ r(Y, { title: "If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.", children: /* @__PURE__ */ r(rr, { sx: { cursor: "default", mr: 1 }, fontSize: "small" }) })
1758
+ ]
1759
+ })
1749
1760
  } : void 0
1750
1761
  });
1751
1762
  }
@@ -1785,7 +1796,7 @@ export default function () {
1785
1796
  }`, It = `console.log('hello')
1786
1797
  `;
1787
1798
  function Ot({ value: e }) {
1788
- const { locale: t } = V(), i = Ye(), n = ne(e).doc;
1799
+ const { locale: t } = V(), i = Ye(), n = le(e).doc;
1789
1800
  return _(() => {
1790
1801
  var f;
1791
1802
  (f = e.renderer) != null && f.script || (n.transact(() => {
@@ -1805,7 +1816,7 @@ function Ot({ value: e }) {
1805
1816
  }
1806
1817
  function Ct({ value: e }) {
1807
1818
  var g, v, l;
1808
- const { t } = V(), i = ne(e).doc, { state: { components: n, config: { defaultLocale: f }, resources: x }, localState: { currentLocale: p } } = ue(), w = Pe(), P = ((g = n[e.renderer.componentId]) == null ? void 0 : g.data) ?? ((l = (v = x.components) == null ? void 0 : v[e.renderer.componentId]) == null ? void 0 : l.component), b = Se({ variant: "dialog" });
1819
+ const { t } = V(), i = le(e).doc, { state: { components: n, config: { defaultLocale: f }, resources: x }, localState: { currentLocale: p } } = ae(), w = Pe(), P = ((g = n[e.renderer.componentId]) == null ? void 0 : g.data) ?? ((l = (v = x.components) == null ? void 0 : v[e.renderer.componentId]) == null ? void 0 : l.component), b = Se({ variant: "dialog" });
1809
1820
  return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 1, children: [
1810
1821
  /* @__PURE__ */ r(Oe, {
1811
1822
  allComponents: w,
@@ -1827,12 +1838,12 @@ function Ct({ value: e }) {
1827
1838
  property: c,
1828
1839
  fullWidth: !0,
1829
1840
  size: "small",
1830
- valueImmutable: de((k = (d = (u = (s = e.renderer.properties) == null ? void 0 : s[c.id]) == null ? void 0 : u.locales) == null ? void 0 : d[p]) == null ? void 0 : k.value),
1841
+ valueImmutable: ue((k = (d = (u = (s = e.renderer.properties) == null ? void 0 : s[c.id]) == null ? void 0 : u.locales) == null ? void 0 : d[p]) == null ? void 0 : k.value),
1831
1842
  value: ((y = (m = (h = (o = e.renderer.properties) == null ? void 0 : o[c.id]) == null ? void 0 : h.locales) == null ? void 0 : m[p]) == null ? void 0 : y.value) ?? ((C = (S = (a = (I = e.renderer.properties) == null ? void 0 : I[c.id]) == null ? void 0 : a.locales) == null ? void 0 : S[f]) == null ? void 0 : C.value) ?? ((E = (z = c.locales) == null ? void 0 : z[p]) == null ? void 0 : E.defaultValue) ?? ((B = (T = c.locales) == null ? void 0 : T[f]) == null ? void 0 : B.defaultValue),
1832
1843
  onChange: (K) => {
1833
1844
  i.transact(() => {
1834
- var F, Q, X, Z, ee;
1835
- (F = e.renderer).properties ?? (F.properties = {}), (Q = e.renderer.properties)[X = c.id] ?? (Q[X] = {}), (Z = e.renderer.properties[c.id]).locales ?? (Z.locales = {}), (ee = e.renderer.properties[c.id].locales)[p] ?? (ee[p] = {}), e.renderer.properties[c.id].locales[p].value = K;
1845
+ var M, Q, X, Z, ee;
1846
+ (M = e.renderer).properties ?? (M.properties = {}), (Q = e.renderer.properties)[X = c.id] ?? (Q[X] = {}), (Z = e.renderer.properties[c.id]).locales ?? (Z.locales = {}), (ee = e.renderer.properties[c.id].locales)[p] ?? (ee[p] = {}), e.renderer.properties[c.id].locales[p].value = K;
1836
1847
  });
1837
1848
  }
1838
1849
  }) }, c.id);
@@ -1901,7 +1912,7 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: n,
1901
1912
  }, [JSON.stringify(P)]), s = l(), u = Lr(s, "key");
1902
1913
  return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 2, children: [
1903
1914
  /* @__PURE__ */ r(W, { variant: "subtitle1", children: w("maker.properties.parameters") }),
1904
- !e || c.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ r(ae, { style: { fontSize: 12 }, children: w("maker.properties.noParameters") }) : /* @__PURE__ */ O(q, { children: [
1915
+ !e || c.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ r(pe, { style: { fontSize: 12 }, children: w("maker.properties.noParameters") }) : /* @__PURE__ */ O(q, { children: [
1905
1916
  /* @__PURE__ */ r(j, { gap: 2, children: c.visibleProperties.map(({ data: d }) => {
1906
1917
  var k, o;
1907
1918
  return /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(L, {
@@ -1911,7 +1922,7 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: n,
1911
1922
  fullWidth: !0,
1912
1923
  component: e,
1913
1924
  property: d,
1914
- valueImmutable: de((k = n == null ? void 0 : n[d.id]) == null ? void 0 : k.value),
1925
+ valueImmutable: ue((k = n == null ? void 0 : n[d.id]) == null ? void 0 : k.value),
1915
1926
  value: (p == null ? void 0 : p[d.key || d.id]) ?? ((o = s[d.id]) == null ? void 0 : o.value),
1916
1927
  onChange: (h) => {
1917
1928
  x({
@@ -1974,7 +1985,7 @@ function Nt({ config: e }) {
1974
1985
  e.llmConfig = p;
1975
1986
  };
1976
1987
  return /* @__PURE__ */ O(q, { children: [
1977
- /* @__PURE__ */ r(Y, { title: t("maker.properties.configDetailedDescription"), children: /* @__PURE__ */ r(ie, { size: "small", color: "primary", onClick: () => f(!0), children: /* @__PURE__ */ r(Br, { fontSize: "small" }) }) }),
1988
+ /* @__PURE__ */ r(Y, { title: t("maker.properties.configLLMDescription"), children: /* @__PURE__ */ r(ie, { color: "primary", onClick: () => f(!0), size: "small", children: /* @__PURE__ */ r(Br, {}) }) }),
1978
1989
  n && /* @__PURE__ */ r(mt, {
1979
1990
  open: n,
1980
1991
  onClose: () => f(!1),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/pages-kit-inner-components",
3
- "version": "0.5.43",
3
+ "version": "0.5.45",
4
4
  "description": "Pages Kit inner components library",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -204,8 +204,8 @@
204
204
  "yaml": "^2.5.0",
205
205
  "yjs": "^13.6.18",
206
206
  "zustand": "^4.5.5",
207
- "@blocklet/pages-kit": "^0.5.43",
208
- "@blocklet/pages-kit-block-studio": "^0.5.43"
207
+ "@blocklet/pages-kit": "^0.5.45",
208
+ "@blocklet/pages-kit-block-studio": "^0.5.45"
209
209
  },
210
210
  "devDependencies": {
211
211
  "@trivago/prettier-plugin-sort-imports": "^5.2.1",