@blocklet/pages-kit-inner-components 0.6.84 → 0.6.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/chunks/site-state-2LMcqIzO.js +1 -0
- package/lib/cjs/locales.js +2 -2
- package/lib/cjs/resources.js +1 -1
- package/lib/cjs/site-state.js +1 -1
- package/lib/es/chunks/site-state-B0mj1K8f.js +1635 -0
- package/lib/es/locales.js +2 -0
- package/lib/es/resources.js +1 -1
- package/lib/es/site-state.js +1 -1
- package/package.json +3 -3
- package/lib/cjs/chunks/site-state-CtiXHtSX.js +0 -1
- package/lib/es/chunks/site-state-D4wvb7PN.js +0 -1572
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const f=require("./components-DLLpFRy5.js"),q=require("@syncedstore/core"),Qe=require("yjs"),Ze=require("@blocklet/pages-kit/utils/data-source"),Q=require("@blocklet/pages-kit/utils/route"),et=require("lodash/cloneDeep"),tt=require("@blocklet/sdk/lib/config"),I=require("fs"),g=require("path"),Re=require("@blocklet/pages-kit/utils/common"),st=require("@blocklet/pages-kit/utils/page-model"),at=require("@blocklet/pages-kit/utils/property"),Ee=require("@blocklet/sdk/lib/component"),nt=require("@reactivedata/reactive"),Z=require("glob"),ot=require("lib0/decoding"),rt=require("lib0/encoding"),it=require("lodash/debounce"),ct=require("lodash/get"),lt=require("lodash/isEmpty"),ut=require("lodash/set"),pt=require("lodash/union"),be=require("lru-cache"),dt=require("p-limit"),T=require("sequelize"),ft=require("stream/promises"),gt=require("tar"),F=require("ufo"),mt=require("wait-on"),z=require("y-protocols/awareness"),ue=require("y-protocols/sync"),ht=require("yaml"),ve=require("./html-xfTPTsl5.js");require("sqlite3");require("@blocklet/pages-kit/types/state");const $=t=>t&&t.__esModule?t:{default:t};function ne(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const U=ne(Qe),we=$(et),w=$(tt),pe=ne(ot),v=ne(rt),Me=$(it),Pe=$(ct),Ae=$(lt),ke=$(ut),yt=$(pt),St=$(dt),It=$(mt),B=ne(ht),Et=T.DataTypes.sqlite.DATE.parse;T.DataTypes.sqlite.DATE.parse=(t,e)=>typeof t=="number"?new Date(t):Et(t,e);const M=new T.Sequelize({dialect:"sqlite",storage:f.databaseUrl,benchmark:process.env.ENABLE_SEQUELIZE_BENCHMARK==="true",retry:{match:[/SQLITE_BUSY/],name:"query",max:10},logging:process.env.ENABLE_SEQUELIZE_LOGGING==="true"?console.log:!1});M.query("pragma journal_mode = WAL;");M.query("pragma synchronous = normal;");M.query("pragma journal_size_limit = 33554432;");M.query("pragma cache_size = -2000;");M.query("pragma mmap_size = 33554432;");process.on("SIGINT",async()=>{await M.close(),process.exit(0)});process.on("SIGTERM",async()=>{await M.close(),process.exit(0)});async function bt(t,e){try{if(t.getDialect()!=="sqlite")return;const[s]=await t.query("SELECT 1");if(!s||s.length===0)return;await t.query("PRAGMA shrink_memory;")}catch(s){if(s.name==="SequelizeConnectionError"||s?.message&&/closed!/.test(s.message))return;console.error("Failed to cleanup SQLite memory",e,s)}}let ge=null;ge&&clearInterval(ge);ge=setInterval(async()=>{f.logger.info("Start cleanupSqliteMemory"),await bt(M,f.databaseUrl),f.logger.info("End cleanupSqliteMemory")},60*1e3*10);const wt="z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o",me="page",he="trigger-reload-project-resource",je=wt,Pt="z2qa7BQdkEb3TwYyEYC1psK6uvmGnHSUHt5RM",At="z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o";class Oe extends T.Model{}Oe.init({id:{type:T.DataTypes.UUID,allowNull:!1,primaryKey:!0,defaultValue:T.DataTypes.UUIDV4},projectId:{type:T.DataTypes.UUID,allowNull:!1},componentId:{type:T.DataTypes.STRING,allowNull:!1}},{sequelize:M,tableName:"ProjectComponents",timestamps:!1});const jt="SLUG_INVALID",Y=t=>({error:"slugInvalid",code:jt,field:"slug",message:t}),Ot={error:"slugRequired",code:"SLUG_REQUIRED",field:"slug",message:()=>"Project slug is required"},Tt={error:"slugAlreadyExists",code:"SLUG_EXISTS",field:"slug",message:t=>`Project slug "${t}" already exists`},Ct=[/\.\./,/<[^>]*>/,/%[0-9a-f]{2}/i,/[<>'"%;{}()\\]/,/\x00/,/\n|\r|\t|\v|\f/,/[^a-zA-Z0-9-_@/\\:]/],Le=t=>{if(!t)return"";if(t==="/")return"/";const e=F.withoutTrailingSlash(t);return F.withLeadingSlash(e)||"/"},Dt=t=>t.did===At;class L extends T.Model{static async getProjectByIdOrSlug(e){return L.findOne({where:{[T.Op.or]:[{id:e},{slug:e}]}})}static async validateProjectSlug({slug:e,projectId:s}){if(e==null)return null;if(e==="")return Ot;const a=Le(e);if(e!=="/"&&e.endsWith("/"))return Y(r=>`Project slug "${r}" cannot end with /`);if(/\/{2,}/.test(e))return Y(r=>`Project slug "${r}" cannot contain consecutive /`);if(/\s/.test(e))return Y(r=>`Project slug "${r}" cannot contain whitespace`);if(Ct.some(r=>r.test(e)))return Y(r=>`Project slug "${r}" contains invalid characters`);if(w.default.components?.filter(r=>r.mountPoint&&!Dt(r)).some(r=>Le(r.mountPoint)===a))return Y(r=>`Project slug "${r}" conflicts with existing blocklet`);const o=await L.findOne({where:{slug:e}});return o&&o?.id!==s?Tt:null}}L.init({id:{type:T.DataTypes.UUID,defaultValue:T.DataTypes.UUIDV4,primaryKey:!0},name:{type:T.DataTypes.STRING,allowNull:!1},description:T.DataTypes.TEXT,createdAt:T.DataTypes.DATE,updatedAt:T.DataTypes.DATE,createdBy:{type:T.DataTypes.STRING,allowNull:!1},updatedBy:{type:T.DataTypes.STRING,allowNull:!1},slug:T.DataTypes.STRING,icon:T.DataTypes.STRING,pinnedAt:T.DataTypes.DATE,useAllResources:T.DataTypes.BOOLEAN,npmSecret:T.DataTypes.STRING,relatedBlocklets:{type:T.DataTypes.JSON,allowNull:!1,defaultValue:{},get(){const t=this.getDataValue("relatedBlocklets");if(typeof t=="object")return t??{};try{return t?JSON.parse(t):{}}catch(e){return f.logger.error("Failed to parse relatedBlocklets",{error:e,rawValue:t}),{}}},set(t){try{this.setDataValue("relatedBlocklets",t?JSON.stringify(t):"{}")}catch(e){f.logger.error("Failed to set relatedBlocklets",{error:e,value:t}),this.setDataValue("relatedBlocklets","{}")}}},productionState:{type:T.DataTypes.JSON,allowNull:!1,defaultValue:{},get(){const t=this.getDataValue("productionState");if(typeof t=="object")return t??{};try{return t?JSON.parse(t):{}}catch(e){return f.logger.error("Failed to parse productionState",{error:e,rawValue:t}),{}}},set(t){try{this.setDataValue("productionState",t?JSON.stringify(t):"{}")}catch(e){f.logger.error("Failed to set productionState",{error:e,value:t}),this.setDataValue("productionState","{}")}}}},{sequelize:M,paranoid:!0});L.hasMany(Oe,{foreignKey:"projectId",as:"components"});function ee(t){t.observeDeep(e=>{e.some(s=>s.changes.keys.has("updatedAt")||s.changes.keys.has("publishedAt"))||t.set("updatedAt",new Date().toISOString())})}function $e(){return I.mkdtempSync(g.join(w.default.env.dataDir,"tmp-"))}function te(t,e,s=[]){return Array.isArray(t)?t.flatMap((a,n)=>te(a,e,[...s,n])):typeof t=="object"?t===null?[]:Object.entries(t).flatMap(([a,n])=>te(n,e,[...s,a])):e(t)?[s]:[]}function k(t){return t.filter(e=>e!=null)}function Rt(t){t.pages&&Object.keys(t.pages).forEach(s=>{const a=q.getYjsValue(t.pages[s]);a&&a instanceof U.Map&&ee(a)});const e=q.getYjsValue(t.pages);e&&e instanceof U.Map&&e.observe(s=>{s.changes.keys.forEach((a,n)=>{if(a.action==="add"){const o=q.getYjsValue(t.pages[n]);o&&o instanceof U.Map&&ee(o)}})})}function vt(t){t.routes&&Object.keys(t.routes).forEach(s=>{const a=q.getYjsValue(t.routes?.[s]);a&&a instanceof U.Map&&ee(a)});const e=q.getYjsValue(t.routes);e&&e instanceof U.Map&&e.observe(s=>{s.changes.keys.forEach((a,n)=>{if(a.action==="add"){const o=q.getYjsValue(t.routes?.[n]);o&&o instanceof U.Map&&ee(o)}})})}function kt(t,e){for(const s of e||Object.keys(t.routes||{})){let a=s,n=[];if(s.includes("-")){const[o,...r]=s.split("-");a=o,n=r||[]}if(t.routes?.[a]!==void 0){t.routes[a].publishedAt=new Date().toISOString();const o=t.routes[a];if(!o||!o.params||o.params.length===0)continue;if(s.includes("-")&&n.length>0){const r=Q.getRouteMetaDataByOptionIds(n,o);r&&(r.publishedAt=new Date().toISOString())}if(!e){const r=Q.generateParamCombinations({basePath:o.path,params:o.params,routeId:o.id,paramsOptions:o.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});for(const l of r)l.routeMetaData??={},l.routeMetaData.publishedAt=new Date().toISOString()}}}}function de({page:t,route:e,state:s,routeId:a,routePathInfo:n}){f.logger.info(`Executing datasource data assembly, routeId: ${a}, routePathInfo: ${JSON.stringify(n)}`);const o={...we.default(t),id:a,slug:n?.path??e.path,createdAt:e.createdAt,updatedAt:n?.routeMetaData?.updatedAt??e.updatedAt,publishedAt:n?.routeMetaData?.publishedAt??e.publishedAt,isPublic:(n?.routeMetaData?.isPublic??e.isPublic)&&e.isPublic};for(const r of s.supportedLocales){if(e.dataSource){let l=e.id;n&&(l=n.paramOptionIds.join("-"));const u=e.dataSource.pathDataMappings?.[l]?.dataCache?.[r.locale]??e.dataSource.pathDataMappings?.[l]?.dataCache?.[s.config.defaultLocale||"en"];if(!u)continue;Ze.setPageDataSource(o,s,r.locale,u)}n&&n.routeMetaData&&(n.routeMetaData.publishedAt=new Date().toISOString())}return o}["true","1","yes","y"].includes(process.env.USE_FS_CACHE_HTML??"");const Lt=60*60*1e3,H=new be.LRUCache({max:100,ttl:Lt,ttlResolution:10*1e3,allowStale:!0});function _t(t,e=[]){let s=0;const a=Array.from(H.keys()),n=t.map(o=>F.withoutTrailingSlash(o));for(const o of a)for(const r of n){if(ve.matchCacheKey(o,{currentPath:r})){H.delete(o),s++,f.logger.info(`[Cache CLEAR] key: ${o}`);break}for(const l of e)if(ve.matchCacheKey(o,{currentPath:`/${l}${r}`})){H.delete(o),s++,f.logger.info(`[Cache CLEAR] key: ${o}`);break}}return f.logger.info(`[Cache CLEAR] cleared ${s} entries for paths:`,n),s}function Ut(){const t=H.size;return H.clear(),f.logger.info(`[Cache CLEAR ALL] cleared ${t} entries`),t}w.default.events.on(w.default.Events.envUpdate,Ut);const{uploadToMediaKit:Mt}=require("@blocklet/uploader-server"),Te=/^\w+(\w|-|\.)+\w+\.(jpe?g|png|gif|svg|bmp|webp|mp4|m4v|webm)$/,K=/mediakit:\/\/([a-f0-9]{32}\.(jpe?g|png|gif|svg|bmp|webp|mp4|m4v|webm))/i,_e=/mediakit:\/\/([a-f0-9]{32}\.(jpe?g|png|gif|svg|bmp|webp|mp4|m4v|webm))/gi,$t=1e4,Nt=3e4,W=0,fe=1,Ft=0,qt=1,ye=w.default,x=g.join(process.env.BLOCKLET_DATA_DIR,"site-state"),xt=["production","draft"],Bt=["production"];function se(t){return t?.replace(/\//g,"|")||""}function Ne(){const t=ye.env.languages?.map(s=>({locale:s.code,name:s.name}))||[],e=t[0]?.locale||"en";return{pageIds:[],pages:{},routeIds:[],routes:{},dataSourceIds:[],dataSources:{},components:{},supportedLocales:t,config:{defaultLocale:e},resources:{}}}class O extends U.Doc{constructor(e){super(),this.options=e,I.existsSync(this.draftYjsFilePath)&&U.applyUpdate(this,I.readFileSync(this.draftYjsFilePath)),this.syncedStore=nt.reactive(q.syncedStore({pages:{},pageIds:[],components:{},supportedLocales:[],config:{},resources:{},routeIds:[],routes:{},dataSourceIds:[],dataSources:{}},this)),this.initObserver(),this.on("update",this.updateHandler),this.awareness=new z.Awareness(this),this.awareness.on("update",this.awarenessChangeHandler),this.ensureDataStructure()}static RELEASE_DELAY=5*60*1e3;static PERIODIC_CHECK_INTERVAL=2*60*60*1e3;static sharedInstances={};static pageUrlMapCache=new be.LRUCache({max:100,ttl:1e3*60*60*24});static periodicCheckTimer;static safeDeleteProjectStateDir(e){if(!e)throw new Error("Should provide project context");try{const s=g.join(x,e),a=g.join(x,`@del-${e}`);I.renameSync(s,a)}catch(s){f.logger.error("Failed to safe delete project state dir:",s)}}static async getProjectIds(){return(await L.findAll({attributes:["id"],raw:!0}))?.map(e=>e.id)}static get projectIds(){return Z.globSync("*/",{cwd:x,ignore:["@del-*","@tmp-*",".*","staging","production","@backup-*","undefined"]})}static get allShared(){return this.projectIds.map(e=>O.shared(e))}static shared(e){if(!e)throw new Error("Should provide project context");let s=O.sharedInstances[e];return s||(s=new O({path:g.join(x,e)}),O.sharedInstances[e]=s,s)}static async getProductionState(e){const s=await L.findByPk(e,{attributes:["productionState"]});if(Ae.default(s?.productionState)){const a=g.join(x,e,"production"),n=await Ce(a,{includeResources:!0})??Ne();if(!n?.config?.defaultLocale){n.config??={};const o=ye.env.languages?.map(r=>({locale:r.code,name:r.name}))||[];n.config.defaultLocale=o[0]?.locale}return n}return s?.productionState}destroy(){this.cancelRelease(),this.save({flush:!0}),this.conns.forEach((s,a)=>this.closeConn(a)),this.awareness.destroy();const e=g.basename(this.options.path);delete O.sharedInstances[e],super.destroy()}initObserver(){Rt(this.syncedStore),vt(this.syncedStore)}get draftYjsFilePath(){return g.join(this.options.path,"draft.yjs")}static async getStateByProjectId(e,s){if(s==="draft"){const a=O.shared(e);return JSON.parse(JSON.stringify(a.syncedStore))}return O.getProductionState(e)}async getState(e){if(e==="draft")return JSON.parse(JSON.stringify(this.syncedStore));const s=g.basename(this.options.path);return O.getProductionState(s)}async setState(e,s){const a=await Be(s,{exportAssets:!1,includeResources:!0}),n=this.getPublishDir(e);if(I.mkdirSync(g.dirname(n),{recursive:!0}),I.rmSync(n,{force:!0,recursive:!0}),I.renameSync(a,n),e==="production"){const o=g.basename(this.options.path);O.pageUrlMapCache.delete(o);const r=we.default(s);await L.update({productionState:r},{where:{id:o}})}}getPublishDir(e){return g.join(this.options.path,e)}syncedStore;conns=new Map;awareness;releaseTimer;awarenessChangeHandler=({added:e,updated:s,removed:a},n)=>{const o=e.concat(s,a);if(n!==null){const u=this.conns.get(n);u&&(e.forEach(S=>{u.add(S)}),a.forEach(S=>{u.delete(S)}))}const r=v.createEncoder();v.writeVarUint(r,fe),v.writeVarUint8Array(r,z.encodeAwarenessUpdate(this.awareness,o));const l=v.toUint8Array(r);this.conns.forEach((u,S)=>this.send(S,l))};updateHandler=e=>{const s=v.createEncoder();v.writeVarUint(s,W),ue.writeUpdate(s,e);const a=v.toUint8Array(s);this.conns.forEach((n,o)=>this.send(o,a))};ensureDataStructure=()=>{const{supportedLocales:e,pages:s,pageIds:a,config:n,routes:o,routeIds:r}=this.syncedStore;{const l=new Set(Object.keys(s));let u=0;for(;u<a.length;){const S=a[u];l.has(S)?(l.delete(S),u++):a.splice(u,1)}}{const l=new Set(Object.keys(o));let u=0;for(;u<r.length;){const S=r[u];l.has(S)?(l.delete(S),u++):r.splice(u,1)}}e.splice(0,e.length),e.push(...ye.env.languages.map(l=>({locale:l.code,name:l.name}))),n.defaultLocale=e[0]?.locale;{let l=0;const u=new Set;for(;l<e.length;){const{locale:S}=e[l];u.has(S)?e.splice(l,1):(l++,u.add(S))}}};send=(e,s)=>{e.readyState!==Ft&&e.readyState!==qt&&this.closeConn(e);try{e.send(s,a=>{a&&this.closeConn(e)})}catch{this.closeConn(e)}};closeConn=e=>{if(e.removeAllListeners(),this.conns.has(e)){const s=this.conns.get(e);this.conns.delete(e),s&&z.removeAwarenessStates(this.awareness,Array.from(s),null)}e.close(),this.checkAndScheduleRelease()};checkAndScheduleRelease(){this.conns.size===0&&this.scheduleRelease()}scheduleRelease(){this.cancelRelease();const e=g.basename(this.options.path);this.releaseTimer=setTimeout(()=>{f.logger.info(`[SiteState] releasing instance due to no active connections: ${e}`),this.conns.size===0&&(this.releaseTimer=void 0,this.destroy())},O.RELEASE_DELAY),f.logger.info(`[SiteState] scheduled release for project ${e} in ${O.RELEASE_DELAY/1e3}s`)}cancelRelease(){if(this.releaseTimer){clearTimeout(this.releaseTimer),this.releaseTimer=void 0;const e=g.basename(this.options.path);f.logger.info(`[SiteState] cancelled scheduled release for project ${e}`)}}autoSave=Me.default(()=>{I.mkdirSync(g.dirname(this.draftYjsFilePath),{recursive:!0}),I.writeFileSync(this.draftYjsFilePath,U.encodeStateAsUpdate(this))},$t);save=({flush:e=!1}={})=>{this.autoSave(),e&&this.autoSave.flush()};publish=async({mode:e,routes:s})=>{const a=g.basename(this.options.path);await We(a);const n=await this.getState("draft"),o=await this.getState("production");await Ie(n,o,{routes:s,mergeMode:"replace",deleteRoutes:!0,publishMode:e}),o.config.publishedAt=new Date().getTime(),kt(this.syncedStore,s),await this.setState(e,o),await this.clearPageCacheForRoutes(s,o)};mergeState=async(e,s)=>{const a=JSON.parse(JSON.stringify(s));e.config.fontFamily??={};const n=a.config?.fontFamily,o=e.config?.fontFamily;e.config.fontFamily.title=n?.title||o?.title,e.config.fontFamily.description=n?.description||o?.description,await new Promise((r,l)=>{this.transact(async()=>{try{const u=await Ie(e,s);r(u)}catch(u){l(u)}})})};clearPageCacheForRoutes=async(e,s)=>{const a=g.basename(this.options.path),o=(await L.findByPk(a))?.slug||a;let r=e;(!r||r.length===0)&&(r=s.pageIds??[]),f.logger.info(`[SiteState] clearing page cache for project ${a}, routes:`,r||[]);const l=s.supportedLocales.map(P=>P.locale),u=[],S=r.filter(P=>s.pageIds?.includes(P));for(const P of S){const b=s.pages[P].slug;o&&o!==a&&(o==="/"?u.push(b):u.push(`/${o}${b}`)),u.push(`/${a}${b}`)}if(u.length>0)try{const P=_t(u,l);f.logger.info(`[SiteState] cleared ${P} page cache entries for project ${a}, routes:`,r)}catch{}};addConnection=e=>{if(this.conns.has(e))return;this.cancelRelease(),e.binaryType="arraybuffer",this.conns.set(e,new Set),e.on("message",n=>this.messageListener(e,new Uint8Array(n)));let s=!0;const a=setInterval(()=>{if(!s)this.conns.has(e)&&this.closeConn(e),clearInterval(a);else if(this.conns.has(e)){s=!1;try{e.ping()}catch{this.closeConn(e),clearInterval(a)}}},Nt);e.on("close",()=>{this.closeConn(e),clearInterval(a)}),e.on("pong",()=>{s=!0});{const n=v.createEncoder();v.writeVarUint(n,W),ue.writeSyncStep1(n,this),this.send(e,v.toUint8Array(n));const o=this.awareness.getStates();if(o.size>0){const r=v.createEncoder();v.writeVarUint(r,fe),v.writeVarUint8Array(r,z.encodeAwarenessUpdate(this.awareness,Array.from(o.keys()))),this.send(e,v.toUint8Array(r))}}};messageListener=(e,s)=>{try{const a=v.createEncoder(),n=pe.createDecoder(s),o=pe.readVarUint(n);switch(o){case W:v.writeVarUint(a,W),ue.readSyncMessage(n,a,this,null),v.length(a)>1&&(this.ensureDataStructure(),this.send(e,v.toUint8Array(a)));break;case fe:{z.applyAwarenessUpdate(this.awareness,pe.readVarUint8Array(n),e);break}default:f.logger.warn(`Unsupported messageType ${o}`)}}catch(a){f.logger.error(a)}this.save()};static async pageUrlMap(e,s){let a=[];s?a=[s]:a=await this.getProjectIds();let n={};if(e==="production"&&a?.length){const o=new Map(a?.map(r=>[r,!0])||[]);for(const r of a){const l=O.pageUrlMapCache.get(r);l&&(n={...n,...l},o.delete(r))}a=Array.from(o.keys())}if(a?.length){const o=await L.findAll({where:{id:{[T.Op.in]:a}}});await Promise.all(o?.map(async r=>{const l=r.id,u=r.slug||l,S={},P=e==="production"&&r?.productionState?r.productionState:await O.getStateByProjectId(r.id,e),R=yt.default(w.default.env.languages?.map(p=>p.code)||[],P.supportedLocales?.map(p=>p.locale)||[]),b=(p,c)=>{u&&(S[F.joinURL("/",u,p)]={...c,shouldRedirect:!0,mainPage:!0}),S[F.joinURL("/",l,p)]={...c,shouldRedirect:!0,mainPage:!0};for(const h of R){const C={...c,locale:h};S[F.joinURL("/",h,l,p)]=C,u&&(S[F.joinURL("/",h,u,p)]=C)}};if(e==="draft")for(const p of P.routeIds||[]){const c=P?.routes?.[p];if(!c)continue;if(c.params&&c.params.length>0){const m=Q.generateParamCombinations({basePath:c.path,params:c.params,routeId:c.id,paramsOptions:c.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]});for(const d of m){const y=d.path,A={projectId:l,projectSlug:u,pageSlug:y,pageId:c.displayTemplateId||"",routeId:p,defaultLocale:R?.[0],locales:R,publishedAt:P.config.publishedAt,isPublic:c.isPublic&&d?.routeMetaData?.isPublic};b(y,A)}}const h=c.path,C={projectId:l,projectSlug:u,pageSlug:h,pageId:c.displayTemplateId||"",routeId:p,defaultLocale:R?.[0],locales:R,publishedAt:P.config.publishedAt,isPublic:c.isPublic};b(h,C)}for(const p of P.pageIds||[]){const c=P.pages[p];if(!c||e==="production"&&!c.isPublic)continue;const h=c.slug,C=r.slug||l,m={projectId:l,projectSlug:C,pageSlug:h,pageId:p,defaultLocale:R?.[0],locales:R,publishedAt:P.config.publishedAt,isPublic:c.isPublic,templateConfig:c.templateConfig};b(h,m)}e==="production"&&O.pageUrlMapCache.set(l,S),n={...n,...S}}))}return n}getDocumentSize(){return U.encodeStateAsUpdate(this).byteLength}static getInstancesSizeInfo(){const e=[];for(const[s,a]of Object.entries(O.sharedInstances)){const n=a.getDocumentSize();e.push({projectId:s,sizeInBytes:n,sizeInMB:`${(n/(1024*1024)).toFixed(2)} MB`,activeConnections:a.conns.size})}return e}static startPeriodicCheck(){this.periodicCheckTimer||(this.periodicCheckTimer=setInterval(()=>{this.performPeriodicCheck()},this.PERIODIC_CHECK_INTERVAL),f.logger.info(`[SiteState] periodic check started, interval: ${this.PERIODIC_CHECK_INTERVAL/(60*60*1e3)} hours`))}static stopPeriodicCheck(){this.periodicCheckTimer&&(clearInterval(this.periodicCheckTimer),this.periodicCheckTimer=void 0,f.logger.info("[SiteState] periodic check stopped"))}static performPeriodicCheck(){const e=Object.keys(O.sharedInstances).length,s=[],a=[];for(const[n,o]of Object.entries(O.sharedInstances))o.conns.size===0?s.push({projectId:n,instance:o}):a.push({projectId:n,connections:o.conns.size});if(f.logger.info(`[SiteState] periodic check summary: total instances: ${e}, with connections: ${a.length}, without connections: ${s.length}`),s.length>0){f.logger.info(`[SiteState] releasing ${s.length} instances without connections:`,s.map(o=>o.projectId));let n=0;for(const{projectId:o,instance:r}of s)try{f.logger.info(`[SiteState] releasing instance due to periodic check: ${o}`),r.destroy(),n++}catch(l){f.logger.error(`[SiteState] failed to release instance ${o} during periodic check:`,l)}f.logger.info(`[SiteState] periodic check completed: ${n}/${s.length} instances released successfully`)}else e>0?f.logger.debug("[SiteState] periodic check: all instances have active connections"):f.logger.debug("[SiteState] periodic check: no instances exist")}}async function Gt(t,e,s){if(!t||!I.existsSync(t)||!I.lstatSync(t).isFile())return null;let a=s[t];return a||(a=(async()=>{try{return(await Mt({filePath:t,fileName:e}))?.data?.filename}catch(n){return f.logger.error(`Failed to upload asset ${t}:`,n),null}})(),s[t]=a),a}const Fe=async(t,e)=>{const s=g.basename(t),a=await Ee.call({name:je,path:F.joinURL("/uploads",s),responseType:"stream",method:"GET"});if(a.status>=200&&a.status<400){const n=I.createWriteStream(e);await ft.pipeline(a.data,n)}else throw new Error(`download asset failed ${a.status}`)},qe=async(t,e)=>{await Promise.all(t.map(async s=>{try{await Fe(s,g.join(e,g.basename(s)))}catch(a){f.logger.error(`Failed to export assets: ${s}, ${a}`)}}))};function xe(t){return Te.test(t)?[t]:K.test(t)?(_e.lastIndex=0,Array.from(t.matchAll(_e)).map(s=>s[1]).filter(s=>!!s)):[]}async function X(t,e,s){const{getFilename:a,exportAssets:n}=s,o=g.join(e,a(t));if(I.mkdirSync(g.dirname(o),{recursive:!0}),I.writeFileSync(o,B.stringify(t)),n){const l=te(t,u=>typeof u=="string"&&(Te.test(u)||K.test(u))).map(u=>{const S=Pe.default(t,u);return xe(S)}).flat().filter(Boolean);await qe(l,g.dirname(o))}}const Se=new be.LRUCache({max:100,ttl:1*60*1e3});async function Ue(t,e,s){const a=te(t,l=>typeof l=="string"&&(Te.test(l)||K.test(l))),n=St.default(2),o=a.map(l=>n(async()=>{try{const u=Pe.default(t,l),S=xe(u);for(const P of S){const R=g.basename(P),b=s.getFilePath(P,l),p=b?`${b}:${R}`:R,c=Se.get(p);if(c){K.test(u)||ke.default(t,l,c);return}const h=await Gt(b,R,e);h&&(K.test(u)||ke.default(t,l,h),Se.set(p,h))}}catch(u){f.logger.error(`Failed to process upload for path ${l.join(".")}:`,u.message||u.reason)}})),r=await Promise.allSettled(o);s.onFinish?.(r)}async function Be(t,{exportAssets:e,pageIds:s="all",componentIds:a="all",rawConfig:n,includeResources:o=!1,routeIds:r="all"}={}){const l=s==="all"?t.pageIds:s,u=at.getComponentDependencies({state:t,pageIds:l,componentIds:a==="all"?Object.keys(t.components):a});Object.entries(t.components).forEach(([i,E])=>{E.data?.renderer?.type==="component-template"&&u.push(i)});const S=r==="all"?t.routeIds:r,P=i=>({id:i.id,name:i.name,isTemplateSection:i.isTemplateSection??!1,templateDescription:i.templateDescription,component:i.component,config:i.config,visibility:i.visibility,sections:i?.sectionIds?k(i?.sectionIds?.map(E=>{const D=i.sections?.[E];return D&&P(D)})):void 0}),R=(i,E)=>({id:i.id,createdAt:i.createdAt,updatedAt:i.updatedAt,publishedAt:i.publishedAt,isPublic:i.isPublic??!0,templateConfig:i.templateConfig,meta:i.locales?.[E]??{},sections:k(i.sectionIds.map(D=>{const N=i.sections[D];return N&&P(N)})),dataSource:Object.fromEntries(Object.entries(i.dataSource||{}).map(([D,N])=>[D,N?.[E]??{}]))}),b=i=>({id:i.id,createdAt:i.createdAt,updatedAt:i.updatedAt,publishedAt:i.publishedAt,path:i.path,handler:i.handler,isPublic:i.isPublic??!0,params:i.params??[],enabledGenerate:i.enabledGenerate??!1,displayTemplateId:i.displayTemplateId,dataSource:i.dataSource}),p=k(S.map(i=>{const E=t.routes[i];return E&&b(E)})),c=k(t.supportedLocales.map(i=>i.locale).flatMap(i=>l.map(E=>{const D=t.pages[E];return D&&{locale:i,slug:D.slug,page:R(D,i)}}))),h=$e(),C=g.join(h,"pages");I.mkdirSync(C,{recursive:!0});const m=g.join(h,"components");I.mkdirSync(m,{recursive:!0});const d=g.join(h,"routes");I.mkdirSync(d,{recursive:!0});for(const{locale:i,slug:E,page:D}of c)await X(D,C,{getFilename:()=>`${se(E)||"index"}.${i}.yml`,exportAssets:e});for(const i of p)await X(i,d,{getFilename:()=>`${se(i.path)||"index"}.yml`,exportAssets:e});for(const i of u){const E=t.components[i]?.data;E&&await X(E,m,{getFilename:D=>`${D.name||"unnamed"}.${D.id}.yml`,exportAssets:e})}const y=g.join(h,".blocklet/pages/pages.config.yml");I.mkdirSync(g.dirname(y),{recursive:!0});const A={pages:k(l.map(i=>{const E=t.pages[i];return E&&{id:i,slug:E.slug}})),routes:k(S.map(i=>{const E=t.routes[i];return E&&{id:i,path:E.path}})),components:k(u.map(i=>{const E=t.components[i]?.data;return E&&{id:i,name:E.name}})),...o?{resources:{components:k(Object.keys(t.resources?.components||{}).filter(i=>u.includes(i)).map(i=>({id:i,name:t.resources?.components?.[i]?.component?.name})))}}:{},supportedLocales:t.supportedLocales,config:t.config};I.writeFileSync(y,B.stringify(A));const j=g.join(h,"config.source.json");if(n&&I.writeFileSync(j,JSON.stringify(n)),o){const i=g.join(h,"resources"),E=g.join(i,"components");I.mkdirSync(E,{recursive:!0});for(const G of Object.keys(t?.resources?.components??{}).filter(_=>u.includes(_))){const _=t.resources?.components?.[G]?.component;_&&await X(_,E,{getFilename:V=>`${V.name||"unnamed"}.${V.id}.yml`,exportAssets:e})}const D=g.join(h,"chunks");I.mkdirSync(D,{recursive:!0});const N=Vt();for(const G of Object.keys(t?.resources?.components??{}).filter(_=>u.includes(_))){const _=t.resources?.components?.[G]?.component;if(_&&_.renderer?.type==="react-component"){const V=_.renderer?.chunks??[];if(V?.length>0)for(const ce of V){const De=g.join(D,ce),le=N?.[ce];try{le&&I.existsSync(le)&&!I.existsSync(De)&&I.copyFileSync(le,De)}catch(Xe){f.logger.error(`copy chunk ${ce} error`,Xe.message)}}}}}return h}async function Ce(t,{importAssets:e,includeResources:s}={}){if(!I.existsSync(t))return null;let a,n=!1;try{I.lstatSync(t).isDirectory()?a=t:/\.(tgz|gz|tar)$/.test(t)&&(n=!0,a=$e(),await gt.x({file:t,C:a}));const o=Z.globSync("**/.blocklet/pages/pages.config.yml",{cwd:a,absolute:!0}).at(0),r=o&&g.join(g.dirname(o),"../../pages"),l=o&&g.join(g.dirname(o),"../../components"),u=o&&g.join(g.dirname(o),"../../routes");if(!o)return null;const S=B.parse(I.readFileSync(o).toString()),P=(m,d,y)=>{let A=g.join(m,`${d}${y?`.${y}`:""}.yml`);return(!I.existsSync(A)||!I.lstatSync(A).isFile())&&(A=g.join(m,d,`index${y?`.${y}`:""}.yml`),!I.existsSync(A)||!I.lstatSync(A))?null:B.parse(I.readFileSync(A).toString())},R=(m,d)=>{try{const y=Z.globSync(`*.${d}.yml`,{cwd:m,absolute:!0})[0];return y?B.parse(I.readFileSync(y).toString()):null}catch(y){f.logger.error("parse component error",y)}return null},b=(m,d)=>{let y=g.join(m,`${d}.yml`);return(!I.existsSync(y)||!I.lstatSync(y).isFile())&&(y=g.join(m,d,"index.yml"),!I.existsSync(y)||!I.lstatSync(y))?null:B.parse(I.readFileSync(y).toString())},p=k(S.pages.map(({slug:m})=>{const d=k(S.supportedLocales.map(({locale:j})=>{const i=r?P(r,se(m),j):void 0;if(i)return{locale:j,page:i};const E=r?P(r,m,j):void 0;return E&&{locale:j,page:E}})),y=d[0]?.page;if(!y)return null;const A=y.sections.map(st.unzipSection);return{id:y.id||Re.nextId(),createdAt:y.createdAt,updatedAt:y.updatedAt,publishedAt:y.publishedAt,isPublic:y.isPublic??!0,templateConfig:y.templateConfig,slug:m,sections:Object.fromEntries(A.map(j=>[j.id,j])),sectionIds:A.map(j=>j.id),locales:Object.fromEntries(d.map(({locale:j,page:i})=>[j,i.meta])),dataSource:y.dataSource?Object.fromEntries([...new Set(d.flatMap(({page:j})=>Object.keys(j.dataSource??{})))].map(j=>[j,Object.fromEntries(d.map(({locale:i,page:E})=>{const D=E.dataSource?.[j];return[i,D||{}]}))])):Object.fromEntries([...new Set(d.flatMap(({page:j})=>j.sections.map(i=>i.id)))].map(j=>[j,Object.fromEntries(d.map(({locale:i,page:E})=>{const D=E.dataSource?.[j];if(D)return[i,D];const N=E.sections.find(G=>G.id===j);return[i,N?.properties||{}]}))]))}})),c=k(S?.routes?.map(({path:m})=>{const d=u?b(u,se(m)):void 0;return{...d,id:d?.id||Re.nextId(),createdAt:d?.createdAt??new Date().toISOString(),updatedAt:d?.updatedAt??new Date().toISOString(),publishedAt:new Date(0).toISOString(),path:d?.path??`/${d?.id}`,params:d?.params,handler:d?.handler??"Pages Kit",isPublic:d?.isPublic??!0,enabledGenerate:d?.enabledGenerate??!1,displayTemplateId:d?.displayTemplateId??void 0,dataSource:d?.dataSource??{}}})??[]),h=l?k(S.components?.map(({id:m})=>R(l,m))??[]):[];if(e){const m=(...d)=>{f.logger.info(`[${n?g.basename(t):g.basename(g.join(t,"../../../../"))}] importAssets:`,...d)};try{m("wait image-bin api ready"),await It.default({resources:[`${Ee.getComponentWebEndpoint(f.IMAGE_BIN_NAME)}/api/sdk/uploads`],validateStatus:A=>A>=200&&A<=500}),m("image-bin api is ready");const d={},y={};m("start to upload assets"),await Promise.allSettled([Ue(h,d,{getFilePath:A=>l&&g.join(l,A),onFinish:A=>{m(`upload ${A.length} component assets`)}}),Ue(p,y,{getFilePath:(A,j)=>{const i=Pe.default(p,j.slice(0,1));return r&&g.join(r,g.dirname(i.slug),A)},onFinish:A=>{m(`upload ${A.length} page assets`)}})]),m("upload assets done"),Se.clear(),global.gc&&global.gc()}catch(d){m("Error during asset import:",d)}}const C={};if(s){const m=o&&g.join(g.dirname(o),"../../resources/components"),d=k(S.resources?.components?.map(({id:y})=>R(m,y))??[]);d.length>0&&(C.components=Object.fromEntries(d.map((y,A)=>[y.id,{index:A,component:y}])))}return{supportedLocales:S.supportedLocales,pageIds:p.map(m=>m.id),components:Object.fromEntries(h.map((m,d)=>[m.id,{index:d,data:m}])),pages:Object.fromEntries(p.map(m=>[m.id,m])),config:S.config||{},resources:C,routeIds:c.map(m=>m.id),routes:Object.fromEntries(c.map(m=>[m.id,m])),dataSourceIds:[],dataSources:{}}}finally{n&&a&&I.rmSync(a,{force:!0,recursive:!0})}}async function Ie(t,e,{routes:s,mergeMode:a="byUpdateTime",deleteRoutes:n=!1,publishMode:o=void 0}={}){try{o&&f.clearPreloadComponentsCacheByMode(o)}catch(b){f.logger.error("clear preload page cache error",{error:b})}const{pages:r,pageIds:l,routeIds:u,routes:S,supportedLocales:P}=t;if(o==="production"){let b=s??[],p=null;for(const c of u??[]){const h=S?.[c];if(h?.params&&h?.params.length>0&&h?.paramsOptions&&h?.paramsOptions.length>0){const C=Q.generateParamCombinations({basePath:h.path,params:h.params,routeId:h.id,paramsOptions:h.paramsOptions,currentIndex:0,currentParams:[],currentOptionIds:[],result:[]}),m=Object.fromEntries(C.map(d=>[`${c}-${d.paramOptionIds.join("-")}`,d]));p={...p||{},...m},s||(b=[...b,...C.map(d=>`${c}-${d.paramOptionIds.join("-")}`)])}else s||b.push(c)}f.logger.info("routeIds to be published: ",b);for(const c of b){let h=c;if(h.includes("-")){const[d]=h.split("-");h=d}const C=S?.[h];if(!C){const d=e.pageIds.indexOf(h);d!==-1&&n&&(e.pageIds.splice(d,1),delete e.pages[h]);for(const y of e.pageIds)y.includes(`${h}-`)&&(e.pageIds.splice(e.pageIds.indexOf(y),1),delete e.pages[y]);f.logger.info("delete main route page",h);continue}if(c.includes("-")&&!p?.[c]){const d=e.pageIds.indexOf(c);d!==-1&&n&&(e.pageIds.splice(d,1),delete e.pages[c]),f.logger.info("delete page",c);continue}if(!C.displayTemplateId){f.logger.info("no display template",c);continue}const m=r[C.displayTemplateId];if(!m){f.logger.info("no template page",c);continue}if(e.pageIds.includes(c)){if(f.logger.info("has need update page",c),a==="replace")e.pages[c]=de({page:m,route:C,state:t,routeId:c,routePathInfo:p?.[c]}),f.logger.info("replace page",c);else if(a==="byUpdateTime"){const d=e.pages[C.id];(!d||C.updatedAt&&C.updatedAt>d.updatedAt)&&(e.pages[c]=de({page:m,route:C,state:t,routeId:c,routePathInfo:p?.[c]}),f.logger.info("replace page by update time",c))}}else e.pageIds.push(c),e.pages[c]=de({page:m,route:C,state:t,routeId:c,routePathInfo:p?.[c]}),f.logger.info("add page",c)}if(n&&!s)for(const c of e.pageIds)b?.includes(c)||(delete e.pages[c],f.logger.info("delete page",c)),e.pageIds=[...e.pageIds].filter(h=>b?.includes(h))}else{for(const b of l){const p=r[b];if(p)if(e.pageIds.includes(p.id)){if(a==="replace")e.pages[p.id]=p;else if(a==="byUpdateTime"){const c=e.pages[p.id];(!c||p.updatedAt&&p.updatedAt>c.updatedAt)&&(e.pages[p.id]=p)}}else e.pageIds.push(p.id),e.pages[p.id]=p}for(const b of u){const p=S[b];if(p)if(e.routeIds.includes(p.id)){if(a==="replace")e.routes[p.id]=p;else if(a==="byUpdateTime"){const c=e.routes[p.id];(!c||p.updatedAt&&p.updatedAt>c.updatedAt)&&(e.routes[p.id]=p)}}else e.routeIds.push(p.id),e.routes[p.id]=p}}if(e.supportedLocales.splice(0,e.supportedLocales.length),e.supportedLocales.push(...we.default(P)),n)for(const b of Object.keys(e.components))delete e.components[b];let R=JSON.parse(JSON.stringify(t.components));R=Object.fromEntries(await Promise.all(Object.entries(R).map(async([b,p])=>{const c=await Ge(p?.data);return[b,{...p,data:c}]}))),Object.assign(e.components,R),Object.assign(e.config,JSON.parse(JSON.stringify(t.config))),Ae.default(t.resources.components)||(e.resources.components=JSON.parse(JSON.stringify(t.resources.components||{})))}const Ge=f.memoizeWithFs(async t=>{if(!Ae.default(t?.properties))return t;if(t?.renderer?.type==="react-component"){const{script:e,PROPERTIES_SCHEMA:s}=t?.renderer||{};if(s||e&&e.includes("PROPERTIES_SCHEMA"))try{const a=await f.getExportSchemaValueFromCode(e??"","PROPERTIES_SCHEMA",t.id,s);a&&a.length>0&&t&&(t.properties={},a.forEach((n,o)=>{t?.properties&&(t.properties[n.id]={index:o,data:n})}))}catch(a){f.logger.error("getPropertiesFromCode error",{componentId:t.id,name:t.name},{error:a})}}return t},{subdir:"getPropertiesFromCode"});let ae,J,oe,re;const Ve=()=>Ee.getResources({types:[{did:je,type:me},{did:Pt,type:me}]}),Vt=()=>{const t=Ve(),e={};return t.forEach(s=>{const a=Z.globSync("**/.blocklet/pages/pages.config.yml",{cwd:s.path,absolute:!0}).at(0),n=a&&g.join(g.dirname(a),"../../chunks");if(n&&I.existsSync(n)){const o=I.readdirSync(n);for(const r of o)e[r]=g.join(n,r)}}),e};function ze(){return ae=(async()=>{const t=Ve();J=(await Promise.all(t.map(async s=>{const a=s.path?await Ce(s.path,{importAssets:!1}):void 0;return a?{blockletId:s.did,state:a,blockletTitle:s.title}:void 0}))).filter(s=>!!s),oe=J.reduce((s,a)=>Object.assign(s,Object.fromEntries(Object.values(a.state.pages).map(n=>n?[n?.id,{page:n,blockletId:a.blockletId}]:[]))),{});const e=J.reduce((s,a)=>Object.assign(s,Object.fromEntries(Object.values(a.state.components).map(n=>[n.data.id,{blockletId:a.blockletId,component:n.data}]))),{});re=Object.fromEntries(await Promise.all(Object.entries(e).map(async([s,a])=>{const n=await Ge(a.component);return[s,{...a,component:n}]})))})(),ae}function Ye(t){const e=Me.default(async()=>{await ze().catch(s=>{f.logger.error("load resource states error",{error:s})}),await t?.({states:J,pages:oe,components:re})},3e3,{leading:!1,trailing:!0});return e(),w.default.events.on(w.default.Events.componentAdded,e),w.default.events.on(w.default.Events.componentRemoved,e),w.default.events.on(w.default.Events.componentStarted,e),w.default.events.on(w.default.Events.componentStopped,e),w.default.events.on(w.default.Events.componentUpdated,e),w.default.events.on(he,e),()=>{w.default.events.off(w.default.Events.componentAdded,e),w.default.events.off(w.default.Events.componentRemoved,e),w.default.events.off(w.default.Events.componentStarted,e),w.default.events.off(w.default.Events.componentStopped,e),w.default.events.off(w.default.Events.componentUpdated,e),w.default.events.off(he,e)}}const He=Symbol.for("GLOBAL_RESOURCE_STATES_LISTENER_KEY"),Ke=Symbol.for("GLOBAL_ENV_UPDATE_LISTENER_KEY"),ie=globalThis;ie[He]?.();ie[He]=Ye(async({pages:t,components:e})=>{const s=await O.getProjectIds();f.logger.info(`start update resource states projects(${s.length})`,s),await Promise.race([new Promise(a=>{setTimeout(()=>{a({})},30*1e3)}),Promise.all(s.map(async a=>{Je({projectId:a,pages:t,components:e})}))]).catch(a=>{f.logger.error("update resource states failed:",a)})});ie[Ke]?.();ie[Ke]=()=>{const t=()=>{O.pageUrlMapCache.clear(),f.logger.info("[Cache CLEAR ALL] clear all page url map cache by env update")};return w.default.events.on(w.default.Events.envUpdate,t),()=>{w.default.events.off(w.default.Events.envUpdate,t)}};O.startPeriodicCheck();process.on("beforeExit",()=>{O.stopPeriodicCheck()});process.on("SIGINT",()=>{O.stopPeriodicCheck(),process.exit(0)});process.on("SIGTERM",()=>{O.stopPeriodicCheck(),process.exit(0)});async function Je({projectId:t,pages:e,components:s}){const a=O.sharedInstances[t];if(!a){f.logger.info(`projectId: ${t} not found in sharedInstances`);return}if(a.syncedStore.resources.pages=e,(await L.findByPk(t))?.useAllResources)a.syncedStore.resources.components=s;else{const r=(await Oe.findAll({where:{projectId:t}})).map(u=>u.componentId),l=Object.fromEntries(Object.entries(s||{}).filter(([u])=>r.includes(u)));a.syncedStore.resources.components=l}f.logger.info(`update [${t}] resource states:`,{pages:Object.keys(a.syncedStore.resources.pages||{}).length,components:Object.keys(a.syncedStore.resources.components||{}).length})}async function We(t){return Je({projectId:t,pages:oe,components:re})}async function zt(){f.logger.info("trigger reload all project resource"),w.default.events.emit(he)}async function Yt({ensureLoaded:t=!0}={}){return t&&(ae??=ze(),await ae),{states:J,pages:oe,components:re}}exports.COMPONENT_DID=je;exports.PUBLISH_MODES=Bt;exports.Project=L;exports.RESOURCE_TYPE=me;exports.SITE_STATE_PATH=x;exports.STATE_MODES=xt;exports.SiteState=O;exports.downloadAsset=Fe;exports.downloadAssets=qe;exports.fromPackage=Ce;exports.getDefaultState=Ne;exports.getResourceStates=Yt;exports.initPackResourceStates=Ye;exports.mergeState=Ie;exports.toPackage=Be;exports.triggerReloadAllProjectResource=zt;exports.updateResourceStatesByProjectId=We;
|
package/lib/cjs/locales.js
CHANGED
|
@@ -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({disableSharing:"Disable Sharing this parameter value to all languages",enableSharing:"Enable Sharing this parameter value to all languages",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:{collapseTopPanel:"Collapse top panel",collapseBottomPanel:"Collapse bottom panel",collapseAll:"Collapse All",expandAll:"Expand All",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",moreItems:"more items"},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"},moreItems:"more items"},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",componentTemplate:"Component Template",templateDialogTitle:"Save as Component Template",templateNameRequired:"Please enter a template name",templateCreateSuccess:'Component template "{name}" created',templateCreateFailed:"Failed to create component template",templateExtractFailed:"Failed to extract component template"},outline:{outline:"Outline"},properties:{forceSyncToAllLanguages:"Sync all languages",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",backgroundFullWidth:"Background Full Width",backgroundFullWidthHelper:"The background will cover the entire page",badge:"Badge",buttons:"Buttons",button:"Button",border:{title:"Border",helper:"Set the border style of the layout",custom:"Custom Border",width:"Border Width(px)",style:"Border Style",color:"Border Color",preview:"Border Preview",solid:"Solid",dashed:"Dashed",dotted:"Dotted",double:"Double",groove:"Groove",ridge:"Ridge",inset:"Inset",outset:"Outset",borderHelper:"Set the border style of the layout",frame:{borderFrame:"Border",deviceFrame:"Device",browserFrame:"Browser",shadowFrame:"Shadow",terminalFrame:"Terminal",commonFrame:"Common"}},borderRadius:{title:"Border Radius",helper:"Set the border radius of the layout",custom:"Custom Border Radius",value:"Radius Value(px)",preview:"Radius Preview"},shadow:"Shadow",color:"Color",variant:"Variant",isPageLink:"Is page link?",link:"Link",style:"Style",utmCampaign:"UTM Campaign(default value: default)",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",paddingCustomTip:"For example: 10px, 20px, 30px",layoutBlockMaxWidthHelper:"Set the maximum width of the layout, this will make the layout not follow the maximum width setting in the page global style",customValue:"Custom Value",stickyHeader:"Sticky Header",translucent:"Translucent Mode",hideNavMenus:"Hide Navigation Menus",hideFooter:"Hide Footer",size:"Size",height:"Height",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:"Configure LLM Description",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",gap:"Layout Gap",gapHelper:"Set the gap between components in the layout, if the horizontal gap will overflow the width, it will not be applied",gapUnit:"px",padding:"Padding",paddingHelper:"Set the padding of the layout",alignContent:{title:"Vertical Alignment",helper:"Set the vertical alignment of content in the layout"},textAlign:{title:"Text Alignment",helper:"Set text alignment for content inside the layout"},justifyContent:{title:"Horizontal Alignment",helper:"Set the horizontal alignment of content in the layout"},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 AIGNE Hub is initialized",unavailable:"Check whether the AIGNE Hub 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",fields:"Fields",unsupportedFieldType:"Unsupported field type",expandAll:"Expand all groups",collapseAll:"Collapse all groups",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.",updateMode:"Translation Update Mode",batchMode:"Batch",realtimeMode:"Real-time",batchModeDescription:"Update all translations at once after completion (better performance)",realtimeModeDescription:"Show each translation result immediately as it arrives (live preview)"},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",pullToWebSmith:"Pull Component to WebSmith",websmith:"WebSmith"}},edit:{modified:"Modified",new:"New",deleted:"Deleted",undo:"Undo",redo:"Redo"},style:{title:"Global Style"}}),a=e.flatten({disableSharing:"停止共享属性值到所有语言",enableSharing:"启用共享属性值到所有语言",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:{collapseTopPanel:"折叠顶部面板",collapseBottomPanel:"折叠底部面板",collapseAll:"折叠所有",expandAll:"展开所有",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:"拖拽到这里",moreItems:"更多项"},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:"取消"},moreItems:"更多项"},components:{components:"组件",addComponent:"添加组件",basicGroup:"基础组件",customGroup:"自定义组件",resourceGroup:"资源组件",deleteTitle:"删除 {name} 组件?",noComponents:"暂无组件",needAddResource:"请在项目设置中选择资源组件",searchComponent:"请输入组件名称进行搜索",componentTemplate:"组件模板",templateDialogTitle:"保存为组件模板",templateNameRequired:"请输入模板名称",templateCreateSuccess:"组件模板“{name}”已创建",templateCreateFailed:"组件模板创建失败",templateExtractFailed:"组件模板提取失败"},outline:{outline:"概览"},properties:{forceSyncToAllLanguages:"同步所有语言",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:"背景",backgroundFullWidth:"背景全宽",backgroundFullWidthHelper:"背景将覆盖整个页面",badge:"标签",buttons:"按钮",button:"按钮",border:{title:"边框",helper:"设置布局的边框样式",custom:"自定义边框",width:"边框宽度 (px)",style:"边框样式",color:"边框颜色",preview:"边框预览",solid:"实线",dashed:"虚线",dotted:"点线",double:"双线",groove:"凹槽",ridge:"凸槽",inset:"内嵌",outset:"外凸",borderHelper:"设置布局的边框样式",frame:{borderFrame:"边框",deviceFrame:"设备",browserFrame:"浏览器",shadowFrame:"阴影",terminalFrame:"终端",commonFrame:"通用"}},borderRadius:{title:"边框圆角",helper:"设置布局的边框圆角",custom:"自定义边框圆角",value:"圆角大小 (px)",preview:"圆角预览"},shadow:"阴影",color:"颜色",variant:"样式",isPageLink:"是否内部链接?",link:"链接",style:"样式",utmCampaign:"UTM 活动(默认值: default)",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",paddingCustomTip:"例如: 10px, 20px, 30px",layoutBlockMaxWidthHelper:"设置布局的最大宽度,这将会布局将不会遵循页面公共样式中的最大宽度设置",customValue:"自定义值",stickyHeader:"固定导航栏",translucent:"沉浸式",hideNavMenus:"隐藏导航菜单",hideFooter:"隐藏页脚",size:"大小",height:"高度",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:"列数",gap:"布局间距",gapHelper:"设置布局中组件之间的间距,如果横向的间隔会让宽度溢出,则不会应用横向间距",padding:"内边距",paddingHelper:"设置布局的内边距",alignContent:{title:"垂直内容对齐",helper:"设置布局中垂直内容的对齐方式"},textAlign:{title:"文本对齐",helper:"设置布局中文本的对齐方式"},justifyContent:{title:"水平内容对齐",helper:"设置布局中水平内容的对齐方式"},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:"请先检查 AIGNE Hub 是否已经配置",unavailable:"请先检查 AIGNE Hub 是否正常设置"}},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:"字段",fields:"字段",unsupportedFieldType:"不支持的字段类型",expandAll:"展开所有分组",collapseAll:"折叠所有分组",unsavedChanges:"你有未保存的更改。是否在关闭前保存?",templateSyncTip:"您只需维护一种语言版本的页面模板,我们会在处理翻译的同时,自动同步页面模板的配置。",updateMode:"翻译更新模式",batchMode:"批量更新",realtimeMode:"实时更新",batchModeDescription:"翻译完成后一次性更新所有内容(性能更佳)",realtimeModeDescription:"每个翻译结果立即显示(实时预览)"},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:"迁移组件设置",pullToWebSmith:"拉取组件库到 WebSmith",websmith:"WebSmith"}},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"},moreItems:"more items"},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",componentTemplate:"Component Template",templateDialogTitle:"Save as Component Template",templateNameRequired:"Please enter a template name",templateCreateSuccess:'Component template "{name}" created',templateCreateFailed:"Failed to create component template",templateExtractFailed:"Failed to extract component template"},outline:{outline:"Outline"},properties:{forceSyncToAllLanguages:"Sync all languages",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",backgroundFullWidth:"Background Full Width",backgroundFullWidthHelper:"The background will cover the entire page",badge:"Badge",buttons:"Buttons",button:"Button",border:{title:"Border",helper:"Set the border style of the layout",custom:"Custom Border",width:"Border Width(px)",style:"Border Style",color:"Border Color",preview:"Border Preview",solid:"Solid",dashed:"Dashed",dotted:"Dotted",double:"Double",groove:"Groove",ridge:"Ridge",inset:"Inset",outset:"Outset",borderHelper:"Set the border style of the layout",frame:{borderFrame:"Border",deviceFrame:"Device",browserFrame:"Browser",shadowFrame:"Shadow",terminalFrame:"Terminal",commonFrame:"Common"}},borderRadius:{title:"Border Radius",helper:"Set the border radius of the layout",custom:"Custom Border Radius",value:"Radius Value(px)",preview:"Radius Preview"},shadow:"Shadow",color:"Color",variant:"Variant",isPageLink:"Is page link?",link:"Link",style:"Style",utmCampaign:"UTM Campaign(default value: default)",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",paddingCustomTip:"For example: 10px, 20px, 30px",layoutBlockMaxWidthHelper:"Set the maximum width of the layout, this will make the layout not follow the maximum width setting in the page global style",customValue:"Custom Value",stickyHeader:"Sticky Header",translucent:"Translucent Mode",hideNavMenus:"Hide Navigation Menus",hideFooter:"Hide Footer",size:"Size",height:"Height",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:"Configure LLM Description",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",gap:"Layout Gap",gapHelper:"Set the gap between components in the layout, if the horizontal gap will overflow the width, it will not be applied",gapUnit:"px",padding:"Padding",paddingHelper:"Set the padding of the layout",alignContent:{title:"Vertical Alignment",helper:"Set the vertical alignment of content in the layout"},textAlign:{title:"Text Alignment",helper:"Set text alignment for content inside the layout"},justifyContent:{title:"Horizontal Alignment",helper:"Set the horizontal alignment of content in the layout"},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",slugInvalid:"Slug format is invalid",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 AIGNE Hub is initialized",unavailable:"Check whether the AIGNE Hub 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",fields:"Fields",unsupportedFieldType:"Unsupported field type",expandAll:"Expand all groups",collapseAll:"Collapse all groups",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.",updateMode:"Translation Update Mode",batchMode:"Batch",realtimeMode:"Real-time",batchModeDescription:"Update all translations at once after completion (better performance)",realtimeModeDescription:"Show each translation result immediately as it arrives (live preview)"},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",pullToWebSmith:"Pull Component to WebSmith",websmith:"WebSmith"}},edit:{modified:"Modified",new:"New",deleted:"Deleted",undo:"Undo",redo:"Redo"},style:{title:"Global Style"}}),a=e.flatten({disableSharing:"停止共享属性值到所有语言",enableSharing:"启用共享属性值到所有语言",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:{collapseTopPanel:"折叠顶部面板",collapseBottomPanel:"折叠底部面板",collapseAll:"折叠所有",expandAll:"展开所有",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:"拖拽到这里",moreItems:"更多项"},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:"取消"},moreItems:"更多项"},components:{components:"组件",addComponent:"添加组件",basicGroup:"基础组件",customGroup:"自定义组件",resourceGroup:"资源组件",deleteTitle:"删除 {name} 组件?",noComponents:"暂无组件",needAddResource:"请在项目设置中选择资源组件",searchComponent:"请输入组件名称进行搜索",componentTemplate:"组件模板",templateDialogTitle:"保存为组件模板",templateNameRequired:"请输入模板名称",templateCreateSuccess:"组件模板“{name}”已创建",templateCreateFailed:"组件模板创建失败",templateExtractFailed:"组件模板提取失败"},outline:{outline:"概览"},properties:{forceSyncToAllLanguages:"同步所有语言",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:"背景",backgroundFullWidth:"背景全宽",backgroundFullWidthHelper:"背景将覆盖整个页面",badge:"标签",buttons:"按钮",button:"按钮",border:{title:"边框",helper:"设置布局的边框样式",custom:"自定义边框",width:"边框宽度 (px)",style:"边框样式",color:"边框颜色",preview:"边框预览",solid:"实线",dashed:"虚线",dotted:"点线",double:"双线",groove:"凹槽",ridge:"凸槽",inset:"内嵌",outset:"外凸",borderHelper:"设置布局的边框样式",frame:{borderFrame:"边框",deviceFrame:"设备",browserFrame:"浏览器",shadowFrame:"阴影",terminalFrame:"终端",commonFrame:"通用"}},borderRadius:{title:"边框圆角",helper:"设置布局的边框圆角",custom:"自定义边框圆角",value:"圆角大小 (px)",preview:"圆角预览"},shadow:"阴影",color:"颜色",variant:"样式",isPageLink:"是否内部链接?",link:"链接",style:"样式",utmCampaign:"UTM 活动(默认值: default)",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",paddingCustomTip:"例如: 10px, 20px, 30px",layoutBlockMaxWidthHelper:"设置布局的最大宽度,这将会布局将不会遵循页面公共样式中的最大宽度设置",customValue:"自定义值",stickyHeader:"固定导航栏",translucent:"沉浸式",hideNavMenus:"隐藏导航菜单",hideFooter:"隐藏页脚",size:"大小",height:"高度",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:"列数",gap:"布局间距",gapHelper:"设置布局中组件之间的间距,如果横向的间隔会让宽度溢出,则不会应用横向间距",padding:"内边距",paddingHelper:"设置布局的内边距",alignContent:{title:"垂直内容对齐",helper:"设置布局中垂直内容的对齐方式"},textAlign:{title:"文本对齐",helper:"设置布局中文本的对齐方式"},justifyContent:{title:"水平内容对齐",helper:"设置布局中水平内容的对齐方式"},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:"路径不能为空",slugInvalid:"路径格式不合法",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:"请先检查 AIGNE Hub 是否已经配置",unavailable:"请先检查 AIGNE Hub 是否正常设置"}},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:"字段",fields:"字段",unsupportedFieldType:"不支持的字段类型",expandAll:"展开所有分组",collapseAll:"折叠所有分组",unsavedChanges:"你有未保存的更改。是否在关闭前保存?",templateSyncTip:"您只需维护一种语言版本的页面模板,我们会在处理翻译的同时,自动同步页面模板的配置。",updateMode:"翻译更新模式",batchMode:"批量更新",realtimeMode:"实时更新",batchModeDescription:"翻译完成后一次性更新所有内容(性能更佳)",realtimeModeDescription:"每个翻译结果立即显示(实时预览)"},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:"迁移组件设置",pullToWebSmith:"拉取组件库到 WebSmith",websmith:"WebSmith"}},edit:{modified:"已修改",new:"新增",deleted:"已删除",undo:"撤销",redo:"重做"},style:{title:"公共样式"}}),o={en:t,zh:a};exports.translations=o;
|
package/lib/cjs/resources.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const g=require("./chunks/components-DLLpFRy5.js"),c=require("./chunks/site-state-
|
|
1
|
+
"use strict";const g=require("./chunks/components-DLLpFRy5.js"),c=require("./chunks/site-state-2LMcqIzO.js"),F=require("express"),L=require("fs"),J=require("joi"),X=require("lodash/groupBy"),W=require("lodash/sortBy"),B=require("path"),G=require("@blocklet/sdk/lib/middlewares/auth"),K=require("@blocklet/sdk/lib/component"),m=e=>e&&e.__esModule?e:{default:e},u=m(L),f=m(J),C=m(X),Y=m(W),D=m(B),k=m(G),$=async(e,t,o)=>{try{const{projectId:s}=e.params;if(!s)return o();const n=await c.Project.findByPk(s);if(!n)return t?.status(404).json({error:"Project not found"});const r=e.user?.did,a=e.user?.role||"UNKNOWN_ROLE";if(!r)return t?.status(401).json({error:"Authentication required"});if(g.isMultiTenant()){const P=n.createdBy===r,y=g.getMultiTenantAllProjectAccessPassports()?.includes?.(a);if(!P&&!y)return t?.status(403).json({error:"No permission to access this project in multi-tenant mode"})}else if(!["owner","admin","pagesEditor"].includes(a))return t?.status(403).json({error:"No permission to access this project in single-tenant mode"});e.project=n,e.projectId=s,o()}catch(s){g.logger.error("Project middleware error:",s),t?.status(400).json({error:"Internal server error"})}};function b(e,t){return new Promise((o,s)=>{const n=u.default.createReadStream(e),r=u.default.createWriteStream(t);n.on("error",s),r.on("error",s),r.on("finish",o),n.pipe(r)})}async function N(e,t){await u.default.promises.mkdir(t,{recursive:!0});const o=await u.default.promises.readdir(e,{withFileTypes:!0});for(const s of o){const n=D.default.join(e,s.name),r=D.default.join(t,s.name);s.isDirectory()?await N(n,r):await b(n,r)}}async function z(e,t){(await u.default.promises.stat(e)).isDirectory()?await N(e,t):await b(e,t)}const h=(e,t,o)=>g.isMultiTenant()?k.default()(e,t,o):k.default({roles:["owner","admin","pagesEditor"]})(e,t,o),H=(e,t)=>{const o=K.getResourceExportDir({projectId:e,releaseId:t});return B.join(o,c.COMPONENT_DID,c.RESOURCE_TYPE)},w=F.Router(),T="@page",U="@component",j=":",R="ALL",q="@project",v=({pageId:e,projectId:t})=>[T,t,e].join(j),Q=e=>{const[t,o,s]=e.split(j);if(t===T)return{pageId:s,projectId:o}},x=({componentId:e,projectId:t})=>[U,t,e].join(j),V=e=>{const[t,o,s]=e.split(j);if(t===U)return{componentId:s,projectId:o}},Z=e=>[q,e].join(j),ee=e=>{const[t,o]=e.split(j);if(t===q)return o},te=e=>{try{return JSON.parse(e)}catch{}return{}};async function A(e){const t=await c.SiteState.getStateByProjectId(e,"production"),o=await c.Project.findByPk(e),s=t.pageIds.map(r=>{const a=t.pages[r];if(a)return{id:v({pageId:r,projectId:e}),name:a.slug}}).filter(Boolean),n=Y.default(Object.values(t.components),r=>r.index).map(({data:r})=>({id:x({componentId:r.id,projectId:e}),name:r.name||r.id}));return{id:Z(e),name:o?.name||"Unnamed Project",children:[{id:v({pageId:R,projectId:e}),name:"Pages",children:s},{id:x({componentId:R,projectId:e}),name:"Components",children:n}]}}w.get("/resources",h,async(e,t)=>{const{projectId:o}=te(e.query.resourcesParams);if(o){e.params={...e.params,projectId:o},await $(e,t,()=>{});const r=await A(o);t.json({resources:[r]});return}const s=await c.Project.findAll({where:{}}),n=await Promise.all(s.map(r=>A(r.id)));t.json({resources:n})});const oe=f.default.object({projectId:f.default.string().required().min(1),releaseId:f.default.string().allow(""),resources:f.default.array().items(f.default.string()).required(),locale:f.default.string().allow("")});w.post("/resources",h,async(e,t)=>{const{resources:o,projectId:s,releaseId:n}=await oe.validateAsync(e.body),r="production",a=[],P=[];for(const i of o){if(ee(i))continue;const{pageId:d,projectId:_}=Q(i)||{};if(d)d===R||d&&_&&a.push({pageId:d,projectId:_});else{const{componentId:I,projectId:p}=V(i)||{};I===R||I&&p&&P.push({componentId:I,projectId:p})}}const y=C.default(a,"projectId"),O=C.default(P,"projectId"),M=new Set([...Object.keys(y),...Object.keys(O)]),E=H(s,n);u.default.rmSync(E,{recursive:!0,force:!0}),u.default.mkdirSync(E,{recursive:!0});for(const i of M){const d=await c.SiteState.getStateByProjectId(i,r),_=y[i],I=O[i],p=_?.map(l=>l.pageId),S=I?.map(l=>l.componentId);if(p?.length||S?.length){const l=await c.toPackage(d,{exportAssets:!0,pageIds:p,componentIds:S});await z(l,E),u.default.rmSync(l,{recursive:!0,force:!0})}g.logger.info(`Exported resources for project ${i}`,{pageIds:p,componentIds:S})}t.json({})});w.get("/all-resources",h,async(e,t)=>{const{states:o}=await c.getResourceStates(),s=o?.map(n=>{const r={blockletId:n.blockletId,blockletTitle:n.blockletTitle,components:{}};if(n.state.components&&(r.components=n.state.components),Object.keys(r.components).length!==0)return r}).filter(Boolean);t.json(s)});module.exports=w;
|
package/lib/cjs/site-state.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./chunks/components-DLLpFRy5.js");const e=require("./chunks/site-state-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./chunks/components-DLLpFRy5.js");const e=require("./chunks/site-state-2LMcqIzO.js"),u=require("@blocklet/pages-kit/utils/common");require("@blocklet/pages-kit/utils/page-model");require("@blocklet/pages-kit/utils/property");require("@blocklet/pages-kit/utils/route");require("@blocklet/sdk/lib/component");require("@blocklet/sdk/lib/config");require("@reactivedata/reactive");require("@syncedstore/core");require("fs");require("glob");require("lib0/decoding");require("lib0/encoding");require("lodash/cloneDeep");require("lodash/debounce");require("lodash/get");require("lodash/isEmpty");require("lodash/set");require("lodash/union");require("lru-cache");require("p-limit");require("path");require("sequelize");require("stream/promises");require("tar");require("ufo");require("wait-on");require("y-protocols/awareness");require("y-protocols/sync");require("yaml");require("yjs");const t=require("@blocklet/pages-kit/types/state");exports.PUBLISH_MODES=e.PUBLISH_MODES;exports.SITE_STATE_PATH=e.SITE_STATE_PATH;exports.STATE_MODES=e.STATE_MODES;exports.default=e.SiteState;exports.downloadAsset=e.downloadAsset;exports.downloadAssets=e.downloadAssets;exports.fromPackage=e.fromPackage;exports.getDefaultState=e.getDefaultState;exports.getResourceStates=e.getResourceStates;exports.initPackResourceStates=e.initPackResourceStates;exports.mergeState=e.mergeState;exports.toPackage=e.toPackage;exports.triggerReloadAllProjectResource=e.triggerReloadAllProjectResource;exports.updateResourceStatesByProjectId=e.updateResourceStatesByProjectId;Object.defineProperty(exports,"nextId",{enumerable:!0,get:()=>u.nextId});Object.keys(t).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(exports,r)&&Object.defineProperty(exports,r,{enumerable:!0,get:()=>t[r]})});
|