@openbkn/workshop 0.3.0-rc.1 → 0.3.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ActionConfirm-BX1dlrAM.js → ActionConfirm-G-F1ZPqU.js} +5 -5
- package/dist/{ActionFailure-xcSfKJYC.js → ActionFailure-PXLm8Yrm.js} +2 -2
- package/dist/{AgentChat-DHdX_6W7.js → AgentChat-D2h4hYuv.js} +25 -25
- package/dist/{AppListPage-DsUvFo6B.js → AppListPage-CjAyblsr.js} +4 -4
- package/dist/{AskDrawer-j-CR4yXP.js → AskDrawer-BOZHK2uD.js} +4 -4
- package/dist/{ComputedView-dWFlHngu.js → ComputedView-CFB6TLqD.js} +27 -27
- package/dist/{ConclusionApply-BAoZpxl-.js → ConclusionApply-QzEgCkEr.js} +4 -4
- package/dist/{CypherEditor-CZ5Z4SGH.js → CypherEditor-ChbgNwGj.js} +5 -5
- package/dist/{LandingList-BUO6-at_.js → LandingList-D4rN2C_h.js} +5 -5
- package/dist/{MenuUnfoldOutlined-DAeIeIap.js → MenuUnfoldOutlined-9J7j6Kim.js} +1 -1
- package/dist/{ModelTrial-C7XvLVY7.js → ModelTrial-DWE5fBa4.js} +4 -4
- package/dist/{PageRenderer-CkmvW4aO.js → PageRenderer-BYBHi5At.js} +12737 -12687
- package/dist/{ScenarioApply-COdlyvrC.js → ScenarioApply-Ck68QOWM.js} +25 -25
- package/dist/{SimulateForm-B_9laTIl.js → SimulateForm-QwSu0BWO.js} +4 -4
- package/dist/{Subgraph-CDY3wvCA.js → Subgraph-CMIts4-k.js} +3 -3
- package/dist/{WorkshopLabPage-BtYnBpk4.js → WorkshopLabPage-N-CVblXc.js} +4930 -4619
- package/dist/{WorkshopRunPage-DHMJ3b8k.js → WorkshopRunPage-LtG2nDNS.js} +6 -6
- package/dist/{abnfDiagram-WEYOIA3C-Blje2Kbf.js → abnfDiagram-WEYOIA3C-CEkD2Kbr.js} +3 -3
- package/dist/{action-type-tool.service-BN-W_Az_.js → action-type-tool.service-DfyMNDaF.js} +1 -1
- package/dist/{architectureDiagram-ZHVYKT53-B_FkRXc3.js → architectureDiagram-ZHVYKT53-ypBqmKJn.js} +3 -3
- package/dist/{bkn-agent-execution.service-CJalMVIc.js → bkn-agent-execution.service-DpOKT3iR.js} +1 -1
- package/dist/{blockDiagram-RJAE7QA3-CYJLthoI.js → blockDiagram-RJAE7QA3-BQiz7ppY.js} +3 -3
- package/dist/{c4Diagram-XDPPPE54-CmMaN3M4.js → c4Diagram-XDPPPE54-DoQEicnh.js} +2 -2
- package/dist/{channel-Dp24Bgua.js → channel-CLsZYFb3.js} +1 -1
- package/dist/{chunk-2E7WHVMD-DrnpfYKB.js → chunk-2E7WHVMD-C7KAk7Aw.js} +1 -1
- package/dist/{chunk-2Q5K7J3B-BXqKcHlQ.js → chunk-2Q5K7J3B-DJjZ1fjz.js} +1 -1
- package/dist/{chunk-4EMNKR2T-DYgY_0_y.js → chunk-4EMNKR2T-Da2DlW9r.js} +1 -1
- package/dist/{chunk-55XCU76K-Bja7bE8g.js → chunk-55XCU76K-Dke6HW5r.js} +1 -1
- package/dist/{chunk-5VM5RSS4-CGTnbRRi.js → chunk-5VM5RSS4-CfxCWhgL.js} +1 -1
- package/dist/{chunk-JWPE2WC7-2AyjxdJR.js → chunk-JWPE2WC7-BvFVx2S8.js} +1 -1
- package/dist/{chunk-VQ5W62QI-B3PGCKOg.js → chunk-VQ5W62QI-BKtRw0gX.js} +1 -1
- package/dist/{chunk-XXDRQBXY-RrIsI-B5.js → chunk-XXDRQBXY-BFdjgXiI.js} +1 -1
- package/dist/{chunk-ZCHMQSOR-COJTBW1i.js → chunk-ZCHMQSOR-BV9eKUlK.js} +2 -2
- package/dist/{classDiagram-v2-4MYWR3UA-DolLxH6t.js → classDiagram-v2-4MYWR3UA-CrCmRIma.js} +5 -5
- package/dist/{cose-bilkent-JH36ORCC-DMSYgFxc.js → cose-bilkent-JH36ORCC-BLuhBHgL.js} +2 -2
- package/dist/{customParseFormat-C9WAjjqH.js → customParseFormat-LvPG_yWc.js} +1 -1
- package/dist/{cynefinDiagram-WF24UDRP-DrksRWCn.js → cynefinDiagram-WF24UDRP-Dkdu7UWf.js} +2 -2
- package/dist/{dagre-NK4GIZVX-CFRT2dAc.js → dagre-NK4GIZVX-wQ94w-j-.js} +2 -2
- package/dist/{dayjs.min-CziT8yW9.js → dayjs.min-C7Hp2iGA.js} +1 -1
- package/dist/{diagram-CBK3MWTC-DzZ_sQCl.js → diagram-CBK3MWTC-DFfVlq-I.js} +3 -3
- package/dist/{diagram-I5XIIV2D-RYNBUOF4.js → diagram-I5XIIV2D-kg2lU_ud.js} +2 -2
- package/dist/{diagram-ODIL2UCW-DqJETE9R.js → diagram-ODIL2UCW-Cq22spS8.js} +3 -3
- package/dist/{diagram-PFBEJUXE-BekIE7hh.js → diagram-PFBEJUXE-6v743_6i.js} +2 -2
- package/dist/{diagram-RJA3I4VV-DAIwlMxl.js → diagram-RJA3I4VV-CfpzBZG7.js} +2 -2
- package/dist/{diagram-TYUNFSNR-CLJ0Ou9i.js → diagram-TYUNFSNR-DWcS3i5W.js} +6 -6
- package/dist/{ebnfDiagram-V4P3TTPT-CRs8ppfT.js → ebnfDiagram-V4P3TTPT-CDdo-DHX.js} +3 -3
- package/dist/{elk-QONTBCTQ-Bqoh6AYY.js → elk-QONTBCTQ-tURRkPjL.js} +5 -5
- package/dist/{erDiagram-KYQIGQAA-BSp8Z7uQ.js → erDiagram-KYQIGQAA-DOUye_XT.js} +4 -4
- package/dist/{flowDiagram-IUGLLWBU-WKILTCDc.js → flowDiagram-IUGLLWBU-DSva8jfA.js} +7 -7
- package/dist/{ganttDiagram-R7GPNTJY-CaTn_Mmr.js → ganttDiagram-R7GPNTJY-yY38MCsA.js} +4 -4
- package/dist/generateCypher-Cv-1H1ju.js +1088 -0
- package/dist/{gitGraphDiagram-PDYL7XHY-DGPs-RF6.js → gitGraphDiagram-PDYL7XHY-Cib4RIM7.js} +3 -3
- package/dist/{infoDiagram-MVDRKAX5-HIQg7U3R.js → infoDiagram-MVDRKAX5-C95Rlu7T.js} +1 -1
- package/dist/{ishikawaDiagram-HPEHV2GE-C84x8n2j.js → ishikawaDiagram-HPEHV2GE-BAJtxdug.js} +2 -2
- package/dist/{journeyDiagram-BOSHW7O7-CvYDNxSY.js → journeyDiagram-BOSHW7O7-D0_UFC4-.js} +4 -4
- package/dist/{kanban-definition-FNSA4HC5-B586ryFD.js → kanban-definition-FNSA4HC5-DVGJd60c.js} +2 -2
- package/dist/{mermaid.core-3J01L12Z.js → mermaid.core-CaigvKK3.js} +43 -43
- package/dist/{mindmap-definition-6OY57UG3-Donc6BMy.js → mindmap-definition-6OY57UG3-Cc9NVGcT.js} +3 -3
- package/dist/{models-Rf3LB8wS.js → models-9HukOADg.js} +1 -1
- package/dist/{object-metric-numeric-BcgaJ6EW.js → object-metric-numeric-DpQoy02c.js} +1 -1
- package/dist/{object-metric.service-CKiaFYcp.js → object-metric.service-Bs69yRkm.js} +2 -2
- package/dist/{pegDiagram-ECIUJNBX-CYVi7x6D.js → pegDiagram-ECIUJNBX-DAnSZciK.js} +3 -3
- package/dist/{pieDiagram-GNMPY74T-4iWKYTTS.js → pieDiagram-GNMPY74T-CPRmYgcD.js} +2 -2
- package/dist/{prompt-BQzBLrua.js → prompt-CdE-v-Ut.js} +124 -113
- package/dist/{quadrantDiagram-D57K4MC3-Bm6Cyi1I.js → quadrantDiagram-D57K4MC3--PBqyWig.js} +1 -1
- package/dist/{railroadDiagram-Y72NRBL7-Du6iN-Jz.js → railroadDiagram-Y72NRBL7-v4wxw4pH.js} +3 -3
- package/dist/{requirementDiagram-EQYSW5RA-BGxpuSlc.js → requirementDiagram-EQYSW5RA-CXUiIggI.js} +3 -3
- package/dist/{sankeyDiagram-SY24JHO5-CsHmu__D.js → sankeyDiagram-SY24JHO5-CXWMlyCF.js} +2 -2
- package/dist/{sequenceDiagram-BLEHNHQU-DBNi943L.js → sequenceDiagram-BLEHNHQU-BBOTQGfc.js} +3 -3
- package/dist/{sizeCapture-INFHLROL-CcGr2ilA.js → sizeCapture-INFHLROL-CoWTXUCl.js} +1 -1
- package/dist/{stateDiagram-v2-A6IESKWZ-C78tVzaF.js → stateDiagram-v2-A6IESKWZ-f2F4pX57.js} +4 -4
- package/dist/{swimlanes-B3ENRKFQ-BROc4LGM.js → swimlanes-B3ENRKFQ-Cpfk8ZRY.js} +3 -3
- package/dist/{swimlanesDiagram-AYQRV4AK-C0RDY4m2.js → swimlanesDiagram-AYQRV4AK-hM77bzoI.js} +3 -3
- package/dist/{timeline-definition-JXYKGLGB-C6WGe4xl.js → timeline-definition-JXYKGLGB-BR5tHWmO.js} +1 -1
- package/dist/{toolMatchLines-DrXpUwcl.js → toolMatchLines-CvXMA8LD.js} +2 -2
- package/dist/{useLabData-B-3UW8zF.js → useLabData-OIsblj-7.js} +3220 -3200
- package/dist/{usecaseDiagram-WPOLBNNX-yMP7SDIg.js → usecaseDiagram-WPOLBNNX-DKhBwmOs.js} +3 -3
- package/dist/{vennDiagram-Q3Y3IDCW-bZW2LzBB.js → vennDiagram-Q3Y3IDCW-BnwNAM2m.js} +2 -2
- package/dist/{wardleyDiagram-IVAIDKWA-DBbog93x.js → wardleyDiagram-IVAIDKWA-BAl9UccR.js} +2 -2
- package/dist/{workshop-app-ByYXbgcn.js → workshop-app-7WTuNuCp.js} +7521 -7419
- package/dist/workshop-app.css +1 -1
- package/dist/workshop-app.js +2 -2
- package/dist/{xychartDiagram-4URNHDU4-CVLJNXOt.js → xychartDiagram-4URNHDU4-DAUWzPOU.js} +1 -1
- package/dist-cli/workshop.js +179 -169
- package/package.json +1 -1
- package/skill/SKILL.en-US.md +1 -1
- package/skill/SKILL.md +1 -1
- package/dist/generateCypher-BE_4YCWB.js +0 -1032
package/dist-cli/workshop.js
CHANGED
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
import{spawnSync as yu,execFile as bu,spawn as wu}from"node:child_process";import{homedir as ku}from"node:os";import{join as G,extname as sc,posix as vu,relative as rc,sep as $u,dirname as Tt,resolve as tt}from"node:path";import{isDeepStrictEqual as Su,parseArgs as ju}from"node:util";import{readFileSync as ct,readdirSync as nn,statSync as Au,existsSync as we,rmSync as ut,mkdirSync as Bn,writeFileSync as ac,rmdirSync as Tu,watch as Ou,cpSync as To,symlinkSync as Eu,lstatSync as ic,readlinkSync as Cu}from"node:fs";import Er from"process";import Nu from"buffer";import{deflateRawSync as xu,inflateRawSync as Ru}from"node:zlib";import{createHash as lc}from"node:crypto";import{request as _u}from"node:http";import{request as Pu}from"node:https";function Mt(e){const t=e?.trim().split(/[.@]/)[0];if(!(!t||t==="C"||t==="POSIX"))return/^zh/i.test(t)?"zh-CN":"en-US"}function oa(e,t=process.env){return Mt(e)??Mt(t.WORKSHOP_LANG)??Mt(t.LC_ALL)??Mt(t.LC_MESSAGES)??Mt(t.LANG)??"zh-CN"}function cc(e,t={}){return e.replace(/\{(\w+)\}/g,(n,o)=>o in t?String(t[o]):n)}let Un=null;function Lu(e){Un=e}function Iu(){return Un}function nt(){if(!Un)throw new Error("No Workshop host is installed: call installWorkshopHost first.");return Un}const st={get:(e,t)=>nt().http.get(e,t),delete:(e,t)=>nt().http.delete(e,t),post:(e,t,n)=>nt().http.post(e,t,n),put:(e,t,n)=>nt().http.put(e,t,n)};function Mu(e,t){if(!t.from)return t;const n=t.from.source;return e.sources.find(o=>o.id===n&&!o.from)}function ue(e,t){const n=e.sources.find(a=>a.id===t);if(!n?.from)return n;const o=Mu(e,n);if(!o)return;const s=sa.get(n);if(s?.base===o)return s.value;const r={...o,id:n.id,label:n.label,from:n.from};return sa.set(n,{base:o,value:r}),r}const sa=new WeakMap,_=e=>typeof e=="string",qt=()=>{let e,t;const n=new Promise((o,s)=>{e=o,t=s});return n.resolve=e,n.reject=t,n},ra=e=>e==null?"":String(e),qu=(e,t,n)=>{e.forEach(o=>{t[o]&&(n[o]=t[o])})},Fu=/###/g,aa=e=>e&&e.includes("###")?e.replace(Fu,"."):e,ia=e=>!e||_(e),Vt=(e,t,n)=>{const o=_(t)?t.split("."):t;let s=0;for(;s<o.length-1;){if(ia(e))return{};const r=aa(o[s]);!e[r]&&n&&(e[r]=new n),Object.prototype.hasOwnProperty.call(e,r)?e=e[r]:e={},++s}return ia(e)?{}:{obj:e,k:aa(o[s])}},la=(e,t,n)=>{const{obj:o,k:s}=Vt(e,t,Object);if(o!==void 0||t.length===1){o[s]=n;return}let r=t[t.length-1],a=t.slice(0,t.length-1),l=Vt(e,a,Object);for(;l.obj===void 0&&a.length;)r=`${a[a.length-1]}.${r}`,a=a.slice(0,a.length-1),l=Vt(e,a,Object),l?.obj&&typeof l.obj[`${l.k}.${r}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${r}`]=n},Du=(e,t,n,o)=>{const{obj:s,k:r}=Vt(e,t,Object);s[r]=s[r]||[],s[r].push(n)},zn=(e,t)=>{const{obj:n,k:o}=Vt(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,o))return n[o]},Bu=(e,t,n)=>{const o=zn(e,n);return o!==void 0?o:zn(t,n)},dc=(e,t,n)=>{for(const o in t)o!=="__proto__"&&o!=="constructor"&&(Object.prototype.hasOwnProperty.call(e,o)?_(e[o])||e[o]instanceof String||_(t[o])||t[o]instanceof String?n&&(e[o]=t[o]):dc(e[o],t[o],n):e[o]=t[o]);return e},Ke=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Uu={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},zu=e=>_(e)?e.replace(/[&<>"'\/]/g,t=>Uu[t]):e;class Wu{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const o=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,o),this.regExpQueue.push(t),o}}const Ku=[" ",",","?","!",";"],Yu=new Wu(20),Gu=(e,t,n)=>{t=t||"",n=n||"";const o=Ku.filter(a=>!t.includes(a)&&!n.includes(a));if(o.length===0)return!0;const s=Yu.getRegExp(`(${o.map(a=>a==="?"?"\\?":a).join("|")})`);let r=!s.test(e);if(!r){const a=e.indexOf(n);a>0&&!s.test(e.substring(0,a))&&(r=!0)}return r},qs=(e,t,n=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const o=t.split(n);let s=e;for(let r=0;r<o.length;){if(!s||typeof s!="object")return;let a,l="";for(let c=r;c<o.length;++c)if(c!==r&&(l+=n),l+=o[c],a=s[l],a!==void 0){if(["string","number","boolean"].includes(typeof a)&&c<o.length-1)continue;r+=c-r+1;break}s=a}return s},on=e=>e?.replace(/_/g,"-"),Hu={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class Wn{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||Hu,this.options=n,this.debug=n.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,o,s){return s&&!this.debug?null:(t=t.map(r=>_(r)?r.replace(/[\r\n\x00-\x1F\x7F]/g," "):r),_(t[0])&&(t[0]=`${o}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Wn(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Wn(this.logger,t)}}var Be=new Wn;class ao{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const s=this.observers[o].get(n)||0;this.observers[o].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}once(t,n){const o=(...s)=>{n(...s),this.off(t,o)};return this.on(t,o),this}emit(t,...n){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([s,r])=>{for(let a=0;a<r;a++)s(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,r])=>{for(let a=0;a<r;a++)s(t,...n)})}}class ca extends ao{constructor(t,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.includes(t)||this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,o,s={}){const r=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.includes(".")?l=t.split("."):(l=[t,n],o&&(Array.isArray(o)?l.push(...o):_(o)&&r?l.push(...o.split(r)):l.push(o)));const c=zn(this.data,l);return!c&&!n&&!o&&t.includes(".")&&(t=l[0],n=l[1],o=l.slice(2).join(".")),c||!a||!_(o)?c:qs(this.data?.[t]?.[n],o,r)}addResource(t,n,o,s,r={silent:!1}){const a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let l=[t,n];o&&(l=l.concat(a?o.split(a):o)),t.includes(".")&&(l=t.split("."),s=n,n=l[1]),this.addNamespaces(n),la(this.data,l,s),r.silent||this.emit("added",t,n,o,s)}addResources(t,n,o,s={silent:!1}){for(const r in o)(_(o[r])||Array.isArray(o[r]))&&this.addResource(t,n,r,o[r],{silent:!0});s.silent||this.emit("added",t,n,o)}addResourceBundle(t,n,o,s,r,a={silent:!1,skipCopy:!1}){let l=[t,n];t.includes(".")&&(l=t.split("."),s=o,o=n,n=l[1]),this.addNamespaces(n);let c=zn(this.data,l)||{};a.skipCopy||(o=JSON.parse(JSON.stringify(o))),s?dc(c,o,r):c={...c,...o},la(this.data,l,c),a.silent||this.emit("added",t,n,o)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var uc={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,o,s){return e.forEach(r=>{t=this.processors[r]?.process(t,n,o,s)??t}),t}};const hc=Symbol("i18next/PATH_KEY");function Vu(){const e=[],t=Object.create(null);let n;return t.get=(o,s)=>(n?.revoke?.(),s===hc?e:(e.push(s),n=Proxy.revocable(o,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Ot(e,t){const{[hc]:n}=e(Vu()),o=t?.keySeparator??".",s=t?.nsSeparator??":",r=t?.enableSelector==="strict";if(n.length>1&&s){const a=t?.ns,l=r?Array.isArray(a)?a:a?[a]:null:Array.isArray(a)?a:null;if(l&&(r?l:l.length>1?l.slice(1):[]).includes(n[0]))return`${n[0]}${s}${n.slice(1).join(o)}`}return n.join(o)}const Oo=e=>!_(e)&&typeof e!="boolean"&&typeof e!="number";class Kn extends ao{constructor(t,n={}){super(),qu(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Be.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,n={interpolation:{}}){const o={...n};if(t==null)return!1;const s=this.resolve(t,o);if(s?.res===void 0)return!1;const r=Oo(s.res);return!(o.returnObjects===!1&&r)}extractFromKey(t,n){let o=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let r=n.ns||this.options.defaultNS||[];const a=o&&t.includes(o),l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Gu(t,o,s);if(a&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:_(r)?[r]:r};const i=t.split(o);(o!==s||o===s&&this.options.ns.includes(i[0]))&&(r=i.shift()),t=i.join(s)}return{key:t,namespaces:_(r)?[r]:r}}translate(t,n,o){let s=typeof n=="object"?{...n}:n;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),t==null)return"";typeof t=="function"&&(t=Ot(t,{...this.options,...s})),Array.isArray(t)||(t=[String(t)]),t=t.map(I=>typeof I=="function"?Ot(I,{...this.options,...s}):String(I));const r=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:l,namespaces:c}=this.extractFromKey(t[t.length-1],s),i=c[c.length-1];let d=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;d===void 0&&(d=":");const h=s.lng||this.language,u=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(h?.toLowerCase()==="cimode")return u?r?{res:`${i}${d}${l}`,usedKey:l,exactUsedKey:l,usedLng:h,usedNS:i,usedParams:this.getUsedParamsDetails(s)}:`${i}${d}${l}`:r?{res:l,usedKey:l,exactUsedKey:l,usedLng:h,usedNS:i,usedParams:this.getUsedParamsDetails(s)}:l;const p=this.resolve(t,s);let f=p?.res;const m=p?.usedKey||l,g=p?.exactUsedKey||l,y=["[object Number]","[object Function]","[object RegExp]"],b=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,k=!this.i18nFormat||this.i18nFormat.handleAsObject,w=s.count!==void 0&&!_(s.count),v=Kn.hasDefaultValue(s),S=w?this.pluralResolver.getSuffix(h,s.count,s):"",j=s.ordinal&&w?this.pluralResolver.getSuffix(h,s.count,{ordinal:!1}):"",O=w&&!s.ordinal&&s.count===0,A=O&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${S}`]||s[`defaultValue${j}`]||s.defaultValue;let E=f;k&&!f&&v&&(E=A);const x=Oo(E),L=Object.prototype.toString.apply(E);if(k&&E&&x&&!y.includes(L)&&!(_(b)&&Array.isArray(E))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const I=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,E,{...s,ns:c}):`key '${l} (${this.language})' returned an object instead of string.`;return r?(p.res=I,p.usedParams=this.getUsedParamsDetails(s),p):I}if(a){const I=Array.isArray(E),M=I?[]:{},ne=I?g:m;for(const q in E)if(Object.prototype.hasOwnProperty.call(E,q)){const N=`${ne}${a}${q}`;v&&!f?M[q]=this.translate(N,{...s,defaultValue:Oo(A)?A[q]:void 0,joinArrays:!1,ns:c}):M[q]=this.translate(N,{...s,joinArrays:!1,ns:c}),M[q]===N&&(M[q]=E[q])}f=M}}else if(k&&_(b)&&Array.isArray(f))f=f.join(b),f&&(f=this.extendTranslation(f,t,s,o));else{let I=!1,M=!1;!this.isValidLookup(f)&&v&&(I=!0,f=A),this.isValidLookup(f)||(M=!0,f=l);const q=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&M?void 0:f,N=v&&A!==f&&this.options.updateMissing;if(M||I||N){if(this.logger.log(N?"updateKey":"missingKey",h,i,w&&!N?`${l}${this.pluralResolver.getSuffix(h,s.count,s)}`:l,N?A:f),a){const $=this.resolve(l,{...s,keySeparator:!1});$&&$.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Z=[];const U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&U&&U[0])for(let $=0;$<U.length;$++)Z.push(U[$]);else this.options.saveMissingTo==="all"?Z=this.languageUtils.toResolveHierarchy(s.lng||this.language):Z.push(s.lng||this.language);const oe=($,T,C)=>{const R=v&&C!==f?C:q;this.options.missingKeyHandler?this.options.missingKeyHandler($,i,T,R,N,s):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing($,i,T,R,N,s),this.emit("missingKey",$,i,T,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?Z.forEach($=>{const T=this.pluralResolver.getSuffixes($,s);O&&s[`defaultValue${this.options.pluralSeparator}zero`]&&!T.includes(`${this.options.pluralSeparator}zero`)&&T.push(`${this.options.pluralSeparator}zero`),T.forEach(C=>{oe([$],l+C,s[`defaultValue${C}`]||A)})}):oe(Z,l,A))}f=this.extendTranslation(f,t,s,p,o),M&&f===l&&this.options.appendNamespaceToMissingKey&&(f=`${i}${d}${l}`),(M||I)&&this.options.parseMissingKeyHandler&&(f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${i}${d}${l}`:l,I?f:void 0,s))}return r?(p.res=f,p.usedParams=this.getUsedParamsDetails(s),p):f}extendTranslation(t,n,o,s,r){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const c=_(t)&&(o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let i;if(c){const h=t.match(this.interpolator.nestingRegexp);i=h&&h.length}let d=o.replace&&!_(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,o.lng||this.language||s.usedLng,o),c){const h=t.match(this.interpolator.nestingRegexp),u=h&&h.length;i<u&&(o.nest=!1)}!o.lng&&s&&s.res&&(o.lng=this.language||s.usedLng),o.nest!==!1&&(t=this.interpolator.nest(t,(...h)=>r?.[0]===h[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):this.translate(...h,n),o)),o.interpolation&&this.interpolator.reset()}const a=o.postProcess||this.options.postProcess,l=_(a)?[a]:a;return t!=null&&l?.length&&o.applyPostProcessor!==!1&&(t=uc.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),t}resolve(t,n={}){let o,s,r,a,l;return _(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(c=>typeof c=="function"?Ot(c,{...this.options,...n}):c)),t.forEach(c=>{if(this.isValidLookup(o))return;const i=this.extractFromKey(c,n),d=i.key;s=d;let h=i.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const u=n.count!==void 0&&!_(n.count),p=u&&!n.ordinal&&n.count===0,f=n.context!==void 0&&(_(n.context)||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(g=>{this.isValidLookup(o)||(l=g,!this.checkedLoadedFor[`${m[0]}-${g}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(l)&&(this.checkedLoadedFor[`${m[0]}-${g}`]=!0,this.logger.warn(`key "${s}" for languages "${m.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(y=>{if(this.isValidLookup(o))return;a=y;const b=[d];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(b,d,y,g,n);else{let w;u&&(w=this.pluralResolver.getSuffix(y,n.count,n));const v=`${this.options.pluralSeparator}zero`,S=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(n.ordinal&&w.startsWith(S)&&b.push(d+w.replace(S,this.options.pluralSeparator)),b.push(d+w),p&&b.push(d+v)),f){const j=`${d}${this.options.contextSeparator||"_"}${n.context}`;b.push(j),u&&(n.ordinal&&w.startsWith(S)&&b.push(j+w.replace(S,this.options.pluralSeparator)),b.push(j+w),p&&b.push(j+v))}}let k;for(;k=b.pop();)this.isValidLookup(o)||(r=k,o=this.getResource(y,g,k,n))}))})}),{res:o,usedKey:s,exactUsedKey:r,usedLng:a,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,o,s={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,n,o,s):this.resourceStore.getResource(t,n,o,s)}getUsedParamsDetails(t={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=t.replace&&!_(t.replace);let s=o?t.replace:t;if(o&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!o){s={...s};for(const r of n)delete s[r]}return s}static hasDefaultValue(t){const n="defaultValue";for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&o.startsWith(n)&&t[o]!==void 0)return!0;return!1}}class da{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Be.create("languageUtils")}getScriptPartFromCode(t){if(t=on(t),!t||!t.includes("-"))return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=on(t),!t||!t.includes("-"))return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(_(t)&&t.includes("-")){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(o=>{if(n)return;const s=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(o=>{if(n)return;const s=this.getScriptPartFromCode(o);if(this.isSupportedCode(s))return n=s;const r=this.getLanguagePartFromCode(o);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(a=>a===r?!0:!a.includes("-")&&!r.includes("-")?!1:!!(a.includes("-")&&!r.includes("-")&&a.slice(0,a.indexOf("-"))===r||a.startsWith(r)&&r.length>1))}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),_(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let o=t[n];return o||(o=t[this.getScriptPartFromCode(n)]),o||(o=t[this.formatLanguageCode(n)]),o||(o=t[this.getLanguagePartFromCode(n)]),o||(o=t.default),o||[]}toResolveHierarchy(t,n){const o=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],t),s=[],r=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return _(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&r(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&r(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&r(this.getLanguagePartFromCode(t))):_(t)&&r(this.formatLanguageCode(t)),o.forEach(a=>{s.includes(a)||r(this.formatLanguageCode(a))}),s}}const ua={zero:0,one:1,two:2,few:3,many:4,other:5},ha={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Ju{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=Be.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const o=on(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:o,type:s});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let a;try{a=new Intl.PluralRules(o,{type:s})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),ha;if(!t.match(/-|_/))return ha;const c=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(c,n)}return this.pluralRulesCache[r]=a,a}needsPlural(t,n={}){let o=this.getRule(t,n);return o||(o=this.getRule("dev",n)),o?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,n,o={}){return this.getSuffixes(t,o).map(s=>`${n}${s}`)}getSuffixes(t,n={}){let o=this.getRule(t,n);return o||(o=this.getRule("dev",n)),o?o.resolvedOptions().pluralCategories.sort((s,r)=>ua[s]-ua[r]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(t,n,o={}){const s=this.getRule(t,o);return s?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,o))}}const pa=(e,t,n,o=".",s=!0)=>{let r=Bu(e,t,n);return!r&&s&&_(n)&&(r=qs(e,n,o),r===void 0&&(r=qs(t,n,o))),r},Eo=e=>e.replace(/\$/g,"$$$$");class fa{constructor(t={}){this.logger=Be.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(n=>n),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:o,useRawValueToEscape:s,prefix:r,prefixEscaped:a,suffix:l,suffixEscaped:c,formatSeparator:i,unescapeSuffix:d,unescapePrefix:h,nestingPrefix:u,nestingPrefixEscaped:p,nestingSuffix:f,nestingSuffixEscaped:m,nestingOptionsSeparator:g,maxReplaces:y,alwaysFormat:b}=t.interpolation;this.escape=n!==void 0?n:zu,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=r?Ke(r):a||"{{",this.suffix=l?Ke(l):c||"}}",this.formatSeparator=i||",",this.unescapePrefix=d?"":h?Ke(h):"-",this.unescapeSuffix=this.unescapePrefix?"":d?Ke(d):"",this.nestingPrefix=u?Ke(u):p||Ke("$t("),this.nestingSuffix=f?Ke(f):m||Ke(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=y||1e3,this.alwaysFormat=b!==void 0?b:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,o)=>n?.source===o?(n.lastIndex=0,n):new RegExp(o,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,n,o,s){let r,a,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},i=p=>{if(!p.includes(this.formatSeparator)){const y=pa(n,c,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,o,{...s,...n,interpolationkey:p}):y}const f=p.split(this.formatSeparator),m=f.shift().trim(),g=f.join(this.formatSeparator).trim();return this.format(pa(n,c,m,this.options.keySeparator,this.options.ignoreJSONStructure),g,o,{...s,...n,interpolationkey:m})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const d=s?.missingInterpolationHandler||this.options.missingInterpolationHandler,h=s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>Eo(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?Eo(this.escape(p)):Eo(p)}].forEach(p=>{for(l=0;r=p.regex.exec(t);){const f=r[1].trim();if(a=i(f),a===void 0)if(typeof d=="function"){const g=d(t,r,s);a=_(g)?g:""}else if(s&&Object.prototype.hasOwnProperty.call(s,f))a="";else if(h){a=r[0];continue}else this.logger.warn(`missed to pass in variable ${f} for interpolating ${t}`),a="";else!_(a)&&!this.useRawValueToEscape&&(a=ra(a));const m=p.safeValue(a);if(t=t.replace(r[0],m),h?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=r[0].length):p.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n,o={}){let s,r,a;const l=(c,i)=>{const d=this.nestingOptionsSeparator;if(!c.includes(d))return c;const h=c.split(new RegExp(`${Ke(d)}[ ]*{`));let u=`{${h[1]}`;c=h[0],u=this.interpolate(u,a);const p=u.match(/'/g),f=u.match(/"/g);((p?.length??0)%2===0&&!f||(f?.length??0)%2!==0)&&(u=u.replace(/'/g,'"'));try{a=JSON.parse(u),i&&(a={...i,...a})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,m),`${c}${d}${u}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];a={...o},a=a.replace&&!_(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const i=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(i!==-1&&(c=s[1].slice(i).split(this.formatSeparator).map(d=>d.trim()).filter(Boolean),s[1]=s[1].slice(0,i)),r=n(l.call(this,s[1].trim(),a),a),r&&s[0]===t&&!_(r))return r;_(r)||(r=ra(r)),r||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),r=""),c.length&&(r=c.reduce((d,h)=>this.format(d,h,o.lng,{...o,interpolationkey:s[1].trim()}),r.trim())),t=t.replace(s[0],r),this.regexp.lastIndex=0}return t}}const Zu=e=>{let t=e.toLowerCase().trim();const n={};if(e.includes("(")){const o=e.split("(");t=o[0].toLowerCase().trim();const s=o[1].slice(0,-1);t==="currency"&&!s.includes(":")?n.currency||(n.currency=s.trim()):t==="relativetime"&&!s.includes(":")?n.range||(n.range=s.trim()):s.split(";").forEach(a=>{if(a){const[l,...c]=a.split(":"),i=c.join(":").trim().replace(/^'+|'+$/g,""),d=l.trim();n[d]||(n[d]=i),i==="false"&&(n[d]=!1),i==="true"&&(n[d]=!0),isNaN(i)||(n[d]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},ma=e=>{const t={};return(n,o,s)=>{let r=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(r={...r,[s.interpolationkey]:void 0});const a=o+JSON.stringify(r);let l=t[a];return l||(l=e(on(o),s),t[a]=l),l(n)}},Xu=e=>(t,n,o)=>e(on(n),o)(t);class Qu{constructor(t={}){this.logger=Be.create("formatter"),this.options=t,this.init(t)}init(t,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const o=n.cacheInBuiltFormats?ma:Xu;this.formats={number:o((s,r)=>{const a=new Intl.NumberFormat(s,{...r});return l=>a.format(l)}),currency:o((s,r)=>{const a=new Intl.NumberFormat(s,{...r,style:"currency"});return l=>a.format(l)}),datetime:o((s,r)=>{const a=new Intl.DateTimeFormat(s,{...r});return l=>a.format(l)}),relativetime:o((s,r)=>{const a=new Intl.RelativeTimeFormat(s,{...r});return l=>a.format(l,r.range||"day")}),list:o((s,r)=>{const a=new Intl.ListFormat(s,{...r});return l=>a.format(l)})}}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=ma(n)}format(t,n,o,s={}){if(!n||t==null)return t;const r=n.split(this.formatSeparator),a=[];for(let c=0;c<r.length;c++){let i=r[c];for(;i.indexOf("(")>-1&&!i.includes(")")&&c+1<r.length;)i=`${i}${this.formatSeparator}${r[++c]}`;a.push(i)}return a.reduce((c,i)=>{const{formatName:d,formatOptions:h}=Zu(i);if(this.formats[d]){let u=c;try{const p=s?.formatParams?.[s.interpolationkey]||{},f=p.locale||p.lng||s.locale||s.lng||o;u=this.formats[d](c,f,{...h,...s,...p})}catch(p){this.logger.warn(p)}return u}else this.logger.warn(`there was no format function for ${d}`);return c},t)}}const eh=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class th extends ao{constructor(t,n,o,s={}){super(),this.backend=t,this.store=n,this.services=o,this.languageUtils=o.languageUtils,this.options=s,this.logger=Be.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(o,s.backend,s)}queueLoad(t,n,o,s){const r={},a={},l={},c={};return t.forEach(i=>{let d=!0;n.forEach(h=>{const u=`${i}|${h}`;!o.reload&&this.store.hasResourceBundle(i,h)?this.state[u]=2:this.state[u]<0||(this.state[u]===1?a[u]===void 0&&(a[u]=!0):(this.state[u]=1,d=!1,a[u]===void 0&&(a[u]=!0),r[u]===void 0&&(r[u]=!0),c[h]===void 0&&(c[h]=!0)))}),d||(l[i]=!0)}),(Object.keys(r).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(r),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,o){const s=t.split("|"),r=s[0],a=s[1];n&&this.emit("failedLoading",r,a,n),!n&&o&&this.store.addResourceBundle(r,a,o,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&o&&(this.state[t]=0);const l={};this.queue.forEach(c=>{Du(c.loaded,[r],a),eh(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(i=>{l[i]||(l[i]={});const d=c.loaded[i];d.length&&d.forEach(h=>{l[i][h]===void 0&&(l[i][h]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,o,s=0,r=this.retryTimeout,a){if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:o,tried:s,wait:r,callback:a});return}this.readingCalls++;const l=(i,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(i&&d&&s<this.maxRetries){setTimeout(()=>{this.read(t,n,o,s+1,r*2,a)},r);return}a(i,d)},c=this.backend[o].bind(this.backend);if(c.length===2){try{const i=c(t,n);i&&typeof i.then=="function"?i.then(d=>l(null,d)).catch(l):l(null,i)}catch(i){l(i)}return}return c(t,n,l)}prepareLoading(t,n,o={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();_(t)&&(t=this.languageUtils.toResolveHierarchy(t)),_(n)&&(n=[n]);const r=this.queueLoad(t,n,o,s);if(!r.toLoad.length)return r.pending.length||s(),null;r.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,o){this.prepareLoading(t,n,{},o)}reload(t,n,o){this.prepareLoading(t,n,{reload:!0},o)}loadOne(t,n=""){const o=t.split("|"),s=o[0],r=o[1];this.read(s,r,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${r} for language ${s} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${r} for language ${s}`,l),this.loaded(t,a,l)})}saveMissing(t,n,o,s,r,a={},l=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${o}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend?.create){const c={...a,isUpdate:r},i=this.backend.create.bind(this.backend);if(i.length<6)try{let d;i.length===5?d=i(t,n,o,s,c):d=i(t,n,o,s),d&&typeof d.then=="function"?d.then(h=>l(null,h)).catch(l):l(null,d)}catch(d){l(d)}else i(t,n,o,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,o,s)}}}const Co=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),_(e[1])&&(t.defaultValue=e[1]),_(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(o=>{t[o]=n[o]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ga=e=>(_(e.ns)&&(e.ns=[e.ns]),_(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),_(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),kn=()=>{},nh=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Jt extends ao{constructor(t={},n){if(super(),this.options=ga(t),this.services={},this.logger=Be,this.modules={external:[]},nh(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(t={},n){this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),t.defaultNS==null&&t.ns&&(_(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));const o=Co();this.options={...o,...this.options,...ga(t)},this.options.interpolation={...o.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=o.overloadTranslationOptionHandler);const s=i=>i?typeof i=="function"?new i:i:null;if(!this.options.isClone){this.modules.logger?Be.init(s(this.modules.logger),this.options):Be.init(null,this.options);let i;this.modules.formatter?i=this.modules.formatter:i=Qu;const d=new da(this.options);this.store=new ca(this.options.resources,this.options);const h=this.services;h.logger=Be,h.resourceStore=this.store,h.languageUtils=d,h.pluralResolver=new Ju(d,{prepend:this.options.pluralSeparator}),i&&(h.formatter=s(i),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new fa(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new th(s(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(u,...p)=>{this.emit(u,...p)}),this.modules.languageDetector&&(h.languageDetector=s(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=s(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new Kn(this.services,this.options),this.translator.on("*",(u,...p)=>{this.emit(u,...p)}),this.modules.external.forEach(u=>{u.init&&u.init(this)})}if(this.format=this.options.interpolation.format,n||(n=kn),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const i=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);i.length>0&&i[0]!=="dev"&&(this.options.lng=i[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(i=>{this[i]=(...d)=>this.store[i](...d)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(i=>{this[i]=(...d)=>(this.store[i](...d),this)});const l=qt(),c=()=>{const i=(d,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(h),n(d,h)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return i(null,this.t.bind(this));this.changeLanguage(this.options.lng,i)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),l}loadResources(t,n=kn){let o=n;const s=_(t)?t:this.language;if(typeof t=="function"&&(o=t),!this.options.resources||this.options.partialBundledLanguages){if(s?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const r=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(i=>{i!=="cimode"&&(r.includes(i)||r.push(i))})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>a(c)),this.options.preload?.forEach?.(l=>a(l)),this.services.backendConnector.load(r,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(l)})}else o(null)}reloadResources(t,n,o){const s=qt();return typeof t=="function"&&(o=t,t=void 0),typeof n=="function"&&(o=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),o||(o=kn),this.services.backendConnector.reload(t,n,r=>{s.resolve(),o(r)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&uc.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let n=0;n<this.languages.length;n++){const o=this.languages[n];if(!["cimode","dev"].includes(o)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&!this.languages.includes(t)&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,n){this.isLanguageChangingTo=t;const o=qt();this.emit("languageChanging",t);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},r=(l,c)=>{c?this.isLanguageChangingTo===t&&(s(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,o.resolve((...i)=>this.t(...i)),n&&n(l,(...i)=>this.t(...i))},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const c=_(l)?l:l&&l[0],i=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(_(l)?[l]:l);i&&(this.language||s(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector?.cacheUserLanguage?.(i)),this.loadResources(i,d=>{r(d,i)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),o}getFixedT(t,n,o,s){const r=s?.scopeNs,a=(l,c,...i)=>{let d;typeof c!="object"?d=this.options.overloadTranslationOptionHandler([l,c].concat(i)):d={...c},d.lng=d.lng||a.lng,d.lngs=d.lngs||a.lngs;const h=d.ns!==void 0&&d.ns!==null;d.ns=d.ns||a.ns,d.keyPrefix!==""&&(d.keyPrefix=d.keyPrefix||o||a.keyPrefix);const u={...this.options,...d};Array.isArray(r)&&!h&&(u.ns=r),typeof d.keyPrefix=="function"&&(d.keyPrefix=Ot(d.keyPrefix,u));const p=this.options.keySeparator||".";let f;return d.keyPrefix&&Array.isArray(l)?f=l.map(m=>(typeof m=="function"&&(m=Ot(m,u)),`${d.keyPrefix}${p}${m}`)):(typeof l=="function"&&(l=Ot(l,u)),f=d.keyPrefix?`${d.keyPrefix}${p}${l}`:l),this.t(f,d)};return _(t)?a.lng=t:a.lngs=t,a.ns=n,a.keyPrefix=o,a}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const i=this.services.backendConnector.state[`${l}|${c}`];return i===-1||i===0||i===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(o,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(o,t)&&(!s||a(r,t)))}loadNamespaces(t,n){const o=qt();return this.options.ns?(_(t)&&(t=[t]),t.forEach(s=>{this.options.ns.includes(s)||this.options.ns.push(s)}),this.loadResources(s=>{o.resolve(),n&&n(s)}),o):(n&&n(),Promise.resolve())}loadLanguages(t,n){const o=qt();_(t)&&(t=[t]);const s=this.options.preload||[],r=t.filter(a=>!s.includes(a)&&this.services.languageUtils.isSupportedCode(a));return r.length?(this.options.preload=s.concat(r),this.loadResources(a=>{o.resolve(),n&&n(a)}),o):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const s=new Intl.Locale(t);if(s&&s.getTextInfo){const r=s.getTextInfo();if(r&&r.direction)return r.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services?.languageUtils||new da(Co());return t.toLowerCase().indexOf("-latn")>1?"ltr":n.includes(o.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},n){const o=new Jt(t,n);return o.createInstance=Jt.createInstance,o}cloneInstance(t={},n=kn){const o=t.forkResourceStore;o&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},r=new Jt(s);if((t.debug!==void 0||t.prefix!==void 0)&&(r.logger=r.logger.clone(t)),["store","services","language"].forEach(l=>{r[l]=this[l]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},o){const l=Object.keys(this.store.data).reduce((c,i)=>(c[i]={...this.store.data[i]},c[i]=Object.keys(c[i]).reduce((d,h)=>(d[h]={...c[i][h]},d),c[i]),c),{});r.store=new ca(l,s),r.services.resourceStore=r.store}if(t.interpolation){const c={...Co().interpolation,...this.options.interpolation,...t.interpolation},i={...s,interpolation:c};r.services.interpolator=new fa(i)}return r.translator=new Kn(r.services,s),r.translator.on("*",(l,...c)=>{r.emit(l,...c)}),r.init(s,n),r.translator.options=s,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ge=Jt.createInstance();ge.createInstance;ge.dir;ge.init;ge.loadResources;ge.reloadResources;ge.use;ge.changeLanguage;ge.getFixedT;ge.t;ge.exists;ge.setDefaultNamespace;ge.hasLoadedNamespace;ge.loadNamespaces;ge.loadLanguages;let pc=ge;function oh(e){pc=e}function sh(){const e=pc.language;return e&&!e.startsWith("zh")?"en-US":"zh-CN"}function fe(e){return e[sh()]}const rh={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,oneOf:(e,t)=>`${e} 必须是 ${t.join("、")} 之一`,label:e=>`${e} 必须是不超过 20 字的文本`,confirm:e=>`${e} 必须是不超过 120 字的文本`,maxObjects:(e,t)=>`${e} 必须是 1 到 ${t} 的整数`,list:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,hitNeeds:e=>`${e} 要给出 { selection: 筛选 } 或 { set: 筛选 }:按钮没有点到的对象`,targetsShape:e=>`${e} 只能是 hit、{ selection } 或 { set }`,targetsNotFilter:(e,t,n)=>`${e} 不是页面上的${t==="set"?"对象集合":"选中对象"}筛选:${n}`,targetsOtherType:e=>`${e} 里的对象和行动作用的对象不是同一类`,paramNot:(e,t)=>`${e} 不是行动「${t}」要填的参数`,paramNoSource:(e,t)=>`${e} 没有给出来源:行动「${t}」要求填写它`,fromShape:e=>`${e} 必须是 { from, ... }`,notPageFilter:(e,t)=>`${e} 不是页面筛选:${t}`,constValue:e=>`${e} 必须是文本、数字或真假`,fromOneOf:e=>`${e} 只能是 input、var 或 const`,actionRequired:e=>`${e} 必填:知识网络里的行动`,needSource:e=>`${e} 需要先选好数据源`,notObjects:e=>`${e} 查询结果和事件不是网络里的对象,不能执行行动`,notAction:(e,t)=>`${e} 不是知识网络里的行动:${t}`,actionObject:(e,t,n,o)=>`${e} 行动「${t}」作用于 ${n??(o||"未绑定的对象")},和数据源的对象类不同`},ah={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,oneOf:(e,t)=>`${e} must be one of ${t.join(", ")}`,label:e=>`${e} must be text of at most 20 characters`,confirm:e=>`${e} must be text of at most 120 characters`,maxObjects:(e,t)=>`${e} must be an integer from 1 to ${t}`,list:(e,t)=>`${e} must be a list of at most ${t} items`,hitNeeds:e=>`${e} must give { selection: filter } or { set: filter }: a button has no clicked objects`,targetsShape:e=>`${e} must be hit, { selection } or { set }`,targetsNotFilter:(e,t,n)=>`${e} is not ${t==="set"?"an object set":"a selected object"} filter of the page: ${n}`,targetsOtherType:e=>`${e} holds objects of another type than the ones the action works on`,paramNot:(e,t)=>`${e} is not a parameter of action "${t}"`,paramNoSource:(e,t)=>`${e} has no source: action "${t}" requires it`,fromShape:e=>`${e} must be { from, ... }`,notPageFilter:(e,t)=>`${e} is not a page filter: ${t}`,constValue:e=>`${e} must be text, a number or a boolean`,fromOneOf:e=>`${e} must be input, var or const`,actionRequired:e=>`${e} is required: an action of the knowledge network`,needSource:e=>`${e} needs a source to be chosen first`,notObjects:e=>`${e} query results and events are not objects of the network, so no action can run on them`,notAction:(e,t)=>`${e} is not an action of the knowledge network: ${t}`,actionObject:(e,t,n,o)=>`${e} action "${t}" acts on ${n??(o||"an unbound object")}, which is not the object type of the source`},Cr=()=>fe({"zh-CN":rh,"en-US":ah}),Fs=100;function ln(e,t){return e.actionTypes?.find(n=>n.id===t)}function Yn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ih(e,t,n,o,s){const r=Cr();if(e===void 0||e==="hit")return t?[]:[r.hitNeeds(s)];if(!Yn(e))return[r.targetsShape(s)];const a="selection"in e?"selection":"set"in e?"set":null,l=a?e[a]:void 0;if(!a||typeof l!="string"||Object.keys(e).length!==1)return[r.targetsShape(s)];const c=n.variables.find(d=>d.name===l);return!c||c.kind!==a?[r.targetsNotFilter(`${s}.${a}`,a,l)]:("source"in c?ue(n,c.source)?.objectType:void 0)===o?[]:[r.targetsOtherType(`${s}.${a}`)]}function lh(e,t,n,o){const s=Cr();if(e!==void 0&&!Yn(e))return[s.object(o)];const r=e??{},a=new Set(t.inputs.map(c=>c.name)),l=Object.keys(r).filter(c=>!a.has(c)).map(c=>s.paramNot(`${o}.${c}`,t.name));for(const c of t.inputs){const i=r[c.name],d=`${o}.${c.name}`;if(i===void 0){c.property||l.push(s.paramNoSource(d,t.name));continue}if(!Yn(i)){l.push(s.fromShape(d));continue}i.from==="input"?i.label!==void 0&&(typeof i.label!="string"||i.label.length>20)&&l.push(s.label(`${d}.label`)):i.from==="var"?n.variables.some(h=>h.name===i.variable)||l.push(s.notPageFilter(`${d}.variable`,String(i.variable))):i.from==="const"?["string","number","boolean"].includes(typeof i.value)||l.push(s.constValue(`${d}.value`)):l.push(s.fromOneOf(`${d}.from`))}return l}function fc(e,t,n,o,s){const r=Cr();if(!Yn(e))return[r.object(s)];const a=new Set(["on","action","label","targets","params","confirm","maxObjects"]),l=Object.keys(e).filter(h=>!a.has(h)).map(h=>r.noOption(s,h));if(t.on.includes(e.on)||l.push(r.oneOf(`${s}.on`,t.on)),e.label!==void 0&&(typeof e.label!="string"||e.label.length>20)&&l.push(r.label(`${s}.label`)),e.confirm!==void 0&&(typeof e.confirm!="string"||e.confirm.length>120)&&l.push(r.confirm(`${s}.confirm`)),e.maxObjects!==void 0&&(typeof e.maxObjects!="number"||!Number.isInteger(e.maxObjects)||e.maxObjects<1||e.maxObjects>Fs)&&l.push(r.maxObjects(`${s}.maxObjects`,Fs)),typeof e.action!="string"||!e.action)return l.push(r.actionRequired(`${s}.action`)),l;const c=ue(n.spec,o);if(!c)return[...l,r.needSource(s)];const i=n.spec.sources.find(h=>h.id===(c.from?.source??c.id));if(c.cypher||i?.cypher||c.events)return[...l,r.notObjects(s)];if(!n.kn.actionTypes)return l;const d=ln(n.kn,e.action);return d?(d.objectType!==c.objectType&&l.push(r.actionObject(`${s}.action`,d.name,n.kn.objectTypes[d.objectType]?.name,d.objectType)),l.push(...ih(e.targets,t.hit,n.spec,c.objectType,`${s}.targets`)),l.push(...lh(e.params,d,n.spec,`${s}.params`)),l):[...l,r.notAction(`${s}.action`,e.action)]}const Ds=["workbench","dashboard","detail","free"],mc={workbench:["side","main","aside"],dashboard:["header","grid"],detail:["header","main","aside"],free:["cells"]},At=12,Ve=["asOfSlider","dateRange","metricCards","segmentedFilter","dropdownFilter","searchBox","text","objectTable","objectList","pivotTable","trendChart","regionMap","ganttChart","scheduleGantt","stageChain","subgraph","agentChat","alertList","eventList","eventReport","taskInbox","actionButton","scenarioBar","modelTrial"],Nr=new Set(["taskInbox"]),ch=/^x-[a-z0-9-]+\.[A-Za-z][A-Za-z0-9]*$/,Rt=e=>typeof e=="string"&&ch.test(e),gc={asOfSlider:[4,2],dateRange:[3,2],metricCards:[4,3],segmentedFilter:[3,2],dropdownFilter:[3,2],searchBox:[3,2],text:[2,2],objectTable:[4,6],objectList:[3,5],pivotTable:[3,5],trendChart:[4,5],regionMap:[3,6],ganttChart:[4,5],scheduleGantt:[6,7],stageChain:[3,3],subgraph:[3,6],agentChat:[3,7],alertList:[3,5],eventList:[4,5],eventReport:[2,2],taskInbox:[4,5],actionButton:[2,2],scenarioBar:[4,2],modelTrial:[6,7]},dh=8,uh=5,me="objectDetail",xr=12,Bs=["none","subtle","strong"],Us=["compact","comfortable"],_t=["card","plain"],Pt=["neutral","info","success","warning","danger"],he="$asOf",Gn=["isSet","isEmpty","eq","ne","in","before","onOrBefore","after","onOrAfter","gt","gte","lt","lte"],Zt=["classify","days","formula","related","region","text","matched"],ya=["china","world"],zs=["count","sum","avg","min","max","one","list"],le={status:"$status",stage:"$stage",overdueDays:"$overdueDays",dueInDays:"$dueInDays"},re={done:{value:"done",label:"已完成",tone:"success"},overdue:{value:"overdue",label:"已超期",tone:"danger"},active:{value:"active",label:"进行中",tone:"info"}},Ws=6,ba=4,cn="$scenarioMark",In={edited:{value:"edited",label:"改动",tone:"warning"},followed:{value:"followed",label:"联动",tone:"info"},related:{value:"related",label:"相关",tone:"neutral"}},Ks=["shiftDays","add","set","fromAsOf"],Ys=["scenario","user"],Hn=["asOf","value","dateRange","search","selection","set"],wa=["value","dateRange","search","set"],ka=["auto","manual"],va=["filter","select","none"],hh=["P1","P2","P3","P4"],Gs=["text","number","date"],Hs=["none","property","batch"],$a=/(^|_)(id|key|code|no)$/i,ph=/(主键|编号|编码|单号|单据号|代码|\bID\b|\bNo\.?$)/i;function Sa(e,t){const n=e.filter(o=>o.type==="text"&&!t?.primaryKeys.includes(o.name));return n.find(o=>o.name!==t?.displayKey&&!$a.test(o.name)&&!ph.test(o.label))??n.find(o=>o.name!==t?.displayKey&&!$a.test(o.name))??n[0]}function No(e,t){const n=t.objectTypes[e.objectType],o=n?.displayKey;return!e.cypher&&o&&n.properties.some(s=>s.name===o)?o:e.key}function io(e){return e.operation==="tool"?"tool":e.operation==="relation"?"relation":e.kind==="add"?"create":"modify"}const fh=new Set(["date","datetime","timestamp"]),mh=new Set(["integer","unsigned integer","float","decimal","int","long","short","double","bigint","smallint","tinyint","number","numeric","real"]),gh=new Set(["binary","vector","shape","point"]);function yh(e){const t=e.toLowerCase().replace(/\s+/g," ").trim();return fh.has(t)?"date":mh.has(t)?"number":"text"}function bh(e){return e.kind==="matched"?e.field?e.type??"text":"number":e.kind==="related"?e.aggregate==="one"?e.type??"text":e.aggregate==="list"?"text":"number":e.kind==="classify"||e.kind==="region"||e.kind==="text"?"text":"number"}function Rr(e){return{name:e.name,label:e.label,type:bh(e)}}function yc(e){if(!e)return[];const t=[{name:le.status,label:"进度状态",type:"text"},{name:le.stage,label:"当前步骤",type:"text"}];return e.due&&t.push({name:le.overdueDays,label:"超期天数",type:"number"},{name:le.dueInDays,label:"距截止天数",type:"number"}),t}function wh(e){return!!(e.operations?.length||e.follows?.length||e.relatedTo?.length)}const kh={name:cn,label:"方案标记",type:"text"};function pe(e,t){return[...t.objectTypes[e.objectType]?.properties??[],...yc(e.progress),...(e.computed??[]).map(Rr),...wh(e)?[kh]:[]]}const ja="~";function vh(e){return e.startsWith(ja)?{id:e.slice(ja.length),reversed:!0}:{id:e,reversed:!1}}function dn(e,t,n){const o=[];let s=t;for(const r of n){const{id:a,reversed:l}=vh(r),c=e.relations.find(i=>i.id===a);if(!c)return null;if(l){if(c.target!==s)return null;o.push({relation:c,forward:!1,to:c.source})}else if(c.source===s)o.push({relation:c,forward:!0,to:c.target});else if(c.target===s)o.push({relation:c,forward:!1,to:c.source});else return null;s=o[o.length-1].to}return o}function $h(e,t,n){const o=dn(e,t,n);return o?[t,...o.map(s=>s.to)].map(s=>e.objectTypes[s]?.name??s).join(" → "):n.join(" → ")}const Sh={unknown:(e,t)=>`第 ${e} 个字符“${t}”无法识别`,empty:"公式是空的",unfinished:"公式没写完",unclosed:e=>`第 ${e} 个字符的括号没有闭合`,missing:(e,t)=>`第 ${e} 个字符“${t}”前缺少数字或字段`,extra:(e,t)=>`第 ${e} 个字符“${t}”多余`},jh={unknown:(e,t)=>`character ${e} "${t}" is not recognized`,empty:"the formula is empty",unfinished:"the formula is unfinished",unclosed:e=>`the parenthesis at character ${e} is not closed`,missing:(e,t)=>`a number or field is missing before character ${e} "${t}"`,extra:(e,t)=>`character ${e} "${t}" is unexpected`},bc=()=>fe({"zh-CN":Sh,"en-US":jh}),Aa=/(\d+(?:\.\d+)?)|(\$?[A-Za-z_][A-Za-z0-9_]*)|`([^`]+)`|([-+*/()])/y;function Ah(e){const t=bc(),n=[];let o=0;for(;o<e.length;){if(/\s/.test(e[o])){o++;continue}Aa.lastIndex=o;const s=Aa.exec(e);if(!s)return t.unknown(o+1,e[o]);const[r,a,l,c]=s;n.push({kind:a!==void 0?"number":l!==void 0||c!==void 0?"name":"op",text:c??r,at:o}),o+=s[0].length}return n}function wc(e){const t=bc(),n=Ah(e);if(typeof n=="string")return{ok:!1,error:n};if(n.length===0)return{ok:!1,error:t.empty};let o=0;const s=()=>n[o],r=d=>{throw new Error(d)},a=()=>{let d=l();for(;s()?.text==="+"||s()?.text==="-";)d={type:"binary",op:n[o++].text,left:d,right:l()};return d},l=()=>{let d=c();for(;s()?.text==="*"||s()?.text==="/";)d={type:"binary",op:n[o++].text,left:d,right:c()};return d},c=()=>s()?.text==="-"?(o++,{type:"negate",arg:c()}):i(),i=()=>{const d=n[o++];if(!d)return r(t.unfinished);if(d.kind==="number")return{type:"number",value:Number(d.text)};if(d.kind==="name")return{type:"field",name:d.text};if(d.text==="("){const h=a();return n[o++]?.text!==")"&&r(t.unclosed(d.at+1)),h}return r(t.missing(d.at+1,d.text))};try{const d=a();return o<n.length&&r(t.extra(n[o].at+1,n[o].text)),{ok:!0,node:d}}catch(d){return{ok:!1,error:d.message}}}function Xt(e){switch(e.type){case"number":return[];case"field":return[e.name];case"negate":return Xt(e.arg);case"binary":return[...Xt(e.left),...Xt(e.right)]}}const Th={sep:"、",object:e=>`${e} 必须是对象`,array:e=>`${e} 必须是数组`,valueNotTaken:(e,t,n,o)=>`${e} 的取值「${t}」不是 ${n} 的取值(可选:${o})`,fieldUnusable:(e,t)=>`${e}.field 不是可用的字段:${t}`,opOneOf:(e,t)=>`${e}.op 只能是 ${t}`,valuesList:e=>`${e}.values 必须是非空的文本列表`,refOrValue:(e,t)=>`${e} 要给 ref(字段或 ${t})或 value(值)其中一个`,refUnusable:(e,t)=>`${e}.ref 不是可用的字段:${t}`,needDateField:(e,t)=>`${e}.field 用 ${t} 比较时必须是日期字段`,otherDate:(e,t,n)=>`${e} 用 ${t} 比较时,另一边必须是日期字段、${n} 或 YYYY-MM-DD`,needNumberField:(e,t)=>`${e}.field 用 ${t} 比较时必须是数字字段`,otherNumber:(e,t)=>`${e} 用 ${t} 比较时,另一边必须是数字字段或数字`,textOrNumber:e=>`${e}.value 必须是文本或数字`,conditionList:e=>`${e} 必须是条件列表`,identifier:e=>`${e}.name 必须是字母开头的标识`,nameTaken:(e,t)=>`${e}.name ${t} 与已有属性或计算列重名`,nameReserved:(e,t)=>`${e}.name ${t} 是进度列的保留名`,required:e=>`${e} 必填`,kindOneOf:(e,t)=>`${e}.kind 只能是 ${t}`,cycle:(e,t)=>`${e} 计算列互相引用成环:${t}`,matchedName:(e,t)=>`「${e}」的「${t}」`,matchedCycle:(e,t)=>`${e} 这些匹配字段互相取值,形成了循环,都算不出来:${t}。请让其中一个直接取对方的原始属性,而不是对方的匹配字段。`,dateOrAsOf:(e,t)=>`${e} 必须是日期字段或 ${t}`,exprText:e=>`${e}.expr 必须是公式文本`,exprError:(e,t)=>`${e}.expr ${t}`,exprField:(e,t)=>`${e}.expr 里的 ${t} 不是可用的数字字段`,templateText:e=>`${e}.template 必须是非空文本,用 {字段名} 引用字段`,templateNoField:e=>`${e}.template 至少要用 {字段名} 引用一个字段`,templateField:(e,t)=>`${e}.template 里的 {${t}} 不是可用的字段`,fromText:e=>`${e}.from 必须是文本字段`,scopeOneOf:(e,t)=>`${e}.scope 只能是 ${t}`,relatedCypher:e=>`${e} Cypher 数据源暂不支持关联统计,可以把统计直接写进查询`,pathNeeded:e=>`${e}.path 必须是至少一条关系的路径`,pathUnreachable:(e,t)=>`${e}.path 不是从 ${t} 出发连通的关系路径`,aggregateOneOf:(e,t)=>`${e}.aggregate 只能是 ${t}`,endObjectType:"终点对象类",fieldOfProperty:(e,t)=>`${e}.field 必须是 ${t} 的属性`,typeOfTaken:(e,t)=>`${e}.type 必须是所取属性的类型:${t}`,typeListIsText:e=>`${e}.type 列出的值是文本,不用写 type`,fieldNumberProperty:(e,t)=>`${e}.field 必须是 ${t} 的数字属性`,typeOnlyOne:e=>`${e}.type 只有 one 需要写`,whereFixed:e=>`${e}.where 关联统计的条件只能和固定值比较`,matchedCypher:e=>`${e} Cypher 数据源不支持按字段匹配其他数据源`,otherSource:e=>`${e}.source 必须是另一个数据源`,otherSourceKind:e=>`${e}.source 必须是本应用中读取知识网络对象类的数据源(不能是子集)`,pairsCount:e=>`${e}.pairs 必须是 1 到 4 对字段`,otherProperty:(e,t)=>`${e}.other 必须是 ${t} 的属性`,typeOnlyWithField:e=>`${e}.type 只有取属性(field)时需要写`,valueText:e=>`${e}.value 必须是非空文本`,toneOneOf:(e,t)=>`${e}.tone 只能是 ${t}`},Oh={sep:", ",object:e=>`${e} must be an object`,array:e=>`${e} must be an array`,valueNotTaken:(e,t,n,o)=>`${e} value "${t}" is not a value of ${n} (one of: ${o})`,fieldUnusable:(e,t)=>`${e}.field is not an available field: ${t}`,opOneOf:(e,t)=>`${e}.op must be one of ${t}`,valuesList:e=>`${e}.values must be a non-empty list of text`,refOrValue:(e,t)=>`${e} needs exactly one of ref (a field or ${t}) and value`,refUnusable:(e,t)=>`${e}.ref is not an available field: ${t}`,needDateField:(e,t)=>`${e}.field must be a date field when compared with ${t}`,otherDate:(e,t,n)=>`${e}: when compared with ${t}, the other side must be a date field, ${n} or YYYY-MM-DD`,needNumberField:(e,t)=>`${e}.field must be a number field when compared with ${t}`,otherNumber:(e,t)=>`${e}: when compared with ${t}, the other side must be a number field or a number`,textOrNumber:e=>`${e}.value must be text or a number`,conditionList:e=>`${e} must be a list of conditions`,identifier:e=>`${e}.name must be an identifier starting with a letter`,nameTaken:(e,t)=>`${e}.name ${t} is already used by a property or computed column`,nameReserved:(e,t)=>`${e}.name ${t} is reserved for a progress column`,required:e=>`${e} is required`,kindOneOf:(e,t)=>`${e}.kind must be one of ${t}`,cycle:(e,t)=>`${e} computed columns read each other in a circle: ${t}`,matchedName:(e,t)=>`"${t}" of "${e}"`,matchedCycle:(e,t)=>`${e} these matched fields take values from each other in a circle, so none can be worked out: ${t}. Make one of them take the other source's own property instead of its matched field.`,dateOrAsOf:(e,t)=>`${e} must be a date field or ${t}`,exprText:e=>`${e}.expr must be formula text`,exprError:(e,t)=>`${e}.expr: ${t}`,exprField:(e,t)=>`${t} in ${e}.expr is not an available number field`,templateText:e=>`${e}.template must be non-empty text that refers to fields as {field}`,templateNoField:e=>`${e}.template must refer to at least one field as {field}`,templateField:(e,t)=>`{${t}} in ${e}.template is not an available field`,fromText:e=>`${e}.from must be a text field`,scopeOneOf:(e,t)=>`${e}.scope must be one of ${t}`,relatedCypher:e=>`${e}: a Cypher source does not support related counts yet; write the count into the query`,pathNeeded:e=>`${e}.path must be a path of at least one relation`,pathUnreachable:(e,t)=>`${e}.path is not a connected relation path starting at ${t}`,aggregateOneOf:(e,t)=>`${e}.aggregate must be one of ${t}`,endObjectType:"the end object type",fieldOfProperty:(e,t)=>`${e}.field must be a property of ${t}`,typeOfTaken:(e,t)=>`${e}.type must be the type of the property taken: ${t}`,typeListIsText:e=>`${e}.type: the listed values are text, so type is not needed`,fieldNumberProperty:(e,t)=>`${e}.field must be a number property of ${t}`,typeOnlyOne:e=>`${e}.type is only needed for one`,whereFixed:e=>`${e}.where: conditions of a related count can only compare with fixed values`,matchedCypher:e=>`${e}: a Cypher source does not support matching other sources by field`,otherSource:e=>`${e}.source must be another source`,otherSourceKind:e=>`${e}.source must be a source of this app that reads an object type of the knowledge network (not a subset)`,pairsCount:e=>`${e}.pairs must be 1 to 4 pairs of fields`,otherProperty:(e,t)=>`${e}.other must be a property of ${t}`,typeOnlyWithField:e=>`${e}.type is only needed when taking a property (field)`,valueText:e=>`${e}.value must be non-empty text`,toneOneOf:(e,t)=>`${e}.tone must be one of ${t}`},Je=()=>fe({"zh-CN":Th,"en-US":Oh}),Eh=/^[A-Za-z][A-Za-z0-9_]*$/,Ch=/^\d{4}-\d{2}-\d{2}$/,Nh=["before","onOrBefore","after","onOrAfter"],xh=["gt","gte","lt","lte"],kc=()=>[];function Ta(e,t,n,o){const s=n(e);if(s.length===0)return[];const r=Je();return t.filter(a=>typeof a=="string"&&!s.includes(a)).map(a=>r.valueNotTaken(o,String(a),e,s.join(r.sep)))}function Rh(e,t,n,o=kc){const s=Je();if(!Oe(e))return[s.object(n)];const r=d=>d===he?"date":t.find(h=>h.name===d)?.type,a=r(e.field);if(!a)return[s.fieldUnusable(n,String(e.field))];if(!Lt(e.op,Gn))return[s.opOneOf(n,Gn.join(s.sep))];const l=e.op;if(l==="isSet"||l==="isEmpty")return[];if(l==="in")return Array.isArray(e.values)&&e.values.length>0&&e.values.every(d=>typeof d=="string")?Ta(String(e.field),e.values,o,`${n}.values`):[s.valuesList(n)];const c=e.ref!==void 0;if(c===(e.value!==void 0))return[s.refOrValue(n,he)];const i=c?r(e.ref):void 0;return c&&!i?[s.refUnusable(n,String(e.ref))]:Nh.includes(l)?a!=="date"?[s.needDateField(n,l)]:(c?i==="date":typeof e.value=="string"&&Ch.test(e.value))?[]:[s.otherDate(n,l,he)]:xh.includes(l)?a!=="number"?[s.needNumberField(n,l)]:(c?i==="number":typeof e.value=="number")?[]:[s.otherNumber(n,l)]:c?[]:typeof e.value!="string"&&typeof e.value!="number"?[s.textOrNumber(n)]:Ta(String(e.field),[e.value],o,`${n}.value`)}function xe(e,t,n,o=kc){return Array.isArray(e)?e.flatMap((s,r)=>Rh(s,t,`${n}[${r}]`,o)):[Je().conditionList(n)]}function vc(e,t=!1){return n=>{if(t&&n===le.status)return jc.map(s=>s.value);if(n===cn)return Wh.map(s=>s.value);const o=e.find(s=>Oe(s)&&s.name===n&&s.kind==="classify"&&Array.isArray(s.cases)&&Oe(s.otherwise));return o?[...o.cases,o.otherwise].map(s=>Oe(s)?s.value:void 0).filter(s=>typeof s=="string"):[]}}const Vs=e=>(e??[]).flatMap(t=>[t.field,t.ref].filter(n=>typeof n=="string"&&n!==he)),_h=/\{([^{}]+)\}/g;function $c(e){return[...new Set([...e.matchAll(_h)].map(t=>t[1].trim()))]}function _r(e){switch(e.kind){case"classify":return e.cases.flatMap(t=>Vs(t.when));case"days":return[e.from,e.to,...Vs(e.when)].filter(t=>t!==he);case"formula":{const t=wc(e.expr);return t.ok?Xt(t.node):[]}case"related":return[];case"matched":return[];case"region":return[e.from];case"text":return $c(e.template)}}function Ph(e){const t=new Set(e.map(r=>r.name)),n=new Set,o=[];let s=[...e];for(;s.length>0;){const r=s.filter(a=>_r(a).every(l=>!t.has(l)||l===a.name||n.has(l)));if(r.length===0)return[...o,...s];for(const a of r)o.push(a),n.add(a.name);s=s.filter(a=>!r.includes(a))}return o}function Lh(e){const t=Ph(e),n=new Set(e.map(r=>r.name)),o=new Set,s=[];for(const r of t)_r(r).some(a=>n.has(a)&&!o.has(a))&&s.push(r.name),o.add(r.name);return s}function Sc(e){return Array.isArray(e)?e.filter(t=>Oe(t)&&typeof t.name=="string"&&Lt(t.kind,Zt)):[]}function Ih(e){try{return _r(e)??[]}catch{return[]}}const xo=e=>typeof e=="string"&&e!==""?[e]:[];function Mh(e){const t=h=>e.find(u=>u.id===h)?.from?.source??h,n=h=>Sc(h.computed),o=e.filter(h=>Oe(h)&&!h.from&&n(h).length>0),s=new Map(o.map(h=>[h.id,new Set(n(h).map(u=>u.name))])),r=(h,u)=>`${h}\0${u}`,a=(h,u)=>u.filter(p=>s.get(h)?.has(p)).map(p=>r(h,p)),l=[];for(const h of o)for(const u of n(h)){const p=r(h.id,u.name);let f;if(u.kind==="matched"){const m=t(String(u.source)),g=Array.isArray(u.pairs)?u.pairs.filter(y=>Oe(y)):[];f=[...a(h.id,g.flatMap(y=>xo(y?.field))),...a(m,[...g.flatMap(y=>xo(y?.other)),...xo(u.field),...Vs(Array.isArray(u.where)?u.where.filter(y=>Oe(y)):void 0)])]}else f=a(h.id,Ih(u));l.push({id:p,ref:{source:h.id,field:u},reads:f.filter(m=>m!==p)})}const c=new Set,i=[];let d=l;for(;d.length>0;){const h=d.filter(u=>u.reads.every(p=>c.has(p)));if(h.length===0)break;for(const u of h)i.push(u.ref),c.add(u.id);d=d.filter(u=>!c.has(u.id))}return{order:i,stuck:d.map(h=>h.ref)}}const qh=new Set([...Object.values(le),cn]);function Fh(e,t,n,o){if(e===void 0)return[];const s=Je();if(!Array.isArray(e))return[s.array(n)];const r=[],a=vc(e,o.progress),l=e.filter(d=>Oe(d)&&typeof d.name=="string"&&Lt(d.kind,Zt)),c=new Set;e.forEach((d,h)=>{const u=`${n}[${h}]`;if(!Oe(d))return r.push(s.object(u));if(typeof d.name!="string"||!Eh.test(d.name))return r.push(s.identifier(u));if(t.some(f=>f.name===d.name)||c.has(d.name))return r.push(s.nameTaken(u,d.name));if(qh.has(d.name)&&o.progress)return r.push(s.nameReserved(u,d.name));if(c.add(d.name),(typeof d.label!="string"||d.label.trim()==="")&&r.push(s.required(`${u}.label`)),!Lt(d.kind,Zt))return r.push(s.kindOneOf(u,Zt.join(s.sep)));const p=l.filter(f=>f.name!==d.name).map(Rr);r.push(...Bh(d,[...t,...p],u,a,o))});const i=Lh(l);return i.length>0?r.push(s.cycle(n,i.join(s.sep))):o.sources&&o.source&&r.push(...Dh(n,o)),r}function Dh(e,t){const n=Je(),o=t.sources??[],{stuck:s}=Mh(o);if(!s.some(l=>l.source===t.source&&l.field.kind==="matched"))return[];const r=l=>o.find(c=>c.id===l)?.label??l,a=s.map(l=>n.matchedName(r(l.source),l.field.label||l.field.name)).join(n.sep);return[n.matchedCycle(e,a)]}function Bh(e,t,n,o,s){const r=Je(),a=l=>l===he||t.some(c=>c.name===l&&c.type==="date");switch(e.kind){case"classify":{const l=[];return Array.isArray(e.cases)?e.cases.forEach((c,i)=>{const d=`${n}.cases[${i}]`;l.push(...Oa(c,d)),Oe(c)&&l.push(...xe(c.when,t,`${d}.when`,o))}):l.push(r.array(`${n}.cases`)),l.push(...Oa(e.otherwise,`${n}.otherwise`)),l}case"days":return[...a(e.from)?[]:[r.dateOrAsOf(`${n}.from`,he)],...a(e.to)?[]:[r.dateOrAsOf(`${n}.to`,he)],...e.when===void 0?[]:xe(e.when,t,`${n}.when`,o)];case"formula":{if(typeof e.expr!="string")return[r.exprText(n)];const l=wc(e.expr);return l.ok?[...new Set(Xt(l.node))].filter(c=>!t.some(i=>i.name===c&&i.type==="number")).map(c=>r.exprField(n,c)):[r.exprError(n,l.error)]}case"related":return Uh(e,n,s);case"matched":return zh(e,n,s,t);case"text":{if(typeof e.template!="string"||e.template.trim()==="")return[r.templateText(n)];const l=$c(e.template);return l.length===0?[r.templateNoField(n)]:l.filter(c=>!t.some(i=>i.name===c)).map(c=>r.templateField(n,c))}default:return[...t.some(l=>l.name===e.from&&l.type==="text")?[]:[r.fromText(n)],...e.scope===void 0||ya.includes(e.scope)?[]:[r.scopeOneOf(n,ya.join(r.sep))]]}}function Uh(e,t,{kn:n,objectType:o,cypher:s}){const r=Je();if(s)return[r.relatedCypher(t)];if(!Array.isArray(e.path)||e.path.length===0)return[r.pathNeeded(t)];const a=dn(n,o,e.path);if(!a)return[r.pathUnreachable(t,o)];const l=n.objectTypes[a[a.length-1].to],c=l?.properties??[];if(!Lt(e.aggregate,zs))return[r.aggregateOneOf(t,zs.join(r.sep))];const i=[],d=c.find(h=>h.name===e.field);return e.aggregate==="one"||e.aggregate==="list"?d?e.aggregate==="one"&&e.type!==d.type?i.push(r.typeOfTaken(t,d.type)):e.aggregate==="list"&&e.type!==void 0&&e.type!=="text"&&i.push(r.typeListIsText(t)):i.push(r.fieldOfProperty(t,l?.name??r.endObjectType)):(e.aggregate!=="count"&&d?.type!=="number"&&i.push(r.fieldNumberProperty(t,l?.name??r.endObjectType)),e.type!==void 0&&i.push(r.typeOnlyOne(t))),e.where!==void 0&&(i.push(...xe(e.where,c,`${t}.where`)),Array.isArray(e.where)&&e.where.some(h=>Oe(h)&&(h.ref!==void 0||h.field===he))&&i.push(r.whereFixed(t))),i}function zh(e,t,{kn:n,objectType:o,cypher:s,sources:r},a){const l=Je();if(s)return[l.matchedCypher(t)];if(typeof e.source!="string"||e.source==="")return[l.otherSource(t)];const c=r?.find(h=>h.id===e.source);if(r&&(!c||c.cypher||c.events||c.model||c.from))return[l.otherSourceKind(t)];const i=c?[...n.objectTypes[c.objectType]?.properties??[],...Sc(c.computed).map(Rr)]:void 0,d=[];if(!Array.isArray(e.pairs)||e.pairs.length===0||e.pairs.length>4?d.push(l.pairsCount(t)):e.pairs.forEach((h,u)=>{const p=`${t}.pairs[${u}]`;return Oe(h)?(n.objectTypes[o]?.properties.some(m=>m.name===h.field)||a.some(m=>m.name===h.field)||d.push(l.fieldOfProperty(p,o)),i&&!i.some(m=>m.name===h.other)&&d.push(l.otherProperty(p,c?.objectType??"")),d):d.push(l.object(p))}),e.field!==void 0){const h=i?.find(u=>u.name===e.field);i&&!h?d.push(l.fieldOfProperty(t,c?.objectType??"")):h&&e.type!==h.type&&d.push(l.typeOfTaken(t,h.type))}else e.type!==void 0&&d.push(l.typeOnlyWithField(t));return e.where!==void 0&&i&&d.push(...xe(e.where,i,`${t}.where`)),d}function Oa(e,t){const n=Je();return Oe(e)?[...typeof e.value=="string"&&e.value.trim()!==""?[]:[n.valueText(t)],...e.tone===void 0||Lt(e.tone,Pt)?[]:[n.toneOneOf(t,Pt.join(n.sep))]]:[n.object(t)]}const jc=[re.done,re.overdue,re.active],Wh=[In.edited,In.followed,In.related];function un(e){return vc(e?.computed??[],!!e?.progress)}function Kh(e){return e?e.progress?!0:JSON.stringify(e.computed??[]).includes(`"${he}"`):!1}const Yh=`计算列(sources[].computed,可选):浏览器为数据源的每行算出的列;组件、筛选像普通属性一样用它们。计算列可以读数据源的属性、进度列和其他计算列,系统按依赖自动排顺序,不能互相引用成环。每项 { name, label, kind, ... },name 为字母开头的标识,不得与属性或进度列重名:
|
|
2
|
-
|
|
3
|
-
- days(算天数){ from, to, when? }:from 到 to 的天数(to 减 from),二者为日期字段或 ${he};when 不成立时为空。
|
|
1
|
+
import{spawnSync as gu,execFile as yu,spawn as bu}from"node:child_process";import{homedir as wu}from"node:os";import{join as G,extname as oc,posix as ku,relative as sc,sep as vu,dirname as At,resolve as tt}from"node:path";import{isDeepStrictEqual as $u,parseArgs as Su}from"node:util";import{readFileSync as ct,readdirSync as en,statSync as ju,existsSync as we,rmSync as ut,mkdirSync as Bn,writeFileSync as rc,rmdirSync as Au,watch as Tu,cpSync as jo,symlinkSync as Ou,lstatSync as ac,readlinkSync as Eu}from"node:fs";import Or from"process";import Cu from"buffer";import{deflateRawSync as Nu,inflateRawSync as xu}from"node:zlib";import{createHash as ic}from"node:crypto";import{request as Ru}from"node:http";import{request as _u}from"node:https";function It(e){const t=e?.trim().split(/[.@]/)[0];if(!(!t||t==="C"||t==="POSIX"))return/^zh/i.test(t)?"zh-CN":"en-US"}function oa(e,t=process.env){return It(e)??It(t.WORKSHOP_LANG)??It(t.LC_ALL)??It(t.LC_MESSAGES)??It(t.LANG)??"zh-CN"}function lc(e,t={}){return e.replace(/\{(\w+)\}/g,(n,o)=>o in t?String(t[o]):n)}let Un=null;function Pu(e){Un=e}function Lu(){return Un}function nt(){if(!Un)throw new Error("No Workshop host is installed: call installWorkshopHost first.");return Un}const st={get:(e,t)=>nt().http.get(e,t),delete:(e,t)=>nt().http.delete(e,t),post:(e,t,n)=>nt().http.post(e,t,n),put:(e,t,n)=>nt().http.put(e,t,n)},Is=["workbench","dashboard","detail","free"],cc={workbench:["side","main","aside"],dashboard:["header","grid"],detail:["header","main","aside"],free:["cells"]},Ms=["standard","fine"],ht={standard:{columns:12,scale:1,maxY:400,maxH:40,pinRowsMax:12},fine:{columns:24,scale:2,maxY:800,maxH:80,pinRowsMax:24}},Er=e=>e?.grid==="fine"?"fine":"standard",Ve=["asOfSlider","dateRange","metricCards","segmentedFilter","dropdownFilter","searchBox","text","objectTable","objectList","pivotTable","trendChart","regionMap","ganttChart","scheduleGantt","stageChain","subgraph","agentChat","alertList","eventList","eventReport","taskInbox","actionButton","scenarioBar","modelTrial"],Cr=new Set(["taskInbox"]),Iu=/^x-[a-z0-9-]+\.[A-Za-z][A-Za-z0-9]*$/,xt=e=>typeof e=="string"&&Iu.test(e),dc={asOfSlider:[4,2],dateRange:[3,2],metricCards:[4,3],segmentedFilter:[3,2],dropdownFilter:[3,2],searchBox:[3,2],text:[2,2],objectTable:[4,6],objectList:[3,5],pivotTable:[3,5],trendChart:[4,5],regionMap:[3,6],ganttChart:[4,5],scheduleGantt:[6,7],stageChain:[3,3],subgraph:[3,6],agentChat:[3,7],alertList:[3,5],eventList:[4,5],eventReport:[2,2],taskInbox:[4,5],actionButton:[2,2],scenarioBar:[4,2],modelTrial:[6,7]},uc={asOfSlider:[8,4],dateRange:[6,3],metricCards:[8,4],segmentedFilter:[6,3],dropdownFilter:[6,3],searchBox:[6,3],text:[4,2],objectTable:[8,10],objectList:[6,8],pivotTable:[6,7],trendChart:[8,8],regionMap:[6,10],ganttChart:[8,10],scheduleGantt:[12,14],stageChain:[6,5],subgraph:[6,12],agentChat:[6,14],alertList:[6,7],eventList:[8,10],eventReport:[4,3],taskInbox:[8,10],actionButton:[4,4],scenarioBar:[8,4],modelTrial:[12,14]},Mu=8,qu=5,Te="objectDetail",Fu=ht.fine.pinRowsMax,qs=["none","subtle","strong"],Fs=["compact","comfortable"],Rt=["card","plain"],_t=["neutral","info","success","warning","danger"],ue="$asOf",zn=["isSet","isEmpty","eq","ne","in","before","onOrBefore","after","onOrAfter","gt","gte","lt","lte"],Ht=["classify","days","formula","related","region","text","matched"],sa=["china","world"],Ds=["count","sum","avg","min","max","one","list"],le={status:"$status",stage:"$stage",overdueDays:"$overdueDays",dueInDays:"$dueInDays"},re={done:{value:"done",label:"已完成",tone:"success"},overdue:{value:"overdue",label:"已超期",tone:"danger"},active:{value:"active",label:"进行中",tone:"info"}},Bs=6,ra=4,rn="$scenarioMark",In={edited:{value:"edited",label:"改动",tone:"warning"},followed:{value:"followed",label:"联动",tone:"info"},related:{value:"related",label:"相关",tone:"neutral"}},Us=["shiftDays","add","set","fromAsOf"],zs=["scenario","user"],Wn=["asOf","value","dateRange","search","selection","set"],aa=["value","dateRange","search","set"],ia=["auto","manual"],la=["filter","select","none"],Du=["P1","P2","P3","P4"],Ws=["text","number","date"],Ks=["none","property","batch"],ca=/(^|_)(id|key|code|no)$/i,Bu=/(主键|编号|编码|单号|单据号|代码|\bID\b|\bNo\.?$)/i;function da(e,t){const n=e.filter(o=>o.type==="text"&&!t?.primaryKeys.includes(o.name));return n.find(o=>o.name!==t?.displayKey&&!ca.test(o.name)&&!Bu.test(o.label))??n.find(o=>o.name!==t?.displayKey&&!ca.test(o.name))??n[0]}function Ao(e,t){const n=t.objectTypes[e.objectType],o=n?.displayKey;return!e.cypher&&o&&n.properties.some(s=>s.name===o)?o:e.key}function an(e){return e.operation==="tool"?"tool":e.operation==="relation"?"relation":e.kind==="add"?"create":"modify"}const Uu=new Set(["date","datetime","timestamp"]),zu=new Set(["integer","unsigned integer","float","decimal","int","long","short","double","bigint","smallint","tinyint","number","numeric","real"]),Wu=new Set(["binary","vector","shape","point"]);function Ku(e){const t=e.toLowerCase().replace(/\s+/g," ").trim();return Uu.has(t)?"date":zu.has(t)?"number":"text"}function Yu(e){return e.kind==="matched"?e.field?e.type??"text":"number":e.kind==="related"?e.aggregate==="one"?e.type??"text":e.aggregate==="list"?"text":"number":e.kind==="classify"||e.kind==="region"||e.kind==="text"?"text":"number"}function Nr(e){return{name:e.name,label:e.label,type:Yu(e)}}function hc(e){if(!e)return[];const t=[{name:le.status,label:"进度状态",type:"text"},{name:le.stage,label:"当前步骤",type:"text"}];return e.due&&t.push({name:le.overdueDays,label:"超期天数",type:"number"},{name:le.dueInDays,label:"距截止天数",type:"number"}),t}function Gu(e){return!!(e.operations?.length||e.follows?.length||e.relatedTo?.length)}const Hu={name:rn,label:"方案标记",type:"text"};function he(e,t){return[...t.objectTypes[e.objectType]?.properties??[],...hc(e.progress),...(e.computed??[]).map(Nr),...Gu(e)?[Hu]:[]]}const ua="~";function Vu(e){return e.startsWith(ua)?{id:e.slice(ua.length),reversed:!0}:{id:e,reversed:!1}}function ln(e,t,n){const o=[];let s=t;for(const a of n){const{id:r,reversed:l}=Vu(a),c=e.relations.find(i=>i.id===r);if(!c)return null;if(l){if(c.target!==s)return null;o.push({relation:c,forward:!1,to:c.source})}else if(c.source===s)o.push({relation:c,forward:!0,to:c.target});else if(c.target===s)o.push({relation:c,forward:!1,to:c.source});else return null;s=o[o.length-1].to}return o}function Ju(e,t,n){const o=ln(e,t,n);return o?[t,...o.map(s=>s.to)].map(s=>e.objectTypes[s]?.name??s).join(" → "):n.join(" → ")}function Zu(e,t){if(!t.from)return t;const n=t.from.source;return e.sources.find(o=>o.id===n&&!o.from)}function pe(e,t){const n=e.sources.find(r=>r.id===t);if(!n?.from)return n;const o=Zu(e,n);if(!o)return;const s=ha.get(n);if(s?.base===o)return s.value;const a={...o,id:n.id,label:n.label,from:n.from};return ha.set(n,{base:o,value:a}),a}const ha=new WeakMap,_=e=>typeof e=="string",Mt=()=>{let e,t;const n=new Promise((o,s)=>{e=o,t=s});return n.resolve=e,n.reject=t,n},pa=e=>e==null?"":String(e),Xu=(e,t,n)=>{e.forEach(o=>{t[o]&&(n[o]=t[o])})},Qu=/###/g,fa=e=>e&&e.includes("###")?e.replace(Qu,"."):e,ma=e=>!e||_(e),Vt=(e,t,n)=>{const o=_(t)?t.split("."):t;let s=0;for(;s<o.length-1;){if(ma(e))return{};const a=fa(o[s]);!e[a]&&n&&(e[a]=new n),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={},++s}return ma(e)?{}:{obj:e,k:fa(o[s])}},ga=(e,t,n)=>{const{obj:o,k:s}=Vt(e,t,Object);if(o!==void 0||t.length===1){o[s]=n;return}let a=t[t.length-1],r=t.slice(0,t.length-1),l=Vt(e,r,Object);for(;l.obj===void 0&&r.length;)a=`${r[r.length-1]}.${a}`,r=r.slice(0,r.length-1),l=Vt(e,r,Object),l?.obj&&typeof l.obj[`${l.k}.${a}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${a}`]=n},eh=(e,t,n,o)=>{const{obj:s,k:a}=Vt(e,t,Object);s[a]=s[a]||[],s[a].push(n)},Kn=(e,t)=>{const{obj:n,k:o}=Vt(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,o))return n[o]},th=(e,t,n)=>{const o=Kn(e,n);return o!==void 0?o:Kn(t,n)},pc=(e,t,n)=>{for(const o in t)o!=="__proto__"&&o!=="constructor"&&(Object.prototype.hasOwnProperty.call(e,o)?_(e[o])||e[o]instanceof String||_(t[o])||t[o]instanceof String?n&&(e[o]=t[o]):pc(e[o],t[o],n):e[o]=t[o]);return e},We=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),nh={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},oh=e=>_(e)?e.replace(/[&<>"'\/]/g,t=>nh[t]):e;class sh{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const o=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,o),this.regExpQueue.push(t),o}}const rh=[" ",",","?","!",";"],ah=new sh(20),ih=(e,t,n)=>{t=t||"",n=n||"";const o=rh.filter(r=>!t.includes(r)&&!n.includes(r));if(o.length===0)return!0;const s=ah.getRegExp(`(${o.map(r=>r==="?"?"\\?":r).join("|")})`);let a=!s.test(e);if(!a){const r=e.indexOf(n);r>0&&!s.test(e.substring(0,r))&&(a=!0)}return a},Ys=(e,t,n=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const o=t.split(n);let s=e;for(let a=0;a<o.length;){if(!s||typeof s!="object")return;let r,l="";for(let c=a;c<o.length;++c)if(c!==a&&(l+=n),l+=o[c],r=s[l],r!==void 0){if(["string","number","boolean"].includes(typeof r)&&c<o.length-1)continue;a+=c-a+1;break}s=r}return s},tn=e=>e?.replace(/_/g,"-"),lh={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class Yn{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||lh,this.options=n,this.debug=n.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,o,s){return s&&!this.debug?null:(t=t.map(a=>_(a)?a.replace(/[\r\n\x00-\x1F\x7F]/g," "):a),_(t[0])&&(t[0]=`${o}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Yn(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Yn(this.logger,t)}}var Be=new Yn;class ro{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const s=this.observers[o].get(n)||0;this.observers[o].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}once(t,n){const o=(...s)=>{n(...s),this.off(t,o)};return this.on(t,o),this}emit(t,...n){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([s,a])=>{for(let r=0;r<a;r++)s(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,a])=>{for(let r=0;r<a;r++)s(t,...n)})}}class ya extends ro{constructor(t,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.includes(t)||this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,o,s={}){const a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,r=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.includes(".")?l=t.split("."):(l=[t,n],o&&(Array.isArray(o)?l.push(...o):_(o)&&a?l.push(...o.split(a)):l.push(o)));const c=Kn(this.data,l);return!c&&!n&&!o&&t.includes(".")&&(t=l[0],n=l[1],o=l.slice(2).join(".")),c||!r||!_(o)?c:Ys(this.data?.[t]?.[n],o,a)}addResource(t,n,o,s,a={silent:!1}){const r=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let l=[t,n];o&&(l=l.concat(r?o.split(r):o)),t.includes(".")&&(l=t.split("."),s=n,n=l[1]),this.addNamespaces(n),ga(this.data,l,s),a.silent||this.emit("added",t,n,o,s)}addResources(t,n,o,s={silent:!1}){for(const a in o)(_(o[a])||Array.isArray(o[a]))&&this.addResource(t,n,a,o[a],{silent:!0});s.silent||this.emit("added",t,n,o)}addResourceBundle(t,n,o,s,a,r={silent:!1,skipCopy:!1}){let l=[t,n];t.includes(".")&&(l=t.split("."),s=o,o=n,n=l[1]),this.addNamespaces(n);let c=Kn(this.data,l)||{};r.skipCopy||(o=JSON.parse(JSON.stringify(o))),s?pc(c,o,a):c={...c,...o},ga(this.data,l,c),r.silent||this.emit("added",t,n,o)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var fc={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,o,s){return e.forEach(a=>{t=this.processors[a]?.process(t,n,o,s)??t}),t}};const mc=Symbol("i18next/PATH_KEY");function ch(){const e=[],t=Object.create(null);let n;return t.get=(o,s)=>(n?.revoke?.(),s===mc?e:(e.push(s),n=Proxy.revocable(o,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Tt(e,t){const{[mc]:n}=e(ch()),o=t?.keySeparator??".",s=t?.nsSeparator??":",a=t?.enableSelector==="strict";if(n.length>1&&s){const r=t?.ns,l=a?Array.isArray(r)?r:r?[r]:null:Array.isArray(r)?r:null;if(l&&(a?l:l.length>1?l.slice(1):[]).includes(n[0]))return`${n[0]}${s}${n.slice(1).join(o)}`}return n.join(o)}const To=e=>!_(e)&&typeof e!="boolean"&&typeof e!="number";class Gn extends ro{constructor(t,n={}){super(),Xu(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Be.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,n={interpolation:{}}){const o={...n};if(t==null)return!1;const s=this.resolve(t,o);if(s?.res===void 0)return!1;const a=To(s.res);return!(o.returnObjects===!1&&a)}extractFromKey(t,n){let o=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let a=n.ns||this.options.defaultNS||[];const r=o&&t.includes(o),l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!ih(t,o,s);if(r&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:_(a)?[a]:a};const i=t.split(o);(o!==s||o===s&&this.options.ns.includes(i[0]))&&(a=i.shift()),t=i.join(s)}return{key:t,namespaces:_(a)?[a]:a}}translate(t,n,o){let s=typeof n=="object"?{...n}:n;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),t==null)return"";typeof t=="function"&&(t=Tt(t,{...this.options,...s})),Array.isArray(t)||(t=[String(t)]),t=t.map(q=>typeof q=="function"?Tt(q,{...this.options,...s}):String(q));const a=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,r=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:l,namespaces:c}=this.extractFromKey(t[t.length-1],s),i=c[c.length-1];let d=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;d===void 0&&(d=":");const h=s.lng||this.language,u=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(h?.toLowerCase()==="cimode")return u?a?{res:`${i}${d}${l}`,usedKey:l,exactUsedKey:l,usedLng:h,usedNS:i,usedParams:this.getUsedParamsDetails(s)}:`${i}${d}${l}`:a?{res:l,usedKey:l,exactUsedKey:l,usedLng:h,usedNS:i,usedParams:this.getUsedParamsDetails(s)}:l;const p=this.resolve(t,s);let f=p?.res;const m=p?.usedKey||l,g=p?.exactUsedKey||l,y=["[object Number]","[object Function]","[object RegExp]"],b=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,k=!this.i18nFormat||this.i18nFormat.handleAsObject,w=s.count!==void 0&&!_(s.count),v=Gn.hasDefaultValue(s),S=w?this.pluralResolver.getSuffix(h,s.count,s):"",j=s.ordinal&&w?this.pluralResolver.getSuffix(h,s.count,{ordinal:!1}):"",O=w&&!s.ordinal&&s.count===0,A=O&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${S}`]||s[`defaultValue${j}`]||s.defaultValue;let E=f;k&&!f&&v&&(E=A);const x=To(E),M=Object.prototype.toString.apply(E);if(k&&E&&x&&!y.includes(M)&&!(_(b)&&Array.isArray(E))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const q=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,E,{...s,ns:c}):`key '${l} (${this.language})' returned an object instead of string.`;return a?(p.res=q,p.usedParams=this.getUsedParamsDetails(s),p):q}if(r){const q=Array.isArray(E),L=q?[]:{},ne=q?g:m;for(const I in E)if(Object.prototype.hasOwnProperty.call(E,I)){const N=`${ne}${r}${I}`;v&&!f?L[I]=this.translate(N,{...s,defaultValue:To(A)?A[I]:void 0,joinArrays:!1,ns:c}):L[I]=this.translate(N,{...s,joinArrays:!1,ns:c}),L[I]===N&&(L[I]=E[I])}f=L}}else if(k&&_(b)&&Array.isArray(f))f=f.join(b),f&&(f=this.extendTranslation(f,t,s,o));else{let q=!1,L=!1;!this.isValidLookup(f)&&v&&(q=!0,f=A),this.isValidLookup(f)||(L=!0,f=l);const I=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&L?void 0:f,N=v&&A!==f&&this.options.updateMissing;if(L||q||N){if(this.logger.log(N?"updateKey":"missingKey",h,i,w&&!N?`${l}${this.pluralResolver.getSuffix(h,s.count,s)}`:l,N?A:f),r){const $=this.resolve(l,{...s,keySeparator:!1});$&&$.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Z=[];const U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&U&&U[0])for(let $=0;$<U.length;$++)Z.push(U[$]);else this.options.saveMissingTo==="all"?Z=this.languageUtils.toResolveHierarchy(s.lng||this.language):Z.push(s.lng||this.language);const oe=($,T,C)=>{const R=v&&C!==f?C:I;this.options.missingKeyHandler?this.options.missingKeyHandler($,i,T,R,N,s):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing($,i,T,R,N,s),this.emit("missingKey",$,i,T,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?Z.forEach($=>{const T=this.pluralResolver.getSuffixes($,s);O&&s[`defaultValue${this.options.pluralSeparator}zero`]&&!T.includes(`${this.options.pluralSeparator}zero`)&&T.push(`${this.options.pluralSeparator}zero`),T.forEach(C=>{oe([$],l+C,s[`defaultValue${C}`]||A)})}):oe(Z,l,A))}f=this.extendTranslation(f,t,s,p,o),L&&f===l&&this.options.appendNamespaceToMissingKey&&(f=`${i}${d}${l}`),(L||q)&&this.options.parseMissingKeyHandler&&(f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${i}${d}${l}`:l,q?f:void 0,s))}return a?(p.res=f,p.usedParams=this.getUsedParamsDetails(s),p):f}extendTranslation(t,n,o,s,a){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const c=_(t)&&(o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let i;if(c){const h=t.match(this.interpolator.nestingRegexp);i=h&&h.length}let d=o.replace&&!_(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,o.lng||this.language||s.usedLng,o),c){const h=t.match(this.interpolator.nestingRegexp),u=h&&h.length;i<u&&(o.nest=!1)}!o.lng&&s&&s.res&&(o.lng=this.language||s.usedLng),o.nest!==!1&&(t=this.interpolator.nest(t,(...h)=>a?.[0]===h[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):this.translate(...h,n),o)),o.interpolation&&this.interpolator.reset()}const r=o.postProcess||this.options.postProcess,l=_(r)?[r]:r;return t!=null&&l?.length&&o.applyPostProcessor!==!1&&(t=fc.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),t}resolve(t,n={}){let o,s,a,r,l;return _(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(c=>typeof c=="function"?Tt(c,{...this.options,...n}):c)),t.forEach(c=>{if(this.isValidLookup(o))return;const i=this.extractFromKey(c,n),d=i.key;s=d;let h=i.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const u=n.count!==void 0&&!_(n.count),p=u&&!n.ordinal&&n.count===0,f=n.context!==void 0&&(_(n.context)||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(g=>{this.isValidLookup(o)||(l=g,!this.checkedLoadedFor[`${m[0]}-${g}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(l)&&(this.checkedLoadedFor[`${m[0]}-${g}`]=!0,this.logger.warn(`key "${s}" for languages "${m.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(y=>{if(this.isValidLookup(o))return;r=y;const b=[d];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(b,d,y,g,n);else{let w;u&&(w=this.pluralResolver.getSuffix(y,n.count,n));const v=`${this.options.pluralSeparator}zero`,S=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(n.ordinal&&w.startsWith(S)&&b.push(d+w.replace(S,this.options.pluralSeparator)),b.push(d+w),p&&b.push(d+v)),f){const j=`${d}${this.options.contextSeparator||"_"}${n.context}`;b.push(j),u&&(n.ordinal&&w.startsWith(S)&&b.push(j+w.replace(S,this.options.pluralSeparator)),b.push(j+w),p&&b.push(j+v))}}let k;for(;k=b.pop();)this.isValidLookup(o)||(a=k,o=this.getResource(y,g,k,n))}))})}),{res:o,usedKey:s,exactUsedKey:a,usedLng:r,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,o,s={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,n,o,s):this.resourceStore.getResource(t,n,o,s)}getUsedParamsDetails(t={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=t.replace&&!_(t.replace);let s=o?t.replace:t;if(o&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!o){s={...s};for(const a of n)delete s[a]}return s}static hasDefaultValue(t){const n="defaultValue";for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&o.startsWith(n)&&t[o]!==void 0)return!0;return!1}}class ba{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Be.create("languageUtils")}getScriptPartFromCode(t){if(t=tn(t),!t||!t.includes("-"))return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=tn(t),!t||!t.includes("-"))return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(_(t)&&t.includes("-")){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(o=>{if(n)return;const s=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(o=>{if(n)return;const s=this.getScriptPartFromCode(o);if(this.isSupportedCode(s))return n=s;const a=this.getLanguagePartFromCode(o);if(this.isSupportedCode(a))return n=a;n=this.options.supportedLngs.find(r=>r===a?!0:!r.includes("-")&&!a.includes("-")?!1:!!(r.includes("-")&&!a.includes("-")&&r.slice(0,r.indexOf("-"))===a||r.startsWith(a)&&a.length>1))}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),_(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let o=t[n];return o||(o=t[this.getScriptPartFromCode(n)]),o||(o=t[this.formatLanguageCode(n)]),o||(o=t[this.getLanguagePartFromCode(n)]),o||(o=t.default),o||[]}toResolveHierarchy(t,n){const o=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],t),s=[],a=r=>{r&&(this.isSupportedCode(r)?s.push(r):this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`))};return _(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):_(t)&&a(this.formatLanguageCode(t)),o.forEach(r=>{s.includes(r)||a(this.formatLanguageCode(r))}),s}}const wa={zero:0,one:1,two:2,few:3,many:4,other:5},ka={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class dh{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=Be.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const o=tn(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:o,type:s});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];let r;try{r=new Intl.PluralRules(o,{type:s})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),ka;if(!t.match(/-|_/))return ka;const c=this.languageUtils.getLanguagePartFromCode(t);r=this.getRule(c,n)}return this.pluralRulesCache[a]=r,r}needsPlural(t,n={}){let o=this.getRule(t,n);return o||(o=this.getRule("dev",n)),o?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,n,o={}){return this.getSuffixes(t,o).map(s=>`${n}${s}`)}getSuffixes(t,n={}){let o=this.getRule(t,n);return o||(o=this.getRule("dev",n)),o?o.resolvedOptions().pluralCategories.sort((s,a)=>wa[s]-wa[a]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(t,n,o={}){const s=this.getRule(t,o);return s?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,o))}}const va=(e,t,n,o=".",s=!0)=>{let a=th(e,t,n);return!a&&s&&_(n)&&(a=Ys(e,n,o),a===void 0&&(a=Ys(t,n,o))),a},Oo=e=>e.replace(/\$/g,"$$$$");class $a{constructor(t={}){this.logger=Be.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(n=>n),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:o,useRawValueToEscape:s,prefix:a,prefixEscaped:r,suffix:l,suffixEscaped:c,formatSeparator:i,unescapeSuffix:d,unescapePrefix:h,nestingPrefix:u,nestingPrefixEscaped:p,nestingSuffix:f,nestingSuffixEscaped:m,nestingOptionsSeparator:g,maxReplaces:y,alwaysFormat:b}=t.interpolation;this.escape=n!==void 0?n:oh,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=a?We(a):r||"{{",this.suffix=l?We(l):c||"}}",this.formatSeparator=i||",",this.unescapePrefix=d?"":h?We(h):"-",this.unescapeSuffix=this.unescapePrefix?"":d?We(d):"",this.nestingPrefix=u?We(u):p||We("$t("),this.nestingSuffix=f?We(f):m||We(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=y||1e3,this.alwaysFormat=b!==void 0?b:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,o)=>n?.source===o?(n.lastIndex=0,n):new RegExp(o,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,n,o,s){let a,r,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},i=p=>{if(!p.includes(this.formatSeparator)){const y=va(n,c,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,o,{...s,...n,interpolationkey:p}):y}const f=p.split(this.formatSeparator),m=f.shift().trim(),g=f.join(this.formatSeparator).trim();return this.format(va(n,c,m,this.options.keySeparator,this.options.ignoreJSONStructure),g,o,{...s,...n,interpolationkey:m})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const d=s?.missingInterpolationHandler||this.options.missingInterpolationHandler,h=s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>Oo(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?Oo(this.escape(p)):Oo(p)}].forEach(p=>{for(l=0;a=p.regex.exec(t);){const f=a[1].trim();if(r=i(f),r===void 0)if(typeof d=="function"){const g=d(t,a,s);r=_(g)?g:""}else if(s&&Object.prototype.hasOwnProperty.call(s,f))r="";else if(h){r=a[0];continue}else this.logger.warn(`missed to pass in variable ${f} for interpolating ${t}`),r="";else!_(r)&&!this.useRawValueToEscape&&(r=pa(r));const m=p.safeValue(r);if(t=t.replace(a[0],m),h?(p.regex.lastIndex+=r.length,p.regex.lastIndex-=a[0].length):p.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n,o={}){let s,a,r;const l=(c,i)=>{const d=this.nestingOptionsSeparator;if(!c.includes(d))return c;const h=c.split(new RegExp(`${We(d)}[ ]*{`));let u=`{${h[1]}`;c=h[0],u=this.interpolate(u,r);const p=u.match(/'/g),f=u.match(/"/g);((p?.length??0)%2===0&&!f||(f?.length??0)%2!==0)&&(u=u.replace(/'/g,'"'));try{r=JSON.parse(u),i&&(r={...i,...r})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,m),`${c}${d}${u}`}return r.defaultValue&&r.defaultValue.includes(this.prefix)&&delete r.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];r={...o},r=r.replace&&!_(r.replace)?r.replace:r,r.applyPostProcessor=!1,delete r.defaultValue;const i=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(i!==-1&&(c=s[1].slice(i).split(this.formatSeparator).map(d=>d.trim()).filter(Boolean),s[1]=s[1].slice(0,i)),a=n(l.call(this,s[1].trim(),r),r),a&&s[0]===t&&!_(a))return a;_(a)||(a=pa(a)),a||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),a=""),c.length&&(a=c.reduce((d,h)=>this.format(d,h,o.lng,{...o,interpolationkey:s[1].trim()}),a.trim())),t=t.replace(s[0],a),this.regexp.lastIndex=0}return t}}const uh=e=>{let t=e.toLowerCase().trim();const n={};if(e.includes("(")){const o=e.split("(");t=o[0].toLowerCase().trim();const s=o[1].slice(0,-1);t==="currency"&&!s.includes(":")?n.currency||(n.currency=s.trim()):t==="relativetime"&&!s.includes(":")?n.range||(n.range=s.trim()):s.split(";").forEach(r=>{if(r){const[l,...c]=r.split(":"),i=c.join(":").trim().replace(/^'+|'+$/g,""),d=l.trim();n[d]||(n[d]=i),i==="false"&&(n[d]=!1),i==="true"&&(n[d]=!0),isNaN(i)||(n[d]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},Sa=e=>{const t={};return(n,o,s)=>{let a=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(a={...a,[s.interpolationkey]:void 0});const r=o+JSON.stringify(a);let l=t[r];return l||(l=e(tn(o),s),t[r]=l),l(n)}},hh=e=>(t,n,o)=>e(tn(n),o)(t);class ph{constructor(t={}){this.logger=Be.create("formatter"),this.options=t,this.init(t)}init(t,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const o=n.cacheInBuiltFormats?Sa:hh;this.formats={number:o((s,a)=>{const r=new Intl.NumberFormat(s,{...a});return l=>r.format(l)}),currency:o((s,a)=>{const r=new Intl.NumberFormat(s,{...a,style:"currency"});return l=>r.format(l)}),datetime:o((s,a)=>{const r=new Intl.DateTimeFormat(s,{...a});return l=>r.format(l)}),relativetime:o((s,a)=>{const r=new Intl.RelativeTimeFormat(s,{...a});return l=>r.format(l,a.range||"day")}),list:o((s,a)=>{const r=new Intl.ListFormat(s,{...a});return l=>r.format(l)})}}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Sa(n)}format(t,n,o,s={}){if(!n||t==null)return t;const a=n.split(this.formatSeparator),r=[];for(let c=0;c<a.length;c++){let i=a[c];for(;i.indexOf("(")>-1&&!i.includes(")")&&c+1<a.length;)i=`${i}${this.formatSeparator}${a[++c]}`;r.push(i)}return r.reduce((c,i)=>{const{formatName:d,formatOptions:h}=uh(i);if(this.formats[d]){let u=c;try{const p=s?.formatParams?.[s.interpolationkey]||{},f=p.locale||p.lng||s.locale||s.lng||o;u=this.formats[d](c,f,{...h,...s,...p})}catch(p){this.logger.warn(p)}return u}else this.logger.warn(`there was no format function for ${d}`);return c},t)}}const fh=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class mh extends ro{constructor(t,n,o,s={}){super(),this.backend=t,this.store=n,this.services=o,this.languageUtils=o.languageUtils,this.options=s,this.logger=Be.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(o,s.backend,s)}queueLoad(t,n,o,s){const a={},r={},l={},c={};return t.forEach(i=>{let d=!0;n.forEach(h=>{const u=`${i}|${h}`;!o.reload&&this.store.hasResourceBundle(i,h)?this.state[u]=2:this.state[u]<0||(this.state[u]===1?r[u]===void 0&&(r[u]=!0):(this.state[u]=1,d=!1,r[u]===void 0&&(r[u]=!0),a[u]===void 0&&(a[u]=!0),c[h]===void 0&&(c[h]=!0)))}),d||(l[i]=!0)}),(Object.keys(a).length||Object.keys(r).length)&&this.queue.push({pending:r,pendingCount:Object.keys(r).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(a),pending:Object.keys(r),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,o){const s=t.split("|"),a=s[0],r=s[1];n&&this.emit("failedLoading",a,r,n),!n&&o&&this.store.addResourceBundle(a,r,o,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&o&&(this.state[t]=0);const l={};this.queue.forEach(c=>{eh(c.loaded,[a],r),fh(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(i=>{l[i]||(l[i]={});const d=c.loaded[i];d.length&&d.forEach(h=>{l[i][h]===void 0&&(l[i][h]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,o,s=0,a=this.retryTimeout,r){if(!t.length)return r(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:o,tried:s,wait:a,callback:r});return}this.readingCalls++;const l=(i,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(i&&d&&s<this.maxRetries){setTimeout(()=>{this.read(t,n,o,s+1,a*2,r)},a);return}r(i,d)},c=this.backend[o].bind(this.backend);if(c.length===2){try{const i=c(t,n);i&&typeof i.then=="function"?i.then(d=>l(null,d)).catch(l):l(null,i)}catch(i){l(i)}return}return c(t,n,l)}prepareLoading(t,n,o={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();_(t)&&(t=this.languageUtils.toResolveHierarchy(t)),_(n)&&(n=[n]);const a=this.queueLoad(t,n,o,s);if(!a.toLoad.length)return a.pending.length||s(),null;a.toLoad.forEach(r=>{this.loadOne(r)})}load(t,n,o){this.prepareLoading(t,n,{},o)}reload(t,n,o){this.prepareLoading(t,n,{reload:!0},o)}loadOne(t,n=""){const o=t.split("|"),s=o[0],a=o[1];this.read(s,a,"read",void 0,void 0,(r,l)=>{r&&this.logger.warn(`${n}loading namespace ${a} for language ${s} failed`,r),!r&&l&&this.logger.log(`${n}loaded namespace ${a} for language ${s}`,l),this.loaded(t,r,l)})}saveMissing(t,n,o,s,a,r={},l=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${o}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend?.create){const c={...r,isUpdate:a},i=this.backend.create.bind(this.backend);if(i.length<6)try{let d;i.length===5?d=i(t,n,o,s,c):d=i(t,n,o,s),d&&typeof d.then=="function"?d.then(h=>l(null,h)).catch(l):l(null,d)}catch(d){l(d)}else i(t,n,o,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,o,s)}}}const Eo=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),_(e[1])&&(t.defaultValue=e[1]),_(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(o=>{t[o]=n[o]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ja=e=>(_(e.ns)&&(e.ns=[e.ns]),_(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),_(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),kn=()=>{},gh=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Jt extends ro{constructor(t={},n){if(super(),this.options=ja(t),this.services={},this.logger=Be,this.modules={external:[]},gh(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(t={},n){this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),t.defaultNS==null&&t.ns&&(_(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));const o=Eo();this.options={...o,...this.options,...ja(t)},this.options.interpolation={...o.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=o.overloadTranslationOptionHandler);const s=i=>i?typeof i=="function"?new i:i:null;if(!this.options.isClone){this.modules.logger?Be.init(s(this.modules.logger),this.options):Be.init(null,this.options);let i;this.modules.formatter?i=this.modules.formatter:i=ph;const d=new ba(this.options);this.store=new ya(this.options.resources,this.options);const h=this.services;h.logger=Be,h.resourceStore=this.store,h.languageUtils=d,h.pluralResolver=new dh(d,{prepend:this.options.pluralSeparator}),i&&(h.formatter=s(i),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new $a(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new mh(s(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(u,...p)=>{this.emit(u,...p)}),this.modules.languageDetector&&(h.languageDetector=s(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=s(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new Gn(this.services,this.options),this.translator.on("*",(u,...p)=>{this.emit(u,...p)}),this.modules.external.forEach(u=>{u.init&&u.init(this)})}if(this.format=this.options.interpolation.format,n||(n=kn),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const i=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);i.length>0&&i[0]!=="dev"&&(this.options.lng=i[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(i=>{this[i]=(...d)=>this.store[i](...d)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(i=>{this[i]=(...d)=>(this.store[i](...d),this)});const l=Mt(),c=()=>{const i=(d,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(h),n(d,h)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return i(null,this.t.bind(this));this.changeLanguage(this.options.lng,i)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),l}loadResources(t,n=kn){let o=n;const s=_(t)?t:this.language;if(typeof t=="function"&&(o=t),!this.options.resources||this.options.partialBundledLanguages){if(s?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const a=[],r=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(i=>{i!=="cimode"&&(a.includes(i)||a.push(i))})};s?r(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>r(c)),this.options.preload?.forEach?.(l=>r(l)),this.services.backendConnector.load(a,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(l)})}else o(null)}reloadResources(t,n,o){const s=Mt();return typeof t=="function"&&(o=t,t=void 0),typeof n=="function"&&(o=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),o||(o=kn),this.services.backendConnector.reload(t,n,a=>{s.resolve(),o(a)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&fc.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let n=0;n<this.languages.length;n++){const o=this.languages[n];if(!["cimode","dev"].includes(o)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&!this.languages.includes(t)&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,n){this.isLanguageChangingTo=t;const o=Mt();this.emit("languageChanging",t);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,c)=>{c?this.isLanguageChangingTo===t&&(s(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,o.resolve((...i)=>this.t(...i)),n&&n(l,(...i)=>this.t(...i))},r=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const c=_(l)?l:l&&l[0],i=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(_(l)?[l]:l);i&&(this.language||s(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector?.cacheUserLanguage?.(i)),this.loadResources(i,d=>{a(d,i)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?r(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(r):this.services.languageDetector.detect(r):r(t),o}getFixedT(t,n,o,s){const a=s?.scopeNs,r=(l,c,...i)=>{let d;typeof c!="object"?d=this.options.overloadTranslationOptionHandler([l,c].concat(i)):d={...c},d.lng=d.lng||r.lng,d.lngs=d.lngs||r.lngs;const h=d.ns!==void 0&&d.ns!==null;d.ns=d.ns||r.ns,d.keyPrefix!==""&&(d.keyPrefix=d.keyPrefix||o||r.keyPrefix);const u={...this.options,...d};Array.isArray(a)&&!h&&(u.ns=a),typeof d.keyPrefix=="function"&&(d.keyPrefix=Tt(d.keyPrefix,u));const p=this.options.keySeparator||".";let f;return d.keyPrefix&&Array.isArray(l)?f=l.map(m=>(typeof m=="function"&&(m=Tt(m,u)),`${d.keyPrefix}${p}${m}`)):(typeof l=="function"&&(l=Tt(l,u)),f=d.keyPrefix?`${d.keyPrefix}${p}${l}`:l),this.t(f,d)};return _(t)?r.lng=t:r.lngs=t,r.ns=n,r.keyPrefix=o,r}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,a=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const r=(l,c)=>{const i=this.services.backendConnector.state[`${l}|${c}`];return i===-1||i===0||i===2};if(n.precheck){const l=n.precheck(this,r);if(l!==void 0)return l}return!!(this.hasResourceBundle(o,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||r(o,t)&&(!s||r(a,t)))}loadNamespaces(t,n){const o=Mt();return this.options.ns?(_(t)&&(t=[t]),t.forEach(s=>{this.options.ns.includes(s)||this.options.ns.push(s)}),this.loadResources(s=>{o.resolve(),n&&n(s)}),o):(n&&n(),Promise.resolve())}loadLanguages(t,n){const o=Mt();_(t)&&(t=[t]);const s=this.options.preload||[],a=t.filter(r=>!s.includes(r)&&this.services.languageUtils.isSupportedCode(r));return a.length?(this.options.preload=s.concat(a),this.loadResources(r=>{o.resolve(),n&&n(r)}),o):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const s=new Intl.Locale(t);if(s&&s.getTextInfo){const a=s.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services?.languageUtils||new ba(Eo());return t.toLowerCase().indexOf("-latn")>1?"ltr":n.includes(o.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},n){const o=new Jt(t,n);return o.createInstance=Jt.createInstance,o}cloneInstance(t={},n=kn){const o=t.forkResourceStore;o&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},a=new Jt(s);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),["store","services","language"].forEach(l=>{a[l]=this[l]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},o){const l=Object.keys(this.store.data).reduce((c,i)=>(c[i]={...this.store.data[i]},c[i]=Object.keys(c[i]).reduce((d,h)=>(d[h]={...c[i][h]},d),c[i]),c),{});a.store=new ya(l,s),a.services.resourceStore=a.store}if(t.interpolation){const c={...Eo().interpolation,...this.options.interpolation,...t.interpolation},i={...s,interpolation:c};a.services.interpolator=new $a(i)}return a.translator=new Gn(a.services,s),a.translator.on("*",(l,...c)=>{a.emit(l,...c)}),a.init(s,n),a.translator.options=s,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const me=Jt.createInstance();me.createInstance;me.dir;me.init;me.loadResources;me.reloadResources;me.use;me.changeLanguage;me.getFixedT;me.t;me.exists;me.setDefaultNamespace;me.hasLoadedNamespace;me.loadNamespaces;me.loadLanguages;let gc=me;function yh(e){gc=e}function bh(){const e=gc.language;return e&&!e.startsWith("zh")?"en-US":"zh-CN"}function fe(e){return e[bh()]}const wh={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,oneOf:(e,t)=>`${e} 必须是 ${t.join("、")} 之一`,label:e=>`${e} 必须是不超过 20 字的文本`,confirm:e=>`${e} 必须是不超过 120 字的文本`,maxObjects:(e,t)=>`${e} 必须是 1 到 ${t} 的整数`,list:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,hitNeeds:e=>`${e} 要给出 { selection: 筛选 } 或 { set: 筛选 }:按钮没有点到的对象`,targetsShape:e=>`${e} 只能是 hit、{ selection } 或 { set }`,targetsNotFilter:(e,t,n)=>`${e} 不是页面上的${t==="set"?"对象集合":"选中对象"}筛选:${n}`,targetsOtherType:e=>`${e} 里的对象和行动作用的对象不是同一类`,paramNot:(e,t)=>`${e} 不是行动「${t}」要填的参数`,paramNoSource:(e,t)=>`${e} 没有给出来源:行动「${t}」要求填写它`,fromShape:e=>`${e} 必须是 { from, ... }`,notPageFilter:(e,t)=>`${e} 不是页面筛选:${t}`,constValue:e=>`${e} 必须是文本、数字或真假`,fromOneOf:e=>`${e} 只能是 input、var 或 const`,actionRequired:e=>`${e} 必填:知识网络里的行动`,needSource:e=>`${e} 需要先选好数据源`,notObjects:e=>`${e} 查询结果和事件不是网络里的对象,不能执行行动`,notAction:(e,t)=>`${e} 不是知识网络里的行动:${t}`,actionObject:(e,t,n,o)=>`${e} 行动「${t}」作用于 ${n??(o||"未绑定的对象")},和数据源的对象类不同`},kh={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,oneOf:(e,t)=>`${e} must be one of ${t.join(", ")}`,label:e=>`${e} must be text of at most 20 characters`,confirm:e=>`${e} must be text of at most 120 characters`,maxObjects:(e,t)=>`${e} must be an integer from 1 to ${t}`,list:(e,t)=>`${e} must be a list of at most ${t} items`,hitNeeds:e=>`${e} must give { selection: filter } or { set: filter }: a button has no clicked objects`,targetsShape:e=>`${e} must be hit, { selection } or { set }`,targetsNotFilter:(e,t,n)=>`${e} is not ${t==="set"?"an object set":"a selected object"} filter of the page: ${n}`,targetsOtherType:e=>`${e} holds objects of another type than the ones the action works on`,paramNot:(e,t)=>`${e} is not a parameter of action "${t}"`,paramNoSource:(e,t)=>`${e} has no source: action "${t}" requires it`,fromShape:e=>`${e} must be { from, ... }`,notPageFilter:(e,t)=>`${e} is not a page filter: ${t}`,constValue:e=>`${e} must be text, a number or a boolean`,fromOneOf:e=>`${e} must be input, var or const`,actionRequired:e=>`${e} is required: an action of the knowledge network`,needSource:e=>`${e} needs a source to be chosen first`,notObjects:e=>`${e} query results and events are not objects of the network, so no action can run on them`,notAction:(e,t)=>`${e} is not an action of the knowledge network: ${t}`,actionObject:(e,t,n,o)=>`${e} action "${t}" acts on ${n??(o||"an unbound object")}, which is not the object type of the source`},xr=()=>fe({"zh-CN":wh,"en-US":kh}),Gs=100;function cn(e,t){return e.actionTypes?.find(n=>n.id===t)}function vh(e,t){const n=(e.actionTypes??[]).filter(r=>r.objectType&&!0);if(n.length===0)return"";const o={create:"新建对象",modify:"修改对象",relation:"修改关系",tool:"调用工具"},s=r=>r.trim().replace(/[。.]+$/,""),a=r=>`${r.name}${r.label?`(${s(r.label)})`:""}:${r.type}${r.property?",新对象的属性":""}`;return`行动(组件点击执行、按钮动作里的 action 只能用下列 id,须作用于组件数据源的对象类,不能编造;params 给“用户填写”的参数指定来源):
|
|
2
|
+
${n.map(r=>`- ${r.id}:${r.name}${r.comment?`;${s(r.comment)}`:""};作用于 ${r.objectType};${o[an(r)]};用户填写 ${r.inputs.map(a).join("、")||"无"}${r.canExecute?"":";当前用户无权执行"}`).join(`
|
|
3
|
+
`)}`}function Hn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $h(e,t,n,o,s){const a=xr();if(e===void 0||e==="hit")return t?[]:[a.hitNeeds(s)];if(!Hn(e))return[a.targetsShape(s)];const r="selection"in e?"selection":"set"in e?"set":null,l=r?e[r]:void 0;if(!r||typeof l!="string"||Object.keys(e).length!==1)return[a.targetsShape(s)];const c=n.variables.find(d=>d.name===l);return!c||c.kind!==r?[a.targetsNotFilter(`${s}.${r}`,r,l)]:("source"in c?pe(n,c.source)?.objectType:void 0)===o?[]:[a.targetsOtherType(`${s}.${r}`)]}function Sh(e,t,n,o){const s=xr();if(e!==void 0&&!Hn(e))return[s.object(o)];const a=e??{},r=new Set(t.inputs.map(c=>c.name)),l=Object.keys(a).filter(c=>!r.has(c)).map(c=>s.paramNot(`${o}.${c}`,t.name));for(const c of t.inputs){const i=a[c.name],d=`${o}.${c.name}`;if(i===void 0){c.property||l.push(s.paramNoSource(d,t.name));continue}if(!Hn(i)){l.push(s.fromShape(d));continue}i.from==="input"?i.label!==void 0&&(typeof i.label!="string"||i.label.length>20)&&l.push(s.label(`${d}.label`)):i.from==="var"?n.variables.some(h=>h.name===i.variable)||l.push(s.notPageFilter(`${d}.variable`,String(i.variable))):i.from==="const"?["string","number","boolean"].includes(typeof i.value)||l.push(s.constValue(`${d}.value`)):l.push(s.fromOneOf(`${d}.from`))}return l}function yc(e,t,n,o,s){const a=xr();if(!Hn(e))return[a.object(s)];const r=new Set(["on","action","label","targets","params","confirm","maxObjects"]),l=Object.keys(e).filter(h=>!r.has(h)).map(h=>a.noOption(s,h));if(t.on.includes(e.on)||l.push(a.oneOf(`${s}.on`,t.on)),e.label!==void 0&&(typeof e.label!="string"||e.label.length>20)&&l.push(a.label(`${s}.label`)),e.confirm!==void 0&&(typeof e.confirm!="string"||e.confirm.length>120)&&l.push(a.confirm(`${s}.confirm`)),e.maxObjects!==void 0&&(typeof e.maxObjects!="number"||!Number.isInteger(e.maxObjects)||e.maxObjects<1||e.maxObjects>Gs)&&l.push(a.maxObjects(`${s}.maxObjects`,Gs)),typeof e.action!="string"||!e.action)return l.push(a.actionRequired(`${s}.action`)),l;const c=pe(n.spec,o);if(!c)return[...l,a.needSource(s)];const i=n.spec.sources.find(h=>h.id===(c.from?.source??c.id));if(c.cypher||i?.cypher||c.events)return[...l,a.notObjects(s)];if(!n.kn.actionTypes)return l;const d=cn(n.kn,e.action);return d?(d.objectType!==c.objectType&&l.push(a.actionObject(`${s}.action`,d.name,n.kn.objectTypes[d.objectType]?.name,d.objectType)),l.push(...$h(e.targets,t.hit,n.spec,c.objectType,`${s}.targets`)),l.push(...Sh(e.params,d,n.spec,`${s}.params`)),l):[...l,a.notAction(`${s}.action`,e.action)]}const jh={unknown:(e,t)=>`第 ${e} 个字符“${t}”无法识别`,empty:"公式是空的",unfinished:"公式没写完",unclosed:e=>`第 ${e} 个字符的括号没有闭合`,missing:(e,t)=>`第 ${e} 个字符“${t}”前缺少数字或字段`,extra:(e,t)=>`第 ${e} 个字符“${t}”多余`},Ah={unknown:(e,t)=>`character ${e} "${t}" is not recognized`,empty:"the formula is empty",unfinished:"the formula is unfinished",unclosed:e=>`the parenthesis at character ${e} is not closed`,missing:(e,t)=>`a number or field is missing before character ${e} "${t}"`,extra:(e,t)=>`character ${e} "${t}" is unexpected`},bc=()=>fe({"zh-CN":jh,"en-US":Ah}),Aa=/(\d+(?:\.\d+)?)|(\$?[A-Za-z_][A-Za-z0-9_]*)|`([^`]+)`|([-+*/()])/y;function Th(e){const t=bc(),n=[];let o=0;for(;o<e.length;){if(/\s/.test(e[o])){o++;continue}Aa.lastIndex=o;const s=Aa.exec(e);if(!s)return t.unknown(o+1,e[o]);const[a,r,l,c]=s;n.push({kind:r!==void 0?"number":l!==void 0||c!==void 0?"name":"op",text:c??a,at:o}),o+=s[0].length}return n}function wc(e){const t=bc(),n=Th(e);if(typeof n=="string")return{ok:!1,error:n};if(n.length===0)return{ok:!1,error:t.empty};let o=0;const s=()=>n[o],a=d=>{throw new Error(d)},r=()=>{let d=l();for(;s()?.text==="+"||s()?.text==="-";)d={type:"binary",op:n[o++].text,left:d,right:l()};return d},l=()=>{let d=c();for(;s()?.text==="*"||s()?.text==="/";)d={type:"binary",op:n[o++].text,left:d,right:c()};return d},c=()=>s()?.text==="-"?(o++,{type:"negate",arg:c()}):i(),i=()=>{const d=n[o++];if(!d)return a(t.unfinished);if(d.kind==="number")return{type:"number",value:Number(d.text)};if(d.kind==="name")return{type:"field",name:d.text};if(d.text==="("){const h=r();return n[o++]?.text!==")"&&a(t.unclosed(d.at+1)),h}return a(t.missing(d.at+1,d.text))};try{const d=r();return o<n.length&&a(t.extra(n[o].at+1,n[o].text)),{ok:!0,node:d}}catch(d){return{ok:!1,error:d.message}}}function Zt(e){switch(e.type){case"number":return[];case"field":return[e.name];case"negate":return Zt(e.arg);case"binary":return[...Zt(e.left),...Zt(e.right)]}}const Oh={sep:"、",object:e=>`${e} 必须是对象`,array:e=>`${e} 必须是数组`,valueNotTaken:(e,t,n,o)=>`${e} 的取值「${t}」不是 ${n} 的取值(可选:${o})`,fieldUnusable:(e,t)=>`${e}.field 不是可用的字段:${t}`,opOneOf:(e,t)=>`${e}.op 只能是 ${t}`,valuesList:e=>`${e}.values 必须是非空的文本列表`,refOrValue:(e,t)=>`${e} 要给 ref(字段或 ${t})或 value(值)其中一个`,refUnusable:(e,t)=>`${e}.ref 不是可用的字段:${t}`,needDateField:(e,t)=>`${e}.field 用 ${t} 比较时必须是日期字段`,otherDate:(e,t,n)=>`${e} 用 ${t} 比较时,另一边必须是日期字段、${n} 或 YYYY-MM-DD`,needNumberField:(e,t)=>`${e}.field 用 ${t} 比较时必须是数字字段`,otherNumber:(e,t)=>`${e} 用 ${t} 比较时,另一边必须是数字字段或数字`,textOrNumber:e=>`${e}.value 必须是文本或数字`,conditionList:e=>`${e} 必须是条件列表`,identifier:e=>`${e}.name 必须是字母开头的标识`,nameTaken:(e,t)=>`${e}.name ${t} 与已有属性或计算列重名`,nameReserved:(e,t)=>`${e}.name ${t} 是进度列的保留名`,required:e=>`${e} 必填`,kindOneOf:(e,t)=>`${e}.kind 只能是 ${t}`,cycle:(e,t)=>`${e} 计算列互相引用成环:${t}`,matchedName:(e,t)=>`「${e}」的「${t}」`,matchedCycle:(e,t)=>`${e} 这些匹配字段互相取值,形成了循环,都算不出来:${t}。请让其中一个直接取对方的原始属性,而不是对方的匹配字段。`,dateOrAsOf:(e,t)=>`${e} 必须是日期字段或 ${t}`,exprText:e=>`${e}.expr 必须是公式文本`,exprError:(e,t)=>`${e}.expr ${t}`,exprField:(e,t)=>`${e}.expr 里的 ${t} 不是可用的数字字段`,templateText:e=>`${e}.template 必须是非空文本,用 {字段名} 引用字段`,templateNoField:e=>`${e}.template 至少要用 {字段名} 引用一个字段`,templateField:(e,t)=>`${e}.template 里的 {${t}} 不是可用的字段`,fromText:e=>`${e}.from 必须是文本字段`,scopeOneOf:(e,t)=>`${e}.scope 只能是 ${t}`,relatedCypher:e=>`${e} Cypher 数据源暂不支持关联统计,可以把统计直接写进查询`,pathNeeded:e=>`${e}.path 必须是至少一条关系的路径`,pathUnreachable:(e,t)=>`${e}.path 不是从 ${t} 出发连通的关系路径`,aggregateOneOf:(e,t)=>`${e}.aggregate 只能是 ${t}`,endObjectType:"终点对象类",fieldOfProperty:(e,t)=>`${e}.field 必须是 ${t} 的属性`,typeOfTaken:(e,t)=>`${e}.type 必须是所取属性的类型:${t}`,typeListIsText:e=>`${e}.type 列出的值是文本,不用写 type`,fieldNumberProperty:(e,t)=>`${e}.field 必须是 ${t} 的数字属性`,typeOnlyOne:e=>`${e}.type 只有 one 需要写`,whereFixed:e=>`${e}.where 关联统计的条件只能和固定值比较`,matchedCypher:e=>`${e} Cypher 数据源不支持按字段匹配其他数据源`,otherSource:e=>`${e}.source 必须是另一个数据源`,otherSourceKind:e=>`${e}.source 必须是本应用中读取知识网络对象类的数据源(不能是子集)`,pairsCount:e=>`${e}.pairs 必须是 1 到 4 对字段`,otherProperty:(e,t)=>`${e}.other 必须是 ${t} 的属性`,typeOnlyWithField:e=>`${e}.type 只有取属性(field)时需要写`,valueText:e=>`${e}.value 必须是非空文本`,toneOneOf:(e,t)=>`${e}.tone 只能是 ${t}`},Eh={sep:", ",object:e=>`${e} must be an object`,array:e=>`${e} must be an array`,valueNotTaken:(e,t,n,o)=>`${e} value "${t}" is not a value of ${n} (one of: ${o})`,fieldUnusable:(e,t)=>`${e}.field is not an available field: ${t}`,opOneOf:(e,t)=>`${e}.op must be one of ${t}`,valuesList:e=>`${e}.values must be a non-empty list of text`,refOrValue:(e,t)=>`${e} needs exactly one of ref (a field or ${t}) and value`,refUnusable:(e,t)=>`${e}.ref is not an available field: ${t}`,needDateField:(e,t)=>`${e}.field must be a date field when compared with ${t}`,otherDate:(e,t,n)=>`${e}: when compared with ${t}, the other side must be a date field, ${n} or YYYY-MM-DD`,needNumberField:(e,t)=>`${e}.field must be a number field when compared with ${t}`,otherNumber:(e,t)=>`${e}: when compared with ${t}, the other side must be a number field or a number`,textOrNumber:e=>`${e}.value must be text or a number`,conditionList:e=>`${e} must be a list of conditions`,identifier:e=>`${e}.name must be an identifier starting with a letter`,nameTaken:(e,t)=>`${e}.name ${t} is already used by a property or computed column`,nameReserved:(e,t)=>`${e}.name ${t} is reserved for a progress column`,required:e=>`${e} is required`,kindOneOf:(e,t)=>`${e}.kind must be one of ${t}`,cycle:(e,t)=>`${e} computed columns read each other in a circle: ${t}`,matchedName:(e,t)=>`"${t}" of "${e}"`,matchedCycle:(e,t)=>`${e} these matched fields take values from each other in a circle, so none can be worked out: ${t}. Make one of them take the other source's own property instead of its matched field.`,dateOrAsOf:(e,t)=>`${e} must be a date field or ${t}`,exprText:e=>`${e}.expr must be formula text`,exprError:(e,t)=>`${e}.expr: ${t}`,exprField:(e,t)=>`${t} in ${e}.expr is not an available number field`,templateText:e=>`${e}.template must be non-empty text that refers to fields as {field}`,templateNoField:e=>`${e}.template must refer to at least one field as {field}`,templateField:(e,t)=>`{${t}} in ${e}.template is not an available field`,fromText:e=>`${e}.from must be a text field`,scopeOneOf:(e,t)=>`${e}.scope must be one of ${t}`,relatedCypher:e=>`${e}: a Cypher source does not support related counts yet; write the count into the query`,pathNeeded:e=>`${e}.path must be a path of at least one relation`,pathUnreachable:(e,t)=>`${e}.path is not a connected relation path starting at ${t}`,aggregateOneOf:(e,t)=>`${e}.aggregate must be one of ${t}`,endObjectType:"the end object type",fieldOfProperty:(e,t)=>`${e}.field must be a property of ${t}`,typeOfTaken:(e,t)=>`${e}.type must be the type of the property taken: ${t}`,typeListIsText:e=>`${e}.type: the listed values are text, so type is not needed`,fieldNumberProperty:(e,t)=>`${e}.field must be a number property of ${t}`,typeOnlyOne:e=>`${e}.type is only needed for one`,whereFixed:e=>`${e}.where: conditions of a related count can only compare with fixed values`,matchedCypher:e=>`${e}: a Cypher source does not support matching other sources by field`,otherSource:e=>`${e}.source must be another source`,otherSourceKind:e=>`${e}.source must be a source of this app that reads an object type of the knowledge network (not a subset)`,pairsCount:e=>`${e}.pairs must be 1 to 4 pairs of fields`,otherProperty:(e,t)=>`${e}.other must be a property of ${t}`,typeOnlyWithField:e=>`${e}.type is only needed when taking a property (field)`,valueText:e=>`${e}.value must be non-empty text`,toneOneOf:(e,t)=>`${e}.tone must be one of ${t}`},Je=()=>fe({"zh-CN":Oh,"en-US":Eh}),Ch=/^[A-Za-z][A-Za-z0-9_]*$/,Nh=/^\d{4}-\d{2}-\d{2}$/,xh=["before","onOrBefore","after","onOrAfter"],Rh=["gt","gte","lt","lte"],kc=()=>[];function Ta(e,t,n,o){const s=n(e);if(s.length===0)return[];const a=Je();return t.filter(r=>typeof r=="string"&&!s.includes(r)).map(r=>a.valueNotTaken(o,String(r),e,s.join(a.sep)))}function _h(e,t,n,o=kc){const s=Je();if(!Oe(e))return[s.object(n)];const a=d=>d===ue?"date":t.find(h=>h.name===d)?.type,r=a(e.field);if(!r)return[s.fieldUnusable(n,String(e.field))];if(!Pt(e.op,zn))return[s.opOneOf(n,zn.join(s.sep))];const l=e.op;if(l==="isSet"||l==="isEmpty")return[];if(l==="in")return Array.isArray(e.values)&&e.values.length>0&&e.values.every(d=>typeof d=="string")?Ta(String(e.field),e.values,o,`${n}.values`):[s.valuesList(n)];const c=e.ref!==void 0;if(c===(e.value!==void 0))return[s.refOrValue(n,ue)];const i=c?a(e.ref):void 0;return c&&!i?[s.refUnusable(n,String(e.ref))]:xh.includes(l)?r!=="date"?[s.needDateField(n,l)]:(c?i==="date":typeof e.value=="string"&&Nh.test(e.value))?[]:[s.otherDate(n,l,ue)]:Rh.includes(l)?r!=="number"?[s.needNumberField(n,l)]:(c?i==="number":typeof e.value=="number")?[]:[s.otherNumber(n,l)]:c?[]:typeof e.value!="string"&&typeof e.value!="number"?[s.textOrNumber(n)]:Ta(String(e.field),[e.value],o,`${n}.value`)}function xe(e,t,n,o=kc){return Array.isArray(e)?e.flatMap((s,a)=>_h(s,t,`${n}[${a}]`,o)):[Je().conditionList(n)]}function vc(e,t=!1){return n=>{if(t&&n===le.status)return jc.map(s=>s.value);if(n===rn)return Kh.map(s=>s.value);const o=e.find(s=>Oe(s)&&s.name===n&&s.kind==="classify"&&Array.isArray(s.cases)&&Oe(s.otherwise));return o?[...o.cases,o.otherwise].map(s=>Oe(s)?s.value:void 0).filter(s=>typeof s=="string"):[]}}const Hs=e=>(e??[]).flatMap(t=>[t.field,t.ref].filter(n=>typeof n=="string"&&n!==ue)),Ph=/\{([^{}]+)\}/g;function $c(e){return[...new Set([...e.matchAll(Ph)].map(t=>t[1].trim()))]}function Rr(e){switch(e.kind){case"classify":return e.cases.flatMap(t=>Hs(t.when));case"days":return[e.from,e.to,...Hs(e.when)].filter(t=>t!==ue);case"formula":{const t=wc(e.expr);return t.ok?Zt(t.node):[]}case"related":return[];case"matched":return[];case"region":return[e.from];case"text":return $c(e.template)}}function Lh(e){const t=new Set(e.map(a=>a.name)),n=new Set,o=[];let s=[...e];for(;s.length>0;){const a=s.filter(r=>Rr(r).every(l=>!t.has(l)||l===r.name||n.has(l)));if(a.length===0)return[...o,...s];for(const r of a)o.push(r),n.add(r.name);s=s.filter(r=>!a.includes(r))}return o}function Ih(e){const t=Lh(e),n=new Set(e.map(a=>a.name)),o=new Set,s=[];for(const a of t)Rr(a).some(r=>n.has(r)&&!o.has(r))&&s.push(a.name),o.add(a.name);return s}function Sc(e){return Array.isArray(e)?e.filter(t=>Oe(t)&&typeof t.name=="string"&&Pt(t.kind,Ht)):[]}function Mh(e){try{return Rr(e)??[]}catch{return[]}}const Co=e=>typeof e=="string"&&e!==""?[e]:[];function qh(e){const t=h=>e.find(u=>u.id===h)?.from?.source??h,n=h=>Sc(h.computed),o=e.filter(h=>Oe(h)&&!h.from&&n(h).length>0),s=new Map(o.map(h=>[h.id,new Set(n(h).map(u=>u.name))])),a=(h,u)=>`${h}\0${u}`,r=(h,u)=>u.filter(p=>s.get(h)?.has(p)).map(p=>a(h,p)),l=[];for(const h of o)for(const u of n(h)){const p=a(h.id,u.name);let f;if(u.kind==="matched"){const m=t(String(u.source)),g=Array.isArray(u.pairs)?u.pairs.filter(y=>Oe(y)):[];f=[...r(h.id,g.flatMap(y=>Co(y?.field))),...r(m,[...g.flatMap(y=>Co(y?.other)),...Co(u.field),...Hs(Array.isArray(u.where)?u.where.filter(y=>Oe(y)):void 0)])]}else f=r(h.id,Mh(u));l.push({id:p,ref:{source:h.id,field:u},reads:f.filter(m=>m!==p)})}const c=new Set,i=[];let d=l;for(;d.length>0;){const h=d.filter(u=>u.reads.every(p=>c.has(p)));if(h.length===0)break;for(const u of h)i.push(u.ref),c.add(u.id);d=d.filter(u=>!c.has(u.id))}return{order:i,stuck:d.map(h=>h.ref)}}const Fh=new Set([...Object.values(le),rn]);function Dh(e,t,n,o){if(e===void 0)return[];const s=Je();if(!Array.isArray(e))return[s.array(n)];const a=[],r=vc(e,o.progress),l=e.filter(d=>Oe(d)&&typeof d.name=="string"&&Pt(d.kind,Ht)),c=new Set;e.forEach((d,h)=>{const u=`${n}[${h}]`;if(!Oe(d))return a.push(s.object(u));if(typeof d.name!="string"||!Ch.test(d.name))return a.push(s.identifier(u));if(t.some(f=>f.name===d.name)||c.has(d.name))return a.push(s.nameTaken(u,d.name));if(Fh.has(d.name)&&o.progress)return a.push(s.nameReserved(u,d.name));if(c.add(d.name),(typeof d.label!="string"||d.label.trim()==="")&&a.push(s.required(`${u}.label`)),!Pt(d.kind,Ht))return a.push(s.kindOneOf(u,Ht.join(s.sep)));const p=l.filter(f=>f.name!==d.name).map(Nr);a.push(...Uh(d,[...t,...p],u,r,o))});const i=Ih(l);return i.length>0?a.push(s.cycle(n,i.join(s.sep))):o.sources&&o.source&&a.push(...Bh(n,o)),a}function Bh(e,t){const n=Je(),o=t.sources??[],{stuck:s}=qh(o);if(!s.some(l=>l.source===t.source&&l.field.kind==="matched"))return[];const a=l=>o.find(c=>c.id===l)?.label??l,r=s.map(l=>n.matchedName(a(l.source),l.field.label||l.field.name)).join(n.sep);return[n.matchedCycle(e,r)]}function Uh(e,t,n,o,s){const a=Je(),r=l=>l===ue||t.some(c=>c.name===l&&c.type==="date");switch(e.kind){case"classify":{const l=[];return Array.isArray(e.cases)?e.cases.forEach((c,i)=>{const d=`${n}.cases[${i}]`;l.push(...Oa(c,d)),Oe(c)&&l.push(...xe(c.when,t,`${d}.when`,o))}):l.push(a.array(`${n}.cases`)),l.push(...Oa(e.otherwise,`${n}.otherwise`)),l}case"days":return[...r(e.from)?[]:[a.dateOrAsOf(`${n}.from`,ue)],...r(e.to)?[]:[a.dateOrAsOf(`${n}.to`,ue)],...e.when===void 0?[]:xe(e.when,t,`${n}.when`,o)];case"formula":{if(typeof e.expr!="string")return[a.exprText(n)];const l=wc(e.expr);return l.ok?[...new Set(Zt(l.node))].filter(c=>!t.some(i=>i.name===c&&i.type==="number")).map(c=>a.exprField(n,c)):[a.exprError(n,l.error)]}case"related":return zh(e,n,s);case"matched":return Wh(e,n,s,t);case"text":{if(typeof e.template!="string"||e.template.trim()==="")return[a.templateText(n)];const l=$c(e.template);return l.length===0?[a.templateNoField(n)]:l.filter(c=>!t.some(i=>i.name===c)).map(c=>a.templateField(n,c))}default:return[...t.some(l=>l.name===e.from&&l.type==="text")?[]:[a.fromText(n)],...e.scope===void 0||sa.includes(e.scope)?[]:[a.scopeOneOf(n,sa.join(a.sep))]]}}function zh(e,t,{kn:n,objectType:o,cypher:s}){const a=Je();if(s)return[a.relatedCypher(t)];if(!Array.isArray(e.path)||e.path.length===0)return[a.pathNeeded(t)];const r=ln(n,o,e.path);if(!r)return[a.pathUnreachable(t,o)];const l=n.objectTypes[r[r.length-1].to],c=l?.properties??[];if(!Pt(e.aggregate,Ds))return[a.aggregateOneOf(t,Ds.join(a.sep))];const i=[],d=c.find(h=>h.name===e.field);return e.aggregate==="one"||e.aggregate==="list"?d?e.aggregate==="one"&&e.type!==d.type?i.push(a.typeOfTaken(t,d.type)):e.aggregate==="list"&&e.type!==void 0&&e.type!=="text"&&i.push(a.typeListIsText(t)):i.push(a.fieldOfProperty(t,l?.name??a.endObjectType)):(e.aggregate!=="count"&&d?.type!=="number"&&i.push(a.fieldNumberProperty(t,l?.name??a.endObjectType)),e.type!==void 0&&i.push(a.typeOnlyOne(t))),e.where!==void 0&&(i.push(...xe(e.where,c,`${t}.where`)),Array.isArray(e.where)&&e.where.some(h=>Oe(h)&&(h.ref!==void 0||h.field===ue))&&i.push(a.whereFixed(t))),i}function Wh(e,t,{kn:n,objectType:o,cypher:s,sources:a},r){const l=Je();if(s)return[l.matchedCypher(t)];if(typeof e.source!="string"||e.source==="")return[l.otherSource(t)];const c=a?.find(h=>h.id===e.source);if(a&&(!c||c.cypher||c.events||c.model||c.from))return[l.otherSourceKind(t)];const i=c?[...n.objectTypes[c.objectType]?.properties??[],...Sc(c.computed).map(Nr)]:void 0,d=[];if(!Array.isArray(e.pairs)||e.pairs.length===0||e.pairs.length>4?d.push(l.pairsCount(t)):e.pairs.forEach((h,u)=>{const p=`${t}.pairs[${u}]`;return Oe(h)?(n.objectTypes[o]?.properties.some(m=>m.name===h.field)||r.some(m=>m.name===h.field)||d.push(l.fieldOfProperty(p,o)),i&&!i.some(m=>m.name===h.other)&&d.push(l.otherProperty(p,c?.objectType??"")),d):d.push(l.object(p))}),e.field!==void 0){const h=i?.find(u=>u.name===e.field);i&&!h?d.push(l.fieldOfProperty(t,c?.objectType??"")):h&&e.type!==h.type&&d.push(l.typeOfTaken(t,h.type))}else e.type!==void 0&&d.push(l.typeOnlyWithField(t));return e.where!==void 0&&i&&d.push(...xe(e.where,i,`${t}.where`)),d}function Oa(e,t){const n=Je();return Oe(e)?[...typeof e.value=="string"&&e.value.trim()!==""?[]:[n.valueText(t)],...e.tone===void 0||Pt(e.tone,_t)?[]:[n.toneOneOf(t,_t.join(n.sep))]]:[n.object(t)]}const jc=[re.done,re.overdue,re.active],Kh=[In.edited,In.followed,In.related];function dn(e){return vc(e?.computed??[],!!e?.progress)}function Yh(e){return e?e.progress?!0:JSON.stringify(e.computed??[]).includes(`"${ue}"`):!1}const Gh=`计算列(sources[].computed,可选):浏览器为数据源的每行算出的列;组件、筛选像普通属性一样用它们。计算列可以读数据源的属性、进度列和其他计算列,系统按依赖自动排顺序,不能互相引用成环。每项 { name, label, kind, ... },name 为字母开头的标识,不得与属性或进度列重名:
|
|
4
|
+
- classify(判断状态){ cases: [{ when: [条件…], value, tone? }], otherwise: { value, tone? } }:从上往下取第一条全部条件成立的 value,都不成立取 otherwise;tone 为 ${_t.join("/")},决定标签颜色。
|
|
5
|
+
- days(算天数){ from, to, when? }:from 到 to 的天数(to 减 from),二者为日期字段或 ${ue};when 不成立时为空。
|
|
4
6
|
- formula(算数){ expr }:数字字段的四则运算,可用 + - * / 和括号、数字和数字字段名,比如 "<数字字段A> - <数字字段B>" 或 "$overdueDays * 2";名字不是普通标识符的字段(含 -、以数字开头)用反引号括起来,比如 \`unit-price\` * 2;字段为空或除以 0 时为空。
|
|
5
7
|
- related(读关联数据){ path, aggregate, field?, type?, where? }:沿关系路径(关系 id 列表,从数据源的对象类出发,可反向经过关系)读到达的对象:aggregate 为 count(计数)、sum(求和)、avg(平均)、min、max(对终点对象类的数字属性 field);one 取到达对象的属性 field 作为本行的一个值(一对一的关系,如订单的客户名称;到达多个时取第一个),须写 type 为该属性的类型(date/number/text);list 把到达的每个对象的属性 field 列出来(文本,顿号连接,最多 10 个)。where 为对终点对象属性的条件,只能和固定值比较。随数据一起读取,不随基准日期变化;Cypher 数据源不能用。要在表格里显示关联对象的名称,用 one。
|
|
6
8
|
- region(识别地区){ from, scope? }:从文本字段里识别地区。scope 为 china(默认,中国的省份,可从客户名称这类含地名的文字里推断)或 world(国家,按中英文国名、常见别称或 ISO 代码识别)。只在数据里确实有地名时才用。
|
|
7
9
|
- text(拼文本){ template }:用 {字段名} 把几个字段和文字拼成一列文本,如 "{given_name} {family_name}" 得到球员全名、"{code} - {name}";引用的字段都为空时为空。需要显示全名、组合名称时用它(后端查询不能拼字符串)。
|
|
8
|
-
条件 { field, op, ref? | value? | values? }:field 为字段或 ${
|
|
9
|
-
状态、超期天数这类随进度变化的列,优先用进度(progress)自动得出,不要再用计算列重写一遍。`;function Oe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Lt(e,t){return typeof e=="string"&&t.includes(e)}const Gh={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,required:e=>`${e} 必填`,identifier:e=>`${e} 必须是字母开头的标识`,duplicate:(e,t)=>`${e} 重复:${t}`,paramsCount:(e,t)=>`${e} 必须是 1 到 ${t} 个参数`,typeOneOf:(e,t)=>`${e} 只能是 ${t.join("、")}`,minOverMax:e=>`${e} 不能大于 max`,operationsList:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,label:e=>`${e} 必须是不超过 30 字的名称`,effectsCount:(e,t,n)=>`${e} 必须是 ${t} 到 ${n} 个效果`,propertyOf:(e,t)=>`${e} 必须是 ${t} 的属性`,notKey:e=>`${e} 不能是对象的主键或标识`,kindOneOf:(e,t)=>`${e} 只能是 ${t.join("、")}`,kindOnlyFor:(e,t,n)=>`${e} ${t} 只能用于${n.join("、")}类型的属性`,ownParam:e=>`${e} 必须是本操作的参数`,paramNeeds:(e,t,n,o)=>`${e} 要求 ${t.join(" 或 ")} 类型的参数,${n} 是 ${o}`,notActionType:e=>`${e} 不是知识网络中的行动类型`,actionOn:(e,t)=>`${e} 必须作用于 ${t},或是新建对象的行动`,notUserParam:e=>`${e} 不是该行动的用户填写参数`,contextOneOf:(e,t)=>`${e} 只能是 ${t.join("、")}`,fromOneOf:e=>`${e} 只能是 param、field、const 或 context`,uniqueOnlyCreate:e=>`${e} 只用于新建对象的行动`,uniqueList:(e,t)=>`${e} 必须是 ${t} 的属性列表`,adjustNeedsLayer:()=>"图层需要先选好开始和结束",adjustSetters:(e,t)=>`操作须用日期或日期时间参数设置开始(${e})和结束(${t})`,adjustOther:e=>`操作只能设置开始、结束和所属资源,不能改 ${e}`},Hh={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,required:e=>`${e} is required`,identifier:e=>`${e} must be an identifier starting with a letter`,duplicate:(e,t)=>`${e} is used twice: ${t}`,paramsCount:(e,t)=>`${e} must be 1 to ${t} parameters`,typeOneOf:(e,t)=>`${e} must be one of ${t.join(", ")}`,minOverMax:e=>`${e} cannot be greater than max`,operationsList:(e,t)=>`${e} must be a list of at most ${t} items`,label:e=>`${e} must be a name of at most 30 characters`,effectsCount:(e,t,n)=>`${e} must be ${t} to ${n} effects`,propertyOf:(e,t)=>`${e} must be a property of ${t}`,notKey:e=>`${e} cannot be the primary key or identifier of the object`,kindOneOf:(e,t)=>`${e} must be one of ${t.join(", ")}`,kindOnlyFor:(e,t,n)=>`${e} ${t} only works on properties of type ${n.join(", ")}`,ownParam:e=>`${e} must be a parameter of this operation`,paramNeeds:(e,t,n,o)=>`${e} needs a parameter of type ${t.join(" or ")}, but ${n} is ${o}`,notActionType:e=>`${e} is not an action type of the knowledge network`,actionOn:(e,t)=>`${e} must act on ${t}, or be an action that creates an object`,notUserParam:e=>`${e} is not a parameter the user fills in for this action`,contextOneOf:(e,t)=>`${e} must be one of ${t.join(", ")}`,fromOneOf:e=>`${e} must be param, field, const or context`,uniqueOnlyCreate:e=>`${e} is only for actions that create an object`,uniqueList:(e,t)=>`${e} must be a list of properties of ${t}`,adjustNeedsLayer:()=>"the layer needs a start and an end first",adjustSetters:(e,t)=>`the operation must set the start (${e}) and the end (${t}) from date or datetime parameters`,adjustOther:e=>`the operation can only set the start, the end and the resource it belongs to, not ${e}`},lo=()=>fe({"zh-CN":Gh,"en-US":Hh}),Ac=/^[A-Za-z][A-Za-z0-9_]*$/,Vh=["number","date","text"],Jh=["number","date","datetime","text"],Js=10,Vn=5,Zs=5,at=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Zh(e,t){return e==="shiftDays"||e==="fromAsOf"?{param:["number"],field:["date"]}:e==="add"?{param:["number"],field:["number"]}:t==="date"?{param:["date","datetime"],field:[]}:{param:[t==="number"?"number":"text"],field:[]}}function Tc(e,t,n=Vh){const o=lo(),s=[],r=new Map;return!Array.isArray(e)||e.length===0||e.length>Vn?{errors:[o.paramsCount(t,Vn)],types:r}:(e.forEach((a,l)=>{const c=`${t}[${l}]`;return at(a)?(typeof a.name!="string"||!Ac.test(a.name)?s.push(o.identifier(`${c}.name`)):r.has(a.name)&&s.push(o.duplicate(`${c}.name`,a.name)),(typeof a.label!="string"||!a.label.trim())&&s.push(o.required(`${c}.label`)),n.includes(a.type)?typeof a.name=="string"&&r.set(a.name,a.type):s.push(o.typeOneOf(`${c}.type`,n)),typeof a.min=="number"&&typeof a.max=="number"&&a.min>a.max&&s.push(o.minOverMax(`${c}.min`)),s):s.push(o.object(c))}),{errors:s,types:r})}function Xh(e,t,n,o){const s=lo();if(!Array.isArray(e)||e.length>Js)return[s.operationsList(o,Js)];const r=n.objectTypes[t.objectType],a=r?.properties??[],l=pe(t,n),c=new Set;return e.flatMap((i,d)=>{const h=`${o}[${d}]`;if(!at(i))return[s.object(h)];const u=Object.keys(i).filter(y=>!["id","label","when","params","effects","action"].includes(y)).map(y=>s.noOption(h,y));typeof i.id!="string"||!Ac.test(i.id)?u.push(s.identifier(`${h}.id`)):c.has(i.id)?u.push(s.duplicate(`${h}.id`,i.id)):c.add(i.id),(typeof i.label!="string"||!i.label.trim()||i.label.length>30)&&u.push(s.label(`${h}.label`)),i.when!==void 0&&u.push(...xe(i.when,l,`${h}.when`,un(t)));const p=Tc(i.params,`${h}.params`,Jh);u.push(...p.errors);const f=p.types,m=Qh(i,n),g=Array.isArray(i.effects)?i.effects:null;if(!g||g.length===0&&!m||g.length>Zs?u.push(s.effectsCount(`${h}.effects`,m?0:1,Zs)):g.forEach((y,b)=>{const k=`${h}.effects[${b}]`;if(!at(y))return u.push(s.object(k));const w=a.find(j=>j.name===y.field);if(!w)return u.push(s.propertyOf(`${k}.field`,t.objectType));if(y.field===t.key||r?.primaryKeys.includes(w.name))return u.push(s.notKey(`${k}.field`));if(!Ks.includes(y.kind))return u.push(s.kindOneOf(`${k}.kind`,Ks));const v=Zh(String(y.kind),w.type);v.field.length>0&&!v.field.includes(w.type)&&u.push(s.kindOnlyFor(k,String(y.kind),v.field));const S=f.get(String(y.param));return S?v.param.includes(S)||u.push(s.paramNeeds(`${k}.param`,v.param,String(y.param),S)):u.push(s.ownParam(`${k}.param`)),u}),i.action!==void 0){const y=at(i.action)?i.action:null,b=y&&typeof y.id=="string"?ln(n,y.id):void 0;if(!y)u.push(s.object(`${h}.action`));else if(n.actionTypes!==void 0){if(b?b.objectType!==t.objectType&&io(b)!=="create"&&u.push(s.actionOn(`${h}.action.id`,t.objectType)):u.push(s.notActionType(`${h}.action.id`)),b&&y.params!==void 0)if(!at(y.params))u.push(s.object(`${h}.action.params`));else for(const[k,w]of Object.entries(y.params)){const v=`${h}.action.params.${k}`;b.inputs.some(S=>S.name===k)?at(w)?w.from==="param"&&!f.has(String(w.name))?u.push(s.ownParam(`${v}.name`)):w.from==="field"&&!a.some(S=>S.name===w.name)?u.push(s.propertyOf(`${v}.name`,t.objectType)):w.from==="const"&&w.value===void 0?u.push(s.required(`${v}.value`)):w.from==="context"&&!Ys.includes(w.name)?u.push(s.contextOneOf(`${v}.name`,Ys)):["param","field","const","context"].includes(String(w.from))||u.push(s.fromOneOf(`${v}.from`)):u.push(s.object(v)):u.push(s.notUserParam(v))}b&&u.push(...ep(y,b,n,h))}}return u})}function Qh(e,t){const n=at(e.action)?e.action:null,o=n?ln(t,n.id):void 0;return o!==void 0&&io(o)==="create"}function ep(e,t,n,o){if(e.unique===void 0&&e.active===void 0)return[];const s=lo();if(io(t)!=="create")return[s.uniqueOnlyCreate(`${o}.action.unique`)];const r=n.objectTypes[t.objectType]?.properties??[],a=[],l=e.unique;return(!Array.isArray(l)||l.length===0||l.some(c=>!r.some(i=>i.name===c)))&&a.push(s.uniqueList(`${o}.action.unique`,t.objectType)),e.active!==void 0&&a.push(...xe(e.active,r,`${o}.action.active`)),a}const Ea=e=>e?.type==="date"||e?.type==="datetime";function Ca(e,t){if(!t)return;const n=e.effects.find(o=>o.kind==="set"&&o.field===t);return n&&e.params.find(o=>o.name===n.param)}function tp(e,t){const n=c=>typeof c=="string"&&c!==""?c:void 0,o=n(t.startField),s=n(t.endField),r=lo();if(!o||!s)return r.adjustNeedsLayer();if(!Ea(Ca(e,o))||!Ea(Ca(e,s)))return r.adjustSetters(o,s);const a=[o,s,n(t.resourceField)],l=e.effects.find(c=>c.kind!=="set"||!a.includes(c.field));if(l)return r.adjustOther(l.field)}const np={joiner:"、",list:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,idFormat:e=>`${e} 必须是字母开头的标识`,idTwice:(e,t)=>`${e} 重复:${t}`,label:e=>`${e} 必须是不超过 30 字的名称`,text:e=>`${e} 必须是文字`,tool:e=>`${e} 必须写明执行工厂的工具箱 box 与工具 tool`,required:e=>`${e} 必填`,inputsCount:(e,t)=>`${e} 必须是 1 到 ${t} 个属性`,inputField:e=>`${e} 必须是本数据源的字段`,outputsCount:(e,t)=>`${e} 必须是 1 到 ${t} 个结果字段`,outputSameName:(e,t)=>`${e} 与本数据源的字段同名:${t}`,oneOf:(e,t)=>`${e} 只能是 ${t}`,measuresCount:(e,t)=>`${e} 必须是 1 到 ${t} 个度量`,valueField:e=>`${e} 必须是本数据源的字段或模型的结果字段`,valueFieldNumber:e=>`${e} 求和、平均、最大、最小须是数字字段`,actionType:e=>`${e} 不是知识网络中的行动类型`,actionObjectType:(e,t)=>`${e} 必须作用于 ${t}`,notUserParam:e=>`${e} 不是该行动的用户填写参数`,mustBeModelParam:e=>`${e} 必须是本模型的参数`,mustBePropertyOf:(e,t)=>`${e} 必须是 ${t} 的属性`,mustBeModelOutput:e=>`${e} 必须是本模型的结果字段`,fromOneOf:e=>`${e} 只能是 param、field、output 或 const`},op={joiner:", ",list:(e,t)=>`${e} must be a list of at most ${t} items`,object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,idFormat:e=>`${e} must be an identifier starting with a letter`,idTwice:(e,t)=>`${e} is used twice: ${t}`,label:e=>`${e} must be a name of at most 30 characters`,text:e=>`${e} must be text`,tool:e=>`${e} must name the execution factory toolbox (box) and tool`,required:e=>`${e} is required`,inputsCount:(e,t)=>`${e} must list 1 to ${t} properties`,inputField:e=>`${e} must be a field of this source`,outputsCount:(e,t)=>`${e} must list 1 to ${t} result fields`,outputSameName:(e,t)=>`${e} has the same name as a field of this source: ${t}`,oneOf:(e,t)=>`${e} must be one of ${t}`,measuresCount:(e,t)=>`${e} must list 1 to ${t} measures`,valueField:e=>`${e} must be a field of this source or a result field of the model`,valueFieldNumber:e=>`${e} must be a number field for sum, average, max and min`,actionType:e=>`${e} is not an action type of the knowledge network`,actionObjectType:(e,t)=>`${e} must act on ${t}`,notUserParam:e=>`${e} is not a parameter the user fills in for this action`,mustBeModelParam:e=>`${e} must be a parameter of this model`,mustBePropertyOf:(e,t)=>`${e} must be a property of ${t}`,mustBeModelOutput:e=>`${e} must be a result field of this model`,fromOneOf:e=>`${e} must be one of param, field, output or const`},Na=()=>fe({"zh-CN":np,"en-US":op}),xa=/^[A-Za-z][A-Za-z0-9_]*$/,Ro=["number","date","text"],Xs=["count","sum","avg","min","max","ratio"],Qs=5,er=20,tr=8,nr=8,Xe=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function sp(e,t,n,o){if(!Array.isArray(e)||e.length>Qs)return[Na().list(o,Qs)];const s=Na(),r=pe(t,n),a=new Set(r.map(i=>i.name)),l=n.objectTypes[t.objectType]?.properties??[],c=new Set;return e.flatMap((i,d)=>{const h=`${o}[${d}]`;if(!Xe(i))return[s.object(h)];const u=Object.keys(i).filter(w=>!["id","label","description","tool","inputs","params","outputs","measures","action"].includes(w)).map(w=>s.noOption(h,w));typeof i.id!="string"||!xa.test(i.id)?u.push(s.idFormat(`${h}.id`)):c.has(i.id)?u.push(s.idTwice(`${h}.id`,i.id)):c.add(i.id),(typeof i.label!="string"||!i.label.trim()||i.label.length>30)&&u.push(s.label(`${h}.label`)),i.description!==void 0&&typeof i.description!="string"&&u.push(s.text(`${h}.description`));const p=Xe(i.tool)?i.tool:null;!p||typeof p.box!="string"||!p.box||typeof p.tool!="string"?u.push(s.tool(`${h}.tool`)):p.tool||u.push(s.required(`${h}.tool.tool`));const f=Array.isArray(i.inputs)?i.inputs:null;!f||f.length===0||f.length>er?u.push(s.inputsCount(`${h}.inputs`,er)):f.forEach((w,v)=>{(typeof w!="string"||!a.has(w))&&u.push(s.inputField(`${h}.inputs[${v}]`))});const m=Tc(i.params,`${h}.params`);u.push(...m.errors);const g=Array.isArray(i.outputs)?i.outputs:null,y=new Set;!g||g.length===0||g.length>tr?u.push(s.outputsCount(`${h}.outputs`,tr)):g.forEach((w,v)=>{const S=`${h}.outputs[${v}]`;return Xe(w)?(typeof w.name!="string"||!xa.test(w.name)?u.push(s.idFormat(`${S}.name`)):a.has(w.name)?u.push(s.outputSameName(`${S}.name`,w.name)):y.has(w.name)?u.push(s.idTwice(`${S}.name`,w.name)):y.add(w.name),(typeof w.label!="string"||!w.label.trim())&&u.push(s.required(`${S}.label`)),Ro.includes(w.type)||u.push(s.oneOf(`${S}.type`,Ro.join(s.joiner))),u):u.push(s.object(S))});const b=[...r,...(g??[]).filter(Xe).map(w=>({name:String(w.name),label:String(w.label),type:Ro.includes(w.type)?w.type:"text"}))],k=Array.isArray(i.measures)?i.measures:null;if(!k||k.length===0||k.length>nr?u.push(s.measuresCount(`${h}.measures`,nr)):k.forEach((w,v)=>{const S=`${h}.measures[${v}]`;if(!Xe(w))return u.push(s.object(S));if((typeof w.label!="string"||!w.label.trim())&&u.push(s.required(`${S}.label`)),Xs.includes(w.aggregate)||u.push(s.oneOf(`${S}.aggregate`,Xs.join(s.joiner))),w.when!==void 0&&u.push(...xe(w.when,b,`${S}.when`,un(t))),["sum","avg","min","max"].includes(String(w.aggregate))){const O=b.find(A=>A.name===w.valueField);O?O.type!=="number"&&u.push(s.valueFieldNumber(`${S}.valueField`)):u.push(s.valueField(`${S}.valueField`))}return u}),i.action!==void 0){const w=Xe(i.action)?i.action:null,v=w&&typeof w.id=="string"?ln(n,w.id):void 0;if(!w)u.push(s.object(`${h}.action`));else if(n.actionTypes!==void 0){if(!v)u.push(s.actionType(`${h}.action.id`));else if(v.objectType!==t.objectType)u.push(s.actionObjectType(`${h}.action.id`,t.objectType));else if(w.params!==void 0)if(!Xe(w.params))u.push(s.object(`${h}.action.params`));else for(const[S,j]of Object.entries(w.params)){const O=`${h}.action.params.${S}`;v.inputs.some(A=>A.name===S)?Xe(j)?j.from==="param"&&!m.types.has(String(j.name))?u.push(s.mustBeModelParam(`${O}.name`)):j.from==="field"&&!l.some(A=>A.name===j.name)?u.push(s.mustBePropertyOf(`${O}.name`,t.objectType)):j.from==="output"&&!y.has(String(j.name))?u.push(s.mustBeModelOutput(`${O}.name`)):j.from==="const"&&j.value===void 0?u.push(s.required(`${O}.value`)):["param","field","output","const"].includes(String(j.from))||u.push(s.fromOneOf(`${O}.from`)):u.push(s.object(O)):u.push(s.notUserParam(O))}}}return u})}const rp=JSON.parse(`[{"name":"Fiji","zh":"斐济","a2":"FJ","a3":"FJI","alt":["Republic of Fiji"]},{"name":"Tanzania","zh":"坦桑尼亚","a2":"TZ","a3":"TZA","alt":["United Republic of Tanzania"]},{"name":"Western Sahara","zh":"西撒哈拉","a2":"EH","a3":"ESH","alt":["Sahrawi Arab Democratic Republic","W. Sahara"]},{"name":"Canada","zh":"加拿大","a2":"CA","a3":"CAN"},{"name":"United States of America","zh":"美国","a2":"US","a3":"USA","alt":["United States"]},{"name":"Kazakhstan","zh":"哈萨克斯坦","a2":"KZ","a3":"KAZ","alt":["Republic of Kazakhstan"]},{"name":"Uzbekistan","zh":"乌兹别克斯坦","a2":"UZ","a3":"UZB","alt":["Republic of Uzbekistan"]},{"name":"Papua New Guinea","zh":"巴布亚新几内亚","a2":"PG","a3":"PNG","alt":["Independent State of Papua New Guinea"]},{"name":"Indonesia","zh":"印度尼西亚","a2":"ID","a3":"IDN","alt":["Republic of Indonesia"]},{"name":"Argentina","zh":"阿根廷","a2":"AR","a3":"ARG","alt":["Argentine Republic"]},{"name":"Chile","zh":"智利","a2":"CL","a3":"CHL","alt":["Republic of Chile"]},{"name":"Democratic Republic of the Congo","zh":"刚果民主共和国","a2":"CD","a3":"COD","alt":["Congo, Dem. Rep.","Dem. Rep. Congo"]},{"name":"Somalia","zh":"索马里","a2":"SO","a3":"SOM","alt":["Federal Republic of Somalia"]},{"name":"Kenya","zh":"肯尼亚","a2":"KE","a3":"KEN","alt":["Republic of Kenya"]},{"name":"Sudan","zh":"苏丹","a2":"SD","a3":"SDN","alt":["Republic of the Sudan"]},{"name":"Chad","zh":"乍得","a2":"TD","a3":"TCD","alt":["Republic of Chad"]},{"name":"Haiti","zh":"海地","a2":"HT","a3":"HTI","alt":["Republic of Haiti"]},{"name":"Dominican Republic","zh":"多米尼加","a2":"DO","a3":"DOM","alt":["Dominican Rep."]},{"name":"Russia","zh":"俄罗斯","a2":"RU","a3":"RUS","alt":["Russian Federation"]},{"name":"The Bahamas","zh":"巴哈马","a2":"BS","a3":"BHS","alt":["Bahamas","Bahamas, The","Commonwealth of the Bahamas"]},{"name":"Falkland Islands","zh":"福克兰群岛","a2":"FK","a3":"FLK","alt":["Falkland Is.","Falkland Islands / Malvinas"]},{"name":"Norway","zh":"挪威","a2":"NO","a3":"NOR","alt":["Kingdom of Norway"]},{"name":"Greenland","zh":"格陵兰","a2":"GL","a3":"GRL"},{"name":"French Southern and Antarctic Lands","zh":"法属南部和南极领地","a2":"TF","a3":"ATF","alt":["Fr. S. Antarctic Lands","Territory of the French Southern and Antarctic Lands"]},{"name":"East Timor","zh":"东帝汶","a2":"TL","a3":"TLS","alt":["Democratic Republic of Timor-Leste","Timor-Leste"]},{"name":"South Africa","zh":"南非","a2":"ZA","a3":"ZAF","alt":["Republic of South Africa"]},{"name":"Lesotho","zh":"莱索托","a2":"LS","a3":"LSO","alt":["Kingdom of Lesotho"]},{"name":"Mexico","zh":"墨西哥","a2":"MX","a3":"MEX","alt":["United Mexican States"]},{"name":"Uruguay","zh":"乌拉圭","a2":"UY","a3":"URY","alt":["Oriental Republic of Uruguay"]},{"name":"Brazil","zh":"巴西","a2":"BR","a3":"BRA","alt":["Federative Republic of Brazil"]},{"name":"Bolivia","zh":"玻利维亚","a2":"BO","a3":"BOL","alt":["Plurinational State of Bolivia"]},{"name":"Peru","zh":"秘鲁","a2":"PE","a3":"PER","alt":["Republic of Peru"]},{"name":"Colombia","zh":"哥伦比亚","a2":"CO","a3":"COL","alt":["Republic of Colombia"]},{"name":"Panama","zh":"巴拿马","a2":"PA","a3":"PAN","alt":["Republic of Panama"]},{"name":"Costa Rica","zh":"哥斯达黎加","a2":"CR","a3":"CRI","alt":["Republic of Costa Rica"]},{"name":"Nicaragua","zh":"尼加拉瓜","a2":"NI","a3":"NIC","alt":["Republic of Nicaragua"]},{"name":"Honduras","zh":"洪都拉斯","a2":"HN","a3":"HND","alt":["Republic of Honduras"]},{"name":"El Salvador","zh":"萨尔瓦多","a2":"SV","a3":"SLV","alt":["Republic of El Salvador"]},{"name":"Guatemala","zh":"危地马拉","a2":"GT","a3":"GTM","alt":["Republic of Guatemala"]},{"name":"Belize","zh":"伯利兹","a2":"BZ","a3":"BLZ"},{"name":"Venezuela","zh":"委内瑞拉","a2":"VE","a3":"VEN","alt":["Bolivarian Republic of Venezuela","Venezuela, RB"]},{"name":"Guyana","zh":"圭亚那","a2":"GY","a3":"GUY","alt":["Co-operative Republic of Guyana"]},{"name":"Suriname","zh":"苏里南","a2":"SR","a3":"SUR","alt":["Republic of Suriname"]},{"name":"France","zh":"法国","a2":"FR","a3":"FRA","alt":["French Republic"]},{"name":"Ecuador","zh":"厄瓜多尔","a2":"EC","a3":"ECU","alt":["Republic of Ecuador"]},{"name":"Puerto Rico","zh":"波多黎各","a2":"PR","a3":"PRI","alt":["Commonwealth of Puerto Rico"]},{"name":"Jamaica","zh":"牙买加","a2":"JM","a3":"JAM"},{"name":"Cuba","zh":"古巴","a2":"CU","a3":"CUB","alt":["Republic of Cuba"]},{"name":"Zimbabwe","zh":"津巴布韦","a2":"ZW","a3":"ZWE","alt":["Republic of Zimbabwe"]},{"name":"Botswana","zh":"博茨瓦纳","a2":"BW","a3":"BWA","alt":["Republic of Botswana"]},{"name":"Namibia","zh":"纳米比亚","a2":"NA","a3":"NAM","alt":["Republic of Namibia"]},{"name":"Senegal","zh":"塞内加尔","a2":"SN","a3":"SEN","alt":["Republic of Senegal"]},{"name":"Mali","zh":"马里","a2":"ML","a3":"MLI","alt":["Republic of Mali"]},{"name":"Mauritania","zh":"毛里塔尼亚","a2":"MR","a3":"MRT","alt":["Islamic Republic of Mauritania"]},{"name":"Benin","zh":"贝宁","a2":"BJ","a3":"BEN","alt":["Republic of Benin"]},{"name":"Niger","zh":"尼日尔","a2":"NE","a3":"NER","alt":["Republic of Niger"]},{"name":"Nigeria","zh":"尼日利亚","a2":"NG","a3":"NGA","alt":["Federal Republic of Nigeria"]},{"name":"Cameroon","zh":"喀麦隆","a2":"CM","a3":"CMR","alt":["Republic of Cameroon"]},{"name":"Togo","zh":"多哥","a2":"TG","a3":"TGO","alt":["Togolese Republic"]},{"name":"Ghana","zh":"加纳","a2":"GH","a3":"GHA","alt":["Republic of Ghana"]},{"name":"Ivory Coast","zh":"科特迪瓦","a2":"CI","a3":"CIV","alt":["Côte d'Ivoire","Republic of Ivory Coast"]},{"name":"Guinea","zh":"几内亚","a2":"GN","a3":"GIN","alt":["Republic of Guinea"]},{"name":"Guinea-Bissau","zh":"几内亚比绍","a2":"GW","a3":"GNB","alt":["Republic of Guinea-Bissau"]},{"name":"Liberia","zh":"利比里亚","a2":"LR","a3":"LBR","alt":["Republic of Liberia"]},{"name":"Sierra Leone","zh":"塞拉利昂","a2":"SL","a3":"SLE","alt":["Republic of Sierra Leone"]},{"name":"Burkina Faso","zh":"布基纳法索","a2":"BF","a3":"BFA"},{"name":"Central African Republic","zh":"中非共和国","a2":"CF","a3":"CAF","alt":["Central African Rep."]},{"name":"Republic of the Congo","zh":"刚果共和国","a2":"CG","a3":"COG","alt":["Congo","Congo, Rep."]},{"name":"Gabon","zh":"加蓬","a2":"GA","a3":"GAB","alt":["Gabonese Republic"]},{"name":"Equatorial Guinea","zh":"赤道几内亚","a2":"GQ","a3":"GNQ","alt":["Eq. Guinea","Republic of Equatorial Guinea"]},{"name":"Zambia","zh":"赞比亚","a2":"ZM","a3":"ZMB","alt":["Republic of Zambia"]},{"name":"Malawi","zh":"马拉维","a2":"MW","a3":"MWI","alt":["Republic of Malawi"]},{"name":"Mozambique","zh":"莫桑比克","a2":"MZ","a3":"MOZ","alt":["Republic of Mozambique"]},{"name":"Eswatini","zh":"斯威士兰","a2":"SZ","a3":"SWZ","alt":["Kingdom of eSwatini","eSwatini"]},{"name":"Angola","zh":"安哥拉","a2":"AO","a3":"AGO","alt":["People's Republic of Angola"]},{"name":"Burundi","zh":"布隆迪","a2":"BI","a3":"BDI","alt":["Republic of Burundi"]},{"name":"Israel","zh":"以色列","a2":"IL","a3":"ISR","alt":["State of Israel"]},{"name":"Lebanon","zh":"黎巴嫩","a2":"LB","a3":"LBN","alt":["Lebanese Republic"]},{"name":"Madagascar","zh":"马达加斯加","a2":"MG","a3":"MDG","alt":["Republic of Madagascar"]},{"name":"Palestine","zh":"巴勒斯坦","a2":"PS","a3":"PSE","alt":["Palestine (West Bank and Gaza)","West Bank and Gaza"]},{"name":"The Gambia","zh":"冈比亚","a2":"GM","a3":"GMB","alt":["Gambia","Gambia, The","Republic of the Gambia"]},{"name":"Tunisia","zh":"突尼斯","a2":"TN","a3":"TUN","alt":["Republic of Tunisia"]},{"name":"Algeria","zh":"阿尔及利亚","a2":"DZ","a3":"DZA","alt":["People's Democratic Republic of Algeria"]},{"name":"Jordan","zh":"约旦","a2":"JO","a3":"JOR","alt":["Hashemite Kingdom of Jordan"]},{"name":"United Arab Emirates","zh":"阿拉伯联合酋长国","a2":"AE","a3":"ARE"},{"name":"Qatar","zh":"卡塔尔","a2":"QA","a3":"QAT","alt":["State of Qatar"]},{"name":"Kuwait","zh":"科威特","a2":"KW","a3":"KWT","alt":["State of Kuwait"]},{"name":"Iraq","zh":"伊拉克","a2":"IQ","a3":"IRQ","alt":["Republic of Iraq"]},{"name":"Oman","zh":"阿曼","a2":"OM","a3":"OMN","alt":["Sultanate of Oman"]},{"name":"Vanuatu","zh":"瓦努阿图","a2":"VU","a3":"VUT","alt":["Republic of Vanuatu"]},{"name":"Cambodia","zh":"柬埔寨","a2":"KH","a3":"KHM","alt":["Kingdom of Cambodia"]},{"name":"Thailand","zh":"泰国","a2":"TH","a3":"THA","alt":["Kingdom of Thailand"]},{"name":"Laos","zh":"老挝","a2":"LA","a3":"LAO","alt":["Lao PDR","Lao People's Democratic Republic"]},{"name":"Myanmar","zh":"缅甸","a2":"MM","a3":"MMR","alt":["Republic of the Union of Myanmar"]},{"name":"Vietnam","zh":"越南","a2":"VN","a3":"VNM","alt":["Socialist Republic of Vietnam"]},{"name":"North Korea","zh":"朝鲜民主主义人民共和国","a2":"KP","a3":"PRK","alt":["Dem. Rep. Korea","Democratic People's Republic of Korea","Korea, Dem. Rep."]},{"name":"South Korea","zh":"大韩民国","a2":"KR","a3":"KOR","alt":["Korea, Rep.","Republic of Korea"]},{"name":"Mongolia","zh":"蒙古国","a2":"MN","a3":"MNG"},{"name":"India","zh":"印度","a2":"IN","a3":"IND","alt":["Republic of India"]},{"name":"Bangladesh","zh":"孟加拉国","a2":"BD","a3":"BGD","alt":["People's Republic of Bangladesh"]},{"name":"Bhutan","zh":"不丹","a2":"BT","a3":"BTN","alt":["Kingdom of Bhutan"]},{"name":"Nepal","zh":"尼泊尔","a2":"NP","a3":"NPL"},{"name":"Pakistan","zh":"巴基斯坦","a2":"PK","a3":"PAK","alt":["Islamic Republic of Pakistan"]},{"name":"Afghanistan","zh":"阿富汗","a2":"AF","a3":"AFG","alt":["Islamic State of Afghanistan"]},{"name":"Tajikistan","zh":"塔吉克斯坦","a2":"TJ","a3":"TJK","alt":["Republic of Tajikistan"]},{"name":"Kyrgyzstan","zh":"吉尔吉斯斯坦","a2":"KG","a3":"KGZ","alt":["Kyrgyz Republic"]},{"name":"Turkmenistan","zh":"土库曼斯坦","a2":"TM","a3":"TKM"},{"name":"Iran","zh":"伊朗","a2":"IR","a3":"IRN","alt":["Iran, Islamic Rep.","Islamic Republic of Iran"]},{"name":"Syria","zh":"叙利亚","a2":"SY","a3":"SYR","alt":["Syrian Arab Republic"]},{"name":"Armenia","zh":"亚美尼亚","a2":"AM","a3":"ARM","alt":["Republic of Armenia"]},{"name":"Sweden","zh":"瑞典","a2":"SE","a3":"SWE","alt":["Kingdom of Sweden"]},{"name":"Belarus","zh":"白俄罗斯","a2":"BY","a3":"BLR","alt":["Republic of Belarus"]},{"name":"Ukraine","zh":"乌克兰","a2":"UA","a3":"UKR"},{"name":"Poland","zh":"波兰","a2":"PL","a3":"POL","alt":["Republic of Poland"]},{"name":"Austria","zh":"奥地利","a2":"AT","a3":"AUT","alt":["Republic of Austria"]},{"name":"Hungary","zh":"匈牙利","a2":"HU","a3":"HUN","alt":["Republic of Hungary"]},{"name":"Moldova","zh":"摩尔多瓦","a2":"MD","a3":"MDA","alt":["Republic of Moldova"]},{"name":"Romania","zh":"罗马尼亚","a2":"RO","a3":"ROU"},{"name":"Lithuania","zh":"立陶宛","a2":"LT","a3":"LTU","alt":["Republic of Lithuania"]},{"name":"Latvia","zh":"拉脱维亚","a2":"LV","a3":"LVA","alt":["Republic of Latvia"]},{"name":"Estonia","zh":"爱沙尼亚","a2":"EE","a3":"EST","alt":["Republic of Estonia"]},{"name":"Germany","zh":"德国","a2":"DE","a3":"DEU","alt":["Federal Republic of Germany"]},{"name":"Bulgaria","zh":"保加利亚","a2":"BG","a3":"BGR","alt":["Republic of Bulgaria"]},{"name":"Greece","zh":"希腊","a2":"GR","a3":"GRC","alt":["Hellenic Republic"]},{"name":"Turkey","zh":"土耳其","a2":"TR","a3":"TUR","alt":["Republic of Turkey"]},{"name":"Albania","zh":"阿尔巴尼亚","a2":"AL","a3":"ALB","alt":["Republic of Albania"]},{"name":"Croatia","zh":"克罗地亚","a2":"HR","a3":"HRV","alt":["Republic of Croatia"]},{"name":"Switzerland","zh":"瑞士","a2":"CH","a3":"CHE","alt":["Swiss Confederation"]},{"name":"Luxembourg","zh":"卢森堡","a2":"LU","a3":"LUX","alt":["Grand Duchy of Luxembourg"]},{"name":"Belgium","zh":"比利时","a2":"BE","a3":"BEL","alt":["Kingdom of Belgium"]},{"name":"Netherlands","zh":"荷兰","a2":"NL","a3":"NLD","alt":["Kingdom of the Netherlands"]},{"name":"Portugal","zh":"葡萄牙","a2":"PT","a3":"PRT","alt":["Portuguese Republic"]},{"name":"Spain","zh":"西班牙","a2":"ES","a3":"ESP","alt":["Kingdom of Spain"]},{"name":"Ireland","zh":"爱尔兰","a2":"IE","a3":"IRL"},{"name":"New Caledonia","zh":"新喀里多尼亚","a2":"NC","a3":"NCL"},{"name":"Solomon Islands","zh":"所罗门群岛","a2":"SB","a3":"SLB","alt":["Solomon Is."]},{"name":"New Zealand","zh":"新西兰","a2":"NZ","a3":"NZL"},{"name":"Australia","zh":"澳大利亚","a2":"AU","a3":"AUS","alt":["Commonwealth of Australia"]},{"name":"Sri Lanka","zh":"斯里兰卡","a2":"LK","a3":"LKA","alt":["Democratic Socialist Republic of Sri Lanka"]},{"name":"People's Republic of China","zh":"中华人民共和国","a2":"CN","a3":"CHN","alt":["China","Chinese Taipei","Taiwan","中国台湾","台湾"]},{"name":"Italy","zh":"意大利","a2":"IT","a3":"ITA","alt":["Italian Republic"]},{"name":"Denmark","zh":"丹麦","a2":"DK","a3":"DNK","alt":["Kingdom of Denmark"]},{"name":"United Kingdom","zh":"英国","a2":"GB","a3":"GBR","alt":["United Kingdom of Great Britain and Northern Ireland"]},{"name":"Iceland","zh":"冰岛","a2":"IS","a3":"ISL","alt":["Republic of Iceland"]},{"name":"Azerbaijan","zh":"阿塞拜疆","a2":"AZ","a3":"AZE","alt":["Republic of Azerbaijan"]},{"name":"Georgia","zh":"格鲁吉亚","a2":"GE","a3":"GEO"},{"name":"Philippines","zh":"菲律宾","a2":"PH","a3":"PHL","alt":["Republic of the Philippines"]},{"name":"Malaysia","zh":"马来西亚","a2":"MY","a3":"MYS"},{"name":"Brunei","zh":"文莱","a2":"BN","a3":"BRN","alt":["Brunei Darussalam","Negara Brunei Darussalam"]},{"name":"Slovenia","zh":"斯洛文尼亚","a2":"SI","a3":"SVN","alt":["Republic of Slovenia"]},{"name":"Finland","zh":"芬兰","a2":"FI","a3":"FIN","alt":["Republic of Finland"]},{"name":"Slovakia","zh":"斯洛伐克","a2":"SK","a3":"SVK","alt":["Slovak Republic"]},{"name":"Czech Republic","zh":"捷克","a2":"CZ","a3":"CZE","alt":["Czechia"]},{"name":"Eritrea","zh":"厄立特里亚","a2":"ER","a3":"ERI","alt":["State of Eritrea"]},{"name":"Japan","zh":"日本","a2":"JP","a3":"JPN"},{"name":"Paraguay","zh":"巴拉圭","a2":"PY","a3":"PRY","alt":["Republic of Paraguay"]},{"name":"Yemen","zh":"也门","a2":"YE","a3":"YEM","alt":["Republic of Yemen","Yemen, Rep."]},{"name":"Saudi Arabia","zh":"沙特阿拉伯","a2":"SA","a3":"SAU","alt":["Kingdom of Saudi Arabia"]},{"name":"Antarctica","zh":"南极洲","a2":"AQ","a3":"ATA"},{"name":"Turkish Republic of Northern Cyprus","zh":"北塞浦路斯土耳其共和国","a3":"CYN","alt":["Cyprus, Northern","N. Cyprus","Northern Cyprus"]},{"name":"Cyprus","zh":"塞浦路斯","a2":"CY","a3":"CYP","alt":["Republic of Cyprus"]},{"name":"Morocco","zh":"摩洛哥","a2":"MA","a3":"MAR","alt":["Kingdom of Morocco"]},{"name":"Egypt","zh":"埃及","a2":"EG","a3":"EGY","alt":["Arab Republic of Egypt","Egypt, Arab Rep."]},{"name":"Libya","zh":"利比亚","a2":"LY","a3":"LBY"},{"name":"Ethiopia","zh":"埃塞俄比亚","a2":"ET","a3":"ETH","alt":["Federal Democratic Republic of Ethiopia"]},{"name":"Djibouti","zh":"吉布提","a2":"DJ","a3":"DJI","alt":["Republic of Djibouti"]},{"name":"Somaliland","zh":"索马里兰","a3":"SOL","alt":["Republic of Somaliland"]},{"name":"Uganda","zh":"乌干达","a2":"UG","a3":"UGA","alt":["Republic of Uganda"]},{"name":"Rwanda","zh":"卢旺达","a2":"RW","a3":"RWA","alt":["Republic of Rwanda"]},{"name":"Bosnia and Herzegovina","zh":"波斯尼亚和黑塞哥维那","a2":"BA","a3":"BIH","alt":["Bosnia and Herz."]},{"name":"North Macedonia","zh":"北马其顿","a2":"MK","a3":"MKD","alt":["Republic of North Macedonia"]},{"name":"Serbia","zh":"塞尔维亚","a2":"RS","a3":"SRB","alt":["Republic of Serbia"]},{"name":"Montenegro","zh":"黑山","a2":"ME","a3":"MNE"},{"name":"Kosovo","zh":"科索沃","a2":"XK","a3":"KOS","alt":["Republic of Kosovo"]},{"name":"Trinidad and Tobago","zh":"特立尼达和多巴哥","a2":"TT","a3":"TTO","alt":["Republic of Trinidad and Tobago"]},{"name":"South Sudan","zh":"南苏丹","a2":"SS","a3":"SSD","alt":["Republic of South Sudan","S. Sudan"]}]`),ap=["北京","天津","河北","山西","内蒙古","辽宁","吉林","黑龙江","上海","江苏","浙江","安徽","福建","江西","山东","河南","湖北","湖南","广东","广西","海南","重庆","四川","贵州","云南","西藏","陕西","甘肃","青海","宁夏","新疆","台湾","香港","澳门"],ip={河北:"石家庄 唐山 保定 邯郸 秦皇岛 廊坊 沧州 邢台 张家口 承德 衡水",山西:"太原 大同 长治 晋城 运城 临汾",内蒙古:"呼和浩特 包头 鄂尔多斯 赤峰",辽宁:"沈阳 大连 鞍山 抚顺 锦州 营口 丹东",吉林:"长春 四平 延吉",黑龙江:"哈尔滨 齐齐哈尔 大庆 牡丹江 佳木斯",江苏:"南京 苏州 无锡 常州 南通 徐州 扬州 镇江 盐城 泰州 连云港 淮安 宿迁 昆山 江阴",浙江:"杭州 宁波 温州 绍兴 嘉兴 金华 台州 湖州 义乌",安徽:"合肥 芜湖 蚌埠 马鞍山 安庆",福建:"福州 厦门 泉州 漳州 莆田",江西:"南昌 赣州 九江 景德镇",山东:"济南 青岛 烟台 潍坊 淄博 威海 临沂 济宁 泰安 日照 东营",河南:"郑州 洛阳 开封 新乡 南阳 许昌 安阳",湖北:"武汉 宜昌 襄阳 十堰 荆州 黄石",湖南:"长沙 株洲 湘潭 衡阳 岳阳 常德",广东:"广州 深圳 东莞 佛山 珠海 中山 惠州 汕头 江门 湛江 肇庆",广西:"南宁 柳州 桂林 北海",海南:"海口 三亚",四川:"成都 绵阳 德阳 宜宾 南充 泸州",贵州:"贵阳 遵义",云南:"昆明 大理 曲靖 玉溪",西藏:"拉萨",陕西:"西安 宝鸡 咸阳 榆林 延安 汉中",甘肃:"兰州 天水",青海:"西宁",宁夏:"银川",新疆:"乌鲁木齐 克拉玛依 喀什"};[...ap.map(e=>[e,e]),...Object.entries(ip).flatMap(([e,t])=>t.split(" ").map(n=>[n,e]))].sort((e,t)=>t[0].length-e[0].length);const lp={GB:["England","Scotland","Wales","Northern Ireland","Great Britain","UK","英格兰","苏格兰","威尔士","北爱尔兰"],US:["USA","United States","America","美利坚"],KR:["Korea Republic","Republic of Korea","Korea","韩国"],KP:["Korea DPR","DPR Korea","North Korea","朝鲜"],IR:["IR Iran","Iran"],CI:["Côte d'Ivoire","Cote d'Ivoire","Ivory Coast","科特迪瓦"],CZ:["Czechia","Czech Republic","捷克"],TR:["Türkiye","Turkey","土耳其"],NL:["Holland","荷兰"],IE:["Republic of Ireland","Éire"],RU:["Russia","Russian Federation","俄罗斯"],CN:["China PR","中国","TWN"],AE:["UAE","阿联酋"]},cp=e=>e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu,""),dp=["zh-Hans","en"].flatMap(e=>{try{return typeof Intl<"u"&&"DisplayNames"in Intl?[new Intl.DisplayNames([e],{type:"region"})]:[]}catch{return[]}});function up(e){return e?dp.flatMap(t=>{try{const n=t.of(e);return n&&n!==e?[n]:[]}catch{return[]}}):[]}const Oc=rp.flatMap(e=>[e.name,e.zh,e.a2,e.a3,...e.alt??[],...e.a2?lp[e.a2]??[]:[],...up(e.a2)].filter(t=>!!t).map(t=>[cp(t),e.name])).filter(([e])=>e.length>0).sort((e,t)=>t[0].length-e[0].length);new Map(Oc);Oc.filter(([e])=>new RegExp("\\p{Script=Han}","u").test(e)&&e.length>=2);function Ec(e){if(e?.length!==1)return null;const[t]=e;return t.op==="in"&&t.values?.length?{field:t.field,values:t.values}:t.op==="eq"&&t.ref===void 0&&t.value!==void 0?{field:t.field,values:[String(t.value)]}:null}function Qt(e,t){return e&&t?.length?[{field:e,op:"in",values:t}]:void 0}const hp=()=>nt().listNetworks(),pp=e=>nt().listObjectTypes(e),fp=(e,t)=>nt().getObjectType(e,t),mp=e=>nt().listRelationTypes(e),gp={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,oneOf:(e,t)=>`${e} 必须是 ${t.join("、")} 之一`,question:e=>`${e} 必须是不超过 300 字的问题`,placeholder:(e,t)=>`${e} 里的 {${t}} 不是这次点击能填的内容`,agent:e=>`${e} 目前只能是 analyst`,context:(e,t)=>`${e} 只能取 ${t.join("、")}`,send:(e,t)=>`${e} 只能是 ${t.join(" 或 ")}`,maxObjects:(e,t)=>`${e} 必须是 1 到 ${t} 的整数`,list:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,label:e=>`${e} 必须是不超过 20 字的文本`,steps:(e,t)=>`${e} 必须是 1 到 ${t} 个动作`,noObjectSimulate:(e,t)=>`${e} 这次点击没有对象,不能推演:${t}`,operation:(e,t)=>`${e} 必须是数据源的推演操作:${t}`,noObjectAct:(e,t)=>`${e} 这次点击没有对象,不能执行行动:${t}`,kind:e=>`${e} 只能是 ask、act 或 simulate`},yp={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,oneOf:(e,t)=>`${e} must be one of ${t.join(", ")}`,question:e=>`${e} must be a question of at most 300 characters`,placeholder:(e,t)=>`${e} has {${t}}, which this click cannot fill in`,agent:e=>`${e} can only be analyst for now`,context:(e,t)=>`${e} must be one of ${t.join(", ")}`,send:(e,t)=>`${e} must be ${t.join(" or ")}`,maxObjects:(e,t)=>`${e} must be an integer from 1 to ${t}`,list:(e,t)=>`${e} must be a list of at most ${t} items`,label:e=>`${e} must be text of at most 20 characters`,steps:(e,t)=>`${e} must be 1 to ${t} steps`,noObjectSimulate:(e,t)=>`${e} this click has no objects, so it cannot simulate: ${t}`,operation:(e,t)=>`${e} must be a scenario operation of the source: ${t}`,noObjectAct:(e,t)=>`${e} this click has no objects, so it cannot run an action: ${t}`,kind:e=>`${e} must be ask, act or simulate`},Cc=()=>fe({"zh-CN":gp,"en-US":yp}),bp={alertList:["rule","object"],metricCards:["card"],objectTable:["row"],objectList:["row"],pivotTable:["row"],trendChart:["point"],regionMap:["region"],stageChain:["stage"],[me]:["button"]},wp={alertList:["rule","object"],objectTable:["row"],objectList:["row"],pivotTable:["row"],[me]:["button"]},Ra={objectTable:"row",objectList:"row",[me]:"button"},Nc={rule:["count","rule.label","rule.severity"],object:["count","rule.label","rule.severity"],card:["count","card.label","value"],row:["count"],point:["count","category","period","value","series"],region:["count","region","value"],stage:["count","stage.label"],button:["count"]},xc=["object","row","button"],or=["hits","filters"],sr=["auto","prefill"],rr=200,kp=/\{([^{}]+)\}/g;function vp(e){return[...e.matchAll(kp)].map(t=>t[1].trim())}function ar(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $p(e,t,n,o){const s=Cc();if(!ar(e))return[s.object(o)];const r=new Set(["on","question","agent","context","send","maxObjects"]),a=Object.keys(e).filter(l=>!r.has(l)).map(l=>s.noOption(o,l));if(t.includes(e.on)||a.push(s.oneOf(`${o}.on`,t)),typeof e.question!="string"||!e.question.trim()||e.question.length>300)a.push(s.question(`${o}.question`));else{const l=new Set([...Nc[e.on]??[],...xc.includes(e.on)?(n??[]).map(c=>c.name):[]]);for(const c of vp(e.question))l.has(c)||a.push(s.placeholder(`${o}.question`,c))}return e.agent!==void 0&&e.agent!=="analyst"&&a.push(s.agent(`${o}.agent`)),e.context!==void 0&&(!Array.isArray(e.context)||e.context.some(l=>!or.includes(l)))&&a.push(s.context(`${o}.context`,or)),e.send!==void 0&&!sr.includes(e.send)&&a.push(s.send(`${o}.send`,sr)),e.maxObjects!==void 0&&(typeof e.maxObjects!="number"||!Number.isInteger(e.maxObjects)||e.maxObjects<1||e.maxObjects>rr)&&a.push(s.maxObjects(`${o}.maxObjects`,rr)),a}const Sp=["row","object","rule","button"],jp=8,Jn=5;function Ap({on:e,...t}){return{on:e,do:[{kind:"ask",...t}]}}function Tp({on:e,label:t,...n}){return{on:e,...t?{label:t}:{},do:[{kind:"act",...n}]}}function Op(e,t,n,o,s,r){const a=Cc();return!Array.isArray(e)||e.length>t.max?[a.list(r,t.max)]:e.flatMap((l,c)=>{const i=`${r}[${c}]`;if(!ar(l))return[a.object(i)];const d=Object.keys(l).filter(u=>!["on","label","do"].includes(u)).map(u=>a.noOption(i,u)),h=l.on;return t.on.includes(h)?(l.label!==void 0&&(typeof l.label!="string"||l.label.length>20)&&d.push(a.label(`${i}.label`)),!Array.isArray(l.do)||l.do.length===0||l.do.length>Jn?(d.push(a.steps(`${i}.do`,Jn)),d):(l.do.forEach((u,p)=>{const f=`${i}.do[${p}]`;if(!ar(u))return d.push(a.object(f));const{kind:m,...g}=u;if(m==="ask")d.push(...$p({...g,on:h},[h],s,f));else if(m==="simulate"){t.actOn.includes(h)||d.push(a.noObjectSimulate(f,h));const y=ue(n.spec,o);Object.keys(g).filter(b=>b!=="operation").forEach(b=>d.push(a.noOption(f,b))),y?.operations?.some(b=>b.id===g.operation)||d.push(a.operation(`${f}.operation`,String(g.operation)))}else m==="act"?t.actOn.includes(h)?d.push(...fc({...g,on:h},{on:[h],hit:t.hit},n,o,f)):d.push(a.noObjectAct(f,h)):d.push(a.kind(`${f}.kind`));return d}),d)):(d.push(a.oneOf(`${i}.on`,t.on)),d)})}function Ep(e,t,n,o){const s=e.filter(a=>Sp.includes(a)),r=e.map(a=>`${a}:${Nc[a].join("、")}`).join(";");return[`点击时还要做什么,列表,每项 { on, label?, do }:on 为 ${e.join("、")} 之一;do 为按顺序执行的 1 到 ${Jn} 个动作(点击写入的筛选总是先写入,不写在这里)`,s.length>0?`${s.join("、")} 各项是单独一个按钮,label 为按钮文字`:"",`问 Agent 的动作 { kind: "ask", question, agent?, context?, send?, maxObjects? }:question 是问题模板,可用占位 {…}(${r}${e.some(a=>xc.includes(a))?";点到单个对象时还可用该对象的字段名":""});context 取 hits(点到的对象)、filters(当前筛选);send 为 auto(直接发送)或 prefill(放进输入框)`,t.length>0?`推演的动作 { kind: "simulate", operation }(只能用于 ${t.join("、")}):operation 为数据源的推演操作 id,点击后由用户填参数,写入当前方案,不执行行动${o?`;数据源有推演操作而这里没写推演的动作时,${o} 上已自动提供“推演”按钮(多个操作时为下拉选择),只在要限定用哪个操作时才写`:""};执行行动的动作 { kind: "act", action, targets?, params?, confirm?, maxObjects? }(只能用于 ${t.join("、")}):action 为行动类型 id,须作用于数据源的对象类;targets ${n?"默认 hit(点到的对象),也可":""}为 { selection: 选中筛选 } 或 { set: 对象集合筛选 };params 给行动的每个“用户填写”参数指定来源:{ from: "input", label? }(确认时用户填)、{ from: "var", variable }(页面筛选的值)、{ from: "const", value };confirm 为确认时的说明,可用 {count}、{action};执行前总会弹出确认`:""].filter(Boolean).join(";")}function Cp(e){return typeof e=="string"&&e!==""?e.slice(0,10):"—"}function Np(e){return e.toLocaleString(void 0,{maximumFractionDigits:2})}function xp(e,t="text"){return e==null||e===""?"—":t==="date"?Cp(e):t==="number"&&typeof e=="number"?Np(e):String(e)}let Zn=ge;function Rp(e){const t=Object.values(re).find(s=>s.value===e);if(!t)return e;const n=`workshopLab.progress.status.${e}`,o=Zn.isInitialized?Zn.t(n):n;return typeof o=="string"&&o!==n?o:t.label}function _p(e){const t=Object.values(In).find(s=>s.value===e);if(!t)return e;const n=`workshopLab.scenario.mark.${e}`,o=Zn.isInitialized?Zn.t(n):n;return typeof o=="string"&&o!==n?o:t.label}function _o(e,t,n){return e===le.status&&typeof t=="string"?Rp(t):e===cn&&typeof t=="string"?_p(t):xp(t,n)}const Fe=e=>typeof e=="string"?e:"";function Pp(e,t){const n=(Array.isArray(e.layers)?e.layers:[]).filter(a=>typeof a=="object"&&a!==null),o=[],s=n.filter(a=>a.style==="standard");n.length>0&&s.length===0&&o.push({key:"noTasks"}),Fe(e.source)!==""&&Fe(e.titleField)===""&&o.push({key:"noResourceName"});const r=n.some(a=>a.style==="background"&&a.blocks===!0);for(const a of s){const l=Fe(a.label),c=Array.isArray(a.ruleTools)?a.ruleTools:[],i=u=>Array.isArray(u)&&u.length>0,d=a.exclusive===!0||r||c.length>0||Fe(a.earliestField)!==""||i(a.readyFrom)||i(a.predecessorPath);Fe(a.adjust)!==""&&!d&&o.push({key:"noConstraints",values:{layer:l}});const h=new Set;for(const u of c){const p=u?.tool;if(!p||Fe(p.box)===""||Fe(p.tool)==="")continue;const f=`${Fe(p.box)}/${Fe(p.tool)}`;h.has(f)&&o.push({key:"duplicateTool",values:{layer:l,name:Fe(u.name)}}),h.add(f)}}return o}const Lp=/^\d{4}-\d{2}-\d{2}$/;function _a(e,t){const n=new Intl.DateTimeFormat("en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(new Date(e)),o=r=>Number(n.find(a=>a.type===r)?.value);return Date.UTC(o("year"),o("month")-1,o("day"),o("hour"),o("minute"),o("second"))-(e-(e%1e3+1e3)%1e3)}function Ip(e){if(e)try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),e}catch{return}}const Mp=e=>{const[t,n,o]=e.split("-").map(Number);return new Date(Date.UTC(t,n-1,o+1)).toISOString().slice(0,10)};function Rc(e,t){const[n,o,s]=e.split("-").map(Number),r=Ip(t);if(!r)return new Date(n,o-1,s).getTime();const a=Date.UTC(n,o-1,s),l=a-_a(a,r);return a-_a(l,r)}function qp(e,t){return Rc(Mp(e),t)-1}function Fp(e){return new Set([...e.dimensions,...e.timeDimensions])}function Pa(e,t){return e.kn.objectTypes[e.metric.objectType]?.properties.find(n=>n.name===t)?.type}const ir=(e,t)=>({source:"property",property_ref:{object_type_id:e.objectType,property_name:t}}),_c=e=>({source:"literal",value_type:"string",value:e}),Pc=e=>({source:"literal",value_type:Number.isInteger(e)?"int64":"decimal",value:e}),Qe=e=>({source:"literal",value_type:"datetime",value:e}),Ce=(e,t,n)=>({node_type:"predicate",left:e,comparison_operator:t,...n?{right:n}:{}});function Dp(e,t){if(t.length!==0)return t.length===1?t[0]:{node_type:"group",boolean_operator:e,children:t}}const Lc=e=>e!==""&&e!==null&&e!==void 0&&!Number.isNaN(Number(e));function Ic(e,t,n,o){if(!Lp.test(n))return null;const[s,r]=[Rc(n,o.timezone),qp(n,o.timezone)];switch(t){case"eq":return Ce(e,"between",[Qe(s),Qe(r)]);case"ne":return Ce(e,"not_between",[Qe(s),Qe(r)]);case"before":return Ce(e,"before",[Qe(s)]);case"onOrBefore":return Ce(e,"before_or_equal",[Qe(r)]);case"after":return Ce(e,"after",[Qe(r)]);case"onOrAfter":return Ce(e,"after_or_equal",[Qe(s)]);default:return null}}function Bp(e,t,n,o){if(n.length===0)return null;const s=ir(o,e);if(t==="text")return Ce(s,"in",n.map(_c));if(t==="number")return n.every(Lc)?Ce(s,"in",n.map(a=>Pc(Number(a)))):null;const r=n.map(a=>Ic(s,"eq",a.slice(0,10),o));return r.every(Boolean)?Dp("or",r)??null:null}const La={eq:"eq",ne:"neq",before:"before",onOrBefore:"before_or_equal",after:"after",onOrAfter:"after_or_equal",gt:"gt",gte:"gte",lt:"lt",lte:"lte"};function Mc(e,t){const n=Fp(t.metric),o=n.has(e.field)?Pa(t,e.field):void 0;if(!o)return null;const s=ir(t.metric,e.field);if(e.op==="isSet")return Ce(s,o==="text"?"is_not_empty":"is_not_null");if(e.op==="isEmpty")return Ce(s,o==="text"?"is_empty":"is_null");if(e.op==="in")return Bp(e.field,o,e.values??[],t.metric);if(e.ref!==void 0&&e.ref!==he){const l=n.has(e.ref)?Pa(t,e.ref):void 0,c=La[e.op];return!c||l!==o||["before","onOrBefore","after","onOrAfter"].includes(e.op)||["gt","gte","lt","lte"].includes(e.op)&&o!=="number"?null:Ce(s,c,[ir(t.metric,e.ref)])}const r=e.ref===he?t.asOf:e.value;if(r===void 0||r==="")return null;if(o==="date")return Ic(s,e.op,String(r).slice(0,10),t.metric);const a=La[e.op];return o==="number"?!a||["before","onOrBefore","after","onOrAfter"].includes(e.op)?null:Lc(r)?Ce(s,a,[Pc(Number(r))]):null:e.op==="eq"||e.op==="ne"?Ce(s,a,[_c(String(r))]):null}const Up={cardShape:"指标卡只能显示返回单个值的指标",timeShape:"按时间的图表只能用有固定时间粒度、没有固定分组的指标",timeGrain:"时间粒度须为日、周、月或季度",weekStart:"按周的指标须从周一起算",categoryShape:"按类别的图表只能用返回单个值的指标",categoryDimension:"类别列须是指标开放的分析维度",blocked:e=>`子集的条件(${e})不能交给平台`,listJoiner:"、",ops:{isSet:"有值",isEmpty:"为空",eq:"等于",ne:"不等于",in:"属于",before:"早于",onOrBefore:"不晚于",after:"晚于",onOrAfter:"不早于",gt:"大于",gte:"不小于",lt:"小于",lte:"不大于"},refShape:e=>`${e} 必须是 { id, version },version 为不小于 1 的整数`,unknownMetric:(e,t)=>`${e} 不是知识网络中已发布的对象指标:${t}`,unpublished:(e,t,n)=>`${e} 的版本 ${t} 尚未发布(最新为 ${n})`,sourceKind:e=>`${e} 对象指标只能用在对象类数据源或它的子集上`,otherObjectType:(e,t)=>`${e} 指标「${t}」不属于数据源的对象类`,subsetBlocked:(e,t)=>`${e} 数据源是子集,它的条件(${t})不能交给平台,不能用对象指标`,unfit:(e,t,n)=>`${e} ${t}:「${n}」`},zp={cardShape:"a metric card can only show a metric that returns a single value",timeShape:"a chart by time can only use a metric with a fixed time grain and no fixed grouping",timeGrain:"the time grain must be day, week, month or quarter",weekStart:"a weekly metric must start its weeks on Monday",categoryShape:"a chart by category can only use a metric that returns a single value",categoryDimension:"the category column must be an analysis dimension the metric opens",blocked:e=>`the subset's condition (${e}) cannot be handed to the platform`,listJoiner:", ",ops:{isSet:"has a value",isEmpty:"is empty",eq:"equals",ne:"does not equal",in:"is one of",before:"is before",onOrBefore:"is not after",after:"is after",onOrAfter:"is not before",gt:"is greater than",gte:"is at least",lt:"is less than",lte:"is at most"},refShape:e=>`${e} must be { id, version }, with version an integer of at least 1`,unknownMetric:(e,t)=>`${e} is not a published object metric of the knowledge network: ${t}`,unpublished:(e,t,n)=>`version ${t} of ${e} is not published yet (the latest is ${n})`,sourceKind:e=>`${e}: an object metric can only be used on an object type source or a subset of one`,otherObjectType:(e,t)=>`${e}: metric "${t}" does not belong to the source's object type`,subsetBlocked:(e,t)=>`${e}: the source is a subset whose condition (${t}) cannot be handed to the platform, so it cannot use an object metric`,unfit:(e,t,n)=>`${e}: ${t} ("${n}")`},Pr=()=>fe({"zh-CN":Up,"en-US":zp}),Wp=new Set(["day","week","month","quarter"]);function Kp(e,t){return e==="card"?{place:"card"}:t.axis==="category"?{place:"category",...typeof t.category=="string"?{category:t.category}:{}}:{place:"time"}}function lr(e){if(typeof e!="object"||e===null)return;const{id:t,version:n}=e;return typeof t=="string"&&t!==""&&Number.isInteger(n)&&(n??0)>=1?{id:t,version:n}:void 0}function Yp(e){const t=e.owner_object_type_id,n=p=>p.filter(f=>f.object_type_id===t&&!f.relation_path_alias).map(f=>f.property_name),o=e.result_semantics.statistical_grain,s=e.specification,r=s.kind==="derived"?s.business_qualifiers:void 0,a=n(e.query_capabilities.time_dimensions),l=r?.event_time,c=l?l.object_type_id===t?l.property_name:void 0:e.query_capabilities.time_dimensions.length===1?a[0]:void 0,i=r?.time_window,d=e.result_semantics.value,h=d.unit?.display_symbol||d.unit?.code,u=o.time_granularity?"time_series":o.group_by_dimensions.length>0?"grouped":"summary";return{id:e.id,version:e.version,status:e.lifecycle.status==="deprecated"?"deprecated":"published",code:e.code,name:e.name,description:e.description,objectType:t,kind:e.metric_type,shape:u,...o.time_granularity?{grain:o.time_granularity}:{},...o.timezone?{timezone:o.timezone}:{},...o.week_start?{weekStart:o.week_start}:{},groupBy:n(o.group_by_dimensions),dimensions:n(e.query_capabilities.analysis_dimensions),timeDimensions:a,...c?{timeField:c}:{},...i&&i.mode!=="unbounded"?{window:{mode:i.mode,..."length"in i?{length:i.length,unit:i.unit}:{},..."period"in i?{period:i.period}:{}}}:{},noData:e.result_semantics.no_data_policy,value:{semantic:d.semantic_type,...d.scale!==void 0?{scale:d.scale}:{},...h?{unit:h}:{},...d.unit?.quantity_kind==="currency"?{unitFirst:!0}:{}}}}function Gp(e,t=[]){const n=new Map;for(const o of[...e,...t]){const s=Yp(o.definition),r=n.get(s.id);(!r||r.status===s.status&&s.version>r.version)&&n.set(s.id,s)}return[...n.values()]}function Hp(e,t,n){const o=Pr();return t==="card"?e.shape==="summary"?null:o.cardShape:t==="time"?e.shape!=="time_series"||e.groupBy.length>0?o.timeShape:Wp.has(e.grain??"")?e.grain==="week"&&e.weekStart==="sunday"?o.weekStart:null:o.timeGrain:e.shape!=="summary"?o.categoryShape:n&&!e.dimensions.includes(n)?o.categoryDimension:null}function Vp(e,t){const n=ue(e,t);if(!n||n.cypher||n.events||n.model)return;const o=n.from?e.sources.find(s=>s.id===n.from?.source):n;return o&&!o.cypher&&!o.events&&!o.model?n:void 0}function Jp(e,t,n){return(e.from?.where??[]).find(o=>!Mc(o,{metric:t,kn:n,asOf:"2000-01-01"}))}function qc(e){const t=Pr(),n=t.ops,o=e.ref??e.values?.join(t.listJoiner)??(e.value!==void 0?String(e.value):"");return[e.field,n[e.op],o].filter(Boolean).join(" ")}function Zp(e,t,n,o,s,r,a){const l=Pr(),c=lr(e);if(!c)return[l.refShape(r)];if(!t.metrics)return[];const i=t.metrics.find(p=>p.id===c.id);if(!i)return[l.unknownMetric(r,c.id)];if(c.version>i.version)return[l.unpublished(r,c.version,i.version)];const d=Vp(n,o);if(!d)return[l.sourceKind(r)];if(d.objectType!==i.objectType)return[l.otherObjectType(r,i.name)];const h=Jp(d,i,t);if(h)return[l.subsetBlocked(r,qc(h))];const u=c.version===i.version?Hp(i,s,a):null;return u?[l.unfit(r,u,i.name)]:[]}function Ia(e,t){const n=t?e.metrics?.find(o=>o.id===t.id):void 0;return n&&n.version===t?.version?n:void 0}function Xp(e,t){const n=(e.metrics??[]).filter(s=>!0);if(n.length===0)return"";const o=s=>s.shape==="time_series"?`时间序列(按${s.grain})`:s.shape==="grouped"?`固定分组(${s.groupBy.join("、")})`:"单个值";return`对象指标(网络中已发布,平台按全部对象计算;卡片或系列写 metric: { id, version },只能用下列 id 与版本,不能编造):
|
|
10
|
-
${n.map(s=>`- ${s.id}
|
|
11
|
-
`)}`}const
|
|
12
|
-
- steps:1 到 ${
|
|
10
|
+
条件 { field, op, ref? | value? | values? }:field 为字段或 ${ue};op 为 isSet、isEmpty(无需另一边)、eq、ne(文本或数字)、in(values 文本列表)、before、onOrBefore、after、onOrAfter(日期,另一边为日期字段、${ue} 或 YYYY-MM-DD)、gt、gte、lt、lte(数字);另一边是字段或 ${ue} 时写 ref,是值时写 value。
|
|
11
|
+
状态、超期天数这类随进度变化的列,优先用进度(progress)自动得出,不要再用计算列重写一遍。`;function Oe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Pt(e,t){return typeof e=="string"&&t.includes(e)}const Hh={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,required:e=>`${e} 必填`,identifier:e=>`${e} 必须是字母开头的标识`,duplicate:(e,t)=>`${e} 重复:${t}`,paramsCount:(e,t)=>`${e} 必须是 1 到 ${t} 个参数`,typeOneOf:(e,t)=>`${e} 只能是 ${t.join("、")}`,minOverMax:e=>`${e} 不能大于 max`,operationsList:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,label:e=>`${e} 必须是不超过 30 字的名称`,effectsCount:(e,t,n)=>`${e} 必须是 ${t} 到 ${n} 个效果`,propertyOf:(e,t)=>`${e} 必须是 ${t} 的属性`,notKey:e=>`${e} 不能是对象的主键或标识`,kindOneOf:(e,t)=>`${e} 只能是 ${t.join("、")}`,kindOnlyFor:(e,t,n)=>`${e} ${t} 只能用于${n.join("、")}类型的属性`,ownParam:e=>`${e} 必须是本操作的参数`,paramNeeds:(e,t,n,o)=>`${e} 要求 ${t.join(" 或 ")} 类型的参数,${n} 是 ${o}`,notActionType:e=>`${e} 不是知识网络中的行动类型`,actionOn:(e,t)=>`${e} 必须作用于 ${t},或是新建对象的行动`,notUserParam:e=>`${e} 不是该行动的用户填写参数`,contextOneOf:(e,t)=>`${e} 只能是 ${t.join("、")}`,fromOneOf:e=>`${e} 只能是 param、field、const 或 context`,uniqueOnlyCreate:e=>`${e} 只用于新建对象的行动`,uniqueList:(e,t)=>`${e} 必须是 ${t} 的属性列表`,adjustNeedsLayer:()=>"图层需要先选好开始和结束",adjustSetters:(e,t)=>`操作须用日期或日期时间参数设置开始(${e})和结束(${t})`,adjustOther:e=>`操作只能设置开始、结束和所属资源,不能改 ${e}`},Vh={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,required:e=>`${e} is required`,identifier:e=>`${e} must be an identifier starting with a letter`,duplicate:(e,t)=>`${e} is used twice: ${t}`,paramsCount:(e,t)=>`${e} must be 1 to ${t} parameters`,typeOneOf:(e,t)=>`${e} must be one of ${t.join(", ")}`,minOverMax:e=>`${e} cannot be greater than max`,operationsList:(e,t)=>`${e} must be a list of at most ${t} items`,label:e=>`${e} must be a name of at most 30 characters`,effectsCount:(e,t,n)=>`${e} must be ${t} to ${n} effects`,propertyOf:(e,t)=>`${e} must be a property of ${t}`,notKey:e=>`${e} cannot be the primary key or identifier of the object`,kindOneOf:(e,t)=>`${e} must be one of ${t.join(", ")}`,kindOnlyFor:(e,t,n)=>`${e} ${t} only works on properties of type ${n.join(", ")}`,ownParam:e=>`${e} must be a parameter of this operation`,paramNeeds:(e,t,n,o)=>`${e} needs a parameter of type ${t.join(" or ")}, but ${n} is ${o}`,notActionType:e=>`${e} is not an action type of the knowledge network`,actionOn:(e,t)=>`${e} must act on ${t}, or be an action that creates an object`,notUserParam:e=>`${e} is not a parameter the user fills in for this action`,contextOneOf:(e,t)=>`${e} must be one of ${t.join(", ")}`,fromOneOf:e=>`${e} must be param, field, const or context`,uniqueOnlyCreate:e=>`${e} is only for actions that create an object`,uniqueList:(e,t)=>`${e} must be a list of properties of ${t}`,adjustNeedsLayer:()=>"the layer needs a start and an end first",adjustSetters:(e,t)=>`the operation must set the start (${e}) and the end (${t}) from date or datetime parameters`,adjustOther:e=>`the operation can only set the start, the end and the resource it belongs to, not ${e}`},ao=()=>fe({"zh-CN":Hh,"en-US":Vh}),Ac=/^[A-Za-z][A-Za-z0-9_]*$/,Jh=["number","date","text"],Zh=["number","date","datetime","text"],Vs=10,Vn=5,Js=5,at=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Xh(e,t){return e==="shiftDays"||e==="fromAsOf"?{param:["number"],field:["date"]}:e==="add"?{param:["number"],field:["number"]}:t==="date"?{param:["date","datetime"],field:[]}:{param:[t==="number"?"number":"text"],field:[]}}function Tc(e,t,n=Jh){const o=ao(),s=[],a=new Map;return!Array.isArray(e)||e.length===0||e.length>Vn?{errors:[o.paramsCount(t,Vn)],types:a}:(e.forEach((r,l)=>{const c=`${t}[${l}]`;return at(r)?(typeof r.name!="string"||!Ac.test(r.name)?s.push(o.identifier(`${c}.name`)):a.has(r.name)&&s.push(o.duplicate(`${c}.name`,r.name)),(typeof r.label!="string"||!r.label.trim())&&s.push(o.required(`${c}.label`)),n.includes(r.type)?typeof r.name=="string"&&a.set(r.name,r.type):s.push(o.typeOneOf(`${c}.type`,n)),typeof r.min=="number"&&typeof r.max=="number"&&r.min>r.max&&s.push(o.minOverMax(`${c}.min`)),s):s.push(o.object(c))}),{errors:s,types:a})}function Qh(e,t,n,o){const s=ao();if(!Array.isArray(e)||e.length>Vs)return[s.operationsList(o,Vs)];const a=n.objectTypes[t.objectType],r=a?.properties??[],l=he(t,n),c=new Set;return e.flatMap((i,d)=>{const h=`${o}[${d}]`;if(!at(i))return[s.object(h)];const u=Object.keys(i).filter(y=>!["id","label","when","params","effects","action"].includes(y)).map(y=>s.noOption(h,y));typeof i.id!="string"||!Ac.test(i.id)?u.push(s.identifier(`${h}.id`)):c.has(i.id)?u.push(s.duplicate(`${h}.id`,i.id)):c.add(i.id),(typeof i.label!="string"||!i.label.trim()||i.label.length>30)&&u.push(s.label(`${h}.label`)),i.when!==void 0&&u.push(...xe(i.when,l,`${h}.when`,dn(t)));const p=Tc(i.params,`${h}.params`,Zh);u.push(...p.errors);const f=p.types,m=ep(i,n),g=Array.isArray(i.effects)?i.effects:null;if(!g||g.length===0&&!m||g.length>Js?u.push(s.effectsCount(`${h}.effects`,m?0:1,Js)):g.forEach((y,b)=>{const k=`${h}.effects[${b}]`;if(!at(y))return u.push(s.object(k));const w=r.find(j=>j.name===y.field);if(!w)return u.push(s.propertyOf(`${k}.field`,t.objectType));if(y.field===t.key||a?.primaryKeys.includes(w.name))return u.push(s.notKey(`${k}.field`));if(!Us.includes(y.kind))return u.push(s.kindOneOf(`${k}.kind`,Us));const v=Xh(String(y.kind),w.type);v.field.length>0&&!v.field.includes(w.type)&&u.push(s.kindOnlyFor(k,String(y.kind),v.field));const S=f.get(String(y.param));return S?v.param.includes(S)||u.push(s.paramNeeds(`${k}.param`,v.param,String(y.param),S)):u.push(s.ownParam(`${k}.param`)),u}),i.action!==void 0){const y=at(i.action)?i.action:null,b=y&&typeof y.id=="string"?cn(n,y.id):void 0;if(!y)u.push(s.object(`${h}.action`));else if(n.actionTypes!==void 0){if(b?b.objectType!==t.objectType&&an(b)!=="create"&&u.push(s.actionOn(`${h}.action.id`,t.objectType)):u.push(s.notActionType(`${h}.action.id`)),b&&y.params!==void 0)if(!at(y.params))u.push(s.object(`${h}.action.params`));else for(const[k,w]of Object.entries(y.params)){const v=`${h}.action.params.${k}`;b.inputs.some(S=>S.name===k)?at(w)?w.from==="param"&&!f.has(String(w.name))?u.push(s.ownParam(`${v}.name`)):w.from==="field"&&!r.some(S=>S.name===w.name)?u.push(s.propertyOf(`${v}.name`,t.objectType)):w.from==="const"&&w.value===void 0?u.push(s.required(`${v}.value`)):w.from==="context"&&!zs.includes(w.name)?u.push(s.contextOneOf(`${v}.name`,zs)):["param","field","const","context"].includes(String(w.from))||u.push(s.fromOneOf(`${v}.from`)):u.push(s.object(v)):u.push(s.notUserParam(v))}b&&u.push(...tp(y,b,n,h))}}return u})}function ep(e,t){const n=at(e.action)?e.action:null,o=n?cn(t,n.id):void 0;return o!==void 0&&an(o)==="create"}function tp(e,t,n,o){if(e.unique===void 0&&e.active===void 0)return[];const s=ao();if(an(t)!=="create")return[s.uniqueOnlyCreate(`${o}.action.unique`)];const a=n.objectTypes[t.objectType]?.properties??[],r=[],l=e.unique;return(!Array.isArray(l)||l.length===0||l.some(c=>!a.some(i=>i.name===c)))&&r.push(s.uniqueList(`${o}.action.unique`,t.objectType)),e.active!==void 0&&r.push(...xe(e.active,a,`${o}.action.active`)),r}const Ea=e=>e?.type==="date"||e?.type==="datetime";function Ca(e,t){if(!t)return;const n=e.effects.find(o=>o.kind==="set"&&o.field===t);return n&&e.params.find(o=>o.name===n.param)}function np(e,t){const n=c=>typeof c=="string"&&c!==""?c:void 0,o=n(t.startField),s=n(t.endField),a=ao();if(!o||!s)return a.adjustNeedsLayer();if(!Ea(Ca(e,o))||!Ea(Ca(e,s)))return a.adjustSetters(o,s);const r=[o,s,n(t.resourceField)],l=e.effects.find(c=>c.kind!=="set"||!r.includes(c.field));if(l)return a.adjustOther(l.field)}const op={joiner:"、",list:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,idFormat:e=>`${e} 必须是字母开头的标识`,idTwice:(e,t)=>`${e} 重复:${t}`,label:e=>`${e} 必须是不超过 30 字的名称`,text:e=>`${e} 必须是文字`,tool:e=>`${e} 必须写明执行工厂的工具箱 box 与工具 tool`,required:e=>`${e} 必填`,inputsCount:(e,t)=>`${e} 必须是 1 到 ${t} 个属性`,inputField:e=>`${e} 必须是本数据源的字段`,outputsCount:(e,t)=>`${e} 必须是 1 到 ${t} 个结果字段`,outputSameName:(e,t)=>`${e} 与本数据源的字段同名:${t}`,oneOf:(e,t)=>`${e} 只能是 ${t}`,measuresCount:(e,t)=>`${e} 必须是 1 到 ${t} 个度量`,valueField:e=>`${e} 必须是本数据源的字段或模型的结果字段`,valueFieldNumber:e=>`${e} 求和、平均、最大、最小须是数字字段`,actionType:e=>`${e} 不是知识网络中的行动类型`,actionObjectType:(e,t)=>`${e} 必须作用于 ${t}`,notUserParam:e=>`${e} 不是该行动的用户填写参数`,mustBeModelParam:e=>`${e} 必须是本模型的参数`,mustBePropertyOf:(e,t)=>`${e} 必须是 ${t} 的属性`,mustBeModelOutput:e=>`${e} 必须是本模型的结果字段`,fromOneOf:e=>`${e} 只能是 param、field、output 或 const`},sp={joiner:", ",list:(e,t)=>`${e} must be a list of at most ${t} items`,object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,idFormat:e=>`${e} must be an identifier starting with a letter`,idTwice:(e,t)=>`${e} is used twice: ${t}`,label:e=>`${e} must be a name of at most 30 characters`,text:e=>`${e} must be text`,tool:e=>`${e} must name the execution factory toolbox (box) and tool`,required:e=>`${e} is required`,inputsCount:(e,t)=>`${e} must list 1 to ${t} properties`,inputField:e=>`${e} must be a field of this source`,outputsCount:(e,t)=>`${e} must list 1 to ${t} result fields`,outputSameName:(e,t)=>`${e} has the same name as a field of this source: ${t}`,oneOf:(e,t)=>`${e} must be one of ${t}`,measuresCount:(e,t)=>`${e} must list 1 to ${t} measures`,valueField:e=>`${e} must be a field of this source or a result field of the model`,valueFieldNumber:e=>`${e} must be a number field for sum, average, max and min`,actionType:e=>`${e} is not an action type of the knowledge network`,actionObjectType:(e,t)=>`${e} must act on ${t}`,notUserParam:e=>`${e} is not a parameter the user fills in for this action`,mustBeModelParam:e=>`${e} must be a parameter of this model`,mustBePropertyOf:(e,t)=>`${e} must be a property of ${t}`,mustBeModelOutput:e=>`${e} must be a result field of this model`,fromOneOf:e=>`${e} must be one of param, field, output or const`},Na=()=>fe({"zh-CN":op,"en-US":sp}),xa=/^[A-Za-z][A-Za-z0-9_]*$/,No=["number","date","text"],Zs=["count","sum","avg","min","max","ratio"],Xs=5,Qs=20,er=8,tr=8,Xe=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function rp(e,t,n,o){if(!Array.isArray(e)||e.length>Xs)return[Na().list(o,Xs)];const s=Na(),a=he(t,n),r=new Set(a.map(i=>i.name)),l=n.objectTypes[t.objectType]?.properties??[],c=new Set;return e.flatMap((i,d)=>{const h=`${o}[${d}]`;if(!Xe(i))return[s.object(h)];const u=Object.keys(i).filter(w=>!["id","label","description","tool","inputs","params","outputs","measures","action"].includes(w)).map(w=>s.noOption(h,w));typeof i.id!="string"||!xa.test(i.id)?u.push(s.idFormat(`${h}.id`)):c.has(i.id)?u.push(s.idTwice(`${h}.id`,i.id)):c.add(i.id),(typeof i.label!="string"||!i.label.trim()||i.label.length>30)&&u.push(s.label(`${h}.label`)),i.description!==void 0&&typeof i.description!="string"&&u.push(s.text(`${h}.description`));const p=Xe(i.tool)?i.tool:null;!p||typeof p.box!="string"||!p.box||typeof p.tool!="string"?u.push(s.tool(`${h}.tool`)):p.tool||u.push(s.required(`${h}.tool.tool`));const f=Array.isArray(i.inputs)?i.inputs:null;!f||f.length===0||f.length>Qs?u.push(s.inputsCount(`${h}.inputs`,Qs)):f.forEach((w,v)=>{(typeof w!="string"||!r.has(w))&&u.push(s.inputField(`${h}.inputs[${v}]`))});const m=Tc(i.params,`${h}.params`);u.push(...m.errors);const g=Array.isArray(i.outputs)?i.outputs:null,y=new Set;!g||g.length===0||g.length>er?u.push(s.outputsCount(`${h}.outputs`,er)):g.forEach((w,v)=>{const S=`${h}.outputs[${v}]`;return Xe(w)?(typeof w.name!="string"||!xa.test(w.name)?u.push(s.idFormat(`${S}.name`)):r.has(w.name)?u.push(s.outputSameName(`${S}.name`,w.name)):y.has(w.name)?u.push(s.idTwice(`${S}.name`,w.name)):y.add(w.name),(typeof w.label!="string"||!w.label.trim())&&u.push(s.required(`${S}.label`)),No.includes(w.type)||u.push(s.oneOf(`${S}.type`,No.join(s.joiner))),u):u.push(s.object(S))});const b=[...a,...(g??[]).filter(Xe).map(w=>({name:String(w.name),label:String(w.label),type:No.includes(w.type)?w.type:"text"}))],k=Array.isArray(i.measures)?i.measures:null;if(!k||k.length===0||k.length>tr?u.push(s.measuresCount(`${h}.measures`,tr)):k.forEach((w,v)=>{const S=`${h}.measures[${v}]`;if(!Xe(w))return u.push(s.object(S));if((typeof w.label!="string"||!w.label.trim())&&u.push(s.required(`${S}.label`)),Zs.includes(w.aggregate)||u.push(s.oneOf(`${S}.aggregate`,Zs.join(s.joiner))),w.when!==void 0&&u.push(...xe(w.when,b,`${S}.when`,dn(t))),["sum","avg","min","max"].includes(String(w.aggregate))){const O=b.find(A=>A.name===w.valueField);O?O.type!=="number"&&u.push(s.valueFieldNumber(`${S}.valueField`)):u.push(s.valueField(`${S}.valueField`))}return u}),i.action!==void 0){const w=Xe(i.action)?i.action:null,v=w&&typeof w.id=="string"?cn(n,w.id):void 0;if(!w)u.push(s.object(`${h}.action`));else if(n.actionTypes!==void 0){if(!v)u.push(s.actionType(`${h}.action.id`));else if(v.objectType!==t.objectType)u.push(s.actionObjectType(`${h}.action.id`,t.objectType));else if(w.params!==void 0)if(!Xe(w.params))u.push(s.object(`${h}.action.params`));else for(const[S,j]of Object.entries(w.params)){const O=`${h}.action.params.${S}`;v.inputs.some(A=>A.name===S)?Xe(j)?j.from==="param"&&!m.types.has(String(j.name))?u.push(s.mustBeModelParam(`${O}.name`)):j.from==="field"&&!l.some(A=>A.name===j.name)?u.push(s.mustBePropertyOf(`${O}.name`,t.objectType)):j.from==="output"&&!y.has(String(j.name))?u.push(s.mustBeModelOutput(`${O}.name`)):j.from==="const"&&j.value===void 0?u.push(s.required(`${O}.value`)):["param","field","output","const"].includes(String(j.from))||u.push(s.fromOneOf(`${O}.from`)):u.push(s.object(O)):u.push(s.notUserParam(O))}}}return u})}const ap=JSON.parse(`[{"name":"Fiji","zh":"斐济","a2":"FJ","a3":"FJI","alt":["Republic of Fiji"]},{"name":"Tanzania","zh":"坦桑尼亚","a2":"TZ","a3":"TZA","alt":["United Republic of Tanzania"]},{"name":"Western Sahara","zh":"西撒哈拉","a2":"EH","a3":"ESH","alt":["Sahrawi Arab Democratic Republic","W. Sahara"]},{"name":"Canada","zh":"加拿大","a2":"CA","a3":"CAN"},{"name":"United States of America","zh":"美国","a2":"US","a3":"USA","alt":["United States"]},{"name":"Kazakhstan","zh":"哈萨克斯坦","a2":"KZ","a3":"KAZ","alt":["Republic of Kazakhstan"]},{"name":"Uzbekistan","zh":"乌兹别克斯坦","a2":"UZ","a3":"UZB","alt":["Republic of Uzbekistan"]},{"name":"Papua New Guinea","zh":"巴布亚新几内亚","a2":"PG","a3":"PNG","alt":["Independent State of Papua New Guinea"]},{"name":"Indonesia","zh":"印度尼西亚","a2":"ID","a3":"IDN","alt":["Republic of Indonesia"]},{"name":"Argentina","zh":"阿根廷","a2":"AR","a3":"ARG","alt":["Argentine Republic"]},{"name":"Chile","zh":"智利","a2":"CL","a3":"CHL","alt":["Republic of Chile"]},{"name":"Democratic Republic of the Congo","zh":"刚果民主共和国","a2":"CD","a3":"COD","alt":["Congo, Dem. Rep.","Dem. Rep. Congo"]},{"name":"Somalia","zh":"索马里","a2":"SO","a3":"SOM","alt":["Federal Republic of Somalia"]},{"name":"Kenya","zh":"肯尼亚","a2":"KE","a3":"KEN","alt":["Republic of Kenya"]},{"name":"Sudan","zh":"苏丹","a2":"SD","a3":"SDN","alt":["Republic of the Sudan"]},{"name":"Chad","zh":"乍得","a2":"TD","a3":"TCD","alt":["Republic of Chad"]},{"name":"Haiti","zh":"海地","a2":"HT","a3":"HTI","alt":["Republic of Haiti"]},{"name":"Dominican Republic","zh":"多米尼加","a2":"DO","a3":"DOM","alt":["Dominican Rep."]},{"name":"Russia","zh":"俄罗斯","a2":"RU","a3":"RUS","alt":["Russian Federation"]},{"name":"The Bahamas","zh":"巴哈马","a2":"BS","a3":"BHS","alt":["Bahamas","Bahamas, The","Commonwealth of the Bahamas"]},{"name":"Falkland Islands","zh":"福克兰群岛","a2":"FK","a3":"FLK","alt":["Falkland Is.","Falkland Islands / Malvinas"]},{"name":"Norway","zh":"挪威","a2":"NO","a3":"NOR","alt":["Kingdom of Norway"]},{"name":"Greenland","zh":"格陵兰","a2":"GL","a3":"GRL"},{"name":"French Southern and Antarctic Lands","zh":"法属南部和南极领地","a2":"TF","a3":"ATF","alt":["Fr. S. Antarctic Lands","Territory of the French Southern and Antarctic Lands"]},{"name":"East Timor","zh":"东帝汶","a2":"TL","a3":"TLS","alt":["Democratic Republic of Timor-Leste","Timor-Leste"]},{"name":"South Africa","zh":"南非","a2":"ZA","a3":"ZAF","alt":["Republic of South Africa"]},{"name":"Lesotho","zh":"莱索托","a2":"LS","a3":"LSO","alt":["Kingdom of Lesotho"]},{"name":"Mexico","zh":"墨西哥","a2":"MX","a3":"MEX","alt":["United Mexican States"]},{"name":"Uruguay","zh":"乌拉圭","a2":"UY","a3":"URY","alt":["Oriental Republic of Uruguay"]},{"name":"Brazil","zh":"巴西","a2":"BR","a3":"BRA","alt":["Federative Republic of Brazil"]},{"name":"Bolivia","zh":"玻利维亚","a2":"BO","a3":"BOL","alt":["Plurinational State of Bolivia"]},{"name":"Peru","zh":"秘鲁","a2":"PE","a3":"PER","alt":["Republic of Peru"]},{"name":"Colombia","zh":"哥伦比亚","a2":"CO","a3":"COL","alt":["Republic of Colombia"]},{"name":"Panama","zh":"巴拿马","a2":"PA","a3":"PAN","alt":["Republic of Panama"]},{"name":"Costa Rica","zh":"哥斯达黎加","a2":"CR","a3":"CRI","alt":["Republic of Costa Rica"]},{"name":"Nicaragua","zh":"尼加拉瓜","a2":"NI","a3":"NIC","alt":["Republic of Nicaragua"]},{"name":"Honduras","zh":"洪都拉斯","a2":"HN","a3":"HND","alt":["Republic of Honduras"]},{"name":"El Salvador","zh":"萨尔瓦多","a2":"SV","a3":"SLV","alt":["Republic of El Salvador"]},{"name":"Guatemala","zh":"危地马拉","a2":"GT","a3":"GTM","alt":["Republic of Guatemala"]},{"name":"Belize","zh":"伯利兹","a2":"BZ","a3":"BLZ"},{"name":"Venezuela","zh":"委内瑞拉","a2":"VE","a3":"VEN","alt":["Bolivarian Republic of Venezuela","Venezuela, RB"]},{"name":"Guyana","zh":"圭亚那","a2":"GY","a3":"GUY","alt":["Co-operative Republic of Guyana"]},{"name":"Suriname","zh":"苏里南","a2":"SR","a3":"SUR","alt":["Republic of Suriname"]},{"name":"France","zh":"法国","a2":"FR","a3":"FRA","alt":["French Republic"]},{"name":"Ecuador","zh":"厄瓜多尔","a2":"EC","a3":"ECU","alt":["Republic of Ecuador"]},{"name":"Puerto Rico","zh":"波多黎各","a2":"PR","a3":"PRI","alt":["Commonwealth of Puerto Rico"]},{"name":"Jamaica","zh":"牙买加","a2":"JM","a3":"JAM"},{"name":"Cuba","zh":"古巴","a2":"CU","a3":"CUB","alt":["Republic of Cuba"]},{"name":"Zimbabwe","zh":"津巴布韦","a2":"ZW","a3":"ZWE","alt":["Republic of Zimbabwe"]},{"name":"Botswana","zh":"博茨瓦纳","a2":"BW","a3":"BWA","alt":["Republic of Botswana"]},{"name":"Namibia","zh":"纳米比亚","a2":"NA","a3":"NAM","alt":["Republic of Namibia"]},{"name":"Senegal","zh":"塞内加尔","a2":"SN","a3":"SEN","alt":["Republic of Senegal"]},{"name":"Mali","zh":"马里","a2":"ML","a3":"MLI","alt":["Republic of Mali"]},{"name":"Mauritania","zh":"毛里塔尼亚","a2":"MR","a3":"MRT","alt":["Islamic Republic of Mauritania"]},{"name":"Benin","zh":"贝宁","a2":"BJ","a3":"BEN","alt":["Republic of Benin"]},{"name":"Niger","zh":"尼日尔","a2":"NE","a3":"NER","alt":["Republic of Niger"]},{"name":"Nigeria","zh":"尼日利亚","a2":"NG","a3":"NGA","alt":["Federal Republic of Nigeria"]},{"name":"Cameroon","zh":"喀麦隆","a2":"CM","a3":"CMR","alt":["Republic of Cameroon"]},{"name":"Togo","zh":"多哥","a2":"TG","a3":"TGO","alt":["Togolese Republic"]},{"name":"Ghana","zh":"加纳","a2":"GH","a3":"GHA","alt":["Republic of Ghana"]},{"name":"Ivory Coast","zh":"科特迪瓦","a2":"CI","a3":"CIV","alt":["Côte d'Ivoire","Republic of Ivory Coast"]},{"name":"Guinea","zh":"几内亚","a2":"GN","a3":"GIN","alt":["Republic of Guinea"]},{"name":"Guinea-Bissau","zh":"几内亚比绍","a2":"GW","a3":"GNB","alt":["Republic of Guinea-Bissau"]},{"name":"Liberia","zh":"利比里亚","a2":"LR","a3":"LBR","alt":["Republic of Liberia"]},{"name":"Sierra Leone","zh":"塞拉利昂","a2":"SL","a3":"SLE","alt":["Republic of Sierra Leone"]},{"name":"Burkina Faso","zh":"布基纳法索","a2":"BF","a3":"BFA"},{"name":"Central African Republic","zh":"中非共和国","a2":"CF","a3":"CAF","alt":["Central African Rep."]},{"name":"Republic of the Congo","zh":"刚果共和国","a2":"CG","a3":"COG","alt":["Congo","Congo, Rep."]},{"name":"Gabon","zh":"加蓬","a2":"GA","a3":"GAB","alt":["Gabonese Republic"]},{"name":"Equatorial Guinea","zh":"赤道几内亚","a2":"GQ","a3":"GNQ","alt":["Eq. Guinea","Republic of Equatorial Guinea"]},{"name":"Zambia","zh":"赞比亚","a2":"ZM","a3":"ZMB","alt":["Republic of Zambia"]},{"name":"Malawi","zh":"马拉维","a2":"MW","a3":"MWI","alt":["Republic of Malawi"]},{"name":"Mozambique","zh":"莫桑比克","a2":"MZ","a3":"MOZ","alt":["Republic of Mozambique"]},{"name":"Eswatini","zh":"斯威士兰","a2":"SZ","a3":"SWZ","alt":["Kingdom of eSwatini","eSwatini"]},{"name":"Angola","zh":"安哥拉","a2":"AO","a3":"AGO","alt":["People's Republic of Angola"]},{"name":"Burundi","zh":"布隆迪","a2":"BI","a3":"BDI","alt":["Republic of Burundi"]},{"name":"Israel","zh":"以色列","a2":"IL","a3":"ISR","alt":["State of Israel"]},{"name":"Lebanon","zh":"黎巴嫩","a2":"LB","a3":"LBN","alt":["Lebanese Republic"]},{"name":"Madagascar","zh":"马达加斯加","a2":"MG","a3":"MDG","alt":["Republic of Madagascar"]},{"name":"Palestine","zh":"巴勒斯坦","a2":"PS","a3":"PSE","alt":["Palestine (West Bank and Gaza)","West Bank and Gaza"]},{"name":"The Gambia","zh":"冈比亚","a2":"GM","a3":"GMB","alt":["Gambia","Gambia, The","Republic of the Gambia"]},{"name":"Tunisia","zh":"突尼斯","a2":"TN","a3":"TUN","alt":["Republic of Tunisia"]},{"name":"Algeria","zh":"阿尔及利亚","a2":"DZ","a3":"DZA","alt":["People's Democratic Republic of Algeria"]},{"name":"Jordan","zh":"约旦","a2":"JO","a3":"JOR","alt":["Hashemite Kingdom of Jordan"]},{"name":"United Arab Emirates","zh":"阿拉伯联合酋长国","a2":"AE","a3":"ARE"},{"name":"Qatar","zh":"卡塔尔","a2":"QA","a3":"QAT","alt":["State of Qatar"]},{"name":"Kuwait","zh":"科威特","a2":"KW","a3":"KWT","alt":["State of Kuwait"]},{"name":"Iraq","zh":"伊拉克","a2":"IQ","a3":"IRQ","alt":["Republic of Iraq"]},{"name":"Oman","zh":"阿曼","a2":"OM","a3":"OMN","alt":["Sultanate of Oman"]},{"name":"Vanuatu","zh":"瓦努阿图","a2":"VU","a3":"VUT","alt":["Republic of Vanuatu"]},{"name":"Cambodia","zh":"柬埔寨","a2":"KH","a3":"KHM","alt":["Kingdom of Cambodia"]},{"name":"Thailand","zh":"泰国","a2":"TH","a3":"THA","alt":["Kingdom of Thailand"]},{"name":"Laos","zh":"老挝","a2":"LA","a3":"LAO","alt":["Lao PDR","Lao People's Democratic Republic"]},{"name":"Myanmar","zh":"缅甸","a2":"MM","a3":"MMR","alt":["Republic of the Union of Myanmar"]},{"name":"Vietnam","zh":"越南","a2":"VN","a3":"VNM","alt":["Socialist Republic of Vietnam"]},{"name":"North Korea","zh":"朝鲜民主主义人民共和国","a2":"KP","a3":"PRK","alt":["Dem. Rep. Korea","Democratic People's Republic of Korea","Korea, Dem. Rep."]},{"name":"South Korea","zh":"大韩民国","a2":"KR","a3":"KOR","alt":["Korea, Rep.","Republic of Korea"]},{"name":"Mongolia","zh":"蒙古国","a2":"MN","a3":"MNG"},{"name":"India","zh":"印度","a2":"IN","a3":"IND","alt":["Republic of India"]},{"name":"Bangladesh","zh":"孟加拉国","a2":"BD","a3":"BGD","alt":["People's Republic of Bangladesh"]},{"name":"Bhutan","zh":"不丹","a2":"BT","a3":"BTN","alt":["Kingdom of Bhutan"]},{"name":"Nepal","zh":"尼泊尔","a2":"NP","a3":"NPL"},{"name":"Pakistan","zh":"巴基斯坦","a2":"PK","a3":"PAK","alt":["Islamic Republic of Pakistan"]},{"name":"Afghanistan","zh":"阿富汗","a2":"AF","a3":"AFG","alt":["Islamic State of Afghanistan"]},{"name":"Tajikistan","zh":"塔吉克斯坦","a2":"TJ","a3":"TJK","alt":["Republic of Tajikistan"]},{"name":"Kyrgyzstan","zh":"吉尔吉斯斯坦","a2":"KG","a3":"KGZ","alt":["Kyrgyz Republic"]},{"name":"Turkmenistan","zh":"土库曼斯坦","a2":"TM","a3":"TKM"},{"name":"Iran","zh":"伊朗","a2":"IR","a3":"IRN","alt":["Iran, Islamic Rep.","Islamic Republic of Iran"]},{"name":"Syria","zh":"叙利亚","a2":"SY","a3":"SYR","alt":["Syrian Arab Republic"]},{"name":"Armenia","zh":"亚美尼亚","a2":"AM","a3":"ARM","alt":["Republic of Armenia"]},{"name":"Sweden","zh":"瑞典","a2":"SE","a3":"SWE","alt":["Kingdom of Sweden"]},{"name":"Belarus","zh":"白俄罗斯","a2":"BY","a3":"BLR","alt":["Republic of Belarus"]},{"name":"Ukraine","zh":"乌克兰","a2":"UA","a3":"UKR"},{"name":"Poland","zh":"波兰","a2":"PL","a3":"POL","alt":["Republic of Poland"]},{"name":"Austria","zh":"奥地利","a2":"AT","a3":"AUT","alt":["Republic of Austria"]},{"name":"Hungary","zh":"匈牙利","a2":"HU","a3":"HUN","alt":["Republic of Hungary"]},{"name":"Moldova","zh":"摩尔多瓦","a2":"MD","a3":"MDA","alt":["Republic of Moldova"]},{"name":"Romania","zh":"罗马尼亚","a2":"RO","a3":"ROU"},{"name":"Lithuania","zh":"立陶宛","a2":"LT","a3":"LTU","alt":["Republic of Lithuania"]},{"name":"Latvia","zh":"拉脱维亚","a2":"LV","a3":"LVA","alt":["Republic of Latvia"]},{"name":"Estonia","zh":"爱沙尼亚","a2":"EE","a3":"EST","alt":["Republic of Estonia"]},{"name":"Germany","zh":"德国","a2":"DE","a3":"DEU","alt":["Federal Republic of Germany"]},{"name":"Bulgaria","zh":"保加利亚","a2":"BG","a3":"BGR","alt":["Republic of Bulgaria"]},{"name":"Greece","zh":"希腊","a2":"GR","a3":"GRC","alt":["Hellenic Republic"]},{"name":"Turkey","zh":"土耳其","a2":"TR","a3":"TUR","alt":["Republic of Turkey"]},{"name":"Albania","zh":"阿尔巴尼亚","a2":"AL","a3":"ALB","alt":["Republic of Albania"]},{"name":"Croatia","zh":"克罗地亚","a2":"HR","a3":"HRV","alt":["Republic of Croatia"]},{"name":"Switzerland","zh":"瑞士","a2":"CH","a3":"CHE","alt":["Swiss Confederation"]},{"name":"Luxembourg","zh":"卢森堡","a2":"LU","a3":"LUX","alt":["Grand Duchy of Luxembourg"]},{"name":"Belgium","zh":"比利时","a2":"BE","a3":"BEL","alt":["Kingdom of Belgium"]},{"name":"Netherlands","zh":"荷兰","a2":"NL","a3":"NLD","alt":["Kingdom of the Netherlands"]},{"name":"Portugal","zh":"葡萄牙","a2":"PT","a3":"PRT","alt":["Portuguese Republic"]},{"name":"Spain","zh":"西班牙","a2":"ES","a3":"ESP","alt":["Kingdom of Spain"]},{"name":"Ireland","zh":"爱尔兰","a2":"IE","a3":"IRL"},{"name":"New Caledonia","zh":"新喀里多尼亚","a2":"NC","a3":"NCL"},{"name":"Solomon Islands","zh":"所罗门群岛","a2":"SB","a3":"SLB","alt":["Solomon Is."]},{"name":"New Zealand","zh":"新西兰","a2":"NZ","a3":"NZL"},{"name":"Australia","zh":"澳大利亚","a2":"AU","a3":"AUS","alt":["Commonwealth of Australia"]},{"name":"Sri Lanka","zh":"斯里兰卡","a2":"LK","a3":"LKA","alt":["Democratic Socialist Republic of Sri Lanka"]},{"name":"People's Republic of China","zh":"中华人民共和国","a2":"CN","a3":"CHN","alt":["China","Chinese Taipei","Taiwan","中国台湾","台湾"]},{"name":"Italy","zh":"意大利","a2":"IT","a3":"ITA","alt":["Italian Republic"]},{"name":"Denmark","zh":"丹麦","a2":"DK","a3":"DNK","alt":["Kingdom of Denmark"]},{"name":"United Kingdom","zh":"英国","a2":"GB","a3":"GBR","alt":["United Kingdom of Great Britain and Northern Ireland"]},{"name":"Iceland","zh":"冰岛","a2":"IS","a3":"ISL","alt":["Republic of Iceland"]},{"name":"Azerbaijan","zh":"阿塞拜疆","a2":"AZ","a3":"AZE","alt":["Republic of Azerbaijan"]},{"name":"Georgia","zh":"格鲁吉亚","a2":"GE","a3":"GEO"},{"name":"Philippines","zh":"菲律宾","a2":"PH","a3":"PHL","alt":["Republic of the Philippines"]},{"name":"Malaysia","zh":"马来西亚","a2":"MY","a3":"MYS"},{"name":"Brunei","zh":"文莱","a2":"BN","a3":"BRN","alt":["Brunei Darussalam","Negara Brunei Darussalam"]},{"name":"Slovenia","zh":"斯洛文尼亚","a2":"SI","a3":"SVN","alt":["Republic of Slovenia"]},{"name":"Finland","zh":"芬兰","a2":"FI","a3":"FIN","alt":["Republic of Finland"]},{"name":"Slovakia","zh":"斯洛伐克","a2":"SK","a3":"SVK","alt":["Slovak Republic"]},{"name":"Czech Republic","zh":"捷克","a2":"CZ","a3":"CZE","alt":["Czechia"]},{"name":"Eritrea","zh":"厄立特里亚","a2":"ER","a3":"ERI","alt":["State of Eritrea"]},{"name":"Japan","zh":"日本","a2":"JP","a3":"JPN"},{"name":"Paraguay","zh":"巴拉圭","a2":"PY","a3":"PRY","alt":["Republic of Paraguay"]},{"name":"Yemen","zh":"也门","a2":"YE","a3":"YEM","alt":["Republic of Yemen","Yemen, Rep."]},{"name":"Saudi Arabia","zh":"沙特阿拉伯","a2":"SA","a3":"SAU","alt":["Kingdom of Saudi Arabia"]},{"name":"Antarctica","zh":"南极洲","a2":"AQ","a3":"ATA"},{"name":"Turkish Republic of Northern Cyprus","zh":"北塞浦路斯土耳其共和国","a3":"CYN","alt":["Cyprus, Northern","N. Cyprus","Northern Cyprus"]},{"name":"Cyprus","zh":"塞浦路斯","a2":"CY","a3":"CYP","alt":["Republic of Cyprus"]},{"name":"Morocco","zh":"摩洛哥","a2":"MA","a3":"MAR","alt":["Kingdom of Morocco"]},{"name":"Egypt","zh":"埃及","a2":"EG","a3":"EGY","alt":["Arab Republic of Egypt","Egypt, Arab Rep."]},{"name":"Libya","zh":"利比亚","a2":"LY","a3":"LBY"},{"name":"Ethiopia","zh":"埃塞俄比亚","a2":"ET","a3":"ETH","alt":["Federal Democratic Republic of Ethiopia"]},{"name":"Djibouti","zh":"吉布提","a2":"DJ","a3":"DJI","alt":["Republic of Djibouti"]},{"name":"Somaliland","zh":"索马里兰","a3":"SOL","alt":["Republic of Somaliland"]},{"name":"Uganda","zh":"乌干达","a2":"UG","a3":"UGA","alt":["Republic of Uganda"]},{"name":"Rwanda","zh":"卢旺达","a2":"RW","a3":"RWA","alt":["Republic of Rwanda"]},{"name":"Bosnia and Herzegovina","zh":"波斯尼亚和黑塞哥维那","a2":"BA","a3":"BIH","alt":["Bosnia and Herz."]},{"name":"North Macedonia","zh":"北马其顿","a2":"MK","a3":"MKD","alt":["Republic of North Macedonia"]},{"name":"Serbia","zh":"塞尔维亚","a2":"RS","a3":"SRB","alt":["Republic of Serbia"]},{"name":"Montenegro","zh":"黑山","a2":"ME","a3":"MNE"},{"name":"Kosovo","zh":"科索沃","a2":"XK","a3":"KOS","alt":["Republic of Kosovo"]},{"name":"Trinidad and Tobago","zh":"特立尼达和多巴哥","a2":"TT","a3":"TTO","alt":["Republic of Trinidad and Tobago"]},{"name":"South Sudan","zh":"南苏丹","a2":"SS","a3":"SSD","alt":["Republic of South Sudan","S. Sudan"]}]`),ip=["北京","天津","河北","山西","内蒙古","辽宁","吉林","黑龙江","上海","江苏","浙江","安徽","福建","江西","山东","河南","湖北","湖南","广东","广西","海南","重庆","四川","贵州","云南","西藏","陕西","甘肃","青海","宁夏","新疆","台湾","香港","澳门"],lp={河北:"石家庄 唐山 保定 邯郸 秦皇岛 廊坊 沧州 邢台 张家口 承德 衡水",山西:"太原 大同 长治 晋城 运城 临汾",内蒙古:"呼和浩特 包头 鄂尔多斯 赤峰",辽宁:"沈阳 大连 鞍山 抚顺 锦州 营口 丹东",吉林:"长春 四平 延吉",黑龙江:"哈尔滨 齐齐哈尔 大庆 牡丹江 佳木斯",江苏:"南京 苏州 无锡 常州 南通 徐州 扬州 镇江 盐城 泰州 连云港 淮安 宿迁 昆山 江阴",浙江:"杭州 宁波 温州 绍兴 嘉兴 金华 台州 湖州 义乌",安徽:"合肥 芜湖 蚌埠 马鞍山 安庆",福建:"福州 厦门 泉州 漳州 莆田",江西:"南昌 赣州 九江 景德镇",山东:"济南 青岛 烟台 潍坊 淄博 威海 临沂 济宁 泰安 日照 东营",河南:"郑州 洛阳 开封 新乡 南阳 许昌 安阳",湖北:"武汉 宜昌 襄阳 十堰 荆州 黄石",湖南:"长沙 株洲 湘潭 衡阳 岳阳 常德",广东:"广州 深圳 东莞 佛山 珠海 中山 惠州 汕头 江门 湛江 肇庆",广西:"南宁 柳州 桂林 北海",海南:"海口 三亚",四川:"成都 绵阳 德阳 宜宾 南充 泸州",贵州:"贵阳 遵义",云南:"昆明 大理 曲靖 玉溪",西藏:"拉萨",陕西:"西安 宝鸡 咸阳 榆林 延安 汉中",甘肃:"兰州 天水",青海:"西宁",宁夏:"银川",新疆:"乌鲁木齐 克拉玛依 喀什"};[...ip.map(e=>[e,e]),...Object.entries(lp).flatMap(([e,t])=>t.split(" ").map(n=>[n,e]))].sort((e,t)=>t[0].length-e[0].length);const cp={GB:["England","Scotland","Wales","Northern Ireland","Great Britain","UK","英格兰","苏格兰","威尔士","北爱尔兰"],US:["USA","United States","America","美利坚"],KR:["Korea Republic","Republic of Korea","Korea","韩国"],KP:["Korea DPR","DPR Korea","North Korea","朝鲜"],IR:["IR Iran","Iran"],CI:["Côte d'Ivoire","Cote d'Ivoire","Ivory Coast","科特迪瓦"],CZ:["Czechia","Czech Republic","捷克"],TR:["Türkiye","Turkey","土耳其"],NL:["Holland","荷兰"],IE:["Republic of Ireland","Éire"],RU:["Russia","Russian Federation","俄罗斯"],CN:["China PR","中国","TWN"],AE:["UAE","阿联酋"]},dp=e=>e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu,""),up=["zh-Hans","en"].flatMap(e=>{try{return typeof Intl<"u"&&"DisplayNames"in Intl?[new Intl.DisplayNames([e],{type:"region"})]:[]}catch{return[]}});function hp(e){return e?up.flatMap(t=>{try{const n=t.of(e);return n&&n!==e?[n]:[]}catch{return[]}}):[]}const Oc=ap.flatMap(e=>[e.name,e.zh,e.a2,e.a3,...e.alt??[],...e.a2?cp[e.a2]??[]:[],...hp(e.a2)].filter(t=>!!t).map(t=>[dp(t),e.name])).filter(([e])=>e.length>0).sort((e,t)=>t[0].length-e[0].length);new Map(Oc);Oc.filter(([e])=>new RegExp("\\p{Script=Han}","u").test(e)&&e.length>=2);function Ec(e){if(e?.length!==1)return null;const[t]=e;return t.op==="in"&&t.values?.length?{field:t.field,values:t.values}:t.op==="eq"&&t.ref===void 0&&t.value!==void 0?{field:t.field,values:[String(t.value)]}:null}function Xt(e,t){return e&&t?.length?[{field:e,op:"in",values:t}]:void 0}const pp=()=>nt().listNetworks(),fp=e=>nt().listObjectTypes(e),mp=(e,t)=>nt().getObjectType(e,t),gp=e=>nt().listRelationTypes(e),yp={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,oneOf:(e,t)=>`${e} 必须是 ${t.join("、")} 之一`,question:e=>`${e} 必须是不超过 300 字的问题`,placeholder:(e,t)=>`${e} 里的 {${t}} 不是这次点击能填的内容`,agent:e=>`${e} 目前只能是 analyst`,context:(e,t)=>`${e} 只能取 ${t.join("、")}`,send:(e,t)=>`${e} 只能是 ${t.join(" 或 ")}`,maxObjects:(e,t)=>`${e} 必须是 1 到 ${t} 的整数`,list:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,label:e=>`${e} 必须是不超过 20 字的文本`,steps:(e,t)=>`${e} 必须是 1 到 ${t} 个动作`,noObjectSimulate:(e,t)=>`${e} 这次点击没有对象,不能推演:${t}`,operation:(e,t)=>`${e} 必须是数据源的推演操作:${t}`,noObjectAct:(e,t)=>`${e} 这次点击没有对象,不能执行行动:${t}`,kind:e=>`${e} 只能是 ask、act 或 simulate`},bp={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,oneOf:(e,t)=>`${e} must be one of ${t.join(", ")}`,question:e=>`${e} must be a question of at most 300 characters`,placeholder:(e,t)=>`${e} has {${t}}, which this click cannot fill in`,agent:e=>`${e} can only be analyst for now`,context:(e,t)=>`${e} must be one of ${t.join(", ")}`,send:(e,t)=>`${e} must be ${t.join(" or ")}`,maxObjects:(e,t)=>`${e} must be an integer from 1 to ${t}`,list:(e,t)=>`${e} must be a list of at most ${t} items`,label:e=>`${e} must be text of at most 20 characters`,steps:(e,t)=>`${e} must be 1 to ${t} steps`,noObjectSimulate:(e,t)=>`${e} this click has no objects, so it cannot simulate: ${t}`,operation:(e,t)=>`${e} must be a scenario operation of the source: ${t}`,noObjectAct:(e,t)=>`${e} this click has no objects, so it cannot run an action: ${t}`,kind:e=>`${e} must be ask, act or simulate`},Cc=()=>fe({"zh-CN":yp,"en-US":bp}),wp={alertList:["rule","object"],metricCards:["card"],objectTable:["row"],objectList:["row"],pivotTable:["row"],trendChart:["point"],regionMap:["region"],stageChain:["stage"],[Te]:["button"]},kp={alertList:["rule","object"],objectTable:["row"],objectList:["row"],pivotTable:["row"],[Te]:["button"]},Ra={objectTable:"row",objectList:"row",[Te]:"button"},Nc={rule:["count","rule.label","rule.severity"],object:["count","rule.label","rule.severity"],card:["count","card.label","value"],row:["count"],point:["count","category","period","value","series"],region:["count","region","value"],stage:["count","stage.label"],button:["count"]},xc=["object","row","button"],nr=["hits","filters"],or=["auto","prefill"],sr=200,vp=/\{([^{}]+)\}/g;function $p(e){return[...e.matchAll(vp)].map(t=>t[1].trim())}function rr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Sp(e,t,n,o){const s=Cc();if(!rr(e))return[s.object(o)];const a=new Set(["on","question","agent","context","send","maxObjects"]),r=Object.keys(e).filter(l=>!a.has(l)).map(l=>s.noOption(o,l));if(t.includes(e.on)||r.push(s.oneOf(`${o}.on`,t)),typeof e.question!="string"||!e.question.trim()||e.question.length>300)r.push(s.question(`${o}.question`));else{const l=new Set([...Nc[e.on]??[],...xc.includes(e.on)?(n??[]).map(c=>c.name):[]]);for(const c of $p(e.question))l.has(c)||r.push(s.placeholder(`${o}.question`,c))}return e.agent!==void 0&&e.agent!=="analyst"&&r.push(s.agent(`${o}.agent`)),e.context!==void 0&&(!Array.isArray(e.context)||e.context.some(l=>!nr.includes(l)))&&r.push(s.context(`${o}.context`,nr)),e.send!==void 0&&!or.includes(e.send)&&r.push(s.send(`${o}.send`,or)),e.maxObjects!==void 0&&(typeof e.maxObjects!="number"||!Number.isInteger(e.maxObjects)||e.maxObjects<1||e.maxObjects>sr)&&r.push(s.maxObjects(`${o}.maxObjects`,sr)),r}const jp=["row","object","rule","button"],Ap=8,Jn=5;function Tp({on:e,...t}){return{on:e,do:[{kind:"ask",...t}]}}function Op({on:e,label:t,...n}){return{on:e,...t?{label:t}:{},do:[{kind:"act",...n}]}}function Ep(e,t,n,o,s,a){const r=Cc();return!Array.isArray(e)||e.length>t.max?[r.list(a,t.max)]:e.flatMap((l,c)=>{const i=`${a}[${c}]`;if(!rr(l))return[r.object(i)];const d=Object.keys(l).filter(u=>!["on","label","do"].includes(u)).map(u=>r.noOption(i,u)),h=l.on;return t.on.includes(h)?(l.label!==void 0&&(typeof l.label!="string"||l.label.length>20)&&d.push(r.label(`${i}.label`)),!Array.isArray(l.do)||l.do.length===0||l.do.length>Jn?(d.push(r.steps(`${i}.do`,Jn)),d):(l.do.forEach((u,p)=>{const f=`${i}.do[${p}]`;if(!rr(u))return d.push(r.object(f));const{kind:m,...g}=u;if(m==="ask")d.push(...Sp({...g,on:h},[h],s,f));else if(m==="simulate"){t.actOn.includes(h)||d.push(r.noObjectSimulate(f,h));const y=pe(n.spec,o);Object.keys(g).filter(b=>b!=="operation").forEach(b=>d.push(r.noOption(f,b))),y?.operations?.some(b=>b.id===g.operation)||d.push(r.operation(`${f}.operation`,String(g.operation)))}else m==="act"?t.actOn.includes(h)?d.push(...yc({...g,on:h},{on:[h],hit:t.hit},n,o,f)):d.push(r.noObjectAct(f,h)):d.push(r.kind(`${f}.kind`));return d}),d)):(d.push(r.oneOf(`${i}.on`,t.on)),d)})}function Cp(e,t,n,o){const s=e.filter(r=>jp.includes(r)),a=e.map(r=>`${r}:${Nc[r].join("、")}`).join(";");return[`点击时还要做什么,列表,每项 { on, label?, do }:on 为 ${e.join("、")} 之一;do 为按顺序执行的 1 到 ${Jn} 个动作(点击写入的筛选总是先写入,不写在这里)`,s.length>0?`${s.join("、")} 各项是单独一个按钮,label 为按钮文字`:"",`问 Agent 的动作 { kind: "ask", question, agent?, context?, send?, maxObjects? }:question 是问题模板,可用占位 {…}(${a}${e.some(r=>xc.includes(r))?";点到单个对象时还可用该对象的字段名":""});context 取 hits(点到的对象)、filters(当前筛选);send 为 auto(直接发送)或 prefill(放进输入框)`,t.length>0?`推演的动作 { kind: "simulate", operation }(只能用于 ${t.join("、")}):operation 为数据源的推演操作 id,点击后由用户填参数,写入当前方案,不执行行动${o?`;数据源有推演操作而这里没写推演的动作时,${o} 上已自动提供“推演”按钮(多个操作时为下拉选择),只在要限定用哪个操作时才写`:""};执行行动的动作 { kind: "act", action, targets?, params?, confirm?, maxObjects? }(只能用于 ${t.join("、")}):action 为行动类型 id,须作用于数据源的对象类;targets ${n?"默认 hit(点到的对象),也可":""}为 { selection: 选中筛选 } 或 { set: 对象集合筛选 };params 给行动的每个“用户填写”参数指定来源:{ from: "input", label? }(确认时用户填)、{ from: "var", variable }(页面筛选的值)、{ from: "const", value };confirm 为确认时的说明,可用 {count}、{action};执行前总会弹出确认`:""].filter(Boolean).join(";")}function Np(e){return typeof e=="string"&&e!==""?e.slice(0,10):"—"}function xp(e){return e.toLocaleString(void 0,{maximumFractionDigits:2})}function Rp(e,t="text"){return e==null||e===""?"—":t==="date"?Np(e):t==="number"&&typeof e=="number"?xp(e):String(e)}let Zn=me;function _p(e){const t=Object.values(re).find(s=>s.value===e);if(!t)return e;const n=`workshopLab.progress.status.${e}`,o=Zn.isInitialized?Zn.t(n):n;return typeof o=="string"&&o!==n?o:t.label}function Pp(e){const t=Object.values(In).find(s=>s.value===e);if(!t)return e;const n=`workshopLab.scenario.mark.${e}`,o=Zn.isInitialized?Zn.t(n):n;return typeof o=="string"&&o!==n?o:t.label}function xo(e,t,n){return e===le.status&&typeof t=="string"?_p(t):e===rn&&typeof t=="string"?Pp(t):Rp(t,n)}const Fe=e=>typeof e=="string"?e:"";function Lp(e,t){const n=(Array.isArray(e.layers)?e.layers:[]).filter(r=>typeof r=="object"&&r!==null),o=[],s=n.filter(r=>r.style==="standard");n.length>0&&s.length===0&&o.push({key:"noTasks"}),Fe(e.source)!==""&&Fe(e.titleField)===""&&o.push({key:"noResourceName"});const a=n.some(r=>r.style==="background"&&r.blocks===!0);for(const r of s){const l=Fe(r.label),c=Array.isArray(r.ruleTools)?r.ruleTools:[],i=u=>Array.isArray(u)&&u.length>0,d=r.exclusive===!0||a||c.length>0||Fe(r.earliestField)!==""||i(r.readyFrom)||i(r.predecessorPath);Fe(r.adjust)!==""&&!d&&o.push({key:"noConstraints",values:{layer:l}});const h=new Set;for(const u of c){const p=u?.tool;if(!p||Fe(p.box)===""||Fe(p.tool)==="")continue;const f=`${Fe(p.box)}/${Fe(p.tool)}`;h.has(f)&&o.push({key:"duplicateTool",values:{layer:l,name:Fe(u.name)}}),h.add(f)}}return o}const Ip=/^\d{4}-\d{2}-\d{2}$/;function _a(e,t){const n=new Intl.DateTimeFormat("en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(new Date(e)),o=a=>Number(n.find(r=>r.type===a)?.value);return Date.UTC(o("year"),o("month")-1,o("day"),o("hour"),o("minute"),o("second"))-(e-(e%1e3+1e3)%1e3)}function Mp(e){if(e)try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),e}catch{return}}const qp=e=>{const[t,n,o]=e.split("-").map(Number);return new Date(Date.UTC(t,n-1,o+1)).toISOString().slice(0,10)};function Rc(e,t){const[n,o,s]=e.split("-").map(Number),a=Mp(t);if(!a)return new Date(n,o-1,s).getTime();const r=Date.UTC(n,o-1,s),l=r-_a(r,a);return r-_a(l,a)}function Fp(e,t){return Rc(qp(e),t)-1}function Dp(e){return new Set([...e.dimensions,...e.timeDimensions])}function Pa(e,t){return e.kn.objectTypes[e.metric.objectType]?.properties.find(n=>n.name===t)?.type}const ar=(e,t)=>({source:"property",property_ref:{object_type_id:e.objectType,property_name:t}}),_c=e=>({source:"literal",value_type:"string",value:e}),Pc=e=>({source:"literal",value_type:Number.isInteger(e)?"int64":"decimal",value:e}),Qe=e=>({source:"literal",value_type:"datetime",value:e}),Ce=(e,t,n)=>({node_type:"predicate",left:e,comparison_operator:t,...n?{right:n}:{}});function Bp(e,t){if(t.length!==0)return t.length===1?t[0]:{node_type:"group",boolean_operator:e,children:t}}const Lc=e=>e!==""&&e!==null&&e!==void 0&&!Number.isNaN(Number(e));function Ic(e,t,n,o){if(!Ip.test(n))return null;const[s,a]=[Rc(n,o.timezone),Fp(n,o.timezone)];switch(t){case"eq":return Ce(e,"between",[Qe(s),Qe(a)]);case"ne":return Ce(e,"not_between",[Qe(s),Qe(a)]);case"before":return Ce(e,"before",[Qe(s)]);case"onOrBefore":return Ce(e,"before_or_equal",[Qe(a)]);case"after":return Ce(e,"after",[Qe(a)]);case"onOrAfter":return Ce(e,"after_or_equal",[Qe(s)]);default:return null}}function Up(e,t,n,o){if(n.length===0)return null;const s=ar(o,e);if(t==="text")return Ce(s,"in",n.map(_c));if(t==="number")return n.every(Lc)?Ce(s,"in",n.map(r=>Pc(Number(r)))):null;const a=n.map(r=>Ic(s,"eq",r.slice(0,10),o));return a.every(Boolean)?Bp("or",a)??null:null}const La={eq:"eq",ne:"neq",before:"before",onOrBefore:"before_or_equal",after:"after",onOrAfter:"after_or_equal",gt:"gt",gte:"gte",lt:"lt",lte:"lte"};function Mc(e,t){const n=Dp(t.metric),o=n.has(e.field)?Pa(t,e.field):void 0;if(!o)return null;const s=ar(t.metric,e.field);if(e.op==="isSet")return Ce(s,o==="text"?"is_not_empty":"is_not_null");if(e.op==="isEmpty")return Ce(s,o==="text"?"is_empty":"is_null");if(e.op==="in")return Up(e.field,o,e.values??[],t.metric);if(e.ref!==void 0&&e.ref!==ue){const l=n.has(e.ref)?Pa(t,e.ref):void 0,c=La[e.op];return!c||l!==o||["before","onOrBefore","after","onOrAfter"].includes(e.op)||["gt","gte","lt","lte"].includes(e.op)&&o!=="number"?null:Ce(s,c,[ar(t.metric,e.ref)])}const a=e.ref===ue?t.asOf:e.value;if(a===void 0||a==="")return null;if(o==="date")return Ic(s,e.op,String(a).slice(0,10),t.metric);const r=La[e.op];return o==="number"?!r||["before","onOrBefore","after","onOrAfter"].includes(e.op)?null:Lc(a)?Ce(s,r,[Pc(Number(a))]):null:e.op==="eq"||e.op==="ne"?Ce(s,r,[_c(String(a))]):null}const zp={cardShape:"指标卡只能显示返回单个值的指标",timeShape:"按时间的图表只能用有固定时间粒度、没有固定分组的指标",timeGrain:"时间粒度须为日、周、月或季度",weekStart:"按周的指标须从周一起算",categoryShape:"按类别的图表只能用返回单个值的指标",categoryDimension:"类别列须是指标开放的分析维度",blocked:e=>`子集的条件(${e})不能交给平台`,listJoiner:"、",ops:{isSet:"有值",isEmpty:"为空",eq:"等于",ne:"不等于",in:"属于",before:"早于",onOrBefore:"不晚于",after:"晚于",onOrAfter:"不早于",gt:"大于",gte:"不小于",lt:"小于",lte:"不大于"},refShape:e=>`${e} 必须是 { id, version },version 为不小于 1 的整数`,unknownMetric:(e,t)=>`${e} 不是知识网络中已发布的对象指标:${t}`,unpublished:(e,t,n)=>`${e} 的版本 ${t} 尚未发布(最新为 ${n})`,sourceKind:e=>`${e} 对象指标只能用在对象类数据源或它的子集上`,otherObjectType:(e,t)=>`${e} 指标「${t}」不属于数据源的对象类`,subsetBlocked:(e,t)=>`${e} 数据源是子集,它的条件(${t})不能交给平台,不能用对象指标`,unfit:(e,t,n)=>`${e} ${t}:「${n}」`},Wp={cardShape:"a metric card can only show a metric that returns a single value",timeShape:"a chart by time can only use a metric with a fixed time grain and no fixed grouping",timeGrain:"the time grain must be day, week, month or quarter",weekStart:"a weekly metric must start its weeks on Monday",categoryShape:"a chart by category can only use a metric that returns a single value",categoryDimension:"the category column must be an analysis dimension the metric opens",blocked:e=>`the subset's condition (${e}) cannot be handed to the platform`,listJoiner:", ",ops:{isSet:"has a value",isEmpty:"is empty",eq:"equals",ne:"does not equal",in:"is one of",before:"is before",onOrBefore:"is not after",after:"is after",onOrAfter:"is not before",gt:"is greater than",gte:"is at least",lt:"is less than",lte:"is at most"},refShape:e=>`${e} must be { id, version }, with version an integer of at least 1`,unknownMetric:(e,t)=>`${e} is not a published object metric of the knowledge network: ${t}`,unpublished:(e,t,n)=>`version ${t} of ${e} is not published yet (the latest is ${n})`,sourceKind:e=>`${e}: an object metric can only be used on an object type source or a subset of one`,otherObjectType:(e,t)=>`${e}: metric "${t}" does not belong to the source's object type`,subsetBlocked:(e,t)=>`${e}: the source is a subset whose condition (${t}) cannot be handed to the platform, so it cannot use an object metric`,unfit:(e,t,n)=>`${e}: ${t} ("${n}")`},_r=()=>fe({"zh-CN":zp,"en-US":Wp}),Kp=new Set(["day","week","month","quarter"]);function Yp(e,t){return e==="card"?{place:"card"}:t.axis==="category"?{place:"category",...typeof t.category=="string"?{category:t.category}:{}}:{place:"time"}}function ir(e){if(typeof e!="object"||e===null)return;const{id:t,version:n}=e;return typeof t=="string"&&t!==""&&Number.isInteger(n)&&(n??0)>=1?{id:t,version:n}:void 0}function Gp(e){const t=e.owner_object_type_id,n=p=>p.filter(f=>f.object_type_id===t&&!f.relation_path_alias).map(f=>f.property_name),o=e.result_semantics.statistical_grain,s=e.specification,a=s.kind==="derived"?s.business_qualifiers:void 0,r=n(e.query_capabilities.time_dimensions),l=a?.event_time,c=l?l.object_type_id===t?l.property_name:void 0:e.query_capabilities.time_dimensions.length===1?r[0]:void 0,i=a?.time_window,d=e.result_semantics.value,h=d.unit?.display_symbol||d.unit?.code,u=o.time_granularity?"time_series":o.group_by_dimensions.length>0?"grouped":"summary";return{id:e.id,version:e.version,status:e.lifecycle.status==="deprecated"?"deprecated":"published",code:e.code,name:e.name,description:e.description,objectType:t,kind:e.metric_type,shape:u,...o.time_granularity?{grain:o.time_granularity}:{},...o.timezone?{timezone:o.timezone}:{},...o.week_start?{weekStart:o.week_start}:{},groupBy:n(o.group_by_dimensions),dimensions:n(e.query_capabilities.analysis_dimensions),timeDimensions:r,...c?{timeField:c}:{},...i&&i.mode!=="unbounded"?{window:{mode:i.mode,..."length"in i?{length:i.length,unit:i.unit}:{},..."period"in i?{period:i.period}:{}}}:{},noData:e.result_semantics.no_data_policy,value:{semantic:d.semantic_type,...d.scale!==void 0?{scale:d.scale}:{},...h?{unit:h}:{},...d.unit?.quantity_kind==="currency"?{unitFirst:!0}:{}}}}function Hp(e,t=[]){const n=new Map;for(const o of[...e,...t]){const s=Gp(o.definition),a=n.get(s.id);(!a||a.status===s.status&&s.version>a.version)&&n.set(s.id,s)}return[...n.values()]}function Vp(e,t,n){const o=_r();return t==="card"?e.shape==="summary"?null:o.cardShape:t==="time"?e.shape!=="time_series"||e.groupBy.length>0?o.timeShape:Kp.has(e.grain??"")?e.grain==="week"&&e.weekStart==="sunday"?o.weekStart:null:o.timeGrain:e.shape!=="summary"?o.categoryShape:n&&!e.dimensions.includes(n)?o.categoryDimension:null}function Jp(e,t){const n=pe(e,t);if(!n||n.cypher||n.events||n.model)return;const o=n.from?e.sources.find(s=>s.id===n.from?.source):n;return o&&!o.cypher&&!o.events&&!o.model?n:void 0}function Zp(e,t,n){return(e.from?.where??[]).find(o=>!Mc(o,{metric:t,kn:n,asOf:"2000-01-01"}))}function qc(e){const t=_r(),n=t.ops,o=e.ref??e.values?.join(t.listJoiner)??(e.value!==void 0?String(e.value):"");return[e.field,n[e.op],o].filter(Boolean).join(" ")}function Xp(e,t,n,o,s,a,r){const l=_r(),c=ir(e);if(!c)return[l.refShape(a)];if(!t.metrics)return[];const i=t.metrics.find(p=>p.id===c.id);if(!i)return[l.unknownMetric(a,c.id)];if(c.version>i.version)return[l.unpublished(a,c.version,i.version)];const d=Jp(n,o);if(!d)return[l.sourceKind(a)];if(d.objectType!==i.objectType)return[l.otherObjectType(a,i.name)];const h=Zp(d,i,t);if(h)return[l.subsetBlocked(a,qc(h))];const u=c.version===i.version?Vp(i,s,r):null;return u?[l.unfit(a,u,i.name)]:[]}function Ia(e,t){const n=t?e.metrics?.find(o=>o.id===t.id):void 0;return n&&n.version===t?.version?n:void 0}function Qp(e,t){const n=(e.metrics??[]).filter(s=>!0);if(n.length===0)return"";const o=s=>s.shape==="time_series"?`时间序列(按${s.grain})`:s.shape==="grouped"?`固定分组(${s.groupBy.join("、")})`:"单个值";return`对象指标(网络中已发布,平台按全部对象计算;卡片或系列写 metric: { id, version },只能用下列 id 与版本,不能编造):
|
|
12
|
+
${n.map(s=>`- id ${s.id},version ${s.version}:${s.name}(${s.code});${s.description};对象类 ${s.objectType};${s.kind==="atomic"?"原子":s.kind==="derived"?"衍生":"复合"};返回${o(s)};时间维度 ${s.timeField??"无(不随基准日期)"};开放的维度 ${s.dimensions.join("、")||"无"}${s.value.unit?`;单位 ${s.value.unit}`:""}`).join(`
|
|
13
|
+
`)}`}const ef={object:e=>`${e} 必须是对象`,steps:(e,t)=>`${e}.steps 必须是 1 到 ${t} 步`,required:e=>`${e} 必填`,stepField:e=>`${e} 必填:日期属性,或给出 done 条件`,dateField:e=>`${e} 必须是数据源的日期属性`},tf={object:e=>`${e} must be an object`,steps:(e,t)=>`${e}.steps must have 1 to ${t} steps`,required:e=>`${e} is required`,stepField:e=>`${e} is required: a date property, unless done is given`,dateField:e=>`${e} must be a date property of the source`},nf=()=>fe({"zh-CN":ef,"en-US":tf}),lr=12;function of(e,t,n){if(e===void 0)return[];const o=nf();if(!Ro(e))return[o.object(n)];const s=r=>t.some(l=>l.name===r&&l.type==="date"),a=[];return!Array.isArray(e.steps)||e.steps.length===0||e.steps.length>lr?[o.steps(n,lr)]:(e.steps.forEach((r,l)=>{const c=`${n}.steps[${l}]`;if(!Ro(r))return a.push(o.object(c));(typeof r.label!="string"||r.label.trim()==="")&&a.push(o.required(`${c}.label`));const i=Array.isArray(r.done)&&r.done.length>0;r.field===void 0||r.field===""?i||a.push(o.stepField(`${c}.field`)):s(r.field)||a.push(o.dateField(`${c}.field`)),r.done!==void 0&&a.push(...xe(r.done,t,`${c}.done`))}),e.due!==void 0&&(!Ro(e.due)||!s(e.due.field))&&a.push(o.dateField(`${n}.due.field`)),a)}function sf(e){return e?.steps[0]?.field}const rf=`进度(sources[].progress,可选):这类对象依次经过哪几步、截止日期是哪个。{ steps: [{ label, field, done? }], due?: { field, label? } }
|
|
14
|
+
- steps:1 到 ${lr} 步,按先后顺序;field 为这一步的日期属性。默认日期不晚于基准日期就算这一步完成;给了 done(条件列表,写法同计算列的条件,只能读数据源自己的属性)则按条件判断,比如某个状态属性 eq 某个表示完成的值,这时 field 可以省略。计划日期(如计划完工日)不能说明这一步真的完成了,这种步骤要用 done 按实际状态判断。
|
|
13
15
|
- due:截止日期属性。
|
|
14
16
|
- 第一步有日期时,对象从这个日期起才算存在:基准日期早于这个日期的对象不出现;没有这个日期的对象不显示,页面上会提示有几条。
|
|
15
17
|
- 有进度的数据源自动多出这些列,组件、筛选、计算列都能直接用:${le.status}(进度状态,取值是代码:最后一步完成为 "${re.done.value}"(${re.done.label});否则过了截止日期为 "${re.overdue.value}"(${re.overdue.label});其余为 "${re.active.value}"(${re.active.label})。条件、取值列表、筛选默认值里都写代码,页面上按语言显示名称)、${le.stage}(当前步骤:已完成的最后一步的 label);有 due 时还有 ${le.overdueDays}(超期天数,只有已超期时有值)、${le.dueInDays}(距截止天数,只有进行中时有值)。这些列名以 $ 开头,不会和属性重名;对象类自己的 status 等属性照常可用。
|
|
16
|
-
- 详情抽屉的进度条直接按进度画。`;function Po(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const rf=e=>hh.includes(e??"")?e:"P3";function af(e,t){if(!t)return;const n=e.sources.filter(o=>{const s=ue(e,o.id);return s&&!s.events&&!s.cypher&&s.objectType===t});return(n.find(o=>!o.from)??n[0])?.id}function Fc(e,t,n){const o=n?.get(t.id),s=o?.subject||void 0,r=af(e,s);return{...t,label:o?.name||t.id,severity:rf(o?.severity),...o?{source:o.source,network:o}:{},...n&&!o?{missing:!0}:{},...s?{objectType:s}:{},...r?{subject:r}:{}}}function en(e){if(!e)return;const t=Array.isArray(e)?e:Object.values(e);return new Map(t.map(n=>[n.code,n]))}function Mn(e,t){return(e.eventTypes??[]).map(n=>Fc(e,n,t))}const ot="fieldRoles",Dc=`${ot}.`,sn=new Map,lf=new Set;function Bc(e,t,n="zh-CN"){const o=sn.get(t.type);o?.package===e&&o.locale===n||(sn.set(t.type,{package:e,manifest:t,schema:Uc(t,n),locale:n}),lf.forEach(s=>s()))}function cf(e){return sn.get(e)?.schema??df(e)}function df(e){return{label:e,summary:"",category:"display",description:`自定义组件 ${e}`,descriptors:[],follows:!1,selectorKeys:[],defaults:()=>({})}}function uf(e){if(!Rt(e))return gc[e];const t=sn.get(e)?.manifest.minSize;return t?[t.w,t.h]:[3,3]}function hf(e,t){return e.label[t]??e.label["zh-CN"]??e.type}const Lr=e=>e==="string"?"text":e==="number"?"number":e==="date"||e==="datetime"?"date":void 0,pf=["filter","display","chart","relation"];function ff(e,t,n){const o=t["x-workshop"],s={key:e,label:t.title??e,...t.description?{hint:t.description}:{},...n?{}:{optional:!0},tab:o?.tab??"display",...o?.showIf?{shows:l=>Object.entries(o.showIf??{}).every(([c,i])=>l[c]===i)}:{}},r=Lr(o?.fieldTypes?.[0]);let a=null;switch(o?.widget){case"field":a={...s,kind:"field",...r?{of:r}:{}};break;case"fields":a={...s,kind:"fields",...r?{of:r}:{}};break;case"variable":a={...s,kind:"variable",accepts:Hn};break;case"objectType":a={...s,kind:"objectType"};break;case"relationPath":a={...s,kind:"relationPath",...mf(t)?{single:!0}:{}};break;case"actionType":a={...s,kind:"actionTypes"};break;default:Array.isArray(t.enum)&&t.enum.every(l=>typeof l=="string")?a={...s,kind:"enum",options:t.enum.map(l=>[l,l])}:t.type==="boolean"?a={...s,kind:"bool"}:t.type==="number"||t.type==="integer"?a={...s,kind:"number",min:t.minimum??-1e12,max:t.maximum??1e12,...t.type==="number"?{decimal:!0}:{}}:t.type==="string"&&(a={...s,kind:"text",max:t.maxLength??null})}return a}const mf=e=>e.type==="string"||e["x-workshop"]?.maxHops===1;function gf(e){return Object.entries(e.configSchema.properties??{}).filter(([,t])=>{const n=t["x-workshop"]?.widget;return n==="actionType"||n==="relationPath"&&t.type==="string"}).map(([t])=>t)}function yf(e,t){const n=sn.get(e)?.manifest,{[ot]:o,...s}=t,r={...s};if(o&&typeof o=="object"&&!Array.isArray(o))for(const[a,l]of Object.entries(o))r[Dc+a]=l;for(const a of n?gf(n):[])typeof r[a]=="string"&&(r[a]=[r[a]]);return r}function Uc(e,t="zh-CN"){const n=e.data.source,o=Array.isArray(e.data.fields)?e.data.fields:[],s=new Set(e.configSchema.required??[]),r={},a=[{key:"title",label:"标题",kind:"text",max:80,optional:!0,tab:"display"}];n&&a.push({key:"source",label:"数据源",kind:"source",tab:"data"});for(const c of o){const i=Lr(c.type);a.push({key:Dc+c.role,label:`字段:${c.role}`,kind:"field",...i?{of:i}:{},tab:"data"})}for(const[c,i]of Object.entries(e.configSchema.properties??{})){if(["title","source","filters","selection",ot].includes(c))continue;const d=ff(c,i,s.has(c));d?a.push(d):(i.type==="array"||i.type==="object")&&(r[c]=i.type)}const l=n&&e.follows;return l&&a.push({key:"filters",label:"跟随筛选",kind:"bindings",optional:!0,tab:"link"}),e.emits?.includes("selection")&&a.push({key:"selection",label:"点选对象写入",kind:"variable",accepts:["selection"],optional:!0,tab:"link"}),{label:hf(e,t),summary:e.description,category:pf.includes(e.category)?e.category:"display",description:e.description,descriptors:a,...Object.keys(r).length>0?{free:r}:{},follows:l,selectorKeys:[],defaults:(c,i)=>bf(e,c,i.kn)}}function bf(e,t,n){const o={};for(const[i,d]of Object.entries(e.configSchema.properties??{}))d.default!==void 0&&(o[i]=d.default);if(!e.data.source)return o;const s=t.sources[0];if(!s)return o;if(o.source=s.id,e.emits?.includes("selection")){const i=t.variables.find(d=>d.kind==="selection"&&(!("source"in d)||d.source===s.id))?.name;i&&(o.selection=i)}if(Array.isArray(e.data.fields)){const i=pe(s,n),d={},h=new Set;for(const u of e.data.fields){const p=Lr(u.type),f=i.find(m=>!h.has(m.name)&&(!p||m.type===p));f&&(d[u.role]=f.name,h.add(f.name))}Object.keys(d).length>0&&(o[ot]=d)}const r=new Set(e.configSchema.required??[]),a=i=>Object.entries(e.configSchema.properties??{}).filter(([d,h])=>r.has(d)&&o[d]===void 0&&h["x-workshop"]?.widget===i);let l;const c=n.relations.find(i=>i.source===s.objectType||i.target===s.objectType);if(c){l=c.source===s.objectType?c.target:c.source;for(const[i,d]of a("relationPath"))o[i]=d.type==="string"?c.id:[c.id]}for(const[i]of a("objectType"))o[i]=l??s.objectType;return o}const Ma=[["neutral","中性"],["info","信息"],["success","成功"],["warning","警示"],["danger","危险"]],dr=[["count","计数"],["sum","求和"],["avg","平均"],["min","最小"],["max","最大"],["distinct","去重计数"]],wf=[...dr,["ratio","占比(满足条件的 ÷ 全部)"]];function qa(e){return e.basis==="period"||e.basis===void 0&&e.periodField!==void 0}function Lo(e){return typeof e.compare=="string"&&e.compare!=="none"}const kf=[["local","浏览器所在时区"],["Asia/Shanghai","北京时间"],["UTC","协调世界时"],["Asia/Tokyo","东京时间"],["Asia/Singapore","新加坡时间"],["Europe/Berlin","柏林时间"],["Europe/London","伦敦时间"],["America/New_York","纽约时间"],["America/Los_Angeles","洛杉矶时间"]],vf=[["high","严重"],["medium","关注"],["low","提示"]],Fa=[["asc","升序"],["desc","降序"]],J=(e="标题")=>({key:"title",label:e,kind:"text",tab:"display",optional:!0}),ae={key:"source",label:"数据源",kind:"source",tab:"data"},Q=(e,t,n,o,s={})=>({key:e,label:t,kind:"variable",accepts:n,tab:"link",sentence:o,optional:s.optional??!0,reads:s.reads}),_e={key:"valueField",label:"统计字段",hint:"求和、平均、最大、最小须选择数字列。",kind:"field",optional:!0,shows:e=>e.aggregate!==void 0&&!["count","ratio"].includes(String(e.aggregate)),neededAs:e=>["sum","avg","min","max"].includes(String(e.aggregate))?"number":void 0},rt=[{key:"label",label:"名称",kind:"text"},{key:"when",label:"仅统计满足以下条件的",kind:"conditions",optional:!0},{key:"aggregate",label:"统计方式",kind:"enum",options:wf},_e],Se=e=>e.metric!==void 0,Io=e=>({key:"metric",label:"数值来源",hint:"对象指标由平台按全部对象计算,口径在知识网络中定义。",kind:"metric",on:e,optional:!0}),wt={key:"description",label:"说明",hint:"显示在标题下面的一行小字,写这里看什么、该做什么。",kind:"text",max:120,tab:"display",optional:!0},$f=/^[A-Za-z][A-Za-z0-9_]*$/,ve={key:"filters",label:"跟随的筛选",kind:"bindings",tab:"link",optional:!0},$e=(e,t,n,o)=>typeof e[t]=="string"&&e[t]!==""?[{key:t,variable:e[t],...typeof n=="string"?{field:n}:{},...Array.isArray(o)?{fields:o.filter(s=>typeof s=="string")}:{}}]:[],Sf=[["frontend","前端 Agent(在浏览器内调用平台模型,可读取页面并代为筛选)"],["bknAgent","内置 BKN Agent(平台智能问答 Agent,以当前用户身份查询知识网络)"],["mcp","外部 Agent(执行工厂中登记的 MCP 服务,由对方直接回答)"]];function Da(e,t){return[{key:"objectType",label:e,kind:"objectType"},{key:"path",label:"关系路径",kind:"relationPath"},{key:"field",label:t,kind:"field",owner:"objectType",of:"date"}]}const ze={asOfSlider:{label:"基准日期",summary:"拖动滑块选择日期,整页按该日期计算。",category:"filter",description:"滑块选一个日期,全页按这一天计算:有进度的数据源按第一步的日期决定对象在这天是否存在,状态、超期天数等读基准日期的列跟着重算;滑块范围从范围日期属性的最早值到今天",descriptors:[J(),{...ae,label:"滑块范围取自"},{key:"rangeField",label:"范围日期属性(默认取进度第一步的日期)",kind:"field",tab:"data",of:"date",optional:!0},{key:"step",label:"步长",kind:"enum",tab:"display",options:[["day","天"],["week","周"],["month","月"]]},Q("writes","写入",["asOf"],"拖动滑块时,按 {var} 重新计算全页",{optional:!1})],follows:!1,selectorKeys:[],defaults:(e,t,n)=>({title:"基准日期",source:ee(e,n,Kh)?.id,step:"day",writes:je(e,"asOf")})},dateRange:{label:"日期区间",summary:"选择日期区间,跟随它的组件仅查看该时间段。",category:"filter",description:"选起点和终点两个日期(附本月、上月、近 30 天、今年等快捷项),写入一个日期区间筛选;跟随它的组件只看某个日期列落在区间里的对象",descriptors:[J(),ae,{key:"field",label:"依据的日期(新组件默认依此跟随)",kind:"field",tab:"data",of:"date"},{key:"presets",label:"显示快捷项",kind:"bool",tab:"display"},Q("writes","写入",["dateRange"],"选定日期后,按 {var} 筛选",{optional:!1})],follows:!1,selectorKeys:[],emits:e=>$e(e,"writes",e.field),defaults:(e,t,n)=>{const o=ee(e,n);return{title:"日期区间",source:o?.id,field:o?of(o.progress)??Mo(o,t,"date"):void 0,presets:!0,writes:je(e,"dateRange")}}},metricCards:{label:"指标卡组",summary:"一排数字卡片,每张统计一项指标;点击卡片可筛选页面。",category:"filter",description:"一行指标卡,每张是一个统计(计数、求和、平均、最大最小、去重计数、占比),可只算满足条件的对象(如进度状态为 overdue 且金额大于 100 万);整组 compare(none 不显示、mom 环比、yoy 同比、both 都显示)对每张卡生效;basis 为 asOf(默认:统计基准日期(没有则今天)当天处于各状态的对象,与告警一致,同环比对比上一期、去年的同一天)或 period(只统计日期落在基准日期所在期的对象,如本月签约数;periodField 为日期属性,不填取进度第一步的日期;同环比按相同天数对比);periodUnit 为 day/week/month/quarter/year(默认 month);单张卡的 compare 可覆盖整组(none 为这张不显示),better(up 越高越好、down 越低越好)决定涨跌颜色,不填时按色调推断(danger、warning 越低越好,success 越高越好);点卡片写入筛选:取值筛选写这张卡的取值(卡片条件只能是一个字段取某些值),对象集合筛选写它算到的对象。一张卡写了 metric 就改为显示知识网络的对象指标:由平台按全部对象计算,不受数据源读取行数限制;when 只能用该指标开放的属性;它不写入筛选,点击时列出参与对象",descriptors:[J(),ae,{key:"compare",label:"同比环比",hint:"对整组卡片生效;单张卡片可在下方「指标」中另设。",kind:"enum",tab:"data",optional:!0,options:[["none","不显示"],["mom","环比(与上一期比较)"],["yoy","同比(与去年同期比较)"],["both","同比与环比"]]},{key:"basis",label:"统计口径",hint:"截至基准日期:统计基准日期当天处于各状态的对象,与告警、表格一致,适合已超期、进行中等状态;同比、环比与去年、上一期的同一天对比。基准日期所在期:只统计日期落在本期的对象,适合本月签约数等新增量;同比、环比按相同天数对比。",kind:"enum",tab:"data",optional:!0,options:[["asOf","截至基准日期"],["period","基准日期所在期"]]},{key:"periodField",label:"分期日期",hint:"对象按该日期归入某一期。留空时使用进度第一步的日期(如签约时间)。",kind:"field",of:"date",tab:"data",optional:!0,shows:(e,t)=>qa(t)},{key:"periodUnit",label:"周期",hint:"默认按月:环比对比上个月,按期统计时一期为一个月。",kind:"enum",tab:"data",optional:!0,shows:(e,t)=>Lo(t)||qa(t),options:[["day","日"],["week","周"],["month","月"],["quarter","季度"],["year","年"]]},{key:"showNoData",label:"对比期无数据时显示「无对比数据」",kind:"bool",tab:"data",optional:!0,shows:(e,t)=>Lo(t)},{key:"items",label:"指标",kind:"list",tab:"data",min:1,max:8,item:[rt[0],{key:"description",label:"说明",hint:"显示在数字下面的一行小字,写它的含义或该做什么。",kind:"text",max:60,optional:!0},Io("card"),rt[1],{...rt[2],shows:e=>!Se(e),notNeeded:Se},{..._e,shows:e=>!Se(e)&&_e.shows(e),neededAs:e=>Se(e)?void 0:_e.neededAs(e)},{key:"tone",label:"色调",kind:"enum",options:Ma},{key:"compare",label:"同比环比",hint:"留空时沿用整组设置。",kind:"enum",optional:!0,shows:(e,t)=>Lo(t)||e.compare!==void 0,options:[["none","不显示"],["mom","环比(与上一期比较)"],["yoy","同比(与去年同期比较)"],["both","同比与环比"]]},{key:"better",label:"变化方向",hint:"决定涨跌显示为绿色还是红色。留空时按色调判定:危险、警示越低越好,成功越高越好。",kind:"enum",optional:!0,shows:(e,t)=>(e.compare??t.compare??"none")!=="none"||e.better!==void 0,options:[["up","越高越好(上涨为绿色)"],["down","越低越好(上涨为红色)"]]}]},Q("writes","点击写入",["value","set"],"点击指标卡时,将该卡统计的对象写入 {var}"),ve],follows:!0,selectorKeys:["writes"],emits:(e,t)=>Do(t,e.writes)==="set"?$e(e,"writes"):$e(e,"writes",Wa(e.items)[0]),check:(e,t,n)=>{const o=e.items??[],s=o.flatMap((a,l)=>{const c=Ia(t.kn,lr(a.metric));return c?(a.when??[]).filter(i=>!Mc(i,{metric:c,kn:t.kn,asOf:"2000-01-01"})).map(i=>`${n}.items[${l}].when 的条件(${qc(i)})不能交给平台:对象指标卡的条件只能用指标「${c.name}」开放的属性`):[]});if(Do(t.spec,e.writes)!=="value")return s;const r=o.filter(a=>a.metric===void 0);return r.some(a=>a.when?.length&&!Ec(a.when))?[...s,`${n}.items 写入取值筛选时,每张卡的条件只能是“某字段为某些值”;条件更复杂时改写入对象集合筛选`]:new Set(Wa(r)).size>1?[...s,`${n}.items 写入同一个筛选的指标要按同一个字段取值`]:s},defaults:(e,t,n)=>{const o=ee(e,n,r=>!!et(r)),s=o&&et(o);return{title:"关键指标",source:o?.id,items:[{label:"全部",aggregate:"count",tone:"neutral"},...(s?qo(s):[]).map(r=>({label:s?_o(s.name,r.value):r.value,when:Qt(s?.name,[r.value]),aggregate:"count",tone:r.tone??"neutral"}))],writes:s?vn(e,s.name):void 0}}},segmentedFilter:{label:"分段筛选",summary:"一排带数量的按钮,点击后仅显示该类。",category:"filter",description:"一组带数量的筛选按钮,按一个字段的取值分段;一个按钮可以包含几个取值",descriptors:[J(),ae,{key:"field",label:"字段",kind:"field",tab:"data"},{key:"options",label:"选项",kind:"list",tab:"data",min:2,max:6,item:[{key:"label",label:"名称",kind:"text"},{key:"values",label:"取值(留空为全部)",kind:"values",fieldKey:"field",optional:!0}]},{key:"showCounts",label:"显示数量",kind:"bool",tab:"display"},Q("writes","写入",["value"],"点击选项时,将其取值写入 {var}",{optional:!1}),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes",e.field),defaults:(e,t,n)=>{const o=ee(e,n,r=>!!et(r)),s=o&&et(o);return{source:o?.id,field:s?.name,options:[{label:"全部"},...(s?qo(s):[]).map(r=>({label:s?_o(s.name,r.value):r.value,values:[r.value]}))],showCounts:!0,writes:s?vn(e,s.name):void 0}}},dropdownFilter:{label:"下拉筛选",summary:"下拉选择一个或多个值,跟随它的组件仅显示所选值;选项与数量取自数据。",category:"filter",description:"按一个字段的取值筛选,选项从数据里自动取并带数量,可搜索、可多选;适合取值很多的字段(城市、球队、客户)",descriptors:[J(),ae,{key:"field",label:"字段",kind:"field",tab:"data"},{key:"multiple",label:"允许多选",kind:"bool",tab:"display"},{key:"showCounts",label:"显示数量",kind:"bool",tab:"display"},{key:"placeholder",label:"提示文字",kind:"text",tab:"display",optional:!0},Q("writes","写入",["value"],"选中值时,将其写入 {var}",{optional:!1}),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes",e.field),defaults:(e,t,n)=>{const o=ee(e,n),s=o&&(et(o)?.name??Fo(o,t).find(r=>r!==o.key));return{source:o?.id,field:s,multiple:!1,showCounts:!0,writes:s?vn(e,s):void 0}}},searchBox:{label:"搜索框",summary:"输入关键词,跟随它的组件仅显示包含该关键词的对象。",category:"filter",description:"输入文字,写入一个搜索筛选;跟随它的组件在各自的文本列里查找",descriptors:[J(),ae,{key:"fields",label:"搜索的列(新组件默认依此跟随)",kind:"fields",tab:"data",of:"text",optional:!0},{key:"placeholder",label:"提示文字",kind:"text",tab:"display",optional:!0},Q("writes","写入",["search"],"输入内容时,写入 {var}",{optional:!1})],follows:!1,selectorKeys:[],emits:e=>$e(e,"writes",void 0,e.fields),defaults:(e,t,n)=>{const o=ee(e,n);return{source:o?.id,fields:o?[...Fo(o,t).filter(s=>s===o.key),...Fo(o,t).filter(s=>s!==o.key).slice(0,2)]:[],placeholder:"搜索",writes:je(e,"search",o?.id)}}},text:{label:"文本",summary:"一段文字:标题、结论或说明,在页面上直接编辑,可以引用随筛选变化的数字。",category:"basic",description:"一段 Markdown 文字(标题、加粗、列表、链接),用来写页面开头的结论、分节标题和说明段落;搭建时选中后可在页面上直接编辑。align 为对齐方式(left 左对齐、center 居中、right 右对齐,默认左对齐)。values 列出正文引用的数字,每项 { name, source, aggregate, when?, valueField?, metric?, filters? }:name 字母开头;统计写法同指标卡的一项(写 metric 就取知识网络的对象指标);filters 为这个数字跟随的筛选,写法同组件的 filters,按它自己数据源的字段比对。content 里用 {name} 填入数字,用 {$asOf} 填入基准日期;读不到时显示 —",descriptors:[J(),{key:"content",label:"内容",hint:"可在页面上选中后直接编辑;这里是 Markdown 写法。用 {引用名} 填入下面的数字,用 {$asOf} 填入基准日期。",kind:"text",multiline:!0,max:4e3,tab:"display"},{key:"align",label:"对齐",kind:"enum",tab:"display",optional:!0,options:[["left","左对齐"],["center","居中"],["right","右对齐"]]},{key:"values",label:"引用的数字",kind:"list",tab:"data",optional:!0,min:1,max:12,item:[{key:"name",label:"引用名",hint:"正文里写 {引用名} 填入这个数字;字母开头,可含数字和下划线。",kind:"text"},{key:"source",label:"数据源",kind:"source"},Io("card"),rt[1],{...rt[2],shows:e=>!Se(e),notNeeded:Se},{..._e,shows:e=>!Se(e)&&_e.shows(e),neededAs:e=>Se(e)?void 0:_e.neededAs(e)},{...ve,optional:!0}]}],follows:!1,selectorKeys:[],check:(e,t,n)=>{const s=(e.values??[]).map(l=>l.name),r=s.flatMap((l,c)=>typeof l=="string"&&!$f.test(l)?[`${n}.values[${c}].name 须字母开头,只含字母、数字和下划线`]:[]),a=s.filter((l,c)=>s.indexOf(l)!==c);return a.length>0&&r.push(`${n}.values 的引用名重复:${[...new Set(a)].join("、")}`),r},defaults:()=>({content:"在这里输入文字"})},objectTable:{label:"对象表",summary:"明细表,支持排序、分页、勾选;点击行选中对象。",category:"display",description:"对象明细表,可排序分页;点行选中对象,表头可带按某字段取值的快捷筛选与搜索,某列可点击筛选;格式 tag 把值显示成标签,进度状态和判断状态的计算列带颜色",descriptors:[J(),wt,ae,{key:"columns",label:"列",kind:"list",tab:"data",min:1,max:20,fill:{from:"field",item:Ba},item:[{key:"field",label:"属性",kind:"field"},{key:"label",label:"列名",kind:"text"},{key:"format",label:"格式",kind:"enum",options:[["text","文本"],["date","日期"],["number","数字"],["tag","标签"]]}]},{key:"sortField",label:"排序属性",kind:"field",tab:"data",optional:!0},{key:"sortOrder",label:"排序方向",kind:"enum",tab:"data",options:Fa},{key:"pageSize",label:"每页行数",kind:"number",tab:"display",min:5,max:50},Q("selection","点击行写入",["selection"],"点击行时,选中该对象(写入 {var}),详情抽屉和关系子图将显示该对象"),Q("picks","勾选写入",["set"],"每行前显示勾选框,勾选的对象作为一组写入 {var},其他组件可仅查看该组"),{key:"quickField",label:"表头快捷筛选字段",kind:"field",tab:"link",optional:!0},Q("quickFilter","表头快捷筛选",["value"],"表头按上述字段的取值显示按钮,点击后写入 {var}"),Q("search","表头搜索",["search"],"表头显示搜索框,输入内容时写入 {var}"),{key:"cellFilters",label:"点击单元格筛选",sentence:"点击某列的值时,写入对应的筛选:",kind:"list",tab:"link",min:0,max:4,optional:!0,item:[{key:"field",label:"列的属性",kind:"field"},{key:"variable",label:"写入筛选",kind:"variable",accepts:["value"]}]},ve],follows:!0,selectorKeys:["picks"],emits:e=>[...$e(e,"picks"),...$e(e,"quickFilter",e.quickField),...$e(e,"search",void 0,Of(e)),...(e.cellFilters??[]).flatMap(t=>t.variable?[{key:"cellFilters",variable:t.variable,field:t.field}]:[])],check:(e,t,n)=>e.quickFilter&&!e.quickField?[`${n}.quickField 表头快捷筛选要指定按哪个字段`]:[],defaults:(e,t,n)=>{const o=ee(e,n),s=o?pe(o,t.kn).slice(0,5):[];return{title:o?.label,source:o?.id,columns:s.map(Ba),sortOrder:"desc",pageSize:10,selection:je(e,"selection",o?.id)}}},objectList:{label:"对象列表",summary:"卡片式列表,适用于待办和收件箱;点击列表项选中对象。",category:"display",description:"卡片式列表,适合收件箱、待办;可只看满足条件的对象,点一项选中对象",descriptors:[J(),wt,ae,{key:"when",label:"仅显示满足以下条件的对象",kind:"conditions",tab:"data",optional:!0},{key:"titleField",label:"标题属性",kind:"field",tab:"data"},{key:"subtitleFields",label:"副标题属性",kind:"fields",tab:"data",optional:!0},{key:"sortField",label:"排序属性",kind:"field",tab:"data",optional:!0},{key:"sortOrder",label:"排序方向",kind:"enum",tab:"data",options:Fa},{key:"badgeField",label:"徽标字段(状态类字段按颜色区分)",kind:"field",tab:"display",optional:!0},{key:"limit",label:"最多显示",kind:"number",tab:"display",min:3,max:30},Q("selection","点击写入",["selection"],"点击列表项时,选中该对象(写入 {var}),详情抽屉和关系子图将显示该对象"),ve],follows:!0,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n);return{title:o?.label,source:o?.id,titleField:o&&No(o,t.kn),sortOrder:"desc",badgeField:o?et(o)?.name:void 0,limit:8,selection:je(e,"selection",o?.id)}}},pivotTable:{label:"透视表",summary:"按一个属性分组汇总,每列一项统计;点击行可筛选页面。",category:"display",description:"按一个属性分组汇总,每列一个度量;点一行按该分组筛选全页",descriptors:[J(),wt,ae,{key:"dimension",label:"分组属性",kind:"field",tab:"data"},{key:"measures",label:"度量",kind:"list",tab:"data",min:1,max:5,item:[...rt]},{key:"limit",label:"最多行数",kind:"number",tab:"display",min:5,max:50},{key:"bars",label:"数值显示条形",kind:"bool",tab:"display",optional:!0,hint:"在每列数值下方显示按该列最大值比例的条形,便于比较各组。"},Q("writes","点击行写入",["value"],"点击行时,将该组的取值写入 {var}"),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes",e.dimension),defaults:(e,t,n)=>{const o=ee(e,n),s=o?Sa(pe(o,t.kn),t.kn.objectTypes[o.objectType]):void 0;return{source:o?.id,dimension:s?.name,measures:[{label:"数量",aggregate:"count"}],limit:10,bars:!0}}},trendChart:{label:"图表",summary:"柱状图、折线图或饼图:按时间或类别统计;点击图形可筛选页面。",category:"chart",description:"柱线饼图。横轴 axis 为 time(默认)时按日、周、月或季度统计(grain,默认按月),每个系列用自己的日期属性 dateField,点某个周期把它写入一个日期区间筛选;为 category 时按属性 category 的取值统计(最多 limit 个,取第一个系列最大的几个;sort 为 category 时按类别本身排序,如年份,默认按数值从大到小),点一个取值把它写入取值筛选。segmentBy 把每个系列再按另一个属性拆开(柱堆叠、线分色)。只有一个系列且横轴为 category 时图形可选 pie(饼图)。横轴为 category 且各系列都是柱时,orientation 决定柱子方向:auto(默认)在有类别名长于约四个汉字时改为横向条形(类别列在左侧,过长截断、悬停看全名),vertical 始终竖向,horizontal 始终横向。系列写了 metric 就改为显示知识网络的对象指标,由平台按全部对象计算:一张图的系列要么都写 metric、要么都不写;横轴为时间时粒度跟随指标(各指标须相同,不写 grain);不能用 segmentBy;按类别时由平台取前 limit 个",descriptors:[J(),wt,ae,{key:"axis",label:"横轴",kind:"enum",tab:"data",optional:!0,options:[["time","时间(按周期)"],["category","类别(按属性取值)"]]},{key:"category",label:"类别属性",kind:"field",tab:"data",optional:!0,shows:(e,t)=>t.axis==="category"},{key:"sort",label:"类别排序",kind:"enum",tab:"display",optional:!0,shows:(e,t)=>t.axis==="category",options:[["value","按数值从大到小"],["category","按类别自身(例如年份)"]]},{key:"orientation",label:"柱子方向",kind:"enum",tab:"display",optional:!0,shows:(e,t)=>t.axis==="category"&&!t.series?.some(n=>n.chart!=="bar"),options:[["auto","自动:类别名较长时横向"],["vertical","竖向柱"],["horizontal","横向条形"]]},{key:"limit",label:"最多显示类别数",kind:"number",tab:"display",optional:!0,shows:(e,t)=>t.axis==="category",min:2,max:50},{key:"segmentBy",label:"按属性拆分系列",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!za(t)||t.segmentBy!==void 0},{key:"grain",label:"统计粒度",shows:(e,t)=>t.axis!=="category"&&!za(t),kind:"enum",tab:"display",optional:!0,options:[["day","日"],["week","周"],["month","月"],["quarter","季度"]]},{key:"months",label:"显示周期数(横轴为时间时必填)",shows:(e,t)=>t.axis!=="category",kind:"number",tab:"display",optional:!0,min:3,max:36},{key:"series",label:"系列",kind:"list",tab:"data",min:1,max:4,item:[{key:"label",label:"名称",kind:"text"},Io("chart"),{key:"dateField",label:"日期属性",shows:(e,t)=>t.axis!=="category"&&!Se(e),kind:"field",of:"date",optional:!0},{key:"aggregate",label:"聚合",kind:"enum",options:dr,shows:e=>!Se(e),notNeeded:Se},{..._e,shows:e=>!Se(e)&&_e.shows(e),neededAs:e=>Se(e)?void 0:_e.neededAs(e)},{key:"chart",label:"图形",kind:"enum",options:[["bar","柱"],["line","线"],["pie","饼(仅限单系列且横轴为类别时可用)"]]}]},Q("writes","点击写入",["dateRange","value"],"点击周期(或类别)时,将其写入 {var}"),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes",e.axis==="category"?e.category:e.series?.[0]?.dateField),check:(e,t,n)=>{const o=[],s=e.axis==="category",r=e.series??[];s&&!e.category&&o.push(`${n}.category 横轴为类别时必填`),!s&&e.months===void 0&&o.push(`${n}.months 横轴为时间时必填`),!s&&r.some(c=>!c.dateField&&c.metric===void 0)&&o.push(`${n}.series 横轴为时间时每个系列要有 dateField`);const a=r.filter(c=>c.metric!==void 0);a.length>0&&a.length<r.length&&o.push(`${n}.series 一张图的系列要么都用页面内统计,要么都用对象指标`),a.length>0&&e.segmentBy!==void 0&&o.push(`${n}.segmentBy 用对象指标的图表不能按另一个属性拆分系列`),s||new Set(a.flatMap(i=>Ia(t.kn,lr(i.metric))?.grain??[])).size>1&&o.push(`${n}.series 各对象指标的时间粒度须相同`),r.some(c=>c.chart==="pie")&&(!s||r.length!==1)&&o.push(`${n}.series 饼图只能用于横轴为类别、只有一个系列的图表`),e.orientation==="horizontal"&&!s&&o.push(`${n}.orientation 只有横轴为类别时才能横向`),e.orientation==="horizontal"&&r.some(c=>c.chart!=="bar")&&o.push(`${n}.orientation 只有全部系列都是柱时才能横向`);const l=Do(t.spec,e.writes);return l==="value"&&!s&&o.push(`${n}.writes 横轴为时间时只能写入日期区间筛选`),l==="dateRange"&&s&&o.push(`${n}.writes 横轴为类别时只能写入取值筛选`),o},defaults:(e,t,n)=>{const o=ee(e,n),s=o?Mo(o,t,"date"):void 0;return{source:o?.id,months:8,series:[{label:"数量",dateField:s,aggregate:"count",chart:"bar"}],writes:je(e,"dateRange")}}},regionMap:{label:"地图",summary:"按地区着色的地图,可绘制关联对象之间的连线;点击地区可筛选页面。",category:"chart",description:"按地区着色的地图:底图为中国(按省份,省份可从客户名称这类含地名的文字里推断)或世界(按国家,认中英文国名、常见别称和 ISO 代码),地区从一个文本字段里识别;只在数据里确实有地名时才用;可标出满足条件的对象所在地区;可加关系连线:选知识网络里与数据源对象类直接相连的一条关系,连到另一类对象,从它的位置属性识别地区,画出它到对象所在地区的连线(网络里没有直接关系的两类对象不能连线,不能沿多条关系拼出连线);点地区时,把该地区对应的字段值写入一个取值筛选",descriptors:[J(),ae,{key:"basemap",label:"底图",kind:"enum",tab:"data",optional:!0,options:[["china","中国(按省份)"],["world","世界(按国家)"]]},{key:"regionField",label:"地区字段(地名,或含地名的文本)",kind:"field",tab:"data",of:"text"},{key:"aggregate",label:"度量",kind:"enum",tab:"data",options:dr},{..._e,tab:"data"},{key:"highlight",label:"标注(存在满足条件对象的省份以红色描边)",kind:"conditions",tab:"display",optional:!0},{key:"links",label:"关系连线",kind:"list",tab:"data",min:0,max:2,optional:!0,item:[{key:"label",label:"名称",kind:"text"},{key:"objectType",label:"连到的对象类",kind:"objectType"},{key:"path",label:"关系(直接相连的一条)",kind:"relationPath",single:!0},{key:"locationField",label:"位置属性(用于识别省份)",kind:"field",owner:"objectType",of:"text"}]},Q("writes","点击省份写入",["value"],"点击省份时,将该省对应的取值写入 {var}"),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes",e.regionField),defaults:(e,t,n)=>{const o=ee(e,n,l=>!!Ua(l)),s=o&&Ua(o),r=s?.name??(o&&Tf(o,t)),a=s?.kind==="region"?s.scope:r&&zc.test(r)?"world":void 0;return{title:"地区分布",source:o?.id,...a==="world"?{basemap:a}:{},regionField:r,aggregate:"count",writes:r?vn(e,r):void 0}}},ganttChart:{label:"甘特图",summary:"按开始和结束日期绘制条形,查看计划与进度。",category:"chart",description:"按分组属性排成行、按开始和结束日期画条,显示基准日期前后的一段时间(默认多看之前,lookAhead 调大可多看之后,适合排计划);状态字段有色调时按色调着色",descriptors:[J(),ae,{key:"groupField",label:"行(分组属性)",kind:"field",tab:"data"},{key:"labelField",label:"条形名称",kind:"field",tab:"data"},{key:"startField",label:"开始日期",kind:"field",tab:"data",of:"date"},{key:"endField",label:"结束日期",kind:"field",tab:"data",of:"date"},{key:"statusField",label:"状态属性",kind:"field",tab:"data",optional:!0},{key:"windowDays",label:"显示天数",kind:"number",tab:"display",min:14,max:365},{key:"lookAhead",label:"基准日期之后的占比(%,规划计划时调大)",kind:"number",tab:"display",min:0,max:100,optional:!0},{key:"maxRows",label:"最多行数",kind:"number",tab:"display",min:3,max:40},ve],follows:!0,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n),s=o?pe(o,t.kn).filter(r=>r.type==="date"):[];return{source:o?.id,groupField:o?.key,labelField:o&&No(o,t.kn),startField:s[0]?.name,endField:s[1]?.name??s[0]?.name,windowDays:60,maxRows:12}}},scheduleGantt:{label:"调度甘特",summary:"资源排成行、时间横向展开,查看各资源上的任务、停机窗口和关键时点。",category:"chart",description:"按资源排成行(可按上级资源折叠、按属性分组),时间轴以基准日期为中心;每个图层是一类对象:标准图层画任务条(同一资源上重叠的任务分轨显示),背景图层画停机等时段,事件图层画到货等时点(可全局显示)。悬停看起止和属性,在情景中被改动或联动的任务显示原值、原因和改动前位置;点击任务或资源写入选中变量,供对象详情和关联表显示;不满足页面筛选的任务淡化显示;缺资源或缺时间的任务列在底部待排区。标准图层配了调整操作时,可拖动任务改资源和时间、拖动右边缘改结束,改动记入当前方案(没有打开的方案时新建一个),在方案栏的改动清单里查看和移除。数据本身只在采用方案时改。标准图层可配目标完成、最早开始(或所需资源的就绪日)、前序关系和已完成条件:未就绪、前序未完是硬约束,晚于目标只标出不阻止采用;配了目标与前序时算出余量,余量不大于 0 的任务属于关键链并描边,悬停任务显示整条依赖链。工具栏的状态摘要按约束计数,点击筛选。资源可设并行上限(默认 1),任务占用资源的图层按上限判断超限,每行底部显示负荷、超出上限标红;上级资源不可排程的时段对下级同样生效;折叠的上级显示下级任务的汇总条和有问题的任务数。标准图层可配规则工具(ruleTools,执行工厂的工具)判断行业规则:工具收到 { tasks: [{ key, start, end, resource, values }], scenario: { edits } },返回 { results: [{ key, pass, severity?, text, related? }] };不通过的任务与内置约束一起标出、计数、筛选,硬约束阻止采用方案,软约束只标出;工具失败或超时,任务显示未能校验,按硬约束处理。timeZoneVariable 是取值筛选,取值须为 IANA 时区名(如 Asia/Shanghai),没有取值时用 timeZone",descriptors:[J(),{key:"source",label:"资源来源(每个对象一行)",hint:"不选时,按任务的所属资源取值自动成行。",kind:"source",tab:"data",optional:!0},{key:"titleField",label:"资源名称",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!!t.source},{key:"subtitleField",label:"资源副标题",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!!t.source},{key:"parentField",label:"上级资源(取值为上级资源的标识)",hint:"有上级时,资源按上级折叠展开,如工厂下的产线。",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!!t.source},{key:"capacityField",label:"并行上限(同一时间最多承接的任务数)",hint:"不选或没有取值时为 1。图层打开“任务占用资源”后,同一时间的任务数超过上限会标为硬约束,并按上限算负荷。上级资源不可排程的时段,对其下级同样生效。",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!!t.source,of:"number"},{key:"groupField",label:"按属性分组",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!!t.source},{key:"layers",label:"图层",kind:"list",tab:"data",min:0,max:dh,item:[{key:"label",label:"名称",kind:"text"},{key:"style",label:"样式",kind:"enum",options:[["standard","任务条"],["background","背景时段(如停机窗口)"],["event","事件时点(如到货)"]]},{key:"source",label:"对象来源",kind:"source"},{key:"global",label:"在所有资源上显示",kind:"bool",optional:!0,shows:e=>e.style==="event"},{key:"resourceField",label:"所属资源",hint:"任务排在哪个资源行上:选任务里记着资源的那一项。资源来源与图层是同一类对象时,选「对象本身」,每个对象一行。",kind:"field",objectKey:!0,optional:!0,shows:e=>!(e.style==="event"&&e.global===!0)},{key:"startField",label:"开始",kind:"field",of:"date"},{key:"endField",label:"结束",kind:"field",of:"date",optional:!0,shows:e=>e.style!=="event"},{key:"barFields",label:"条上显示的属性(第一个作为名称)",kind:"fields",optional:!0},{key:"popoverFields",label:"悬浮卡显示的属性",kind:"fields",optional:!0,shows:e=>e.style!=="background"},{key:"color",label:"颜色",kind:"enum",optional:!0,options:[["static","固定颜色"],["field","按属性取值分色"],["format","按属性的条件颜色"]]},{key:"tone",label:"固定颜色",kind:"enum",options:Ma,optional:!0,shows:e=>e.color===void 0||e.color==="static"},{key:"colorField",label:"着色属性",hint:"按条件颜色时,读数据源里为该属性设置的条件颜色。",kind:"field",optional:!0,shows:e=>e.color==="field"||e.color==="format"},{key:"exclusive",label:"任务占用资源",hint:"打开后,同一资源同一时间的任务数超过它的并行上限(默认 1)会标为硬约束,方案超限时不能采用;每行底部显示负荷。适合设备、产线、人员这类按时间占用的资源;以物料等为行时保持关闭。",kind:"bool",optional:!0,shows:e=>e.style==="standard"},{key:"blocks",label:"该时段不可排程",kind:"bool",optional:!0,shows:e=>e.style==="background"},{key:"selection",label:"点击写入",kind:"variable",accepts:["selection"],sentence:"点击该图层的对象时,选中它(写入 {var}),对象详情和关联表将显示它",optional:!0,shows:e=>e.style!=="background"},{key:"adjust",label:"拖动时记入的调整操作",hint:"拖动任务或它的右边缘时,用这个情景操作在方案里记一条改动;不选则只能查看。操作须用时间参数设置开始和结束,也可设置所属资源以便换行。",kind:"operation",optional:!0,fits:(e,t)=>tp(e,t),shows:e=>e.style==="standard"},{key:"create",label:"从待排区新建",hint:"计划这类为其他对象新建的记录:还没有有效记录的对象(如需求)列在待排区,拖到资源行上时用这个操作在方案里新建一条,采用时执行它的新建行动。操作须设置开始、结束和所属资源;按行动的查重属性判断对象是否已有记录。",kind:"list",min:0,max:1,optional:!0,shows:e=>e.style==="standard",item:[{key:"source",label:"待排对象",kind:"source"},{key:"operation",label:"新建操作",kind:"operation"},{key:"days",label:"默认时长(天)",kind:"number",min:0,max:365,optional:!0},{key:"daysField",label:"时长取自(天)",kind:"field",of:"number",optional:!0},{key:"fields",label:"待排卡片显示的属性",hint:"如预测单号、交货日期,帮助认出是哪条需求。",kind:"fields",optional:!0}]},{key:"snap",label:"拖动吸附到",hint:"不选时按小时取整;操作的时间参数是日期时按天取整。",kind:"enum",optional:!0,options:[["minute","分钟"],["hour","小时"],["day","天"]],shows:e=>e.style==="standard"&&!!e.adjust},{key:"targetField",label:"目标完成",hint:"任务应在这天之前完成,如工单的交期。完成晚于目标的任务标出晚了多久、计入状态摘要,但不阻止采用方案。",kind:"field",of:"date",optional:!0,shows:e=>e.style==="standard"},{key:"targetFrom",label:"或:目标完成取自关联对象",hint:"如生产计划 → 需求预测单的交货日期;关联到多个时取最早的。",kind:"list",min:0,max:1,optional:!0,item:Da("需求对象类","目标日期"),shows:e=>e.style==="standard"},{key:"earliestField",label:"最早开始",hint:"早于这天开始的任务标为未就绪,属于硬约束。",kind:"field",of:"date",optional:!0,shows:e=>e.style==="standard"},{key:"readyFrom",label:"或:所需资源及其就绪日",hint:"如工单 → 所需备件的就绪日。任务要等所需资源都就绪才能开始:取最晚的就绪日,并点名这个关键资源。",kind:"list",min:0,max:1,optional:!0,item:Da("资源对象类","就绪日"),shows:e=>e.style==="standard"},{key:"predecessorPath",label:"前序关系",hint:"同一图层任务之间的关系。开始早于前序完成的任务标为前序未完,属于硬约束;配了目标完成时,沿前后序算出每项任务的余量,余量不大于 0 的任务属于关键链。",kind:"relationPath",single:!0,optional:!0,shows:e=>e.style==="standard"},{key:"predecessorReaches",label:"沿前序关系到达的是",kind:"enum",optional:!0,options:[["predecessors","前序任务"],["successors","后序任务"]],shows:e=>e.style==="standard"&&Array.isArray(e.predecessorPath)&&e.predecessorPath.length>0},{key:"doneWhen",label:"已完成条件(须全部满足)",hint:"满足的任务不参与约束和余量,如状态为已完工。",kind:"conditions",optional:!0,shows:e=>e.style==="standard"},{key:"ruleTools",label:"规则工具",hint:"行业规则(资质、温控、法规时段、换型时间等)由执行工厂的工具判断,结果与内置约束一起标出、计数和筛选。",kind:"list",min:0,max:uh,optional:!0,shows:e=>e.style==="standard",item:[{key:"name",label:"名称",kind:"text"},{key:"tool",label:"工具",kind:"tool",contract:"scheduleRule"},{key:"severity",label:"不通过时默认",hint:"工具的回答里写了严重程度时,以回答为准。",kind:"enum",optional:!0,options:[["hard","硬约束:方案不能采用"],["soft","软约束:只标出"]]}]},{key:"filters",label:"跟随的筛选",kind:"bindings",optional:!0}]},{key:"daysBefore",label:"基准日期之前显示的天数",kind:"number",tab:"display",min:0,max:365},{key:"daysAfter",label:"基准日期之后显示的天数",kind:"number",tab:"display",min:0,max:365},{key:"tray",label:"待排区",hint:"只看不排的页面可只显示未排数量,不列出可拖动的任务。",kind:"enum",tab:"display",optional:!0,options:[["list","列出待排任务,可点开、可拖到资源上"],["count","只显示未排数量"]]},{key:"tick",label:"时间刻度",kind:"enum",tab:"display",options:[["auto","随缩放自动"],["hour","每小时"],["fourHours","每 4 小时"],["day","每天"],["week","每周"]]},{key:"timeZone",label:"时区",kind:"enum",tab:"display",options:kf},Q("timeZoneVariable","按页面变量取时区",["value"],"按 {var} 选中的时区换算时间,没有选中时用上面的时区"),Q("resourceSelection","点击资源写入",["selection"],"点击资源名称时,选中该资源(写入 {var})")],follows:!1,selectorKeys:[],emits:e=>[...$e(e,"resourceSelection"),...(e.layers??[]).flatMap(t=>typeof t?.selection=="string"&&t.selection!==""?[{key:"layers",variable:t.selection}]:[])],check:(e,t,n)=>(e.layers??[]).flatMap((o,s)=>{if(!o||typeof o!="object")return[];const r=`${n}.layers[${s}]`;return[...o.style!=="event"&&!o.endField?[`${r}.endField 任务条和背景时段要指定结束`]:[],...!o.resourceField&&!(o.style==="event"&&o.global===!0)?[`${r}.resourceField 要指定所属资源,事件时点也可改为在所有资源上显示`]:[],...(o.color==="field"||o.color==="format")&&!o.colorField?[`${r}.colorField 按属性着色要指定着色属性`]:[]]}),review:Pp,defaults:(e,t,n)=>{const o=ee(e,n,c=>!!(ue(e,c.id)&&Mo(c,t,"date"))),s=o?pe(o,t.kn):[],r=s.filter(c=>c.type==="date"),a=o?Sa(s,t.kn.objectTypes[o.objectType]):void 0,l=o&&{label:o.label,style:"standard",source:o.id,resourceField:a?.name,startField:r[0]?.name,endField:r[1]?.name??r[0]?.name,barFields:[No(o,t.kn)],popoverFields:s.filter(c=>c.type!=="date"&&c.name!==a?.name).slice(0,3).map(c=>c.name),color:"static",tone:"info",selection:je(e,"selection",o.id),filters:Kc(e,t.kn,{source:o.id},{follows:!0,selectorKeys:[]})};return{title:"调度甘特",layers:l?[l]:[],daysBefore:7,daysAfter:21,tick:"auto",timeZone:"local"}}},stageChain:{label:"环节链路",summary:"环节链路,查看各环节关联的对象数量。",category:"relation",description:"依次排列的环节,每个环节是一个对象类;有关系路径的环节按跟随的筛选显示关联数量,点环节展开记录",descriptors:[J(),ae,{key:"stages",label:"环节",kind:"list",tab:"data",min:1,max:9,fill:{from:"objectType",item:e=>({objectType:e.name,label:e.label})},item:[{key:"objectType",label:"对象类",kind:"objectType"},{key:"label",label:"名称",kind:"text"},{key:"path",label:"关系路径",kind:"relationPath",optional:!0},{key:"fields",label:"展开显示的属性",kind:"fields",owner:"objectType",optional:!0}]},ve],follows:!0,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n);return{source:o?.id,stages:o?[{label:o.label,objectType:o.objectType,path:[]}]:[]}}},subgraph:{label:"关系子图",summary:"以选中对象为中心,绘制其关联对象。",category:"relation",description:"以选中对象为中心,沿配置的关系路径展开关联对象,画成关系图;layout 为 force 时画成关系网,layered 时从左到右分层(选中对象在最左,每一步关系一列),auto(默认)在各路径首尾相连成一条链(如销售订单 → 产品 → 物料 → 采购订单)时分层,否则画成关系网",descriptors:[J(),ae,{key:"layout",label:"布局",kind:"enum",tab:"display",optional:!0,options:[["auto","自动:路径成一条链时分层"],["force","关系网"],["layered","从左到右分层"]]},{key:"paths",label:"展开路径",kind:"list",tab:"data",min:1,max:6,item:[{key:"label",label:"名称",kind:"text"},{key:"objectType",label:"对象类",kind:"objectType"},{key:"path",label:"关系路径",kind:"relationPath"},{key:"limit",label:"最多节点",kind:"number",min:1,max:50}]},{key:"height",label:"高度(自由网格中随单元格调整)",kind:"number",tab:"display",min:240,max:640},Q("selection","读取",["selection"],"显示 {var} 中选中的对象",{optional:!1,reads:!0})],follows:!1,selectorKeys:[],review:(e,t)=>{const n=typeof e.source=="string"?ue(t.spec,e.source):void 0;return!n?.objectType||t.kn.relations.some(o=>o.source===n.objectType||o.target===n.objectType)?[]:[{key:"noRelations",values:{name:t.kn.objectTypes[n.objectType]?.name??n.objectType}}]},defaults:(e,t,n)=>{const o=ee(e,n),s=t.kn.relations.find(a=>a.source===o?.objectType||a.target===o?.objectType),r=s&&(s.source===o?.objectType?s.target:s.source);return{title:"关系子图",source:o?.id,paths:r?[{label:t.kn.objectTypes[r]?.name??r,objectType:r,path:[s.id],limit:8}]:[],height:320,selection:je(e,"selection",o?.id)}}},scenarioBar:{label:"方案",summary:"切换、新建、保存与采用方案,并排对比各方案与现状的指标;紧凑样式只留一行切换,假设样式在侧栏改方案参数和改动。",category:"scenario",description:"方案推演的入口:选择页面显示哪个方案(或现状),新建、复制、命名保存、作废方案,查看方案的改动清单(可移除),采用方案时逐条执行推演操作关联的行动和模型结果的落地条目;改动由组件点击的“推演”动作或 Agent 建议写入,推演操作在数据源上配置;方案只存在于 Workshop,不写回知识网络。页面有模型结果数据源时显示计算状态和「计算」(算当前方案中待重算的结果);新建菜单可按方案参数的可选值一次建出多个方案。style 为 table(对比表,默认)时,每行一个度量,每列现状或一个方案(最多 4 列),附与现状的差值,点列头切换方案,下方可展开方案之间不同的改动;度量可读模型结果数据源,没算过的列写「待重算」,表上的「计算」依次算各列;跟随页面筛选;需要 source 与 measures。style 为 compact(紧凑)时只有一行:方案下拉、新建与当前方案的操作,适合放在页头。style 为 assumptions(假设)时适合放在侧栏:当前方案的方案参数输入、改动清单和「添加假设」,常与页头的紧凑样式配合",descriptors:[J(),{key:"style",label:"样式",kind:"enum",tab:"display",optional:!0,options:[["table","对比表"],["compact","紧凑(只切换)"],["assumptions","假设(参数与改动)"]]},{...ae,optional:!0},{key:"measures",label:"对比的指标",kind:"list",tab:"data",optional:!0,min:1,max:8,item:[...rt]},ve],follows:!0,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n,s=>!!s.operations?.length);return{title:"方案",style:"table",source:o?.id,measures:[{label:"数量",aggregate:"count"},...o?.progress?.due?[{label:"已超期",aggregate:"count",when:[{field:le.status,op:"eq",value:re.overdue.value}]}]:[]]}}},modelTrial:{label:"模型试算",summary:"对一批对象按几组参数调用模型,比较各组结果的差异;结果不改对象。",category:"scenario",description:"对组件跟随的筛选留下的对象(最多 200 个,例如点指标卡或在表格勾选的一批)调用数据源上登记的模型(sources[].models),每组参数调用一次,2 到 4 组并排比较:汇总度量附与第一组(基准)的差值,明细列出各组结果;选中方案时模型读到的是方案中的值;结果只显示在页面上,不写回知识网络;可按选定一组的结果执行模型配置的行动",descriptors:[J(),ae,ve],follows:!0,selectorKeys:[],defaults:(e,t,n)=>({title:"模型试算",source:ee(e,n,s=>!!s.models?.length)?.id})},alertList:{label:"告警",summary:"按规则列出需关注的对象;点击规则仅查看其命中的对象。",category:"filter",description:"按规则实时列出命中的对象:每条规则是一组条件(如进度状态为 overdue、$overdueDays 大于 90),还可要求沿关系路径查不到记录(如没有任何关联的某类对象);按严重程度排序,点规则把命中的对象写入一个对象集合筛选,展开看具体对象",descriptors:[J(),wt,ae,{key:"rules",label:"规则",kind:"list",tab:"data",min:1,max:8,item:[{key:"label",label:"名称",kind:"text"},{key:"severity",label:"严重程度",kind:"enum",options:vf},{key:"when",label:"条件(须全部满足)",kind:"conditions",optional:!0},{key:"objectType",label:"且无关联记录:关联对象类",kind:"objectType",optional:!0},{key:"path",label:"且无关联记录:关系路径",kind:"relationPath",optional:!0}]},{key:"tagField",label:"命中对象的附加显示字段",kind:"field",tab:"display",optional:!0},{key:"limit",label:"展开显示条数",kind:"number",tab:"display",min:3,max:20},Q("writes","点击规则写入",["set"],"点击规则时,将其命中的对象写入 {var}"),Q("selection","点击对象写入",["selection"],"点击展开列表中的对象时,选中该对象(写入 {var})"),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes"),check:(e,t,n)=>(e.rules??[]).flatMap((o,s)=>{const r=`${n}.rules[${s}]`,a=!!o.objectType||!!o.path?.length;return a&&(!o.objectType||!o.path?.length)?[`${r} 查不到关联记录的条件需要同时给关联对象类 objectType 和关系路径 path`]:!a&&!o.when?.length?[`${r} 至少要有一个条件`]:[]}),defaults:(e,t,n)=>{const o=ee(e,n,a=>!!et(a)),s=o&&et(o),r=s?qo(s).filter(a=>a.tone==="danger"):[];return{title:"告警",source:o?.id,rules:s&&r.length>0?r.map(a=>({label:s?_o(s.name,a.value):a.value,severity:"medium",when:[{field:s.name,op:"eq",value:a.value}]})):[{label:"缺少标识",severity:"low",when:[{field:o?.key??"",op:"isEmpty"}]}],tagField:s?.name,limit:8,writes:je(e,"set",o?.id),selection:je(e,"selection",o?.id)}}},eventList:{label:"事件列表",summary:"列出应用的业务事件,支持核实、驳回、关闭;点击事件选中其关联的对象。",category:"display",description:"列出应用里的业务事件(规则命中或用户登记的),未关闭的在前、按严重程度排;待核实的可以核实或驳回,已核实的可以关闭;显示规则的最近与下次检查时间,可以立即检查。事件类型在知识网络里建模,应用在 eventTypes 里按编码选择要处理的。点事件把它关联的对象写入一个选中对象筛选",descriptors:[J(),wt,{key:"types",label:"显示的事件类型(不选则为全部)",kind:"eventType",multiple:!0,tab:"data",optional:!0},{key:"show",label:"默认显示",kind:"enum",options:[["open","未关闭"],["all","全部"]],tab:"display"},{key:"limit",label:"最多显示条数",kind:"number",min:5,max:100,tab:"display"},Q("selection","点击事件选中",["selection"],"点击事件时,选中其关联的对象(写入 {var})")],follows:!1,selectorKeys:[],check:(e,t,n)=>{const o=e.selection,s=t.spec.variables.find(l=>l.name===o);if(!s||!("source"in s))return[];const r=ue(t.spec,s.source)?.objectType,a=e.types;return Mn(t.spec,en(t.kn.eventTypes)).filter(l=>(!a?.length||a.includes(l.id))&&l.objectType).filter(l=>l.objectType!==r).map(l=>`${n}.selection 选中的是另一类对象,事件类型 ${l.id} 关联的对象对不上;换一个筛选,或只显示关联对象相同的事件类型`)},defaults:(e,t)=>{const n=Mn(e,en(t.kn.eventTypes)).find(s=>s.objectType)?.objectType,o=e.variables.find(s=>s.kind==="selection"&&ue(e,s.source)?.objectType===n)?.name;return{title:"事件",show:"open",limit:20,...n&&o?{selection:o}:{}}}},eventReport:{label:"事件登记",summary:"按钮,打开表单登记业务事件;登记后状态为待核实。",category:"display",description:"一个按钮,打开一类用户登记事件(应用处理的、知识网络里来源为用户登记的事件类型)的表单:标题、发生时间、关联对象与表单字段。登记的事件默认待核实,登记人可以勾选一并核实;合并窗口内同一对象再次登记记为重复",descriptors:[{key:"type",label:"事件类型",kind:"eventType",of:"report",tab:"data"},J("按钮文字")],follows:!1,selectorKeys:[],defaults:(e,t)=>{const n=Mn(e,en(t.kn.eventTypes)).find(o=>o.source==="report");return n?{type:n.id}:{}}},taskInbox:{label:"任务收件箱",summary:"由事件归并生成的任务:认领后查看事件、撰写分析、进行处理,事件均有结果时任务关闭。",category:"display",description:"列出事件归并成的任务(按事件类型的归并方式:一个事件一个任务、按关联对象的属性、或按检查批次),未关闭的在前,显示事件数、未处理数、认领人与剩余时限;打开一个任务看事件、分析与处理三栏:认领、添加分析(可多条)、勾选事件新建处理(可多条,处理之间不共用事件)、判定无需处理或移出、手工结束",descriptors:[J(),{key:"types",label:"任务所属事件类型(不选则为全部)",kind:"eventType",multiple:!0,tab:"data",optional:!0},{key:"show",label:"默认显示",kind:"enum",options:[["open","未关闭"],["all","全部"]],tab:"display"},{key:"limit",label:"最多显示条数",kind:"number",min:5,max:100,tab:"display"}],follows:!1,selectorKeys:[],defaults:()=>({title:"任务",show:"open",limit:20})},actionButton:{label:"按钮",summary:"按钮:向 Agent 提问,或对选中、勾选的对象执行行动,执行前需确认。",category:"ai",description:"一个按钮,点了按顺序做 interactions 里的动作:问 Agent(可带上当前筛选),或对选中的对象(selection 筛选)、一组对象(set 筛选,例如表格勾选的行)执行知识网络里的行动;行动执行前总会打开执行确认,列出对象、填写参数、检查执行权限,确认后逐个对象以用户身份执行;行动的对象为空时按钮不可点",descriptors:[J(),ae,{key:"interactions",label:"按钮动作",kind:"interactions",on:["button"],actOn:["button"],hit:!1,max:1,tab:"data"}],follows:!1,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n,c=>!c.cypher&&!c.events),s=o&&t.kn.actionTypes?.find(c=>c.objectType===o.objectType),r=o&&je(e,"selection",o.id),a=o&&je(e,"set",o.id),l=r?{selection:r}:a?{set:a}:void 0;return{title:s?.name??"按钮",source:o?.id,interactions:[{on:"button",...s?{label:s.name}:{},do:s&&l?[{kind:"act",action:s.id,targets:l,params:Object.fromEntries(s.inputs.map(c=>[c.name,{from:"input"}]))}]:[{kind:"ask",question:"总结一下当前页面上需要关注的情况,并给出依据。",context:["filters"],send:"auto"}]}]}}},agentChat:{label:"Agent 对话",summary:"围绕页面数据提问,也可由 Agent 代为筛选页面。",category:"ai",description:"围绕页面数据回答问题:能查页面上的全部数据源和整个知识网络,读当前筛选和选中对象,允许时还能替用户调整全页筛选",descriptors:[J(),{key:"provider",label:"由谁回答",kind:"enum",tab:"data",options:Sf},{key:"agent",label:"外部 Agent",hint:"选择 MCP 服务和其中回答问题的工具(通常名为 ask);使用者须有该服务的执行权限。",kind:"mcpTool",tab:"data",optional:!0,shows:e=>e.provider==="mcp"},{key:"allowAgentSwitch",label:"允许使用者切换智能体",hint:"MCP 服务需提供 list_agents 和接受 agent_id 的 ask 工具。切换时开始新对话。列出哪些智能体由服务决定,list_agents 声明了 app_id、bkn_token 时照样传给它。",kind:"bool",tab:"data",optional:!0,shows:e=>e.provider==="mcp"},{key:"passToken",label:"交出使用者的登录令牌",hint:"打开后,工具声明了 bkn_token 时,把使用者本人的访问令牌交给这个 Agent。Agent 凭它能做使用者能做的一切,包括执行行动和办理审批;只对可信的 Agent 打开。默认不交。",kind:"bool",tab:"data",optional:!0,shows:e=>e.provider==="mcp"},{key:"instructions",label:"补充说明",kind:"text",tab:"data",optional:!0,multiline:!0,max:600},{key:"mode",label:"显示方式",kind:"enum",tab:"display",optional:!0,options:[["float","右下角按钮,点开对话"],["side","右侧栏"],["inline","放在页面里"]]},{key:"height",shows:e=>(e.mode??"inline")==="inline",label:"高度(自由网格中随单元格调整)",kind:"number",tab:"display",min:280,max:800},{key:"suggestions",label:"建议问题",kind:"list",tab:"display",min:0,max:6,optional:!0,item:[{key:"text",label:"问题",kind:"text"}]},Q("selection","当前对象",["selection"],"回答时以 {var} 中选中的对象作为当前对象",{reads:!0}),{key:"canFilter",label:"允许 Agent 设置筛选和选中对象(例如“仅看超期”)",kind:"bool",tab:"link"},{key:"actions",label:"允许 Agent 建议的行动",hint:"Agent 只生成建议卡,由用户确认后执行;目前仅前端 Agent 支持。",kind:"actionTypes",tab:"data",optional:!0}],follows:!1,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n);return{title:"Agent 对话",provider:"frontend",mode:"float",height:420,suggestions:o?[{text:`${o.label}里现在最需要关注的是哪些?`},{text:`这一页的${o.label}有什么异常或趋势?`}]:[],selection:je(e,"selection",o?.id),canFilter:!0}}}};function jf(e){return Ve.filter(t=>!Nr.has(t)&&(e||ze[t].category!=="scenario"))}const dt={label:"对象详情",summary:"选中对象后打开,显示其属性、进度和关联记录。",category:"relation",description:"抽屉里显示选中对象的进度、属性,以及沿关系路径关联的记录。进度条按数据源的进度(progress)画:每一步是否完成,截止日期按期还是超期",descriptors:[J(),ae,{key:"showProgress",label:"显示进度条(需先在数据源中设置进度)",kind:"bool",tab:"data",optional:!0},{key:"fields",label:"属性",kind:"fields",tab:"data"},{key:"related",label:"关联区块",kind:"list",tab:"data",min:0,max:4,optional:!0,item:[{key:"label",label:"名称",kind:"text"},{key:"objectType",label:"对象类",kind:"objectType"},{key:"path",label:"关系路径",kind:"relationPath"},{key:"fields",label:"属性",kind:"fields",owner:"objectType"},{key:"limit",label:"最多行数",kind:"number",min:1,max:20}]},Q("selection","读取",["selection"],"显示 {var} 中选中的对象",{optional:!1,reads:!0})],follows:!1,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n);return{source:o?.id,...o?.progress?{showProgress:!0}:{},fields:o?pe(o,t.kn).slice(0,8).map(s=>s.name):[],selection:je(e,"selection",o?.id)}}};function ht(e){return e===me?dt:Rt(e)?cf(e):ze[e]}function ee(e,t,n=()=>!0){const o=e.sources.find(s=>s.id===t)??e.sources.find(n)??e.sources[0];return o&&(ue(e,o.id)??o)}function je(e,t,n){return e.variables.find(o=>o.kind===t&&(!n||!("source"in o)||o.source===n))?.name}function Mo(e,t,n){return pe(e,t.kn).find(o=>o.type===n)?.name}function Af(e){return e==="date"?"date":e==="number"?"number":"text"}function Ba(e){return{field:e.name,label:e.label,format:e.name===le.status?"tag":e.type?Af(e.type):"text"}}function et(e){if(e.progress)return{name:le.status,outcomes:jc};const t=e.computed?.find(n=>n.kind==="classify");return t&&{name:t.name,outcomes:[...t.cases,t.otherwise]}}function Ua(e){return e.computed?.find(t=>t.kind==="region")}const zc=/country|nation|国家|国籍/i;function Tf(e,t){const n=/country|nation|region|province|state|city|site|location|address|国家|国籍|地区|省|城市|地址|所在地|产地|区域/i,o=pe(e,t.kn).filter(r=>r.type==="text"),s=r=>o.find(a=>r.test(a.name)||r.test(a.label))?.name;return s(zc)??s(n)}function qo(e){return e.outcomes}function Fo(e,t){return pe(e,t.kn).filter(n=>n.type==="text").map(n=>n.name)}function za(e){return Array.isArray(e.series)&&e.series.some(t=>Se(t))}function Wa(e){return(e?.filter(t=>t.metric===void 0)??[]).flatMap(t=>{const n=Ec(t.when);return n?[n.field]:[]})}function Do(e,t){return e?.variables.find(n=>n.name===t)?.kind}function Of(e){return(e.columns??[]).filter(t=>t.format==="text"||t.format==="tag").map(t=>t.field).filter(t=>typeof t=="string")}function Ef(e){return[...Object.values(e.regions).flatMap(t=>t??[]),...e.detail?[e.detail]:[]]}function Wc(e){const t=new Map;for(const n of Ef(e)){const o=ht(n.type).emits?.(n.config,e)??[];for(const s of o){const r=t.get(s.variable)??[];r.push({...s,placement:n.id,source:typeof n.config.source=="string"?n.config.source:void 0}),t.set(s.variable,r)}}return t}function vn(e,t){const n=Wc(e);return e.variables.find(o=>o.kind==="value"&&((n.get(o.name)??[]).some(s=>s.field===t)||o.name===t))?.name}function Kc(e,t,n,o){const s=ue(e,n.source);if(!o.follows||!s)return[];const r=new Set(o.selectorKeys.map(h=>n[h])),a=pe(s,t),l=(h,u)=>a.some(p=>p.name===h&&(!u||p.type===u)),c=Wc(e),i=h=>e.sources.find(u=>u.id===h)?.objectType,d=[];for(const h of e.variables){if(r.has(h.name))continue;const u=c.get(h.name)??[],p=u.filter(f=>i(f.source)===s.objectType);switch(h.kind){case"value":{const f=p.map(m=>m.field).find(m=>l(m))??(u.length===0&&l(h.name)?h.name:void 0);f&&d.push({variable:h.name,field:f});break}case"dateRange":{const f=p.map(m=>m.field).find(m=>l(m,"date"));f&&d.push({variable:h.name,field:f});break}case"search":{const f=[...new Set(p.flatMap(m=>m.fields??[]))].filter(m=>l(m,"text"));f.length>0&&d.push({variable:h.name,fields:f});break}case"set":i(h.source)===s.objectType&&d.push({variable:h.name});break}}return d}for(const e of Object.values(ze)){if(!e.follows)continue;const t=e.defaults;e.defaults=(n,o,s)=>{const r=t(n,o,s);return{...r,filters:Kc(n,o.kn,r,e)}}}for(const[e,t]of Object.entries(bp)){const n=e===me?dt:ze[e];n.descriptors=[...n.descriptors,{key:"interactions",label:"点击后的动作",kind:"interactions",on:t,actOn:wp[e]??[],hit:!0,max:jp,...Ra[e]?{offers:Ra[e]}:{},tab:"link",optional:!0}]}function Cf(e,t){return new Set([t,...e.sources.filter(n=>n.from?.source===t).map(n=>n.id)])}function Yc(e,t,n,o){if(o.size===0)return e;const s=structuredClone(e),r=d=>typeof d=="string"?o.get(d)??d:d,a=(d,h)=>{if(Array.isArray(d))return d.forEach(f=>a(f,h));if(typeof d!="object"||d===null)return;const u=d,p=typeof u.field=="string"?u.field:h;p===n&&(Array.isArray(u.values)&&(u.values=u.values.map(r)),"op"in u&&u.ref===void 0&&(u.value=r(u.value)));for(const[f,m]of Object.entries(u))f!=="values"&&a(m,p)},l=new Set,c=Cf(s,t);for(const d of s.pages)for(const h of[...Object.values(d.regions).flatMap(u=>u??[]),...d.detail?[d.detail]:[]])if(c.has(h.config.source)){a(h.config);for(const u of h.config.filters??[])u?.field===n&&l.add(u.variable)}for(const d of s.sources)d.from?.source===t&&a(d.from.where);s.variables=s.variables.map(d=>d.kind==="value"&&l.has(d.name)&&d.default!==void 0?{...d,default:r(d.default)}:d);const i=s.sources.find(d=>d.id===t);for(const d of i?.operations??[])a(d.when);for(const d of i?.computed??[])d.name!==n&&(d.kind==="classify"&&d.cases.forEach(h=>a(h.when)),d.kind==="days"&&a(d.when));i?.progress?.steps.forEach(d=>a(d.done));for(const d of Object.values(i?.formats??{}))d.colors?.forEach(h=>a(h.when));for(const d of i?.models??[])d.measures.forEach(h=>a(h.when));return s}const X=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Nf(e){if(e.ask===void 0&&e.act===void 0)return;const t=Array.isArray(e.interactions)?e.interactions:[],n=X(e.ask)?[Ap(e.ask)]:[],o=Array.isArray(e.act)?e.act.map(Tp):[],s=[...t,...n,...o];s.length>0&&(e.interactions=s),delete e.ask,delete e.act}function xf(e,t,n){const o=n.find(l=>l.id===t.source),s=X(o?.from)?o.from:void 0,r=s?n.find(l=>l.id===s.source):o,a=Array.isArray(t.adjustments)?t.adjustments:[];if(r){const l=Array.isArray(r.operations)?r.operations:[],c=new Set(l.map(i=>String(i.id)));for(const i of a){if(typeof i.field!="string")continue;let d=`shift_${i.field}`.replace(/[^A-Za-z0-9_]/g,"_");for(let h=2;c.has(d);h++)d=`shift_${i.field}_${h}`.replace(/[^A-Za-z0-9_]/g,"_");c.add(d),l.push({id:d,label:String(i.label??i.field).slice(0,30),...Array.isArray(i.when)&&i.when.length>0?{when:i.when}:{},params:[{name:"days",label:"天数",type:"number",...typeof i.min=="number"?{min:i.min}:{},...typeof i.max=="number"?{max:i.max}:{}}],effects:[{field:i.field,kind:"shiftDays",param:"days"}]})}l.length>0&&(r.operations=l)}e.type="scenarioBar",e.config={title:typeof t.title=="string"?t.title:"方案",style:"compact"}}function Rf(e){const n=Object.values(e).filter(r=>Array.isArray(r)).flat(),o=r=>{const a=X(r.config)?r.config:{};return r.type==="scenarioBar"&&a.style===void 0&&(a.layout!==void 0||a.source===void 0)},s=n.some(r=>r.type==="scenarioCompare");for(const r of n){const a=X(r.config)?r.config:{};r.type==="scenarioCompare"?(r.type="scenarioBar",r.config={...a,style:"table"}):o(r)&&!s&&(delete a.layout,r.config={...a,style:"compact"})}if(s)for(const[r,a]of Object.entries(e))Array.isArray(a)&&(e[r]=a.filter(l=>!o(l)))}const _f=new Set(["status","overdueDays","dueInDays"]);function Pf(e){const[t,n]=e.split("-").map(Number);return new Date(Date.UTC(t,n,0)).toISOString().slice(0,10)}function Lf(e){if(typeof e.appearsOn!="string")return null;const n=(Array.isArray(e.computed)?e.computed:[]).find(c=>c.name==="status"&&c.kind==="classify"),o=Array.isArray(n?.cases)?n.cases:[],s=Array.isArray(o[0]?.when)?o[0].when[0]:void 0,r=Array.isArray(o[1]?.when)?o[1].when[0]:void 0,a=r&&r.op==="before"&&r.ref===he?String(r.field):void 0,l=[{label:"开始",field:e.appearsOn}];return s&&s.op==="onOrBefore"&&s.ref===he?l.push({label:"完成",field:String(s.field)}):s&&s.op==="eq"&&a&&l.push({label:"完成",field:a,done:[{field:String(s.field),op:"eq",value:s.value}]}),{steps:l,...a?{due:{field:a}}:{}}}function Bo(e){if(typeof e.field!="string"||e.when!==void 0)return;const t=Array.isArray(e.values)?e.values:[];t.length>0&&(e.when=[{field:e.field,op:"in",values:t}]),delete e.field,delete e.values}function ur(e){if(Array.isArray(e))return e.forEach(ur);X(e)&&("sumField"in e&&(e.valueField===void 0&&(e.valueField=e.sumField),delete e.sumField),Object.values(e).forEach(ur))}function If(e){const t=new Map,o=(Array.isArray(e.computed)?e.computed:[]).find(a=>a.name==="status"&&a.kind==="classify");if(!o)return t;const s=Array.isArray(o.cases)?o.cases:[],r=[[s[0]?.value,re.done.value],[s[1]?.value,re.overdue.value],[X(o.otherwise)?o.otherwise.value:void 0,re.active.value]];for(const[a,l]of r)typeof a=="string"&&a!==l&&t.set(a,l);return t}function Mf(e,t){for(const n of e){const o=X(n.regions)?n.regions:{};for(const s of Object.values(o))if(Array.isArray(s))for(const r of s){const a=X(r.config)?r.config:{},l=(Array.isArray(a.filters)?a.filters:[]).find(c=>c?.variable===t&&Array.isArray(c.fields));if(l?.fields)return l.fields}}}function qf(e){if(!X(e))return e;let t=e;const n=Array.isArray(e.sources)?e.sources:[],o=Array.isArray(e.variables)?e.variables:[],s=new Map,r=new Set;for(const i of n){if(i.progress!==void 0)continue;const d=Lf(i);if(!d)continue;const h=If(i);if(h.size>0&&s.set(String(i.id),h),i.progress=d,r.add(String(i.id)),delete i.appearsOn,Array.isArray(i.computed)){const u=i.computed.filter(p=>!_f.has(String(p.name)));u.length>0?i.computed=u:delete i.computed}}const a=new Map;for(const i of o)("field"in i||"fields"in i||i.kind==="month")&&(i.kind==="selection"||i.kind==="set"||(a.set(String(i.name),{...i}),i.kind==="month"&&(i.kind="dateRange",typeof i.default=="string"&&/^\d{4}-\d{2}$/.test(i.default)&&(i.default=`${i.default}-01..${Pf(i.default)}`)),delete i.source,delete i.field,delete i.fields));const l=o.filter(i=>i.kind==="set"),c=Array.isArray(e.pages)?e.pages:[];for(const i of c){const d=X(i.regions)?i.regions:{};Rf(d);const h=[...Object.values(d).flatMap(u=>Array.isArray(u)?u:[]),...X(i.detail)?[i.detail]:[]];for(const u of h){const p=u.type,f=X(u.config)?u.config:null;if(!f)continue;if(p==="whatIf"){xf(u,f,n);continue}if(ur(f),Nf(f),p==="metricCards"&&Array.isArray(f.items)&&f.items.forEach(b=>X(b)&&Bo(b)),p==="pivotTable"&&Array.isArray(f.measures)&&f.measures.forEach(b=>X(b)&&Bo(b)),p==="objectList"&&Bo(f),p==="regionMap"&&Array.isArray(f.links)){const b=f.links.filter(k=>Array.isArray(k?.path)&&k.path.length===1);b.length>0?f.links=b:delete f.links}if(p===me&&Array.isArray(f.progress)&&(f.progress.length>0&&(f.showProgress=!0),delete f.progress),!Ve.includes(p))continue;const m=ht(p);if(p==="searchBox"&&typeof f.writes=="string"&&!f.fields){const b=a.get(f.writes)?.fields??Mf(c,f.writes);Array.isArray(b)&&b.length>0&&(f.fields=b)}if(p==="objectTable"&&typeof f.quickFilter=="string"&&!f.quickField){const b=a.get(f.quickFilter);typeof b?.field=="string"&&(f.quickField=b.field)}if(!m.follows||f.filters!==void 0||typeof f.source!="string")continue;const g=new Set(m.selectorKeys.map(b=>f[b])),y=[];for(const[b,k]of a)g.has(b)||k.source!==f.source||(Array.isArray(k.fields)?y.push({variable:b,fields:k.fields}):typeof k.field=="string"&&y.push({variable:b,field:k.field}));for(const b of l)!g.has(b.name)&&b.source===f.source&&y.push({variable:String(b.name)});f.filters=y}}for(const[i,d]of s)t=Yc(t,i,"status",d);return r.size>0&&(t=Kf(t,r)),Uf(t),Ff(t),t}function Ff(e){const t=Array.isArray(e.eventTypes)?e.eventTypes:[];for(const n of t)if(X(n)){for(const o of["label","source","subject","severity","rule"])delete n[o];X(n.report)&&delete n.report.mergeHours}}const Df=/^[a-z0-9][a-z0-9_.-]{0,63}$/;function Bf(e,t){const n=e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase().replace(/[^a-z0-9_.-]/g,"_").replace(/^[^a-z0-9]+/,"").slice(0,64)||"event";let o=n;for(let s=2;t.has(o);s+=1)o=`${n.slice(0,64-String(s).length)}${s}`;return o}function Uf(e){const t=Array.isArray(e.eventTypes)?e.eventTypes:[],n=new Set(t.map(r=>String(r.id))),o=new Map;for(const r of t){const a=r.id;if(typeof a!="string"||Df.test(a))continue;n.delete(a);const l=Bf(a,n);n.add(l),o.set(a,l),r.id=l}if(o.size===0)return;const s=r=>typeof r=="string"?o.get(r)??r:r;for(const r of Array.isArray(e.sources)?e.sources:[]){const a=X(r.events)?r.events:void 0;Array.isArray(a?.types)&&(a.types=a.types.map(s))}for(const r of Array.isArray(e.pages)?e.pages:[]){const l=[...(X(r.regions)?Object.values(r.regions):[]).flatMap(c=>Array.isArray(c)?c:[]),...X(r.detail)?[r.detail]:[]];for(const c of l){if(!Ve.includes(c.type)||!X(c.config))continue;const i=c.config;for(const d of ht(c.type).descriptors){if(d.kind!=="eventType"||i[d.key]===void 0)continue;const h=i[d.key];i[d.key]=Array.isArray(h)?h.map(s):s(h)}}}}const zf=new Map([["status",le.status],["stage",le.stage],["overdueDays",le.overdueDays],["dueInDays",le.dueInDays]]),Wf=new Map(Object.values(re).map(e=>[e.label,e.value]));function Gc(e,t,n){const o=s=>typeof s=="string"?n(s):s;for(const s of e){const r=t[s.key],a=!("owner"in s)||s.owner!=="objectType";if(s.kind==="field"&&a)t[s.key]=o(r);else if(s.kind==="fields"&&a&&Array.isArray(r))t[s.key]=r.map(o);else if(s.kind==="conditions"&&Array.isArray(r))for(const l of r)X(l)&&(l.field=o(l.field),l.ref!==void 0&&(l.ref=o(l.ref)));else if(s.kind==="bindings"&&Array.isArray(r))for(const l of r)X(l)&&(l.field!==void 0&&(l.field=o(l.field)),Array.isArray(l.fields)&&(l.fields=l.fields.map(o)));else if(s.kind==="list"&&Array.isArray(r))for(const l of r)X(l)&&Gc(s.item,l,n)}}function Kf(e,t){let n=structuredClone(e);const o=r=>zf.get(r)??r,s=r=>r.replace(/(?<![$\w`])(status|stage|overdueDays|dueInDays)\b/g,a=>o(a));for(const r of n.sources){if(!r.progress||t&&!t.has(r.id))continue;const a=new Set(n.sources.filter(c=>c.id===r.id||c.from?.source===r.id).map(c=>c.id));for(const c of n.pages)for(const i of[...Object.values(c.regions).flatMap(d=>d??[]),...c.detail?[c.detail]:[]])a.has(i.config.source)&&Gc(ht(i.type).descriptors,i.config,o);const l=c=>c?.forEach(i=>{i.field=o(i.field),i.ref!==void 0&&(i.ref=o(i.ref))});r.formats&&(r.formats=Object.fromEntries(Object.entries(r.formats).map(([c,i])=>(i.colors?.forEach(d=>l(d.when)),[o(c),i]))));for(const c of n.sources)if(c.from?.source===r.id){l(c.from.where);for(const i of c.from.filters??[])i.field!==void 0&&(i.field=o(i.field)),i.fields&&(i.fields=i.fields.map(o))}for(const c of r.operations??[])l(c.when);for(const c of r.computed??[])c.kind==="classify"&&c.cases.forEach(i=>l(i.when)),c.kind==="days"&&(c.from=o(c.from),c.to=o(c.to),l(c.when)),c.kind==="formula"&&(c.expr=s(c.expr));n=Yc(n,r.id,le.status,Wf)}return n}const pt="workshop.openbkn.ai/v1",Yf=["tabs","cards","segmented","side"],Gf=["dashboard","table","chart","map","alert","task","calendar","relation","search","agent","team","setting"],Hf=["tasks","alerts"];function tn(e,t){const n=e.pages.find(o=>o.id===t)??e.pages[0];return{version:2,title:n.title,layout:n.layout,sources:e.sources,variables:e.variables,...e.eventTypes?{eventTypes:e.eventTypes}:{},...e.scenarioParams?{scenarioParams:e.scenarioParams}:{},...e.components?{components:e.components}:{},regions:n.regions,detail:n.detail,theme:e.theme,...n.linking?{linking:n.linking}:{},...e.linkPaths?{linkPaths:e.linkPaths}:{}}}function Vf(e){if(typeof e!="object"||e===null)return e;const t=qf(structuredClone(e)),n=t.pages;if(!Array.isArray(n))return t;for(const o of n)for(const s of Object.values(o?.regions??{}))if(Array.isArray(s))for(const r of s)r?.type==="agentChat"&&r.config&&delete r.config.source;return t}var Uo={exports:{}},P={};var Ka;function Jf(){if(Ka)return P;Ka=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),r=Symbol.for("react.consumer"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),i=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),u=Symbol.iterator;function p($){return $===null||typeof $!="object"?null:($=u&&$[u]||$["@@iterator"],typeof $=="function"?$:null)}var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,g={};function y($,T,C){this.props=$,this.context=T,this.refs=g,this.updater=C||f}y.prototype.isReactComponent={},y.prototype.setState=function($,T){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,T,"setState")},y.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function b(){}b.prototype=y.prototype;function k($,T,C){this.props=$,this.context=T,this.refs=g,this.updater=C||f}var w=k.prototype=new b;w.constructor=k,m(w,y.prototype),w.isPureReactComponent=!0;var v=Array.isArray;function S(){}var j={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function A($,T,C){var R=C.ref;return{$$typeof:e,type:$,key:T,ref:R!==void 0?R:null,props:C}}function E($,T){return A($.type,T,$.props)}function x($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function L($){var T={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(C){return T[C]})}var I=/\/+/g;function M($,T){return typeof $=="object"&&$!==null&&$.key!=null?L(""+$.key):T.toString(36)}function ne($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(S,S):($.status="pending",$.then(function(T){$.status==="pending"&&($.status="fulfilled",$.value=T)},function(T){$.status==="pending"&&($.status="rejected",$.reason=T)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function q($,T,C,R,z){var Y=typeof $;(Y==="undefined"||Y==="boolean")&&($=null);var V=!1;if($===null)V=!0;else switch(Y){case"bigint":case"string":case"number":V=!0;break;case"object":switch($.$$typeof){case e:case t:V=!0;break;case d:return V=$._init,q(V($._payload),T,C,R,z)}}if(V)return z=z($),V=R===""?"."+M($,0):R,v(z)?(C="",V!=null&&(C=V.replace(I,"$&/")+"/"),q(z,T,C,"",function(gu){return gu})):z!=null&&(x(z)&&(z=E(z,C+(z.key==null||$&&$.key===z.key?"":(""+z.key).replace(I,"$&/")+"/")+V)),T.push(z)),1;V=0;var qe=R===""?".":R+":";if(v($))for(var ke=0;ke<$.length;ke++)R=$[ke],Y=qe+M(R,ke),V+=q(R,T,C,Y,z);else if(ke=p($),typeof ke=="function")for($=ke.call($),ke=0;!(R=$.next()).done;)R=R.value,Y=qe+M(R,ke++),V+=q(R,T,C,Y,z);else if(Y==="object"){if(typeof $.then=="function")return q(ne($),T,C,R,z);throw T=String($),Error("Objects are not valid as a React child (found: "+(T==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":T)+"). If you meant to render a collection of children, use an array instead.")}return V}function N($,T,C){if($==null)return $;var R=[],z=0;return q($,R,"","",function(Y){return T.call(C,Y,z++)}),R}function Z($){if($._status===-1){var T=$._result;T=T(),T.then(function(C){($._status===0||$._status===-1)&&($._status=1,$._result=C)},function(C){($._status===0||$._status===-1)&&($._status=2,$._result=C)}),$._status===-1&&($._status=0,$._result=T)}if($._status===1)return $._result.default;throw $._result}var U=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var T=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(T))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)},oe={map:N,forEach:function($,T,C){N($,function(){T.apply(this,arguments)},C)},count:function($){var T=0;return N($,function(){T++}),T},toArray:function($){return N($,function(T){return T})||[]},only:function($){if(!x($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return P.Activity=h,P.Children=oe,P.Component=y,P.Fragment=n,P.Profiler=s,P.PureComponent=k,P.StrictMode=o,P.Suspense=c,P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,P.__COMPILER_RUNTIME={__proto__:null,c:function($){return j.H.useMemoCache($)}},P.cache=function($){return function(){return $.apply(null,arguments)}},P.cacheSignal=function(){return null},P.cloneElement=function($,T,C){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var R=m({},$.props),z=$.key;if(T!=null)for(Y in T.key!==void 0&&(z=""+T.key),T)!O.call(T,Y)||Y==="key"||Y==="__self"||Y==="__source"||Y==="ref"&&T.ref===void 0||(R[Y]=T[Y]);var Y=arguments.length-2;if(Y===1)R.children=C;else if(1<Y){for(var V=Array(Y),qe=0;qe<Y;qe++)V[qe]=arguments[qe+2];R.children=V}return A($.type,z,R)},P.createContext=function($){return $={$$typeof:a,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:r,_context:$},$},P.createElement=function($,T,C){var R,z={},Y=null;if(T!=null)for(R in T.key!==void 0&&(Y=""+T.key),T)O.call(T,R)&&R!=="key"&&R!=="__self"&&R!=="__source"&&(z[R]=T[R]);var V=arguments.length-2;if(V===1)z.children=C;else if(1<V){for(var qe=Array(V),ke=0;ke<V;ke++)qe[ke]=arguments[ke+2];z.children=qe}if($&&$.defaultProps)for(R in V=$.defaultProps,V)z[R]===void 0&&(z[R]=V[R]);return A($,Y,z)},P.createRef=function(){return{current:null}},P.forwardRef=function($){return{$$typeof:l,render:$}},P.isValidElement=x,P.lazy=function($){return{$$typeof:d,_payload:{_status:-1,_result:$},_init:Z}},P.memo=function($,T){return{$$typeof:i,type:$,compare:T===void 0?null:T}},P.startTransition=function($){var T=j.T,C={};j.T=C;try{var R=$(),z=j.S;z!==null&&z(C,R),typeof R=="object"&&R!==null&&typeof R.then=="function"&&R.then(S,U)}catch(Y){U(Y)}finally{T!==null&&C.types!==null&&(T.types=C.types),j.T=T}},P.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},P.use=function($){return j.H.use($)},P.useActionState=function($,T,C){return j.H.useActionState($,T,C)},P.useCallback=function($,T){return j.H.useCallback($,T)},P.useContext=function($){return j.H.useContext($)},P.useDebugValue=function(){},P.useDeferredValue=function($,T){return j.H.useDeferredValue($,T)},P.useEffect=function($,T){return j.H.useEffect($,T)},P.useEffectEvent=function($){return j.H.useEffectEvent($)},P.useId=function(){return j.H.useId()},P.useImperativeHandle=function($,T,C){return j.H.useImperativeHandle($,T,C)},P.useInsertionEffect=function($,T){return j.H.useInsertionEffect($,T)},P.useLayoutEffect=function($,T){return j.H.useLayoutEffect($,T)},P.useMemo=function($,T){return j.H.useMemo($,T)},P.useOptimistic=function($,T){return j.H.useOptimistic($,T)},P.useReducer=function($,T,C){return j.H.useReducer($,T,C)},P.useRef=function($){return j.H.useRef($)},P.useState=function($){return j.H.useState($)},P.useSyncExternalStore=function($,T,C){return j.H.useSyncExternalStore($,T,C)},P.useTransition=function(){return j.H.useTransition()},P.version="19.2.8",P}var Ya;function Zf(){return Ya||(Ya=1,Uo.exports=Jf()),Uo.exports}Zf();const Xf={skipErrorToast:!0},Ir=e=>`/bkn-backend/v1/knowledge-networks/${encodeURIComponent(e)}`,zo=100,Qf=50;async function Mr(e,t={}){const n=[];for(let o=0;o<Qf;o+=1){const{data:s}=await st.get(e,{...Xf,params:{...t,limit:zo,offset:o*zo}}),r=s.entries??[];if(n.push(...r),r.length<zo||n.length>=(s.total_count??1/0))break}return n}async function em(e,t){return(await Mr(`${Ir(e)}/action-types`,{operation_kind:"event"})).filter(o=>o.id&&o.operation_config?.type==="event"&&!0)}function tm(e){const t=e.schedule;return t?.expression?{...t.type?{type:t.type}:{},expression:t.expression,...t.timezone?{timezone:t.timezone}:{}}:null}async function nm(e,t){return(await Mr(`${Ir(e)}/action-schedules`,{})).filter(o=>o.id&&o.source==="action_type"&&!0)}function om(e,t,n){const o=e.id??"",s=e.event??{},r=s.source==="rule"?"rule":"report",a=t?.find(i=>i.operation_config?.event_class===o),l=a&&n?.find(i=>i.action_type_id===a.id),c=l?.next_run_time;return{code:o,name:e.name||o,source:r,...s.subject?{subject:s.subject}:{},...s.severity?{severity:s.severity}:{},...s.merge_hours?{merge_hours:s.merge_hours}:{},...r==="rule"&&t?{recognition_action_id:a?.id??null,check_schedule:a?tm(a):null,...a&&n?{platform_schedule_id:l?.id??null}:{}}:{},...c?{next_check_at:c}:{}}}async function sm(e){const[t,n,o]=await Promise.all([Mr(`${Ir(e)}/object-types`),em(e).catch(()=>{}),nm(e).catch(()=>{})]);return t.filter(s=>s.id&&Array.isArray(s.kinds)&&s.kinds.includes("event")).map(s=>om(s,n,o))}Math.random().toString(36).slice(2);const rm=new Map;Math.random().toString(36).slice(2);function am(){for(const e of rm.values())if(e.dirty.size>0||e.writing.size>0||e.failed.size>0)return!0;return!1}typeof window<"u"&&window.addEventListener("beforeunload",e=>{am()&&(e.preventDefault(),e.returnValue="")});const im=new Map;function lm(e,t){im.set(e,Promise.resolve(t))}class Hc extends Error{constructor(t){super("draft changed since it was read"),this.currentRevision=t}currentRevision}class qr extends Error{constructor(){super("app not found")}}class Fr extends Error{constructor(){super("not allowed")}}class Vc extends Error{constructor(){super("app too large")}}class cm extends Error{constructor(t){super("event types missing on the network"),this.eventTypes=t}eventTypes}const Dr="/workshop/v1",hn={skipErrorToast:!0},dm=200;function um(e){const t=e?.response,n=t?.status,o=t?.data?.metadata;if(n===404)return new qr;if(n===403)return new Fr;if(n===413)return new Vc;if(n===409){if(typeof o?.current_revision=="number")return new Hc(o.current_revision);if(Array.isArray(o?.event_types))return new cm(o.event_types.map(String))}return e}async function pn(e){try{return(await e()).data}catch(t){throw um(t)}}function hm(){return`ws-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}const Ga=e=>({id:e?.id??"",name:e?.name||e?.id||""});function pm(e){return!e||typeof e!="object"||!Array.isArray(e.pages)?null:Vf(e)}function Jc(e){const t=e.tags??[],n=(e.references??[]).map(Ga);return{id:e.id,name:e.name,...e.description?{description:e.description}:{},...e.icon?{icon:e.icon}:{},...e.color?{color:e.color}:{},...t.length>0?{tags:t}:{},...n.length>0?{references:n}:{},network:Ga(e.kn),version:e.current_version??0,revision:e.draft_revision??0,creator:e.creator??"",updatedAt:e.update_time??0,operations:e.operations??[],...e.managed_by?{managedBy:e.managed_by}:{},...e.workspace_id?{workspaceId:e.workspace_id}:{}}}const Br=e=>({...Jc(e),draft:pm(e.draft)}),Ur=e=>`${Dr}/apps/${encodeURIComponent(e)}`;async function fm(){const e=[];let t="";for(const n=new Set;;n.add(t)){const o=new URLSearchParams({limit:String(dm)});t&&o.set("cursor",t);const s=await pn(()=>st.get(`${Dr}/apps`,{...hn,params:o}));if(e.push(...(s.entries??[]).map(Jc)),t=s.next_cursor??"",!t||n.has(t))return e}}async function mm(e){try{const t=Br(await pn(()=>st.get(Ur(e),hn)));return lm(e,t.workspaceId),t}catch(t){if(t instanceof qr)return null;throw t}}const gm=e=>({name:e.name,description:e.description?.trim()??"",...e.icon?{icon:e.icon}:{},...e.color?{color:e.color}:{},tags:e.tags??[],references:(e.references??[]).map(({id:t,name:n})=>({id:t,name:n}))});async function ym(e,t,n,o={},s){const r=await pn(()=>st.post(`${Dr}/apps`,{...gm({...o,name:e}),kn:{id:t.id,name:t.name},draft:n,...s?{workspace_id:s}:{}},{...hn,headers:{"Idempotency-Key":hm()}}));return Br(r)}async function bm(e,t,n){return Br(await pn(()=>st.put(`${Ur(e)}/draft`,{draft:t,revision:n},hn)))}async function wm(e,t,n="upload"){const o=await pn(()=>st.post(`${Ur(e)}/component-packages`,t,{...hn,params:{source:n},headers:{"Content-Type":"application/zip"}}));return{id:o.package.id,type:o.package.type,version:o.package.version,manifest:o.package.manifest,warnings:o.warnings??[]}}var W={},Wo={},Ko={},de={},Ha;function B(){if(Ha)return de;Ha=1;const e=Symbol.for("yaml.alias"),t=Symbol.for("yaml.document"),n=Symbol.for("yaml.map"),o=Symbol.for("yaml.pair"),s=Symbol.for("yaml.scalar"),r=Symbol.for("yaml.seq"),a=Symbol.for("yaml.node.type"),l=g=>!!g&&typeof g=="object"&&g[a]===e,c=g=>!!g&&typeof g=="object"&&g[a]===t,i=g=>!!g&&typeof g=="object"&&g[a]===n,d=g=>!!g&&typeof g=="object"&&g[a]===o,h=g=>!!g&&typeof g=="object"&&g[a]===s,u=g=>!!g&&typeof g=="object"&&g[a]===r;function p(g){if(g&&typeof g=="object")switch(g[a]){case n:case r:return!0}return!1}function f(g){if(g&&typeof g=="object")switch(g[a]){case e:case n:case s:case r:return!0}return!1}const m=g=>(h(g)||p(g))&&!!g.anchor;return de.ALIAS=e,de.DOC=t,de.MAP=n,de.NODE_TYPE=a,de.PAIR=o,de.SCALAR=s,de.SEQ=r,de.hasAnchor=m,de.isAlias=l,de.isCollection=p,de.isDocument=c,de.isMap=i,de.isNode=f,de.isPair=d,de.isScalar=h,de.isSeq=u,de}var $n={},Va;function co(){if(Va)return $n;Va=1;var e=B();const t=Symbol("break visit"),n=Symbol("skip children"),o=Symbol("remove node");function s(h,u){const p=c(u);e.isDocument(h)?r(null,h.contents,p,Object.freeze([h]))===o&&(h.contents=null):r(null,h,p,Object.freeze([]))}s.BREAK=t,s.SKIP=n,s.REMOVE=o;function r(h,u,p,f){const m=i(h,u,p,f);if(e.isNode(m)||e.isPair(m))return d(h,f,m),r(h,m,p,f);if(typeof m!="symbol"){if(e.isCollection(u)){f=Object.freeze(f.concat(u));for(let g=0;g<u.items.length;++g){const y=r(g,u.items[g],p,f);if(typeof y=="number")g=y-1;else{if(y===t)return t;y===o&&(u.items.splice(g,1),g-=1)}}}else if(e.isPair(u)){f=Object.freeze(f.concat(u));const g=r("key",u.key,p,f);if(g===t)return t;g===o&&(u.key=null);const y=r("value",u.value,p,f);if(y===t)return t;y===o&&(u.value=null)}}return m}async function a(h,u){const p=c(u);e.isDocument(h)?await l(null,h.contents,p,Object.freeze([h]))===o&&(h.contents=null):await l(null,h,p,Object.freeze([]))}a.BREAK=t,a.SKIP=n,a.REMOVE=o;async function l(h,u,p,f){const m=await i(h,u,p,f);if(e.isNode(m)||e.isPair(m))return d(h,f,m),l(h,m,p,f);if(typeof m!="symbol"){if(e.isCollection(u)){f=Object.freeze(f.concat(u));for(let g=0;g<u.items.length;++g){const y=await l(g,u.items[g],p,f);if(typeof y=="number")g=y-1;else{if(y===t)return t;y===o&&(u.items.splice(g,1),g-=1)}}}else if(e.isPair(u)){f=Object.freeze(f.concat(u));const g=await l("key",u.key,p,f);if(g===t)return t;g===o&&(u.key=null);const y=await l("value",u.value,p,f);if(y===t)return t;y===o&&(u.value=null)}}return m}function c(h){return typeof h=="object"&&(h.Collection||h.Node||h.Value)?Object.assign({Alias:h.Node,Map:h.Node,Scalar:h.Node,Seq:h.Node},h.Value&&{Map:h.Value,Scalar:h.Value,Seq:h.Value},h.Collection&&{Map:h.Collection,Seq:h.Collection},h):h}function i(h,u,p,f){if(typeof p=="function")return p(h,u,f);if(e.isMap(u))return p.Map?.(h,u,f);if(e.isSeq(u))return p.Seq?.(h,u,f);if(e.isPair(u))return p.Pair?.(h,u,f);if(e.isScalar(u))return p.Scalar?.(h,u,f);if(e.isAlias(u))return p.Alias?.(h,u,f)}function d(h,u,p){const f=u[u.length-1];if(e.isCollection(f))f.items[h]=p;else if(e.isPair(f))h==="key"?f.key=p:f.value=p;else if(e.isDocument(f))f.contents=p;else{const m=e.isAlias(f)?"alias":"scalar";throw new Error(`Cannot replace node with ${m} parent`)}}return $n.visit=s,$n.visitAsync=a,$n}var Ja;function Zc(){if(Ja)return Ko;Ja=1;var e=B(),t=co();const n={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},o=r=>r.replace(/[!,[\]{}]/g,a=>n[a]);class s{constructor(a,l){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,a),this.tags=Object.assign({},s.defaultTags,l)}clone(){const a=new s(this.yaml,this.tags);return a.docStart=this.docStart,a}atDocument(){const a=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return a}add(a,l){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);const c=a.trim().split(/[ \t]+/),i=c.shift();switch(i){case"%TAG":{if(c.length!==2&&(l(0,"%TAG directive should contain exactly two parts"),c.length<2))return!1;const[d,h]=c;return this.tags[d]=h,!0}case"%YAML":{if(this.yaml.explicit=!0,c.length!==1)return l(0,"%YAML directive should contain exactly one part"),!1;const[d]=c;if(d==="1.1"||d==="1.2")return this.yaml.version=d,!0;{const h=/^\d+\.\d+$/.test(d);return l(6,`Unsupported YAML version ${d}`,h),!1}}default:return l(0,`Unknown directive ${i}`,!0),!1}}tagName(a,l){if(a==="!")return"!";if(a[0]!=="!")return l(`Not a valid tag: ${a}`),null;if(a[1]==="<"){const h=a.slice(2,-1);return h==="!"||h==="!!"?(l(`Verbatim tags aren't resolved, so ${a} is invalid.`),null):(a[a.length-1]!==">"&&l("Verbatim tags must end with a >"),h)}const[,c,i]=a.match(/^(.*!)([^!]*)$/s);i||l(`The ${a} tag has no suffix`);const d=this.tags[c];if(d)try{return d+decodeURIComponent(i)}catch(h){return l(String(h)),null}return c==="!"?a:(l(`Could not resolve tag: ${a}`),null)}tagString(a){for(const[l,c]of Object.entries(this.tags))if(a.startsWith(c))return l+o(a.substring(c.length));return a[0]==="!"?a:`!<${a}>`}toString(a){const l=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],c=Object.entries(this.tags);let i;if(a&&c.length>0&&e.isNode(a.contents)){const d={};t.visit(a.contents,(h,u)=>{e.isNode(u)&&u.tag&&(d[u.tag]=!0)}),i=Object.keys(d)}else i=[];for(const[d,h]of c)d==="!!"&&h==="tag:yaml.org,2002:"||(!a||i.some(u=>u.startsWith(h)))&&l.push(`%TAG ${d} ${h}`);return l.join(`
|
|
17
|
-
`)}}return s.defaultYaml={explicit:!1,version:"1.2"},s.defaultTags={"!!":"tag:yaml.org,2002:"},
|
|
18
|
-
`)?t(
|
|
18
|
+
- 详情抽屉的进度条直接按进度画。`;function Ro(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const af=e=>Du.includes(e??"")?e:"P3";function lf(e,t){if(!t)return;const n=e.sources.filter(o=>{const s=pe(e,o.id);return s&&!s.events&&!s.cypher&&s.objectType===t});return(n.find(o=>!o.from)??n[0])?.id}function Fc(e,t,n){const o=n?.get(t.id),s=o?.subject||void 0,a=lf(e,s);return{...t,label:o?.name||t.id,severity:af(o?.severity),...o?{source:o.source,network:o}:{},...n&&!o?{missing:!0}:{},...s?{objectType:s}:{},...a?{subject:a}:{}}}function Qt(e){if(!e)return;const t=Array.isArray(e)?e:Object.values(e);return new Map(t.map(n=>[n.code,n]))}function Mn(e,t){return(e.eventTypes??[]).map(n=>Fc(e,n,t))}const ot="fieldRoles",Dc=`${ot}.`,nn=new Map,cf=new Set;function Bc(e,t,n="zh-CN"){const o=nn.get(t.type);o?.package===e&&o.locale===n||(nn.set(t.type,{package:e,manifest:t,schema:Uc(t,n),locale:n}),cf.forEach(s=>s()))}function df(e){return nn.get(e)?.schema??uf(e)}function uf(e){return{label:e,summary:"",category:"display",description:`自定义组件 ${e}`,descriptors:[],follows:!1,selectorKeys:[],defaults:()=>({})}}function hf(e,t="standard"){if(!xt(e))return(t==="fine"?uc:dc)[e];const n=nn.get(e)?.manifest.minSize,o=ht[t].scale;return n?[n.w*o,n.h*o]:[3*o,3*o]}function pf(e,t){return e.label[t]??e.label["zh-CN"]??e.type}const Pr=e=>e==="string"?"text":e==="number"?"number":e==="date"||e==="datetime"?"date":void 0,ff=["filter","display","chart","relation"];function mf(e,t,n){const o=t["x-workshop"],s={key:e,label:t.title??e,...t.description?{hint:t.description}:{},...n?{}:{optional:!0},tab:o?.tab??"display",...o?.showIf?{shows:l=>Object.entries(o.showIf??{}).every(([c,i])=>l[c]===i)}:{}},a=Pr(o?.fieldTypes?.[0]);let r=null;switch(o?.widget){case"field":r={...s,kind:"field",...a?{of:a}:{}};break;case"fields":r={...s,kind:"fields",...a?{of:a}:{}};break;case"variable":r={...s,kind:"variable",accepts:Wn};break;case"objectType":r={...s,kind:"objectType"};break;case"relationPath":r={...s,kind:"relationPath",...gf(t)?{single:!0}:{}};break;case"actionType":r={...s,kind:"actionTypes"};break;default:Array.isArray(t.enum)&&t.enum.every(l=>typeof l=="string")?r={...s,kind:"enum",options:t.enum.map(l=>[l,l])}:t.type==="boolean"?r={...s,kind:"bool"}:t.type==="number"||t.type==="integer"?r={...s,kind:"number",min:t.minimum??-1e12,max:t.maximum??1e12,...t.type==="number"?{decimal:!0}:{}}:t.type==="string"&&(r={...s,kind:"text",max:t.maxLength??null})}return r}const gf=e=>e.type==="string"||e["x-workshop"]?.maxHops===1;function yf(e){return Object.entries(e.configSchema.properties??{}).filter(([,t])=>{const n=t["x-workshop"]?.widget;return n==="actionType"||n==="relationPath"&&t.type==="string"}).map(([t])=>t)}function bf(e,t){const n=nn.get(e)?.manifest,{[ot]:o,...s}=t,a={...s};if(o&&typeof o=="object"&&!Array.isArray(o))for(const[r,l]of Object.entries(o))a[Dc+r]=l;for(const r of n?yf(n):[])typeof a[r]=="string"&&(a[r]=[a[r]]);return a}function Uc(e,t="zh-CN"){const n=e.data.source,o=Array.isArray(e.data.fields)?e.data.fields:[],s=new Set(e.configSchema.required??[]),a={},r=[{key:"title",label:"标题",kind:"text",max:80,optional:!0,tab:"display"}];n&&r.push({key:"source",label:"数据源",kind:"source",tab:"data"});for(const c of o){const i=Pr(c.type);r.push({key:Dc+c.role,label:`字段:${c.role}`,kind:"field",...i?{of:i}:{},tab:"data"})}for(const[c,i]of Object.entries(e.configSchema.properties??{})){if(["title","source","filters","selection",ot].includes(c))continue;const d=mf(c,i,s.has(c));d?r.push(d):(i.type==="array"||i.type==="object")&&(a[c]=i.type)}const l=n&&e.follows;return l&&r.push({key:"filters",label:"跟随筛选",kind:"bindings",optional:!0,tab:"link"}),e.emits?.includes("selection")&&r.push({key:"selection",label:"点选对象写入",kind:"variable",accepts:["selection"],optional:!0,tab:"link"}),{label:pf(e,t),summary:e.description,category:ff.includes(e.category)?e.category:"display",description:e.description,descriptors:r,...Object.keys(a).length>0?{free:a}:{},follows:l,selectorKeys:[],defaults:(c,i)=>wf(e,c,i.kn)}}function wf(e,t,n){const o={};for(const[i,d]of Object.entries(e.configSchema.properties??{}))d.default!==void 0&&(o[i]=d.default);if(!e.data.source)return o;const s=t.sources[0];if(!s)return o;if(o.source=s.id,e.emits?.includes("selection")){const i=t.variables.find(d=>d.kind==="selection"&&(!("source"in d)||d.source===s.id))?.name;i&&(o.selection=i)}if(Array.isArray(e.data.fields)){const i=he(s,n),d={},h=new Set;for(const u of e.data.fields){const p=Pr(u.type),f=i.find(m=>!h.has(m.name)&&(!p||m.type===p));f&&(d[u.role]=f.name,h.add(f.name))}Object.keys(d).length>0&&(o[ot]=d)}const a=new Set(e.configSchema.required??[]),r=i=>Object.entries(e.configSchema.properties??{}).filter(([d,h])=>a.has(d)&&o[d]===void 0&&h["x-workshop"]?.widget===i);let l;const c=n.relations.find(i=>i.source===s.objectType||i.target===s.objectType);if(c){l=c.source===s.objectType?c.target:c.source;for(const[i,d]of r("relationPath"))o[i]=d.type==="string"?c.id:[c.id]}for(const[i]of r("objectType"))o[i]=l??s.objectType;return o}const Ma=[["neutral","中性"],["info","信息"],["success","成功"],["warning","警示"],["danger","危险"]],cr=[["count","计数"],["sum","求和"],["avg","平均"],["min","最小"],["max","最大"],["distinct","去重计数"]],kf=[...cr,["ratio","占比(满足条件的 ÷ 全部)"]];function qa(e){return e.basis==="period"||e.basis===void 0&&e.periodField!==void 0}function _o(e){return typeof e.compare=="string"&&e.compare!=="none"}const vf=[["local","浏览器所在时区"],["Asia/Shanghai","北京时间"],["UTC","协调世界时"],["Asia/Tokyo","东京时间"],["Asia/Singapore","新加坡时间"],["Europe/Berlin","柏林时间"],["Europe/London","伦敦时间"],["America/New_York","纽约时间"],["America/Los_Angeles","洛杉矶时间"]],$f=[["high","严重"],["medium","关注"],["low","提示"]],Fa=[["asc","升序"],["desc","降序"]],J=(e="标题")=>({key:"title",label:e,kind:"text",tab:"display",optional:!0}),ae={key:"source",label:"数据源",kind:"source",tab:"data"},Q=(e,t,n,o,s={})=>({key:e,label:t,kind:"variable",accepts:n,tab:"link",sentence:o,optional:s.optional??!0,reads:s.reads}),_e={key:"valueField",label:"统计字段",hint:"求和、平均、最大、最小须选择数字列。",kind:"field",optional:!0,shows:e=>e.aggregate!==void 0&&!["count","ratio"].includes(String(e.aggregate)),neededAs:e=>["sum","avg","min","max"].includes(String(e.aggregate))?"number":void 0},rt=[{key:"label",label:"名称",kind:"text"},{key:"when",label:"仅统计满足以下条件的",kind:"conditions",optional:!0},{key:"aggregate",label:"统计方式",kind:"enum",options:kf},_e],Se=e=>e.metric!==void 0,Po=e=>({key:"metric",label:"数值来源",hint:"对象指标由平台按全部对象计算,口径在知识网络中定义。",kind:"metric",on:e,optional:!0}),wt={key:"description",label:"说明",hint:"显示在标题下面的一行小字,写这里看什么、该做什么。",kind:"text",max:120,tab:"display",optional:!0},Sf=/^[A-Za-z][A-Za-z0-9_]*$/,ve={key:"filters",label:"跟随的筛选",kind:"bindings",tab:"link",optional:!0},$e=(e,t,n,o)=>typeof e[t]=="string"&&e[t]!==""?[{key:t,variable:e[t],...typeof n=="string"?{field:n}:{},...Array.isArray(o)?{fields:o.filter(s=>typeof s=="string")}:{}}]:[],jf=[["frontend","前端 Agent(在浏览器内调用平台模型,可读取页面并代为筛选)"],["bknAgent","内置 BKN Agent(平台智能问答 Agent,以当前用户身份查询知识网络)"],["mcp","外部 Agent(执行工厂中登记的 MCP 服务,由对方直接回答)"]];function Da(e,t){return[{key:"objectType",label:e,kind:"objectType"},{key:"path",label:"关系路径",kind:"relationPath"},{key:"field",label:t,kind:"field",owner:"objectType",of:"date"}]}const He={asOfSlider:{label:"基准日期",summary:"拖动滑块选择日期,整页按该日期计算。",category:"filter",description:"滑块选一个日期,全页按这一天计算:有进度的数据源按第一步的日期决定对象在这天是否存在,状态、超期天数等读基准日期的列跟着重算;滑块范围从范围日期属性的最早值到今天",descriptors:[J(),{...ae,label:"滑块范围取自"},{key:"rangeField",label:"范围日期属性(默认取进度第一步的日期)",kind:"field",tab:"data",of:"date",optional:!0},{key:"step",label:"步长",kind:"enum",tab:"display",options:[["day","天"],["week","周"],["month","月"]]},Q("writes","写入",["asOf"],"拖动滑块时,按 {var} 重新计算全页",{optional:!1})],follows:!1,selectorKeys:[],defaults:(e,t,n)=>({title:"基准日期",source:ee(e,n,Yh)?.id,step:"day",writes:je(e,"asOf")})},dateRange:{label:"日期区间",summary:"选择日期区间,跟随它的组件仅查看该时间段。",category:"filter",description:"选起点和终点两个日期(附本月、上月、近 30 天、今年等快捷项),写入一个日期区间筛选;跟随它的组件只看某个日期列落在区间里的对象",descriptors:[J(),ae,{key:"field",label:"依据的日期(新组件默认依此跟随)",kind:"field",tab:"data",of:"date"},{key:"presets",label:"显示快捷项",kind:"bool",tab:"display"},Q("writes","写入",["dateRange"],"选定日期后,按 {var} 筛选",{optional:!1})],follows:!1,selectorKeys:[],emits:e=>$e(e,"writes",e.field),defaults:(e,t,n)=>{const o=ee(e,n);return{title:"日期区间",source:o?.id,field:o?sf(o.progress)??Lo(o,t,"date"):void 0,presets:!0,writes:je(e,"dateRange")}}},metricCards:{label:"指标卡组",summary:"一排数字卡片,每张统计一项指标;点击卡片可筛选页面。",category:"filter",description:"一行指标卡,每张是一个统计(计数、求和、平均、最大最小、去重计数、占比),可只算满足条件的对象(如进度状态为 overdue 且金额大于 100 万);整组 compare(none 不显示、mom 环比、yoy 同比、both 都显示)对每张卡生效;basis 为 asOf(默认:统计基准日期(没有则今天)当天处于各状态的对象,与告警一致,同环比对比上一期、去年的同一天)或 period(只统计日期落在基准日期所在期的对象,如本月签约数;periodField 为日期属性,不填取进度第一步的日期;同环比按相同天数对比);periodUnit 为 day/week/month/quarter/year(默认 month);单张卡的 compare 可覆盖整组(none 为这张不显示),better(up 越高越好、down 越低越好)决定涨跌颜色,不填时按色调推断(danger、warning 越低越好,success 越高越好);点卡片写入筛选:取值筛选写这张卡的取值(卡片条件只能是一个字段取某些值),对象集合筛选写它算到的对象。一张卡写了 metric 就改为显示知识网络的对象指标:由平台按全部对象计算,不受数据源读取行数限制;when 只能用该指标开放的属性;它不写入筛选,点击时列出参与对象",descriptors:[J(),ae,{key:"compare",label:"同比环比",hint:"对整组卡片生效;单张卡片可在下方「指标」中另设。",kind:"enum",tab:"data",optional:!0,options:[["none","不显示"],["mom","环比(与上一期比较)"],["yoy","同比(与去年同期比较)"],["both","同比与环比"]]},{key:"basis",label:"统计口径",hint:"截至基准日期:统计基准日期当天处于各状态的对象,与告警、表格一致,适合已超期、进行中等状态;同比、环比与去年、上一期的同一天对比。基准日期所在期:只统计日期落在本期的对象,适合本月签约数等新增量;同比、环比按相同天数对比。",kind:"enum",tab:"data",optional:!0,options:[["asOf","截至基准日期"],["period","基准日期所在期"]]},{key:"periodField",label:"分期日期",hint:"对象按该日期归入某一期。留空时使用进度第一步的日期(如签约时间)。",kind:"field",of:"date",tab:"data",optional:!0,shows:(e,t)=>qa(t)},{key:"periodUnit",label:"周期",hint:"默认按月:环比对比上个月,按期统计时一期为一个月。",kind:"enum",tab:"data",optional:!0,shows:(e,t)=>_o(t)||qa(t),options:[["day","日"],["week","周"],["month","月"],["quarter","季度"],["year","年"]]},{key:"showNoData",label:"对比期无数据时显示「无对比数据」",kind:"bool",tab:"data",optional:!0,shows:(e,t)=>_o(t)},{key:"items",label:"指标",kind:"list",tab:"data",min:1,max:8,item:[rt[0],{key:"description",label:"说明",hint:"显示在数字下面的一行小字,写它的含义或该做什么。",kind:"text",max:60,optional:!0},Po("card"),rt[1],{...rt[2],shows:e=>!Se(e),notNeeded:Se},{..._e,shows:e=>!Se(e)&&_e.shows(e),neededAs:e=>Se(e)?void 0:_e.neededAs(e)},{key:"tone",label:"色调",kind:"enum",options:Ma},{key:"compare",label:"同比环比",hint:"留空时沿用整组设置。",kind:"enum",optional:!0,shows:(e,t)=>_o(t)||e.compare!==void 0,options:[["none","不显示"],["mom","环比(与上一期比较)"],["yoy","同比(与去年同期比较)"],["both","同比与环比"]]},{key:"better",label:"变化方向",hint:"决定涨跌显示为绿色还是红色。留空时按色调判定:危险、警示越低越好,成功越高越好。",kind:"enum",optional:!0,shows:(e,t)=>(e.compare??t.compare??"none")!=="none"||e.better!==void 0,options:[["up","越高越好(上涨为绿色)"],["down","越低越好(上涨为红色)"]]}]},Q("writes","点击写入",["value","set"],"点击指标卡时,将该卡统计的对象写入 {var}"),ve],follows:!0,selectorKeys:["writes"],emits:(e,t)=>qo(t,e.writes)==="set"?$e(e,"writes"):$e(e,"writes",Wa(e.items)[0]),check:(e,t,n)=>{const o=e.items??[],s=o.flatMap((r,l)=>{const c=Ia(t.kn,ir(r.metric));return c?(r.when??[]).filter(i=>!Mc(i,{metric:c,kn:t.kn,asOf:"2000-01-01"})).map(i=>`${n}.items[${l}].when 的条件(${qc(i)})不能交给平台:对象指标卡的条件只能用指标「${c.name}」开放的属性`):[]});if(qo(t.spec,e.writes)!=="value")return s;const a=o.filter(r=>r.metric===void 0);return a.some(r=>r.when?.length&&!Ec(r.when))?[...s,`${n}.items 写入取值筛选时,每张卡的条件只能是“某字段为某些值”;条件更复杂时改写入对象集合筛选`]:new Set(Wa(a)).size>1?[...s,`${n}.items 写入同一个筛选的指标要按同一个字段取值`]:s},defaults:(e,t,n)=>{const o=ee(e,n,a=>!!et(a)),s=o&&et(o);return{title:"关键指标",source:o?.id,items:[{label:"全部",aggregate:"count",tone:"neutral"},...(s?Io(s):[]).map(a=>({label:s?xo(s.name,a.value):a.value,when:Xt(s?.name,[a.value]),aggregate:"count",tone:a.tone??"neutral"}))],writes:s?vn(e,s.name):void 0}}},segmentedFilter:{label:"分段筛选",summary:"一排带数量的按钮,点击后仅显示该类。",category:"filter",description:"一组带数量的筛选按钮,按一个字段的取值分段;一个按钮可以包含几个取值",descriptors:[J(),ae,{key:"field",label:"字段",kind:"field",tab:"data"},{key:"options",label:"选项",kind:"list",tab:"data",min:2,max:6,item:[{key:"label",label:"名称",kind:"text"},{key:"values",label:"取值(留空为全部)",kind:"values",fieldKey:"field",optional:!0}]},{key:"showCounts",label:"显示数量",kind:"bool",tab:"display"},Q("writes","写入",["value"],"点击选项时,将其取值写入 {var}",{optional:!1}),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes",e.field),defaults:(e,t,n)=>{const o=ee(e,n,a=>!!et(a)),s=o&&et(o);return{source:o?.id,field:s?.name,options:[{label:"全部"},...(s?Io(s):[]).map(a=>({label:s?xo(s.name,a.value):a.value,values:[a.value]}))],showCounts:!0,writes:s?vn(e,s.name):void 0}}},dropdownFilter:{label:"下拉筛选",summary:"下拉选择一个或多个值,跟随它的组件仅显示所选值;选项与数量取自数据。",category:"filter",description:"按一个字段的取值筛选,选项从数据里自动取并带数量,可搜索、可多选;适合取值很多的字段(城市、球队、客户)",descriptors:[J(),ae,{key:"field",label:"字段",kind:"field",tab:"data"},{key:"multiple",label:"允许多选",kind:"bool",tab:"display"},{key:"showCounts",label:"显示数量",kind:"bool",tab:"display"},{key:"placeholder",label:"提示文字",kind:"text",tab:"display",optional:!0},Q("writes","写入",["value"],"选中值时,将其写入 {var}",{optional:!1}),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes",e.field),defaults:(e,t,n)=>{const o=ee(e,n),s=o&&(et(o)?.name??Mo(o,t).find(a=>a!==o.key));return{source:o?.id,field:s,multiple:!1,showCounts:!0,writes:s?vn(e,s):void 0}}},searchBox:{label:"搜索框",summary:"输入关键词,跟随它的组件仅显示包含该关键词的对象。",category:"filter",description:"输入文字,写入一个搜索筛选;跟随它的组件在各自的文本列里查找",descriptors:[J(),ae,{key:"fields",label:"搜索的列(新组件默认依此跟随)",kind:"fields",tab:"data",of:"text",optional:!0},{key:"placeholder",label:"提示文字",kind:"text",tab:"display",optional:!0},Q("writes","写入",["search"],"输入内容时,写入 {var}",{optional:!1})],follows:!1,selectorKeys:[],emits:e=>$e(e,"writes",void 0,e.fields),defaults:(e,t,n)=>{const o=ee(e,n);return{source:o?.id,fields:o?[...Mo(o,t).filter(s=>s===o.key),...Mo(o,t).filter(s=>s!==o.key).slice(0,2)]:[],placeholder:"搜索",writes:je(e,"search",o?.id)}}},text:{label:"文本",summary:"一段文字:标题、结论或说明,在页面上直接编辑,可以引用随筛选变化的数字。",category:"basic",description:"一段 Markdown 文字(标题、加粗、列表、链接),用来写页面开头的结论、分节标题和说明段落;搭建时选中后可在页面上直接编辑。align 为对齐方式(left 左对齐、center 居中、right 右对齐,默认左对齐)。values 列出正文引用的数字,每项 { name, source, aggregate, when?, valueField?, metric?, filters? }:name 字母开头;统计写法同指标卡的一项(写 metric 就取知识网络的对象指标);filters 为这个数字跟随的筛选,写法同组件的 filters,按它自己数据源的字段比对。content 里用 {name} 填入数字,用 {$asOf} 填入基准日期;读不到时显示 —",descriptors:[J(),{key:"content",label:"内容",hint:"可在页面上选中后直接编辑;这里是 Markdown 写法。用 {引用名} 填入下面的数字,用 {$asOf} 填入基准日期。",kind:"text",multiline:!0,max:4e3,tab:"display"},{key:"align",label:"对齐",kind:"enum",tab:"display",optional:!0,options:[["left","左对齐"],["center","居中"],["right","右对齐"]]},{key:"values",label:"引用的数字",kind:"list",tab:"data",optional:!0,min:1,max:12,item:[{key:"name",label:"引用名",hint:"正文里写 {引用名} 填入这个数字;字母开头,可含数字和下划线。",kind:"text"},{key:"source",label:"数据源",kind:"source"},Po("card"),rt[1],{...rt[2],shows:e=>!Se(e),notNeeded:Se},{..._e,shows:e=>!Se(e)&&_e.shows(e),neededAs:e=>Se(e)?void 0:_e.neededAs(e)},{...ve,optional:!0}]}],follows:!1,selectorKeys:[],check:(e,t,n)=>{const s=(e.values??[]).map(l=>l.name),a=s.flatMap((l,c)=>typeof l=="string"&&!Sf.test(l)?[`${n}.values[${c}].name 须字母开头,只含字母、数字和下划线`]:[]),r=s.filter((l,c)=>s.indexOf(l)!==c);return r.length>0&&a.push(`${n}.values 的引用名重复:${[...new Set(r)].join("、")}`),a},defaults:()=>({content:"在这里输入文字"})},objectTable:{label:"对象表",summary:"明细表,支持排序、分页、勾选;点击行选中对象。",category:"display",description:"对象明细表,可排序分页;点行选中对象,表头可带按某字段取值的快捷筛选与搜索,某列可点击筛选;格式 tag 把值显示成标签,进度状态和判断状态的计算列带颜色",descriptors:[J(),wt,ae,{key:"columns",label:"列",kind:"list",tab:"data",min:1,max:20,fill:{from:"field",item:Ba},item:[{key:"field",label:"属性",kind:"field"},{key:"label",label:"列名",kind:"text"},{key:"format",label:"格式",kind:"enum",options:[["text","文本"],["date","日期"],["number","数字"],["tag","标签"]]}]},{key:"sortField",label:"排序属性",kind:"field",tab:"data",optional:!0},{key:"sortOrder",label:"排序方向",kind:"enum",tab:"data",options:Fa},{key:"pageSize",label:"每页行数",kind:"number",tab:"display",min:5,max:50},Q("selection","点击行写入",["selection"],"点击行时,选中该对象(写入 {var}),详情抽屉和关系子图将显示该对象"),Q("picks","勾选写入",["set"],"每行前显示勾选框,勾选的对象作为一组写入 {var},其他组件可仅查看该组"),{key:"quickField",label:"表头快捷筛选字段",kind:"field",tab:"link",optional:!0},Q("quickFilter","表头快捷筛选",["value"],"表头按上述字段的取值显示按钮,点击后写入 {var}"),Q("search","表头搜索",["search"],"表头显示搜索框,输入内容时写入 {var}"),{key:"cellFilters",label:"点击单元格筛选",sentence:"点击某列的值时,写入对应的筛选:",kind:"list",tab:"link",min:0,max:4,optional:!0,item:[{key:"field",label:"列的属性",kind:"field"},{key:"variable",label:"写入筛选",kind:"variable",accepts:["value"]}]},ve],follows:!0,selectorKeys:["picks"],emits:e=>[...$e(e,"picks"),...$e(e,"quickFilter",e.quickField),...$e(e,"search",void 0,Ef(e)),...(e.cellFilters??[]).flatMap(t=>t.variable?[{key:"cellFilters",variable:t.variable,field:t.field}]:[])],check:(e,t,n)=>e.quickFilter&&!e.quickField?[`${n}.quickField 表头快捷筛选要指定按哪个字段`]:[],defaults:(e,t,n)=>{const o=ee(e,n),s=o?he(o,t.kn).slice(0,5):[];return{title:o?.label,source:o?.id,columns:s.map(Ba),sortOrder:"desc",pageSize:10,selection:je(e,"selection",o?.id)}}},objectList:{label:"对象列表",summary:"卡片式列表,适用于待办和收件箱;点击列表项选中对象。",category:"display",description:"卡片式列表,适合收件箱、待办;可只看满足条件的对象,点一项选中对象",descriptors:[J(),wt,ae,{key:"when",label:"仅显示满足以下条件的对象",kind:"conditions",tab:"data",optional:!0},{key:"titleField",label:"标题属性",kind:"field",tab:"data"},{key:"subtitleFields",label:"副标题属性",kind:"fields",tab:"data",optional:!0},{key:"sortField",label:"排序属性",kind:"field",tab:"data",optional:!0},{key:"sortOrder",label:"排序方向",kind:"enum",tab:"data",options:Fa},{key:"badgeField",label:"徽标字段(状态类字段按颜色区分)",kind:"field",tab:"display",optional:!0},{key:"limit",label:"最多显示",kind:"number",tab:"display",min:3,max:30},Q("selection","点击写入",["selection"],"点击列表项时,选中该对象(写入 {var}),详情抽屉和关系子图将显示该对象"),ve],follows:!0,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n);return{title:o?.label,source:o?.id,titleField:o&&Ao(o,t.kn),sortOrder:"desc",badgeField:o?et(o)?.name:void 0,limit:8,selection:je(e,"selection",o?.id)}}},pivotTable:{label:"透视表",summary:"按一个属性分组汇总,每列一项统计;点击行可筛选页面。",category:"display",description:"按一个属性分组汇总,每列一个度量;点一行按该分组筛选全页",descriptors:[J(),wt,ae,{key:"dimension",label:"分组属性",kind:"field",tab:"data"},{key:"measures",label:"度量",kind:"list",tab:"data",min:1,max:5,item:[...rt]},{key:"limit",label:"最多行数",kind:"number",tab:"display",min:5,max:50},{key:"bars",label:"数值显示条形",kind:"bool",tab:"display",optional:!0,hint:"在每列数值下方显示按该列最大值比例的条形,便于比较各组。"},Q("writes","点击行写入",["value"],"点击行时,将该组的取值写入 {var}"),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes",e.dimension),defaults:(e,t,n)=>{const o=ee(e,n),s=o?da(he(o,t.kn),t.kn.objectTypes[o.objectType]):void 0;return{source:o?.id,dimension:s?.name,measures:[{label:"数量",aggregate:"count"}],limit:10,bars:!0}}},trendChart:{label:"图表",summary:"柱状图、折线图或饼图:按时间或类别统计;点击图形可筛选页面。",category:"chart",description:"柱线饼图。横轴 axis 为 time(默认)时按日、周、月或季度统计(grain,默认按月),每个系列用自己的日期属性 dateField,点某个周期把它写入一个日期区间筛选;为 category 时按属性 category 的取值统计(最多 limit 个,取第一个系列最大的几个;sort 为 category 时按类别本身排序,如年份,默认按数值从大到小),点一个取值把它写入取值筛选。segmentBy 把每个系列再按另一个属性拆开(柱堆叠、线分色)。只有一个系列且横轴为 category 时图形可选 pie(饼图)。横轴为 category 且各系列都是柱时,orientation 决定柱子方向:auto(默认)在有类别名长于约四个汉字时改为横向条形(类别列在左侧,过长截断、悬停看全名),vertical 始终竖向,horizontal 始终横向。系列写了 metric 就改为显示知识网络的对象指标,由平台按全部对象计算:一张图的系列要么都写 metric、要么都不写;横轴为时间时粒度跟随指标(各指标须相同,不写 grain);不能用 segmentBy;按类别时由平台取前 limit 个",descriptors:[J(),wt,ae,{key:"axis",label:"横轴",kind:"enum",tab:"data",optional:!0,options:[["time","时间(按周期)"],["category","类别(按属性取值)"]]},{key:"category",label:"类别属性",kind:"field",tab:"data",optional:!0,shows:(e,t)=>t.axis==="category"},{key:"sort",label:"类别排序",kind:"enum",tab:"display",optional:!0,shows:(e,t)=>t.axis==="category",options:[["value","按数值从大到小"],["category","按类别自身(例如年份)"]]},{key:"orientation",label:"柱子方向",kind:"enum",tab:"display",optional:!0,shows:(e,t)=>t.axis==="category"&&!t.series?.some(n=>n.chart!=="bar"),options:[["auto","自动:类别名较长时横向"],["vertical","竖向柱"],["horizontal","横向条形"]]},{key:"limit",label:"最多显示类别数",kind:"number",tab:"display",optional:!0,shows:(e,t)=>t.axis==="category",min:2,max:50},{key:"segmentBy",label:"按属性拆分系列",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!za(t)||t.segmentBy!==void 0},{key:"grain",label:"统计粒度",shows:(e,t)=>t.axis!=="category"&&!za(t),kind:"enum",tab:"display",optional:!0,options:[["day","日"],["week","周"],["month","月"],["quarter","季度"]]},{key:"months",label:"显示周期数(横轴为时间时必填)",shows:(e,t)=>t.axis!=="category",kind:"number",tab:"display",optional:!0,min:3,max:36},{key:"series",label:"系列",kind:"list",tab:"data",min:1,max:4,item:[{key:"label",label:"名称",kind:"text"},Po("chart"),{key:"dateField",label:"日期属性",shows:(e,t)=>t.axis!=="category"&&!Se(e),kind:"field",of:"date",optional:!0},{key:"aggregate",label:"聚合",kind:"enum",options:cr,shows:e=>!Se(e),notNeeded:Se},{..._e,shows:e=>!Se(e)&&_e.shows(e),neededAs:e=>Se(e)?void 0:_e.neededAs(e)},{key:"chart",label:"图形",kind:"enum",options:[["bar","柱"],["line","线"],["pie","饼(仅限单系列且横轴为类别时可用)"]]}]},Q("writes","点击写入",["dateRange","value"],"点击周期(或类别)时,将其写入 {var}"),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes",e.axis==="category"?e.category:e.series?.[0]?.dateField),check:(e,t,n)=>{const o=[],s=e.axis==="category",a=e.series??[];s&&!e.category&&o.push(`${n}.category 横轴为类别时必填`),!s&&e.months===void 0&&o.push(`${n}.months 横轴为时间时必填`),!s&&a.some(c=>!c.dateField&&c.metric===void 0)&&o.push(`${n}.series 横轴为时间时每个系列要有 dateField`);const r=a.filter(c=>c.metric!==void 0);r.length>0&&r.length<a.length&&o.push(`${n}.series 一张图的系列要么都用页面内统计,要么都用对象指标`),r.length>0&&e.segmentBy!==void 0&&o.push(`${n}.segmentBy 用对象指标的图表不能按另一个属性拆分系列`),s||new Set(r.flatMap(i=>Ia(t.kn,ir(i.metric))?.grain??[])).size>1&&o.push(`${n}.series 各对象指标的时间粒度须相同`),a.some(c=>c.chart==="pie")&&(!s||a.length!==1)&&o.push(`${n}.series 饼图只能用于横轴为类别、只有一个系列的图表`),e.orientation==="horizontal"&&!s&&o.push(`${n}.orientation 只有横轴为类别时才能横向`),e.orientation==="horizontal"&&a.some(c=>c.chart!=="bar")&&o.push(`${n}.orientation 只有全部系列都是柱时才能横向`);const l=qo(t.spec,e.writes);return l==="value"&&!s&&o.push(`${n}.writes 横轴为时间时只能写入日期区间筛选`),l==="dateRange"&&s&&o.push(`${n}.writes 横轴为类别时只能写入取值筛选`),o},defaults:(e,t,n)=>{const o=ee(e,n),s=o?Lo(o,t,"date"):void 0;return{source:o?.id,months:8,series:[{label:"数量",dateField:s,aggregate:"count",chart:"bar"}],writes:je(e,"dateRange")}}},regionMap:{label:"地图",summary:"按地区着色的地图,可绘制关联对象之间的连线;点击地区可筛选页面。",category:"chart",description:"按地区着色的地图:底图为中国(按省份,省份可从客户名称这类含地名的文字里推断)或世界(按国家,认中英文国名、常见别称和 ISO 代码),地区从一个文本字段里识别;只在数据里确实有地名时才用;可标出满足条件的对象所在地区;可加关系连线:选知识网络里与数据源对象类直接相连的一条关系,连到另一类对象,从它的位置属性识别地区,画出它到对象所在地区的连线(网络里没有直接关系的两类对象不能连线,不能沿多条关系拼出连线);点地区时,把该地区对应的字段值写入一个取值筛选",descriptors:[J(),ae,{key:"basemap",label:"底图",kind:"enum",tab:"data",optional:!0,options:[["china","中国(按省份)"],["world","世界(按国家)"]]},{key:"regionField",label:"地区字段(地名,或含地名的文本)",kind:"field",tab:"data",of:"text"},{key:"aggregate",label:"度量",kind:"enum",tab:"data",options:cr},{..._e,tab:"data"},{key:"highlight",label:"标注(存在满足条件对象的省份以红色描边)",kind:"conditions",tab:"display",optional:!0},{key:"links",label:"关系连线",kind:"list",tab:"data",min:0,max:2,optional:!0,item:[{key:"label",label:"名称",kind:"text"},{key:"objectType",label:"连到的对象类",kind:"objectType"},{key:"path",label:"关系(直接相连的一条)",kind:"relationPath",single:!0},{key:"locationField",label:"位置属性(用于识别省份)",kind:"field",owner:"objectType",of:"text"}]},Q("writes","点击省份写入",["value"],"点击省份时,将该省对应的取值写入 {var}"),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes",e.regionField),defaults:(e,t,n)=>{const o=ee(e,n,l=>!!Ua(l)),s=o&&Ua(o),a=s?.name??(o&&Of(o,t)),r=s?.kind==="region"?s.scope:a&&zc.test(a)?"world":void 0;return{title:"地区分布",source:o?.id,...r==="world"?{basemap:r}:{},regionField:a,aggregate:"count",writes:a?vn(e,a):void 0}}},ganttChart:{label:"甘特图",summary:"按开始和结束日期绘制条形,查看计划与进度。",category:"chart",description:"按分组属性排成行、按开始和结束日期画条,显示基准日期前后的一段时间(默认多看之前,lookAhead 调大可多看之后,适合排计划);状态字段有色调时按色调着色",descriptors:[J(),ae,{key:"groupField",label:"行(分组属性)",kind:"field",tab:"data"},{key:"labelField",label:"条形名称",kind:"field",tab:"data"},{key:"startField",label:"开始日期",kind:"field",tab:"data",of:"date"},{key:"endField",label:"结束日期",kind:"field",tab:"data",of:"date"},{key:"statusField",label:"状态属性",kind:"field",tab:"data",optional:!0},{key:"windowDays",label:"显示天数",kind:"number",tab:"display",min:14,max:365},{key:"lookAhead",label:"基准日期之后的占比(%,规划计划时调大)",kind:"number",tab:"display",min:0,max:100,optional:!0},{key:"maxRows",label:"最多行数",kind:"number",tab:"display",min:3,max:40},ve],follows:!0,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n),s=o?he(o,t.kn).filter(a=>a.type==="date"):[];return{source:o?.id,groupField:o?.key,labelField:o&&Ao(o,t.kn),startField:s[0]?.name,endField:s[1]?.name??s[0]?.name,windowDays:60,maxRows:12}}},scheduleGantt:{label:"调度甘特",summary:"资源排成行、时间横向展开,查看各资源上的任务、停机窗口和关键时点。",category:"chart",description:"按资源排成行(可按上级资源折叠、按属性分组),时间轴以基准日期为中心;每个图层是一类对象:标准图层画任务条(同一资源上重叠的任务分轨显示),背景图层画停机等时段,事件图层画到货等时点(可全局显示)。悬停看起止和属性,在情景中被改动或联动的任务显示原值、原因和改动前位置;点击任务或资源写入选中变量,供对象详情和关联表显示;不满足页面筛选的任务淡化显示;缺资源或缺时间的任务列在底部待排区。标准图层配了调整操作时,可拖动任务改资源和时间、拖动右边缘改结束,改动记入当前方案(没有打开的方案时新建一个),在方案栏的改动清单里查看和移除。数据本身只在采用方案时改。标准图层可配目标完成、最早开始(或所需资源的就绪日)、前序关系和已完成条件:未就绪、前序未完是硬约束,晚于目标只标出不阻止采用;配了目标与前序时算出余量,余量不大于 0 的任务属于关键链并描边,悬停任务显示整条依赖链。工具栏的状态摘要按约束计数,点击筛选。资源可设并行上限(默认 1),任务占用资源的图层按上限判断超限,每行底部显示负荷、超出上限标红;上级资源不可排程的时段对下级同样生效;折叠的上级显示下级任务的汇总条和有问题的任务数。标准图层可配规则工具(ruleTools,执行工厂的工具)判断行业规则:工具收到 { tasks: [{ key, start, end, resource, values }], scenario: { edits } },返回 { results: [{ key, pass, severity?, text, related? }] };不通过的任务与内置约束一起标出、计数、筛选,硬约束阻止采用方案,软约束只标出;工具失败或超时,任务显示未能校验,按硬约束处理。timeZoneVariable 是取值筛选,取值须为 IANA 时区名(如 Asia/Shanghai),没有取值时用 timeZone",descriptors:[J(),{key:"source",label:"资源来源(每个对象一行)",hint:"不选时,按任务的所属资源取值自动成行。",kind:"source",tab:"data",optional:!0},{key:"titleField",label:"资源名称",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!!t.source},{key:"subtitleField",label:"资源副标题",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!!t.source},{key:"parentField",label:"上级资源(取值为上级资源的标识)",hint:"有上级时,资源按上级折叠展开,如工厂下的产线。",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!!t.source},{key:"capacityField",label:"并行上限(同一时间最多承接的任务数)",hint:"不选或没有取值时为 1。图层打开“任务占用资源”后,同一时间的任务数超过上限会标为硬约束,并按上限算负荷。上级资源不可排程的时段,对其下级同样生效。",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!!t.source,of:"number"},{key:"groupField",label:"按属性分组",kind:"field",tab:"data",optional:!0,shows:(e,t)=>!!t.source},{key:"layers",label:"图层",kind:"list",tab:"data",min:0,max:Mu,item:[{key:"label",label:"名称",kind:"text"},{key:"style",label:"样式",kind:"enum",options:[["standard","任务条"],["background","背景时段(如停机窗口)"],["event","事件时点(如到货)"]]},{key:"source",label:"对象来源",kind:"source"},{key:"global",label:"在所有资源上显示",kind:"bool",optional:!0,shows:e=>e.style==="event"},{key:"resourceField",label:"所属资源",hint:"任务排在哪个资源行上:选任务里记着资源的那一项。资源来源与图层是同一类对象时,选「对象本身」,每个对象一行。",kind:"field",objectKey:!0,optional:!0,shows:e=>!(e.style==="event"&&e.global===!0)},{key:"startField",label:"开始",kind:"field",of:"date"},{key:"endField",label:"结束",kind:"field",of:"date",optional:!0,shows:e=>e.style!=="event"},{key:"barFields",label:"条上显示的属性(第一个作为名称)",kind:"fields",optional:!0},{key:"popoverFields",label:"悬浮卡显示的属性",kind:"fields",optional:!0,shows:e=>e.style!=="background"},{key:"color",label:"颜色",kind:"enum",optional:!0,options:[["static","固定颜色"],["field","按属性取值分色"],["format","按属性的条件颜色"]]},{key:"tone",label:"固定颜色",kind:"enum",options:Ma,optional:!0,shows:e=>e.color===void 0||e.color==="static"},{key:"colorField",label:"着色属性",hint:"按条件颜色时,读数据源里为该属性设置的条件颜色。",kind:"field",optional:!0,shows:e=>e.color==="field"||e.color==="format"},{key:"exclusive",label:"任务占用资源",hint:"打开后,同一资源同一时间的任务数超过它的并行上限(默认 1)会标为硬约束,方案超限时不能采用;每行底部显示负荷。适合设备、产线、人员这类按时间占用的资源;以物料等为行时保持关闭。",kind:"bool",optional:!0,shows:e=>e.style==="standard"},{key:"blocks",label:"该时段不可排程",kind:"bool",optional:!0,shows:e=>e.style==="background"},{key:"selection",label:"点击写入",kind:"variable",accepts:["selection"],sentence:"点击该图层的对象时,选中它(写入 {var}),对象详情和关联表将显示它",optional:!0,shows:e=>e.style!=="background"},{key:"adjust",label:"拖动时记入的调整操作",hint:"拖动任务或它的右边缘时,用这个情景操作在方案里记一条改动;不选则只能查看。操作须用时间参数设置开始和结束,也可设置所属资源以便换行。",kind:"operation",optional:!0,fits:(e,t)=>np(e,t),shows:e=>e.style==="standard"},{key:"create",label:"从待排区新建",hint:"计划这类为其他对象新建的记录:还没有有效记录的对象(如需求)列在待排区,拖到资源行上时用这个操作在方案里新建一条,采用时执行它的新建行动。操作须设置开始、结束和所属资源;按行动的查重属性判断对象是否已有记录。",kind:"list",min:0,max:1,optional:!0,shows:e=>e.style==="standard",item:[{key:"source",label:"待排对象",kind:"source"},{key:"operation",label:"新建操作",kind:"operation"},{key:"days",label:"默认时长(天)",kind:"number",min:0,max:365,optional:!0},{key:"daysField",label:"时长取自(天)",kind:"field",of:"number",optional:!0},{key:"fields",label:"待排卡片显示的属性",hint:"如预测单号、交货日期,帮助认出是哪条需求。",kind:"fields",optional:!0}]},{key:"snap",label:"拖动吸附到",hint:"不选时按小时取整;操作的时间参数是日期时按天取整。",kind:"enum",optional:!0,options:[["minute","分钟"],["hour","小时"],["day","天"]],shows:e=>e.style==="standard"&&!!e.adjust},{key:"targetField",label:"目标完成",hint:"任务应在这天之前完成,如工单的交期。完成晚于目标的任务标出晚了多久、计入状态摘要,但不阻止采用方案。",kind:"field",of:"date",optional:!0,shows:e=>e.style==="standard"},{key:"targetFrom",label:"或:目标完成取自关联对象",hint:"如生产计划 → 需求预测单的交货日期;关联到多个时取最早的。",kind:"list",min:0,max:1,optional:!0,item:Da("需求对象类","目标日期"),shows:e=>e.style==="standard"},{key:"earliestField",label:"最早开始",hint:"早于这天开始的任务标为未就绪,属于硬约束。",kind:"field",of:"date",optional:!0,shows:e=>e.style==="standard"},{key:"readyFrom",label:"或:所需资源及其就绪日",hint:"如工单 → 所需备件的就绪日。任务要等所需资源都就绪才能开始:取最晚的就绪日,并点名这个关键资源。",kind:"list",min:0,max:1,optional:!0,item:Da("资源对象类","就绪日"),shows:e=>e.style==="standard"},{key:"predecessorPath",label:"前序关系",hint:"同一图层任务之间的关系。开始早于前序完成的任务标为前序未完,属于硬约束;配了目标完成时,沿前后序算出每项任务的余量,余量不大于 0 的任务属于关键链。",kind:"relationPath",single:!0,optional:!0,shows:e=>e.style==="standard"},{key:"predecessorReaches",label:"沿前序关系到达的是",kind:"enum",optional:!0,options:[["predecessors","前序任务"],["successors","后序任务"]],shows:e=>e.style==="standard"&&Array.isArray(e.predecessorPath)&&e.predecessorPath.length>0},{key:"doneWhen",label:"已完成条件(须全部满足)",hint:"满足的任务不参与约束和余量,如状态为已完工。",kind:"conditions",optional:!0,shows:e=>e.style==="standard"},{key:"ruleTools",label:"规则工具",hint:"行业规则(资质、温控、法规时段、换型时间等)由执行工厂的工具判断,结果与内置约束一起标出、计数和筛选。",kind:"list",min:0,max:qu,optional:!0,shows:e=>e.style==="standard",item:[{key:"name",label:"名称",kind:"text"},{key:"tool",label:"工具",kind:"tool",contract:"scheduleRule"},{key:"severity",label:"不通过时默认",hint:"工具的回答里写了严重程度时,以回答为准。",kind:"enum",optional:!0,options:[["hard","硬约束:方案不能采用"],["soft","软约束:只标出"]]}]},{key:"filters",label:"跟随的筛选",kind:"bindings",optional:!0}]},{key:"daysBefore",label:"基准日期之前显示的天数",kind:"number",tab:"display",min:0,max:365},{key:"daysAfter",label:"基准日期之后显示的天数",kind:"number",tab:"display",min:0,max:365},{key:"tray",label:"待排区",hint:"只看不排的页面可只显示未排数量,不列出可拖动的任务。",kind:"enum",tab:"display",optional:!0,options:[["list","列出待排任务,可点开、可拖到资源上"],["count","只显示未排数量"]]},{key:"tick",label:"时间刻度",kind:"enum",tab:"display",options:[["auto","随缩放自动"],["hour","每小时"],["fourHours","每 4 小时"],["day","每天"],["week","每周"]]},{key:"timeZone",label:"时区",kind:"enum",tab:"display",options:vf},Q("timeZoneVariable","按页面变量取时区",["value"],"按 {var} 选中的时区换算时间,没有选中时用上面的时区"),Q("resourceSelection","点击资源写入",["selection"],"点击资源名称时,选中该资源(写入 {var})")],follows:!1,selectorKeys:[],emits:e=>[...$e(e,"resourceSelection"),...(e.layers??[]).flatMap(t=>typeof t?.selection=="string"&&t.selection!==""?[{key:"layers",variable:t.selection}]:[])],check:(e,t,n)=>(e.layers??[]).flatMap((o,s)=>{if(!o||typeof o!="object")return[];const a=`${n}.layers[${s}]`;return[...o.style!=="event"&&!o.endField?[`${a}.endField 任务条和背景时段要指定结束`]:[],...!o.resourceField&&!(o.style==="event"&&o.global===!0)?[`${a}.resourceField 要指定所属资源,事件时点也可改为在所有资源上显示`]:[],...(o.color==="field"||o.color==="format")&&!o.colorField?[`${a}.colorField 按属性着色要指定着色属性`]:[]]}),review:Lp,defaults:(e,t,n)=>{const o=ee(e,n,c=>!!(pe(e,c.id)&&Lo(c,t,"date"))),s=o?he(o,t.kn):[],a=s.filter(c=>c.type==="date"),r=o?da(s,t.kn.objectTypes[o.objectType]):void 0,l=o&&{label:o.label,style:"standard",source:o.id,resourceField:r?.name,startField:a[0]?.name,endField:a[1]?.name??a[0]?.name,barFields:[Ao(o,t.kn)],popoverFields:s.filter(c=>c.type!=="date"&&c.name!==r?.name).slice(0,3).map(c=>c.name),color:"static",tone:"info",selection:je(e,"selection",o.id),filters:Kc(e,t.kn,{source:o.id},{follows:!0,selectorKeys:[]})};return{title:"调度甘特",layers:l?[l]:[],daysBefore:7,daysAfter:21,tick:"auto",timeZone:"local"}}},stageChain:{label:"环节链路",summary:"环节链路,查看各环节关联的对象数量。",category:"relation",description:"依次排列的环节,每个环节是一个对象类;有关系路径的环节按跟随的筛选显示关联数量,点环节展开记录",descriptors:[J(),ae,{key:"stages",label:"环节",kind:"list",tab:"data",min:1,max:9,fill:{from:"objectType",item:e=>({objectType:e.name,label:e.label})},item:[{key:"objectType",label:"对象类",kind:"objectType"},{key:"label",label:"名称",kind:"text"},{key:"path",label:"关系路径",kind:"relationPath",optional:!0},{key:"fields",label:"展开显示的属性",kind:"fields",owner:"objectType",optional:!0}]},ve],follows:!0,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n);return{source:o?.id,stages:o?[{label:o.label,objectType:o.objectType,path:[]}]:[]}}},subgraph:{label:"关系子图",summary:"以选中对象为中心,绘制其关联对象。",category:"relation",description:"以选中对象为中心,沿配置的关系路径展开关联对象,画成关系图;layout 为 force 时画成关系网,layered 时从左到右分层(选中对象在最左,每一步关系一列),auto(默认)在各路径首尾相连成一条链(如销售订单 → 产品 → 物料 → 采购订单)时分层,否则画成关系网",descriptors:[J(),ae,{key:"layout",label:"布局",kind:"enum",tab:"display",optional:!0,options:[["auto","自动:路径成一条链时分层"],["force","关系网"],["layered","从左到右分层"]]},{key:"paths",label:"展开路径",kind:"list",tab:"data",min:1,max:6,item:[{key:"label",label:"名称",kind:"text"},{key:"objectType",label:"对象类",kind:"objectType"},{key:"path",label:"关系路径",kind:"relationPath"},{key:"limit",label:"最多节点",kind:"number",min:1,max:50}]},{key:"height",label:"高度(自由网格中随单元格调整)",kind:"number",tab:"display",min:240,max:640},Q("selection","读取",["selection"],"显示 {var} 中选中的对象",{optional:!1,reads:!0})],follows:!1,selectorKeys:[],review:(e,t)=>{const n=typeof e.source=="string"?pe(t.spec,e.source):void 0;return!n?.objectType||t.kn.relations.some(o=>o.source===n.objectType||o.target===n.objectType)?[]:[{key:"noRelations",values:{name:t.kn.objectTypes[n.objectType]?.name??n.objectType}}]},defaults:(e,t,n)=>{const o=ee(e,n),s=t.kn.relations.find(r=>r.source===o?.objectType||r.target===o?.objectType),a=s&&(s.source===o?.objectType?s.target:s.source);return{title:"关系子图",source:o?.id,paths:a?[{label:t.kn.objectTypes[a]?.name??a,objectType:a,path:[s.id],limit:8}]:[],height:320,selection:je(e,"selection",o?.id)}}},scenarioBar:{label:"方案",summary:"切换、新建、保存与采用方案,并排对比各方案与现状的指标;紧凑样式只留一行切换,假设样式在侧栏改方案参数和改动。",category:"scenario",description:"方案推演的入口:选择页面显示哪个方案(或现状),新建、复制、命名保存、作废方案,查看方案的改动清单(可移除),采用方案时逐条执行推演操作关联的行动和模型结果的落地条目;改动由组件点击的“推演”动作或 Agent 建议写入,推演操作在数据源上配置;方案只存在于 Workshop,不写回知识网络。页面有模型结果数据源时显示计算状态和「计算」(算当前方案中待重算的结果);新建菜单可按方案参数的可选值一次建出多个方案。style 为 table(对比表,默认)时,每行一个度量,每列现状或一个方案(最多 4 列),附与现状的差值,点列头切换方案,下方可展开方案之间不同的改动;度量可读模型结果数据源,没算过的列写「待重算」,表上的「计算」依次算各列;跟随页面筛选;需要 source 与 measures。style 为 compact(紧凑)时只有一行:方案下拉、新建与当前方案的操作,适合放在页头。style 为 assumptions(假设)时适合放在侧栏:当前方案的方案参数输入、改动清单和「添加假设」,常与页头的紧凑样式配合",descriptors:[J(),{key:"style",label:"样式",kind:"enum",tab:"display",optional:!0,options:[["table","对比表"],["compact","紧凑(只切换)"],["assumptions","假设(参数与改动)"]]},{...ae,optional:!0},{key:"measures",label:"对比的指标",kind:"list",tab:"data",optional:!0,min:1,max:8,item:[...rt]},ve],follows:!0,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n,s=>!!s.operations?.length);return{title:"方案",style:"table",source:o?.id,measures:[{label:"数量",aggregate:"count"},...o?.progress?.due?[{label:"已超期",aggregate:"count",when:[{field:le.status,op:"eq",value:re.overdue.value}]}]:[]]}}},modelTrial:{label:"模型试算",summary:"对一批对象按几组参数调用模型,比较各组结果的差异;结果不改对象。",category:"scenario",description:"对组件跟随的筛选留下的对象(最多 200 个,例如点指标卡或在表格勾选的一批)调用数据源上登记的模型(sources[].models),每组参数调用一次,2 到 4 组并排比较:汇总度量附与第一组(基准)的差值,明细列出各组结果;选中方案时模型读到的是方案中的值;结果只显示在页面上,不写回知识网络;可按选定一组的结果执行模型配置的行动",descriptors:[J(),ae,ve],follows:!0,selectorKeys:[],defaults:(e,t,n)=>({title:"模型试算",source:ee(e,n,s=>!!s.models?.length)?.id})},alertList:{label:"告警",summary:"按规则列出需关注的对象;点击规则仅查看其命中的对象。",category:"filter",description:"按规则实时列出命中的对象:每条规则是一组条件(如进度状态为 overdue、$overdueDays 大于 90),还可要求沿关系路径查不到记录(如没有任何关联的某类对象);按严重程度排序,点规则把命中的对象写入一个对象集合筛选,展开看具体对象",descriptors:[J(),wt,ae,{key:"rules",label:"规则",kind:"list",tab:"data",min:1,max:8,item:[{key:"label",label:"名称",kind:"text"},{key:"severity",label:"严重程度",kind:"enum",options:$f},{key:"when",label:"条件(须全部满足)",kind:"conditions",optional:!0},{key:"objectType",label:"且无关联记录:关联对象类",kind:"objectType",optional:!0},{key:"path",label:"且无关联记录:关系路径",kind:"relationPath",optional:!0}]},{key:"tagField",label:"命中对象的附加显示字段",kind:"field",tab:"display",optional:!0},{key:"limit",label:"展开显示条数",kind:"number",tab:"display",min:3,max:20},Q("writes","点击规则写入",["set"],"点击规则时,将其命中的对象写入 {var}"),Q("selection","点击对象写入",["selection"],"点击展开列表中的对象时,选中该对象(写入 {var})"),ve],follows:!0,selectorKeys:["writes"],emits:e=>$e(e,"writes"),check:(e,t,n)=>(e.rules??[]).flatMap((o,s)=>{const a=`${n}.rules[${s}]`,r=!!o.objectType||!!o.path?.length;return r&&(!o.objectType||!o.path?.length)?[`${a} 查不到关联记录的条件需要同时给关联对象类 objectType 和关系路径 path`]:!r&&!o.when?.length?[`${a} 至少要有一个条件`]:[]}),defaults:(e,t,n)=>{const o=ee(e,n,r=>!!et(r)),s=o&&et(o),a=s?Io(s).filter(r=>r.tone==="danger"):[];return{title:"告警",source:o?.id,rules:s&&a.length>0?a.map(r=>({label:s?xo(s.name,r.value):r.value,severity:"medium",when:[{field:s.name,op:"eq",value:r.value}]})):[{label:"缺少标识",severity:"low",when:[{field:o?.key??"",op:"isEmpty"}]}],tagField:s?.name,limit:8,writes:je(e,"set",o?.id),selection:je(e,"selection",o?.id)}}},eventList:{label:"事件列表",summary:"列出应用的业务事件,支持核实、驳回、关闭;点击事件选中其关联的对象。",category:"display",description:"列出应用里的业务事件(规则命中或用户登记的),未关闭的在前、按严重程度排;待核实的可以核实或驳回,已核实的可以关闭;显示规则的最近与下次检查时间,可以立即检查。事件类型在知识网络里建模,应用在 eventTypes 里按编码选择要处理的。点事件把它关联的对象写入一个选中对象筛选",descriptors:[J(),wt,{key:"types",label:"显示的事件类型(不选则为全部)",kind:"eventType",multiple:!0,tab:"data",optional:!0},{key:"show",label:"默认显示",kind:"enum",options:[["open","未关闭"],["all","全部"]],tab:"display"},{key:"limit",label:"最多显示条数",kind:"number",min:5,max:100,tab:"display"},Q("selection","点击事件选中",["selection"],"点击事件时,选中其关联的对象(写入 {var})")],follows:!1,selectorKeys:[],check:(e,t,n)=>{const o=e.selection,s=t.spec.variables.find(l=>l.name===o);if(!s||!("source"in s))return[];const a=pe(t.spec,s.source)?.objectType,r=e.types;return Mn(t.spec,Qt(t.kn.eventTypes)).filter(l=>(!r?.length||r.includes(l.id))&&l.objectType).filter(l=>l.objectType!==a).map(l=>`${n}.selection 选中的是另一类对象,事件类型 ${l.id} 关联的对象对不上;换一个筛选,或只显示关联对象相同的事件类型`)},defaults:(e,t)=>{const n=Mn(e,Qt(t.kn.eventTypes)).find(s=>s.objectType)?.objectType,o=e.variables.find(s=>s.kind==="selection"&&pe(e,s.source)?.objectType===n)?.name;return{title:"事件",show:"open",limit:20,...n&&o?{selection:o}:{}}}},eventReport:{label:"事件登记",summary:"按钮,打开表单登记业务事件;登记后状态为待核实。",category:"display",description:"一个按钮,打开一类用户登记事件(应用处理的、知识网络里来源为用户登记的事件类型)的表单:标题、发生时间、关联对象与表单字段。登记的事件默认待核实,登记人可以勾选一并核实;合并窗口内同一对象再次登记记为重复",descriptors:[{key:"type",label:"事件类型",kind:"eventType",of:"report",tab:"data"},J("按钮文字")],follows:!1,selectorKeys:[],defaults:(e,t)=>{const n=Mn(e,Qt(t.kn.eventTypes)).find(o=>o.source==="report");return n?{type:n.id}:{}}},taskInbox:{label:"任务收件箱",summary:"由事件归并生成的任务:认领后查看事件、撰写分析、进行处理,事件均有结果时任务关闭。",category:"display",description:"列出事件归并成的任务(按事件类型的归并方式:一个事件一个任务、按关联对象的属性、或按检查批次),未关闭的在前,显示事件数、未处理数、认领人与剩余时限;打开一个任务看事件、分析与处理三栏:认领、添加分析(可多条)、勾选事件新建处理(可多条,处理之间不共用事件)、判定无需处理或移出、手工结束",descriptors:[J(),{key:"types",label:"任务所属事件类型(不选则为全部)",kind:"eventType",multiple:!0,tab:"data",optional:!0},{key:"show",label:"默认显示",kind:"enum",options:[["open","未关闭"],["all","全部"]],tab:"display"},{key:"limit",label:"最多显示条数",kind:"number",min:5,max:100,tab:"display"}],follows:!1,selectorKeys:[],defaults:()=>({title:"任务",show:"open",limit:20})},actionButton:{label:"按钮",summary:"按钮:向 Agent 提问,或对选中、勾选的对象执行行动,执行前需确认。",category:"ai",description:"一个按钮,点了按顺序做 interactions 里的动作:问 Agent(可带上当前筛选),或对选中的对象(selection 筛选)、一组对象(set 筛选,例如表格勾选的行)执行知识网络里的行动;行动执行前总会打开执行确认,列出对象、填写参数、检查执行权限,确认后逐个对象以用户身份执行;行动的对象为空时按钮不可点",descriptors:[J(),ae,{key:"interactions",label:"按钮动作",kind:"interactions",on:["button"],actOn:["button"],hit:!1,max:1,tab:"data"}],follows:!1,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n,c=>!c.cypher&&!c.events),s=o&&t.kn.actionTypes?.find(c=>c.objectType===o.objectType),a=o&&je(e,"selection",o.id),r=o&&je(e,"set",o.id),l=a?{selection:a}:r?{set:r}:void 0;return{title:s?.name??"按钮",source:o?.id,interactions:[{on:"button",...s?{label:s.name}:{},do:s&&l?[{kind:"act",action:s.id,targets:l,params:Object.fromEntries(s.inputs.map(c=>[c.name,{from:"input"}]))}]:[{kind:"ask",question:"总结一下当前页面上需要关注的情况,并给出依据。",context:["filters"],send:"auto"}]}]}}},agentChat:{label:"Agent 对话",summary:"围绕页面数据提问,也可由 Agent 代为筛选页面。",category:"ai",description:"围绕页面数据回答问题:能查页面上的全部数据源和整个知识网络,读当前筛选和选中对象,允许时还能替用户调整全页筛选",descriptors:[J(),{key:"provider",label:"由谁回答",kind:"enum",tab:"data",options:jf},{key:"agent",label:"外部 Agent",hint:"选择 MCP 服务和其中回答问题的工具(通常名为 ask);使用者须有该服务的执行权限。",kind:"mcpTool",tab:"data",optional:!0,shows:e=>e.provider==="mcp"},{key:"allowAgentSwitch",label:"允许使用者切换智能体",hint:"MCP 服务需提供 list_agents 和接受 agent_id 的 ask 工具。切换时开始新对话。列出哪些智能体由服务决定,list_agents 声明了 app_id、bkn_token 时照样传给它。",kind:"bool",tab:"data",optional:!0,shows:e=>e.provider==="mcp"},{key:"passToken",label:"交出使用者的登录令牌",hint:"打开后,工具声明了 bkn_token 时,把使用者本人的访问令牌交给这个 Agent。Agent 凭它能做使用者能做的一切,包括执行行动和办理审批;只对可信的 Agent 打开。默认不交。",kind:"bool",tab:"data",optional:!0,shows:e=>e.provider==="mcp"},{key:"instructions",label:"补充说明",kind:"text",tab:"data",optional:!0,multiline:!0,max:600},{key:"mode",label:"显示方式",kind:"enum",tab:"display",optional:!0,options:[["float","右下角按钮,点开对话"],["side","右侧栏"],["inline","放在页面里"]]},{key:"height",shows:e=>(e.mode??"inline")==="inline",label:"高度(自由网格中随单元格调整)",kind:"number",tab:"display",min:280,max:800},{key:"suggestions",label:"建议问题",kind:"list",tab:"display",min:0,max:6,optional:!0,item:[{key:"text",label:"问题",kind:"text"}]},Q("selection","当前对象",["selection"],"回答时以 {var} 中选中的对象作为当前对象",{reads:!0}),{key:"canFilter",label:"允许 Agent 设置筛选和选中对象(例如“仅看超期”)",kind:"bool",tab:"link"},{key:"actions",label:"允许 Agent 建议的行动",hint:"Agent 只生成建议卡,由用户确认后执行;目前仅前端 Agent 支持。",kind:"actionTypes",tab:"data",optional:!0}],follows:!1,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n);return{title:"Agent 对话",provider:"frontend",mode:"float",height:420,suggestions:o?[{text:`${o.label}里现在最需要关注的是哪些?`},{text:`这一页的${o.label}有什么异常或趋势?`}]:[],selection:je(e,"selection",o?.id),canFilter:!0}}}};function Af(e){return Ve.filter(t=>!Cr.has(t)&&(e||He[t].category!=="scenario"))}const dt={label:"对象详情",summary:"选中对象后打开,显示其属性、进度和关联记录。",category:"relation",description:"抽屉里显示选中对象的进度、属性,以及沿关系路径关联的记录。进度条按数据源的进度(progress)画:每一步是否完成,截止日期按期还是超期",descriptors:[J(),ae,{key:"showProgress",label:"显示进度条(需先在数据源中设置进度)",kind:"bool",tab:"data",optional:!0},{key:"fields",label:"属性",kind:"fields",tab:"data"},{key:"related",label:"关联区块",kind:"list",tab:"data",min:0,max:4,optional:!0,item:[{key:"label",label:"名称",kind:"text"},{key:"objectType",label:"对象类",kind:"objectType"},{key:"path",label:"关系路径",kind:"relationPath"},{key:"fields",label:"属性",kind:"fields",owner:"objectType"},{key:"limit",label:"最多行数",kind:"number",min:1,max:20}]},Q("selection","读取",["selection"],"显示 {var} 中选中的对象",{optional:!1,reads:!0})],follows:!1,selectorKeys:[],defaults:(e,t,n)=>{const o=ee(e,n);return{source:o?.id,...o?.progress?{showProgress:!0}:{},fields:o?he(o,t.kn).slice(0,8).map(s=>s.name):[],selection:je(e,"selection",o?.id)}}};function un(e){return e===Te?dt:xt(e)?df(e):He[e]}function ee(e,t,n=()=>!0){const o=e.sources.find(s=>s.id===t)??e.sources.find(n)??e.sources[0];return o&&(pe(e,o.id)??o)}function je(e,t,n){return e.variables.find(o=>o.kind===t&&(!n||!("source"in o)||o.source===n))?.name}function Lo(e,t,n){return he(e,t.kn).find(o=>o.type===n)?.name}function Tf(e){return e==="date"?"date":e==="number"?"number":"text"}function Ba(e){return{field:e.name,label:e.label,format:e.name===le.status?"tag":e.type?Tf(e.type):"text"}}function et(e){if(e.progress)return{name:le.status,outcomes:jc};const t=e.computed?.find(n=>n.kind==="classify");return t&&{name:t.name,outcomes:[...t.cases,t.otherwise]}}function Ua(e){return e.computed?.find(t=>t.kind==="region")}const zc=/country|nation|国家|国籍/i;function Of(e,t){const n=/country|nation|region|province|state|city|site|location|address|国家|国籍|地区|省|城市|地址|所在地|产地|区域/i,o=he(e,t.kn).filter(a=>a.type==="text"),s=a=>o.find(r=>a.test(r.name)||a.test(r.label))?.name;return s(zc)??s(n)}function Io(e){return e.outcomes}function Mo(e,t){return he(e,t.kn).filter(n=>n.type==="text").map(n=>n.name)}function za(e){return Array.isArray(e.series)&&e.series.some(t=>Se(t))}function Wa(e){return(e?.filter(t=>t.metric===void 0)??[]).flatMap(t=>{const n=Ec(t.when);return n?[n.field]:[]})}function qo(e,t){return e?.variables.find(n=>n.name===t)?.kind}function Ef(e){return(e.columns??[]).filter(t=>t.format==="text"||t.format==="tag").map(t=>t.field).filter(t=>typeof t=="string")}function Cf(e){return[...Object.values(e.regions).flatMap(t=>t??[]),...e.detail?[e.detail]:[]]}function Wc(e){const t=new Map;for(const n of Cf(e)){const o=un(n.type).emits?.(n.config,e)??[];for(const s of o){const a=t.get(s.variable)??[];a.push({...s,placement:n.id,source:typeof n.config.source=="string"?n.config.source:void 0}),t.set(s.variable,a)}}return t}function vn(e,t){const n=Wc(e);return e.variables.find(o=>o.kind==="value"&&((n.get(o.name)??[]).some(s=>s.field===t)||o.name===t))?.name}function Kc(e,t,n,o){const s=pe(e,n.source);if(!o.follows||!s)return[];const a=new Set(o.selectorKeys.map(h=>n[h])),r=he(s,t),l=(h,u)=>r.some(p=>p.name===h&&(!u||p.type===u)),c=Wc(e),i=h=>e.sources.find(u=>u.id===h)?.objectType,d=[];for(const h of e.variables){if(a.has(h.name))continue;const u=c.get(h.name)??[],p=u.filter(f=>i(f.source)===s.objectType);switch(h.kind){case"value":{const f=p.map(m=>m.field).find(m=>l(m))??(u.length===0&&l(h.name)?h.name:void 0);f&&d.push({variable:h.name,field:f});break}case"dateRange":{const f=p.map(m=>m.field).find(m=>l(m,"date"));f&&d.push({variable:h.name,field:f});break}case"search":{const f=[...new Set(p.flatMap(m=>m.fields??[]))].filter(m=>l(m,"text"));f.length>0&&d.push({variable:h.name,fields:f});break}case"set":i(h.source)===s.objectType&&d.push({variable:h.name});break}}return d}for(const e of Object.values(He)){if(!e.follows)continue;const t=e.defaults;e.defaults=(n,o,s)=>{const a=t(n,o,s);return{...a,filters:Kc(n,o.kn,a,e)}}}for(const[e,t]of Object.entries(wp)){const n=e===Te?dt:He[e];n.descriptors=[...n.descriptors,{key:"interactions",label:"点击后的动作",kind:"interactions",on:t,actOn:kp[e]??[],hit:!0,max:Ap,...Ra[e]?{offers:Ra[e]}:{},tab:"link",optional:!0}]}function Nf(e,t){return new Set([t,...e.sources.filter(n=>n.from?.source===t).map(n=>n.id)])}function Yc(e,t,n,o){if(o.size===0)return e;const s=structuredClone(e),a=d=>typeof d=="string"?o.get(d)??d:d,r=(d,h)=>{if(Array.isArray(d))return d.forEach(f=>r(f,h));if(typeof d!="object"||d===null)return;const u=d,p=typeof u.field=="string"?u.field:h;p===n&&(Array.isArray(u.values)&&(u.values=u.values.map(a)),"op"in u&&u.ref===void 0&&(u.value=a(u.value)));for(const[f,m]of Object.entries(u))f!=="values"&&r(m,p)},l=new Set,c=Nf(s,t);for(const d of s.pages)for(const h of[...Object.values(d.regions).flatMap(u=>u??[]),...d.detail?[d.detail]:[]])if(c.has(h.config.source)){r(h.config);for(const u of h.config.filters??[])u?.field===n&&l.add(u.variable)}for(const d of s.sources)d.from?.source===t&&r(d.from.where);s.variables=s.variables.map(d=>d.kind==="value"&&l.has(d.name)&&d.default!==void 0?{...d,default:a(d.default)}:d);const i=s.sources.find(d=>d.id===t);for(const d of i?.operations??[])r(d.when);for(const d of i?.computed??[])d.name!==n&&(d.kind==="classify"&&d.cases.forEach(h=>r(h.when)),d.kind==="days"&&r(d.when));i?.progress?.steps.forEach(d=>r(d.done));for(const d of Object.values(i?.formats??{}))d.colors?.forEach(h=>r(h.when));for(const d of i?.models??[])d.measures.forEach(h=>r(h.when));return s}const X=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function xf(e){if(e.ask===void 0&&e.act===void 0)return;const t=Array.isArray(e.interactions)?e.interactions:[],n=X(e.ask)?[Tp(e.ask)]:[],o=Array.isArray(e.act)?e.act.map(Op):[],s=[...t,...n,...o];s.length>0&&(e.interactions=s),delete e.ask,delete e.act}function Rf(e,t,n){const o=n.find(l=>l.id===t.source),s=X(o?.from)?o.from:void 0,a=s?n.find(l=>l.id===s.source):o,r=Array.isArray(t.adjustments)?t.adjustments:[];if(a){const l=Array.isArray(a.operations)?a.operations:[],c=new Set(l.map(i=>String(i.id)));for(const i of r){if(typeof i.field!="string")continue;let d=`shift_${i.field}`.replace(/[^A-Za-z0-9_]/g,"_");for(let h=2;c.has(d);h++)d=`shift_${i.field}_${h}`.replace(/[^A-Za-z0-9_]/g,"_");c.add(d),l.push({id:d,label:String(i.label??i.field).slice(0,30),...Array.isArray(i.when)&&i.when.length>0?{when:i.when}:{},params:[{name:"days",label:"天数",type:"number",...typeof i.min=="number"?{min:i.min}:{},...typeof i.max=="number"?{max:i.max}:{}}],effects:[{field:i.field,kind:"shiftDays",param:"days"}]})}l.length>0&&(a.operations=l)}e.type="scenarioBar",e.config={title:typeof t.title=="string"?t.title:"方案",style:"compact"}}function _f(e){const n=Object.values(e).filter(a=>Array.isArray(a)).flat(),o=a=>{const r=X(a.config)?a.config:{};return a.type==="scenarioBar"&&r.style===void 0&&(r.layout!==void 0||r.source===void 0)},s=n.some(a=>a.type==="scenarioCompare");for(const a of n){const r=X(a.config)?a.config:{};a.type==="scenarioCompare"?(a.type="scenarioBar",a.config={...r,style:"table"}):o(a)&&!s&&(delete r.layout,a.config={...r,style:"compact"})}if(s)for(const[a,r]of Object.entries(e))Array.isArray(r)&&(e[a]=r.filter(l=>!o(l)))}const Pf=new Set(["status","overdueDays","dueInDays"]);function Lf(e){const[t,n]=e.split("-").map(Number);return new Date(Date.UTC(t,n,0)).toISOString().slice(0,10)}function If(e){if(typeof e.appearsOn!="string")return null;const n=(Array.isArray(e.computed)?e.computed:[]).find(c=>c.name==="status"&&c.kind==="classify"),o=Array.isArray(n?.cases)?n.cases:[],s=Array.isArray(o[0]?.when)?o[0].when[0]:void 0,a=Array.isArray(o[1]?.when)?o[1].when[0]:void 0,r=a&&a.op==="before"&&a.ref===ue?String(a.field):void 0,l=[{label:"开始",field:e.appearsOn}];return s&&s.op==="onOrBefore"&&s.ref===ue?l.push({label:"完成",field:String(s.field)}):s&&s.op==="eq"&&r&&l.push({label:"完成",field:r,done:[{field:String(s.field),op:"eq",value:s.value}]}),{steps:l,...r?{due:{field:r}}:{}}}function Fo(e){if(typeof e.field!="string"||e.when!==void 0)return;const t=Array.isArray(e.values)?e.values:[];t.length>0&&(e.when=[{field:e.field,op:"in",values:t}]),delete e.field,delete e.values}function dr(e){if(Array.isArray(e))return e.forEach(dr);X(e)&&("sumField"in e&&(e.valueField===void 0&&(e.valueField=e.sumField),delete e.sumField),Object.values(e).forEach(dr))}function Mf(e){const t=new Map,o=(Array.isArray(e.computed)?e.computed:[]).find(r=>r.name==="status"&&r.kind==="classify");if(!o)return t;const s=Array.isArray(o.cases)?o.cases:[],a=[[s[0]?.value,re.done.value],[s[1]?.value,re.overdue.value],[X(o.otherwise)?o.otherwise.value:void 0,re.active.value]];for(const[r,l]of a)typeof r=="string"&&r!==l&&t.set(r,l);return t}function qf(e,t){for(const n of e){const o=X(n.regions)?n.regions:{};for(const s of Object.values(o))if(Array.isArray(s))for(const a of s){const r=X(a.config)?a.config:{},l=(Array.isArray(r.filters)?r.filters:[]).find(c=>c?.variable===t&&Array.isArray(c.fields));if(l?.fields)return l.fields}}}function Ff(e){if(!X(e))return e;let t=e;const n=Array.isArray(e.sources)?e.sources:[],o=Array.isArray(e.variables)?e.variables:[],s=new Map,a=new Set;for(const i of n){if(i.progress!==void 0)continue;const d=If(i);if(!d)continue;const h=Mf(i);if(h.size>0&&s.set(String(i.id),h),i.progress=d,a.add(String(i.id)),delete i.appearsOn,Array.isArray(i.computed)){const u=i.computed.filter(p=>!Pf.has(String(p.name)));u.length>0?i.computed=u:delete i.computed}}const r=new Map;for(const i of o)("field"in i||"fields"in i||i.kind==="month")&&(i.kind==="selection"||i.kind==="set"||(r.set(String(i.name),{...i}),i.kind==="month"&&(i.kind="dateRange",typeof i.default=="string"&&/^\d{4}-\d{2}$/.test(i.default)&&(i.default=`${i.default}-01..${Lf(i.default)}`)),delete i.source,delete i.field,delete i.fields));const l=o.filter(i=>i.kind==="set"),c=Array.isArray(e.pages)?e.pages:[];for(const i of c){const d=X(i.regions)?i.regions:{};_f(d);const h=[...Object.values(d).flatMap(u=>Array.isArray(u)?u:[]),...X(i.detail)?[i.detail]:[]];for(const u of h){const p=u.type,f=X(u.config)?u.config:null;if(!f)continue;if(p==="whatIf"){Rf(u,f,n);continue}if(dr(f),xf(f),p==="metricCards"&&Array.isArray(f.items)&&f.items.forEach(b=>X(b)&&Fo(b)),p==="pivotTable"&&Array.isArray(f.measures)&&f.measures.forEach(b=>X(b)&&Fo(b)),p==="objectList"&&Fo(f),p==="regionMap"&&Array.isArray(f.links)){const b=f.links.filter(k=>Array.isArray(k?.path)&&k.path.length===1);b.length>0?f.links=b:delete f.links}if(p===Te&&Array.isArray(f.progress)&&(f.progress.length>0&&(f.showProgress=!0),delete f.progress),!Ve.includes(p))continue;const m=un(p);if(p==="searchBox"&&typeof f.writes=="string"&&!f.fields){const b=r.get(f.writes)?.fields??qf(c,f.writes);Array.isArray(b)&&b.length>0&&(f.fields=b)}if(p==="objectTable"&&typeof f.quickFilter=="string"&&!f.quickField){const b=r.get(f.quickFilter);typeof b?.field=="string"&&(f.quickField=b.field)}if(!m.follows||f.filters!==void 0||typeof f.source!="string")continue;const g=new Set(m.selectorKeys.map(b=>f[b])),y=[];for(const[b,k]of r)g.has(b)||k.source!==f.source||(Array.isArray(k.fields)?y.push({variable:b,fields:k.fields}):typeof k.field=="string"&&y.push({variable:b,field:k.field}));for(const b of l)!g.has(b.name)&&b.source===f.source&&y.push({variable:String(b.name)});f.filters=y}}for(const[i,d]of s)t=Yc(t,i,"status",d);return a.size>0&&(t=Yf(t,a)),zf(t),Df(t),t}function Df(e){const t=Array.isArray(e.eventTypes)?e.eventTypes:[];for(const n of t)if(X(n)){for(const o of["label","source","subject","severity","rule"])delete n[o];X(n.report)&&delete n.report.mergeHours}}const Bf=/^[a-z0-9][a-z0-9_.-]{0,63}$/;function Uf(e,t){const n=e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase().replace(/[^a-z0-9_.-]/g,"_").replace(/^[^a-z0-9]+/,"").slice(0,64)||"event";let o=n;for(let s=2;t.has(o);s+=1)o=`${n.slice(0,64-String(s).length)}${s}`;return o}function zf(e){const t=Array.isArray(e.eventTypes)?e.eventTypes:[],n=new Set(t.map(a=>String(a.id))),o=new Map;for(const a of t){const r=a.id;if(typeof r!="string"||Bf.test(r))continue;n.delete(r);const l=Uf(r,n);n.add(l),o.set(r,l),a.id=l}if(o.size===0)return;const s=a=>typeof a=="string"?o.get(a)??a:a;for(const a of Array.isArray(e.sources)?e.sources:[]){const r=X(a.events)?a.events:void 0;Array.isArray(r?.types)&&(r.types=r.types.map(s))}for(const a of Array.isArray(e.pages)?e.pages:[]){const l=[...(X(a.regions)?Object.values(a.regions):[]).flatMap(c=>Array.isArray(c)?c:[]),...X(a.detail)?[a.detail]:[]];for(const c of l){if(!Ve.includes(c.type)||!X(c.config))continue;const i=c.config;for(const d of un(c.type).descriptors){if(d.kind!=="eventType"||i[d.key]===void 0)continue;const h=i[d.key];i[d.key]=Array.isArray(h)?h.map(s):s(h)}}}}const Wf=new Map([["status",le.status],["stage",le.stage],["overdueDays",le.overdueDays],["dueInDays",le.dueInDays]]),Kf=new Map(Object.values(re).map(e=>[e.label,e.value]));function Gc(e,t,n){const o=s=>typeof s=="string"?n(s):s;for(const s of e){const a=t[s.key],r=!("owner"in s)||s.owner!=="objectType";if(s.kind==="field"&&r)t[s.key]=o(a);else if(s.kind==="fields"&&r&&Array.isArray(a))t[s.key]=a.map(o);else if(s.kind==="conditions"&&Array.isArray(a))for(const l of a)X(l)&&(l.field=o(l.field),l.ref!==void 0&&(l.ref=o(l.ref)));else if(s.kind==="bindings"&&Array.isArray(a))for(const l of a)X(l)&&(l.field!==void 0&&(l.field=o(l.field)),Array.isArray(l.fields)&&(l.fields=l.fields.map(o)));else if(s.kind==="list"&&Array.isArray(a))for(const l of a)X(l)&&Gc(s.item,l,n)}}function Yf(e,t){let n=structuredClone(e);const o=a=>Wf.get(a)??a,s=a=>a.replace(/(?<![$\w`])(status|stage|overdueDays|dueInDays)\b/g,r=>o(r));for(const a of n.sources){if(!a.progress||t&&!t.has(a.id))continue;const r=new Set(n.sources.filter(c=>c.id===a.id||c.from?.source===a.id).map(c=>c.id));for(const c of n.pages)for(const i of[...Object.values(c.regions).flatMap(d=>d??[]),...c.detail?[c.detail]:[]])r.has(i.config.source)&&Gc(un(i.type).descriptors,i.config,o);const l=c=>c?.forEach(i=>{i.field=o(i.field),i.ref!==void 0&&(i.ref=o(i.ref))});a.formats&&(a.formats=Object.fromEntries(Object.entries(a.formats).map(([c,i])=>(i.colors?.forEach(d=>l(d.when)),[o(c),i]))));for(const c of n.sources)if(c.from?.source===a.id){l(c.from.where);for(const i of c.from.filters??[])i.field!==void 0&&(i.field=o(i.field)),i.fields&&(i.fields=i.fields.map(o))}for(const c of a.operations??[])l(c.when);for(const c of a.computed??[])c.kind==="classify"&&c.cases.forEach(i=>l(i.when)),c.kind==="days"&&(c.from=o(c.from),c.to=o(c.to),l(c.when)),c.kind==="formula"&&(c.expr=s(c.expr));n=Yc(n,a.id,le.status,Kf)}return n}const pt="workshop.openbkn.ai/v1",Gf=["tabs","cards","segmented","side"],Hf=["dashboard","table","chart","map","alert","task","calendar","relation","search","agent","team","setting"],Vf=["tasks","alerts"];function Ka(e,t){const n=e.pages.find(o=>o.id===t)??e.pages[0];return{version:2,title:n.title,layout:n.layout,sources:e.sources,variables:e.variables,...e.eventTypes?{eventTypes:e.eventTypes}:{},...e.scenarioParams?{scenarioParams:e.scenarioParams}:{},...e.components?{components:e.components}:{},regions:n.regions,detail:n.detail,theme:e.theme,...n.linking?{linking:n.linking}:{},...e.linkPaths?{linkPaths:e.linkPaths}:{}}}function Jf(e){if(typeof e!="object"||e===null)return e;const t=Ff(structuredClone(e)),n=t.pages;if(!Array.isArray(n))return t;for(const o of n)for(const s of Object.values(o?.regions??{}))if(Array.isArray(s))for(const a of s)a?.type==="agentChat"&&a.config&&delete a.config.source;return t}var Do={exports:{}},P={};var Ya;function Zf(){if(Ya)return P;Ya=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),r=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),i=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),u=Symbol.iterator;function p($){return $===null||typeof $!="object"?null:($=u&&$[u]||$["@@iterator"],typeof $=="function"?$:null)}var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,g={};function y($,T,C){this.props=$,this.context=T,this.refs=g,this.updater=C||f}y.prototype.isReactComponent={},y.prototype.setState=function($,T){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,T,"setState")},y.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function b(){}b.prototype=y.prototype;function k($,T,C){this.props=$,this.context=T,this.refs=g,this.updater=C||f}var w=k.prototype=new b;w.constructor=k,m(w,y.prototype),w.isPureReactComponent=!0;var v=Array.isArray;function S(){}var j={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function A($,T,C){var R=C.ref;return{$$typeof:e,type:$,key:T,ref:R!==void 0?R:null,props:C}}function E($,T){return A($.type,T,$.props)}function x($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function M($){var T={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(C){return T[C]})}var q=/\/+/g;function L($,T){return typeof $=="object"&&$!==null&&$.key!=null?M(""+$.key):T.toString(36)}function ne($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(S,S):($.status="pending",$.then(function(T){$.status==="pending"&&($.status="fulfilled",$.value=T)},function(T){$.status==="pending"&&($.status="rejected",$.reason=T)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function I($,T,C,R,z){var Y=typeof $;(Y==="undefined"||Y==="boolean")&&($=null);var V=!1;if($===null)V=!0;else switch(Y){case"bigint":case"string":case"number":V=!0;break;case"object":switch($.$$typeof){case e:case t:V=!0;break;case d:return V=$._init,I(V($._payload),T,C,R,z)}}if(V)return z=z($),V=R===""?"."+L($,0):R,v(z)?(C="",V!=null&&(C=V.replace(q,"$&/")+"/"),I(z,T,C,"",function(mu){return mu})):z!=null&&(x(z)&&(z=E(z,C+(z.key==null||$&&$.key===z.key?"":(""+z.key).replace(q,"$&/")+"/")+V)),T.push(z)),1;V=0;var qe=R===""?".":R+":";if(v($))for(var ke=0;ke<$.length;ke++)R=$[ke],Y=qe+L(R,ke),V+=I(R,T,C,Y,z);else if(ke=p($),typeof ke=="function")for($=ke.call($),ke=0;!(R=$.next()).done;)R=R.value,Y=qe+L(R,ke++),V+=I(R,T,C,Y,z);else if(Y==="object"){if(typeof $.then=="function")return I(ne($),T,C,R,z);throw T=String($),Error("Objects are not valid as a React child (found: "+(T==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":T)+"). If you meant to render a collection of children, use an array instead.")}return V}function N($,T,C){if($==null)return $;var R=[],z=0;return I($,R,"","",function(Y){return T.call(C,Y,z++)}),R}function Z($){if($._status===-1){var T=$._result;T=T(),T.then(function(C){($._status===0||$._status===-1)&&($._status=1,$._result=C)},function(C){($._status===0||$._status===-1)&&($._status=2,$._result=C)}),$._status===-1&&($._status=0,$._result=T)}if($._status===1)return $._result.default;throw $._result}var U=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var T=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(T))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)},oe={map:N,forEach:function($,T,C){N($,function(){T.apply(this,arguments)},C)},count:function($){var T=0;return N($,function(){T++}),T},toArray:function($){return N($,function(T){return T})||[]},only:function($){if(!x($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return P.Activity=h,P.Children=oe,P.Component=y,P.Fragment=n,P.Profiler=s,P.PureComponent=k,P.StrictMode=o,P.Suspense=c,P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,P.__COMPILER_RUNTIME={__proto__:null,c:function($){return j.H.useMemoCache($)}},P.cache=function($){return function(){return $.apply(null,arguments)}},P.cacheSignal=function(){return null},P.cloneElement=function($,T,C){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var R=m({},$.props),z=$.key;if(T!=null)for(Y in T.key!==void 0&&(z=""+T.key),T)!O.call(T,Y)||Y==="key"||Y==="__self"||Y==="__source"||Y==="ref"&&T.ref===void 0||(R[Y]=T[Y]);var Y=arguments.length-2;if(Y===1)R.children=C;else if(1<Y){for(var V=Array(Y),qe=0;qe<Y;qe++)V[qe]=arguments[qe+2];R.children=V}return A($.type,z,R)},P.createContext=function($){return $={$$typeof:r,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:a,_context:$},$},P.createElement=function($,T,C){var R,z={},Y=null;if(T!=null)for(R in T.key!==void 0&&(Y=""+T.key),T)O.call(T,R)&&R!=="key"&&R!=="__self"&&R!=="__source"&&(z[R]=T[R]);var V=arguments.length-2;if(V===1)z.children=C;else if(1<V){for(var qe=Array(V),ke=0;ke<V;ke++)qe[ke]=arguments[ke+2];z.children=qe}if($&&$.defaultProps)for(R in V=$.defaultProps,V)z[R]===void 0&&(z[R]=V[R]);return A($,Y,z)},P.createRef=function(){return{current:null}},P.forwardRef=function($){return{$$typeof:l,render:$}},P.isValidElement=x,P.lazy=function($){return{$$typeof:d,_payload:{_status:-1,_result:$},_init:Z}},P.memo=function($,T){return{$$typeof:i,type:$,compare:T===void 0?null:T}},P.startTransition=function($){var T=j.T,C={};j.T=C;try{var R=$(),z=j.S;z!==null&&z(C,R),typeof R=="object"&&R!==null&&typeof R.then=="function"&&R.then(S,U)}catch(Y){U(Y)}finally{T!==null&&C.types!==null&&(T.types=C.types),j.T=T}},P.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},P.use=function($){return j.H.use($)},P.useActionState=function($,T,C){return j.H.useActionState($,T,C)},P.useCallback=function($,T){return j.H.useCallback($,T)},P.useContext=function($){return j.H.useContext($)},P.useDebugValue=function(){},P.useDeferredValue=function($,T){return j.H.useDeferredValue($,T)},P.useEffect=function($,T){return j.H.useEffect($,T)},P.useEffectEvent=function($){return j.H.useEffectEvent($)},P.useId=function(){return j.H.useId()},P.useImperativeHandle=function($,T,C){return j.H.useImperativeHandle($,T,C)},P.useInsertionEffect=function($,T){return j.H.useInsertionEffect($,T)},P.useLayoutEffect=function($,T){return j.H.useLayoutEffect($,T)},P.useMemo=function($,T){return j.H.useMemo($,T)},P.useOptimistic=function($,T){return j.H.useOptimistic($,T)},P.useReducer=function($,T,C){return j.H.useReducer($,T,C)},P.useRef=function($){return j.H.useRef($)},P.useState=function($){return j.H.useState($)},P.useSyncExternalStore=function($,T,C){return j.H.useSyncExternalStore($,T,C)},P.useTransition=function(){return j.H.useTransition()},P.version="19.2.8",P}var Ga;function Xf(){return Ga||(Ga=1,Do.exports=Zf()),Do.exports}Xf();const Qf={skipErrorToast:!0},Lr=e=>`/bkn-backend/v1/knowledge-networks/${encodeURIComponent(e)}`,Bo=100,em=50;async function Ir(e,t={}){const n=[];for(let o=0;o<em;o+=1){const{data:s}=await st.get(e,{...Qf,params:{...t,limit:Bo,offset:o*Bo}}),a=s.entries??[];if(n.push(...a),a.length<Bo||n.length>=(s.total_count??1/0))break}return n}async function tm(e,t){return(await Ir(`${Lr(e)}/action-types`,{operation_kind:"event"})).filter(o=>o.id&&o.operation_config?.type==="event"&&!0)}function nm(e){const t=e.schedule;return t?.expression?{...t.type?{type:t.type}:{},expression:t.expression,...t.timezone?{timezone:t.timezone}:{}}:null}async function om(e,t){return(await Ir(`${Lr(e)}/action-schedules`,{})).filter(o=>o.id&&o.source==="action_type"&&!0)}function sm(e,t,n){const o=e.id??"",s=e.event??{},a=s.source==="rule"?"rule":"report",r=t?.find(i=>i.operation_config?.event_class===o),l=r&&n?.find(i=>i.action_type_id===r.id),c=l?.next_run_time;return{code:o,name:e.name||o,source:a,...s.subject?{subject:s.subject}:{},...s.severity?{severity:s.severity}:{},...s.merge_hours?{merge_hours:s.merge_hours}:{},...a==="rule"&&t?{recognition_action_id:r?.id??null,check_schedule:r?nm(r):null,...r&&n?{platform_schedule_id:l?.id??null}:{}}:{},...c?{next_check_at:c}:{}}}async function rm(e){const[t,n,o]=await Promise.all([Ir(`${Lr(e)}/object-types`),tm(e).catch(()=>{}),om(e).catch(()=>{})]);return t.filter(s=>s.id&&Array.isArray(s.kinds)&&s.kinds.includes("event")).map(s=>sm(s,n,o))}Math.random().toString(36).slice(2);const am=new Map;Math.random().toString(36).slice(2);function im(){for(const e of am.values())if(e.dirty.size>0||e.writing.size>0||e.failed.size>0)return!0;return!1}typeof window<"u"&&window.addEventListener("beforeunload",e=>{im()&&(e.preventDefault(),e.returnValue="")});const lm=new Map;function cm(e,t){lm.set(e,Promise.resolve(t))}class Hc extends Error{constructor(t){super("draft changed since it was read"),this.currentRevision=t}currentRevision}class Mr extends Error{constructor(){super("app not found")}}class qr extends Error{constructor(){super("not allowed")}}class Vc extends Error{constructor(){super("app too large")}}class dm extends Error{constructor(t){super("event types missing on the network"),this.eventTypes=t}eventTypes}const Fr="/workshop/v1",hn={skipErrorToast:!0},um=200;function hm(e){const t=e?.response,n=t?.status,o=t?.data?.metadata;if(n===404)return new Mr;if(n===403)return new qr;if(n===413)return new Vc;if(n===409){if(typeof o?.current_revision=="number")return new Hc(o.current_revision);if(Array.isArray(o?.event_types))return new dm(o.event_types.map(String))}return e}async function pn(e){try{return(await e()).data}catch(t){throw hm(t)}}function pm(){return`ws-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}const Ha=e=>({id:e?.id??"",name:e?.name||e?.id||""});function fm(e){return!e||typeof e!="object"||!Array.isArray(e.pages)?null:Jf(e)}function Jc(e){const t=e.tags??[],n=(e.references??[]).map(Ha);return{id:e.id,name:e.name,...e.description?{description:e.description}:{},...e.icon?{icon:e.icon}:{},...e.color?{color:e.color}:{},...t.length>0?{tags:t}:{},...n.length>0?{references:n}:{},network:Ha(e.kn),version:e.current_version??0,revision:e.draft_revision??0,creator:e.creator??"",updatedAt:e.update_time??0,operations:e.operations??[],...e.managed_by?{managedBy:e.managed_by}:{},...e.workspace_id?{workspaceId:e.workspace_id}:{}}}const Dr=e=>({...Jc(e),draft:fm(e.draft)}),Br=e=>`${Fr}/apps/${encodeURIComponent(e)}`;async function mm(){const e=[];let t="";for(const n=new Set;;n.add(t)){const o=new URLSearchParams({limit:String(um)});t&&o.set("cursor",t);const s=await pn(()=>st.get(`${Fr}/apps`,{...hn,params:o}));if(e.push(...(s.entries??[]).map(Jc)),t=s.next_cursor??"",!t||n.has(t))return e}}async function gm(e){try{const t=Dr(await pn(()=>st.get(Br(e),hn)));return cm(e,t.workspaceId),t}catch(t){if(t instanceof Mr)return null;throw t}}const ym=e=>({name:e.name,description:e.description?.trim()??"",...e.icon?{icon:e.icon}:{},...e.color?{color:e.color}:{},tags:e.tags??[],references:(e.references??[]).map(({id:t,name:n})=>({id:t,name:n}))});async function bm(e,t,n,o={},s){const a=await pn(()=>st.post(`${Fr}/apps`,{...ym({...o,name:e}),kn:{id:t.id,name:t.name},draft:n,...s?{workspace_id:s}:{}},{...hn,headers:{"Idempotency-Key":pm()}}));return Dr(a)}async function wm(e,t,n){return Dr(await pn(()=>st.put(`${Br(e)}/draft`,{draft:t,revision:n},hn)))}async function km(e,t,n="upload"){const o=await pn(()=>st.post(`${Br(e)}/component-packages`,t,{...hn,params:{source:n},headers:{"Content-Type":"application/zip"}}));return{id:o.package.id,type:o.package.type,version:o.package.version,manifest:o.package.manifest,warnings:o.warnings??[]}}var W={},Uo={},zo={},de={},Va;function B(){if(Va)return de;Va=1;const e=Symbol.for("yaml.alias"),t=Symbol.for("yaml.document"),n=Symbol.for("yaml.map"),o=Symbol.for("yaml.pair"),s=Symbol.for("yaml.scalar"),a=Symbol.for("yaml.seq"),r=Symbol.for("yaml.node.type"),l=g=>!!g&&typeof g=="object"&&g[r]===e,c=g=>!!g&&typeof g=="object"&&g[r]===t,i=g=>!!g&&typeof g=="object"&&g[r]===n,d=g=>!!g&&typeof g=="object"&&g[r]===o,h=g=>!!g&&typeof g=="object"&&g[r]===s,u=g=>!!g&&typeof g=="object"&&g[r]===a;function p(g){if(g&&typeof g=="object")switch(g[r]){case n:case a:return!0}return!1}function f(g){if(g&&typeof g=="object")switch(g[r]){case e:case n:case s:case a:return!0}return!1}const m=g=>(h(g)||p(g))&&!!g.anchor;return de.ALIAS=e,de.DOC=t,de.MAP=n,de.NODE_TYPE=r,de.PAIR=o,de.SCALAR=s,de.SEQ=a,de.hasAnchor=m,de.isAlias=l,de.isCollection=p,de.isDocument=c,de.isMap=i,de.isNode=f,de.isPair=d,de.isScalar=h,de.isSeq=u,de}var $n={},Ja;function io(){if(Ja)return $n;Ja=1;var e=B();const t=Symbol("break visit"),n=Symbol("skip children"),o=Symbol("remove node");function s(h,u){const p=c(u);e.isDocument(h)?a(null,h.contents,p,Object.freeze([h]))===o&&(h.contents=null):a(null,h,p,Object.freeze([]))}s.BREAK=t,s.SKIP=n,s.REMOVE=o;function a(h,u,p,f){const m=i(h,u,p,f);if(e.isNode(m)||e.isPair(m))return d(h,f,m),a(h,m,p,f);if(typeof m!="symbol"){if(e.isCollection(u)){f=Object.freeze(f.concat(u));for(let g=0;g<u.items.length;++g){const y=a(g,u.items[g],p,f);if(typeof y=="number")g=y-1;else{if(y===t)return t;y===o&&(u.items.splice(g,1),g-=1)}}}else if(e.isPair(u)){f=Object.freeze(f.concat(u));const g=a("key",u.key,p,f);if(g===t)return t;g===o&&(u.key=null);const y=a("value",u.value,p,f);if(y===t)return t;y===o&&(u.value=null)}}return m}async function r(h,u){const p=c(u);e.isDocument(h)?await l(null,h.contents,p,Object.freeze([h]))===o&&(h.contents=null):await l(null,h,p,Object.freeze([]))}r.BREAK=t,r.SKIP=n,r.REMOVE=o;async function l(h,u,p,f){const m=await i(h,u,p,f);if(e.isNode(m)||e.isPair(m))return d(h,f,m),l(h,m,p,f);if(typeof m!="symbol"){if(e.isCollection(u)){f=Object.freeze(f.concat(u));for(let g=0;g<u.items.length;++g){const y=await l(g,u.items[g],p,f);if(typeof y=="number")g=y-1;else{if(y===t)return t;y===o&&(u.items.splice(g,1),g-=1)}}}else if(e.isPair(u)){f=Object.freeze(f.concat(u));const g=await l("key",u.key,p,f);if(g===t)return t;g===o&&(u.key=null);const y=await l("value",u.value,p,f);if(y===t)return t;y===o&&(u.value=null)}}return m}function c(h){return typeof h=="object"&&(h.Collection||h.Node||h.Value)?Object.assign({Alias:h.Node,Map:h.Node,Scalar:h.Node,Seq:h.Node},h.Value&&{Map:h.Value,Scalar:h.Value,Seq:h.Value},h.Collection&&{Map:h.Collection,Seq:h.Collection},h):h}function i(h,u,p,f){if(typeof p=="function")return p(h,u,f);if(e.isMap(u))return p.Map?.(h,u,f);if(e.isSeq(u))return p.Seq?.(h,u,f);if(e.isPair(u))return p.Pair?.(h,u,f);if(e.isScalar(u))return p.Scalar?.(h,u,f);if(e.isAlias(u))return p.Alias?.(h,u,f)}function d(h,u,p){const f=u[u.length-1];if(e.isCollection(f))f.items[h]=p;else if(e.isPair(f))h==="key"?f.key=p:f.value=p;else if(e.isDocument(f))f.contents=p;else{const m=e.isAlias(f)?"alias":"scalar";throw new Error(`Cannot replace node with ${m} parent`)}}return $n.visit=s,$n.visitAsync=r,$n}var Za;function Zc(){if(Za)return zo;Za=1;var e=B(),t=io();const n={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},o=a=>a.replace(/[!,[\]{}]/g,r=>n[r]);class s{constructor(r,l){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,r),this.tags=Object.assign({},s.defaultTags,l)}clone(){const r=new s(this.yaml,this.tags);return r.docStart=this.docStart,r}atDocument(){const r=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return r}add(r,l){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);const c=r.trim().split(/[ \t]+/),i=c.shift();switch(i){case"%TAG":{if(c.length!==2&&(l(0,"%TAG directive should contain exactly two parts"),c.length<2))return!1;const[d,h]=c;return this.tags[d]=h,!0}case"%YAML":{if(this.yaml.explicit=!0,c.length!==1)return l(0,"%YAML directive should contain exactly one part"),!1;const[d]=c;if(d==="1.1"||d==="1.2")return this.yaml.version=d,!0;{const h=/^\d+\.\d+$/.test(d);return l(6,`Unsupported YAML version ${d}`,h),!1}}default:return l(0,`Unknown directive ${i}`,!0),!1}}tagName(r,l){if(r==="!")return"!";if(r[0]!=="!")return l(`Not a valid tag: ${r}`),null;if(r[1]==="<"){const h=r.slice(2,-1);return h==="!"||h==="!!"?(l(`Verbatim tags aren't resolved, so ${r} is invalid.`),null):(r[r.length-1]!==">"&&l("Verbatim tags must end with a >"),h)}const[,c,i]=r.match(/^(.*!)([^!]*)$/s);i||l(`The ${r} tag has no suffix`);const d=this.tags[c];if(d)try{return d+decodeURIComponent(i)}catch(h){return l(String(h)),null}return c==="!"?r:(l(`Could not resolve tag: ${r}`),null)}tagString(r){for(const[l,c]of Object.entries(this.tags))if(r.startsWith(c))return l+o(r.substring(c.length));return r[0]==="!"?r:`!<${r}>`}toString(r){const l=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],c=Object.entries(this.tags);let i;if(r&&c.length>0&&e.isNode(r.contents)){const d={};t.visit(r.contents,(h,u)=>{e.isNode(u)&&u.tag&&(d[u.tag]=!0)}),i=Object.keys(d)}else i=[];for(const[d,h]of c)d==="!!"&&h==="tag:yaml.org,2002:"||(!r||i.some(u=>u.startsWith(h)))&&l.push(`%TAG ${d} ${h}`);return l.join(`
|
|
19
|
+
`)}}return s.defaultYaml={explicit:!1,version:"1.2"},s.defaultTags={"!!":"tag:yaml.org,2002:"},zo.Directives=s,zo}var Wo={},Ko={},kt={},Xa;function Ur(){if(Xa)return kt;Xa=1;var e=B(),t=io();function n(r){if(/[\x00-\x19\s,[\]{}]/.test(r)){const c=`Anchor must not contain whitespace or control characters: ${JSON.stringify(r)}`;throw new Error(c)}return!0}function o(r){const l=new Set;return t.visit(r,{Value(c,i){i.anchor&&l.add(i.anchor)}}),l}function s(r,l){for(let c=1;;++c){const i=`${r}${c}`;if(!l.has(i))return i}}function a(r,l){const c=[],i=new Map;let d=null;return{onAnchor:h=>{c.push(h),d??(d=o(r));const u=s(l,d);return d.add(u),u},setAnchors:()=>{for(const h of c){const u=i.get(h);if(typeof u=="object"&&u.anchor&&(e.isScalar(u.node)||e.isCollection(u.node)))u.node.anchor=u.anchor;else{const p=new Error("Failed to resolve repeated object (this should not happen)");throw p.source=h,p}}},sourceObjects:i}}return kt.anchorIsValid=n,kt.anchorNames=o,kt.createNodeAnchors=a,kt.findNewAnchor=s,kt}var Yo={},Go={},Qa;function Xc(){if(Qa)return Go;Qa=1;function e(t,n,o,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let a=0,r=s.length;a<r;++a){const l=s[a],c=e(t,s,String(a),l);c===void 0?delete s[a]:c!==l&&(s[a]=c)}else if(s instanceof Map)for(const a of Array.from(s.keys())){const r=s.get(a),l=e(t,s,a,r);l===void 0?s.delete(a):l!==r&&s.set(a,l)}else if(s instanceof Set)for(const a of Array.from(s)){const r=e(t,s,a,a);r===void 0?s.delete(a):r!==a&&(s.delete(a),s.add(r))}else for(const[a,r]of Object.entries(s)){const l=e(t,s,a,r);l===void 0?delete s[a]:l!==r&&(s[a]=l)}return t.call(n,o,s)}return Go.applyReviver=e,Go}var Ho={},ei;function ft(){if(ei)return Ho;ei=1;var e=B();function t(n,o,s){if(Array.isArray(n))return n.map((a,r)=>t(a,String(r),s));if(n&&typeof n.toJSON=="function"){if(!s||!e.hasAnchor(n))return n.toJSON(o,s);const a={aliasCount:0,count:1,res:void 0};s.anchors.set(n,a),s.onCreate=l=>{a.res=l,delete s.onCreate};const r=n.toJSON(o,s);return s.onCreate&&s.onCreate(r),r}return typeof n=="bigint"&&!s?.keep?Number(n):n}return Ho.toJS=t,Ho}var ti;function zr(){if(ti)return Yo;ti=1;var e=Xc(),t=B(),n=ft();class o{constructor(a){Object.defineProperty(this,t.NODE_TYPE,{value:a})}clone(){const a=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(a.range=this.range.slice()),a}toJS(a,{mapAsMap:r,maxAliasCount:l,onAnchor:c,reviver:i}={}){if(!t.isDocument(a))throw new TypeError("A document argument is required");const d={anchors:new Map,doc:a,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof l=="number"?l:100},h=n.toJS(this,"",d);if(typeof c=="function")for(const{count:u,res:p}of d.anchors.values())c(p,u);return typeof i=="function"?e.applyReviver(i,{"":h},"",h):h}}return Yo.NodeBase=o,Yo}var ni;function lo(){if(ni)return Ko;ni=1;var e=Ur(),t=io(),n=B(),o=zr(),s=ft();let a=class extends o.NodeBase{constructor(c){super(n.ALIAS),this.source=c,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(c,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let d;i?.aliasResolveCache?d=i.aliasResolveCache:(d=[],t.visit(c,{Node:(u,p)=>{(n.isAlias(p)||n.hasAnchor(p))&&d.push(p)}}),i&&(i.aliasResolveCache=d));let h;for(const u of d){if(u===this)break;u.anchor===this.source&&(h=u)}return h}toJSON(c,i){if(!i)return{source:this.source};const{anchors:d,doc:h,maxAliasCount:u}=i,p=this.resolve(h,i);if(!p){const m=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(m)}let f=d.get(p);if(f||(s.toJS(p,null,i),f=d.get(p)),f?.res===void 0){const m="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(m)}if(u>=0&&(f.count+=1,f.aliasCount===0&&(f.aliasCount=r(h,p,d)),f.count*f.aliasCount>u)){const m="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(m)}return f.res}toString(c,i,d){const h=`*${this.source}`;if(c){if(e.anchorIsValid(this.source),c.options.verifyAliasOrder&&!c.anchors.has(this.source)){const u=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(u)}if(c.implicitKey)return`${h} `}return h}};function r(l,c,i){if(n.isAlias(c)){const d=c.resolve(l),h=i&&d&&i.get(d);return h?h.count*h.aliasCount:0}else if(n.isCollection(c)){let d=0;for(const h of c.items){const u=r(l,h,i);u>d&&(d=u)}return d}else if(n.isPair(c)){const d=r(l,c.key,i),h=r(l,c.value,i);return Math.max(d,h)}return 1}return Ko.Alias=a,Ko}var qt={},Vo={},Sn={},oi;function ce(){if(oi)return Sn;oi=1;var e=B(),t=zr(),n=ft();const o=a=>!a||typeof a!="function"&&typeof a!="object";let s=class extends t.NodeBase{constructor(r){super(e.SCALAR),this.value=r}toJSON(r,l){return l?.keep?this.value:n.toJS(this.value,r,l)}toString(){return String(this.value)}};return s.BLOCK_FOLDED="BLOCK_FOLDED",s.BLOCK_LITERAL="BLOCK_LITERAL",s.PLAIN="PLAIN",s.QUOTE_DOUBLE="QUOTE_DOUBLE",s.QUOTE_SINGLE="QUOTE_SINGLE",Sn.Scalar=s,Sn.isScalarValue=o,Sn}var si;function co(){if(si)return Vo;si=1;var e=lo(),t=B(),n=ce();const o="tag:yaml.org,2002:";function s(r,l,c){if(l){const i=c.filter(h=>h.tag===l),d=i.find(h=>!h.format)??i[0];if(!d)throw new Error(`Tag ${l} not found`);return d}return c.find(i=>i.identify?.(r)&&!i.format)}function a(r,l,c){if(t.isDocument(r)&&(r=r.contents),t.isNode(r))return r;if(t.isPair(r)){const y=c.schema[t.MAP].createNode?.(c.schema,null,c);return y.items.push(r),y}(r instanceof String||r instanceof Number||r instanceof Boolean||typeof BigInt<"u"&&r instanceof BigInt)&&(r=r.valueOf());const{aliasDuplicateObjects:i,onAnchor:d,onTagObj:h,schema:u,sourceObjects:p}=c;let f;if(i&&r&&typeof r=="object"){if(f=p.get(r),f)return f.anchor??(f.anchor=d(r)),new e.Alias(f.anchor);f={anchor:null,node:null},p.set(r,f)}l?.startsWith("!!")&&(l=o+l.slice(2));let m=s(r,l,u.tags);if(!m){if(r&&typeof r.toJSON=="function"&&(r=r.toJSON()),!r||typeof r!="object"){const y=new n.Scalar(r);return f&&(f.node=y),y}m=r instanceof Map?u[t.MAP]:Symbol.iterator in Object(r)?u[t.SEQ]:u[t.MAP]}h&&(h(m),delete c.onTagObj);const g=m?.createNode?m.createNode(c.schema,r,c):typeof m?.nodeClass?.from=="function"?m.nodeClass.from(c.schema,r,c):new n.Scalar(r);return l?g.tag=l:m.default||(g.tag=m.tag),f&&(f.node=g),g}return Vo.createNode=a,Vo}var ri;function Wr(){if(ri)return qt;ri=1;var e=co(),t=B(),n=zr();function o(r,l,c){let i=c;for(let d=l.length-1;d>=0;--d){const h=l[d];if(typeof h=="number"&&Number.isInteger(h)&&h>=0){const u=[];u[h]=i,i=u}else i=new Map([[h,i]])}return e.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:r,sourceObjects:new Map})}const s=r=>r==null||typeof r=="object"&&!!r[Symbol.iterator]().next().done;let a=class extends n.NodeBase{constructor(l,c){super(l),Object.defineProperty(this,"schema",{value:c,configurable:!0,enumerable:!1,writable:!0})}clone(l){const c=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return l&&(c.schema=l),c.items=c.items.map(i=>t.isNode(i)||t.isPair(i)?i.clone(l):i),this.range&&(c.range=this.range.slice()),c}addIn(l,c){if(s(l))this.add(c);else{const[i,...d]=l,h=this.get(i,!0);if(t.isCollection(h))h.addIn(d,c);else if(h===void 0&&this.schema)this.set(i,o(this.schema,d,c));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${d}`)}}deleteIn(l){const[c,...i]=l;if(i.length===0)return this.delete(c);const d=this.get(c,!0);if(t.isCollection(d))return d.deleteIn(i);throw new Error(`Expected YAML collection at ${c}. Remaining path: ${i}`)}getIn(l,c){const[i,...d]=l,h=this.get(i,!0);return d.length===0?!c&&t.isScalar(h)?h.value:h:t.isCollection(h)?h.getIn(d,c):void 0}hasAllNullValues(l){return this.items.every(c=>{if(!t.isPair(c))return!1;const i=c.value;return i==null||l&&t.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(l){const[c,...i]=l;if(i.length===0)return this.has(c);const d=this.get(c,!0);return t.isCollection(d)?d.hasIn(i):!1}setIn(l,c){const[i,...d]=l;if(d.length===0)this.set(i,c);else{const h=this.get(i,!0);if(t.isCollection(h))h.setIn(d,c);else if(h===void 0&&this.schema)this.set(i,o(this.schema,d,c));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${d}`)}}};return qt.Collection=a,qt.collectionFromPath=o,qt.isEmptyPath=s,qt}var jn={},Jo={},An={},Ft={},ai;function uo(){if(ai)return Ft;ai=1;const e=o=>o.replace(/^(?!$)(?: $)?/gm,"#");function t(o,s){return/^\n+$/.test(o)?o.substring(1):s?o.replace(/^(?! *$)/gm,s):o}const n=(o,s,a)=>o.endsWith(`
|
|
20
|
+
`)?t(a,s):a.includes(`
|
|
19
21
|
`)?`
|
|
20
|
-
`+t(
|
|
21
|
-
`)l===t&&(w=s(
|
|
22
|
-
`&&b!==" "){const A=
|
|
23
|
-
`&&A!==" "&&(y=w)}if(w>=g)if(y)f.push(y),g=y+p,y=void 0;else if(l===n){for(;b===" "||b===" ";)b=O,O=
|
|
24
|
-
${
|
|
25
|
-
${
|
|
26
|
-
`);c=
|
|
27
|
-
`){if(y-b>m)return!0;if(b=y+1,g-b<=m)return!1}return!0}function
|
|
22
|
+
`+t(a,s):(o.endsWith(" ")?"":" ")+a;return Ft.indentComment=t,Ft.lineComment=n,Ft.stringifyComment=e,Ft}var Zo={},vt={},ii;function vm(){if(ii)return vt;ii=1;const e="flow",t="block",n="quoted";function o(a,r,l="flow",{indentAtStart:c,lineWidth:i=80,minContentWidth:d=20,onFold:h,onOverflow:u}={}){if(!i||i<0)return a;i<d&&(d=0);const p=Math.max(1+d,1+i-r.length);if(a.length<=p)return a;const f=[],m={};let g=i-r.length;typeof c=="number"&&(c>i-Math.max(2,d)?f.push(0):g=i-c);let y,b,k=!1,w=-1,v=-1,S=-1;l===t&&(w=s(a,w,r.length),w!==-1&&(g=w+p));for(let O;O=a[w+=1];){if(l===n&&O==="\\"){switch(v=w,a[w+1]){case"x":w+=3;break;case"u":w+=5;break;case"U":w+=9;break;default:w+=1}S=w}if(O===`
|
|
23
|
+
`)l===t&&(w=s(a,w,r.length)),g=w+r.length+p,y=void 0;else{if(O===" "&&b&&b!==" "&&b!==`
|
|
24
|
+
`&&b!==" "){const A=a[w+1];A&&A!==" "&&A!==`
|
|
25
|
+
`&&A!==" "&&(y=w)}if(w>=g)if(y)f.push(y),g=y+p,y=void 0;else if(l===n){for(;b===" "||b===" ";)b=O,O=a[w+=1],k=!0;const A=w>S+1?w-2:v-1;if(m[A])return a;f.push(A),m[A]=!0,g=A+p,y=void 0}else k=!0}b=O}if(k&&u&&u(),f.length===0)return a;h&&h();let j=a.slice(0,f[0]);for(let O=0;O<f.length;++O){const A=f[O],E=f[O+1]||a.length;A===0?j=`
|
|
26
|
+
${r}${a.slice(0,E)}`:(l===n&&m[A]&&(j+=`${a[A]}\\`),j+=`
|
|
27
|
+
${r}${a.slice(A+1,E)}`)}return j}function s(a,r,l){let c=r,i=r+1,d=a[i];for(;d===" "||d===" ";)if(r<i+l)d=a[++r];else{do d=a[++r];while(d&&d!==`
|
|
28
|
+
`);c=r,i=r+1,d=a[i]}return c}return vt.FOLD_BLOCK=t,vt.FOLD_FLOW=e,vt.FOLD_QUOTED=n,vt.foldFlowLines=o,vt}var li;function ho(){if(li)return Zo;li=1;var e=ce(),t=vm();const n=(u,p)=>({indentAtStart:p?u.indent.length:u.indentAtStart,lineWidth:u.options.lineWidth,minContentWidth:u.options.minContentWidth}),o=u=>/^(%|---|\.\.\.)/m.test(u);function s(u,p,f){if(!p||p<0)return!1;const m=p-f,g=u.length;if(g<=m)return!1;for(let y=0,b=0;y<g;++y)if(u[y]===`
|
|
29
|
+
`){if(y-b>m)return!0;if(b=y+1,g-b<=m)return!1}return!0}function a(u,p){const f=JSON.stringify(u);if(p.options.doubleQuotedAsJSON)return f;const{implicitKey:m}=p,g=p.options.doubleQuotedMinMultiLineLength,y=p.indent||(o(u)?" ":"");let b="",k=0;for(let w=0,v=f[w];v;v=f[++w])if(v===" "&&f[w+1]==="\\"&&f[w+2]==="n"&&(b+=f.slice(k,w)+"\\ ",w+=1,k=w,v="\\"),v==="\\")switch(f[w+1]){case"u":{b+=f.slice(k,w);const S=f.substr(w+2,4);switch(S){case"0000":b+="\\0";break;case"0007":b+="\\a";break;case"000b":b+="\\v";break;case"001b":b+="\\e";break;case"0085":b+="\\N";break;case"00a0":b+="\\_";break;case"2028":b+="\\L";break;case"2029":b+="\\P";break;default:S.substr(0,2)==="00"?b+="\\x"+S.substr(2):b+=f.substr(w,6)}w+=5,k=w+1}break;case"n":if(m||f[w+2]==='"'||f.length<g)w+=1;else{for(b+=f.slice(k,w)+`
|
|
28
30
|
|
|
29
31
|
`;f[w+2]==="\\"&&f[w+3]==="n"&&f[w+4]!=='"';)b+=`
|
|
30
|
-
`,w+=2;b+=y,f[w+2]===" "&&(b+="\\"),w+=1,k=w+1}break;default:w+=1}return b=k?b+f.slice(k):f,m?b:t.foldFlowLines(b,y,t.FOLD_QUOTED,n(p,!1))}function
|
|
31
|
-
`)||/[ \t]\n|\n[ \t]/.test(u))return
|
|
32
|
-
${f}`)+"'";return p.implicitKey?m:t.foldFlowLines(m,f,t.FOLD_FLOW,n(p,!1))}function l(u,p){const{singleQuote:f}=p.options;let m;if(f===!1)m=
|
|
32
|
+
`,w+=2;b+=y,f[w+2]===" "&&(b+="\\"),w+=1,k=w+1}break;default:w+=1}return b=k?b+f.slice(k):f,m?b:t.foldFlowLines(b,y,t.FOLD_QUOTED,n(p,!1))}function r(u,p){if(p.options.singleQuote===!1||p.implicitKey&&u.includes(`
|
|
33
|
+
`)||/[ \t]\n|\n[ \t]/.test(u))return a(u,p);const f=p.indent||(o(u)?" ":""),m="'"+u.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
34
|
+
${f}`)+"'";return p.implicitKey?m:t.foldFlowLines(m,f,t.FOLD_FLOW,n(p,!1))}function l(u,p){const{singleQuote:f}=p.options;let m;if(f===!1)m=a;else{const g=u.includes('"'),y=u.includes("'");g&&!y?m=r:y&&!g?m=a:m=f?r:a}return m(u,p)}let c;try{c=new RegExp(`(^|(?<!
|
|
33
35
|
))
|
|
34
36
|
+(?!
|
|
35
37
|
|$)`,"g")}catch{c=/\n+(?!\n|$)/g}function i({comment:u,type:p,value:f},m,g,y){const{blockQuote:b,commentString:k,lineWidth:w}=m.options;if(!b||/\n[\t ]+$/.test(f))return l(f,m);const v=m.indent||(m.forceBlockIndent||o(f)?" ":""),S=b==="literal"?!0:b==="folded"||p===e.Scalar.BLOCK_FOLDED?!1:p===e.Scalar.BLOCK_LITERAL?!0:!s(f,w,v.length);if(!f)return S?`|
|
|
@@ -37,53 +39,53 @@ ${f}`)+"'";return p.implicitKey?m:t.foldFlowLines(m,f,t.FOLD_FLOW,n(p,!1))}funct
|
|
|
37
39
|
`;let j,O;for(O=f.length;O>0;--O){const N=f[O-1];if(N!==`
|
|
38
40
|
`&&N!==" "&&N!==" ")break}let A=f.substring(O);const E=A.indexOf(`
|
|
39
41
|
`);E===-1?j="-":f===A||E!==A.length-1?(j="+",y&&y()):j="",A&&(f=f.slice(0,-A.length),A[A.length-1]===`
|
|
40
|
-
`&&(A=A.slice(0,-1)),A=A.replace(c,`$&${v}`));let x=!1,
|
|
41
|
-
`)
|
|
42
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${v}`);let Z=!1;const U=n(m,!0);b!=="folded"&&p!==e.Scalar.BLOCK_FOLDED&&(U.onOverflow=()=>{Z=!0});const oe=t.foldFlowLines(`${
|
|
43
|
-
${v}${oe}`}return f=f.replace(/\n+/g,`$&${v}`),`|${
|
|
44
|
-
${v}${
|
|
42
|
+
`&&(A=A.slice(0,-1)),A=A.replace(c,`$&${v}`));let x=!1,M,q=-1;for(M=0;M<f.length;++M){const N=f[M];if(N===" ")x=!0;else if(N===`
|
|
43
|
+
`)q=M;else break}let L=f.substring(0,q<M?q+1:M);L&&(f=f.substring(L.length),L=L.replace(/\n+/g,`$&${v}`));let I=(x?v?"2":"1":"")+j;if(u&&(I+=" "+k(u.replace(/ ?[\r\n]+/g," ")),g&&g()),!S){const N=f.replace(/\n+/g,`
|
|
44
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${v}`);let Z=!1;const U=n(m,!0);b!=="folded"&&p!==e.Scalar.BLOCK_FOLDED&&(U.onOverflow=()=>{Z=!0});const oe=t.foldFlowLines(`${L}${N}${A}`,v,t.FOLD_BLOCK,U);if(!Z)return`>${I}
|
|
45
|
+
${v}${oe}`}return f=f.replace(/\n+/g,`$&${v}`),`|${I}
|
|
46
|
+
${v}${L}${f}${A}`}function d(u,p,f,m){const{type:g,value:y}=u,{actualString:b,implicitKey:k,indent:w,indentStep:v,inFlow:S}=p;if(k&&y.includes(`
|
|
45
47
|
`)||S&&/[[\]{},]/.test(y))return l(y,p);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(y))return k||S||!y.includes(`
|
|
46
48
|
`)?l(y,p):i(u,p,f,m);if(!k&&!S&&g!==e.Scalar.PLAIN&&y.includes(`
|
|
47
49
|
`))return i(u,p,f,m);if(o(y)){if(w==="")return p.forceBlockIndent=!0,i(u,p,f,m);if(k&&w===v)return l(y,p)}const j=y.replace(/\n+/g,`$&
|
|
48
|
-
${w}`);if(b){const O=x=>x.default&&x.tag!=="tag:yaml.org,2002:str"&&x.test?.test(j),{compat:A,tags:E}=p.doc.schema;if(E.some(O)||A?.some(O))return l(y,p)}return k?j:t.foldFlowLines(j,w,t.FOLD_FLOW,n(p,!1))}function h(u,p,f,m){const{implicitKey:g,inFlow:y}=p,b=typeof u.value=="string"?u:Object.assign({},u,{value:String(u.value)});let{type:k}=u;k!==e.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(b.value)&&(k=e.Scalar.QUOTE_DOUBLE);const w=S=>{switch(S){case e.Scalar.BLOCK_FOLDED:case e.Scalar.BLOCK_LITERAL:return g||y?l(b.value,p):i(b,p,f,m);case e.Scalar.QUOTE_DOUBLE:return
|
|
49
|
-
${i.indent}${m}`:m}return An.createStringifyContext=s,An.stringify=l,An}var
|
|
50
|
-
${u}:`):(v=`${v}:`,y&&(v+=o.lineComment(v,l.indent,f(y))));let S,j,O;e.isNode(
|
|
51
|
-
`:"",j){const
|
|
52
|
-
${o.indentComment(
|
|
50
|
+
${w}`);if(b){const O=x=>x.default&&x.tag!=="tag:yaml.org,2002:str"&&x.test?.test(j),{compat:A,tags:E}=p.doc.schema;if(E.some(O)||A?.some(O))return l(y,p)}return k?j:t.foldFlowLines(j,w,t.FOLD_FLOW,n(p,!1))}function h(u,p,f,m){const{implicitKey:g,inFlow:y}=p,b=typeof u.value=="string"?u:Object.assign({},u,{value:String(u.value)});let{type:k}=u;k!==e.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(b.value)&&(k=e.Scalar.QUOTE_DOUBLE);const w=S=>{switch(S){case e.Scalar.BLOCK_FOLDED:case e.Scalar.BLOCK_LITERAL:return g||y?l(b.value,p):i(b,p,f,m);case e.Scalar.QUOTE_DOUBLE:return a(b.value,p);case e.Scalar.QUOTE_SINGLE:return r(b.value,p);case e.Scalar.PLAIN:return d(b,p,f,m);default:return null}};let v=w(k);if(v===null){const{defaultKeyType:S,defaultStringType:j}=p.options,O=g&&S||j;if(v=w(O),v===null)throw new Error(`Unsupported default string type ${O}`)}return v}return Zo.stringifyString=h,Zo}var ci;function po(){if(ci)return An;ci=1;var e=Ur(),t=B(),n=uo(),o=ho();function s(c,i){const d=Object.assign({blockQuote:!0,commentString:n.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},c.schema.toStringOptions,i);let h;switch(d.collectionStyle){case"block":h=!1;break;case"flow":h=!0;break;default:h=null}return{anchors:new Set,doc:c,flowCollectionPadding:d.flowCollectionPadding?" ":"",indent:"",indentStep:typeof d.indent=="number"?" ".repeat(d.indent):" ",inFlow:h,options:d}}function a(c,i){if(i.tag){const u=c.filter(p=>p.tag===i.tag);if(u.length>0)return u.find(p=>p.format===i.format)??u[0]}let d,h;if(t.isScalar(i)){h=i.value;let u=c.filter(p=>p.identify?.(h));if(u.length>1){const p=u.filter(f=>f.test);p.length>0&&(u=p)}d=u.find(p=>p.format===i.format)??u.find(p=>!p.format)}else h=i,d=c.find(u=>u.nodeClass&&h instanceof u.nodeClass);if(!d){const u=h?.constructor?.name??(h===null?"null":typeof h);throw new Error(`Tag not resolved for ${u} value`)}return d}function r(c,i,{anchors:d,doc:h}){if(!h.directives)return"";const u=[],p=(t.isScalar(c)||t.isCollection(c))&&c.anchor;p&&e.anchorIsValid(p)&&(d.add(p),u.push(`&${p}`));const f=c.tag??(i.default?null:i.tag);return f&&u.push(h.directives.tagString(f)),u.join(" ")}function l(c,i,d,h){if(t.isPair(c))return c.toString(i,d,h);if(t.isAlias(c)){if(i.doc.directives)return c.toString(i);if(i.resolvedAliases?.has(c))throw new TypeError("Cannot stringify circular structure without alias nodes");i.resolvedAliases?i.resolvedAliases.add(c):i.resolvedAliases=new Set([c]),c=c.resolve(i.doc)}let u;const p=t.isNode(c)?c:i.doc.createNode(c,{onTagObj:g=>u=g});u??(u=a(i.doc.schema.tags,p));const f=r(p,u,i);f.length>0&&(i.indentAtStart=(i.indentAtStart??0)+f.length+1);const m=typeof u.stringify=="function"?u.stringify(p,i,d,h):t.isScalar(p)?o.stringifyString(p,i,d,h):p.toString(i,d,h);return f?t.isScalar(p)||m[0]==="{"||m[0]==="["?`${f} ${m}`:`${f}
|
|
51
|
+
${i.indent}${m}`:m}return An.createStringifyContext=s,An.stringify=l,An}var di;function $m(){if(di)return Jo;di=1;var e=B(),t=ce(),n=po(),o=uo();function s({key:a,value:r},l,c,i){const{allNullValues:d,doc:h,indent:u,indentStep:p,options:{commentString:f,indentSeq:m,simpleKeys:g}}=l;let y=e.isNode(a)&&a.comment||null;if(g){if(y)throw new Error("With simple keys, key nodes cannot have comments");if(e.isCollection(a)||!e.isNode(a)&&typeof a=="object"){const M="With simple keys, collection cannot be used as a key value";throw new Error(M)}}let b=!g&&(!a||y&&r==null&&!l.inFlow||e.isCollection(a)||(e.isScalar(a)?a.type===t.Scalar.BLOCK_FOLDED||a.type===t.Scalar.BLOCK_LITERAL:typeof a=="object"));l=Object.assign({},l,{allNullValues:!1,implicitKey:!b&&(g||!d),indent:u+p});let k=!1,w=!1,v=n.stringify(a,l,()=>k=!0,()=>w=!0);if(!b&&!l.inFlow&&v.length>1024){if(g)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");b=!0}if(l.inFlow){if(d||r==null)return k&&c&&c(),v===""?"?":b?`? ${v}`:v}else if(d&&!g||r==null&&b)return v=`? ${v}`,y&&!k?v+=o.lineComment(v,l.indent,f(y)):w&&i&&i(),v;k&&(y=null),b?(y&&(v+=o.lineComment(v,l.indent,f(y))),v=`? ${v}
|
|
52
|
+
${u}:`):(v=`${v}:`,y&&(v+=o.lineComment(v,l.indent,f(y))));let S,j,O;e.isNode(r)?(S=!!r.spaceBefore,j=r.commentBefore,O=r.comment):(S=!1,j=null,O=null,r&&typeof r=="object"&&(r=h.createNode(r))),l.implicitKey=!1,!b&&!y&&e.isScalar(r)&&(l.indentAtStart=v.length+1),w=!1,!m&&p.length>=2&&!l.inFlow&&!b&&e.isSeq(r)&&!r.flow&&!r.tag&&!r.anchor&&(l.indent=l.indent.substring(2));let A=!1;const E=n.stringify(r,l,()=>A=!0,()=>w=!0);let x=" ";if(y||S||j){if(x=S?`
|
|
53
|
+
`:"",j){const M=f(j);x+=`
|
|
54
|
+
${o.indentComment(M,l.indent)}`}E===""&&!l.inFlow?x===`
|
|
53
55
|
`&&O&&(x=`
|
|
54
56
|
|
|
55
57
|
`):x+=`
|
|
56
|
-
${l.indent}`}else if(!b&&e.isCollection(
|
|
57
|
-
`),
|
|
58
|
+
${l.indent}`}else if(!b&&e.isCollection(r)){const M=E[0],q=E.indexOf(`
|
|
59
|
+
`),L=q!==-1,ne=l.inFlow??r.flow??r.items.length===0;if(L||!ne){let I=!1;if(L&&(M==="&"||M==="!")){let N=E.indexOf(" ");M==="&"&&N!==-1&&N<q&&E[N+1]==="!"&&(N=E.indexOf(" ",N+1)),(N===-1||q<N)&&(I=!0)}I||(x=`
|
|
58
60
|
${l.indent}`)}}else(E===""||E[0]===`
|
|
59
|
-
`)&&(x="");return v+=x+E,l.inFlow?A&&c&&c():O&&!A?v+=o.lineComment(v,l.indent,f(O)):w&&i&&i(),v}return
|
|
61
|
+
`)&&(x="");return v+=x+E,l.inFlow?A&&c&&c():O&&!A?v+=o.lineComment(v,l.indent,f(O)):w&&i&&i(),v}return Jo.stringifyPair=s,Jo}var Xo={},Tn={},ui;function Qc(){if(ui)return Tn;ui=1;var e=Or;function t(o,...s){o==="debug"&&console.log(...s)}function n(o,s){(o==="debug"||o==="warn")&&(typeof e.emitWarning=="function"?e.emitWarning(s):console.warn(s))}return Tn.debug=t,Tn.warn=n,Tn}var Dt={},hi;function Kr(){if(hi)return Dt;hi=1;var e=B(),t=ce();const n="<<",o={identify:c=>c===n||typeof c=="symbol"&&c.description===n,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new t.Scalar(Symbol(n)),{addToJSMap:a}),stringify:()=>n},s=(c,i)=>(o.identify(i)||e.isScalar(i)&&(!i.type||i.type===t.Scalar.PLAIN)&&o.identify(i.value))&&c?.doc.schema.tags.some(d=>d.tag===o.tag&&d.default);function a(c,i,d){const h=l(c,d);if(e.isSeq(h))for(const u of h.items)r(c,i,u);else if(Array.isArray(h))for(const u of h)r(c,i,u);else r(c,i,h)}function r(c,i,d){const h=l(c,d);if(!e.isMap(h))throw new Error("Merge sources must be maps or map aliases");const u=h.toJSON(null,c,Map);for(const[p,f]of u)i instanceof Map?i.has(p)||i.set(p,f):i instanceof Set?i.add(p):Object.prototype.hasOwnProperty.call(i,p)||Object.defineProperty(i,p,{value:f,writable:!0,enumerable:!0,configurable:!0});return i}function l(c,i){return c&&e.isAlias(i)?i.resolve(c.doc,c):i}return Dt.addMergeToJSMap=a,Dt.isMergeKey=s,Dt.merge=o,Dt}var pi;function ed(){if(pi)return Xo;pi=1;var e=Qc(),t=Kr(),n=po(),o=B(),s=ft();function a(l,c,{key:i,value:d}){if(o.isNode(i)&&i.addToJSMap)i.addToJSMap(l,c,d);else if(t.isMergeKey(l,i))t.addMergeToJSMap(l,c,d);else{const h=s.toJS(i,"",l);if(c instanceof Map)c.set(h,s.toJS(d,h,l));else if(c instanceof Set)c.add(h);else{const u=r(i,h,l),p=s.toJS(d,u,l);u in c?Object.defineProperty(c,u,{value:p,writable:!0,enumerable:!0,configurable:!0}):c[u]=p}}return c}function r(l,c,i){if(c===null)return"";if(typeof c!="object")return String(c);if(o.isNode(l)&&i?.doc){const d=n.createStringifyContext(i.doc,{});d.anchors=new Set;for(const u of i.anchors.keys())d.anchors.add(u.anchor);d.inFlow=!0,d.inStringifyKey=!0;const h=l.toString(d);if(!i.mapKeyWarned){let u=JSON.stringify(h);u.length>40&&(u=u.substring(0,36)+'..."'),e.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${u}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return h}return JSON.stringify(c)}return Xo.addPairToJSMap=a,Xo}var fi;function mt(){if(fi)return jn;fi=1;var e=co(),t=$m(),n=ed(),o=B();function s(r,l,c){const i=e.createNode(r,void 0,c),d=e.createNode(l,void 0,c);return new a(i,d)}let a=class td{constructor(l,c=null){Object.defineProperty(this,o.NODE_TYPE,{value:o.PAIR}),this.key=l,this.value=c}clone(l){let{key:c,value:i}=this;return o.isNode(c)&&(c=c.clone(l)),o.isNode(i)&&(i=i.clone(l)),new td(c,i)}toJSON(l,c){const i=c?.mapAsMap?new Map:{};return n.addPairToJSMap(c,i,this)}toString(l,c,i){return l?.doc?t.stringifyPair(this,l,c,i):JSON.stringify(this)}};return jn.Pair=a,jn.createPair=s,jn}var Qo={},es={},On={},ts={},mi;function nd(){if(mi)return ts;mi=1;var e=B(),t=po(),n=uo();function o(l,c,i){return(c.inFlow??l.flow?a:s)(l,c,i)}function s({comment:l,items:c},i,{blockItemPrefix:d,flowChars:h,itemIndent:u,onChompKeep:p,onComment:f}){const{indent:m,options:{commentString:g}}=i,y=Object.assign({},i,{indent:u,type:null});let b=!1;const k=[];for(let v=0;v<c.length;++v){const S=c[v];let j=null;if(e.isNode(S))!b&&S.spaceBefore&&k.push(""),r(i,k,S.commentBefore,b),S.comment&&(j=S.comment);else if(e.isPair(S)){const A=e.isNode(S.key)?S.key:null;A&&(!b&&A.spaceBefore&&k.push(""),r(i,k,A.commentBefore,b))}b=!1;let O=t.stringify(S,y,()=>j=null,()=>b=!0);j&&(O+=n.lineComment(O,u,g(j))),b&&j&&(b=!1),k.push(d+O)}let w;if(k.length===0)w=h.start+h.end;else{w=k[0];for(let v=1;v<k.length;++v){const S=k[v];w+=S?`
|
|
60
62
|
${m}${S}`:`
|
|
61
63
|
`}}return l?(w+=`
|
|
62
|
-
`+n.indentComment(g(l),m),f&&f()):b&&p&&p(),w}function
|
|
64
|
+
`+n.indentComment(g(l),m),f&&f()):b&&p&&p(),w}function a({items:l},c,{flowChars:i,itemIndent:d}){const{indent:h,indentStep:u,flowCollectionPadding:p,options:{commentString:f}}=c;d+=u;const m=Object.assign({},c,{indent:d,inFlow:!0,type:null});let g=!1,y=0;const b=[];for(let v=0;v<l.length;++v){const S=l[v];let j=null;if(e.isNode(S))S.spaceBefore&&b.push(""),r(c,b,S.commentBefore,!1),S.comment&&(j=S.comment);else if(e.isPair(S)){const A=e.isNode(S.key)?S.key:null;A&&(A.spaceBefore&&b.push(""),r(c,b,A.commentBefore,!1),A.comment&&(g=!0));const E=e.isNode(S.value)?S.value:null;E?(E.comment&&(j=E.comment),E.commentBefore&&(g=!0)):S.value==null&&A?.comment&&(j=A.comment)}j&&(g=!0);let O=t.stringify(S,m,()=>j=null);g||(g=b.length>y||O.includes(`
|
|
63
65
|
`)),v<l.length-1?O+=",":c.options.trailingComma&&(c.options.lineWidth>0&&(g||(g=b.reduce((A,E)=>A+E.length+2,2)+(O.length+2)>c.options.lineWidth)),g&&(O+=",")),j&&(O+=n.lineComment(O,d,f(j))),b.push(O),y=b.length}const{start:k,end:w}=i;if(b.length===0)return k+w;if(!g){const v=b.reduce((S,j)=>S+j.length+2,2);g=c.options.lineWidth>0&&v>c.options.lineWidth}if(g){let v=k;for(const S of b)v+=S?`
|
|
64
66
|
${u}${h}${S}`:`
|
|
65
67
|
`;return`${v}
|
|
66
|
-
${h}${w}`}else return`${k}${p}${b.join(" ")}${p}${w}`}function
|
|
67
|
-
`:" ")}return n.stringifyString({comment:s,type:
|
|
68
|
+
${h}${w}`}else return`${k}${p}${b.join(" ")}${p}${w}`}function r({indent:l,options:{commentString:c}},i,d,h){if(d&&h&&(d=d.replace(/^\n+/,"")),d){const u=n.indentComment(c(d),l);i.push(u.trimStart())}}return ts.stringifyCollection=o,ts}var gi;function gt(){if(gi)return On;gi=1;var e=nd(),t=ed(),n=Wr(),o=B(),s=mt(),a=ce();function r(c,i){const d=o.isScalar(i)?i.value:i;for(const h of c)if(o.isPair(h)&&(h.key===i||h.key===d||o.isScalar(h.key)&&h.key.value===d))return h}let l=class extends n.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(i){super(o.MAP,i),this.items=[]}static from(i,d,h){const{keepUndefined:u,replacer:p}=h,f=new this(i),m=(g,y)=>{if(typeof p=="function")y=p.call(d,g,y);else if(Array.isArray(p)&&!p.includes(g))return;(y!==void 0||u)&&f.items.push(s.createPair(g,y,h))};if(d instanceof Map)for(const[g,y]of d)m(g,y);else if(d&&typeof d=="object")for(const g of Object.keys(d))m(g,d[g]);return typeof i.sortMapEntries=="function"&&f.items.sort(i.sortMapEntries),f}add(i,d){let h;o.isPair(i)?h=i:!i||typeof i!="object"||!("key"in i)?h=new s.Pair(i,i?.value):h=new s.Pair(i.key,i.value);const u=r(this.items,h.key),p=this.schema?.sortMapEntries;if(u){if(!d)throw new Error(`Key ${h.key} already set`);o.isScalar(u.value)&&a.isScalarValue(h.value)?u.value.value=h.value:u.value=h.value}else if(p){const f=this.items.findIndex(m=>p(h,m)<0);f===-1?this.items.push(h):this.items.splice(f,0,h)}else this.items.push(h)}delete(i){const d=r(this.items,i);return d?this.items.splice(this.items.indexOf(d),1).length>0:!1}get(i,d){const u=r(this.items,i)?.value;return(!d&&o.isScalar(u)?u.value:u)??void 0}has(i){return!!r(this.items,i)}set(i,d){this.add(new s.Pair(i,d),!0)}toJSON(i,d,h){const u=h?new h:d?.mapAsMap?new Map:{};d?.onCreate&&d.onCreate(u);for(const p of this.items)t.addPairToJSMap(d,u,p);return u}toString(i,d,h){if(!i)return JSON.stringify(this);for(const u of this.items)if(!o.isPair(u))throw new Error(`Map items must all be pairs; found ${JSON.stringify(u)} instead`);return!i.allNullValues&&this.hasAllNullValues(!1)&&(i=Object.assign({},i,{allNullValues:!0})),e.stringifyCollection(this,i,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:i.indent||"",onChompKeep:h,onComment:d})}};return On.YAMLMap=l,On.findPair=r,On}var yi;function fn(){if(yi)return es;yi=1;var e=B(),t=gt();const n={collection:"map",default:!0,nodeClass:t.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(o,s){return e.isMap(o)||s("Expected a mapping for this tag"),o},createNode:(o,s,a)=>t.YAMLMap.from(o,s,a)};return es.map=n,es}var ns={},os={},bi;function yt(){if(bi)return os;bi=1;var e=co(),t=nd(),n=Wr(),o=B(),s=ce(),a=ft();let r=class extends n.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(i){super(o.SEQ,i),this.items=[]}add(i){this.items.push(i)}delete(i){const d=l(i);return typeof d!="number"?!1:this.items.splice(d,1).length>0}get(i,d){const h=l(i);if(typeof h!="number")return;const u=this.items[h];return!d&&o.isScalar(u)?u.value:u}has(i){const d=l(i);return typeof d=="number"&&d<this.items.length}set(i,d){const h=l(i);if(typeof h!="number")throw new Error(`Expected a valid index, not ${i}.`);const u=this.items[h];o.isScalar(u)&&s.isScalarValue(d)?u.value=d:this.items[h]=d}toJSON(i,d){const h=[];d?.onCreate&&d.onCreate(h);let u=0;for(const p of this.items)h.push(a.toJS(p,String(u++),d));return h}toString(i,d,h){return i?t.stringifyCollection(this,i,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(i.indent||"")+" ",onChompKeep:h,onComment:d}):JSON.stringify(this)}static from(i,d,h){const{replacer:u}=h,p=new this(i);if(d&&Symbol.iterator in Object(d)){let f=0;for(let m of d){if(typeof u=="function"){const g=d instanceof Set?m:String(f++);m=u.call(d,g,m)}p.items.push(e.createNode(m,void 0,h))}}return p}};function l(c){let i=o.isScalar(c)?c.value:c;return i&&typeof i=="string"&&(i=Number(i)),typeof i=="number"&&Number.isInteger(i)&&i>=0?i:null}return os.YAMLSeq=r,os}var wi;function mn(){if(wi)return ns;wi=1;var e=B(),t=yt();const n={collection:"seq",default:!0,nodeClass:t.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(o,s){return e.isSeq(o)||s("Expected a sequence for this tag"),o},createNode:(o,s,a)=>t.YAMLSeq.from(o,s,a)};return ns.seq=n,ns}var ss={},ki;function fo(){if(ki)return ss;ki=1;var e=ho();const t={identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify(n,o,s,a){return o=Object.assign({actualString:!0},o),e.stringifyString(n,o,s,a)}};return ss.string=t,ss}var En={},rs={},vi;function Yr(){if(vi)return rs;vi=1;var e=ce();const t={identify:n=>n==null,createNode:()=>new e.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new e.Scalar(null),stringify:({source:n},o)=>typeof n=="string"&&t.test.test(n)?n:o.options.nullStr};return rs.nullTag=t,rs}var as={},$i;function od(){if($i)return as;$i=1;var e=ce();const t={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new e.Scalar(n[0]==="t"||n[0]==="T"),stringify({source:n,value:o},s){if(n&&t.test.test(n)){const a=n[0]==="t"||n[0]==="T";if(o===a)return n}return o?s.options.trueStr:s.options.falseStr}};return as.boolTag=t,as}var Bt={},is={},Si;function gn(){if(Si)return is;Si=1;function e({format:t,minFractionDigits:n,tag:o,value:s}){if(typeof s=="bigint")return String(s);const a=typeof s=="number"?s:Number(s);if(!isFinite(a))return isNaN(a)?".nan":a<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!t&&n&&(!o||o==="tag:yaml.org,2002:float")&&/^-?\d/.test(r)&&!r.includes("e")){let l=r.indexOf(".");l<0&&(l=r.length,r+=".");let c=n-(r.length-l-1);for(;c-- >0;)r+="0"}return r}return is.stringifyNumber=e,is}var ji;function sd(){if(ji)return Bt;ji=1;var e=ce(),t=gn();const n={identify:a=>typeof a=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:a=>a.slice(-3).toLowerCase()==="nan"?NaN:a[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:t.stringifyNumber},o={identify:a=>typeof a=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:a=>parseFloat(a),stringify(a){const r=Number(a.value);return isFinite(r)?r.toExponential():t.stringifyNumber(a)}},s={identify:a=>typeof a=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(a){const r=new e.Scalar(parseFloat(a)),l=a.indexOf(".");return l!==-1&&a[a.length-1]==="0"&&(r.minFractionDigits=a.length-l-1),r},stringify:t.stringifyNumber};return Bt.float=s,Bt.floatExp=o,Bt.floatNaN=n,Bt}var Ut={},Ai;function rd(){if(Ai)return Ut;Ai=1;var e=gn();const t=l=>typeof l=="bigint"||Number.isInteger(l),n=(l,c,i,{intAsBigInt:d})=>d?BigInt(l):parseInt(l.substring(c),i);function o(l,c,i){const{value:d}=l;return t(d)&&d>=0?i+d.toString(c):e.stringifyNumber(l)}const s={identify:l=>t(l)&&l>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(l,c,i)=>n(l,2,8,i),stringify:l=>o(l,8,"0o")},a={identify:t,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(l,c,i)=>n(l,0,10,i),stringify:e.stringifyNumber},r={identify:l=>t(l)&&l>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(l,c,i)=>n(l,2,16,i),stringify:l=>o(l,16,"0x")};return Ut.int=a,Ut.intHex=r,Ut.intOct=s,Ut}var ls={},Ti;function Sm(){if(Ti)return ls;Ti=1;var e=fn(),t=Yr(),n=mn(),o=fo(),s=od(),a=sd(),r=rd();const l=[e.map,n.seq,o.string,t.nullTag,s.boolTag,r.intOct,r.int,r.intHex,a.floatNaN,a.floatExp,a.float];return ls.schema=l,ls}var cs={},Oi;function jm(){if(Oi)return cs;Oi=1;var e=ce(),t=fn(),n=mn();function o(c){return typeof c=="bigint"||Number.isInteger(c)}const s=({value:c})=>JSON.stringify(c),a=[{identify:c=>typeof c=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:c=>c,stringify:s},{identify:c=>c==null,createNode:()=>new e.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:s},{identify:c=>typeof c=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:c=>c==="true",stringify:s},{identify:o,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(c,i,{intAsBigInt:d})=>d?BigInt(c):parseInt(c,10),stringify:({value:c})=>o(c)?c.toString():JSON.stringify(c)},{identify:c=>typeof c=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:c=>parseFloat(c),stringify:s}],r={default:!0,tag:"",test:/^/,resolve(c,i){return i(`Unresolved plain scalar ${JSON.stringify(c)}`),c}},l=[t.map,n.seq].concat(a,r);return cs.schema=l,cs}var ds={},Ei;function ad(){if(Ei)return ds;Ei=1;var e=Cu,t=ce(),n=ho();const o={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,a){if(typeof e.Buffer=="function")return e.Buffer.from(s,"base64");if(typeof atob=="function"){const r=atob(s.replace(/[\n\r]/g,"")),l=new Uint8Array(r.length);for(let c=0;c<r.length;++c)l[c]=r.charCodeAt(c);return l}else return a("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:a,value:r},l,c,i){if(!r)return"";const d=r;let h;if(typeof e.Buffer=="function")h=d instanceof e.Buffer?d.toString("base64"):e.Buffer.from(d.buffer).toString("base64");else if(typeof btoa=="function"){let u="";for(let p=0;p<d.length;++p)u+=String.fromCharCode(d[p]);h=btoa(u)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(a??(a=t.Scalar.BLOCK_LITERAL),a!==t.Scalar.QUOTE_DOUBLE){const u=Math.max(l.options.lineWidth-l.indent.length,l.options.minContentWidth),p=Math.ceil(h.length/u),f=new Array(p);for(let m=0,g=0;m<p;++m,g+=u)f[m]=h.substr(g,u);h=f.join(a===t.Scalar.BLOCK_LITERAL?`
|
|
69
|
+
`:" ")}return n.stringifyString({comment:s,type:a,value:h},l,c,i)}};return ds.binary=o,ds}var Cn={},zt={},Ci;function Gr(){if(Ci)return zt;Ci=1;var e=B(),t=mt(),n=ce(),o=yt();function s(l,c){if(e.isSeq(l))for(let i=0;i<l.items.length;++i){let d=l.items[i];if(!e.isPair(d)){if(e.isMap(d)){d.items.length>1&&c("Each pair must have its own sequence indicator");const h=d.items[0]||new t.Pair(new n.Scalar(null));if(d.commentBefore&&(h.key.commentBefore=h.key.commentBefore?`${d.commentBefore}
|
|
68
70
|
${h.key.commentBefore}`:d.commentBefore),d.comment){const u=h.value??h.key;u.comment=u.comment?`${d.comment}
|
|
69
|
-
${u.comment}`:d.comment}d=h}l.items[i]=e.isPair(d)?d:new t.Pair(d)}}else c("Expected a sequence for this tag");return l}function r(l,c,i){const{replacer:d}=i,h=new o.YAMLSeq(l);h.tag="tag:yaml.org,2002:pairs";let u=0;if(c&&Symbol.iterator in Object(c))for(let p of c){typeof d=="function"&&(p=d.call(c,String(u++),p));let f,m;if(Array.isArray(p))if(p.length===2)f=p[0],m=p[1];else throw new TypeError(`Expected [key, value] tuple: ${p}`);else if(p&&p instanceof Object){const g=Object.keys(p);if(g.length===1)f=g[0],m=p[f];else throw new TypeError(`Expected tuple with one key, not ${g.length} keys`)}else f=p;h.items.push(t.createPair(f,m,i))}return h}const a={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:s,createNode:r};return Wt.createPairs=r,Wt.pairs=a,Wt.resolvePairs=s,Wt}var Ci;function id(){if(Ci)return Cn;Ci=1;var e=B(),t=ft(),n=gt(),o=yt(),s=Hr();class r extends o.YAMLSeq{constructor(){super(),this.add=n.YAMLMap.prototype.add.bind(this),this.delete=n.YAMLMap.prototype.delete.bind(this),this.get=n.YAMLMap.prototype.get.bind(this),this.has=n.YAMLMap.prototype.has.bind(this),this.set=n.YAMLMap.prototype.set.bind(this),this.tag=r.tag}toJSON(c,i){if(!i)return super.toJSON(c);const d=new Map;i?.onCreate&&i.onCreate(d);for(const h of this.items){let u,p;if(e.isPair(h)?(u=t.toJS(h.key,"",i),p=t.toJS(h.value,u,i)):u=t.toJS(h,"",i),d.has(u))throw new Error("Ordered maps must not include duplicate keys");d.set(u,p)}return d}static from(c,i,d){const h=s.createPairs(c,i,d),u=new this;return u.items=h.items,u}}r.tag="tag:yaml.org,2002:omap";const a={collection:"seq",identify:l=>l instanceof Map,nodeClass:r,default:!1,tag:"tag:yaml.org,2002:omap",resolve(l,c){const i=s.resolvePairs(l,c),d=[];for(const{key:h}of i.items)e.isScalar(h)&&(d.includes(h.value)?c(`Ordered maps must not include duplicate keys: ${h.value}`):d.push(h.value));return Object.assign(new r,i)},createNode:(l,c,i)=>r.from(l,c,i)};return Cn.YAMLOMap=r,Cn.omap=a,Cn}var ps={},Nn={},Ni;function jm(){if(Ni)return Nn;Ni=1;var e=ce();function t({value:s,source:r},a){return r&&(s?n:o).test.test(r)?r:s?a.options.trueStr:a.options.falseStr}const n={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new e.Scalar(!0),stringify:t},o={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new e.Scalar(!1),stringify:t};return Nn.falseTag=o,Nn.trueTag=n,Nn}var Kt={},xi;function Am(){if(xi)return Kt;xi=1;var e=ce(),t=gn();const n={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:r=>r.slice(-3).toLowerCase()==="nan"?NaN:r[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:t.stringifyNumber},o={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:r=>parseFloat(r.replace(/_/g,"")),stringify(r){const a=Number(r.value);return isFinite(a)?a.toExponential():t.stringifyNumber(r)}},s={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(r){const a=new e.Scalar(parseFloat(r.replace(/_/g,""))),l=r.indexOf(".");if(l!==-1){const c=r.substring(l+1).replace(/_/g,"");c[c.length-1]==="0"&&(a.minFractionDigits=c.length)}return a},stringify:t.stringifyNumber};return Kt.float=s,Kt.floatExp=o,Kt.floatNaN=n,Kt}var $t={},Ri;function Tm(){if(Ri)return $t;Ri=1;var e=gn();const t=c=>typeof c=="bigint"||Number.isInteger(c);function n(c,i,d,{intAsBigInt:h}){const u=c[0];if((u==="-"||u==="+")&&(i+=1),c=c.substring(i).replace(/_/g,""),h){switch(d){case 2:c=`0b${c}`;break;case 8:c=`0o${c}`;break;case 16:c=`0x${c}`;break}const f=BigInt(c);return u==="-"?BigInt(-1)*f:f}const p=parseInt(c,d);return u==="-"?-1*p:p}function o(c,i,d){const{value:h}=c;if(t(h)){const u=h.toString(i);return h<0?"-"+d+u.substr(1):d+u}return e.stringifyNumber(c)}const s={identify:t,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(c,i,d)=>n(c,2,2,d),stringify:c=>o(c,2,"0b")},r={identify:t,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(c,i,d)=>n(c,1,8,d),stringify:c=>o(c,8,"0")},a={identify:t,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(c,i,d)=>n(c,0,10,d),stringify:e.stringifyNumber},l={identify:t,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(c,i,d)=>n(c,2,16,d),stringify:c=>o(c,16,"0x")};return $t.int=a,$t.intBin=s,$t.intHex=l,$t.intOct=r,$t}var xn={},_i;function ld(){if(_i)return xn;_i=1;var e=B(),t=mt(),n=gt();class o extends n.YAMLMap{constructor(a){super(a),this.tag=o.tag}add(a){let l;e.isPair(a)?l=a:a&&typeof a=="object"&&"key"in a&&"value"in a&&a.value===null?l=new t.Pair(a.key,null):l=new t.Pair(a,null),n.findPair(this.items,l.key)||this.items.push(l)}get(a,l){const c=n.findPair(this.items,a);return!l&&e.isPair(c)?e.isScalar(c.key)?c.key.value:c.key:c}set(a,l){if(typeof l!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof l}`);const c=n.findPair(this.items,a);c&&!l?this.items.splice(this.items.indexOf(c),1):!c&&l&&this.items.push(new t.Pair(a))}toJSON(a,l){return super.toJSON(a,l,Set)}toString(a,l,c){if(!a)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},a,{allNullValues:!0}),l,c);throw new Error("Set items must all have null values")}static from(a,l,c){const{replacer:i}=c,d=new this(a);if(l&&Symbol.iterator in Object(l))for(let h of l)typeof i=="function"&&(h=i.call(l,h,h)),d.items.push(t.createPair(h,null,c));return d}}o.tag="tag:yaml.org,2002:set";const s={collection:"map",identify:r=>r instanceof Set,nodeClass:o,default:!1,tag:"tag:yaml.org,2002:set",createNode:(r,a,l)=>o.from(r,a,l),resolve(r,a){if(e.isMap(r)){if(r.hasAllNullValues(!0))return Object.assign(new o,r);a("Set items must all have null values")}else a("Expected a mapping for this tag");return r}};return xn.YAMLSet=o,xn.set=s,xn}var Yt={},Pi;function cd(){if(Pi)return Yt;Pi=1;var e=gn();function t(a,l){const c=a[0],i=c==="-"||c==="+"?a.substring(1):a,d=u=>l?BigInt(u):Number(u),h=i.replace(/_/g,"").split(":").reduce((u,p)=>u*d(60)+d(p),d(0));return c==="-"?d(-1)*h:h}function n(a){let{value:l}=a,c=u=>u;if(typeof l=="bigint")c=u=>BigInt(u);else if(isNaN(l)||!isFinite(l))return e.stringifyNumber(a);let i="";l<0&&(i="-",l*=c(-1));const d=c(60),h=[l%d];return l<60?h.unshift(0):(l=(l-h[0])/d,h.unshift(l%d),l>=60&&(l=(l-h[0])/d,h.unshift(l))),i+h.map(u=>String(u).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const o={identify:a=>typeof a=="bigint"||Number.isInteger(a),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(a,l,{intAsBigInt:c})=>t(a,c),stringify:n},s={identify:a=>typeof a=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:a=>t(a,!1),stringify:n},r={identify:a=>a instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(a){const l=a.match(r.test);if(!l)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,c,i,d,h,u,p]=l.map(Number),f=l[7]?Number((l[7]+"00").substr(1,3)):0;let m=Date.UTC(c,i-1,d,h||0,u||0,p||0,f);const g=l[8];if(g&&g!=="Z"){let y=t(g,!1);Math.abs(y)<30&&(y*=60),m-=6e4*y}return new Date(m)},stringify:({value:a})=>a?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};return Yt.floatTime=s,Yt.intTime=o,Yt.timestamp=r,Yt}var Li;function Om(){if(Li)return ps;Li=1;var e=fn(),t=Gr(),n=mn(),o=go(),s=ad(),r=jm(),a=Am(),l=Tm(),c=Yr(),i=id(),d=Hr(),h=ld(),u=cd();const p=[e.map,n.seq,o.string,t.nullTag,r.trueTag,r.falseTag,l.intBin,l.intOct,l.int,l.intHex,a.floatNaN,a.floatExp,a.float,s.binary,c.merge,i.omap,d.pairs,h.set,u.intTime,u.floatTime,u.timestamp];return ps.schema=p,ps}var Ii;function Em(){if(Ii)return En;Ii=1;var e=fn(),t=Gr(),n=mn(),o=go(),s=od(),r=sd(),a=rd(),l=$m(),c=Sm(),i=ad(),d=Yr(),h=id(),u=Hr(),p=Om(),f=ld(),m=cd();const g=new Map([["core",l.schema],["failsafe",[e.map,n.seq,o.string]],["json",c.schema],["yaml11",p.schema],["yaml-1.1",p.schema]]),y={binary:i.binary,bool:s.boolTag,float:r.float,floatExp:r.floatExp,floatNaN:r.floatNaN,floatTime:m.floatTime,int:a.int,intHex:a.intHex,intOct:a.intOct,intTime:m.intTime,map:e.map,merge:d.merge,null:t.nullTag,omap:h.omap,pairs:u.pairs,seq:n.seq,set:f.set,timestamp:m.timestamp},b={"tag:yaml.org,2002:binary":i.binary,"tag:yaml.org,2002:merge":d.merge,"tag:yaml.org,2002:omap":h.omap,"tag:yaml.org,2002:pairs":u.pairs,"tag:yaml.org,2002:set":f.set,"tag:yaml.org,2002:timestamp":m.timestamp};function k(w,v,S){const j=g.get(v);if(j&&!w)return S&&!j.includes(d.merge)?j.concat(d.merge):j.slice();let O=j;if(!O)if(Array.isArray(w))O=[];else{const A=Array.from(g.keys()).filter(E=>E!=="yaml11").map(E=>JSON.stringify(E)).join(", ");throw new Error(`Unknown schema "${v}"; use one of ${A} or define customTags array`)}if(Array.isArray(w))for(const A of w)O=O.concat(A);else typeof w=="function"&&(O=w(O.slice()));return S&&(O=O.concat(d.merge)),O.reduce((A,E)=>{const x=typeof E=="string"?y[E]:E;if(!x){const L=JSON.stringify(E),I=Object.keys(y).map(M=>JSON.stringify(M)).join(", ");throw new Error(`Unknown custom tag ${L}; use one of ${I}`)}return A.includes(x)||A.push(x),A},[])}return En.coreKnownTags=b,En.getTags=k,En}var Mi;function ud(){if(Mi)return ts;Mi=1;var e=B(),t=fn(),n=mn(),o=go(),s=Em();const r=(l,c)=>l.key<c.key?-1:l.key>c.key?1:0;let a=class dd{constructor({compat:c,customTags:i,merge:d,resolveKnownTags:h,schema:u,sortMapEntries:p,toStringDefaults:f}){this.compat=Array.isArray(c)?s.getTags(c,"compat"):c?s.getTags(null,c):null,this.name=typeof u=="string"&&u||"core",this.knownTags=h?s.coreKnownTags:{},this.tags=s.getTags(i,this.name,d),this.toStringOptions=f??null,Object.defineProperty(this,e.MAP,{value:t.map}),Object.defineProperty(this,e.SCALAR,{value:o.string}),Object.defineProperty(this,e.SEQ,{value:n.seq}),this.sortMapEntries=typeof p=="function"?p:p===!0?r:null}clone(){const c=Object.create(dd.prototype,Object.getOwnPropertyDescriptors(this));return c.tags=this.tags.slice(),c}};return ts.Schema=a,ts}var fs={},qi;function Cm(){if(qi)return fs;qi=1;var e=B(),t=mo(),n=po();function o(s,r){const a=[];let l=r.directives===!0;if(r.directives!==!1&&s.directives){const u=s.directives.toString(s);u?(a.push(u),l=!0):s.directives.docStart&&(l=!0)}l&&a.push("---");const c=t.createStringifyContext(s,r),{commentString:i}=c.options;if(s.commentBefore){a.length!==1&&a.unshift("");const u=i(s.commentBefore);a.unshift(n.indentComment(u,""))}let d=!1,h=null;if(s.contents){if(e.isNode(s.contents)){if(s.contents.spaceBefore&&l&&a.push(""),s.contents.commentBefore){const f=i(s.contents.commentBefore);a.push(n.indentComment(f,""))}c.forceBlockIndent=!!s.comment,h=s.contents.comment}const u=h?void 0:()=>d=!0;let p=t.stringify(s.contents,c,()=>h=null,u);h&&(p+=n.lineComment(p,"",i(h))),(p[0]==="|"||p[0]===">")&&a[a.length-1]==="---"?a[a.length-1]=`--- ${p}`:a.push(p)}else a.push(t.stringify(s.contents,c));if(s.directives?.docEnd)if(s.comment){const u=i(s.comment);u.includes(`
|
|
70
|
-
`)?(
|
|
71
|
+
${u.comment}`:d.comment}d=h}l.items[i]=e.isPair(d)?d:new t.Pair(d)}}else c("Expected a sequence for this tag");return l}function a(l,c,i){const{replacer:d}=i,h=new o.YAMLSeq(l);h.tag="tag:yaml.org,2002:pairs";let u=0;if(c&&Symbol.iterator in Object(c))for(let p of c){typeof d=="function"&&(p=d.call(c,String(u++),p));let f,m;if(Array.isArray(p))if(p.length===2)f=p[0],m=p[1];else throw new TypeError(`Expected [key, value] tuple: ${p}`);else if(p&&p instanceof Object){const g=Object.keys(p);if(g.length===1)f=g[0],m=p[f];else throw new TypeError(`Expected tuple with one key, not ${g.length} keys`)}else f=p;h.items.push(t.createPair(f,m,i))}return h}const r={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:s,createNode:a};return zt.createPairs=a,zt.pairs=r,zt.resolvePairs=s,zt}var Ni;function id(){if(Ni)return Cn;Ni=1;var e=B(),t=ft(),n=gt(),o=yt(),s=Gr();class a extends o.YAMLSeq{constructor(){super(),this.add=n.YAMLMap.prototype.add.bind(this),this.delete=n.YAMLMap.prototype.delete.bind(this),this.get=n.YAMLMap.prototype.get.bind(this),this.has=n.YAMLMap.prototype.has.bind(this),this.set=n.YAMLMap.prototype.set.bind(this),this.tag=a.tag}toJSON(c,i){if(!i)return super.toJSON(c);const d=new Map;i?.onCreate&&i.onCreate(d);for(const h of this.items){let u,p;if(e.isPair(h)?(u=t.toJS(h.key,"",i),p=t.toJS(h.value,u,i)):u=t.toJS(h,"",i),d.has(u))throw new Error("Ordered maps must not include duplicate keys");d.set(u,p)}return d}static from(c,i,d){const h=s.createPairs(c,i,d),u=new this;return u.items=h.items,u}}a.tag="tag:yaml.org,2002:omap";const r={collection:"seq",identify:l=>l instanceof Map,nodeClass:a,default:!1,tag:"tag:yaml.org,2002:omap",resolve(l,c){const i=s.resolvePairs(l,c),d=[];for(const{key:h}of i.items)e.isScalar(h)&&(d.includes(h.value)?c(`Ordered maps must not include duplicate keys: ${h.value}`):d.push(h.value));return Object.assign(new a,i)},createNode:(l,c,i)=>a.from(l,c,i)};return Cn.YAMLOMap=a,Cn.omap=r,Cn}var us={},Nn={},xi;function Am(){if(xi)return Nn;xi=1;var e=ce();function t({value:s,source:a},r){return a&&(s?n:o).test.test(a)?a:s?r.options.trueStr:r.options.falseStr}const n={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new e.Scalar(!0),stringify:t},o={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new e.Scalar(!1),stringify:t};return Nn.falseTag=o,Nn.trueTag=n,Nn}var Wt={},Ri;function Tm(){if(Ri)return Wt;Ri=1;var e=ce(),t=gn();const n={identify:a=>typeof a=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:a=>a.slice(-3).toLowerCase()==="nan"?NaN:a[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:t.stringifyNumber},o={identify:a=>typeof a=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:a=>parseFloat(a.replace(/_/g,"")),stringify(a){const r=Number(a.value);return isFinite(r)?r.toExponential():t.stringifyNumber(a)}},s={identify:a=>typeof a=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(a){const r=new e.Scalar(parseFloat(a.replace(/_/g,""))),l=a.indexOf(".");if(l!==-1){const c=a.substring(l+1).replace(/_/g,"");c[c.length-1]==="0"&&(r.minFractionDigits=c.length)}return r},stringify:t.stringifyNumber};return Wt.float=s,Wt.floatExp=o,Wt.floatNaN=n,Wt}var $t={},_i;function Om(){if(_i)return $t;_i=1;var e=gn();const t=c=>typeof c=="bigint"||Number.isInteger(c);function n(c,i,d,{intAsBigInt:h}){const u=c[0];if((u==="-"||u==="+")&&(i+=1),c=c.substring(i).replace(/_/g,""),h){switch(d){case 2:c=`0b${c}`;break;case 8:c=`0o${c}`;break;case 16:c=`0x${c}`;break}const f=BigInt(c);return u==="-"?BigInt(-1)*f:f}const p=parseInt(c,d);return u==="-"?-1*p:p}function o(c,i,d){const{value:h}=c;if(t(h)){const u=h.toString(i);return h<0?"-"+d+u.substr(1):d+u}return e.stringifyNumber(c)}const s={identify:t,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(c,i,d)=>n(c,2,2,d),stringify:c=>o(c,2,"0b")},a={identify:t,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(c,i,d)=>n(c,1,8,d),stringify:c=>o(c,8,"0")},r={identify:t,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(c,i,d)=>n(c,0,10,d),stringify:e.stringifyNumber},l={identify:t,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(c,i,d)=>n(c,2,16,d),stringify:c=>o(c,16,"0x")};return $t.int=r,$t.intBin=s,$t.intHex=l,$t.intOct=a,$t}var xn={},Pi;function ld(){if(Pi)return xn;Pi=1;var e=B(),t=mt(),n=gt();class o extends n.YAMLMap{constructor(r){super(r),this.tag=o.tag}add(r){let l;e.isPair(r)?l=r:r&&typeof r=="object"&&"key"in r&&"value"in r&&r.value===null?l=new t.Pair(r.key,null):l=new t.Pair(r,null),n.findPair(this.items,l.key)||this.items.push(l)}get(r,l){const c=n.findPair(this.items,r);return!l&&e.isPair(c)?e.isScalar(c.key)?c.key.value:c.key:c}set(r,l){if(typeof l!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof l}`);const c=n.findPair(this.items,r);c&&!l?this.items.splice(this.items.indexOf(c),1):!c&&l&&this.items.push(new t.Pair(r))}toJSON(r,l){return super.toJSON(r,l,Set)}toString(r,l,c){if(!r)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},r,{allNullValues:!0}),l,c);throw new Error("Set items must all have null values")}static from(r,l,c){const{replacer:i}=c,d=new this(r);if(l&&Symbol.iterator in Object(l))for(let h of l)typeof i=="function"&&(h=i.call(l,h,h)),d.items.push(t.createPair(h,null,c));return d}}o.tag="tag:yaml.org,2002:set";const s={collection:"map",identify:a=>a instanceof Set,nodeClass:o,default:!1,tag:"tag:yaml.org,2002:set",createNode:(a,r,l)=>o.from(a,r,l),resolve(a,r){if(e.isMap(a)){if(a.hasAllNullValues(!0))return Object.assign(new o,a);r("Set items must all have null values")}else r("Expected a mapping for this tag");return a}};return xn.YAMLSet=o,xn.set=s,xn}var Kt={},Li;function cd(){if(Li)return Kt;Li=1;var e=gn();function t(r,l){const c=r[0],i=c==="-"||c==="+"?r.substring(1):r,d=u=>l?BigInt(u):Number(u),h=i.replace(/_/g,"").split(":").reduce((u,p)=>u*d(60)+d(p),d(0));return c==="-"?d(-1)*h:h}function n(r){let{value:l}=r,c=u=>u;if(typeof l=="bigint")c=u=>BigInt(u);else if(isNaN(l)||!isFinite(l))return e.stringifyNumber(r);let i="";l<0&&(i="-",l*=c(-1));const d=c(60),h=[l%d];return l<60?h.unshift(0):(l=(l-h[0])/d,h.unshift(l%d),l>=60&&(l=(l-h[0])/d,h.unshift(l))),i+h.map(u=>String(u).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const o={identify:r=>typeof r=="bigint"||Number.isInteger(r),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(r,l,{intAsBigInt:c})=>t(r,c),stringify:n},s={identify:r=>typeof r=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:r=>t(r,!1),stringify:n},a={identify:r=>r instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(r){const l=r.match(a.test);if(!l)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,c,i,d,h,u,p]=l.map(Number),f=l[7]?Number((l[7]+"00").substr(1,3)):0;let m=Date.UTC(c,i-1,d,h||0,u||0,p||0,f);const g=l[8];if(g&&g!=="Z"){let y=t(g,!1);Math.abs(y)<30&&(y*=60),m-=6e4*y}return new Date(m)},stringify:({value:r})=>r?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};return Kt.floatTime=s,Kt.intTime=o,Kt.timestamp=a,Kt}var Ii;function Em(){if(Ii)return us;Ii=1;var e=fn(),t=Yr(),n=mn(),o=fo(),s=ad(),a=Am(),r=Tm(),l=Om(),c=Kr(),i=id(),d=Gr(),h=ld(),u=cd();const p=[e.map,n.seq,o.string,t.nullTag,a.trueTag,a.falseTag,l.intBin,l.intOct,l.int,l.intHex,r.floatNaN,r.floatExp,r.float,s.binary,c.merge,i.omap,d.pairs,h.set,u.intTime,u.floatTime,u.timestamp];return us.schema=p,us}var Mi;function Cm(){if(Mi)return En;Mi=1;var e=fn(),t=Yr(),n=mn(),o=fo(),s=od(),a=sd(),r=rd(),l=Sm(),c=jm(),i=ad(),d=Kr(),h=id(),u=Gr(),p=Em(),f=ld(),m=cd();const g=new Map([["core",l.schema],["failsafe",[e.map,n.seq,o.string]],["json",c.schema],["yaml11",p.schema],["yaml-1.1",p.schema]]),y={binary:i.binary,bool:s.boolTag,float:a.float,floatExp:a.floatExp,floatNaN:a.floatNaN,floatTime:m.floatTime,int:r.int,intHex:r.intHex,intOct:r.intOct,intTime:m.intTime,map:e.map,merge:d.merge,null:t.nullTag,omap:h.omap,pairs:u.pairs,seq:n.seq,set:f.set,timestamp:m.timestamp},b={"tag:yaml.org,2002:binary":i.binary,"tag:yaml.org,2002:merge":d.merge,"tag:yaml.org,2002:omap":h.omap,"tag:yaml.org,2002:pairs":u.pairs,"tag:yaml.org,2002:set":f.set,"tag:yaml.org,2002:timestamp":m.timestamp};function k(w,v,S){const j=g.get(v);if(j&&!w)return S&&!j.includes(d.merge)?j.concat(d.merge):j.slice();let O=j;if(!O)if(Array.isArray(w))O=[];else{const A=Array.from(g.keys()).filter(E=>E!=="yaml11").map(E=>JSON.stringify(E)).join(", ");throw new Error(`Unknown schema "${v}"; use one of ${A} or define customTags array`)}if(Array.isArray(w))for(const A of w)O=O.concat(A);else typeof w=="function"&&(O=w(O.slice()));return S&&(O=O.concat(d.merge)),O.reduce((A,E)=>{const x=typeof E=="string"?y[E]:E;if(!x){const M=JSON.stringify(E),q=Object.keys(y).map(L=>JSON.stringify(L)).join(", ");throw new Error(`Unknown custom tag ${M}; use one of ${q}`)}return A.includes(x)||A.push(x),A},[])}return En.coreKnownTags=b,En.getTags=k,En}var qi;function ud(){if(qi)return Qo;qi=1;var e=B(),t=fn(),n=mn(),o=fo(),s=Cm();const a=(l,c)=>l.key<c.key?-1:l.key>c.key?1:0;let r=class dd{constructor({compat:c,customTags:i,merge:d,resolveKnownTags:h,schema:u,sortMapEntries:p,toStringDefaults:f}){this.compat=Array.isArray(c)?s.getTags(c,"compat"):c?s.getTags(null,c):null,this.name=typeof u=="string"&&u||"core",this.knownTags=h?s.coreKnownTags:{},this.tags=s.getTags(i,this.name,d),this.toStringOptions=f??null,Object.defineProperty(this,e.MAP,{value:t.map}),Object.defineProperty(this,e.SCALAR,{value:o.string}),Object.defineProperty(this,e.SEQ,{value:n.seq}),this.sortMapEntries=typeof p=="function"?p:p===!0?a:null}clone(){const c=Object.create(dd.prototype,Object.getOwnPropertyDescriptors(this));return c.tags=this.tags.slice(),c}};return Qo.Schema=r,Qo}var hs={},Fi;function Nm(){if(Fi)return hs;Fi=1;var e=B(),t=po(),n=uo();function o(s,a){const r=[];let l=a.directives===!0;if(a.directives!==!1&&s.directives){const u=s.directives.toString(s);u?(r.push(u),l=!0):s.directives.docStart&&(l=!0)}l&&r.push("---");const c=t.createStringifyContext(s,a),{commentString:i}=c.options;if(s.commentBefore){r.length!==1&&r.unshift("");const u=i(s.commentBefore);r.unshift(n.indentComment(u,""))}let d=!1,h=null;if(s.contents){if(e.isNode(s.contents)){if(s.contents.spaceBefore&&l&&r.push(""),s.contents.commentBefore){const f=i(s.contents.commentBefore);r.push(n.indentComment(f,""))}c.forceBlockIndent=!!s.comment,h=s.contents.comment}const u=h?void 0:()=>d=!0;let p=t.stringify(s.contents,c,()=>h=null,u);h&&(p+=n.lineComment(p,"",i(h))),(p[0]==="|"||p[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${p}`:r.push(p)}else r.push(t.stringify(s.contents,c));if(s.directives?.docEnd)if(s.comment){const u=i(s.comment);u.includes(`
|
|
72
|
+
`)?(r.push("..."),r.push(n.indentComment(u,""))):r.push(`... ${u}`)}else r.push("...");else{let u=s.comment;u&&d&&(u=u.replace(/^\n+/,"")),u&&((!d||h)&&r[r.length-1]!==""&&r.push(""),r.push(n.indentComment(i(u),"")))}return r.join(`
|
|
71
73
|
`)+`
|
|
72
|
-
`}return
|
|
73
|
-
`),d=h+d}if(/[^ ]/.test(d)){let h=1;const u=
|
|
74
|
+
`}return hs.stringifyDocument=o,hs}var Di;function mo(){if(Di)return Wo;Di=1;var e=lo(),t=Wr(),n=B(),o=mt(),s=ft(),a=ud(),r=Nm(),l=Ur(),c=Xc(),i=co(),d=Zc();let h=class hd{constructor(f,m,g){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,n.NODE_TYPE,{value:n.DOC});let y=null;typeof m=="function"||Array.isArray(m)?y=m:g===void 0&&m&&(g=m,m=void 0);const b=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},g);this.options=b;let{version:k}=b;g?._directives?(this.directives=g._directives.atDocument(),this.directives.yaml.explicit&&(k=this.directives.yaml.version)):this.directives=new d.Directives({version:k}),this.setSchema(k,g),this.contents=f===void 0?null:this.createNode(f,y,g)}clone(){const f=Object.create(hd.prototype,{[n.NODE_TYPE]:{value:n.DOC}});return f.commentBefore=this.commentBefore,f.comment=this.comment,f.errors=this.errors.slice(),f.warnings=this.warnings.slice(),f.options=Object.assign({},this.options),this.directives&&(f.directives=this.directives.clone()),f.schema=this.schema.clone(),f.contents=n.isNode(this.contents)?this.contents.clone(f.schema):this.contents,this.range&&(f.range=this.range.slice()),f}add(f){u(this.contents)&&this.contents.add(f)}addIn(f,m){u(this.contents)&&this.contents.addIn(f,m)}createAlias(f,m){if(!f.anchor){const g=l.anchorNames(this);f.anchor=!m||g.has(m)?l.findNewAnchor(m||"a",g):m}return new e.Alias(f.anchor)}createNode(f,m,g){let y;if(typeof m=="function")f=m.call({"":f},"",f),y=m;else if(Array.isArray(m)){const q=ne=>typeof ne=="number"||ne instanceof String||ne instanceof Number,L=m.filter(q).map(String);L.length>0&&(m=m.concat(L)),y=m}else g===void 0&&m&&(g=m,m=void 0);const{aliasDuplicateObjects:b,anchorPrefix:k,flow:w,keepUndefined:v,onTagObj:S,tag:j}=g??{},{onAnchor:O,setAnchors:A,sourceObjects:E}=l.createNodeAnchors(this,k||"a"),x={aliasDuplicateObjects:b??!0,keepUndefined:v??!1,onAnchor:O,onTagObj:S,replacer:y,schema:this.schema,sourceObjects:E},M=i.createNode(f,j,x);return w&&n.isCollection(M)&&(M.flow=!0),A(),M}createPair(f,m,g={}){const y=this.createNode(f,null,g),b=this.createNode(m,null,g);return new o.Pair(y,b)}delete(f){return u(this.contents)?this.contents.delete(f):!1}deleteIn(f){return t.isEmptyPath(f)?this.contents==null?!1:(this.contents=null,!0):u(this.contents)?this.contents.deleteIn(f):!1}get(f,m){return n.isCollection(this.contents)?this.contents.get(f,m):void 0}getIn(f,m){return t.isEmptyPath(f)?!m&&n.isScalar(this.contents)?this.contents.value:this.contents:n.isCollection(this.contents)?this.contents.getIn(f,m):void 0}has(f){return n.isCollection(this.contents)?this.contents.has(f):!1}hasIn(f){return t.isEmptyPath(f)?this.contents!==void 0:n.isCollection(this.contents)?this.contents.hasIn(f):!1}set(f,m){this.contents==null?this.contents=t.collectionFromPath(this.schema,[f],m):u(this.contents)&&this.contents.set(f,m)}setIn(f,m){t.isEmptyPath(f)?this.contents=m:this.contents==null?this.contents=t.collectionFromPath(this.schema,Array.from(f),m):u(this.contents)&&this.contents.setIn(f,m)}setSchema(f,m={}){typeof f=="number"&&(f=String(f));let g;switch(f){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new d.Directives({version:"1.1"}),g={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=f:this.directives=new d.Directives({version:f}),g={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,g=null;break;default:{const y=JSON.stringify(f);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${y}`)}}if(m.schema instanceof Object)this.schema=m.schema;else if(g)this.schema=new a.Schema(Object.assign(g,m));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:f,jsonArg:m,mapAsMap:g,maxAliasCount:y,onAnchor:b,reviver:k}={}){const w={anchors:new Map,doc:this,keep:!f,mapAsMap:g===!0,mapKeyWarned:!1,maxAliasCount:typeof y=="number"?y:100},v=s.toJS(this.contents,m??"",w);if(typeof b=="function")for(const{count:S,res:j}of w.anchors.values())b(j,S);return typeof k=="function"?c.applyReviver(k,{"":v},"",v):v}toJSON(f,m){return this.toJS({json:!0,jsonArg:f,mapAsMap:!1,onAnchor:m})}toString(f={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in f&&(!Number.isInteger(f.indent)||Number(f.indent)<=0)){const m=JSON.stringify(f.indent);throw new Error(`"indent" option must be a positive integer, not ${m}`)}return r.stringifyDocument(this,f)}};function u(p){if(n.isCollection(p))return!0;throw new Error("Expected a YAML collection as document contents")}return Wo.Document=h,Wo}var St={},Bi;function go(){if(Bi)return St;Bi=1;class e extends Error{constructor(a,r,l,c){super(),this.name=a,this.code=l,this.message=c,this.pos=r}}class t extends e{constructor(a,r,l){super("YAMLParseError",a,r,l)}}class n extends e{constructor(a,r,l){super("YAMLWarning",a,r,l)}}const o=(s,a)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(h=>a.linePos(h));const{line:l,col:c}=r.linePos[0];r.message+=` at line ${l}, column ${c}`;let i=c-1,d=s.substring(a.lineStarts[l-1],a.lineStarts[l]).replace(/[\n\r]+$/,"");if(i>=60&&d.length>80){const h=Math.min(i-39,d.length-79);d="…"+d.substring(h),i-=h-1}if(d.length>80&&(d=d.substring(0,79)+"…"),l>1&&/^ *$/.test(d.substring(0,i))){let h=s.substring(a.lineStarts[l-2],a.lineStarts[l-1]);h.length>80&&(h=h.substring(0,79)+`…
|
|
75
|
+
`),d=h+d}if(/[^ ]/.test(d)){let h=1;const u=r.linePos[1];u?.line===l&&u.col>c&&(h=Math.max(1,Math.min(u.col-c,80-i)));const p=" ".repeat(i)+"^".repeat(h);r.message+=`:
|
|
74
76
|
|
|
75
77
|
${d}
|
|
76
78
|
${p}
|
|
77
|
-
`}};return St.YAMLError=e,St.YAMLParseError=t,St.YAMLWarning=n,St.prettifyError=o,St}var
|
|
78
|
-
`))return!0;if(t.end){for(const n of t.end)if(n.type==="newline")return!0}return!1;case"flow-collection":for(const n of t.items){for(const o of n.start)if(o.type==="newline")return!0;if(n.sep){for(const o of n.sep)if(o.type==="newline")return!0}if(e(n.key)||e(n.value))return!0}return!1;default:return!0}}return
|
|
79
|
-
`+j.comment:m.comment=j.comment);continue}(j.newlineAfterProp||o.containsNewline(w))&&u(w??k[k.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else j.found?.indent!==h.indent&&u(g,"BAD_INDENT",
|
|
80
|
-
`+x.comment:E.comment=x.comment);const
|
|
81
|
-
`+N.comment:w.comment=N.comment),S=N.end;continue}!y&&p.options.strict&&
|
|
82
|
-
`+Z:U.comment=Z,N.comment=N.comment.substring(Z.length+1)}}if(!y&&!ne&&!N.found){const Z=
|
|
83
|
-
`+oe.comment:U.comment=oe.comment);const T=new t.Pair(U,$);if(p.options.keepSourceTokens&&(T.srcToken=
|
|
84
|
-
`+x.comment:w.comment=x.comment),w.range=[f.offset,E,x.offset]}else w.range=[f.offset,E,E];return w}return
|
|
85
|
-
`.repeat(Math.max(1,d.length-1)):"";let w=l+c.length;return
|
|
86
|
-
`;for(let k=f;k<h;++k){let[w,v]=d[k];p+=w.length+v.length+1;const S=v[v.length-1]==="\r";if(S&&(v=v.slice(0,-1)),v&&w.length<u){const O=`Block scalar lines must not be less indented than their ${c.indent?"explicit indentation indicator":"first line"}`;
|
|
79
|
+
`}};return St.YAMLError=e,St.YAMLParseError=t,St.YAMLWarning=n,St.prettifyError=o,St}var ps={},Rn={},fs={},ms={},gs={},Ui;function yo(){if(Ui)return gs;Ui=1;function e(t,{flow:n,indicator:o,next:s,offset:a,onError:r,parentIndent:l,startOnNewline:c}){let i=!1,d=c,h=c,u="",p="",f=!1,m=!1,g=null,y=null,b=null,k=null,w=null,v=null,S=null;for(const A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&r(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),g&&(d&&A.type!=="comment"&&A.type!=="newline"&&r(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),A.type){case"space":!n&&(o!=="doc-start"||s?.type!=="flow-collection")&&A.source.includes(" ")&&(g=A),h=!0;break;case"comment":{h||r(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const E=A.source.substring(1)||" ";u?u+=p+E:u=E,p="",d=!1;break}case"newline":d?u?u+=A.source:(!v||o!=="seq-item-ind")&&(i=!0):p+=A.source,d=!0,f=!0,(y||b)&&(k=A),h=!0;break;case"anchor":y&&r(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&r(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=A,S??(S=A.offset),d=!1,h=!1,m=!0;break;case"tag":{b&&r(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,S??(S=A.offset),d=!1,h=!1,m=!0;break}case o:(y||b)&&r(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),v&&r(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${n??"collection"}`),v=A,d=o==="seq-item-ind"||o==="explicit-key-ind",h=!1;break;case"comma":if(n){w&&r(A,"UNEXPECTED_TOKEN",`Unexpected , in ${n}`),w=A,d=!1,h=!1;break}default:r(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),d=!1,h=!1}const j=t[t.length-1],O=j?j.offset+j.source.length:a;return m&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g&&(d&&g.indent<=l||s?.type==="block-map"||s?.type==="block-seq")&&r(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:w,found:v,spaceBefore:i,comment:u,hasNewline:f,anchor:y,tag:b,newlineAfterProp:k,end:O,start:S??O}}return gs.resolveProps=e,gs}var ys={},zi;function Hr(){if(zi)return ys;zi=1;function e(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
80
|
+
`))return!0;if(t.end){for(const n of t.end)if(n.type==="newline")return!0}return!1;case"flow-collection":for(const n of t.items){for(const o of n.start)if(o.type==="newline")return!0;if(n.sep){for(const o of n.sep)if(o.type==="newline")return!0}if(e(n.key)||e(n.value))return!0}return!1;default:return!0}}return ys.containsNewline=e,ys}var bs={},Wi;function pd(){if(Wi)return bs;Wi=1;var e=Hr();function t(n,o,s){if(o?.type==="flow-collection"){const a=o.end[0];a.indent===n&&(a.source==="]"||a.source==="}")&&e.containsNewline(o)&&s(a,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}return bs.flowIndentCheck=t,bs}var ws={},Ki;function fd(){if(Ki)return ws;Ki=1;var e=B();function t(n,o,s){const{uniqueKeys:a}=n.options;if(a===!1)return!1;const r=typeof a=="function"?a:(l,c)=>l===c||e.isScalar(l)&&e.isScalar(c)&&l.value===c.value;return o.some(l=>r(l.key,s))}return ws.mapIncludes=t,ws}var Yi;function xm(){if(Yi)return ms;Yi=1;var e=mt(),t=gt(),n=yo(),o=Hr(),s=pd(),a=fd();const r="All mapping items must start at the same column";function l({composeNode:c,composeEmptyNode:i},d,h,u,p){const f=p?.nodeClass??t.YAMLMap,m=new f(d.schema);d.atRoot&&(d.atRoot=!1);let g=h.offset,y=null;for(const b of h.items){const{start:k,key:w,sep:v,value:S}=b,j=n.resolveProps(k,{indicator:"explicit-key-ind",next:w??v?.[0],offset:g,onError:u,parentIndent:h.indent,startOnNewline:!0}),O=!j.found;if(O){if(w&&(w.type==="block-seq"?u(g,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in w&&w.indent!==h.indent&&u(g,"BAD_INDENT",r)),!j.anchor&&!j.tag&&!v){y=j.end,j.comment&&(m.comment?m.comment+=`
|
|
81
|
+
`+j.comment:m.comment=j.comment);continue}(j.newlineAfterProp||o.containsNewline(w))&&u(w??k[k.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else j.found?.indent!==h.indent&&u(g,"BAD_INDENT",r);d.atKey=!0;const A=j.end,E=w?c(d,w,j,u):i(d,A,k,null,j,u);d.schema.compat&&s.flowIndentCheck(h.indent,w,u),d.atKey=!1,a.mapIncludes(d,m.items,E)&&u(A,"DUPLICATE_KEY","Map keys must be unique");const x=n.resolveProps(v??[],{indicator:"map-value-ind",next:S,offset:E.range[2],onError:u,parentIndent:h.indent,startOnNewline:!w||w.type==="block-scalar"});if(g=x.end,x.found){O&&(S?.type==="block-map"&&!x.hasNewline&&u(g,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),d.options.strict&&j.start<x.found.offset-1024&&u(E.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const M=S?c(d,S,x,u):i(d,g,v,null,x,u);d.schema.compat&&s.flowIndentCheck(h.indent,S,u),g=M.range[2];const q=new e.Pair(E,M);d.options.keepSourceTokens&&(q.srcToken=b),m.items.push(q)}else{O&&u(E.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),x.comment&&(E.comment?E.comment+=`
|
|
82
|
+
`+x.comment:E.comment=x.comment);const M=new e.Pair(E);d.options.keepSourceTokens&&(M.srcToken=b),m.items.push(M)}}return y&&y<g&&u(y,"IMPOSSIBLE","Map comment with trailing content"),m.range=[h.offset,g,y??g],m}return ms.resolveBlockMap=l,ms}var ks={},Gi;function Rm(){if(Gi)return ks;Gi=1;var e=yt(),t=yo(),n=pd();function o({composeNode:s,composeEmptyNode:a},r,l,c,i){const d=i?.nodeClass??e.YAMLSeq,h=new d(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let u=l.offset,p=null;for(const{start:f,value:m}of l.items){const g=t.resolveProps(f,{indicator:"seq-item-ind",next:m,offset:u,onError:c,parentIndent:l.indent,startOnNewline:!0});if(!g.found)if(g.anchor||g.tag||m)m?.type==="block-seq"?c(g.end,"BAD_INDENT","All sequence items must start at the same column"):c(u,"MISSING_CHAR","Sequence item without - indicator");else{p=g.end,g.comment&&(h.comment=g.comment);continue}const y=m?s(r,m,g,c):a(r,g.end,f,null,g,c);r.schema.compat&&n.flowIndentCheck(l.indent,m,c),u=y.range[2],h.items.push(y)}return h.range=[l.offset,u,p??u],h}return ks.resolveBlockSeq=o,ks}var vs={},$s={},Hi;function yn(){if(Hi)return $s;Hi=1;function e(t,n,o,s){let a="";if(t){let r=!1,l="";for(const c of t){const{source:i,type:d}=c;switch(d){case"space":r=!0;break;case"comment":{o&&!r&&s(c,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const h=i.substring(1)||" ";a?a+=l+h:a=h,l="";break}case"newline":a&&(l+=i),r=!0;break;default:s(c,"UNEXPECTED_TOKEN",`Unexpected ${d} at node end`)}n+=i.length}}return{comment:a,offset:n}}return $s.resolveEnd=e,$s}var Vi;function _m(){if(Vi)return vs;Vi=1;var e=B(),t=mt(),n=gt(),o=yt(),s=yn(),a=yo(),r=Hr(),l=fd();const c="Block collections are not allowed within flow collections",i=h=>h&&(h.type==="block-map"||h.type==="block-seq");function d({composeNode:h,composeEmptyNode:u},p,f,m,g){const y=f.start.source==="{",b=y?"flow map":"flow sequence",k=g?.nodeClass??(y?n.YAMLMap:o.YAMLSeq),w=new k(p.schema);w.flow=!0;const v=p.atRoot;v&&(p.atRoot=!1),p.atKey&&(p.atKey=!1);let S=f.offset+f.start.source.length;for(let x=0;x<f.items.length;++x){const M=f.items[x],{start:q,key:L,sep:ne,value:I}=M,N=a.resolveProps(q,{flow:b,indicator:"explicit-key-ind",next:L??ne?.[0],offset:S,onError:m,parentIndent:f.indent,startOnNewline:!1});if(!N.found){if(!N.anchor&&!N.tag&&!ne&&!I){x===0&&N.comma?m(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${b}`):x<f.items.length-1&&m(N.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${b}`),N.comment&&(w.comment?w.comment+=`
|
|
83
|
+
`+N.comment:w.comment=N.comment),S=N.end;continue}!y&&p.options.strict&&r.containsNewline(L)&&m(L,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(x===0)N.comma&&m(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${b}`);else if(N.comma||m(N.start,"MISSING_CHAR",`Missing , between ${b} items`),N.comment){let Z="";e:for(const U of q)switch(U.type){case"comma":case"space":break;case"comment":Z=U.source.substring(1);break e;default:break e}if(Z){let U=w.items[w.items.length-1];e.isPair(U)&&(U=U.value??U.key),U.comment?U.comment+=`
|
|
84
|
+
`+Z:U.comment=Z,N.comment=N.comment.substring(Z.length+1)}}if(!y&&!ne&&!N.found){const Z=I?h(p,I,N,m):u(p,N.end,ne,null,N,m);w.items.push(Z),S=Z.range[2],i(I)&&m(Z.range,"BLOCK_IN_FLOW",c)}else{p.atKey=!0;const Z=N.end,U=L?h(p,L,N,m):u(p,Z,q,null,N,m);i(L)&&m(U.range,"BLOCK_IN_FLOW",c),p.atKey=!1;const oe=a.resolveProps(ne??[],{flow:b,indicator:"map-value-ind",next:I,offset:U.range[2],onError:m,parentIndent:f.indent,startOnNewline:!1});if(oe.found){if(!y&&!N.found&&p.options.strict){if(ne)for(const C of ne){if(C===oe.found)break;if(C.type==="newline"){m(C,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}N.start<oe.found.offset-1024&&m(oe.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else I&&("source"in I&&I.source?.[0]===":"?m(I,"MISSING_CHAR",`Missing space after : in ${b}`):m(oe.start,"MISSING_CHAR",`Missing , or : between ${b} items`));const $=I?h(p,I,oe,m):oe.found?u(p,oe.end,ne,null,oe,m):null;$?i(I)&&m($.range,"BLOCK_IN_FLOW",c):oe.comment&&(U.comment?U.comment+=`
|
|
85
|
+
`+oe.comment:U.comment=oe.comment);const T=new t.Pair(U,$);if(p.options.keepSourceTokens&&(T.srcToken=M),y){const C=w;l.mapIncludes(p,C.items,U)&&m(Z,"DUPLICATE_KEY","Map keys must be unique"),C.items.push(T)}else{const C=new n.YAMLMap(p.schema);C.flow=!0,C.items.push(T);const R=($??U).range;C.range=[U.range[0],R[1],R[2]],w.items.push(C)}S=$?$.range[2]:oe.end}}const j=y?"}":"]",[O,...A]=f.end;let E=S;if(O?.source===j)E=O.offset+O.source.length;else{const x=b[0].toUpperCase()+b.substring(1),M=v?`${x} must end with a ${j}`:`${x} in block collection must be sufficiently indented and end with a ${j}`;m(S,v?"MISSING_CHAR":"BAD_INDENT",M),O&&O.source.length!==1&&A.unshift(O)}if(A.length>0){const x=s.resolveEnd(A,E,p.options.strict,m);x.comment&&(w.comment?w.comment+=`
|
|
86
|
+
`+x.comment:w.comment=x.comment),w.range=[f.offset,E,x.offset]}else w.range=[f.offset,E,E];return w}return vs.resolveFlowCollection=d,vs}var Ji;function Pm(){if(Ji)return fs;Ji=1;var e=B(),t=ce(),n=gt(),o=yt(),s=xm(),a=Rm(),r=_m();function l(i,d,h,u,p,f){const m=h.type==="block-map"?s.resolveBlockMap(i,d,h,u,f):h.type==="block-seq"?a.resolveBlockSeq(i,d,h,u,f):r.resolveFlowCollection(i,d,h,u,f),g=m.constructor;return p==="!"||p===g.tagName?(m.tag=g.tagName,m):(p&&(m.tag=p),m)}function c(i,d,h,u,p){const f=u.tag,m=f?d.directives.tagName(f.source,v=>p(f,"TAG_RESOLVE_FAILED",v)):null;if(h.type==="block-seq"){const{anchor:v,newlineAfterProp:S}=u,j=v&&f?v.offset>f.offset?v:f:v??f;j&&(!S||S.offset<j.offset)&&p(j,"MISSING_CHAR","Missing newline after block sequence props")}const g=h.type==="block-map"?"map":h.type==="block-seq"?"seq":h.start.source==="{"?"map":"seq";if(!f||!m||m==="!"||m===n.YAMLMap.tagName&&g==="map"||m===o.YAMLSeq.tagName&&g==="seq")return l(i,d,h,p,m);let y=d.schema.tags.find(v=>v.tag===m&&v.collection===g);if(!y){const v=d.schema.knownTags[m];if(v?.collection===g)d.schema.tags.push(Object.assign({},v,{default:!1})),y=v;else return v?p(f,"BAD_COLLECTION_TYPE",`${v.tag} used for ${g} collection, but expects ${v.collection??"scalar"}`,!0):p(f,"TAG_RESOLVE_FAILED",`Unresolved tag: ${m}`,!0),l(i,d,h,p,m)}const b=l(i,d,h,p,m,y),k=y.resolve?.(b,v=>p(f,"TAG_RESOLVE_FAILED",v),d.options)??b,w=e.isNode(k)?k:new t.Scalar(k);return w.range=b.range,w.tag=m,y?.format&&(w.format=y.format),w}return fs.composeCollection=c,fs}var Ss={},js={},Zi;function md(){if(Zi)return js;Zi=1;var e=ce();function t(s,a,r){const l=a.offset,c=n(a,s.options.strict,r);if(!c)return{value:"",type:null,comment:"",range:[l,l,l]};const i=c.mode===">"?e.Scalar.BLOCK_FOLDED:e.Scalar.BLOCK_LITERAL,d=a.source?o(a.source):[];let h=d.length;for(let k=d.length-1;k>=0;--k){const w=d[k][1];if(w===""||w==="\r")h=k;else break}if(h===0){const k=c.chomp==="+"&&d.length>0?`
|
|
87
|
+
`.repeat(Math.max(1,d.length-1)):"";let w=l+c.length;return a.source&&(w+=a.source.length),{value:k,type:i,comment:c.comment,range:[l,w,w]}}let u=a.indent+c.indent,p=a.offset+c.length,f=0;for(let k=0;k<h;++k){const[w,v]=d[k];if(v===""||v==="\r")c.indent===0&&w.length>u&&(u=w.length);else{w.length<u&&r(p+w.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),c.indent===0&&(u=w.length),f=k,u===0&&!s.atRoot&&r(p,"BAD_INDENT","Block scalar values in collections must be indented");break}p+=w.length+v.length+1}for(let k=d.length-1;k>=h;--k)d[k][0].length>u&&(h=k+1);let m="",g="",y=!1;for(let k=0;k<f;++k)m+=d[k][0].slice(u)+`
|
|
88
|
+
`;for(let k=f;k<h;++k){let[w,v]=d[k];p+=w.length+v.length+1;const S=v[v.length-1]==="\r";if(S&&(v=v.slice(0,-1)),v&&w.length<u){const O=`Block scalar lines must not be less indented than their ${c.indent?"explicit indentation indicator":"first line"}`;r(p-v.length-(S?2:1),"BAD_INDENT",O),w=""}i===e.Scalar.BLOCK_LITERAL?(m+=g+w.slice(u)+v,g=`
|
|
87
89
|
`):w.length>u||v[0]===" "?(g===" "?g=`
|
|
88
90
|
`:!y&&g===`
|
|
89
91
|
`&&(g=`
|
|
@@ -96,11 +98,11 @@ ${p}
|
|
|
96
98
|
`+d[k][0].slice(u);m[m.length-1]!==`
|
|
97
99
|
`&&(m+=`
|
|
98
100
|
`);break;default:m+=`
|
|
99
|
-
`}const b=l+c.length+
|
|
101
|
+
`}const b=l+c.length+a.source.length;return{value:m,type:i,comment:c.comment,range:[l,b,b]}}function n({offset:s,props:a},r,l){if(a[0].type!=="block-scalar-header")return l(a[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:c}=a[0],i=c[0];let d=0,h="",u=-1;for(let g=1;g<c.length;++g){const y=c[g];if(!h&&(y==="-"||y==="+"))h=y;else{const b=Number(y);!d&&b?d=b:u===-1&&(u=s+g)}}u!==-1&&l(u,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${c}`);let p=!1,f="",m=c.length;for(let g=1;g<a.length;++g){const y=a[g];switch(y.type){case"space":p=!0;case"newline":m+=y.source.length;break;case"comment":r&&!p&&l(y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),m+=y.source.length,f=y.source.substring(1);break;case"error":l(y,"UNEXPECTED_TOKEN",y.message),m+=y.source.length;break;default:{const b=`Unexpected token in block scalar header: ${y.type}`;l(y,"UNEXPECTED_TOKEN",b);const k=y.source;k&&typeof k=="string"&&(m+=k.length)}}}return{mode:i,indent:d,chomp:h,comment:f,length:m}}function o(s){const a=s.split(/\n( *)/),r=a[0],l=r.match(/^( *)/),i=[l?.[1]?[l[1],r.slice(l[1].length)]:["",r]];for(let d=1;d<a.length;d+=2)i.push([a[d],a[d+1]]);return i}return js.resolveBlockScalar=t,js}var As={},Xi;function gd(){if(Xi)return As;Xi=1;var e=ce(),t=yn();function n(d,h,u){const{offset:p,type:f,source:m,end:g}=d;let y,b;const k=(S,j,O)=>u(p+S,j,O);switch(f){case"scalar":y=e.Scalar.PLAIN,b=o(m,k);break;case"single-quoted-scalar":y=e.Scalar.QUOTE_SINGLE,b=s(m,k);break;case"double-quoted-scalar":y=e.Scalar.QUOTE_DOUBLE,b=r(m,k);break;default:return u(d,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${f}`),{value:"",type:null,comment:"",range:[p,p+m.length,p+m.length]}}const w=p+m.length,v=t.resolveEnd(g,w,h,u);return{value:b,type:y,comment:v.comment,range:[p,w,v.offset]}}function o(d,h){let u="";switch(d[0]){case" ":u="a tab character";break;case",":u="flow indicator character ,";break;case"%":u="directive indicator character %";break;case"|":case">":{u=`block scalar indicator ${d[0]}`;break}case"@":case"`":{u=`reserved character ${d[0]}`;break}}return u&&h(0,"BAD_SCALAR_START",`Plain value cannot start with ${u}`),a(d)}function s(d,h){return(d[d.length-1]!=="'"||d.length===1)&&h(d.length,"MISSING_CHAR","Missing closing 'quote"),a(d.slice(1,-1)).replace(/''/g,"'")}function a(d){let h,u;try{h=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
100
102
|
`,"sy"),u=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
101
103
|
`,"sy")}catch{h=/(.*?)[ \t]*\r?\n/sy,u=/[ \t]*(.*?)[ \t]*\r?\n/sy}let p=h.exec(d);if(!p)return d;let f=p[1],m=" ",g=h.lastIndex;for(u.lastIndex=g;p=u.exec(d);)p[1]===""?m===`
|
|
102
104
|
`?f+=m:m=`
|
|
103
|
-
`:(f+=m+p[1],m=" "),g=u.lastIndex;const y=/[ \t]*(.*)/sy;return y.lastIndex=g,p=y.exec(d),f+m+(p?.[1]??"")}function
|
|
105
|
+
`:(f+=m+p[1],m=" "),g=u.lastIndex;const y=/[ \t]*(.*)/sy;return y.lastIndex=g,p=y.exec(d),f+m+(p?.[1]??"")}function r(d,h){let u="";for(let p=1;p<d.length-1;++p){const f=d[p];if(!(f==="\r"&&d[p+1]===`
|
|
104
106
|
`))if(f===`
|
|
105
107
|
`){const{fold:m,offset:g}=l(d,p);u+=m,p=g}else if(f==="\\"){let m=d[++p];const g=c[m];if(g)u+=g;else if(m===`
|
|
106
108
|
`)for(m=d[p+1];m===" "||m===" ";)m=d[++p+1];else if(m==="\r"&&d[p+1]===`
|
|
@@ -111,31 +113,31 @@ ${p}
|
|
|
111
113
|
`);)p===`
|
|
112
114
|
`&&(u+=`
|
|
113
115
|
`),h+=1,p=d[h+1];return u||(u=" "),{fold:u,offset:h}}const c={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
114
|
-
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function i(d,h,u,p){const f=d.substr(h,u),g=f.length===u&&/^[0-9a-fA-F]+$/.test(f)?parseInt(f,16):NaN;try{return String.fromCodePoint(g)}catch{const y=d.substr(h-2,u+2);return p(h-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${y}`),y}}return
|
|
116
|
+
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function i(d,h,u,p){const f=d.substr(h,u),g=f.length===u&&/^[0-9a-fA-F]+$/.test(f)?parseInt(f,16):NaN;try{return String.fromCodePoint(g)}catch{const y=d.substr(h-2,u+2);return p(h-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${y}`),y}}return As.resolveFlowScalar=n,As}var Qi;function Lm(){if(Qi)return Ss;Qi=1;var e=B(),t=ce(),n=md(),o=gd();function s(l,c,i,d){const{value:h,type:u,comment:p,range:f}=c.type==="block-scalar"?n.resolveBlockScalar(l,c,d):o.resolveFlowScalar(c,l.options.strict,d),m=i?l.directives.tagName(i.source,b=>d(i,"TAG_RESOLVE_FAILED",b)):null;let g;l.options.stringKeys&&l.atKey?g=l.schema[e.SCALAR]:m?g=a(l.schema,h,m,i,d):c.type==="scalar"?g=r(l,h,c,d):g=l.schema[e.SCALAR];let y;try{const b=g.resolve(h,k=>d(i??c,"TAG_RESOLVE_FAILED",k),l.options);y=e.isScalar(b)?b:new t.Scalar(b)}catch(b){const k=b instanceof Error?b.message:String(b);d(i??c,"TAG_RESOLVE_FAILED",k),y=new t.Scalar(h)}return y.range=f,y.source=h,u&&(y.type=u),m&&(y.tag=m),g.format&&(y.format=g.format),p&&(y.comment=p),y}function a(l,c,i,d,h){if(i==="!")return l[e.SCALAR];const u=[];for(const f of l.tags)if(!f.collection&&f.tag===i)if(f.default&&f.test)u.push(f);else return f;for(const f of u)if(f.test?.test(c))return f;const p=l.knownTags[i];return p&&!p.collection?(l.tags.push(Object.assign({},p,{default:!1,test:void 0})),p):(h(d,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),l[e.SCALAR])}function r({atKey:l,directives:c,schema:i},d,h,u){const p=i.tags.find(f=>(f.default===!0||l&&f.default==="key")&&f.test?.test(d))||i[e.SCALAR];if(i.compat){const f=i.compat.find(m=>m.default&&m.test?.test(d))??i[e.SCALAR];if(p.tag!==f.tag){const m=c.tagString(p.tag),g=c.tagString(f.tag),y=`Value may be parsed as either ${m} or ${g}`;u(h,"TAG_RESOLVE_FAILED",y,!0)}}return p}return Ss.composeScalar=s,Ss}var Ts={},el;function Im(){if(el)return Ts;el=1;function e(t,n,o){if(n){o??(o=n.length);for(let s=o-1;s>=0;--s){let a=n[s];switch(a.type){case"space":case"comment":case"newline":t-=a.source.length;continue}for(a=n[++s];a?.type==="space";)t+=a.source.length,a=n[++s];break}}return t}return Ts.emptyScalarPosition=e,Ts}var tl;function Mm(){if(tl)return Rn;tl=1;var e=lo(),t=B(),n=Pm(),o=Lm(),s=yn(),a=Im();const r={composeNode:l,composeEmptyNode:c};function l(d,h,u,p){const f=d.atKey,{spaceBefore:m,comment:g,anchor:y,tag:b}=u;let k,w=!0;switch(h.type){case"alias":k=i(d,h,p),(y||b)&&p(h,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":k=o.composeScalar(d,h,b,p),y&&(k.anchor=y.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{k=n.composeCollection(r,d,h,u,p),y&&(k.anchor=y.source.substring(1))}catch(v){const S=v instanceof Error?v.message:String(v);p(h,"RESOURCE_EXHAUSTION",S)}break;default:{const v=h.type==="error"?h.message:`Unsupported token (type: ${h.type})`;p(h,"UNEXPECTED_TOKEN",v),w=!1}}return k??(k=c(d,h.offset,void 0,null,u,p)),y&&k.anchor===""&&p(y,"BAD_ALIAS","Anchor cannot be an empty string"),f&&d.options.stringKeys&&(!t.isScalar(k)||typeof k.value!="string"||k.tag&&k.tag!=="tag:yaml.org,2002:str")&&p(b??h,"NON_STRING_KEY","With stringKeys, all keys must be strings"),m&&(k.spaceBefore=!0),g&&(h.type==="scalar"&&h.source===""?k.comment=g:k.commentBefore=g),d.options.keepSourceTokens&&w&&(k.srcToken=h),k}function c(d,h,u,p,{spaceBefore:f,comment:m,anchor:g,tag:y,end:b},k){const w={type:"scalar",offset:a.emptyScalarPosition(h,u,p),indent:-1,source:""},v=o.composeScalar(d,w,y,k);return g&&(v.anchor=g.source.substring(1),v.anchor===""&&k(g,"BAD_ALIAS","Anchor cannot be an empty string")),f&&(v.spaceBefore=!0),m&&(v.comment=m,v.range[2]=b),v}function i({options:d},{offset:h,source:u,end:p},f){const m=new e.Alias(u.substring(1));m.source===""&&f(h,"BAD_ALIAS","Alias cannot be an empty string"),m.source.endsWith(":")&&f(h+u.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const g=h+u.length,y=s.resolveEnd(p,g,d.strict,f);return m.range=[h,g,y.offset],y.comment&&(m.comment=y.comment),m}return Rn.composeEmptyNode=c,Rn.composeNode=l,Rn}var nl;function qm(){if(nl)return ps;nl=1;var e=mo(),t=Mm(),n=yn(),o=yo();function s(a,r,{offset:l,start:c,value:i,end:d},h){const u=Object.assign({_directives:r},a),p=new e.Document(void 0,u),f={atKey:!1,atRoot:!0,directives:p.directives,options:p.options,schema:p.schema},m=o.resolveProps(c,{indicator:"doc-start",next:i??d?.[0],offset:l,onError:h,parentIndent:0,startOnNewline:!0});m.found&&(p.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!m.hasNewline&&h(m.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),p.contents=i?t.composeNode(f,i,m,h):t.composeEmptyNode(f,m.end,c,null,m,h);const g=p.contents.range[2],y=n.resolveEnd(d,g,!1,h);return y.comment&&(p.comment=y.comment),p.range=[l,g,y.offset],p}return ps.composeDoc=s,ps}var ol;function yd(){if(ol)return Uo;ol=1;var e=Or,t=Zc(),n=mo(),o=go(),s=B(),a=qm(),r=yn();function l(d){if(typeof d=="number")return[d,d+1];if(Array.isArray(d))return d.length===2?d:[d[0],d[1]];const{offset:h,source:u}=d;return[h,h+(typeof u=="string"?u.length:1)]}function c(d){let h="",u=!1,p=!1;for(let f=0;f<d.length;++f){const m=d[f];switch(m[0]){case"#":h+=(h===""?"":p?`
|
|
115
117
|
|
|
116
118
|
`:`
|
|
117
119
|
`)+(m.substring(1)||" "),u=!0,p=!1;break;case"%":d[f+1]?.[0]!=="#"&&(f+=1),u=!1;break;default:u||(p=!0),u=!1}}return{comment:h,afterEmptyLine:p}}class i{constructor(h={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(u,p,f,m)=>{const g=l(u);m?this.warnings.push(new o.YAMLWarning(g,p,f)):this.errors.push(new o.YAMLParseError(g,p,f))},this.directives=new t.Directives({version:h.version||"1.2"}),this.options=h}decorate(h,u){const{comment:p,afterEmptyLine:f}=c(this.prelude);if(p){const m=h.contents;if(u)h.comment=h.comment?`${h.comment}
|
|
118
120
|
${p}`:p;else if(f||h.directives.docStart||!m)h.commentBefore=p;else if(s.isCollection(m)&&!m.flow&&m.items.length>0){let g=m.items[0];s.isPair(g)&&(g=g.key);const y=g.commentBefore;g.commentBefore=y?`${p}
|
|
119
121
|
${y}`:p}else{const g=m.commentBefore;m.commentBefore=g?`${p}
|
|
120
|
-
${g}`:p}}if(u){for(let m=0;m<this.errors.length;++m)h.errors.push(this.errors[m]);for(let m=0;m<this.warnings.length;++m)h.warnings.push(this.warnings[m])}else h.errors=this.errors,h.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:c(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(h,u=!1,p=-1){for(const f of h)yield*this.next(f);yield*this.end(u,p)}*next(h){switch(e.env.LOG_STREAM&&console.dir(h,{depth:null}),h.type){case"directive":this.directives.add(h.source,(u,p,f)=>{const m=l(h);m[0]+=u,this.onError(m,"BAD_DIRECTIVE",p,f)}),this.prelude.push(h.source),this.atDirectives=!0;break;case"document":{const u=
|
|
121
|
-
${u.comment}`:u.comment}this.doc.range[2]=u.offset;break}default:this.errors.push(new o.YAMLParseError(l(h),"UNEXPECTED_TOKEN",`Unsupported token ${h.type}`))}}*end(h=!1,u=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(h){const p=Object.assign({_directives:this.directives},this.options),f=new n.Document(void 0,p);this.atDirectives&&this.onError(u,"MISSING_CHAR","Missing directives-end indicator line"),f.range=[0,u,u],this.decorate(f,!1),yield f}}}return
|
|
122
|
+
${g}`:p}}if(u){for(let m=0;m<this.errors.length;++m)h.errors.push(this.errors[m]);for(let m=0;m<this.warnings.length;++m)h.warnings.push(this.warnings[m])}else h.errors=this.errors,h.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:c(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(h,u=!1,p=-1){for(const f of h)yield*this.next(f);yield*this.end(u,p)}*next(h){switch(e.env.LOG_STREAM&&console.dir(h,{depth:null}),h.type){case"directive":this.directives.add(h.source,(u,p,f)=>{const m=l(h);m[0]+=u,this.onError(m,"BAD_DIRECTIVE",p,f)}),this.prelude.push(h.source),this.atDirectives=!0;break;case"document":{const u=a.composeDoc(this.options,this.directives,h,this.onError);this.atDirectives&&!u.directives.docStart&&this.onError(h,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(u,!1),this.doc&&(yield this.doc),this.doc=u,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(h.source);break;case"error":{const u=h.source?`${h.message}: ${JSON.stringify(h.source)}`:h.message,p=new o.YAMLParseError(l(h),"UNEXPECTED_TOKEN",u);this.atDirectives||!this.doc?this.errors.push(p):this.doc.errors.push(p);break}case"doc-end":{if(!this.doc){const p="Unexpected doc-end without preceding document";this.errors.push(new o.YAMLParseError(l(h),"UNEXPECTED_TOKEN",p));break}this.doc.directives.docEnd=!0;const u=r.resolveEnd(h.end,h.offset+h.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),u.comment){const p=this.doc.comment;this.doc.comment=p?`${p}
|
|
123
|
+
${u.comment}`:u.comment}this.doc.range[2]=u.offset;break}default:this.errors.push(new o.YAMLParseError(l(h),"UNEXPECTED_TOKEN",`Unsupported token ${h.type}`))}}*end(h=!1,u=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(h){const p=Object.assign({_directives:this.directives},this.options),f=new n.Document(void 0,p);this.atDirectives&&this.onError(u,"MISSING_CHAR","Missing directives-end indicator line"),f.range=[0,u,u],this.decorate(f,!1),yield f}}}return Uo.Composer=i,Uo}var ye={},Yt={},sl;function Fm(){if(sl)return Yt;sl=1;var e=md(),t=gd(),n=go(),o=ho();function s(d,h=!0,u){if(d){const p=(f,m,g)=>{const y=typeof f=="number"?f:Array.isArray(f)?f[0]:f.offset;if(u)u(y,m,g);else throw new n.YAMLParseError([y,y+1],m,g)};switch(d.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return t.resolveFlowScalar(d,h,p);case"block-scalar":return e.resolveBlockScalar({options:{strict:h}},d,p)}}return null}function a(d,h){const{implicitKey:u=!1,indent:p,inFlow:f=!1,offset:m=-1,type:g="PLAIN"}=h,y=o.stringifyString({type:g,value:d},{implicitKey:u,indent:p>0?" ".repeat(p):"",inFlow:f,options:{blockQuote:!0,lineWidth:-1}}),b=h.end??[{type:"newline",offset:-1,indent:p,source:`
|
|
122
124
|
`}];switch(y[0]){case"|":case">":{const k=y.indexOf(`
|
|
123
125
|
`),w=y.substring(0,k),v=y.substring(k+1)+`
|
|
124
126
|
`,S=[{type:"block-scalar-header",offset:m,indent:p,source:w}];return c(S,b)||S.push({type:"newline",offset:-1,indent:p,source:`
|
|
125
|
-
`}),{type:"block-scalar",offset:m,indent:p,props:S,source:v}}case'"':return{type:"double-quoted-scalar",offset:m,indent:p,source:y,end:b};case"'":return{type:"single-quoted-scalar",offset:m,indent:p,source:y,end:b};default:return{type:"scalar",offset:m,indent:p,source:y,end:b}}}function
|
|
127
|
+
`}),{type:"block-scalar",offset:m,indent:p,props:S,source:v}}case'"':return{type:"double-quoted-scalar",offset:m,indent:p,source:y,end:b};case"'":return{type:"single-quoted-scalar",offset:m,indent:p,source:y,end:b};default:return{type:"scalar",offset:m,indent:p,source:y,end:b}}}function r(d,h,u={}){let{afterKey:p=!1,implicitKey:f=!1,inFlow:m=!1,type:g}=u,y="indent"in d?d.indent:null;if(p&&typeof y=="number"&&(y+=2),!g)switch(d.type){case"single-quoted-scalar":g="QUOTE_SINGLE";break;case"double-quoted-scalar":g="QUOTE_DOUBLE";break;case"block-scalar":{const k=d.props[0];if(k.type!=="block-scalar-header")throw new Error("Invalid block scalar header");g=k.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:g="PLAIN"}const b=o.stringifyString({type:g,value:h},{implicitKey:f||y===null,indent:y!==null&&y>0?" ".repeat(y):"",inFlow:m,options:{blockQuote:!0,lineWidth:-1}});switch(b[0]){case"|":case">":l(d,b);break;case'"':i(d,b,"double-quoted-scalar");break;case"'":i(d,b,"single-quoted-scalar");break;default:i(d,b,"scalar")}}function l(d,h){const u=h.indexOf(`
|
|
126
128
|
`),p=h.substring(0,u),f=h.substring(u+1)+`
|
|
127
129
|
`;if(d.type==="block-scalar"){const m=d.props[0];if(m.type!=="block-scalar-header")throw new Error("Invalid block scalar header");m.source=p,d.source=f}else{const{offset:m}=d,g="indent"in d?d.indent:-1,y=[{type:"block-scalar-header",offset:m,indent:g,source:p}];c(y,"end"in d?d.end:void 0)||y.push({type:"newline",offset:-1,indent:g,source:`
|
|
128
130
|
`});for(const b of Object.keys(d))b!=="type"&&b!=="offset"&&delete d[b];Object.assign(d,{type:"block-scalar",indent:g,props:y,source:f})}}function c(d,h){if(h)for(const u of h)switch(u.type){case"space":case"comment":d.push(u);break;case"newline":return d.push(u),!0}return!1}function i(d,h,u){switch(d.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":d.type=u,d.source=h;break;case"block-scalar":{const p=d.props.slice(1);let f=h.length;d.props[0].type==="block-scalar-header"&&(f-=d.props[0].source.length);for(const m of p)m.offset+=f;delete d.props,Object.assign(d,{type:u,source:h,end:p});break}case"block-map":case"block-seq":{const f={type:"newline",offset:d.offset+h.length,indent:d.indent,source:`
|
|
129
|
-
`};delete d.items,Object.assign(d,{type:u,source:h,end:[f]});break}default:{const p="indent"in d?d.indent:-1,f="end"in d&&Array.isArray(d.end)?d.end.filter(m=>m.type==="space"||m.type==="comment"||m.type==="newline"):[];for(const m of Object.keys(d))m!=="type"&&m!=="offset"&&delete d[m];Object.assign(d,{type:u,indent:p,source:h,end:f})}}}return
|
|
131
|
+
`};delete d.items,Object.assign(d,{type:u,source:h,end:[f]});break}default:{const p="indent"in d?d.indent:-1,f="end"in d&&Array.isArray(d.end)?d.end.filter(m=>m.type==="space"||m.type==="comment"||m.type==="newline"):[];for(const m of Object.keys(d))m!=="type"&&m!=="offset"&&delete d[m];Object.assign(d,{type:u,indent:p,source:h,end:f})}}}return Yt.createScalarToken=a,Yt.resolveAsScalar=s,Yt.setScalarValue=r,Yt}var Os={},rl;function Dm(){if(rl)return Os;rl=1;const e=o=>"type"in o?t(o):n(o);function t(o){switch(o.type){case"block-scalar":{let s="";for(const a of o.props)s+=t(a);return s+o.source}case"block-map":case"block-seq":{let s="";for(const a of o.items)s+=n(a);return s}case"flow-collection":{let s=o.start.source;for(const a of o.items)s+=n(a);for(const a of o.end)s+=a.source;return s}case"document":{let s=n(o);if(o.end)for(const a of o.end)s+=a.source;return s}default:{let s=o.source;if("end"in o&&o.end)for(const a of o.end)s+=a.source;return s}}}function n({start:o,key:s,sep:a,value:r}){let l="";for(const c of o)l+=c.source;if(s&&(l+=t(s)),a)for(const c of a)l+=c.source;return r&&(l+=t(r)),l}return Os.stringify=e,Os}var Es={},al;function Bm(){if(al)return Es;al=1;const e=Symbol("break visit"),t=Symbol("skip children"),n=Symbol("remove item");function o(a,r){"type"in a&&a.type==="document"&&(a={start:a.start,value:a.value}),s(Object.freeze([]),a,r)}o.BREAK=e,o.SKIP=t,o.REMOVE=n,o.itemAtPath=(a,r)=>{let l=a;for(const[c,i]of r){const d=l?.[c];if(d&&"items"in d)l=d.items[i];else return}return l},o.parentCollection=(a,r)=>{const l=o.itemAtPath(a,r.slice(0,-1)),c=r[r.length-1][0],i=l?.[c];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function s(a,r,l){let c=l(r,a);if(typeof c=="symbol")return c;for(const i of["key","value"]){const d=r[i];if(d&&"items"in d){for(let h=0;h<d.items.length;++h){const u=s(Object.freeze(a.concat([[i,h]])),d.items[h],l);if(typeof u=="number")h=u-1;else{if(u===e)return e;u===n&&(d.items.splice(h,1),h-=1)}}typeof c=="function"&&i==="key"&&(c=c(r,a))}}return typeof c=="function"?c(r,a):c}return Es.visit=o,Es}var il;function Vr(){if(il)return ye;il=1;var e=Fm(),t=Dm(),n=Bm();const o="\uFEFF",s="",a="",r="",l=h=>!!h&&"items"in h,c=h=>!!h&&(h.type==="scalar"||h.type==="single-quoted-scalar"||h.type==="double-quoted-scalar"||h.type==="block-scalar");function i(h){switch(h){case o:return"<BOM>";case s:return"<DOC>";case a:return"<FLOW_END>";case r:return"<SCALAR>";default:return JSON.stringify(h)}}function d(h){switch(h){case o:return"byte-order-mark";case s:return"doc-mode";case a:return"flow-error-end";case r:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
130
132
|
`:case`\r
|
|
131
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(h[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}return
|
|
132
|
-
`:case"\r":case" ":return!0;default:return!1}}const n=new Set("0123456789ABCDEFabcdef"),o=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),s=new Set(",[]{}"),
|
|
133
|
-
\r `),
|
|
133
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(h[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}return ye.createScalarToken=e.createScalarToken,ye.resolveAsScalar=e.resolveAsScalar,ye.setScalarValue=e.setScalarValue,ye.stringify=t.stringify,ye.visit=n.visit,ye.BOM=o,ye.DOCUMENT=s,ye.FLOW_END=a,ye.SCALAR=r,ye.isCollection=l,ye.isScalar=c,ye.prettyToken=i,ye.tokenType=d,ye}var Cs={},ll;function bd(){if(ll)return Cs;ll=1;var e=Vr();function t(c){switch(c){case void 0:case" ":case`
|
|
134
|
+
`:case"\r":case" ":return!0;default:return!1}}const n=new Set("0123456789ABCDEFabcdef"),o=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),s=new Set(",[]{}"),a=new Set(` ,[]{}
|
|
135
|
+
\r `),r=c=>!c||a.has(c);class l{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(i,d=!1){if(i){if(typeof i!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+i:i,this.lineEndPos=null}this.atEnd=!d;let h=this.next??"stream";for(;h&&(d||this.hasChars(1));)h=yield*this.parseNext(h)}atLineEnd(){let i=this.pos,d=this.buffer[i];for(;d===" "||d===" ";)d=this.buffer[++i];return!d||d==="#"||d===`
|
|
134
136
|
`?!0:d==="\r"?this.buffer[i+1]===`
|
|
135
137
|
`:!1}charAt(i){return this.buffer[this.pos+i]}continueScalar(i){let d=this.buffer[i];if(this.indentNext>0){let h=0;for(;d===" ";)d=this.buffer[++h+i];if(d==="\r"){const u=this.buffer[h+i+1];if(u===`
|
|
136
138
|
`||!u&&!this.atEnd)return i+h+1}return d===`
|
|
137
139
|
`||h>=this.indentNext||!d&&!this.atEnd?i+h:-1}if(d==="-"||d==="."){const h=this.buffer.substr(i,3);if((h==="---"||h==="...")&&t(this.buffer[i+3]))return-1}return i}getLine(){let i=this.lineEndPos;return(typeof i!="number"||i!==-1&&i<this.pos)&&(i=this.buffer.indexOf(`
|
|
138
|
-
`,this.pos),this.lineEndPos=i),i===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[i-1]==="\r"&&(i-=1),this.buffer.substring(this.pos,i))}hasChars(i){return this.pos+i<=this.buffer.length}setNext(i){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=i,null}peek(i){return this.buffer.substr(this.pos,i)}*parseNext(i){switch(i){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let i=this.getLine();if(i===null)return this.setNext("stream");if(i[0]===e.BOM&&(yield*this.pushCount(1),i=i.substring(1)),i[0]==="%"){let d=i.length,h=i.indexOf("#");for(;h!==-1;){const p=i[h-1];if(p===" "||p===" "){d=h-1;break}else h=i.indexOf("#",h+1)}for(;;){const p=i[d-1];if(p===" "||p===" ")d-=1;else break}const u=(yield*this.pushCount(d))+(yield*this.pushSpaces(!0));return yield*this.pushCount(i.length-u),this.pushNewline(),"stream"}if(this.atLineEnd()){const d=yield*this.pushSpaces(!0);return yield*this.pushCount(i.length-d),yield*this.pushNewline(),"stream"}return yield e.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){const i=this.charAt(0);if(!i&&!this.atEnd)return this.setNext("line-start");if(i==="-"||i==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const d=this.peek(3);if((d==="---"||d==="...")&&t(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,d==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!t(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[i,d]=this.peek(2);if(!d&&!this.atEnd)return this.setNext("block-start");if((i==="-"||i==="?"||i===":")&&t(d)){const h=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=h,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const i=this.getLine();if(i===null)return this.setNext("doc");let d=yield*this.pushIndicators();switch(i[d]){case"#":yield*this.pushCount(i.length-d);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(
|
|
140
|
+
`,this.pos),this.lineEndPos=i),i===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[i-1]==="\r"&&(i-=1),this.buffer.substring(this.pos,i))}hasChars(i){return this.pos+i<=this.buffer.length}setNext(i){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=i,null}peek(i){return this.buffer.substr(this.pos,i)}*parseNext(i){switch(i){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let i=this.getLine();if(i===null)return this.setNext("stream");if(i[0]===e.BOM&&(yield*this.pushCount(1),i=i.substring(1)),i[0]==="%"){let d=i.length,h=i.indexOf("#");for(;h!==-1;){const p=i[h-1];if(p===" "||p===" "){d=h-1;break}else h=i.indexOf("#",h+1)}for(;;){const p=i[d-1];if(p===" "||p===" ")d-=1;else break}const u=(yield*this.pushCount(d))+(yield*this.pushSpaces(!0));return yield*this.pushCount(i.length-u),this.pushNewline(),"stream"}if(this.atLineEnd()){const d=yield*this.pushSpaces(!0);return yield*this.pushCount(i.length-d),yield*this.pushNewline(),"stream"}return yield e.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){const i=this.charAt(0);if(!i&&!this.atEnd)return this.setNext("line-start");if(i==="-"||i==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const d=this.peek(3);if((d==="---"||d==="...")&&t(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,d==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!t(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[i,d]=this.peek(2);if(!d&&!this.atEnd)return this.setNext("block-start");if((i==="-"||i==="?"||i===":")&&t(d)){const h=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=h,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const i=this.getLine();if(i===null)return this.setNext("doc");let d=yield*this.pushIndicators();switch(i[d]){case"#":yield*this.pushCount(i.length-d);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(r),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return d+=yield*this.parseBlockScalarHeader(),d+=yield*this.pushSpaces(!0),yield*this.pushCount(i.length-d),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let i,d,h=-1;do i=yield*this.pushNewline(),i>0?(d=yield*this.pushSpaces(!1),this.indentValue=h=d):d=0,d+=yield*this.pushSpaces(!0);while(i+d>0);const u=this.getLine();if(u===null)return this.setNext("flow");if((h!==-1&&h<this.indentNext&&u[0]!=="#"||h===0&&(u.startsWith("---")||u.startsWith("..."))&&t(u[3]))&&!(h===this.indentNext-1&&this.flowLevel===1&&(u[0]==="]"||u[0]==="}")))return this.flowLevel=0,yield e.FLOW_END,yield*this.parseLineStart();let p=0;for(;u[p]===",";)p+=yield*this.pushCount(1),p+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(p+=yield*this.pushIndicators(),u[p]){case void 0:return"flow";case"#":return yield*this.pushCount(u.length-p),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(r),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const f=this.charAt(1);if(this.flowKey||t(f)||f===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const i=this.charAt(0);let d=this.buffer.indexOf(i,this.pos+1);if(i==="'")for(;d!==-1&&this.buffer[d+1]==="'";)d=this.buffer.indexOf("'",d+2);else for(;d!==-1;){let p=0;for(;this.buffer[d-1-p]==="\\";)p+=1;if(p%2===0)break;d=this.buffer.indexOf('"',d+1)}const h=this.buffer.substring(0,d);let u=h.indexOf(`
|
|
139
141
|
`,this.pos);if(u!==-1){for(;u!==-1;){const p=this.continueScalar(u+1);if(p===-1)break;u=h.indexOf(`
|
|
140
142
|
`,p)}u!==-1&&(d=u-(h[u-1]==="\r"?2:1))}if(d===-1){if(!this.atEnd)return this.setNext("quoted-scalar");d=this.buffer.length}return yield*this.pushToIndex(d+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let i=this.pos;for(;;){const d=this.buffer[++i];if(d==="+")this.blockScalarKeep=!0;else if(d>"0"&&d<="9")this.blockScalarIndent=Number(d)-1;else if(d!=="-")break}return yield*this.pushUntil(d=>t(d)||d==="#")}*parseBlockScalar(){let i=this.pos-1,d=0,h;e:for(let p=this.pos;h=this.buffer[p];++p)switch(h){case" ":d+=1;break;case`
|
|
141
143
|
`:i=p,d=0;break;case"\r":{const f=this.buffer[p+1];if(!f&&!this.atEnd)return this.setNext("block-scalar");if(f===`
|
|
@@ -145,16 +147,16 @@ ${u.comment}`:u.comment}this.doc.range[2]=u.offset;break}default:this.errors.pus
|
|
|
145
147
|
`&&p>=this.pos&&p+1+d>m)i=p;else break}while(!0);return yield e.SCALAR,yield*this.pushToIndex(i+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const i=this.flowLevel>0;let d=this.pos-1,h=this.pos-1,u;for(;u=this.buffer[++h];)if(u===":"){const p=this.buffer[h+1];if(t(p)||i&&s.has(p))break;d=h}else if(t(u)){let p=this.buffer[h+1];if(u==="\r"&&(p===`
|
|
146
148
|
`?(h+=1,u=`
|
|
147
149
|
`,p=this.buffer[h+1]):d=h),p==="#"||i&&s.has(p))break;if(u===`
|
|
148
|
-
`){const f=this.continueScalar(h+1);if(f===-1)break;h=Math.max(h,f-2)}}else{if(i&&s.has(u))break;d=h}return!u&&!this.atEnd?this.setNext("plain-scalar"):(yield e.SCALAR,yield*this.pushToIndex(d+1,!0),i?"flow":"doc")}*pushCount(i){return i>0?(yield this.buffer.substr(this.pos,i),this.pos+=i,i):0}*pushToIndex(i,d){const h=this.buffer.slice(this.pos,i);return h?(yield h,this.pos+=h.length,h.length):(d&&(yield""),0)}*pushIndicators(){let i=0;e:for(;;){switch(this.charAt(0)){case"!":i+=yield*this.pushTag(),i+=yield*this.pushSpaces(!0);continue e;case"&":i+=yield*this.pushUntil(
|
|
150
|
+
`){const f=this.continueScalar(h+1);if(f===-1)break;h=Math.max(h,f-2)}}else{if(i&&s.has(u))break;d=h}return!u&&!this.atEnd?this.setNext("plain-scalar"):(yield e.SCALAR,yield*this.pushToIndex(d+1,!0),i?"flow":"doc")}*pushCount(i){return i>0?(yield this.buffer.substr(this.pos,i),this.pos+=i,i):0}*pushToIndex(i,d){const h=this.buffer.slice(this.pos,i);return h?(yield h,this.pos+=h.length,h.length):(d&&(yield""),0)}*pushIndicators(){let i=0;e:for(;;){switch(this.charAt(0)){case"!":i+=yield*this.pushTag(),i+=yield*this.pushSpaces(!0);continue e;case"&":i+=yield*this.pushUntil(r),i+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const d=this.flowLevel>0,h=this.charAt(1);if(t(h)||d&&s.has(h)){d?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0);continue e}}}break e}return i}*pushTag(){if(this.charAt(1)==="<"){let i=this.pos+2,d=this.buffer[i];for(;!t(d)&&d!==">";)d=this.buffer[++i];return yield*this.pushToIndex(d===">"?i+1:i,!1)}else{let i=this.pos+1,d=this.buffer[i];for(;d;)if(o.has(d))d=this.buffer[++i];else if(d==="%"&&n.has(this.buffer[i+1])&&n.has(this.buffer[i+2]))d=this.buffer[i+=3];else break;return yield*this.pushToIndex(i,!1)}}*pushNewline(){const i=this.buffer[this.pos];return i===`
|
|
149
151
|
`?yield*this.pushCount(1):i==="\r"&&this.charAt(1)===`
|
|
150
|
-
`?yield*this.pushCount(2):0}*pushSpaces(i){let d=this.pos-1,h;do h=this.buffer[++d];while(h===" "||i&&h===" ");const u=d-this.pos;return u>0&&(yield this.buffer.substr(this.pos,u),this.pos=d),u}*pushUntil(i){let d=this.pos,h=this.buffer[d];for(;!i(h);)h=this.buffer[++d];return yield*this.pushToIndex(d,!1)}}return
|
|
152
|
+
`?yield*this.pushCount(2):0}*pushSpaces(i){let d=this.pos-1,h;do h=this.buffer[++d];while(h===" "||i&&h===" ");const u=d-this.pos;return u>0&&(yield this.buffer.substr(this.pos,u),this.pos=d),u}*pushUntil(i){let d=this.pos,h=this.buffer[d];for(;!i(h);)h=this.buffer[++d];return yield*this.pushToIndex(d,!1)}}return Cs.Lexer=l,Cs}var Ns={},cl;function wd(){if(cl)return Ns;cl=1;class e{constructor(){this.lineStarts=[],this.addNewLine=n=>this.lineStarts.push(n),this.linePos=n=>{let o=0,s=this.lineStarts.length;for(;o<s;){const r=o+s>>1;this.lineStarts[r]<n?o=r+1:s=r}if(this.lineStarts[o]===n)return{line:o+1,col:1};if(o===0)return{line:0,col:n};const a=this.lineStarts[o-1];return{line:o,col:n-a+1}}}}return Ns.LineCounter=e,Ns}var xs={},dl;function kd(){if(dl)return xs;dl=1;var e=Or,t=Vr(),n=bd();function o(h,u){for(let p=0;p<h.length;++p)if(h[p].type===u)return!0;return!1}function s(h){for(let u=0;u<h.length;++u)switch(h[u].type){case"space":case"comment":case"newline":break;default:return u}return-1}function a(h){switch(h?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function r(h){switch(h.type){case"document":return h.start;case"block-map":{const u=h.items[h.items.length-1];return u.sep??u.start}case"block-seq":return h.items[h.items.length-1].start;default:return[]}}function l(h){if(h.length===0)return[];let u=h.length;e:for(;--u>=0;)switch(h[u].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;h[++u]?.type==="space";);return h.splice(u,h.length)}function c(h,u){if(u.length<1e5)Array.prototype.push.apply(h,u);else for(let p=0;p<u.length;++p)h.push(u[p])}function i(h){if(h.start.type==="flow-seq-start")for(const u of h.items)u.sep&&!u.value&&!o(u.start,"explicit-key-ind")&&!o(u.sep,"map-value-ind")&&(u.key&&(u.value=u.key),delete u.key,a(u.value)?u.value.end?c(u.value.end,u.sep):u.value.end=u.sep:c(u.start,u.sep),delete u.sep)}class d{constructor(u){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new n.Lexer,this.onNewLine=u}*parse(u,p=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const f of this.lexer.lex(u,p))yield*this.next(f);p||(yield*this.end())}*next(u){if(this.source=u,e.env.LOG_TOKENS&&console.log("|",t.prettyToken(u)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=u.length;return}const p=t.tokenType(u);if(p)if(p==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=p,yield*this.step(),p){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+u.length);break;case"space":this.atNewLine&&u[0]===" "&&(this.indent+=u.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=u.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=u.length}else{const f=`Not a YAML token: ${u}`;yield*this.pop({type:"error",offset:this.offset,message:f,source:u}),this.offset+=u.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const u=this.peek(1);if(this.type==="doc-end"&&u?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!u)return yield*this.stream();switch(u.type){case"document":return yield*this.document(u);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(u);case"block-scalar":return yield*this.blockScalar(u);case"block-map":return yield*this.blockMap(u);case"block-seq":return yield*this.blockSequence(u);case"flow-collection":return yield*this.flowCollection(u);case"doc-end":return yield*this.documentEnd(u)}yield*this.pop()}peek(u){return this.stack[this.stack.length-u]}*pop(u){const p=u??this.stack.pop();if(!p)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield p;else{const f=this.peek(1);switch(p.type==="block-scalar"?p.indent="indent"in f?f.indent:0:p.type==="flow-collection"&&f.type==="document"&&(p.indent=0),p.type==="flow-collection"&&i(p),f.type){case"document":f.value=p;break;case"block-scalar":f.props.push(p);break;case"block-map":{const m=f.items[f.items.length-1];if(m.value){f.items.push({start:[],key:p,sep:[]}),this.onKeyLine=!0;return}else if(m.sep)m.value=p;else{Object.assign(m,{key:p,sep:[]}),this.onKeyLine=!m.explicitKey;return}break}case"block-seq":{const m=f.items[f.items.length-1];m.value?f.items.push({start:[],value:p}):m.value=p;break}case"flow-collection":{const m=f.items[f.items.length-1];!m||m.value?f.items.push({start:[],key:p,sep:[]}):m.sep?m.value=p:Object.assign(m,{key:p,sep:[]});return}default:yield*this.pop(),yield*this.pop(p)}if((f.type==="document"||f.type==="block-map"||f.type==="block-seq")&&(p.type==="block-map"||p.type==="block-seq")){const m=p.items[p.items.length-1];m&&!m.sep&&!m.value&&m.start.length>0&&s(m.start)===-1&&(p.indent===0||m.start.every(g=>g.type!=="comment"||g.indent<p.indent))&&(f.type==="document"?f.end=m.start:f.items.push({start:m.start}),p.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const u={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&u.start.push(this.sourceToken),this.stack.push(u);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(u){if(u.value)return yield*this.lineEnd(u);switch(this.type){case"doc-start":{s(u.start)!==-1?(yield*this.pop(),yield*this.step()):u.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":u.start.push(this.sourceToken);return}const p=this.startBlockValue(u);p?this.stack.push(p):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(u){if(this.type==="map-value-ind"){const p=r(this.peek(2)),f=l(p);let m;u.end?(m=u.end,m.push(this.sourceToken),delete u.end):m=[this.sourceToken];const g={type:"block-map",offset:u.offset,indent:u.indent,items:[{start:f,key:u,sep:m}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=g}else yield*this.lineEnd(u)}*blockScalar(u){switch(this.type){case"space":case"comment":case"newline":u.props.push(this.sourceToken);return;case"scalar":if(u.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let p=this.source.indexOf(`
|
|
151
153
|
`)+1;for(;p!==0;)this.onNewLine(this.offset+p),p=this.source.indexOf(`
|
|
152
|
-
`,p)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(u){const p=u.items[u.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,p.value){const f="end"in p.value?p.value.end:void 0;(Array.isArray(f)?f[f.length-1]:void 0)?.type==="comment"?f?.push(this.sourceToken):u.items.push({start:[this.sourceToken]})}else p.sep?p.sep.push(this.sourceToken):p.start.push(this.sourceToken);return;case"space":case"comment":if(p.value)u.items.push({start:[this.sourceToken]});else if(p.sep)p.sep.push(this.sourceToken);else{if(this.atIndentedComment(p.start,u.indent)){const m=u.items[u.items.length-2]?.value?.end;if(Array.isArray(m)){c(m,p.start),m.push(this.sourceToken),u.items.pop();return}}p.start.push(this.sourceToken)}return}if(this.indent>=u.indent){const f=!this.onKeyLine&&this.indent===u.indent,m=f&&(p.sep||p.explicitKey)&&this.type!=="seq-item-ind";let g=[];if(m&&p.sep&&!p.value){const y=[];for(let b=0;b<p.sep.length;++b){const k=p.sep[b];switch(k.type){case"newline":y.push(b);break;case"space":break;case"comment":k.indent>u.indent&&(y.length=0);break;default:y.length=0}}y.length>=2&&(g=p.sep.splice(y[1]))}switch(this.type){case"anchor":case"tag":m||p.value?(g.push(this.sourceToken),u.items.push({start:g}),this.onKeyLine=!0):p.sep?p.sep.push(this.sourceToken):p.start.push(this.sourceToken);return;case"explicit-key-ind":!p.sep&&!p.explicitKey?(p.start.push(this.sourceToken),p.explicitKey=!0):m||p.value?(g.push(this.sourceToken),u.items.push({start:g,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(p.explicitKey)if(p.sep)if(p.value)u.items.push({start:[],key:null,sep:[this.sourceToken]});else if(o(p.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:g,key:null,sep:[this.sourceToken]}]});else if(
|
|
154
|
+
`,p)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(u){const p=u.items[u.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,p.value){const f="end"in p.value?p.value.end:void 0;(Array.isArray(f)?f[f.length-1]:void 0)?.type==="comment"?f?.push(this.sourceToken):u.items.push({start:[this.sourceToken]})}else p.sep?p.sep.push(this.sourceToken):p.start.push(this.sourceToken);return;case"space":case"comment":if(p.value)u.items.push({start:[this.sourceToken]});else if(p.sep)p.sep.push(this.sourceToken);else{if(this.atIndentedComment(p.start,u.indent)){const m=u.items[u.items.length-2]?.value?.end;if(Array.isArray(m)){c(m,p.start),m.push(this.sourceToken),u.items.pop();return}}p.start.push(this.sourceToken)}return}if(this.indent>=u.indent){const f=!this.onKeyLine&&this.indent===u.indent,m=f&&(p.sep||p.explicitKey)&&this.type!=="seq-item-ind";let g=[];if(m&&p.sep&&!p.value){const y=[];for(let b=0;b<p.sep.length;++b){const k=p.sep[b];switch(k.type){case"newline":y.push(b);break;case"space":break;case"comment":k.indent>u.indent&&(y.length=0);break;default:y.length=0}}y.length>=2&&(g=p.sep.splice(y[1]))}switch(this.type){case"anchor":case"tag":m||p.value?(g.push(this.sourceToken),u.items.push({start:g}),this.onKeyLine=!0):p.sep?p.sep.push(this.sourceToken):p.start.push(this.sourceToken);return;case"explicit-key-ind":!p.sep&&!p.explicitKey?(p.start.push(this.sourceToken),p.explicitKey=!0):m||p.value?(g.push(this.sourceToken),u.items.push({start:g,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(p.explicitKey)if(p.sep)if(p.value)u.items.push({start:[],key:null,sep:[this.sourceToken]});else if(o(p.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:g,key:null,sep:[this.sourceToken]}]});else if(a(p.key)&&!o(p.sep,"newline")){const y=l(p.start),b=p.key,k=p.sep;k.push(this.sourceToken),delete p.key,delete p.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:y,key:b,sep:k}]})}else g.length>0?p.sep=p.sep.concat(g,this.sourceToken):p.sep.push(this.sourceToken);else if(o(p.start,"newline"))Object.assign(p,{key:null,sep:[this.sourceToken]});else{const y=l(p.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:y,key:null,sep:[this.sourceToken]}]})}else p.sep?p.value||m?u.items.push({start:g,key:null,sep:[this.sourceToken]}):o(p.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):p.sep.push(this.sourceToken):Object.assign(p,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const y=this.flowScalar(this.type);m||p.value?(u.items.push({start:g,key:y,sep:[]}),this.onKeyLine=!0):p.sep?this.stack.push(y):(Object.assign(p,{key:y,sep:[]}),this.onKeyLine=!0);return}default:{const y=this.startBlockValue(u);if(y){if(y.type==="block-seq"){if(!p.explicitKey&&p.sep&&!o(p.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else f&&u.items.push({start:g});this.stack.push(y);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(u){const p=u.items[u.items.length-1];switch(this.type){case"newline":if(p.value){const f="end"in p.value?p.value.end:void 0;(Array.isArray(f)?f[f.length-1]:void 0)?.type==="comment"?f?.push(this.sourceToken):u.items.push({start:[this.sourceToken]})}else p.start.push(this.sourceToken);return;case"space":case"comment":if(p.value)u.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(p.start,u.indent)){const m=u.items[u.items.length-2]?.value?.end;if(Array.isArray(m)){c(m,p.start),m.push(this.sourceToken),u.items.pop();return}}p.start.push(this.sourceToken)}return;case"anchor":case"tag":if(p.value||this.indent<=u.indent)break;p.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==u.indent)break;p.value||o(p.start,"seq-item-ind")?u.items.push({start:[this.sourceToken]}):p.start.push(this.sourceToken);return}if(this.indent>u.indent){const f=this.startBlockValue(u);if(f){this.stack.push(f);return}}yield*this.pop(),yield*this.step()}*flowCollection(u){const p=u.items[u.items.length-1];if(this.type==="flow-error-end"){let f;do yield*this.pop(),f=this.peek(1);while(f?.type==="flow-collection")}else if(u.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!p||p.sep?u.items.push({start:[this.sourceToken]}):p.start.push(this.sourceToken);return;case"map-value-ind":!p||p.value?u.items.push({start:[],key:null,sep:[this.sourceToken]}):p.sep?p.sep.push(this.sourceToken):Object.assign(p,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!p||p.value?u.items.push({start:[this.sourceToken]}):p.sep?p.sep.push(this.sourceToken):p.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const m=this.flowScalar(this.type);!p||p.value?u.items.push({start:[],key:m,sep:[]}):p.sep?this.stack.push(m):Object.assign(p,{key:m,sep:[]});return}case"flow-map-end":case"flow-seq-end":u.end.push(this.sourceToken);return}const f=this.startBlockValue(u);f?this.stack.push(f):(yield*this.pop(),yield*this.step())}else{const f=this.peek(2);if(f.type==="block-map"&&(this.type==="map-value-ind"&&f.indent===u.indent||this.type==="newline"&&!f.items[f.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&f.type!=="flow-collection"){const m=r(f),g=l(m);i(u);const y=u.end.splice(1,u.end.length);y.push(this.sourceToken);const b={type:"block-map",offset:u.offset,indent:u.indent,items:[{start:g,key:u,sep:y}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=b}else yield*this.lineEnd(u)}}flowScalar(u){if(this.onNewLine){let p=this.source.indexOf(`
|
|
153
155
|
`)+1;for(;p!==0;)this.onNewLine(this.offset+p),p=this.source.indexOf(`
|
|
154
|
-
`,p)+1}return{type:u,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(u){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const p=a(u),f=l(p);return f.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:f,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const p=a(u),f=l(p);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:f,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(u,p){return this.type!=="comment"||this.indent<=p?!1:u.every(f=>f.type==="newline"||f.type==="space")}*documentEnd(u){this.type!=="doc-mode"&&(u.end?u.end.push(this.sourceToken):u.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(u){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:u.end?u.end.push(this.sourceToken):u.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}return _s.Parser=d,_s}var jt={},dl;function Bm(){if(dl)return jt;dl=1;var e=yd(),t=yo(),n=bo(),o=Qc(),s=B(),r=wd(),a=kd();function l(u){const p=u.prettyErrors!==!1;return{lineCounter:u.lineCounter||p&&new r.LineCounter||null,prettyErrors:p}}function c(u,p={}){const{lineCounter:f,prettyErrors:m}=l(p),g=new a.Parser(f?.addNewLine),y=new e.Composer(p),b=Array.from(y.compose(g.parse(u)));if(m&&f)for(const k of b)k.errors.forEach(n.prettifyError(u,f)),k.warnings.forEach(n.prettifyError(u,f));return b.length>0?b:Object.assign([],{empty:!0},y.streamInfo())}function i(u,p={}){const{lineCounter:f,prettyErrors:m}=l(p),g=new a.Parser(f?.addNewLine),y=new e.Composer(p);let b=null;for(const k of y.compose(g.parse(u),!0,u.length))if(!b)b=k;else if(b.options.logLevel!=="silent"){b.errors.push(new n.YAMLParseError(k.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return m&&f&&(b.errors.forEach(n.prettifyError(u,f)),b.warnings.forEach(n.prettifyError(u,f))),b}function d(u,p,f){let m;typeof p=="function"?m=p:f===void 0&&p&&typeof p=="object"&&(f=p);const g=i(u,f);if(!g)return null;if(g.warnings.forEach(y=>o.warn(g.options.logLevel,y)),g.errors.length>0){if(g.options.logLevel!=="silent")throw g.errors[0];g.errors=[]}return g.toJS(Object.assign({reviver:m},f))}function h(u,p,f){let m=null;if(typeof p=="function"||Array.isArray(p)?m=p:f===void 0&&p&&(f=p),typeof f=="string"&&(f=f.length),typeof f=="number"){const g=Math.round(f);f=g<1?void 0:g>8?{indent:8}:{indent:g}}if(u===void 0){const{keepUndefined:g}=f??p??{};if(!g)return}return s.isDocument(u)&&!m?u.toString(f):new t.Document(u,m,f).toString(f)}return jt.parse=d,jt.parseAllDocuments=c,jt.parseDocument=i,jt.stringify=h,jt}var ul;function Um(){if(ul)return W;ul=1;var e=yd(),t=yo(),n=ud(),o=bo(),s=uo(),r=B(),a=mt(),l=ce(),c=gt(),i=yt(),d=Jr(),h=bd(),u=wd(),p=kd(),f=Bm(),m=co();return W.Composer=e.Composer,W.Document=t.Document,W.Schema=n.Schema,W.YAMLError=o.YAMLError,W.YAMLParseError=o.YAMLParseError,W.YAMLWarning=o.YAMLWarning,W.Alias=s.Alias,W.isAlias=r.isAlias,W.isCollection=r.isCollection,W.isDocument=r.isDocument,W.isMap=r.isMap,W.isNode=r.isNode,W.isPair=r.isPair,W.isScalar=r.isScalar,W.isSeq=r.isSeq,W.Pair=a.Pair,W.Scalar=l.Scalar,W.YAMLMap=c.YAMLMap,W.YAMLSeq=i.YAMLSeq,W.CST=d,W.Lexer=h.Lexer,W.LineCounter=u.LineCounter,W.Parser=p.Parser,W.parse=f.parse,W.parseAllDocuments=f.parseAllDocuments,W.parseDocument=f.parseDocument,W.stringify=f.stringify,W.visit=m.visit,W.visitAsync=m.visitAsync,W}var Ge=Um();const zm=5*1024*1024,Wm=new Set([".js",".mjs",".css",".json",".svg",".png",".jpg",".webp",".woff2",".md"]),hl=["component","page"],pl=["filter","display","chart","relation"],Km=["value","dateRange","selection","set"],Ym=["query","act","ask","navigate"],fl=["string","number","integer","boolean","object","array"],Gm=new Set(["type","properties","required","items","enum","title","description","default","minimum","maximum","minItems","maxItems","maxLength","x-workshop"]),ml=["field","fields","variable","objectType","relationPath","actionType"],Hm=new Set(["widget","fieldTypes","maxHops","tab","showIf"]),gl=["data","display","link"],hr=["string","number","boolean","date","datetime","object"],yl={"zh-CN":{label:"{key} 须是对象,至少提供 zh-CN",required:"{key} 必填",size:"{key} 须是 { w: 1–12, h: ≥1 } 的整数",list:"{key} 只能是 {allowed} 的列表",object:"{at} 须是对象",unsupported:"{at} 不支持 {key}",oneOf:"{at} 只能是 {allowed}",typeOrEnum:"{at} 须有 type 或 enum",nonEmptyList:"{at} 须是非空列表",requiredNames:"{at} 只能列出 properties 中的配置项",manifestObject:"manifest.json 须是 JSON 对象",type:"type 须是 x-<前缀>.<名称>:前缀为小写字母、数字与连字符,名称为字母与数字",version:"version 须是 主.次.修订",workshopApi:"workshopApi 目前只能是 1",element:"element 须是含连字符的小写自定义元素名",description:"description 必填:写清展示什么、点了会怎样",data:"data 须是 { source: true|false, fields }",dataFields:"data.fields 须是 any,或 { role, type } 列表(type 为 {types})",boolean:"{key} 须是 true 或 false",network:"network 须是来源列表,如 https://risk.example.com(不带路径)",unreadable:"读不到 manifest.json:{message}",tooLarge:"包内文件共 {total} 字节,超过 5 MB",fileType:"不允许的文件类型:{name}",noEntry:"入口 {entry} 不存在",noElement:"入口中没有定义自定义元素 {element}",bigEntry:"入口超过 300 KB:首屏不需要的部分建议拆成分块",remoteScript:"{name} 从外部地址加载脚本:依赖须全部打进包里",syntax:"{name} 第 {line} 行有语法错误,浏览器加载不了:{message}",syntaxOldNode:"{name} 第 {line} 行在本机 Node {node} 下解析不了:{message}。Node 24 以前的版本不认识部分新语法,上传时以 Workshop 的检查为准;用 Node 24 及以上校验才能确定",evalUsed:"{name} 用了 eval 或 new Function:内容安全策略下会被拒绝",noReadme:"没有 README.md:每个组件都应附说明(本体契约、扩展点、场景配方)",noPreview:"没有 preview.json:组件库预览与本地开发都需要示例数据",and:"、"},"en-US":{label:"{key} must be an object with at least zh-CN",required:"{key} is required",size:"{key} must be whole numbers { w: 1–12, h: ≥1 }",list:"{key} must be a list of {allowed}",object:"{at} must be an object",unsupported:"{at} does not support {key}",oneOf:"{at} must be one of {allowed}",typeOrEnum:"{at} needs type or enum",nonEmptyList:"{at} must be a non-empty list",requiredNames:"{at} may only list items of properties",manifestObject:"manifest.json must be a JSON object",type:"type must be x-<prefix>.<name>: the prefix lowercase letters, digits and hyphens, the name letters and digits",version:"version must be major.minor.patch",workshopApi:"workshopApi can only be 1 for now",element:"element must be a lowercase custom element name with a hyphen",description:"description is required: say what it shows and what a click does",data:"data must be { source: true|false, fields }",dataFields:"data.fields must be any, or a list of { role, type } (type one of {types})",boolean:"{key} must be true or false",network:"network must be a list of origins, such as https://risk.example.com (no path)",unreadable:"Cannot read manifest.json: {message}",tooLarge:"The package's files take {total} bytes, over 5 MB",fileType:"File type not allowed: {name}",noEntry:"The entry {entry} does not exist",noElement:"The entry does not define the custom element {element}",bigEntry:"The entry is over 300 KB: split what the first screen does not need into chunks",remoteScript:"{name} loads a script from an outside address: bundle every dependency into the package",syntax:"{name} has a syntax error at line {line}, so the browser cannot load it: {message}",syntaxOldNode:"{name} does not parse at line {line} under this Node {node}: {message}. Node before 24 does not know some newer syntax, and the upload check decides; validate with Node 24 or later to be sure",evalUsed:"{name} uses eval or new Function, which the content security policy refuses",noReadme:"No README.md: every component should come with a guide (ontology contract, extension points, recipes)",noPreview:"No preview.json: the component library's preview and local development both need sample data",and:", "}};function Zr(e){const t=yl[e]??yl["zh-CN"],n=(o,s)=>cc(t[o],s);return n.list=o=>o.join(t.and),n}function bn(e){const t=[],n=o=>{for(const s of nn(o).sort()){if(s.startsWith(".")||s==="node_modules")continue;const r=G(o,s),a=Au(r);if(a.isDirectory())n(r);else{if(sc(s).toLowerCase()===".zip")continue;t.push({path:r,name:rc(e,r).split($u).join("/"),size:a.size})}}};return n(e),t}const De=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Et=e=>typeof e=="string"&&e.trim()!=="";function Vm(e,t,n,o){(!De(e)||!Et(e["zh-CN"]))&&n.push(o("label",{key:t}))}function bl(e,t,n,o,s){if(e===void 0){o&&n.push(s("required",{key:t}));return}(!(De(e)&&[e.w,e.h].every(a=>Number.isInteger(a)&&a>0))||e.w>12)&&n.push(s("size",{key:t}))}function pr(e,t,n,o,s){e!==void 0&&(!Array.isArray(e)||!e.every(r=>n.includes(r)))&&o.push(s("list",{key:t,allowed:s.list(n)}))}function fr(e,t="configSchema",n="zh-CN"){const o=Zr(n),s=[];if(!De(e))return[o("object",{at:t})];for(const a of Object.keys(e))Gm.has(a)||s.push(o("unsupported",{at:t,key:a}));if(e.type!==void 0&&!fl.includes(e.type)&&s.push(o("oneOf",{at:`${t}.type`,allowed:o.list(fl)})),e.type===void 0&&e.enum===void 0&&t!=="configSchema"&&s.push(o("typeOrEnum",{at:t})),e.enum!==void 0&&(!Array.isArray(e.enum)||e.enum.length===0)&&s.push(o("nonEmptyList",{at:`${t}.enum`})),e.properties!==void 0)if(!De(e.properties))s.push(o("object",{at:`${t}.properties`}));else for(const[a,l]of Object.entries(e.properties))s.push(...fr(l,`${t}.properties.${a}`,n));if(e.required!==void 0){const a=De(e.properties)?Object.keys(e.properties):[];(!Array.isArray(e.required)||!e.required.every(l=>a.includes(l)))&&s.push(o("requiredNames",{at:`${t}.required`}))}e.items!==void 0&&s.push(...fr(e.items,`${t}.items`,n));const r=e["x-workshop"];if(r!==void 0)if(!De(r))s.push(o("object",{at:`${t}.x-workshop`}));else{for(const a of Object.keys(r))Hm.has(a)||s.push(o("unsupported",{at:`${t}.x-workshop`,key:a}));r.widget!==void 0&&!ml.includes(r.widget)&&s.push(o("oneOf",{at:`${t}.x-workshop.widget`,allowed:o.list(ml)})),r.tab!==void 0&&!gl.includes(r.tab)&&s.push(o("oneOf",{at:`${t}.x-workshop.tab`,allowed:o.list(gl)})),r.fieldTypes!==void 0&&pr(r.fieldTypes,`${t}.x-workshop.fieldTypes`,hr,s,o),r.showIf!==void 0&&!De(r.showIf)&&s.push(o("object",{at:`${t}.x-workshop.showIf`}))}return s}function vd(e,t="zh-CN"){const n=Zr(t),o=[];if(!De(e))return[n("manifestObject")];const s=e;if(/^x-[a-z0-9-]+\.[A-Za-z][A-Za-z0-9]*$/.test(s.type??"")||o.push(n("type")),hl.includes(s.kind)||o.push(n("oneOf",{at:"kind",allowed:n.list(hl)})),/^\d+\.\d+\.\d+$/.test(s.version??"")||o.push(n("version")),s.workshopApi!==1&&o.push(n("workshopApi")),/^[a-z][a-z0-9]*(-[a-z0-9]+)+$/.test(s.element??"")||o.push(n("element")),Et(s.entry)||o.push(n("required",{key:"entry"})),Vm(s.label,"label",o,n),Et(s.description)||o.push(n("description")),s.kind!=="page"&&!pl.includes(s.category)&&o.push(n("oneOf",{at:"category",allowed:n.list(pl)})),o.push(...fr(s.configSchema,"configSchema",t)),!De(s.data)||typeof s.data.source!="boolean")o.push(n("data"));else if(s.data.fields!=="any"){const r=s.data.fields;Array.isArray(r)&&r.every(l=>De(l)&&Et(l.role)&&hr.includes(l.type))||o.push(n("dataFields",{types:n.list(hr)}))}return typeof s.follows!="boolean"&&o.push(n("boolean",{key:"follows"})),pr(s.emits,"emits",Km,o,n),pr(s.capabilities,"capabilities",Ym,o,n),s.describes!==void 0&&typeof s.describes!="boolean"&&o.push(n("boolean",{key:"describes"})),bl(s.defaultSize,"defaultSize",o,s.kind==="component",n),bl(s.minSize,"minSize",o,!1,n),s.network!==void 0&&(Array.isArray(s.network)&&s.network.every(a=>{try{const l=new URL(a);return["https:","http:","wss:"].includes(l.protocol)&&l.origin===a}catch{return!1}})||o.push(n("network"))),o}const Jm=24,Zm=[/^Private field '#[^']+' must be declared in an enclosing class$/,/^Identifier '[^']+' has already been declared$/,/^Unexpected end of input$/,/^Strict mode code may not include a with statement$/,/^Octal literals are not allowed in strict mode\.$/];function Xm(e){const t=yu(process.execPath,["--input-type=module","--check"],{input:e,encoding:"utf8"});if(t.status===0)return null;const n=`${t.stderr??""}${t.error?.message??""}`,o=Number(/^\[stdin\]:(\d+)/m.exec(n)?.[1]??0),s=/^\w*Error: (.+)$/m.exec(n)?.[1]??n.trim().split(`
|
|
155
|
-
`).at(-1);return{line:o,message:s}}function Qm(e,{language:t="zh-CN",nodeMajor:n=Number(process.versions.node.split(".")[0])}={}){const o=Zr(t),s=[],r=[];let a;try{a=JSON.parse(ct(G(e,"manifest.json"),"utf8"))}catch(h){return{ok:!1,errors:[o("unreadable",{message:h.message})],warnings:r,files:[]}}s.push(...vd(a,t));const l=bn(e),c=l.reduce((h,u)=>h+u.size,0);c>zm&&s.push(o("tooLarge",{total:c}));for(const h of l)Wm.has(sc(h.name).toLowerCase())||s.push(o("fileType",{name:h.name}));const i=Et(a.entry)?vu.normalize(a.entry.replace(/^\.\//,"")):null,d=l.find(h=>h.name===i);if(Et(a.entry)&&!d&&s.push(o("noEntry",{entry:a.entry})),d){const h=ct(d.path,"utf8");a.element&&!h.includes(a.element)&&s.push(o("noElement",{element:a.element})),d.size>300*1024&&r.push(o("bigEntry"))}for(const h of l.filter(u=>/\.(m?js)$/.test(u.name))){const u=ct(h.path,"utf8"),p=Xm(u),f=p&&Zm.some(m=>m.test(p.message));p&&(n>=Jm||f)?s.push(o("syntax",{name:h.name,...p})):p&&r.push(o("syntaxOldNode",{name:h.name,node:process.versions.node,...p})),(/import\s*\(\s*["'`]https?:\/\//.test(u)||/from\s+["']https?:\/\//.test(u))&&s.push(o("remoteScript",{name:h.name})),/\beval\s*\(|new\s+Function\s*\(/.test(u)&&r.push(o("evalUsed",{name:h.name}))}return l.some(h=>h.name==="README.md")||r.push(o("noReadme")),a.data?.source&&!l.some(h=>h.name==="preview.json")&&r.push(o("noPreview")),{ok:s.length===0,errors:s,warnings:r,files:l,manifest:a}}const eg=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let o=0;o<8;o++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function $d(e){let t=4294967295;for(const n of e)t=eg[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function tg(e){const t=[],n=[];let o=0;const s=0,r=33;for(const{name:c,data:i}of e){const d=Buffer.from(c,"utf8"),h=xu(i),u=h.length>=i.length,p=u?i:h,f=$d(i),m=Buffer.alloc(30);m.writeUInt32LE(67324752,0),m.writeUInt16LE(20,4),m.writeUInt16LE(2048,6),m.writeUInt16LE(u?0:8,8),m.writeUInt16LE(s,10),m.writeUInt16LE(r,12),m.writeUInt32LE(f,14),m.writeUInt32LE(p.length,18),m.writeUInt32LE(i.length,22),m.writeUInt16LE(d.length,26),m.writeUInt16LE(0,28),t.push(m,d,p);const g=Buffer.alloc(46);g.writeUInt32LE(33639248,0),g.writeUInt16LE(20,4),g.writeUInt16LE(20,6),g.writeUInt16LE(2048,8),g.writeUInt16LE(u?0:8,10),g.writeUInt16LE(s,12),g.writeUInt16LE(r,14),g.writeUInt32LE(f,16),g.writeUInt32LE(p.length,20),g.writeUInt32LE(i.length,24),g.writeUInt16LE(d.length,28),g.writeUInt32LE(o,42),n.push(g,d),o+=m.length+d.length+p.length}const a=n.reduce((c,i)=>c+i.length,0),l=Buffer.alloc(22);return l.writeUInt32LE(101010256,0),l.writeUInt16LE(e.length,8),l.writeUInt16LE(e.length,10),l.writeUInt32LE(a,12),l.writeUInt32LE(o,16),Buffer.concat([...t,...n,l])}const wl={"zh-CN":{notZip:"不是 zip 文件",directory:"zip 的目录损坏",damaged:"zip 中 {name} 损坏",method:"zip 中 {name} 的压缩方式不支持"},"en-US":{notZip:"Not a zip file",directory:"The zip's directory is damaged",damaged:"{name} in the zip is damaged",method:"{name} in the zip is compressed in a way not supported"}};function ng(e,t="zh-CN"){const n=(c,i)=>cc((wl[t]??wl["zh-CN"])[c],i),o=Buffer.from(e.buffer,e.byteOffset,e.byteLength);let s=-1;for(let c=o.length-22;c>=Math.max(0,o.length-22-65535);c--)if(o.readUInt32LE(c)===101010256){s=c;break}if(s<0)throw new Error(n("notZip"));const r=o.readUInt16LE(s+10);let a=o.readUInt32LE(s+16);const l=[];for(let c=0;c<r;c++){if(a+46>o.length||o.readUInt32LE(a)!==33639248)throw new Error(n("directory"));const i=o.readUInt16LE(a+10),d=o.readUInt32LE(a+16),h=o.readUInt32LE(a+20),u=o.readUInt32LE(a+24),p=o.readUInt16LE(a+28),f=p+o.readUInt16LE(a+30)+o.readUInt16LE(a+32),m=o.readUInt32LE(a+42),g=o.toString("utf8",a+46,a+46+p);if(a+=46+f,g.endsWith("/"))continue;if(m+30>o.length||o.readUInt32LE(m)!==67324752)throw new Error(n("damaged",{name:g}));const y=m+30+o.readUInt16LE(m+26)+o.readUInt16LE(m+28),b=o.subarray(y,y+h);if(i!==0&&i!==8)throw new Error(n("method",{name:g}));const k=i===0?Buffer.from(b):Ru(b);if(k.length!==u||$d(k)!==d)throw new Error(n("damaged",{name:g}));l.push({name:g,data:k})}return l}const _n='"Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif',Xn={default:{name:"default",mode:"light",colorPrimary:"#255db0",colorAccent:"#6d4fc2",colorBg:"#f3f5f8",colorSurface:"#ffffff",colorSurfaceAlt:"#f8fafc",colorBorder:"#dfe5ec",colorText:"#203043",colorTextMuted:"#607086",colorSuccess:"#267257",colorWarning:"#9b4e12",colorDanger:"#b42318",colorInfo:"#1f6f9f",chartPalette:["#255db0","#e0883a","#2f9e77","#d0453a","#6d4fc2","#3a9fc0","#8a97a8"],fontFamily:_n,fontSize:13,radius:8,shadow:"subtle",density:"comfortable"},fresh:{name:"fresh",mode:"light",colorPrimary:"#0f7b6c",colorAccent:"#3b6fb6",colorBg:"#f3f6f5",colorSurface:"#ffffff",colorSurfaceAlt:"#f7faf9",colorBorder:"#dbe4e1",colorText:"#1f2d2b",colorTextMuted:"#5d6f6b",colorSuccess:"#237a4b",colorWarning:"#9a5b07",colorDanger:"#b42318",colorInfo:"#2a6f97",chartPalette:["#0f7b6c","#3b6fb6","#e0a33a","#7fb3a6","#c8553d","#6c63a8","#93a3a0"],fontFamily:_n,fontSize:13,radius:6,shadow:"none",density:"comfortable"},dark:{name:"dark",mode:"dark",colorPrimary:"#9bc1ff",colorAccent:"#c4b5fd",colorBg:"#141b24",colorSurface:"#202936",colorSurfaceAlt:"#1a222d",colorBorder:"#394659",colorText:"#ecf1f7",colorTextMuted:"#adbbce",colorSuccess:"#93d8bd",colorWarning:"#ffc38e",colorDanger:"#ff9e9e",colorInfo:"#8fd3f4",chartPalette:["#9bc1ff","#ffc38e","#93d8bd","#ff9e9e","#c4b5fd","#8fd3f4"],fontFamily:_n,fontSize:13,radius:8,shadow:"none",density:"comfortable"},tech:{name:"tech",mode:"dark",colorPrimary:"#3fd5ff",colorAccent:"#a493ff",colorBg:"#04080e",colorSurface:"#0a131f",colorSurfaceAlt:"#0d1828",colorBorder:"#1e3550",colorText:"#dce7f5",colorTextMuted:"#8193ab",colorSuccess:"#2ee6b6",colorWarning:"#ffb648",colorDanger:"#ff5470",colorInfo:"#5b8cff",chartPalette:["#3fd5ff","#ffb648","#2ee6b6","#ff5470","#a493ff","#5b8cff"],fontFamily:_n,fontSize:13,radius:4,shadow:"none",density:"compact"}},kl={free:{type:"free",columns:2,sidePosition:"left",sideWidth:300,asideWidth:0,gap:"normal"}};re.done.value;const mr=re.overdue.value,Sd=[re.active.value,mr],og={status:{variable:"status",field:"$status"},signed:{variable:"signed",field:"signing_date"},customer:{variable:"customer",field:"customer_name"},region:{variable:"region",field:"region"},search:{variable:"search",fields:["sales_order_id","customer_name","product_name"]},alert:{variable:"alert"}},jd=(...e)=>Object.entries(og).filter(([t])=>!e.includes(t)).map(([,t])=>t);jd("alert");Qt("$status",Sd);Qt("$status",Sd),Qt("$status",[mr]),Qt("$status",[mr]),jd();const sg=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h;function rg(e,t,n){const o=[],s={},r=Object.entries(e).filter(([a])=>a!==t).sort(([,a],[,l])=>a.y-l.y||a.x-l.x);for(const[a,l]of r){const c=h=>!o.some(u=>sg({...l,y:h},u));let i=l.y;for(;i>0&&c(i-1);)i-=1;for(;!c(i);)i+=1;const d={...l,y:i};o.push(d),s[a]=d}return s}const ag={sep:"、",object:e=>`${e} 必须是对象`,array:e=>`${e} 必须是数组`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,required:e=>`${e} 必填`,textMax:(e,t)=>`${e} 必须是不超过 ${t} 字的文本`,text:e=>`${e} 必须是文本`,numberRange:(e,t,n,o)=>`${e} 必须是 ${t} 到 ${n} 的${o?"数":"整数"}`,oneOf:(e,t)=>`${e} 只能是 ${t}`,bool:e=>`${e} 必须是 true 或 false`,sourceOneOf:(e,t)=>`${e} 必须是页面数据源之一:${t}`,pickProperty:e=>`${e} 至少选一个属性`,textList:e=>`${e} 必须是文本列表`,valueNotTaken:(e,t,n,o)=>`${e} 的取值「${t}」不是 ${n} 的取值(可选:${o})`,needSource:e=>`${e} 需要先选好数据源`,notObjectType:e=>`${e} 不是知识网络中的对象类`,operationOneOf:(e,t)=>`${e} 必须是数据源里定义的情景操作:${t}`,noOperations:"(数据源还没有情景操作)",operationProblem:(e,t)=>`${e} ${t}`,eventTypeOneOf:(e,t,n,o)=>`${e} 必须是应用的${t?"用户登记":""}事件类型${n?"列表":""}:${o}`,noEventTypes:"(还没有,先到「事件」页签新建)",actionIdList:e=>`${e} 必须是行动类型 id 的列表`,notAction:(e,t)=>`${e} 里的 ${t} 不是知识网络里的行动`,pickTool:e=>`${e} 要选工具箱和其中的一个工具`,pickMcpTool:e=>`${e} 要选 MCP 服务和其中的一个工具`,listSize:(e,t,n)=>`${e} 必须是 ${t} 到 ${n} 项的列表`,needSourceOrObjectType:e=>`${e} 需要先选好数据源或对象类`,propertyUnusable:(e,t)=>`${e} 不是可用的属性:${t}`,propertyOfType:(e,t)=>`${e} 必须是${t}属性`,typeNames:{date:"日期",number:"数字",text:"文本"},variableOneOf:(e,t)=>`${e} 必须是页面变量之一:${t}`,noVariables:"(没有可用变量)",objectsMismatch:(e,t)=>`${e} 筛选 ${t} 里是另一类对象,组件的数据源对不上`,list:e=>`${e} 必须是列表`,bindingShape:e=>`${e} 必须是 { variable, field? , fields? }`,filterOneOf:(e,t)=>`${e}.variable 必须是页面上的筛选之一:${t}`,noFilters:"(还没有筛选)",filterTwice:(e,t)=>`${e} 重复跟随筛选 ${t}`,bindingField:(e,t)=>`${e}.field 不是数据源的字段:${t}`,bindingDateField:e=>`${e}.field 必须是数据源的日期字段`,bindingTextFields:e=>`${e}.fields 必须是数据源的文本字段列表`,relationIds:e=>`${e} 必须是关系 ID 列表`,singleRelation:e=>`${e} 只能是一条关系:连线必须是知识网络里直接相连的关系,不能沿多条关系拼出来`,pathUnreachable:(e,t)=>`${e} 不是从 ${t} 出发连通的关系路径`,pathEnd:(e,t,n)=>`${e} 终点是 ${t},与 objectType ${n} 不一致`},ig={sep:", ",object:e=>`${e} must be an object`,array:e=>`${e} must be an array`,noOption:(e,t)=>`${e} has no option ${t}`,required:e=>`${e} is required`,textMax:(e,t)=>`${e} must be text of at most ${t} characters`,text:e=>`${e} must be text`,numberRange:(e,t,n,o)=>`${e} must be ${o?"a number":"an integer"} from ${t} to ${n}`,oneOf:(e,t)=>`${e} must be one of ${t}`,bool:e=>`${e} must be true or false`,sourceOneOf:(e,t)=>`${e} must be one of the page's sources: ${t}`,pickProperty:e=>`${e} needs at least one property`,textList:e=>`${e} must be a list of text`,valueNotTaken:(e,t,n,o)=>`${e} value "${t}" is not a value of ${n} (one of: ${o})`,needSource:e=>`${e} needs a source to be chosen first`,notObjectType:e=>`${e} is not an object type of the knowledge network`,operationOneOf:(e,t)=>`${e} must be a scenario operation defined on the source: ${t}`,noOperations:"(the source has no scenario operations yet)",operationProblem:(e,t)=>`${e} ${t}`,eventTypeOneOf:(e,t,n,o)=>`${e} must be ${n?"a list of ":"an "}${t?"user-reported ":""}event type${n?"s":""} of the app: ${o}`,noEventTypes:'(none yet; create one in the "Events" tab first)',actionIdList:e=>`${e} must be a list of action type ids`,notAction:(e,t)=>`${t} in ${e} is not an action of the knowledge network`,pickTool:e=>`${e} needs a toolbox and one of its tools`,pickMcpTool:e=>`${e} needs an MCP server and one of its tools`,listSize:(e,t,n)=>`${e} must be a list of ${t} to ${n} items`,needSourceOrObjectType:e=>`${e} needs a source or an object type to be chosen first`,propertyUnusable:(e,t)=>`${e} is not an available property: ${t}`,propertyOfType:(e,t)=>`${e} must be a ${t} property`,typeNames:{date:"date",number:"number",text:"text"},variableOneOf:(e,t)=>`${e} must be one of the page variables: ${t}`,noVariables:"(no variable available)",objectsMismatch:(e,t)=>`${e} filter ${t} holds another kind of object than the component's source`,list:e=>`${e} must be a list`,bindingShape:e=>`${e} must be { variable, field? , fields? }`,filterOneOf:(e,t)=>`${e}.variable must be one of the filters of the page: ${t}`,noFilters:"(no filter yet)",filterTwice:(e,t)=>`${e} follows filter ${t} twice`,bindingField:(e,t)=>`${e}.field is not a field of the source: ${t}`,bindingDateField:e=>`${e}.field must be a date field of the source`,bindingTextFields:e=>`${e}.fields must be a list of text fields of the source`,relationIds:e=>`${e} must be a list of relation ids`,singleRelation:e=>`${e} must be a single relation: a link must be a relation directly connecting objects in the knowledge network, not several relations chained`,pathUnreachable:(e,t)=>`${e} is not a connected relation path starting at ${t}`,pathEnd:(e,t,n)=>`${e} ends at ${t}, which differs from objectType ${n}`},Ze=()=>fe({"zh-CN":ag,"en-US":ig}),lg=80;function Ad(e,t,n,o,s={}){const r=Ze();if(!Ct(t))return[r.object(o)];const a=typeof t.source=="string"?t.source:void 0,l=[],c={...t};for(const[i,d]of Object.entries(s)){if(!(i in c))continue;const h=c[i];delete c[i],h!=null&&(d==="array"?!Array.isArray(h):!Ct(h))&&l.push(r[d](`${o}.${i}`))}return[...l,...Td(e,c,n,o,{sourceId:a,config:t})]}function cg(e,t){return{...t,sourceId:typeof e.source=="string"?e.source:t.sourceId,objectType:typeof e.objectType=="string"?e.objectType:t.objectType}}function dg(e,t,n,o,s){const r=t[e.key],a=`${o}.${e.key}`,l=e.neededAs?.(t);if(n.spec.linking==="auto"&&e.kind==="variable"&&!e.accepts.every(i=>i==="asOf")&&(r==null||r===""||r===!0&&!e.reads))return[];if(r==null||r==="")return!e.optional&&!e.notNeeded?.(t)||l?[Ze().required(a)]:[];const c=l&&e.kind==="field"?{...e,of:l}:e;return ug(c,r,n,a,s,t)}function Td(e,t,n,o,s){const r=Ze(),a=[],l=new Set(e.map(i=>i.key));for(const i of Object.keys(t))l.has(i)||a.push(r.noOption(o,i));const c=cg(t,s);for(const i of e)a.push(...dg(i,t,n,o,c));return a}function ug(e,t,n,o,s,r){const a=Ze(),l=un(ue(n.spec,s.sourceId));switch(e.kind){case"text":{if(e.max===null)return typeof t=="string"?[]:[a.text(o)];const c=e.max??lg;return typeof t=="string"&&t.length<=c?[]:[a.textMax(o,c)]}case"number":return typeof t=="number"&&Number.isFinite(t)&&(e.decimal===!0||Number.isInteger(t))&&t>=e.min&&t<=e.max?[]:[a.numberRange(o,e.min,e.max,e.decimal===!0)];case"enum":return e.options.some(([c])=>c===t)?[]:[a.oneOf(o,e.options.map(([c])=>c).join(a.sep))];case"bool":return typeof t=="boolean"?[]:[a.bool(o)];case"source":return n.spec.sources.some(c=>c.id===t)?[]:[a.sourceOneOf(o,n.spec.sources.map(c=>c.id).join(a.sep))];case"field":return vl(e,t,n,o,s);case"fields":return!Array.isArray(t)||t.length===0?[a.pickProperty(o)]:t.flatMap((c,i)=>vl(e,c,n,`${o}[${i}]`,s));case"variable":return hg(e.accepts,t,n,o,s);case"bindings":return pg(t,n,o,s);case"values":{if(!Array.isArray(t)||!t.every(d=>typeof d=="string"&&d!==""))return[a.textList(o)];const c=r[e.fieldKey]??s.config?.[e.fieldKey],i=typeof c=="string"?l(c):[];return i.length===0?[]:t.filter(d=>!i.includes(d)).map(d=>a.valueNotTaken(o,d,String(c),i.join(a.sep)))}case"conditions":{const c=Qn("source",n,s);return c===null?[a.needSource(o)]:xe(t,c,o,l)}case"objectType":return typeof t=="string"&&Object.hasOwn(n.kn.objectTypes,t)?[]:[a.notObjectType(o)];case"relationPath":return fg(t,n,o,s,e.single);case"operation":{const c=ue(n.spec,s.sourceId)?.operations??[],i=c.find(h=>h.id===t);if(!i)return[a.operationOneOf(o,c.map(h=>h.id).join(a.sep)||a.noOperations)];const d=e.fits?.(i,r);return d?[a.operationProblem(o,d)]:[]}case"eventType":{const i=(Array.isArray(n.spec.eventTypes)?Mn(n.spec,en(n.kn.eventTypes)):[]).filter(p=>!e.of||!p.source||p.source===e.of),d=p=>i.some(f=>f.id===p);if(e.multiple?Array.isArray(t)&&t.length>0&&t.every(d):d(t))return[];const u=i.map(p=>p.id).join(a.sep);return[a.eventTypeOneOf(o,e.of==="report",e.multiple===!0,u||a.noEventTypes)]}case"interactions":return Op(t,e,n,s.sourceId,Qn("source",n,s),o);case"actionTypes":{if(!Array.isArray(t)||t.some(i=>typeof i!="string"))return[a.actionIdList(o)];const c=n.kn.actionTypes;return c?t.filter(i=>!c.some(d=>d.id===i)).map(i=>a.notAction(o,String(i))):[]}case"metric":{const{place:c,category:i}=Kp(e.on,s.config??{});return Zp(t,n.kn,n.spec,s.sourceId,c,o,i)}case"tool":return Ct(t)&&typeof t.box=="string"&&t.box!==""&&typeof t.tool=="string"&&t.tool!==""?[]:[a.pickTool(o)];case"mcpTool":return Ct(t)&&typeof t.mcp=="string"&&t.mcp!==""&&typeof t.tool=="string"&&t.tool!==""&&[t.agentId,t.agentName].every(c=>c===void 0||typeof c=="string")?[]:[a.pickMcpTool(o)];case"list":return!Array.isArray(t)||t.length<e.min||t.length>e.max?[a.listSize(o,e.min,e.max)]:t.flatMap((c,i)=>Ct(c)?Td(e.item,c,n,`${o}[${i}]`,s):[a.object(`${o}[${i}]`)])}}const Od="$key";function vl(e,t,n,o,s){if(e.objectKey&&t===Od&&!e.of)return[];const r=Ze(),a=Qn(e.owner??"source",n,s);if(a===null)return[r.needSourceOrObjectType(o)];const l=a.find(c=>c.name===t);return l?e.of&&l.type!==e.of?[r.propertyOfType(o,r.typeNames[e.of])]:[]:[r.propertyUnusable(o,String(t))]}function hg(e,t,n,o,s){const r=Ze(),a=n.spec.variables.find(l=>l.name===t);if(!a||!e.includes(a.kind)){const l=n.spec.variables.filter(c=>e.includes(c.kind)).map(c=>c.name);return[r.variableOneOf(o,l.join(r.sep)||r.noVariables)]}return Cd(a,n,s)?[]:[Ed(o,a.name)]}const Ed=(e,t)=>Ze().objectsMismatch(e,t);function Cd(e,t,n){if(!("source"in e)||!n.sourceId)return!0;const o=s=>t.spec.sources.find(r=>r.id===s)?.objectType;return o(e.source)===o(n.sourceId)}function pg(e,t,n,o){const s=Ze();if(!Array.isArray(e))return[s.list(n)];if(e.length===0)return[];const r=Qn("source",t,o);if(r===null)return[s.needSource(n)];const a=c=>r.find(i=>i.name===c)?.type,l=new Set;return e.flatMap((c,i)=>{const d=`${n}[${i}]`;if(!Ct(c)||typeof c.variable!="string")return[s.bindingShape(d)];const h=t.spec.variables.find(u=>u.name===c.variable);if(!h||!wa.includes(h.kind)){const u=t.spec.variables.filter(p=>wa.includes(p.kind)).map(p=>p.name);return[s.filterOneOf(d,u.join(s.sep)||s.noFilters)]}if(l.has(h.name))return[s.filterTwice(d,h.name)];switch(l.add(h.name),h.kind){case"value":return a(c.field)?[]:[s.bindingField(d,String(c.field))];case"dateRange":return a(c.field)==="date"?[]:[s.bindingDateField(d)];case"search":return Array.isArray(c.fields)&&c.fields.length>0&&c.fields.every(u=>a(u)==="text")?[]:[s.bindingTextFields(d)];case"set":return Cd(h,t,o)?[]:[Ed(d,h.name)]}})}function fg(e,t,n,o,s=!1){const r=Ze(),a=ue(t.spec,o.sourceId);if(!a)return[r.needSource(n)];if(!Array.isArray(e)||!e.every(i=>typeof i=="string"))return[r.relationIds(n)];if(s&&e.length!==1)return[r.singleRelation(n)];const l=dn(t.kn,a.objectType,e);if(!l)return[r.pathUnreachable(n,a.objectType)];const c=l.length>0?l[l.length-1].to:a.objectType;return o.objectType&&c!==o.objectType?[r.pathEnd(n,c,o.objectType)]:[]}function Qn(e,t,n){if(e==="objectType")return n.objectType?t.kn.objectTypes[n.objectType]?.properties??null:null;const o=ue(t.spec,n.sourceId);return o?pe(o,t.kn):null}const mg={date:"日期",number:"数字",text:"文本"};function eo(e,t=" "){return e.map(n=>{const o=`${t}- ${n.key}(${n.label}${n.optional?",可选":""}):`;return n.kind==="list"?`${o}列表 ${n.min} 到 ${n.max} 项,每项:
|
|
156
|
-
${
|
|
157
|
-
`)}function gg(e){switch(e.kind){case"text":return e.max!=null?`文本,不超过 ${e.max} 字`:"文本";case"number":return`${e.decimal?"数":"整数"} ${e.min} 到 ${e.max}`;case"enum":return`取值 ${e.options.map(([t,n])=>`${t}(${n})`).join("、")}`;case"bool":return"true 或 false";case"source":return"页面数据源 id";case"field":case"fields":{const t=e.owner==="objectType"?"同一项 objectType 的属性":"数据源的属性",n=e.kind==="fields"?"列表":"",o=e.kind==="field"&&e.objectKey?`,或 ${Od} 表示对象本身`:"";return`${t}名${n}${e.of?`,须为${mg[e.of]}`:""}${o}`}case"variable":return`筛选名(variables 里的 name),类型须为 ${e.accepts.join(" 或 ")}`;case"bindings":return"跟随的筛选列表,每项 { variable, field? , fields? }:value 筛选给 field(按组件数据源的哪个字段比对);dateRange 筛选给日期 field;search 筛选给文本 fields;set 筛选不用给字段(须为同一类对象)。不写或空列表表示不受任何筛选影响";case"values":return`文本列表,为 ${e.fieldKey} 字段的取值(只取其中这些值;空列表表示不限)`;case"conditions":return"条件列表,全部成立才算命中;每项 { field, op, ref? | value? | values? },写法同计算列的条件";case"objectType":return"对象类 id";case"operation":return"数据源 operations 里的情景操作 id";case"relationPath":return e.single?"只含一个关系 id 的列表:知识网络里直接连接数据源对象类与 objectType 的那条关系;网络里没有直接关系的两类对象不能连线":"关系 id 列表,从数据源的对象类依次走到 objectType";case"list":return`列表 ${e.min} 到 ${e.max} 项,每项:${e.item.map(t=>t.label).join("、")}`;case"interactions":return Ep(e.on,e.actOn,e.hit,e.offers);case"actionTypes":return"行动类型 id 列表(知识网络里的行动)";case"metric":return e.on==="card"?"{ id, version }:知识网络中已发布的对象指标(见「对象指标」,没有这一节就不能用),须返回单个值、属于数据源的对象类;写了它,这张卡由平台按全部对象计算,不写 aggregate、valueField":"{ id, version }:知识网络中已发布的对象指标(见「对象指标」,没有这一节就不能用),须属于数据源的对象类;横轴为时间时须是有固定时间粒度的指标,横轴为类别时须返回单个值且类别属性是它开放的维度;写了它,这个系列由平台计算,不写 dateField、aggregate、valueField";case"tool":return"{ box, tool }:执行工厂里已发布工具箱的 id 和其中已启用工具的 id";case"mcpTool":return"{ mcp, tool, mcpName?, agentId?, agentName? }:执行工厂里已发布 MCP 服务的 id、其中工具的名称,以及服务名称(可选,只用于显示,不写时对话框向执行工厂取);支持智能体目录的服务可指定默认智能体 id 和名称;不知道有哪些服务时不写,由构建者选择";case"eventType":return`${e.multiple?"事件类型 id 列表":"事件类型 id"}(eventTypes 里的 id${e.of==="report"?",须为知识网络里来源是用户登记的":""})`}}function Ct(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const yg={joiner:"、",noOption:(e,t)=>`${e} 没有配置项 ${t}`,required:e=>`${e} 必填`,namesList:(e,t)=>`${e} 必须是不超过 ${t} 个名称的列表`,name:e=>`${e} 必须是非空名称`,conditionList:e=>`${e} 必须是条件列表`,condition:e=>`${e} 必须是 { field, op, value? } 条件`,object:e=>`${e} 必须是对象`,paramFrom:e=>`${e} 必须是 param、field、const 或 context 取值`,pathLength:e=>`${e} 必须是 1 到 4 条关系`,targetShape:e=>`${e} 必须是 { path?, field }`,readyShape:e=>`${e} 必须是 { path, field }`,onePath:e=>`${e} 必须是一条关系`,rulesCount:(e,t)=>`${e} 必须是不超过 ${t} 个规则工具`,ruleShape:e=>`${e} 必须是 { name, tool: { box, tool }, severity? }`,severity:e=>`${e} 只能是 hard 或 soft`,sourcesList:(e,t)=>`${e} 必须是不超过 ${t} 个数据源的列表`,layerList:e=>`${e} 必须是图层列表`,oneOf:(e,t)=>`${e} 只能是 ${t}`,tasksSelf:(e,t)=>`${e} 必须是 1 到 ${t} 种任务`,tasksRecord:e=>`${e} 写入计划记录时只能有一种任务`,parentOrGroup:e=>`${e} 上级字段与分组字段只能选一个`,calendarsCount:(e,t)=>`${e} 必须是不超过 ${t} 个日历`,boolean:e=>`${e} 必须是布尔值`,recordOnlyRecord:e=>`${e} 只在写入计划记录时填写`,recordRequired:e=>`${e} 写入计划记录时必填`,days:e=>`${e} 必须是 1 到 365 天`,matchCount:(e,t)=>`${e} 必须是不超过 ${t} 对字段`,matchShape:e=>`${e} 必须是 { from, to }`},bg={joiner:", ",noOption:(e,t)=>`${e} has no option ${t}`,required:e=>`${e} is required`,namesList:(e,t)=>`${e} must be a list of at most ${t} names`,name:e=>`${e} must be a non-empty name`,conditionList:e=>`${e} must be a list of conditions`,condition:e=>`${e} must be a { field, op, value? } condition`,object:e=>`${e} must be an object`,paramFrom:e=>`${e} must take its value from param, field, const or context`,pathLength:e=>`${e} must be 1 to 4 relations`,targetShape:e=>`${e} must be { path?, field }`,readyShape:e=>`${e} must be { path, field }`,onePath:e=>`${e} must be one relation`,rulesCount:(e,t)=>`${e} must be at most ${t} rule tools`,ruleShape:e=>`${e} must be { name, tool: { box, tool }, severity? }`,severity:e=>`${e} must be hard or soft`,sourcesList:(e,t)=>`${e} must be a list of at most ${t} sources`,layerList:e=>`${e} must be a list of layers`,oneOf:(e,t)=>`${e} must be one of ${t}`,tasksSelf:(e,t)=>`${e} must be 1 to ${t} kinds of task`,tasksRecord:e=>`${e} can have only one kind of task when results go into plan records`,parentOrGroup:e=>`${e} can take a parent field or a group field, not both`,calendarsCount:(e,t)=>`${e} must be at most ${t} calendars`,boolean:e=>`${e} must be true or false`,recordOnlyRecord:e=>`${e} is only for results written into plan records`,recordRequired:e=>`${e} is required when results go into plan records`,days:e=>`${e} must be 1 to 365 days`,matchCount:(e,t)=>`${e} must be at most ${t} pairs of fields`,matchShape:e=>`${e} must be { from, to }`},Me=()=>fe({"zh-CN":yg,"en-US":bg}),$l=["self","record"],wg=["title","subtitleField","daysBefore","daysAfter","tick","timeZone","timeZoneVariable","resourceSelection"],kg=["label","popoverFields","color","tone","colorField","snap","selection","filters"],vg=["result","tasks","resource","time","rules","plan"],to=3,gr=3,Sl=4,jl=5,se=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Le=e=>typeof e=="string"&&e!=="";function Ue(e,t,n){return Object.keys(e).filter(o=>!t.includes(o)).map(o=>Me().noOption(n,o))}function Nd(e,t,n,o=10){const s=Me();return e===void 0?n?[s.required(t)]:[]:!Array.isArray(e)||e.length>o||!e.every(Le)?[s.namesList(t,o)]:[]}function H(e,t,n=!0){return e===void 0&&!n?[]:Le(e)?[]:[Me().name(t)]}function xd(e,t){const n=Me();return e===void 0?[]:Array.isArray(e)?e.flatMap((o,s)=>se(o)&&Le(o.field)&&Gn.includes(o.op)?[]:[n.condition(`${t}[${s}]`)]):[n.conditionList(t)]}function yr(e,t,n){const o=Me();if(e===void 0)return n?[o.required(t)]:[];if(!se(e))return[o.object(t)];const s=[...Ue(e,["action","params"],t),...H(e.action,`${t}.action`)];if(e.params!==void 0)if(!se(e.params))s.push(o.object(`${t}.params`));else for(const[r,a]of Object.entries(e.params))(!se(a)||!((a.from==="param"||a.from==="field")&&Le(a.name)||a.from==="const"&&(typeof a.value=="string"||typeof a.value=="number")||a.from==="context"&&Ys.includes(a.name)))&&s.push(o.paramFrom(`${t}.params.${r}`));return s}function Al(e,t){return Array.isArray(e)&&e.length>0&&e.length<=4&&e.every(Le)?[]:[Me().pathLength(t)]}function $g(e,t,n){const o=Me();if(!se(e))return[o.object(t)];const s=[...Ue(e,["objectType","assignField","start","end","status","titleFields","doneWhen","groupField","target","ready","predecessors","modify","rules"],t),...H(e.objectType,`${t}.objectType`),...H(e.assignField,`${t}.assignField`,n),...H(e.start,`${t}.start`,n),...H(e.end,`${t}.end`,n),...H(e.status,`${t}.status`,!1),...H(e.groupField,`${t}.groupField`,!1),...Nd(e.titleFields,`${t}.titleFields`,!1,4),...xd(e.doneWhen,`${t}.doneWhen`),...yr(e.modify,`${t}.modify`,!1)];if(e.target!==void 0&&(se(e.target)?(s.push(...H(e.target.field,`${t}.target.field`)),e.target.path!==void 0&&s.push(...Al(e.target.path,`${t}.target.path`))):s.push(o.targetShape(`${t}.target`))),e.ready!==void 0&&(se(e.ready)?s.push(...Al(e.ready.path,`${t}.ready.path`),...H(e.ready.field,`${t}.ready.field`)):s.push(o.readyShape(`${t}.ready`))),e.predecessors!==void 0){const r=se(e.predecessors)?e.predecessors.path:void 0;(!Array.isArray(r)||r.length!==1||!Le(r[0]))&&s.push(o.onePath(`${t}.predecessors.path`))}return e.rules!==void 0&&(!Array.isArray(e.rules)||e.rules.length>jl?s.push(o.rulesCount(`${t}.rules`,jl)):e.rules.forEach((r,a)=>{const l=se(r)?r.tool:void 0;!se(r)||!Le(r.name)||!se(l)||!Le(l.box)||!Le(l.tool)?s.push(o.ruleShape(`${t}.rules[${a}]`)):r.severity!==void 0&&r.severity!=="hard"&&r.severity!=="soft"&&s.push(o.severity(`${t}.rules[${a}].severity`))})),s}function Tl(e,t,n){return e===void 0?[]:Array.isArray(e)&&e.length<=n&&e.every(o=>typeof o=="string")?[]:[Me().sourcesList(t,n)]}function Sg(e,t){return e===void 0?[]:se(e)?[...Ue(e,["tasks","resource","calendars","plan"],t),...Tl(e.tasks,`${t}.tasks`,to),...H(e.resource,`${t}.resource`,!1),...Tl(e.calendars,`${t}.calendars`,gr),...H(e.plan,`${t}.plan`,!1)]:[Me().object(t)]}function jg(e,t){if(e===void 0)return[];const n=Me();if(!se(e))return[n.object(t)];const o=Ue(e,["resource","demand"],t);for(const s of["resource","demand"]){const r=e[s];if(r!==void 0){if(!se(r)){o.push(n.object(`${t}.${s}`));continue}o.push(...Ue(r,[...wg,"layers"],`${t}.${s}`)),r.layers!==void 0&&(!Array.isArray(r.layers)||r.layers.length>12?o.push(n.layerList(`${t}.${s}.layers`)):r.layers.forEach((a,l)=>{se(a)?o.push(...Ue(a,kg,`${t}.${s}.layers[${l}]`)):o.push(n.object(`${t}.${s}.layers[${l}]`))}))}}return o}function Ag(e,t="scheduleModel"){const n=Me();if(!se(e))return[n.object(t)];const o=Ue(e,["result","tasks","resource","calendars","record","sources","display"],t);o.push(...Sg(e.sources,`${t}.sources`),...jg(e.display,`${t}.display`)),$l.includes(e.result)||o.push(n.oneOf(`${t}.result`,$l.join(n.joiner)));const s=e.result==="self",r=s?to:1;!Array.isArray(e.tasks)||e.tasks.length===0||e.tasks.length>r?o.push(s?n.tasksSelf(`${t}.tasks`,to):n.tasksRecord(`${t}.tasks`)):e.tasks.forEach((c,i)=>o.push(...$g(c,`${t}.tasks[${i}]`,s)));const a=e.resource;se(a)?(o.push(...Ue(a,["objectType","titleField","parentField","groupField","capacityField"],`${t}.resource`),...H(a.objectType,`${t}.resource.objectType`),...H(a.titleField,`${t}.resource.titleField`),...H(a.parentField,`${t}.resource.parentField`,!1),...H(a.groupField,`${t}.resource.groupField`,!1),...H(a.capacityField,`${t}.resource.capacityField`,!1)),a.parentField!==void 0&&a.groupField!==void 0&&o.push(n.parentOrGroup(`${t}.resource`))):o.push(n.object(`${t}.resource`)),e.calendars!==void 0&&(!Array.isArray(e.calendars)||e.calendars.length>gr?o.push(n.calendarsCount(`${t}.calendars`,gr)):e.calendars.forEach((c,i)=>{const d=`${t}.calendars[${i}]`;return se(c)?(o.push(...Ue(c,["objectType","resourceField","start","end","inherit"],d),...H(c.objectType,`${d}.objectType`),...H(c.resourceField,`${d}.resourceField`),...H(c.start,`${d}.start`),...H(c.end,`${d}.end`)),c.inherit!==void 0&&typeof c.inherit!="boolean"&&o.push(n.boolean(`${d}.inherit`)),o):o.push(n.object(d))}));const l=e.record;if(s)l!==void 0&&o.push(n.recordOnlyRecord(`${t}.record`));else if(!se(l))o.push(n.recordRequired(`${t}.record`));else{const c=`${t}.record`;o.push(...Ue(l,["objectType","match","resourceField","start","end","status","titleFields","active","create","modify","days","daysField"],c),...H(l.objectType,`${c}.objectType`),...H(l.resourceField,`${c}.resourceField`,!1),...H(l.start,`${c}.start`),...H(l.end,`${c}.end`),...H(l.status,`${c}.status`,!1),...Nd(l.titleFields,`${c}.titleFields`,!1,4),...H(l.daysField,`${c}.daysField`,!1),...l.days!==void 0&&(typeof l.days!="number"||!(l.days>0)||l.days>365)?[n.days(`${c}.days`)]:[],...xd(l.active,`${c}.active`),...yr(l.create,`${c}.create`,!1),...yr(l.modify,`${c}.modify`,!1)),l.match!==void 0&&(!Array.isArray(l.match)||l.match.length>Sl?o.push(n.matchCount(`${c}.match`,Sl)):l.match.forEach((i,d)=>{(!se(i)||!Le(i.from)||!Le(i.to))&&o.push(n.matchShape(`${c}.match[${d}]`))}))}return o}function Tg(e,t,n){const r=(n.startsWith(`${t.id}_`)?n.slice(t.id.length+1):n).replace(/[^A-Za-z0-9]+(.)?/g,(l,c)=>(c??"").toUpperCase()).replace(/^[^A-Za-z]+/,"")||`source${Object.keys(t.objectTypes).indexOf(n)+1||""}`,a=new Set(e.sources.map(l=>l.id));if(!a.has(r))return r;for(let l=2;;l++)if(!a.has(`${r}${l}`))return`${r}${l}`}const Og={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,notBoth:e=>`${e} 不能同时是 Cypher 数据源和事件数据源`,mustBe:(e,t)=>`${e} 必须是 ${t}`,typesList:e=>`${e} 必须是事件类型 id 列表`},Eg={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,notBoth:e=>`${e} cannot be both a Cypher source and an event source`,mustBe:(e,t)=>`${e} must be ${t}`,typesList:e=>`${e} must be a list of event type ids`},Cg=()=>fe({"zh-CN":Og,"en-US":Eg}),Ng="events:",br="event_id",wr=e=>`${Ng}${e}`,xg=[{name:"event_id",label:"事件 ID",type:"text"},{name:"title",label:"标题",type:"text"},{name:"event_type",label:"事件类型",type:"text"},{name:"severity",label:"严重程度",type:"text"},{name:"status",label:"状态",type:"text"},{name:"open",label:"是否未关闭",type:"text"},{name:"overdue",label:"是否超时",type:"text"},{name:"source",label:"来源",type:"text"},{name:"occurred_at",label:"发生时间",type:"date"},{name:"ended_at",label:"结束时间",type:"date"},{name:"recorded_at",label:"记录时间",type:"date"},{name:"object",label:"关联对象",type:"text"},{name:"object_key",label:"关联对象标识",type:"text"},{name:"reported_by",label:"报告人",type:"text"},{name:"verified_by",label:"核实人",type:"text"}];function Rg(e,t){return{id:wr(e),name:t,primaryKeys:[br],displayKey:"title",properties:xg}}function _g(e,t){const n=Cg(),o=[],s=e.events;if(typeof s!="object"||s===null||Array.isArray(s))return[n.object(`${t}.events`)];e.cypher!==void 0&&o.push(n.notBoth(t)),e.objectType!==wr(String(e.id))&&o.push(n.mustBe(`${t}.objectType`,wr(String(e.id)))),e.key!==br&&o.push(n.mustBe(`${t}.key`,br));const r=s.types;r!==void 0&&!(Array.isArray(r)&&r.every(a=>typeof a=="string"))&&o.push(n.typesList(`${t}.events.types`));for(const a of Object.keys(s))a!=="types"&&o.push(n.noOption(`${t}.events`,a));return o}const Pg={joiner:"、",list:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,idFormat:e=>`${e} 必须是字母开头的标识`,idTwice:(e,t)=>`${e} 重复:${t}`,label:e=>`${e} 必须是不超过 30 字的名称`,oneOf:(e,t)=>`${e} 只能是 ${t}`,unit:e=>`${e} 必须是不超过 10 字的文字`,text:e=>`${e} 必须是文字`,number:e=>`${e} 必须是数值`,minAboveMax:e=>`${e} 不能大于 max`,outOfRange:e=>`${e} 超出范围`,rangeOnlyNumber:e=>`${e} 只有数值参数能设范围`,dayDate:e=>`${e} 必须是 YYYY-MM-DD 日期`,optionsOnlyText:e=>`${e} 只有文本参数能列可选值`,optionsCount:(e,t)=>`${e} 必须是 2 到 ${t} 个可选值`,required:e=>`${e} 必填`,scenarioName:e=>`${e} 必须是不超过 40 字的方案名`,defaultInOptions:e=>`${e} 必须是可选值之一`,saveAsName:e=>`${e} 必填:保存为知识网络对象时的对象类名称`,saveAsNameLong:(e,t)=>`${e} 不能超过 ${t} 个字`,outputTooLong:(e,t,n)=>`${e} 的字段 ${t} 超过 ${n} 个字符,不能保存为对象属性`,outputFixedName:(e,t)=>`${e} 的字段 ${t} 与结果行的固定字段同名,请改名`,objectTypeMustBe:(e,t)=>`${e} 必须是 ${t}`,notForModelSource:e=>`${e} 不能用于模型结果数据源`,tool:e=>`${e} 必须写明执行工厂的工具箱 box 与工具 tool`,inputsCount:(e,t)=>`${e} 必须是 1 到 ${t} 个输入`,inputSource:e=>`${e} 必须是页面的其他数据源`,inputBaseMissing:e=>`${e} 的来源数据源不存在`,inputEvents:e=>`${e} 不能是事件数据源`,inputFollows:e=>`${e} 是跟随筛选的子集,模型的输入不能跟随筛选`,inputQueryParam:(e,t)=>`${e} 的查询参数 $${t} 只能绑定基准日期`,inputFieldsEmpty:e=>`${e} 至少传一个字段`,inputField:e=>`${e} 必须是该数据源的字段`,inputsLoop:e=>`${e} 形成了循环:模型结果数据源不能读到自己`,paramsCount:(e,t)=>`${e} 必须是不超过 ${t} 个参数`,notScenarioParam:e=>`${e} 不是方案参数`,paramTypeDiffers:(e,t)=>`${e} 的类型是 ${t},与参数类型不同`,paramNoValue:e=>`${e} 取方案参数时不写固定值 value`,paramValue:e=>`${e} 必须是与类型相符的固定值,或改取方案参数 param`,outputsCount:(e,t)=>`${e} 必须是行标识加 1 到 ${t} 个字段`,keyMustBeOutput:e=>`${e} 必须是模型的一个输出字段(行标识)`,knObjectType:e=>`${e} 必须是知识网络中的对象类`,mustBeModelOutput:e=>`${e} 必须是模型的输出字段`,actionTarget:e=>`${e} 只能是 object(对这个对象执行)或 new(按新对象执行)`,actionType:e=>`${e} 不是知识网络中的行动类型`,actionObjectType:(e,t)=>`${e} 必须作用于对应对象的对象类 ${t}`,actionNewIsAdd:e=>`${e} 按新对象执行须是新增类行动`,prefix:(e,t)=>`${e} 必须是不超过 ${t} 字的编号前缀`,keyField:(e,t)=>`${e} 必须是 ${t} 的主键`,notPropertyOf:(e,t)=>`${e} 不是 ${t} 的属性`,numberField:e=>`${e} 是编号字段,取新编号`,mustTakeOutput:e=>`${e} 必须取模型的输出字段`,mustGive:e=>`${e} 必须给出:新建对象时这个属性必须有值,取模型的输出字段,或在 action.params 里给出来源`,notUserParam:e=>`${e} 不是该行动的用户填写参数`,fieldsAtLeastOne:e=>`${e} 至少要有一个字段`,fieldNameEmpty:e=>`${e} 的字段名不能为空`,textOrNumber:e=>`${e} 必须是文字或数值`,fromFieldOrConst:e=>`${e} 只能是 field 或 const`},Lg={joiner:", ",list:(e,t)=>`${e} must be a list of at most ${t} items`,object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,idFormat:e=>`${e} must be an identifier starting with a letter`,idTwice:(e,t)=>`${e} is used twice: ${t}`,label:e=>`${e} must be a name of at most 30 characters`,oneOf:(e,t)=>`${e} must be one of ${t}`,unit:e=>`${e} must be text of at most 10 characters`,text:e=>`${e} must be text`,number:e=>`${e} must be a number`,minAboveMax:e=>`${e} cannot be greater than max`,outOfRange:e=>`${e} is out of range`,rangeOnlyNumber:e=>`${e}: only a number parameter can have a range`,dayDate:e=>`${e} must be a date in YYYY-MM-DD`,optionsOnlyText:e=>`${e}: only a text parameter can list options`,optionsCount:(e,t)=>`${e} must list 2 to ${t} options`,required:e=>`${e} is required`,scenarioName:e=>`${e} must be a scenario name of at most 40 characters`,defaultInOptions:e=>`${e} must be one of the options`,saveAsName:e=>`${e} is required: the object type name when saved as a knowledge network object`,saveAsNameLong:(e,t)=>`${e} cannot be longer than ${t} characters`,outputTooLong:(e,t,n)=>`field ${t} of ${e} is longer than ${n} characters and cannot be saved as an object property`,outputFixedName:(e,t)=>`field ${t} of ${e} has the same name as a fixed field of the result row, please rename it`,objectTypeMustBe:(e,t)=>`${e} must be ${t}`,notForModelSource:e=>`${e} cannot be used on a model result source`,tool:e=>`${e} must name the execution factory toolbox (box) and tool`,inputsCount:(e,t)=>`${e} must list 1 to ${t} inputs`,inputSource:e=>`${e} must be another source of the page`,inputBaseMissing:e=>`the source that ${e} comes from does not exist`,inputEvents:e=>`${e} cannot be an event source`,inputFollows:e=>`${e} is a subset that follows filters, and the inputs of a model cannot follow filters`,inputQueryParam:(e,t)=>`query parameter $${t} of ${e} can only be bound to the base date`,inputFieldsEmpty:e=>`${e} must send at least one field`,inputField:e=>`${e} must be a field of that source`,inputsLoop:e=>`${e} form a loop: a model result source cannot read itself`,paramsCount:(e,t)=>`${e} must be at most ${t} parameters`,notScenarioParam:e=>`${e} is not a scenario parameter`,paramTypeDiffers:(e,t)=>`${e} has type ${t}, which differs from the parameter type`,paramNoValue:e=>`${e} takes a scenario parameter, so it must not have a fixed value`,paramValue:e=>`${e} must be a fixed value of the matching type, or take a scenario parameter with param`,outputsCount:(e,t)=>`${e} must be a row id plus 1 to ${t} fields`,keyMustBeOutput:e=>`${e} must be an output field of the model (the row id)`,knObjectType:e=>`${e} must be an object type of the knowledge network`,mustBeModelOutput:e=>`${e} must be an output field of the model`,actionTarget:e=>`${e} must be object (act on this object) or new (act on a new object)`,actionType:e=>`${e} is not an action type of the knowledge network`,actionObjectType:(e,t)=>`${e} must act on the object type ${t} of the object`,actionNewIsAdd:e=>`${e} must be an add action to act on a new object`,prefix:(e,t)=>`${e} must be a number prefix of at most ${t} characters`,keyField:(e,t)=>`${e} must be the primary key of ${t}`,notPropertyOf:(e,t)=>`${e} is not a property of ${t}`,numberField:e=>`${e} is the number field and takes the new number`,mustTakeOutput:e=>`${e} must take an output field of the model`,mustGive:e=>`${e} is required: this property must have a value when the object is created, so take an output field of the model or give its source in action.params`,notUserParam:e=>`${e} is not a parameter the user fills in for this action`,fieldsAtLeastOne:e=>`${e} must have at least one field`,fieldNameEmpty:e=>`a field name of ${e} cannot be empty`,textOrNumber:e=>`${e} must be text or a number`,fromFieldOrConst:e=>`${e} must be field or const`},ko=()=>fe({"zh-CN":Pg,"en-US":Lg}),Ig="model:",kr=e=>`${Ig}${e}`,Ol=5,El=5,Cl=8,Nl=10,xl=10,Rl=20,qn=/^[A-Za-z][A-Za-z0-9_]*$/,Rd=/^\d{4}-\d{2}-\d{2}$/,lt=["number","date","text"],te=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function _d(e){const t=Array.isArray(e.model?.outputs)?e.model.outputs:[],n=typeof e.key=="string"?e.key:"";return{id:kr(e.id),name:typeof e.label=="string"?e.label:e.id,primaryKeys:n?[n]:[],displayKey:n,properties:t.filter(o=>o&&typeof o.name=="string").map(o=>({name:o.name,label:typeof o.label=="string"&&o.label?o.label:o.name,type:lt.includes(o.type)?o.type:"text"}))}}function Mg(e,t){return e.find(o=>o.id===t)?.from?.source??t}function _l(e,t){const n=new Set(e.filter(r=>r.model).map(r=>r.id)),s=(Array.isArray(t.model?.inputs)?t.model.inputs:[]).filter(r=>te(r)&&typeof r.source=="string").map(r=>Mg(e,r.source)).filter(r=>n.has(r));return[...new Set(s)]}function qg(e,t="scenarioParams"){if(e===void 0)return[];const n=ko();if(!Array.isArray(e)||e.length>Nl)return[n.list(t,Nl)];const o=new Set;return e.flatMap((s,r)=>{const a=`${t}[${r}]`;if(!te(s))return[n.object(a)];const l=Object.keys(s).filter(c=>!["name","label","type","unit","default","description","min","max","options"].includes(c)).map(c=>n.noOption(a,c));if(typeof s.name!="string"||!qn.test(s.name)?l.push(n.idFormat(`${a}.name`)):o.has(s.name)?l.push(n.idTwice(`${a}.name`,s.name)):o.add(s.name),(typeof s.label!="string"||!s.label.trim()||s.label.length>30)&&l.push(n.label(`${a}.label`)),!lt.includes(s.type))return[...l,n.oneOf(`${a}.type`,lt.join(n.joiner))];if(s.unit!==void 0&&(typeof s.unit!="string"||s.unit.length>10)&&l.push(n.unit(`${a}.unit`)),s.description!==void 0&&typeof s.description!="string"&&l.push(n.text(`${a}.description`)),s.type==="number"){(typeof s.default!="number"||!Number.isFinite(s.default))&&l.push(n.number(`${a}.default`));for(const c of["min","max"])s[c]!==void 0&&typeof s[c]!="number"&&l.push(n.number(`${a}.${c}`));typeof s.min=="number"&&typeof s.max=="number"&&s.min>s.max?l.push(n.minAboveMax(`${a}.min`)):typeof s.default=="number"&&(typeof s.min=="number"&&s.default<s.min||typeof s.max=="number"&&s.default>s.max)&&l.push(n.outOfRange(`${a}.default`))}else(s.min!==void 0||s.max!==void 0)&&l.push(n.rangeOnlyNumber(a)),s.type==="date"&&(typeof s.default!="string"||!Rd.test(s.default))&&l.push(n.dayDate(`${a}.default`)),s.type==="text"&&typeof s.default!="string"&&l.push(n.text(`${a}.default`));if(s.options!==void 0){const c=Array.isArray(s.options)?s.options:null;if(s.type!=="text")l.push(n.optionsOnlyText(`${a}.options`));else if(!c||c.length<2||c.length>xl)l.push(n.optionsCount(`${a}.options`,xl));else{const i=new Set;c.forEach((d,h)=>{const u=`${a}.options[${h}]`;return!te(d)||typeof d.value!="string"||!d.value.trim()?l.push(n.required(`${u}.value`)):(i.has(d.value)&&l.push(n.idTwice(`${u}.value`,d.value)),i.add(d.value),d.scenario!==void 0&&(typeof d.scenario!="string"||d.scenario.length>40)&&l.push(n.scenarioName(`${u}.scenario`)),l)}),typeof s.default=="string"&&!i.has(s.default)&&l.push(n.defaultInOptions(`${a}.default`))}}return l})}function Fg(e,t,n){const o=e.find(a=>a.id===t),s=o?.from?e.find(a=>a.id===o.from?.source):o;if(!o||!s)return[];const r=o.from?{...s,id:o.id,from:o.from}:o;return pe(r,n).filter(a=>a.name!==cn)}const Pl=128,Ll=40,Dg=["result_id","row_key","scenario_id","scenario_name","run_id","as_of","computed_at","app_id","source_id"];function Bg(e,t,n){const o=ko(),s=`${n}.model.saveAs`;if(!te(e))return[o.object(s)];const r=Object.keys(e).filter(l=>l!=="name").map(l=>o.noOption(s,l)),a=typeof e.name=="string"?e.name.trim():"";a?[...a].length>Pl&&r.push(o.saveAsNameLong(`${s}.name`,Pl)):r.push(o.saveAsName(`${s}.name`));for(const l of t)l.length>Ll&&r.push(o.outputTooLong(`${n}.model.outputs`,l,Ll)),Dg.includes(l)&&r.push(o.outputFixedName(`${n}.model.outputs`,l));return r}function Ug(e,t,n){const{sources:o,kn:s,variables:r,scenarioParams:a}=t,l=ko(),c=e.model;if(!te(c))return[l.object(`${n}.model`)];const i=Object.keys(c).filter(m=>!["tool","inputs","params","outputs","landing","saveAs"].includes(m)).map(m=>l.noOption(`${n}.model`,m));e.objectType!==kr(e.id)&&i.push(l.objectTypeMustBe(`${n}.objectType`,kr(e.id)));for(const m of["cypher","events","from","models","follows","relatedTo","computed","progress"])e[m]!==void 0&&i.push(l.notForModelSource(`${n}.${m}`));const d=te(c.tool)?c.tool:null;!d||typeof d.box!="string"||!d.box||typeof d.tool!="string"?i.push(l.tool(`${n}.model.tool`)):d.tool||i.push(l.required(`${n}.model.tool.tool`));const h=Array.isArray(c.inputs)?c.inputs:null;if(!h||h.length===0||h.length>Ol)i.push(l.inputsCount(`${n}.model.inputs`,Ol));else{const m=new Set;h.forEach((y,b)=>{const k=`${n}.model.inputs[${b}]`;if(!te(y))return i.push(l.object(k));typeof y.name!="string"||!qn.test(y.name)?i.push(l.idFormat(`${k}.name`)):m.has(y.name)?i.push(l.idTwice(`${k}.name`,y.name)):m.add(y.name);const w=o.find(j=>j.id===y.source);if(!w||w.id===e.id)return i.push(l.inputSource(`${k}.source`));const v=w.from?o.find(j=>j.id===w.from?.source):w;if(!v)return i.push(l.inputBaseMissing(`${k}.source`));if(v.events)return i.push(l.inputEvents(`${k}.source`));if(w.from?.filters?.length&&i.push(l.inputFollows(`${k}.source`)),v.cypher)for(const[j,O]of Object.entries(v.cypher.params??{}))r.find(E=>E.name===O)?.kind!=="asOf"&&i.push(l.inputQueryParam(`${k}.source`,j));const S=new Set(Fg(o,w.id,s).map(j=>j.name));return!Array.isArray(y.fields)||y.fields.length===0?i.push(l.inputFieldsEmpty(`${k}.fields`)):y.fields.forEach((j,O)=>{(typeof j!="string"||!S.has(j))&&i.push(l.inputField(`${k}.fields[${O}]`))}),i});const g=y=>{const b=new Set,k=w=>{if(w===e.id)return!0;if(b.has(w))return!1;b.add(w);const v=o.find(S=>S.id===w);return v?.model?_l(o,v).some(k):!1};return k(y)};_l(o,e).some(g)&&i.push(l.inputsLoop(`${n}.model.inputs`))}const u=c.params===void 0?[]:Array.isArray(c.params)?c.params:null;if(!u||u.length>El)i.push(l.paramsCount(`${n}.model.params`,El));else{const m=new Set;u.forEach((g,y)=>{const b=`${n}.model.params[${y}]`;if(!te(g))return i.push(l.object(b));if(typeof g.name!="string"||!qn.test(g.name)?i.push(l.idFormat(`${b}.name`)):m.has(g.name)?i.push(l.idTwice(`${b}.name`,g.name)):m.add(g.name),!lt.includes(g.type))return i.push(l.oneOf(`${b}.type`,lt.join(l.joiner)));if(g.param!==void 0){const k=a.find(w=>w.name===g.param);k?k.type!==g.type&&i.push(l.paramTypeDiffers(`${b}.param`,k.type)):i.push(l.notScenarioParam(`${b}.param`)),g.value!==void 0&&i.push(l.paramNoValue(b))}else(g.type==="number"?typeof g.value!="number":typeof g.value!="string"||g.type==="date"&&!Rd.test(g.value))&&i.push(l.paramValue(`${b}.value`));return i})}const p=Array.isArray(c.outputs)?c.outputs:null,f=new Set;return!p||p.length<2||p.length>Cl+1?i.push(l.outputsCount(`${n}.model.outputs`,Cl)):p.forEach((m,g)=>{const y=`${n}.model.outputs[${g}]`;return te(m)?(typeof m.name!="string"||!qn.test(m.name)?i.push(l.idFormat(`${y}.name`)):f.has(m.name)?i.push(l.idTwice(`${y}.name`,m.name)):f.add(m.name),(typeof m.label!="string"||!m.label.trim())&&i.push(l.required(`${y}.label`)),lt.includes(m.type)||i.push(l.oneOf(`${y}.type`,lt.join(l.joiner))),i):i.push(l.object(y))}),p&&!f.has(String(e.key))&&i.push(l.keyMustBeOutput(`${n}.key`)),c.landing!==void 0&&i.push(...zg(c.landing,e,s,n)),c.saveAs!==void 0&&i.push(...Bg(c.saveAs,f,n)),i}function zg(e,t,n,o){const s=ko(),r=`${o}.model.landing`;if(!te(e))return[s.object(r)];const a=[],l=_d(t).properties,c=new Set(l.map(f=>f.name));e.when!==void 0&&a.push(...xe(e.when,l,`${r}.when`));const i=te(e.object)?e.object:null,d=typeof i?.type=="string"?i.type:"",h=d&&!d.includes(":")&&Object.hasOwn(n.objectTypes,d)?n.objectTypes[d]:void 0;if(h||a.push(s.knObjectType(`${r}.object.type`)),(!i||typeof i.field!="string"||!c.has(i.field))&&a.push(s.mustBeModelOutput(`${r}.object.field`)),e.action===void 0)return a;const u=te(e.action)?e.action:null;if(!u||typeof u.id!="string")return[...a,s.required(`${r}.action.id`)];if(["object","new"].includes(String(u.target))||a.push(s.actionTarget(`${r}.action.target`)),n.actionTypes===void 0)return a;const p=ln(n,u.id);if(!p)return[...a,s.actionType(`${r}.action.id`)];if(u.target==="object"&&h&&p.objectType!==h.id&&a.push(s.actionObjectType(`${r}.action.id`,h.id)),u.target==="new"){p.kind!=="add"&&a.push(s.actionNewIsAdd(`${r}.action.id`));const f=n.objectTypes[p.objectType],m=te(u.newObject)?u.newObject:null;if(!m||typeof m.prefix!="string"||!m.prefix.trim()||m.prefix.length>Rl)a.push(s.prefix(`${r}.action.newObject.prefix`,Rl));else if(f){const g=m.keyField??f.primaryKeys[0];if((typeof g!="string"||!f.primaryKeys.includes(g))&&a.push(s.keyField(`${r}.action.newObject.keyField`,f.id)),m.fields!==void 0)if(!te(m.fields))a.push(s.object(`${r}.action.newObject.fields`));else for(const[k,w]of Object.entries(m.fields))f.properties.some(v=>v.name===k)?k===g&&a.push(s.numberField(`${r}.action.newObject.fields.${k}`)):a.push(s.notPropertyOf(`${r}.action.newObject.fields.${k}`,f.id)),(typeof w!="string"||!c.has(w))&&a.push(s.mustTakeOutput(`${r}.action.newObject.fields.${k}`));const y=te(m.fields)?m.fields:{},b=te(u.params)?u.params:{};for(const k of p.inputs)k.property&&k.name!==g&&!Object.hasOwn(y,k.name)&&!Object.hasOwn(b,k.name)&&a.push(s.mustGive(`${r}.action.newObject.fields.${k.name}`))}}if(u.params!==void 0){if(!te(u.params))return[...a,s.object(`${r}.action.params`)];const f=(m,g)=>te(m)?m.from==="field"?c.has(String(m.name))?[]:[s.mustBeModelOutput(`${g}.name`)]:m.from==="const"?typeof m.value=="string"||typeof m.value=="number"?[]:[s.textOrNumber(`${g}.value`)]:[s.fromFieldOrConst(`${g}.from`)]:[s.object(g)];for(const[m,g]of Object.entries(u.params)){const y=`${r}.action.params.${m}`;if(!p.inputs.some(b=>b.name===m)){a.push(s.notUserParam(y));continue}if(!(te(g)&&g.from==="ask")){if(te(g)&&g.from==="item"){if(!te(g.fields)||Object.keys(g.fields).length===0)a.push(s.fieldsAtLeastOne(`${y}.fields`));else for(const[b,k]of Object.entries(g.fields))b.trim()||a.push(s.fieldNameEmpty(`${y}.fields`)),a.push(...f(k,`${y}.fields.${b}`));continue}a.push(...f(g,y))}}}return a}const Wg={object:e=>`${e}.cypher 必须是对象`,objectType:(e,t)=>`${e}.objectType 必须是 ${t}`,queryRequired:e=>`${e}.cypher.query 必填`,readOnly:e=>`${e}.cypher.query 只能是只读查询,不能写数据`,columnsMin:e=>`${e}.cypher.columns 至少要有一列`,nameRequired:e=>`${e}.name 必填`,nameTwice:(e,t)=>`${e}.name ${t} 重复`,columnType:e=>`${e}.type 只能是 date、number、text`,unbound:(e,t)=>`${e} 查询里的 $${t} 没有绑定页面变量`,notVariable:(e,t)=>`${e}.cypher.params.${t} 不是页面变量`,badKind:(e,t,n)=>`${e}.cypher.params.${t} 不能绑定 ${n} 变量`},Kg={object:e=>`${e}.cypher must be an object`,objectType:(e,t)=>`${e}.objectType must be ${t}`,queryRequired:e=>`${e}.cypher.query is required`,readOnly:e=>`${e}.cypher.query must be a read-only query, it cannot write data`,columnsMin:e=>`${e}.cypher.columns needs at least one column`,nameRequired:e=>`${e}.name is required`,nameTwice:(e,t)=>`${e}.name ${t} is used twice`,columnType:e=>`${e}.type must be one of date, number, text`,unbound:(e,t)=>`${e}: $${t} in the query is not bound to a page variable`,notVariable:(e,t)=>`${e}.cypher.params.${t} is not a page variable`,badKind:(e,t,n)=>`${e}.cypher.params.${t} cannot be bound to a ${n} variable`},Pd=()=>fe({"zh-CN":Wg,"en-US":Kg}),Yg="cypher:";function vr(e){return`${Yg}${e}`}const Gg=["asOf","value","search","selection"];function Ld(e,t){if(!Array.isArray(t))return e;const n={};for(const o of t){if(o&&typeof o.id=="string"&&o.events&&!o.cypher){const a=Rg(o.id,typeof o.label=="string"?o.label:o.id);n[a.id]=a;continue}if(o&&typeof o.id=="string"&&o.model&&!o.cypher){const a=_d(o);n[a.id]=a;continue}if(!o||typeof o.id!="string"||!o.cypher)continue;const s=Array.isArray(o.cypher.columns)?o.cypher.columns:[],r=vr(o.id);n[r]={id:r,name:typeof o.label=="string"?o.label:o.id,primaryKeys:typeof o.key=="string"?[o.key]:[],displayKey:typeof o.key=="string"?o.key:"",properties:s.filter(a=>a&&typeof a.name=="string").map(a=>({name:a.name,label:typeof a.label=="string"&&a.label?a.label:a.name,type:["date","number","text"].includes(a.type)?a.type:"text"}))}}return Object.keys(n).length===0?e:{...e,objectTypes:{...e.objectTypes,...n}}}function Id(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`]*`/g,t=>" ".repeat(t.length))}function Hg(e){const t=[...Id(e).matchAll(/\$([A-Za-z_][A-Za-z0-9_]*)/g)].map(n=>n[1]);return[...new Set(t)]}const Vg=/\b(CREATE|MERGE|SET|DELETE|DETACH|REMOVE|DROP|CALL|LOAD|FOREACH)\b/i;function Jg(e,t){const n=Pd(),o=[],s=e.cypher;if(typeof s!="object"||s===null)return[n.object(t)];if(e.objectType!==vr(String(e.id))&&o.push(n.objectType(t,vr(String(e.id)))),typeof s.query!="string"||s.query.trim()===""?o.push(n.queryRequired(t)):Vg.test(Id(s.query))&&o.push(n.readOnly(t)),!Array.isArray(s.columns)||s.columns.length===0)o.push(n.columnsMin(t));else{const r=new Set;s.columns.forEach((a,l)=>{const c=`${t}.cypher.columns[${l}]`;if(typeof a?.name!="string"||a.name==="")return o.push(n.nameRequired(c));r.has(a.name)&&o.push(n.nameTwice(c,a.name)),r.add(a.name),["date","number","text"].includes(a.type)||o.push(n.columnType(c))})}return o}function Zg(e,t,n){if(!e.cypher)return[];const o=Pd(),s=[],r=e.cypher.params??{};for(const a of Hg(e.cypher.query))r[a]||s.push(o.unbound(n,a));for(const[a,l]of Object.entries(r)){const c=t.find(i=>i.name===l);c?Gg.includes(c.kind)||s.push(o.badKind(n,a,c.kind)):s.push(o.notVariable(n,a))}return s}new TextEncoder;const Xg=/\{([^{}]+)\}/g;function Qg(e){return[...e.matchAll(Xg)].map(t=>t[1].trim())}const ey={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,identifier:e=>`${e} 必须是字母开头的标识`,duplicate:(e,t)=>`${e} 重复:${t}`,pathCount:(e,t)=>`${e} 必须是 1 到 ${t} 个关系类 id`,notPath:(e,t)=>`${e} 不是从 ${t} 出发、沿知识网络关系的路径`,pathEnd:(e,t,n)=>`${e} 终点是 ${t},应到 ${n}`,fromSource:e=>`${e} 必须是页面中的数据源`,fromLinkable:e=>`${e} 必须是知识网络对象类的数据源,不能是子集或查询`,list:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,dateProperty:(e,t)=>`${e} 必须是 ${t} 的日期属性`,notKey:e=>`${e} 不能是对象的主键或标识`,integerRange:(e,t)=>`${e} 必须是 -${t} 到 ${t} 的整数`,sameAsField:e=>`${e} 不能与 field 相同`},ty={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,identifier:e=>`${e} must be an identifier starting with a letter`,duplicate:(e,t)=>`${e} is used twice: ${t}`,pathCount:(e,t)=>`${e} must be 1 to ${t} relation type ids`,notPath:(e,t)=>`${e} is not a path from ${t} along relations of the knowledge network`,pathEnd:(e,t,n)=>`${e} ends at ${t}, but should end at ${n}`,fromSource:e=>`${e} must be a source of the page`,fromLinkable:e=>`${e} must be a source of an object type of the knowledge network, not a subset or a query`,list:(e,t)=>`${e} must be a list of at most ${t} items`,dateProperty:(e,t)=>`${e} must be a date property of ${t}`,notKey:e=>`${e} cannot be the primary key or identifier of the object`,integerRange:(e,t)=>`${e} must be an integer from -${t} to ${t}`,sameAsField:e=>`${e} cannot be the same as field`},vo=()=>fe({"zh-CN":ey,"en-US":ty}),$r=5,Sr=3,no=3,oo=365,so=1439,Md=/^[A-Za-z][A-Za-z0-9_]*$/,qd=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ny=e=>!e.from&&!e.cypher&&!e.events;function Fd(e,t,n,o,s){if(!t)return[];const r=vo();if(!Array.isArray(e)||e.length===0||e.length>no||!e.every(c=>typeof c=="string"))return[r.pathCount(s,no)];const a=dn(o,t.objectType,e);return a?a[a.length-1].to===n.objectType?[]:[r.pathEnd(s,$h(o,t.objectType,e),n.objectType)]:[r.notPath(s,t.objectType)]}function Dd(e,t,n){const o=vo(),s=t.find(r=>r.id===e);return s?ny(s)?{source:s,errors:[]}:{errors:[o.fromLinkable(n)]}:{errors:[o.fromSource(n)]}}const Ps=(e,t,n)=>e.objectTypes[t]?.properties.find(o=>o.name===n&&o.type==="date");function oy(e,t,n,o,s){const r=vo();if(!Array.isArray(e)||e.length>$r)return[r.list(s,$r)];const a=o.objectTypes[t.objectType],l=new Set;return e.flatMap((c,i)=>{const d=`${s}[${i}]`;if(!qd(c))return[r.object(d)];const h=Object.keys(c).filter(p=>!["id","field","from","path","fromField","gapDays","gapMinutes","keepDuration"].includes(p)).map(p=>r.noOption(d,p));typeof c.id!="string"||!Md.test(c.id)?h.push(r.identifier(`${d}.id`)):l.has(c.id)?h.push(r.duplicate(`${d}.id`,c.id)):l.add(c.id),Ps(o,t.objectType,c.field)?(c.field===t.key||a?.primaryKeys.includes(String(c.field)))&&h.push(r.notKey(`${d}.field`)):h.push(r.dateProperty(`${d}.field`,t.objectType));const u=Dd(c.from,n,`${d}.from`);return h.push(...u.errors),h.push(...Fd(c.path,u.source,t,o,`${d}.path`)),u.source&&!Ps(o,u.source.objectType,c.fromField)&&h.push(r.dateProperty(`${d}.fromField`,u.source.objectType)),(typeof c.gapDays!="number"||!Number.isInteger(c.gapDays)||Math.abs(c.gapDays)>oo)&&h.push(r.integerRange(`${d}.gapDays`,oo)),c.gapMinutes!==void 0&&(typeof c.gapMinutes!="number"||!Number.isInteger(c.gapMinutes)||Math.abs(c.gapMinutes)>so)&&h.push(r.integerRange(`${d}.gapMinutes`,so)),c.keepDuration!==void 0&&(Ps(o,t.objectType,c.keepDuration)?c.keepDuration===c.field?h.push(r.sameAsField(`${d}.keepDuration`)):a?.primaryKeys.includes(c.keepDuration)&&h.push(r.notKey(`${d}.keepDuration`)):h.push(r.dateProperty(`${d}.keepDuration`,t.objectType))),h})}function sy(e,t,n,o,s){const r=vo();if(!Array.isArray(e)||e.length>Sr)return[r.list(s,Sr)];const a=new Set;return e.flatMap((l,c)=>{const i=`${s}[${c}]`;if(!qd(l))return[r.object(i)];const d=Object.keys(l).filter(u=>!["id","from","path"].includes(u)).map(u=>r.noOption(i,u));typeof l.id!="string"||!Md.test(l.id)?d.push(r.identifier(`${i}.id`)):a.has(l.id)?d.push(r.duplicate(`${i}.id`,l.id)):a.add(l.id);const h=Dd(l.from,n,`${i}.from`);return d.push(...h.errors),d.push(...Fd(l.path,h.source,t,o,`${i}.path`)),d})}const ry={notString:"default 必须是字符串",noDefault:e=>`${e} 变量不能有默认值`,asOf:"基准日期的默认值必须是 today 或 YYYY-MM-DD",dateRange:"日期区间的默认值必须是 YYYY-MM-DD..YYYY-MM-DD(可省略一端)"},ay={notString:"default must be a string",noDefault:e=>`a ${e} variable cannot have a default`,asOf:"the default of a base date must be today or YYYY-MM-DD",dateRange:"the default of a date range must be YYYY-MM-DD..YYYY-MM-DD (either end may be left out)"},iy=()=>fe({"zh-CN":ry,"en-US":ay}),ly="today",Il=/^\d{4}-\d{2}-\d{2}$/,cy=["asOf","value","dateRange","search"],dy="..";function uy(e){const t=e.default;if(t===void 0)return null;const n=iy();if(typeof t!="string")return n.notString;if(!cy.includes(e.kind))return n.noDefault(e.kind);switch(e.kind){case"asOf":return t===ly||Il.test(t)&&!Number.isNaN(Date.parse(t))?null:n.asOf;case"dateRange":{const o=t.split(dy);return o.length===2&&o.every(r=>r===""||Il.test(r))&&o.some(r=>r!=="")?null:n.dateRange}default:return null}}const ro=2e3,hy=["title","type","severity","object","occurredAt"],Ml="detail.",py=/\{([A-Za-z_][A-Za-z0-9_]*(?:\.[^{}\s]*)?)\}/g,fy=e=>hy.includes(e)||e.startsWith(Ml)&&e.length>Ml.length;function my(e){const t=[...e.matchAll(py)].map(n=>n[1]);return[...new Set(t.filter(n=>!fy(n)))]}const gy={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,required:e=>`${e} 必填`,boolean:e=>`${e} 必须是 true 或 false`,hours:(e,t)=>`${e} 必须是 1 分钟到 ${t} 小时之间的时长,以小时计,可精确到分钟(如 0.5 为 30 分钟)`,strategyActionsObject:e=>`${e} 必须是对象:处理方案 → { action, params? }`,notStrategy:e=>`${e} 不是这个事件类型的处理方案`,boundShape:e=>`${e} 必须是 { action, params? }`,noSubjectSource:(e,t)=>`${e} 要对事件的关联对象执行行动,应用里还没有「${t}」的数据源`,eventTypesList:()=>"eventTypes 必须是列表",unknownEventType:(e,t)=>`${e} 里的 ${t} 不是应用处理的事件类型`,inNetwork:e=>`${e} 在知识网络里设置:应用只配置怎样处理这类事件`,typeCode:e=>`${e} 必须是知识网络的事件类型编码:小写字母或数字开头,只含小写字母、数字、_、. 和 -,最长 64 个字符`,duplicate:e=>`事件类型 ${e} 重复`,owners:e=>`${e} 必须是最多 8 个角色名`,reportRule:e=>`${e} 只用于用户登记的事件`,strategies:e=>`${e} 必须是最多 12 个、每个不超过 40 字的处理方案名称`,groupingShape:e=>`${e} 必须是 { mode, by? }`,groupingMode:(e,t)=>`${e} 只能是 ${t.join("、")}`,groupingByOnly:e=>`${e} 只用于按属性归并`,groupingByName:e=>`${e} 必须是属性名`,groupingNoSource:(e,t)=>`${e} 按属性归并要从关联对象取值,应用里还没有「${t}」的数据源`,groupingByProperty:e=>`${e} 必须是关联对象的属性`,analysisPage:(e,t)=>`${e} 必须是应用的页面之一${t?`:${t.join("、")}`:""}`,analysisSelection:e=>`${e} 必须是选中对象筛选`,analysisSelectionOther:e=>`${e} 选中的是另一类对象,和事件关联的对象对不上`,analysisAsOfNone:e=>`${e} 页面没有基准日期`,analysisWindowShape:e=>`${e} 必须是 { variable, days }`,analysisWindowVariable:e=>`${e} 必须是日期区间筛选`,analysisWindowDays:e=>`${e} 必须是 1 到 365 的整数(天)`,mergeHours:e=>`${e} 是事件类型的合并窗口,在知识网络里设置`,fieldsList:e=>`${e} 必须是最多 12 项的列表`,fieldName:e=>`${e} 必须是小写字母开头的字段名`,fieldDuplicate:(e,t)=>`${e} ${t} 重复`,fieldType:(e,t)=>`${e} 只能是 ${t.join("、")}`,verifier:e=>`${e} 必须是角色名`,canvasText:(e,t)=>`${e} 必须是不超过 ${t} 字的文字`,canvasPlaceholder:(e,t)=>`${e} 里的 {${t}} 不是事件的值:可用 {title}、{type}、{severity}、{object}、{occurredAt} 与 {detail.<字段>}`},yy={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,required:e=>`${e} is required`,boolean:e=>`${e} must be true or false`,hours:(e,t)=>`${e} must be a length of time from 1 minute to ${t} hours, in hours, to the minute (0.5 is 30 minutes)`,strategyActionsObject:e=>`${e} must be an object: strategy -> { action, params? }`,notStrategy:e=>`${e} is not a strategy of this event type`,boundShape:e=>`${e} must be { action, params? }`,noSubjectSource:(e,t)=>`${e} runs an action on the event's object, but the app has no source for "${t}"`,eventTypesList:()=>"eventTypes must be a list",unknownEventType:(e,t)=>`${e} has ${t}, which is not an event type the app handles`,inNetwork:e=>`${e} is set in the knowledge network: the app only configures how events of this type are handled`,typeCode:e=>`${e} must be the event type code of the knowledge network: starts with a lowercase letter or digit, only lowercase letters, digits, _, . and -, at most 64 characters`,duplicate:e=>`event type ${e} is used twice`,owners:e=>`${e} must be at most 8 role names`,reportRule:e=>`${e} is only for events reported by users`,strategies:e=>`${e} must be at most 12 strategy names, each at most 40 characters`,groupingShape:e=>`${e} must be { mode, by? }`,groupingMode:(e,t)=>`${e} must be one of ${t.join(", ")}`,groupingByOnly:e=>`${e} is only for grouping by property`,groupingByName:e=>`${e} must be a property name`,groupingNoSource:(e,t)=>`${e} groups by a property of the event's object, but the app has no source for "${t}"`,groupingByProperty:e=>`${e} must be a property of the event's object`,analysisPage:(e,t)=>`${e} must be one of the app's pages${t?`: ${t.join(", ")}`:""}`,analysisSelection:e=>`${e} must be a selected-object filter`,analysisSelectionOther:e=>`${e} selects another kind of object than the one the event is about`,analysisAsOfNone:e=>`${e} the page has no as-of date`,analysisWindowShape:e=>`${e} must be { variable, days }`,analysisWindowVariable:e=>`${e} must be a date range filter`,analysisWindowDays:e=>`${e} must be an integer from 1 to 365 (days)`,mergeHours:e=>`${e} is the merge window of the event type: set it in the knowledge network`,fieldsList:e=>`${e} must be a list of at most 12 items`,fieldName:e=>`${e} must be a field name starting with a lowercase letter`,fieldDuplicate:(e,t)=>`${e} ${t} is used twice`,fieldType:(e,t)=>`${e} must be one of ${t.join(", ")}`,verifier:e=>`${e} must be a role name`,canvasText:(e,t)=>`${e} must be text of at most ${t} characters`,canvasPlaceholder:(e,t)=>`${e}: {${t}} is not a value of the event; use {title}, {type}, {severity}, {object}, {occurredAt} or {detail.<field>}`},bt=()=>fe({"zh-CN":gy,"en-US":yy}),by=/^[a-z0-9][a-z0-9_.-]{0,63}$/,wy=/^[a-z][a-z0-9_-]{0,39}$/,ql=720,ky=new Set(["id","owners","dueHours","report","analysis","grouping","strategies","strategyActions","canvas"]),vy=new Set(["label","source","subject","severity","rule"]),We=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),$y=(e,t)=>e===void 0||typeof e=="number"&&Math.abs(e*60-Math.round(e*60))<1e-6&&e*60>=1&&e<=ql?[]:[bt().hours(t,ql)],Bd=(e,t)=>e.objectType&&t.kn.objectTypes[e.objectType]?.name||e.objectType||"";function Sy(e,t,n,o){const s=bt();if(!We(e.strategyActions))return[s.strategyActionsObject(o)];const r=Array.isArray(e.strategies)?e.strategies:[];return Object.entries(e.strategyActions).flatMap(([a,l])=>{const c=`${o}.${a}`;if(!r.includes(a))return[s.notStrategy(c)];if(!We(l))return[s.boundShape(c)];const i=Object.keys(l).filter(d=>d!=="action"&&d!=="params");return i.length>0?i.map(d=>s.noOption(c,d)):t.network?t.subject?fc({on:"button",...l},{on:["button"],hit:!0},n,t.subject,c):[s.noSubjectSource(c,Bd(t,n))]:[]})}function jy(e,t,n){const o=bt();if(e!==void 0&&!Array.isArray(e))return[o.eventTypesList()];const s=Array.isArray(e)?e:[],r=en(t.kn.eventTypes),a=new Set,l=new Set(s.map(i=>We(i)?i.id:void 0));return[...t.spec.sources.flatMap((i,d)=>(i.events?.types??[]).filter(h=>!l.has(h)).map(h=>o.unknownEventType(`sources[${d}].events.types`,h))),...s.flatMap((i,d)=>{const h=`eventTypes[${d}]`;if(!We(i))return[o.object(h)];const u=[];for(const f of Object.keys(i))vy.has(f)?u.push(o.inNetwork(`${h}.${f}`)):ky.has(f)||u.push(o.noOption(h,f));if(typeof i.id!="string"||!by.test(i.id))return u.push(o.typeCode(`${h}.id`)),u;a.has(i.id)?u.push(o.duplicate(i.id)):a.add(i.id);const p=Fc(t.spec,i,r);return i.owners!==void 0&&!(Array.isArray(i.owners)&&i.owners.length<=8&&i.owners.every(f=>typeof f=="string"&&f.trim()!==""))&&u.push(o.owners(`${h}.owners`)),u.push(...$y(i.dueHours,`${h}.dueHours`)),i.report!==void 0&&(p.source==="rule"?u.push(o.reportRule(`${h}.report`)):u.push(...Ey(i.report,`${h}.report`))),i.analysis!==void 0&&u.push(...Ty(i.analysis,p,t,n,`${h}.analysis`)),i.grouping!==void 0&&u.push(...Ay(i.grouping,p,t,`${h}.grouping`)),i.strategies!==void 0&&!(Array.isArray(i.strategies)&&i.strategies.length<=12&&i.strategies.every(f=>typeof f=="string"&&f.trim()!==""&&f.length<=40))&&u.push(o.strategies(`${h}.strategies`)),i.strategyActions!==void 0&&u.push(...Sy(i,p,t,`${h}.strategyActions`)),i.canvas!==void 0&&u.push(...Oy(i.canvas,`${h}.canvas`)),u})]}function Ay(e,t,n,o){const s=bt();if(!We(e))return[s.groupingShape(o)];const r=[];for(const l of Object.keys(e))l!=="mode"&&l!=="by"&&r.push(s.noOption(o,l));if(!Hs.includes(e.mode))return[...r,s.groupingMode(`${o}.mode`,Hs)];if(e.mode!=="property")return e.by!==void 0&&r.push(s.groupingByOnly(`${o}.by`)),r;if(typeof e.by!="string"||e.by.trim()==="")return[...r,s.groupingByName(`${o}.by`)];if(t.source!=="report")return r;const a=ue(n.spec,t.subject);return a?pe(a,n.kn).some(l=>l.name===e.by)||r.push(s.groupingByProperty(`${o}.by`)):r.push(s.groupingNoSource(o,Bd(t,n))),r}function Ty(e,t,n,o,s){const r=bt();if(!We(e))return[r.object(s)];const a=[];for(const c of Object.keys(e))["page","selection","asOf","window"].includes(c)||a.push(r.noOption(s,c));(typeof e.page!="string"||o&&!o.includes(e.page))&&a.push(r.analysisPage(`${s}.page`,o));const l=c=>n.spec.variables.find(i=>i.name===c);if(e.selection!==void 0){const c=l(e.selection);!c||c.kind!=="selection"?a.push(r.analysisSelection(`${s}.selection`)):t.network&&ue(n.spec,c.source)?.objectType!==t.objectType&&a.push(r.analysisSelectionOther(`${s}.selection`))}if(e.asOf!==void 0&&(typeof e.asOf!="boolean"?a.push(r.boolean(`${s}.asOf`)):e.asOf&&!n.spec.variables.some(c=>c.kind==="asOf")&&a.push(r.analysisAsOfNone(`${s}.asOf`))),e.window!==void 0){const c=e.window;if(!We(c))a.push(r.analysisWindowShape(`${s}.window`));else{l(c.variable)?.kind!=="dateRange"&&a.push(r.analysisWindowVariable(`${s}.window.variable`));const i=c.days;(typeof i!="number"||!Number.isInteger(i)||i<1||i>365)&&a.push(r.analysisWindowDays(`${s}.window.days`))}}return a}function Oy(e,t){const n=bt();if(!We(e))return[n.object(t)];const o=[];for(const[s,r]of Object.entries(e)){const a=`${t}.${s}`;if(s!=="prompt"&&s!=="question")o.push(n.noOption(t,s));else if(typeof r!="string"||r.length>ro)o.push(n.canvasText(a,ro));else for(const l of my(r))o.push(n.canvasPlaceholder(a,l))}return o}function Ey(e,t){const n=bt();if(!We(e))return[n.object(t)];const o=[];for(const r of Object.keys(e))r==="mergeHours"?o.push(n.mergeHours(`${t}.mergeHours`)):r!=="fields"&&r!=="verifier"&&o.push(n.noOption(t,r));const s=e.fields;if(!Array.isArray(s)||s.length>12)o.push(n.fieldsList(`${t}.fields`));else{const r=new Set;s.forEach((a,l)=>{const c=`${t}.fields[${l}]`;if(!We(a))return o.push(n.object(c));typeof a.name!="string"||!wy.test(a.name)?o.push(n.fieldName(`${c}.name`)):r.has(a.name)?o.push(n.fieldDuplicate(`${c}.name`,a.name)):r.add(a.name),(typeof a.label!="string"||a.label.trim()==="")&&o.push(n.required(`${c}.label`)),Gs.includes(a.type)||o.push(n.fieldType(`${c}.type`,Gs)),a.required!==void 0&&typeof a.required!="boolean"&&o.push(n.boolean(`${c}.required`))})}return e.verifier!==void 0&&(typeof e.verifier!="string"||e.verifier.trim()==="")&&o.push(n.verifier(`${t}.verifier`)),o}const Cy={join:e=>e.join("、"),pageNotObject:"页面定义必须是对象",appNotObject:"App Spec 必须是对象",emptyApp:"应用至少要放一个组件",pagePrefix:(e,t)=>`页面 ${e}:${t}`,component:e=>`组件 ${e}`,object:e=>`${e} 必须是对象`,array:e=>`${e} 必须是数组`,required:e=>`${e} 必填`,identifier:e=>`${e} 必须是字母开头的标识`,nonEmptyString:e=>`${e} 必须是非空字符串`,oneOf:(e,t)=>`${e} 只能是 ${t}`,either:(e,t,n)=>`${e} 只能是 ${t} 或 ${n}`,integer:(e,t,n)=>`${e} 必须是 ${t} 到 ${n} 的整数`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,notField:e=>`${e} 不是数据源的字段`,version:"version 必须为 2",apiVersion:e=>`apiVersion 必须为 ${e}`,appId:"app.id 必须是字母或数字开头的标识",knDependency:(e,t)=>`dependencies.knowledgeNetwork 必须引用知识网络 ${e}(${t})`,pagesMin:"pages 至少要有一个页面",pageTwice:e=>`页面 id ${e} 重复`,navShown:"至少要有一个页面在导航中显示",variableReserved:(e,t)=>`${e} 不能以 ${t} 开头,这是自动联动保留的名称`,linkPathShape:e=>`${e} 必须是 { between: [对象类, 对象类], path: [关系…] }`,linkPathType:(e,t)=>`${e} 中的对象类 ${t} 不在知识网络中`,linkPathBroken:e=>`${e}.path 不是从 between[0] 到 between[1] 的关系路径`,linkPathLong:(e,t)=>`${e}.path 最多 ${t} 个关系`,customType:e=>`${e}.type 必须是 x-<发布者>.<名称> 形式的自定义组件类型`,customTwice:e=>`自定义组件 ${e} 登记了两次`,packageId:e=>`${e}.package 必须是上传后得到的组件包 id`,asideWidth:"layout.asideWidth(或 0)",chartPaletteSize:"theme.chartPalette 必须有 6 到 8 个颜色",chartPaletteHex:"theme.chartPalette 中的颜色必须是 #rrggbb",fontFamily:"theme.fontFamily 必须是字体名称列表",hexColor:e=>`${e} 必须是 #rrggbb 颜色`,contrast:(e,t,n,o)=>`${e} 与 ${t} 对比度 ${n},需不低于 ${o}`,sourcesMin:"sources 至少要有一个数据源",sourceTwice:e=>`数据源 ${e} 重复`,notObjectType:e=>`${e}.objectType 不是知识网络中的对象类`,notProperty:(e,t)=>`${e}.key 不是 ${t} 的属性`,onlyObjectSources:e=>`${e} 只能用于知识网络对象类的数据源`,modelOperationAction:e=>`${e}.action 模型结果数据源上的推演操作不能关联行动,请用落地`,notScenarioParam:e=>`${e} 不是方案参数`,scenarioParamType:e=>`${e} 的类型与方案参数不同`,displayShape:e=>`${e} 必须是 { template, facts? }`,templateNeedsField:e=>`${e}.template 至少要用 {字段名} 引用一个字段`,templateNotField:(e,t)=>`${e}.template 中的 {${t}} 不是数据源的字段`,factsList:(e,t)=>`${e}.facts 必须是不超过 ${t} 个字段名的列表`,factsNotField:(e,t)=>`${e}.facts 中的 ${t} 不是数据源的字段`,formatsShape:e=>`${e} 必须是 { 字段名: 格式 } 的对象`,formatShape:e=>`${e} 必须是 { unit?, decimals?, colors? }`,unitText:e=>`${e}.unit 必须是不超过 8 字的文本`,unitNumber:e=>`${e}.unit 只有数字字段有单位`,decimalsInt:(e,t)=>`${e}.decimals 必须是 0 到 ${t} 的整数`,decimalsNumber:e=>`${e}.decimals 只有数字字段有小数位`,colorsList:e=>`${e}.colors 必须是 [{ when, tone }] 的列表`,ruleShape:e=>`${e} 必须是 { when, tone }`,fromShape:e=>`${e}.from 必须是 { source, where?, filters? }`,fromNotSource:(e,t)=>`${e}.from.source 不是页面数据源:${t}`,fromSubset:e=>`${e}.from.source 不能是另一个子集`,fromCypherParams:e=>`${e}.from.source 不能是带参数的 Cypher 数据源`,sameAsBase:(e,t,n)=>`${e}.${t} 必须与来源数据源一致:${n}`,derivedOwn:(e,t)=>`${e}.${t} 子集沿用来源数据源的,不能自己定义`,variableTwice:e=>`变量 ${e} 重复`,variableDefault:(e,t)=>`${e}.default:${t}`,variableSource:e=>`${e}.source 不是页面数据源`,variableNoLonger:e=>`${e} 不再需要:筛选不绑数据源,由跟随它的组件各自指定字段`,componentTwice:e=>`组件 id ${e} 重复`,noRegion:(e,t,n)=>`${e} 布局没有区域 ${t},可用区域:${n}`,customNoPackage:(e,t)=>`${e}.type ${t} 是自定义组件,但应用的 components 里没有它的组件包:先上传组件包`,typeOneOf:(e,t)=>`${e}.type 只能是 ${t},或 components 里登记的自定义组件`,pageEmpty:"页面至少要放一个组件",detailType:e=>`detail 必须是 type 为 ${e} 的组件`,frameShape:e=>`${e} 必须给出 x、y、w、h`,frameRight:(e,t)=>`${e} 超出右边界:x + w 不能大于 ${t}`,frameSmall:(e,t,n,o)=>`${e} 太小:${t} 至少 ${n} 列宽、${o} 行高`},Ny={join:e=>e.join(", "),pageNotObject:"page definition must be an object",appNotObject:"App Spec must be an object",emptyApp:"the app needs at least one component",pagePrefix:(e,t)=>`page ${e}: ${t}`,component:e=>`component ${e}`,object:e=>`${e} must be an object`,array:e=>`${e} must be an array`,required:e=>`${e} is required`,identifier:e=>`${e} must be an identifier starting with a letter`,nonEmptyString:e=>`${e} must be a non-empty string`,oneOf:(e,t)=>`${e} must be one of ${t}`,either:(e,t,n)=>`${e} must be ${t} or ${n}`,integer:(e,t,n)=>`${e} must be an integer from ${t} to ${n}`,noOption:(e,t)=>`${e} has no option ${t}`,notField:e=>`${e} is not a field of the source`,version:"version must be 2",apiVersion:e=>`apiVersion must be ${e}`,appId:"app.id must be an identifier starting with a letter or digit",knDependency:(e,t)=>`dependencies.knowledgeNetwork must refer to knowledge network ${e} (${t})`,pagesMin:"pages needs at least one page",pageTwice:e=>`page id ${e} is used twice`,navShown:"at least one page must be shown in the navigation",variableReserved:(e,t)=>`${e} cannot start with ${t}, which default linkage uses`,linkPathShape:e=>`${e} must be { between: [object type, object type], path: [relations…] }`,linkPathType:(e,t)=>`${e} names object type ${t}, which is not in the network`,linkPathBroken:e=>`${e}.path is not a relation path from between[0] to between[1]`,linkPathLong:(e,t)=>`${e}.path may have at most ${t} relations`,customType:e=>`${e}.type must be a custom component type of the form x-<publisher>.<name>`,customTwice:e=>`custom component ${e} is registered twice`,packageId:e=>`${e}.package must be the id of an uploaded component package`,asideWidth:"layout.asideWidth (or 0)",chartPaletteSize:"theme.chartPalette must have 6 to 8 colors",chartPaletteHex:"theme.chartPalette colors must be #rrggbb",fontFamily:"theme.fontFamily must be a list of font names",hexColor:e=>`${e} must be a #rrggbb color`,contrast:(e,t,n,o)=>`${e} and ${t} have a contrast of ${n}, at least ${o} is needed`,sourcesMin:"sources needs at least one source",sourceTwice:e=>`source ${e} is used twice`,notObjectType:e=>`${e}.objectType is not an object type of the knowledge network`,notProperty:(e,t)=>`${e}.key is not a property of ${t}`,onlyObjectSources:e=>`${e} only applies to sources of knowledge network object types`,modelOperationAction:e=>`${e}.action: a scenario operation on a model result source cannot link an action, use landing`,notScenarioParam:e=>`${e} is not a scenario parameter`,scenarioParamType:e=>`${e} has a different type than the scenario parameter`,displayShape:e=>`${e} must be { template, facts? }`,templateNeedsField:e=>`${e}.template must refer to at least one field as {field name}`,templateNotField:(e,t)=>`{${t}} in ${e}.template is not a field of the source`,factsList:(e,t)=>`${e}.facts must be a list of at most ${t} field names`,factsNotField:(e,t)=>`${t} in ${e}.facts is not a field of the source`,formatsShape:e=>`${e} must be an object of { field name: format }`,formatShape:e=>`${e} must be { unit?, decimals?, colors? }`,unitText:e=>`${e}.unit must be text of at most 8 characters`,unitNumber:e=>`${e}.unit applies to number fields only`,decimalsInt:(e,t)=>`${e}.decimals must be an integer from 0 to ${t}`,decimalsNumber:e=>`${e}.decimals applies to number fields only`,colorsList:e=>`${e}.colors must be a list of [{ when, tone }]`,ruleShape:e=>`${e} must be { when, tone }`,fromShape:e=>`${e}.from must be { source, where?, filters? }`,fromNotSource:(e,t)=>`${e}.from.source is not a source of the page: ${t}`,fromSubset:e=>`${e}.from.source cannot be another subset`,fromCypherParams:e=>`${e}.from.source cannot be a Cypher source with parameters`,sameAsBase:(e,t,n)=>`${e}.${t} must match the source it comes from: ${n}`,derivedOwn:(e,t)=>`${e}.${t} is taken from the source the subset comes from and cannot be set here`,variableTwice:e=>`variable ${e} is used twice`,variableDefault:(e,t)=>`${e}.default: ${t}`,variableSource:e=>`${e}.source is not a source of the page`,variableNoLonger:e=>`${e} is no longer needed: a filter is not bound to a source, each component that follows it names its own field`,componentTwice:e=>`component id ${e} is used twice`,noRegion:(e,t,n)=>`${e} layout has no region ${t}, available regions: ${n}`,customNoPackage:(e,t)=>`${e}.type ${t} is a custom component, but components of the app has no component package for it: upload the component package first`,typeOneOf:(e,t)=>`${e}.type must be one of ${t}, or a custom component registered in components`,pageEmpty:"a page needs at least one component",detailType:e=>`detail must be a component of type ${e}`,frameShape:e=>`${e} must give x, y, w, h`,frameRight:(e,t)=>`${e} goes past the right edge: x + w must not exceed ${t}`,frameSmall:(e,t,n,o)=>`${e} is too small: ${t} needs at least ${n} columns wide and ${o} rows high`},ye=()=>fe({"zh-CN":Cy,"en-US":Ny}),Fl="lk_",Dl=4,Bl=/^#[0-9a-fA-F]{6}$/,$o=/^[A-Za-z][A-Za-z0-9_-]{0,39}$/,xy=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/,Ry=["colorPrimary","colorAccent","colorBg","colorSurface","colorSurfaceAlt","colorBorder","colorText","colorTextMuted","colorSuccess","colorWarning","colorDanger","colorInfo"],jr=4.5,Ar=3;function _y(e,t,n={}){const o=ye(),s=[],r=c=>s.push(c);if(!K(e))return{ok:!1,errors:[o.pageNotObject]};const a=Ld(t,e.sources);if(e.version!==2&&r(o.version),(typeof e.title!="string"||e.title.trim()==="")&&r(o.nonEmptyString("title")),My(e.layout,r),qy(e.theme,r),e.linking!==void 0&&!Te(e.linking,ka)&&r(o.oneOf("linking",o.join(ka))),Hy(e.linkPaths,a,r),s.length>0)return{ok:!1,errors:s};if(Fy(e.sources,a,r,n.allowEmpty??!1),s.length>0)return{ok:!1,errors:s};if(Yy(e.variables,e,r),s.length>0)return{ok:!1,errors:s};if(e.sources.forEach((c,i)=>Zg(c,e.variables,`sources[${i}]`).forEach(r)),s.length>0)return{ok:!1,errors:s};if(qg(e.scenarioParams).forEach(r),s.length>0)return{ok:!1,errors:s};if(Wy(e,a,r),s.length>0)return{ok:!1,errors:s};if(Ky(e,a,r),s.length>0)return{ok:!1,errors:s};const l=e;return Gy(e,{kn:a,spec:l},r,n.allowEmpty??!1),s.length>0?{ok:!1,errors:s}:{ok:!0,spec:l}}const Py=()=>ye().emptyApp;function Ud(e,t,n={}){const o=ye();if(!K(e))return{ok:!1,errors:[o.appNotObject]};const s=[],r=u=>s.push(u);e.apiVersion!==pt&&r(o.apiVersion(String(pt)));const a=e.app;K(a)?((typeof a.id!="string"||!xy.test(a.id))&&r(o.appId),(typeof a.name!="string"||a.name.trim()==="")&&r(o.nonEmptyString("app.name"))):r(o.object("app"));const l=K(e.dependencies)?e.dependencies.knowledgeNetwork:void 0;(!K(l)||l.id!==t.id)&&r(o.knDependency(t.id,t.name));const c=e.pages;if(!Array.isArray(c)||c.length===0)r(o.pagesMin);else{const u=new Set;c.forEach((p,f)=>{if(!K(p))return r(o.object(`pages[${f}]`));if(typeof p.id!="string"||!$o.test(p.id))return r(o.identifier(`pages[${f}].id`));u.has(p.id)&&r(o.pageTwice(p.id)),u.add(p.id)}),c.every(p=>K(p)&&p.hidden===!0)&&r(o.navShown)}if(Ly(e.components,r),s.length>0)return{ok:!1,errors:s};const i=e,d=new Set;if(i.pages.reduce((u,p)=>u+Object.values(p.regions??{}).reduce((f,m)=>f+(m?.length??0),0),0)===0&&!n.allowEmpty)return{ok:!1,errors:[Py()]};if(!n.allowEmpty&&Array.isArray(i.sources)&&i.sources.length===0)return{ok:!1,errors:[o.sourcesMin]};for(const u of i.pages){const p=_y(tn(i,u.id),t,{allowEmpty:!0});if(!p.ok)for(const f of p.errors)d.has(f)||(d.add(f),s.push(i.pages.length>1?o.pagePrefix(u.id,f):f))}return s.length>0?{ok:!1,errors:s}:(s.push(...jy(e.eventTypes,{kn:Ld(t,i.sources),spec:tn(i,i.pages[0].id)},i.pages.map(u=>u.id))),e.scheduleModel!==void 0&&s.push(...Ag(e.scheduleModel)),s.length>0?{ok:!1,errors:s}:{ok:!0,app:i})}function Ly(e,t){if(e===void 0)return;const n=ye();if(!Array.isArray(e))return t(n.array("components"));const o=new Set;e.forEach((s,r)=>{const a=`components[${r}]`;if(!K(s))return t(n.object(a));if(!Rt(s.type))return t(n.customType(a));o.has(s.type)&&t(n.customTwice(s.type)),o.add(s.type),(typeof s.package!="string"||!Iy.test(s.package))&&t(n.packageId(a)),s.source!==void 0&&!Te(s.source,["upload","ai"])&&t(n.either(`${a}.source`,"upload","ai"))})}const Iy=/^[0-9a-f]{64}$/;function My(e,t){const n=ye();if(!K(e))return t(n.object("layout"));Te(e.type,Ds)||t(n.oneOf("layout.type",n.join(Ds))),Ie(e.columns,2,4,"layout.columns",t),Te(e.sidePosition,["left","right"])||t(n.either("layout.sidePosition","left","right")),Ie(e.sideWidth,220,420,"layout.sideWidth",t),e.asideWidth!==0&&Ie(e.asideWidth,240,420,n.asideWidth,t),Te(e.gap,["compact","normal","relaxed"])||t(n.oneOf("layout.gap",n.join(["compact","normal","relaxed"]))),e.pinRows!==void 0&&Ie(e.pinRows,0,xr,"layout.pinRows",t)}function qy(e,t){const n=ye();if(!K(e))return t(n.object("theme"));const o=[],s=c=>o.push(c);(typeof e.name!="string"||e.name.trim()==="")&&s(n.nonEmptyString("theme.name")),Te(e.mode,["light","dark"])||s(n.either("theme.mode","light","dark"));for(const c of Ry)(typeof e[c]!="string"||!Bl.test(e[c]))&&s(n.hexColor(`theme.${c}`));const r=e.chartPalette;if(!Array.isArray(r)||r.length<6||r.length>8?s(n.chartPaletteSize):r.every(c=>typeof c=="string"&&Bl.test(c))||s(n.chartPaletteHex),(typeof e.fontFamily!="string"||e.fontFamily.trim()===""||/[;{}<>]/.test(e.fontFamily))&&s(n.fontFamily),Ie(e.fontSize,12,16,"theme.fontSize",s),Ie(e.radius,0,16,"theme.radius",s),Te(e.shadow,Bs)||s(n.oneOf("theme.shadow",n.join(Bs))),Te(e.density,Us)||s(n.oneOf("theme.density",n.join(Us))),e.surface!==void 0&&!Te(e.surface,_t)&&s(n.oneOf("theme.surface",n.join(_t))),o.forEach(t),o.length>0)return;const a=e.colorText;for(const c of["colorBg","colorSurface"]){const i=zl(a,e[c]);i<jr&&t(n.contrast("colorText",c,i.toFixed(2),jr))}const l=zl(e.colorTextMuted,e.colorSurface);l<Ar&&t(n.contrast("colorTextMuted","colorSurface",l.toFixed(2),Ar))}function Fy(e,t,n,o){const s=ye();if(!Array.isArray(e))return n(s.sourcesMin);if(e.length===0)return o?void 0:n(s.sourcesMin);const r=new Set;e.forEach((a,l)=>{const c=`sources[${l}]`;if(!K(a))return n(s.object(c));if(typeof a.id!="string"||!$o.test(a.id)?n(s.identifier(`${c}.id`)):r.has(a.id)?n(s.sourceTwice(a.id)):r.add(a.id),(typeof a.label!="string"||a.label.trim()==="")&&n(s.required(`${c}.label`)),a.from!==void 0)return Uy(a,e,t,c).forEach(n);if(a.model!==void 0){if(!K(a.model))return n(s.object(`${c}.model`))}else if(a.events!==void 0){const u=_g(a,c);if(u.forEach(n),u.length>0)return}else if(a.cypher!==void 0){const u=Jg(a,c);if(u.forEach(n),u.length>0)return}const i=typeof a.objectType=="string"&&Object.hasOwn(t.objectTypes,a.objectType)?t.objectTypes[a.objectType]:void 0;if(!i)return n(s.notObjectType(c));((u,p)=>i.properties.find(m=>m.name===u)&&!0)(a.key)||n(s.notProperty(c,i.id)),nf(a.progress,i.properties,`${c}.progress`).forEach(n);const h=K(a.progress)&&Array.isArray(a.progress.steps);Fh(a.computed,[...i.properties,...h?yc(a.progress):[]],`${c}.computed`,{kn:t,objectType:i.id,cypher:a.cypher!==void 0,progress:h,sources:e.filter(K),...typeof a.id=="string"?{source:a.id}:{}}).forEach(n),a.display!==void 0&&Dy(a.display,a,t,`${c}.display`).forEach(n),a.formats!==void 0&&By(a.formats,a,t,`${c}.formats`).forEach(n),a.operations!==void 0&&(a.cypher!==void 0||a.events!==void 0?n(s.onlyObjectSources(`${c}.operations`)):Xh(a.operations,a,t,`${c}.operations`).forEach(n)),a.models!==void 0&&(a.cypher!==void 0||a.events!==void 0||a.model!==void 0?n(s.onlyObjectSources(`${c}.models`)):sp(a.models,a,t,`${c}.models`).forEach(n));for(const u of["follows","relatedTo"]){if(a[u]===void 0)continue;if(a.cypher!==void 0||a.events!==void 0||a.model!==void 0){n(s.onlyObjectSources(`${c}.${u}`));continue}(u==="follows"?oy:sy)(a[u],a,e.filter(K),t,`${c}.${u}`).forEach(n)}})}function Dy(e,t,n,o){const s=ye();if(!K(e)||typeof e.template!="string")return[s.displayShape(o)];const r=[...t.cypher?.columns??[],...pe(t,n)],a=i=>r.some(d=>d.name===i),l=Object.keys(e).filter(i=>!["template","facts"].includes(i)).map(i=>s.noOption(o,i)),c=Qg(e.template);c.length===0&&l.push(s.templateNeedsField(o));for(const i of c)a(i)||l.push(s.templateNotField(o,i));if(e.facts!==void 0)if(!Array.isArray(e.facts)||e.facts.length>ba||!e.facts.every(i=>typeof i=="string"))l.push(s.factsList(o,ba));else for(const i of e.facts)a(i)||l.push(s.factsNotField(o,i));return l}function By(e,t,n,o){const s=ye();if(!K(e))return[s.formatsShape(o)];const r=pe(t,n),a=un(t),l=[];for(const[c,i]of Object.entries(e)){const d=`${o}.${c}`,h=r.find(u=>u.name===c);if(!h){l.push(s.notField(d));continue}if(!K(i)){l.push(s.formatShape(d));continue}for(const u of Object.keys(i))["unit","decimals","colors"].includes(u)||l.push(s.noOption(d,u));if(i.unit!==void 0&&(typeof i.unit!="string"||i.unit.length>8?l.push(s.unitText(d)):h.type!=="number"&&l.push(s.unitNumber(d))),i.decimals!==void 0){const u=i.decimals;typeof u!="number"||!Number.isInteger(u)||u<0||u>Ws?l.push(s.decimalsInt(d,Ws)):h.type!=="number"&&l.push(s.decimalsNumber(d))}if(i.colors!==void 0){if(!Array.isArray(i.colors)){l.push(s.colorsList(d));continue}i.colors.forEach((u,p)=>{const f=`${d}.colors[${p}]`;if(!K(u))return l.push(s.ruleShape(f));Te(u.tone,Pt)||l.push(s.oneOf(`${f}.tone`,s.join(Pt))),l.push(...xe(u.when,r,`${f}.when`,a))})}}return l}function Uy(e,t,n,o){const s=ye(),r=e.from;if(!K(r)||typeof r.source!="string")return[s.fromShape(o)];const a=t.find(c=>K(c)&&c.id===r.source);if(!K(a))return[s.fromNotSource(o,r.source)];if(a.from!==void 0)return[s.fromSubset(o)];const l=[];K(a.cypher)&&K(a.cypher.params)&&Object.keys(a.cypher.params).length&&l.push(s.fromCypherParams(o)),e.objectType!==a.objectType&&l.push(s.sameAsBase(o,"objectType",String(a.objectType))),e.key!==a.key&&l.push(s.sameAsBase(o,"key",String(a.key)));for(const c of["progress","computed","cypher","formats","display","operations","follows","relatedTo","models"])c in e&&l.push(s.derivedOwn(o,c));for(const c of Object.keys(r))["source","where","filters"].includes(c)||l.push(s.noOption(`${o}.from`,c));if(r.where!==void 0){const c=ue({sources:t},e.id),i=c?pe(c,n):[];l.push(...xe(r.where,i,`${o}.from.where`,un(c)))}return l}const zy=[{key:"source",label:"来源数据源",kind:"source"},{key:"filters",label:"跟随的筛选",kind:"bindings",optional:!0}];function Wy(e,t,n){const o=ye(),s=e.scenarioParams??[];e.sources.forEach((r,a)=>{const l=`sources[${a}]`;r.model&&(Ug(r,{sources:e.sources,kn:t,variables:e.variables,scenarioParams:s},l).forEach(n),(r.operations??[]).forEach((c,i)=>{c?.action!==void 0&&n(o.modelOperationAction(`${l}.operations[${i}]`))})),(r.models??[]).forEach((c,i)=>(Array.isArray(c?.params)?c.params:[]).forEach((d,h)=>{if(d?.scenarioParam===void 0)return;const u=s.find(f=>f.name===d.scenarioParam),p=`${l}.models[${i}].params[${h}].scenarioParam`;u?u.type!==d.type&&n(o.scenarioParamType(p)):n(o.notScenarioParam(p))}))})}function Ky(e,t,n){e.sources.forEach((o,s)=>{if(!o.from?.filters)return;const r={source:o.from.source,filters:o.from.filters};Ad(zy,r,{kn:t,spec:e},`sources[${s}].from`).forEach(n)})}function Yy(e,t,n){const o=ye();if(!Array.isArray(e))return n(o.array("variables"));const s=new Set;e.forEach((r,a)=>{const l=`variables[${a}]`;if(!K(r))return n(o.object(l));if(typeof r.name!="string"||!$o.test(r.name))return n(o.identifier(`${l}.name`));if(s.has(r.name)&&n(o.variableTwice(r.name)),s.add(r.name),t.linking==="auto"&&r.name.startsWith(Fl)&&n(o.variableReserved(`${l}.name`,Fl)),(typeof r.label!="string"||r.label.trim()==="")&&n(o.required(`${l}.label`)),!Te(r.kind,Hn))return n(o.oneOf(`${l}.kind`,o.join(Hn)));const c=uy(r);if(c&&n(o.variableDefault(l,c)),r.kind==="selection"||r.kind==="set")t.sources.some(i=>i.id===r.source)||n(o.variableSource(l));else for(const i of["source","field","fields"])i in r&&n(o.variableNoLonger(`${l}.${i}`))})}function Gy(e,t,n,o){const s=ye(),{layout:r,regions:a}=t.spec;if(!K(a))return n(s.object("regions"));const l=mc[r.type],c=new Set,i=new Set((t.spec.components??[]).map(p=>p.type));let d=0;const h=(p,f)=>{if(typeof p!="string"||!$o.test(p))return n(s.identifier(`${f}.id`));c.has(p)&&n(s.componentTwice(p)),c.add(p)};for(const[p,f]of Object.entries(a)){if(!l.includes(p)){n(s.noRegion(r.type,p,s.join(l)));continue}if(!Array.isArray(f)){n(s.array(`regions.${p}`));continue}f.forEach((m,g)=>{const y=`regions.${p}[${g}]`;if(!K(m))return n(s.object(y));h(m.id,y);const b=Rt(m.type);if(b&&!i.has(m.type))return n(s.customNoPackage(y,String(m.type)));if(!b&&!Te(m.type,Ve))return n(s.typeOneOf(y,s.join(Ve)));const k=m.type;d++,m.span!==void 0&&Ie(m.span,1,4,`${y}.span`,n),m.surface!==void 0&&!Te(m.surface,_t)&&n(s.oneOf(`${y}.surface`,s.join(_t))),m.follow!==void 0&&typeof m.follow!="boolean"&&n(s.oneOf(`${y}.follow`,"true、false")),m.click!==void 0&&!Te(m.click,va)&&n(s.oneOf(`${y}.click`,s.join(va))),r.type==="free"&&Vy(m.frame,k,`${s.component(String(m.id))}.frame`,n),Ul(k,Rt(k)&&K(m.config)?yf(k,m.config):m.config,t,s.component(String(m.id)),n)})}d===0&&!o&&n(s.pageEmpty);const u=e.detail;if(u!==void 0){if(!K(u)||u.type!==me)return n(s.detailType(me));h(u.id,"detail"),Ul(me,u.config,t,s.component(String(u.id)),n)}}function Ul(e,t,n,o,s){const r=ht(e),a=Ad(r.descriptors,t,n,o,r.free);a.forEach(s),a.length===0&&r.check&&r.check(t,n,o).forEach(s)}function Hy(e,t,n){if(e===void 0)return;const o=ye();if(!Array.isArray(e))return n(o.array("linkPaths"));e.forEach((s,r)=>{const a=`linkPaths[${r}]`;if(!K(s)||!Array.isArray(s.between)||s.between.length!==2||!s.between.every(u=>typeof u=="string")||!Array.isArray(s.path)||!s.path.every(u=>typeof u=="string"))return n(o.linkPathShape(a));const[l,c]=s.between,i=[l,c].find(u=>!t.objectTypes[u]);if(i)return n(o.linkPathType(a,i));const d=s.path;if(d.length===0)return;if(d.length>Dl)return n(o.linkPathLong(a,Dl));const h=dn(t,l,d);(!h||h[h.length-1].to!==c)&&n(o.linkPathBroken(a))})}function Vy(e,t,n,o){const s=ye();if(!K(e))return o(s.frameShape(n));Ie(e.x,0,At-1,`${n}.x`,o),Ie(e.w,1,At,`${n}.w`,o),Ie(e.y,0,400,`${n}.y`,o),Ie(e.h,2,40,`${n}.h`,o),typeof e.x=="number"&&typeof e.w=="number"&&e.x+e.w>At&&o(s.frameRight(n,At));const[r,a]=uf(t);(typeof e.w=="number"&&e.w<r||typeof e.h=="number"&&e.h<a)&&o(s.frameSmall(n,t,r,a))}function zl(e,t){const[n,o]=[Wl(e),Wl(t)].sort((s,r)=>r-s);return(n+.05)/(o+.05)}function Wl(e){const t=n=>{const o=parseInt(e.slice(n,n+2),16)/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4};return .2126*t(1)+.7152*t(3)+.0722*t(5)}function K(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Te(e,t){return typeof e=="string"&&t.includes(e)}function Ie(e,t,n,o,s){(typeof e!="number"||!Number.isInteger(e)||e<t||e>n)&&s(ye().integer(o,t,n))}const Jy="scheduleWorkbench",Zy=[{id:"topBottom",name:"上下布局 · 总览",description:"顶部是基准日期和关键指标,中间是趋势与地区分布,底部是整宽的明细表。",theme:"default",pages:[{title:"总览",cells:[["asOfSlider",0,0,12,3],["metricCards",0,3,12,4],["trendChart",0,7,8,8],["regionMap",8,7,4,8],["objectTable",0,15,12,11]]}]},{id:"leftRight",name:"左右布局 · 列表 + 详情",description:"左侧是待处理对象的长列表,右侧是指标、明细表和选中对象的关系子图。",theme:"default",pages:[{title:"列表与详情",cells:[["objectList",0,0,4,26],["metricCards",4,0,8,4],["objectTable",4,4,8,12],["subgraph",4,16,8,10]]}]},{id:"workbench",name:"三栏工作台",description:"左边收件箱、中间指标与明细、右边 Agent 对话,适合每天处理事务的岗位。",theme:"default",pages:[{title:"工作台",cells:[["objectList",0,0,3,24],["asOfSlider",3,0,6,3],["metricCards",3,3,6,4],["objectTable",3,7,6,17],["agentChat",9,0,3,24]]}]},{id:"cockpit",name:"驾驶舱",description:"深色大屏:大地图居中,配趋势、告警、关系链路与甘特图。",theme:"tech",pages:[{title:"驾驶舱",cells:[["metricCards",0,0,12,4],["regionMap",0,4,6,12],["trendChart",6,4,6,6],["alertList",6,10,6,6],["stageChain",0,16,12,4],["ganttChart",0,20,12,8]]}]},{id:"alertDesk",name:"告警处置台",description:"按规则列出告警,点一条只看它命中的对象,旁边看明细、关系子图并问 Agent。",theme:"default",pages:[{title:"告警处置",cells:[["alertList",0,0,4,12],["objectTable",4,0,8,12],["subgraph",0,12,6,10],["agentChat",6,12,6,10]]}]},{id:"analysis",name:"分析看板",description:"分组汇总、月度趋势、关系链路与地区分布并排,适合周会和复盘。",theme:"dark",pages:[{title:"分析",cells:[["asOfSlider",0,0,12,3],["pivotTable",0,3,6,8],["trendChart",6,3,6,8],["stageChain",0,11,12,4],["regionMap",0,15,5,9],["objectTable",5,15,7,9]]}]},{id:"production",name:"排程台",description:"按基准日期看甘特图,下方是明细与告警,盯住临近和超期的对象。",theme:"default",pages:[{title:"排程",cells:[["asOfSlider",0,0,5,4],["metricCards",5,0,7,4],["ganttChart",0,4,12,9],["objectTable",0,13,8,11],["alertList",8,13,4,11]]}]},{id:Jy,name:"资源排程工作台",description:"按向导回答排什么、排在哪、何时完成、结果写到哪里,生成按资源排行的调度甘特与方案改动;结果写入计划记录时另有只读的需求视角,可选再加一页所需资源与就绪。拖动改排程,采用前检查约束。",theme:"default",wizard:!0,pages:[{title:"排程",cells:[["scenarioBar",0,0,12,2,{title:"方案",style:"compact"}],["scheduleGantt",0,2,8,14,{title:"排程(按资源)"}],["scheduleGantt",0,16,8,9,{title:"所需资源与就绪(可选)"}],["scenarioBar",8,2,4,23,{title:"方案改动",style:"assumptions"}]]}]}],zd={id:"blank"};function Xy(e){const t=Object.values(e.objectTypes).filter(o=>o.properties.length>0),n=o=>o.properties.some(s=>s.type==="date")?1:0;return[...t].sort((o,s)=>n(s)-n(o)||s.properties.length-o.properties.length)[0]}const Kl=e=>JSON.parse(JSON.stringify(e));function Qy(e){const t=JSON.stringify(e.pages);return{...e,variables:e.variables.filter(n=>n.kind==="asOf"||t.includes(`"${n.name}"`))}}const eb=e=>ze[e]?.category==="scenario";function tb(e){return{...e,pages:e.pages.map(t=>{const n=t.regions.cells??[],o=rg(Object.fromEntries(n.flatMap(s=>s.frame?[[s.id,s.frame]]:[])));return{...t,regions:{cells:n.map(s=>o[s.id]?{...s,frame:o[s.id]}:s)}}})}}function nb(e,t,n,o,{scenarios:s=!0}={}){const r=Zy.find(m=>m.id===e),a=o&&n.objectTypes[o]||(e===zd.id?void 0:Xy(n)),l={apiVersion:pt,app:t,dependencies:{knowledgeNetwork:{id:n.id,name:n.name}},sources:[],variables:[{name:"asOf",label:"基准日期",kind:"asOf"}],pages:[{id:"main",title:"页面 1",layout:structuredClone(kl.free),regions:{},linking:"auto"}],theme:{...structuredClone(Xn.default),surface:"plain"}};if(!a)return{spec:l,skipped:[]};const c={id:Tg(tn(l,"main"),n,a.id),label:a.name,objectType:a.id,key:a.primaryKeys[0]??a.properties[0].name};if(!r)return{spec:{...l,sources:[c]},skipped:[]};let i={...l,sources:[c],pages:r.pages.map((m,g)=>({id:g===0?"main":`page${g+1}`,title:m.title,layout:structuredClone(kl.free),regions:{cells:[]},linking:"auto"})),theme:{...structuredClone(Xn[r.theme]),surface:"plain"}};const d=[],h=new Set,u=m=>{for(let g=1;;g++)if(!h.has(`${m}${g}`))return`${m}${g}`},p=m=>Ud(m,n,{allowEmpty:!0}).ok,f=a.properties.some(m=>m.type==="date");return r.pages.forEach((m,g)=>{const y=i.pages[g].id;for(const[v,S,j,O,A,E]of m.cells){if(!s&&eb(v))continue;const x=tn(i,y),L={id:u(v),type:v,config:Kl({...ht(v).defaults(x,{kn:n,spec:x},c.id),...E}),frame:{x:S,y:j,w:O,h:A}},I=ob(i,g,L);(v!=="asOfSlider"||f)&&p(I)?(i=I,h.add(L.id)):d.push(v)}const b=tn(i,y),k={id:g===0?"detail":`detail${g+1}`,type:me,config:Kl(ht(me).defaults(b,{kn:n,spec:b},c.id))},w={...i,pages:i.pages.map((v,S)=>S===g?{...v,detail:k}:v)};p(w)&&(i=w)}),{spec:tb(Qy(i)),skipped:d}}function ob(e,t,n){return{...e,pages:e.pages.map((o,s)=>s===t?{...o,regions:{cells:[...o.regions.cells??[],n]}}:o)}}const sb={usage:e=>`用法:workshop <命令> [参数] [选项]
|
|
156
|
+
`,p)+1}return{type:u,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(u){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const p=r(u),f=l(p);return f.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:f,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const p=r(u),f=l(p);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:f,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(u,p){return this.type!=="comment"||this.indent<=p?!1:u.every(f=>f.type==="newline"||f.type==="space")}*documentEnd(u){this.type!=="doc-mode"&&(u.end?u.end.push(this.sourceToken):u.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(u){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:u.end?u.end.push(this.sourceToken):u.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}return xs.Parser=d,xs}var jt={},ul;function Um(){if(ul)return jt;ul=1;var e=yd(),t=mo(),n=go(),o=Qc(),s=B(),a=wd(),r=kd();function l(u){const p=u.prettyErrors!==!1;return{lineCounter:u.lineCounter||p&&new a.LineCounter||null,prettyErrors:p}}function c(u,p={}){const{lineCounter:f,prettyErrors:m}=l(p),g=new r.Parser(f?.addNewLine),y=new e.Composer(p),b=Array.from(y.compose(g.parse(u)));if(m&&f)for(const k of b)k.errors.forEach(n.prettifyError(u,f)),k.warnings.forEach(n.prettifyError(u,f));return b.length>0?b:Object.assign([],{empty:!0},y.streamInfo())}function i(u,p={}){const{lineCounter:f,prettyErrors:m}=l(p),g=new r.Parser(f?.addNewLine),y=new e.Composer(p);let b=null;for(const k of y.compose(g.parse(u),!0,u.length))if(!b)b=k;else if(b.options.logLevel!=="silent"){b.errors.push(new n.YAMLParseError(k.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return m&&f&&(b.errors.forEach(n.prettifyError(u,f)),b.warnings.forEach(n.prettifyError(u,f))),b}function d(u,p,f){let m;typeof p=="function"?m=p:f===void 0&&p&&typeof p=="object"&&(f=p);const g=i(u,f);if(!g)return null;if(g.warnings.forEach(y=>o.warn(g.options.logLevel,y)),g.errors.length>0){if(g.options.logLevel!=="silent")throw g.errors[0];g.errors=[]}return g.toJS(Object.assign({reviver:m},f))}function h(u,p,f){let m=null;if(typeof p=="function"||Array.isArray(p)?m=p:f===void 0&&p&&(f=p),typeof f=="string"&&(f=f.length),typeof f=="number"){const g=Math.round(f);f=g<1?void 0:g>8?{indent:8}:{indent:g}}if(u===void 0){const{keepUndefined:g}=f??p??{};if(!g)return}return s.isDocument(u)&&!m?u.toString(f):new t.Document(u,m,f).toString(f)}return jt.parse=d,jt.parseAllDocuments=c,jt.parseDocument=i,jt.stringify=h,jt}var hl;function zm(){if(hl)return W;hl=1;var e=yd(),t=mo(),n=ud(),o=go(),s=lo(),a=B(),r=mt(),l=ce(),c=gt(),i=yt(),d=Vr(),h=bd(),u=wd(),p=kd(),f=Um(),m=io();return W.Composer=e.Composer,W.Document=t.Document,W.Schema=n.Schema,W.YAMLError=o.YAMLError,W.YAMLParseError=o.YAMLParseError,W.YAMLWarning=o.YAMLWarning,W.Alias=s.Alias,W.isAlias=a.isAlias,W.isCollection=a.isCollection,W.isDocument=a.isDocument,W.isMap=a.isMap,W.isNode=a.isNode,W.isPair=a.isPair,W.isScalar=a.isScalar,W.isSeq=a.isSeq,W.Pair=r.Pair,W.Scalar=l.Scalar,W.YAMLMap=c.YAMLMap,W.YAMLSeq=i.YAMLSeq,W.CST=d,W.Lexer=h.Lexer,W.LineCounter=u.LineCounter,W.Parser=p.Parser,W.parse=f.parse,W.parseAllDocuments=f.parseAllDocuments,W.parseDocument=f.parseDocument,W.stringify=f.stringify,W.visit=m.visit,W.visitAsync=m.visitAsync,W}var Ye=zm();const Wm=5*1024*1024,Km=new Set([".js",".mjs",".css",".json",".svg",".png",".jpg",".webp",".woff2",".md"]),pl=["component","page"],fl=["filter","display","chart","relation"],Ym=["value","dateRange","selection","set"],Gm=["query","act","ask","navigate"],ml=["string","number","integer","boolean","object","array"],Hm=new Set(["type","properties","required","items","enum","title","description","default","minimum","maximum","minItems","maxItems","maxLength","x-workshop"]),gl=["field","fields","variable","objectType","relationPath","actionType"],Vm=new Set(["widget","fieldTypes","maxHops","tab","showIf"]),yl=["data","display","link"],ur=["string","number","boolean","date","datetime","object"],bl={"zh-CN":{label:"{key} 须是对象,至少提供 zh-CN",required:"{key} 必填",size:"{key} 须是 { w: 1–12, h: ≥1 } 的整数",list:"{key} 只能是 {allowed} 的列表",object:"{at} 须是对象",unsupported:"{at} 不支持 {key}",oneOf:"{at} 只能是 {allowed}",typeOrEnum:"{at} 须有 type 或 enum",nonEmptyList:"{at} 须是非空列表",requiredNames:"{at} 只能列出 properties 中的配置项",manifestObject:"manifest.json 须是 JSON 对象",type:"type 须是 x-<前缀>.<名称>:前缀为小写字母、数字与连字符,名称为字母与数字",version:"version 须是 主.次.修订",workshopApi:"workshopApi 目前只能是 1",element:"element 须是含连字符的小写自定义元素名",description:"description 必填:写清展示什么、点了会怎样",data:"data 须是 { source: true|false, fields }",dataFields:"data.fields 须是 any,或 { role, type } 列表(type 为 {types})",boolean:"{key} 须是 true 或 false",network:"network 须是来源列表,如 https://risk.example.com(不带路径)",unreadable:"读不到 manifest.json:{message}",tooLarge:"包内文件共 {total} 字节,超过 5 MB",fileType:"不允许的文件类型:{name}",noEntry:"入口 {entry} 不存在",noElement:"入口中没有定义自定义元素 {element}",bigEntry:"入口超过 300 KB:首屏不需要的部分建议拆成分块",remoteScript:"{name} 从外部地址加载脚本:依赖须全部打进包里",syntax:"{name} 第 {line} 行有语法错误,浏览器加载不了:{message}",syntaxOldNode:"{name} 第 {line} 行在本机 Node {node} 下解析不了:{message}。Node 24 以前的版本不认识部分新语法,上传时以 Workshop 的检查为准;用 Node 24 及以上校验才能确定",evalUsed:"{name} 用了 eval 或 new Function:内容安全策略下会被拒绝",noReadme:"没有 README.md:每个组件都应附说明(本体契约、扩展点、场景配方)",noPreview:"没有 preview.json:组件库预览与本地开发都需要示例数据",and:"、"},"en-US":{label:"{key} must be an object with at least zh-CN",required:"{key} is required",size:"{key} must be whole numbers { w: 1–12, h: ≥1 }",list:"{key} must be a list of {allowed}",object:"{at} must be an object",unsupported:"{at} does not support {key}",oneOf:"{at} must be one of {allowed}",typeOrEnum:"{at} needs type or enum",nonEmptyList:"{at} must be a non-empty list",requiredNames:"{at} may only list items of properties",manifestObject:"manifest.json must be a JSON object",type:"type must be x-<prefix>.<name>: the prefix lowercase letters, digits and hyphens, the name letters and digits",version:"version must be major.minor.patch",workshopApi:"workshopApi can only be 1 for now",element:"element must be a lowercase custom element name with a hyphen",description:"description is required: say what it shows and what a click does",data:"data must be { source: true|false, fields }",dataFields:"data.fields must be any, or a list of { role, type } (type one of {types})",boolean:"{key} must be true or false",network:"network must be a list of origins, such as https://risk.example.com (no path)",unreadable:"Cannot read manifest.json: {message}",tooLarge:"The package's files take {total} bytes, over 5 MB",fileType:"File type not allowed: {name}",noEntry:"The entry {entry} does not exist",noElement:"The entry does not define the custom element {element}",bigEntry:"The entry is over 300 KB: split what the first screen does not need into chunks",remoteScript:"{name} loads a script from an outside address: bundle every dependency into the package",syntax:"{name} has a syntax error at line {line}, so the browser cannot load it: {message}",syntaxOldNode:"{name} does not parse at line {line} under this Node {node}: {message}. Node before 24 does not know some newer syntax, and the upload check decides; validate with Node 24 or later to be sure",evalUsed:"{name} uses eval or new Function, which the content security policy refuses",noReadme:"No README.md: every component should come with a guide (ontology contract, extension points, recipes)",noPreview:"No preview.json: the component library's preview and local development both need sample data",and:", "}};function Jr(e){const t=bl[e]??bl["zh-CN"],n=(o,s)=>lc(t[o],s);return n.list=o=>o.join(t.and),n}function bn(e){const t=[],n=o=>{for(const s of en(o).sort()){if(s.startsWith(".")||s==="node_modules")continue;const a=G(o,s),r=ju(a);if(r.isDirectory())n(a);else{if(oc(s).toLowerCase()===".zip")continue;t.push({path:a,name:sc(e,a).split(vu).join("/"),size:r.size})}}};return n(e),t}const De=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ot=e=>typeof e=="string"&&e.trim()!=="";function Jm(e,t,n,o){(!De(e)||!Ot(e["zh-CN"]))&&n.push(o("label",{key:t}))}function wl(e,t,n,o,s){if(e===void 0){o&&n.push(s("required",{key:t}));return}(!(De(e)&&[e.w,e.h].every(r=>Number.isInteger(r)&&r>0))||e.w>12)&&n.push(s("size",{key:t}))}function hr(e,t,n,o,s){e!==void 0&&(!Array.isArray(e)||!e.every(a=>n.includes(a)))&&o.push(s("list",{key:t,allowed:s.list(n)}))}function pr(e,t="configSchema",n="zh-CN"){const o=Jr(n),s=[];if(!De(e))return[o("object",{at:t})];for(const r of Object.keys(e))Hm.has(r)||s.push(o("unsupported",{at:t,key:r}));if(e.type!==void 0&&!ml.includes(e.type)&&s.push(o("oneOf",{at:`${t}.type`,allowed:o.list(ml)})),e.type===void 0&&e.enum===void 0&&t!=="configSchema"&&s.push(o("typeOrEnum",{at:t})),e.enum!==void 0&&(!Array.isArray(e.enum)||e.enum.length===0)&&s.push(o("nonEmptyList",{at:`${t}.enum`})),e.properties!==void 0)if(!De(e.properties))s.push(o("object",{at:`${t}.properties`}));else for(const[r,l]of Object.entries(e.properties))s.push(...pr(l,`${t}.properties.${r}`,n));if(e.required!==void 0){const r=De(e.properties)?Object.keys(e.properties):[];(!Array.isArray(e.required)||!e.required.every(l=>r.includes(l)))&&s.push(o("requiredNames",{at:`${t}.required`}))}e.items!==void 0&&s.push(...pr(e.items,`${t}.items`,n));const a=e["x-workshop"];if(a!==void 0)if(!De(a))s.push(o("object",{at:`${t}.x-workshop`}));else{for(const r of Object.keys(a))Vm.has(r)||s.push(o("unsupported",{at:`${t}.x-workshop`,key:r}));a.widget!==void 0&&!gl.includes(a.widget)&&s.push(o("oneOf",{at:`${t}.x-workshop.widget`,allowed:o.list(gl)})),a.tab!==void 0&&!yl.includes(a.tab)&&s.push(o("oneOf",{at:`${t}.x-workshop.tab`,allowed:o.list(yl)})),a.fieldTypes!==void 0&&hr(a.fieldTypes,`${t}.x-workshop.fieldTypes`,ur,s,o),a.showIf!==void 0&&!De(a.showIf)&&s.push(o("object",{at:`${t}.x-workshop.showIf`}))}return s}function vd(e,t="zh-CN"){const n=Jr(t),o=[];if(!De(e))return[n("manifestObject")];const s=e;if(/^x-[a-z0-9-]+\.[A-Za-z][A-Za-z0-9]*$/.test(s.type??"")||o.push(n("type")),pl.includes(s.kind)||o.push(n("oneOf",{at:"kind",allowed:n.list(pl)})),/^\d+\.\d+\.\d+$/.test(s.version??"")||o.push(n("version")),s.workshopApi!==1&&o.push(n("workshopApi")),/^[a-z][a-z0-9]*(-[a-z0-9]+)+$/.test(s.element??"")||o.push(n("element")),Ot(s.entry)||o.push(n("required",{key:"entry"})),Jm(s.label,"label",o,n),Ot(s.description)||o.push(n("description")),s.kind!=="page"&&!fl.includes(s.category)&&o.push(n("oneOf",{at:"category",allowed:n.list(fl)})),o.push(...pr(s.configSchema,"configSchema",t)),!De(s.data)||typeof s.data.source!="boolean")o.push(n("data"));else if(s.data.fields!=="any"){const a=s.data.fields;Array.isArray(a)&&a.every(l=>De(l)&&Ot(l.role)&&ur.includes(l.type))||o.push(n("dataFields",{types:n.list(ur)}))}return typeof s.follows!="boolean"&&o.push(n("boolean",{key:"follows"})),hr(s.emits,"emits",Ym,o,n),hr(s.capabilities,"capabilities",Gm,o,n),s.describes!==void 0&&typeof s.describes!="boolean"&&o.push(n("boolean",{key:"describes"})),wl(s.defaultSize,"defaultSize",o,s.kind==="component",n),wl(s.minSize,"minSize",o,!1,n),s.network!==void 0&&(Array.isArray(s.network)&&s.network.every(r=>{try{const l=new URL(r);return["https:","http:","wss:"].includes(l.protocol)&&l.origin===r}catch{return!1}})||o.push(n("network"))),o}const Zm=24,Xm=[/^Private field '#[^']+' must be declared in an enclosing class$/,/^Identifier '[^']+' has already been declared$/,/^Unexpected end of input$/,/^Strict mode code may not include a with statement$/,/^Octal literals are not allowed in strict mode\.$/];function Qm(e){const t=gu(process.execPath,["--input-type=module","--check"],{input:e,encoding:"utf8"});if(t.status===0)return null;const n=`${t.stderr??""}${t.error?.message??""}`,o=Number(/^\[stdin\]:(\d+)/m.exec(n)?.[1]??0),s=/^\w*Error: (.+)$/m.exec(n)?.[1]??n.trim().split(`
|
|
157
|
+
`).at(-1);return{line:o,message:s}}function eg(e,{language:t="zh-CN",nodeMajor:n=Number(process.versions.node.split(".")[0])}={}){const o=Jr(t),s=[],a=[];let r;try{r=JSON.parse(ct(G(e,"manifest.json"),"utf8"))}catch(h){return{ok:!1,errors:[o("unreadable",{message:h.message})],warnings:a,files:[]}}s.push(...vd(r,t));const l=bn(e),c=l.reduce((h,u)=>h+u.size,0);c>Wm&&s.push(o("tooLarge",{total:c}));for(const h of l)Km.has(oc(h.name).toLowerCase())||s.push(o("fileType",{name:h.name}));const i=Ot(r.entry)?ku.normalize(r.entry.replace(/^\.\//,"")):null,d=l.find(h=>h.name===i);if(Ot(r.entry)&&!d&&s.push(o("noEntry",{entry:r.entry})),d){const h=ct(d.path,"utf8");r.element&&!h.includes(r.element)&&s.push(o("noElement",{element:r.element})),d.size>300*1024&&a.push(o("bigEntry"))}for(const h of l.filter(u=>/\.(m?js)$/.test(u.name))){const u=ct(h.path,"utf8"),p=Qm(u),f=p&&Xm.some(m=>m.test(p.message));p&&(n>=Zm||f)?s.push(o("syntax",{name:h.name,...p})):p&&a.push(o("syntaxOldNode",{name:h.name,node:process.versions.node,...p})),(/import\s*\(\s*["'`]https?:\/\//.test(u)||/from\s+["']https?:\/\//.test(u))&&s.push(o("remoteScript",{name:h.name})),/\beval\s*\(|new\s+Function\s*\(/.test(u)&&a.push(o("evalUsed",{name:h.name}))}return l.some(h=>h.name==="README.md")||a.push(o("noReadme")),r.data?.source&&!l.some(h=>h.name==="preview.json")&&a.push(o("noPreview")),{ok:s.length===0,errors:s,warnings:a,files:l,manifest:r}}const tg=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let o=0;o<8;o++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function $d(e){let t=4294967295;for(const n of e)t=tg[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function ng(e){const t=[],n=[];let o=0;const s=0,a=33;for(const{name:c,data:i}of e){const d=Buffer.from(c,"utf8"),h=Nu(i),u=h.length>=i.length,p=u?i:h,f=$d(i),m=Buffer.alloc(30);m.writeUInt32LE(67324752,0),m.writeUInt16LE(20,4),m.writeUInt16LE(2048,6),m.writeUInt16LE(u?0:8,8),m.writeUInt16LE(s,10),m.writeUInt16LE(a,12),m.writeUInt32LE(f,14),m.writeUInt32LE(p.length,18),m.writeUInt32LE(i.length,22),m.writeUInt16LE(d.length,26),m.writeUInt16LE(0,28),t.push(m,d,p);const g=Buffer.alloc(46);g.writeUInt32LE(33639248,0),g.writeUInt16LE(20,4),g.writeUInt16LE(20,6),g.writeUInt16LE(2048,8),g.writeUInt16LE(u?0:8,10),g.writeUInt16LE(s,12),g.writeUInt16LE(a,14),g.writeUInt32LE(f,16),g.writeUInt32LE(p.length,20),g.writeUInt32LE(i.length,24),g.writeUInt16LE(d.length,28),g.writeUInt32LE(o,42),n.push(g,d),o+=m.length+d.length+p.length}const r=n.reduce((c,i)=>c+i.length,0),l=Buffer.alloc(22);return l.writeUInt32LE(101010256,0),l.writeUInt16LE(e.length,8),l.writeUInt16LE(e.length,10),l.writeUInt32LE(r,12),l.writeUInt32LE(o,16),Buffer.concat([...t,...n,l])}const kl={"zh-CN":{notZip:"不是 zip 文件",directory:"zip 的目录损坏",damaged:"zip 中 {name} 损坏",method:"zip 中 {name} 的压缩方式不支持"},"en-US":{notZip:"Not a zip file",directory:"The zip's directory is damaged",damaged:"{name} in the zip is damaged",method:"{name} in the zip is compressed in a way not supported"}};function og(e,t="zh-CN"){const n=(c,i)=>lc((kl[t]??kl["zh-CN"])[c],i),o=Buffer.from(e.buffer,e.byteOffset,e.byteLength);let s=-1;for(let c=o.length-22;c>=Math.max(0,o.length-22-65535);c--)if(o.readUInt32LE(c)===101010256){s=c;break}if(s<0)throw new Error(n("notZip"));const a=o.readUInt16LE(s+10);let r=o.readUInt32LE(s+16);const l=[];for(let c=0;c<a;c++){if(r+46>o.length||o.readUInt32LE(r)!==33639248)throw new Error(n("directory"));const i=o.readUInt16LE(r+10),d=o.readUInt32LE(r+16),h=o.readUInt32LE(r+20),u=o.readUInt32LE(r+24),p=o.readUInt16LE(r+28),f=p+o.readUInt16LE(r+30)+o.readUInt16LE(r+32),m=o.readUInt32LE(r+42),g=o.toString("utf8",r+46,r+46+p);if(r+=46+f,g.endsWith("/"))continue;if(m+30>o.length||o.readUInt32LE(m)!==67324752)throw new Error(n("damaged",{name:g}));const y=m+30+o.readUInt16LE(m+26)+o.readUInt16LE(m+28),b=o.subarray(y,y+h);if(i!==0&&i!==8)throw new Error(n("method",{name:g}));const k=i===0?Buffer.from(b):xu(b);if(k.length!==u||$d(k)!==d)throw new Error(n("damaged",{name:g}));l.push({name:g,data:k})}return l}const sg=e=>({x:e.x*2,y:e.y*2,w:e.w*2,h:e.h*2});function rg(e){if(Er(e.layout)==="fine")return e;const t={};for(const[s,a]of Object.entries(e.regions))t[s]=(a??[]).map(r=>r.frame?{...r,frame:sg(r.frame)}:r);const{pinRows:n,...o}=e.layout;return{...e,layout:{...o,grid:"fine",...n!==void 0?{pinRows:n*2}:{}},regions:t}}const _n='"Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif',Zr={default:{name:"default",mode:"light",colorPrimary:"#255db0",colorAccent:"#6d4fc2",colorBg:"#f3f5f8",colorSurface:"#ffffff",colorSurfaceAlt:"#f8fafc",colorBorder:"#dfe5ec",colorText:"#203043",colorTextMuted:"#607086",colorSuccess:"#267257",colorWarning:"#9b4e12",colorDanger:"#b42318",colorInfo:"#1f6f9f",chartPalette:["#255db0","#e0883a","#2f9e77","#d0453a","#6d4fc2","#3a9fc0","#8a97a8"],fontFamily:_n,fontSize:13,radius:8,shadow:"subtle",density:"comfortable"},fresh:{name:"fresh",mode:"light",colorPrimary:"#0f7b6c",colorAccent:"#3b6fb6",colorBg:"#f3f6f5",colorSurface:"#ffffff",colorSurfaceAlt:"#f7faf9",colorBorder:"#dbe4e1",colorText:"#1f2d2b",colorTextMuted:"#5d6f6b",colorSuccess:"#237a4b",colorWarning:"#9a5b07",colorDanger:"#b42318",colorInfo:"#2a6f97",chartPalette:["#0f7b6c","#3b6fb6","#e0a33a","#7fb3a6","#c8553d","#6c63a8","#93a3a0"],fontFamily:_n,fontSize:13,radius:6,shadow:"none",density:"comfortable"},dark:{name:"dark",mode:"dark",colorPrimary:"#9bc1ff",colorAccent:"#c4b5fd",colorBg:"#141b24",colorSurface:"#202936",colorSurfaceAlt:"#1a222d",colorBorder:"#394659",colorText:"#ecf1f7",colorTextMuted:"#adbbce",colorSuccess:"#93d8bd",colorWarning:"#ffc38e",colorDanger:"#ff9e9e",colorInfo:"#8fd3f4",chartPalette:["#9bc1ff","#ffc38e","#93d8bd","#ff9e9e","#c4b5fd","#8fd3f4"],fontFamily:_n,fontSize:13,radius:8,shadow:"none",density:"comfortable"},tech:{name:"tech",mode:"dark",colorPrimary:"#3fd5ff",colorAccent:"#a493ff",colorBg:"#04080e",colorSurface:"#0a131f",colorSurfaceAlt:"#0d1828",colorBorder:"#1e3550",colorText:"#dce7f5",colorTextMuted:"#8193ab",colorSuccess:"#2ee6b6",colorWarning:"#ffb648",colorDanger:"#ff5470",colorInfo:"#5b8cff",chartPalette:["#3fd5ff","#ffb648","#2ee6b6","#ff5470","#a493ff","#5b8cff"],fontFamily:_n,fontSize:13,radius:4,shadow:"none",density:"compact"}},ag={free:{type:"free",columns:2,sidePosition:"left",sideWidth:300,asideWidth:0,gap:"normal"}};re.done.value;const fr=re.overdue.value,Sd=[re.active.value,fr],ig={status:{variable:"status",field:"$status"},signed:{variable:"signed",field:"signing_date"},customer:{variable:"customer",field:"customer_name"},region:{variable:"region",field:"region"},search:{variable:"search",fields:["sales_order_id","customer_name","product_name"]},alert:{variable:"alert"}},jd=(...e)=>Object.entries(ig).filter(([t])=>!e.includes(t)).map(([,t])=>t);jd("alert");Xt("$status",Sd);Xt("$status",Sd),Xt("$status",[fr]),Xt("$status",[fr]),jd();const lg={sep:"、",object:e=>`${e} 必须是对象`,array:e=>`${e} 必须是数组`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,required:e=>`${e} 必填`,textMax:(e,t)=>`${e} 必须是不超过 ${t} 字的文本`,text:e=>`${e} 必须是文本`,numberRange:(e,t,n,o)=>`${e} 必须是 ${t} 到 ${n} 的${o?"数":"整数"}`,oneOf:(e,t)=>`${e} 只能是 ${t}`,bool:e=>`${e} 必须是 true 或 false`,sourceOneOf:(e,t)=>`${e} 必须是页面数据源之一:${t}`,pickProperty:e=>`${e} 至少选一个属性`,textList:e=>`${e} 必须是文本列表`,valueNotTaken:(e,t,n,o)=>`${e} 的取值「${t}」不是 ${n} 的取值(可选:${o})`,needSource:e=>`${e} 需要先选好数据源`,notObjectType:e=>`${e} 不是知识网络中的对象类`,operationOneOf:(e,t)=>`${e} 必须是数据源里定义的情景操作:${t}`,noOperations:"(数据源还没有情景操作)",operationProblem:(e,t)=>`${e} ${t}`,eventTypeOneOf:(e,t,n,o)=>`${e} 必须是应用的${t?"用户登记":""}事件类型${n?"列表":""}:${o}`,noEventTypes:"(还没有,先到「事件」页签新建)",actionIdList:e=>`${e} 必须是行动类型 id 的列表`,notAction:(e,t)=>`${e} 里的 ${t} 不是知识网络里的行动`,pickTool:e=>`${e} 要选工具箱和其中的一个工具`,pickMcpTool:e=>`${e} 要选 MCP 服务和其中的一个工具`,listSize:(e,t,n)=>`${e} 必须是 ${t} 到 ${n} 项的列表`,needSourceOrObjectType:e=>`${e} 需要先选好数据源或对象类`,propertyUnusable:(e,t)=>`${e} 不是可用的属性:${t}`,propertyOfType:(e,t)=>`${e} 必须是${t}属性`,typeNames:{date:"日期",number:"数字",text:"文本"},variableOneOf:(e,t)=>`${e} 必须是页面变量之一:${t}`,noVariables:"(没有可用变量)",objectsMismatch:(e,t)=>`${e} 筛选 ${t} 里是另一类对象,组件的数据源对不上`,list:e=>`${e} 必须是列表`,bindingShape:e=>`${e} 必须是 { variable, field? , fields? }`,filterOneOf:(e,t)=>`${e}.variable 必须是页面上的筛选之一:${t}`,noFilters:"(还没有筛选)",filterTwice:(e,t)=>`${e} 重复跟随筛选 ${t}`,bindingField:(e,t)=>`${e}.field 不是数据源的字段:${t}`,bindingDateField:e=>`${e}.field 必须是数据源的日期字段`,bindingTextFields:e=>`${e}.fields 必须是数据源的文本字段列表`,relationIds:e=>`${e} 必须是关系 ID 列表`,singleRelation:e=>`${e} 只能是一条关系:连线必须是知识网络里直接相连的关系,不能沿多条关系拼出来`,pathUnreachable:(e,t)=>`${e} 不是从 ${t} 出发连通的关系路径`,pathEnd:(e,t,n)=>`${e} 终点是 ${t},与 objectType ${n} 不一致`},cg={sep:", ",object:e=>`${e} must be an object`,array:e=>`${e} must be an array`,noOption:(e,t)=>`${e} has no option ${t}`,required:e=>`${e} is required`,textMax:(e,t)=>`${e} must be text of at most ${t} characters`,text:e=>`${e} must be text`,numberRange:(e,t,n,o)=>`${e} must be ${o?"a number":"an integer"} from ${t} to ${n}`,oneOf:(e,t)=>`${e} must be one of ${t}`,bool:e=>`${e} must be true or false`,sourceOneOf:(e,t)=>`${e} must be one of the page's sources: ${t}`,pickProperty:e=>`${e} needs at least one property`,textList:e=>`${e} must be a list of text`,valueNotTaken:(e,t,n,o)=>`${e} value "${t}" is not a value of ${n} (one of: ${o})`,needSource:e=>`${e} needs a source to be chosen first`,notObjectType:e=>`${e} is not an object type of the knowledge network`,operationOneOf:(e,t)=>`${e} must be a scenario operation defined on the source: ${t}`,noOperations:"(the source has no scenario operations yet)",operationProblem:(e,t)=>`${e} ${t}`,eventTypeOneOf:(e,t,n,o)=>`${e} must be ${n?"a list of ":"an "}${t?"user-reported ":""}event type${n?"s":""} of the app: ${o}`,noEventTypes:'(none yet; create one in the "Events" tab first)',actionIdList:e=>`${e} must be a list of action type ids`,notAction:(e,t)=>`${t} in ${e} is not an action of the knowledge network`,pickTool:e=>`${e} needs a toolbox and one of its tools`,pickMcpTool:e=>`${e} needs an MCP server and one of its tools`,listSize:(e,t,n)=>`${e} must be a list of ${t} to ${n} items`,needSourceOrObjectType:e=>`${e} needs a source or an object type to be chosen first`,propertyUnusable:(e,t)=>`${e} is not an available property: ${t}`,propertyOfType:(e,t)=>`${e} must be a ${t} property`,typeNames:{date:"date",number:"number",text:"text"},variableOneOf:(e,t)=>`${e} must be one of the page variables: ${t}`,noVariables:"(no variable available)",objectsMismatch:(e,t)=>`${e} filter ${t} holds another kind of object than the component's source`,list:e=>`${e} must be a list`,bindingShape:e=>`${e} must be { variable, field? , fields? }`,filterOneOf:(e,t)=>`${e}.variable must be one of the filters of the page: ${t}`,noFilters:"(no filter yet)",filterTwice:(e,t)=>`${e} follows filter ${t} twice`,bindingField:(e,t)=>`${e}.field is not a field of the source: ${t}`,bindingDateField:e=>`${e}.field must be a date field of the source`,bindingTextFields:e=>`${e}.fields must be a list of text fields of the source`,relationIds:e=>`${e} must be a list of relation ids`,singleRelation:e=>`${e} must be a single relation: a link must be a relation directly connecting objects in the knowledge network, not several relations chained`,pathUnreachable:(e,t)=>`${e} is not a connected relation path starting at ${t}`,pathEnd:(e,t,n)=>`${e} ends at ${t}, which differs from objectType ${n}`},Ze=()=>fe({"zh-CN":lg,"en-US":cg}),dg=80;function Ad(e,t,n,o,s={}){const a=Ze();if(!Et(t))return[a.object(o)];const r=typeof t.source=="string"?t.source:void 0,l=[],c={...t};for(const[i,d]of Object.entries(s)){if(!(i in c))continue;const h=c[i];delete c[i],h!=null&&(d==="array"?!Array.isArray(h):!Et(h))&&l.push(a[d](`${o}.${i}`))}return[...l,...Td(e,c,n,o,{sourceId:r,config:t})]}function ug(e,t){return{...t,sourceId:typeof e.source=="string"?e.source:t.sourceId,objectType:typeof e.objectType=="string"?e.objectType:t.objectType}}function hg(e,t,n,o,s){const a=t[e.key],r=`${o}.${e.key}`,l=e.neededAs?.(t);if(n.spec.linking==="auto"&&e.kind==="variable"&&!e.accepts.every(i=>i==="asOf")&&(a==null||a===""||a===!0&&!e.reads))return[];if(a==null||a==="")return!e.optional&&!e.notNeeded?.(t)||l?[Ze().required(r)]:[];const c=l&&e.kind==="field"?{...e,of:l}:e;return pg(c,a,n,r,s,t)}function Td(e,t,n,o,s){const a=Ze(),r=[],l=new Set(e.map(i=>i.key));for(const i of Object.keys(t))l.has(i)||r.push(a.noOption(o,i));const c=ug(t,s);for(const i of e)r.push(...hg(i,t,n,o,c));return r}function pg(e,t,n,o,s,a){const r=Ze(),l=dn(pe(n.spec,s.sourceId));switch(e.kind){case"text":{if(e.max===null)return typeof t=="string"?[]:[r.text(o)];const c=e.max??dg;return typeof t=="string"&&t.length<=c?[]:[r.textMax(o,c)]}case"number":return typeof t=="number"&&Number.isFinite(t)&&(e.decimal===!0||Number.isInteger(t))&&t>=e.min&&t<=e.max?[]:[r.numberRange(o,e.min,e.max,e.decimal===!0)];case"enum":return e.options.some(([c])=>c===t)?[]:[r.oneOf(o,e.options.map(([c])=>c).join(r.sep))];case"bool":return typeof t=="boolean"?[]:[r.bool(o)];case"source":return n.spec.sources.some(c=>c.id===t)?[]:[r.sourceOneOf(o,n.spec.sources.map(c=>c.id).join(r.sep))];case"field":return vl(e,t,n,o,s);case"fields":return!Array.isArray(t)||t.length===0?[r.pickProperty(o)]:t.flatMap((c,i)=>vl(e,c,n,`${o}[${i}]`,s));case"variable":return fg(e.accepts,t,n,o,s);case"bindings":return mg(t,n,o,s);case"values":{if(!Array.isArray(t)||!t.every(d=>typeof d=="string"&&d!==""))return[r.textList(o)];const c=a[e.fieldKey]??s.config?.[e.fieldKey],i=typeof c=="string"?l(c):[];return i.length===0?[]:t.filter(d=>!i.includes(d)).map(d=>r.valueNotTaken(o,d,String(c),i.join(r.sep)))}case"conditions":{const c=Xn("source",n,s);return c===null?[r.needSource(o)]:xe(t,c,o,l)}case"objectType":return typeof t=="string"&&Object.hasOwn(n.kn.objectTypes,t)?[]:[r.notObjectType(o)];case"relationPath":return gg(t,n,o,s,e.single);case"operation":{const c=pe(n.spec,s.sourceId)?.operations??[],i=c.find(h=>h.id===t);if(!i)return[r.operationOneOf(o,c.map(h=>h.id).join(r.sep)||r.noOperations)];const d=e.fits?.(i,a);return d?[r.operationProblem(o,d)]:[]}case"eventType":{const i=(Array.isArray(n.spec.eventTypes)?Mn(n.spec,Qt(n.kn.eventTypes)):[]).filter(p=>!e.of||!p.source||p.source===e.of),d=p=>i.some(f=>f.id===p);if(e.multiple?Array.isArray(t)&&t.length>0&&t.every(d):d(t))return[];const u=i.map(p=>p.id).join(r.sep);return[r.eventTypeOneOf(o,e.of==="report",e.multiple===!0,u||r.noEventTypes)]}case"interactions":return Ep(t,e,n,s.sourceId,Xn("source",n,s),o);case"actionTypes":{if(!Array.isArray(t)||t.some(i=>typeof i!="string"))return[r.actionIdList(o)];const c=n.kn.actionTypes;return c?t.filter(i=>!c.some(d=>d.id===i)).map(i=>r.notAction(o,String(i))):[]}case"metric":{const{place:c,category:i}=Yp(e.on,s.config??{});return Xp(t,n.kn,n.spec,s.sourceId,c,o,i)}case"tool":return Et(t)&&typeof t.box=="string"&&t.box!==""&&typeof t.tool=="string"&&t.tool!==""?[]:[r.pickTool(o)];case"mcpTool":return Et(t)&&typeof t.mcp=="string"&&t.mcp!==""&&typeof t.tool=="string"&&t.tool!==""&&[t.agentId,t.agentName].every(c=>c===void 0||typeof c=="string")?[]:[r.pickMcpTool(o)];case"list":return!Array.isArray(t)||t.length<e.min||t.length>e.max?[r.listSize(o,e.min,e.max)]:t.flatMap((c,i)=>Et(c)?Td(e.item,c,n,`${o}[${i}]`,s):[r.object(`${o}[${i}]`)])}}const Od="$key";function vl(e,t,n,o,s){if(e.objectKey&&t===Od&&!e.of)return[];const a=Ze(),r=Xn(e.owner??"source",n,s);if(r===null)return[a.needSourceOrObjectType(o)];const l=r.find(c=>c.name===t);return l?e.of&&l.type!==e.of?[a.propertyOfType(o,a.typeNames[e.of])]:[]:[a.propertyUnusable(o,String(t))]}function fg(e,t,n,o,s){const a=Ze(),r=n.spec.variables.find(l=>l.name===t);if(!r||!e.includes(r.kind)){const l=n.spec.variables.filter(c=>e.includes(c.kind)).map(c=>c.name);return[a.variableOneOf(o,l.join(a.sep)||a.noVariables)]}return Cd(r,n,s)?[]:[Ed(o,r.name)]}const Ed=(e,t)=>Ze().objectsMismatch(e,t);function Cd(e,t,n){if(!("source"in e)||!n.sourceId)return!0;const o=s=>t.spec.sources.find(a=>a.id===s)?.objectType;return o(e.source)===o(n.sourceId)}function mg(e,t,n,o){const s=Ze();if(!Array.isArray(e))return[s.list(n)];if(e.length===0)return[];const a=Xn("source",t,o);if(a===null)return[s.needSource(n)];const r=c=>a.find(i=>i.name===c)?.type,l=new Set;return e.flatMap((c,i)=>{const d=`${n}[${i}]`;if(!Et(c)||typeof c.variable!="string")return[s.bindingShape(d)];const h=t.spec.variables.find(u=>u.name===c.variable);if(!h||!aa.includes(h.kind)){const u=t.spec.variables.filter(p=>aa.includes(p.kind)).map(p=>p.name);return[s.filterOneOf(d,u.join(s.sep)||s.noFilters)]}if(l.has(h.name))return[s.filterTwice(d,h.name)];switch(l.add(h.name),h.kind){case"value":return r(c.field)?[]:[s.bindingField(d,String(c.field))];case"dateRange":return r(c.field)==="date"?[]:[s.bindingDateField(d)];case"search":return Array.isArray(c.fields)&&c.fields.length>0&&c.fields.every(u=>r(u)==="text")?[]:[s.bindingTextFields(d)];case"set":return Cd(h,t,o)?[]:[Ed(d,h.name)]}})}function gg(e,t,n,o,s=!1){const a=Ze(),r=pe(t.spec,o.sourceId);if(!r)return[a.needSource(n)];if(!Array.isArray(e)||!e.every(i=>typeof i=="string"))return[a.relationIds(n)];if(s&&e.length!==1)return[a.singleRelation(n)];const l=ln(t.kn,r.objectType,e);if(!l)return[a.pathUnreachable(n,r.objectType)];const c=l.length>0?l[l.length-1].to:r.objectType;return o.objectType&&c!==o.objectType?[a.pathEnd(n,c,o.objectType)]:[]}function Xn(e,t,n){if(e==="objectType")return n.objectType?t.kn.objectTypes[n.objectType]?.properties??null:null;const o=pe(t.spec,n.sourceId);return o?he(o,t.kn):null}const yg={date:"日期",number:"数字",text:"文本"};function Qn(e,t=" "){return e.map(n=>{const o=`${t}- ${n.key}(${n.label}${n.optional?",可选":""}):`;return n.kind==="list"?`${o}列表 ${n.min} 到 ${n.max} 项,每项:
|
|
158
|
+
${Qn(n.item,`${t} `)}`:o+bg(n)}).join(`
|
|
159
|
+
`)}function bg(e){switch(e.kind){case"text":return e.max!=null?`文本,不超过 ${e.max} 字`:"文本";case"number":return`${e.decimal?"数":"整数"} ${e.min} 到 ${e.max}`;case"enum":return`取值 ${e.options.map(([t,n])=>`${t}(${n})`).join("、")}`;case"bool":return"true 或 false";case"source":return"页面数据源 id";case"field":case"fields":{const t=e.owner==="objectType"?"同一项 objectType 的属性":"数据源的属性",n=e.kind==="fields"?"列表":"",o=e.kind==="field"&&e.objectKey?`,或 ${Od} 表示对象本身`:"";return`${t}名${n}${e.of?`,须为${yg[e.of]}`:""}${o}`}case"variable":return`筛选名(variables 里的 name),类型须为 ${e.accepts.join(" 或 ")}`;case"bindings":return"跟随的筛选列表,每项 { variable, field? , fields? }:value 筛选给 field(按组件数据源的哪个字段比对);dateRange 筛选给日期 field;search 筛选给文本 fields;set 筛选不用给字段(须为同一类对象)。不写或空列表表示不受任何筛选影响";case"values":return`文本列表,为 ${e.fieldKey} 字段的取值(只取其中这些值;空列表表示不限)`;case"conditions":return"条件列表,全部成立才算命中;每项 { field, op, ref? | value? | values? },写法同计算列的条件";case"objectType":return"对象类 id";case"operation":return"数据源 operations 里的情景操作 id";case"relationPath":return e.single?"只含一个关系 id 的列表:知识网络里直接连接数据源对象类与 objectType 的那条关系;网络里没有直接关系的两类对象不能连线":"关系 id 列表,从数据源的对象类依次走到 objectType";case"list":return`列表 ${e.min} 到 ${e.max} 项,每项:${e.item.map(t=>t.label).join("、")}`;case"interactions":return Cp(e.on,e.actOn,e.hit,e.offers);case"actionTypes":return"行动类型 id 列表(知识网络里的行动)";case"metric":return e.on==="card"?"{ id, version }:知识网络中已发布的对象指标(见「对象指标」,没有这一节就不能用),须返回单个值、属于数据源的对象类;写了它,这张卡由平台按全部对象计算,不写 aggregate、valueField":"{ id, version }:知识网络中已发布的对象指标(见「对象指标」,没有这一节就不能用),须属于数据源的对象类;横轴为时间时须是有固定时间粒度的指标,横轴为类别时须返回单个值且类别属性是它开放的维度;写了它,这个系列由平台计算,不写 dateField、aggregate、valueField";case"tool":return"{ box, tool }:执行工厂里已发布工具箱的 id 和其中已启用工具的 id";case"mcpTool":return"{ mcp, tool, mcpName?, agentId?, agentName? }:执行工厂里已发布 MCP 服务的 id、其中工具的名称,以及服务名称(可选,只用于显示,不写时对话框向执行工厂取);支持智能体目录的服务可指定默认智能体 id 和名称;不知道有哪些服务时不写,由构建者选择";case"eventType":return`${e.multiple?"事件类型 id 列表":"事件类型 id"}(eventTypes 里的 id${e.of==="report"?",须为知识网络里来源是用户登记的":""})`}}function Et(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const wg={joiner:"、",noOption:(e,t)=>`${e} 没有配置项 ${t}`,required:e=>`${e} 必填`,namesList:(e,t)=>`${e} 必须是不超过 ${t} 个名称的列表`,name:e=>`${e} 必须是非空名称`,conditionList:e=>`${e} 必须是条件列表`,condition:e=>`${e} 必须是 { field, op, value? } 条件`,object:e=>`${e} 必须是对象`,paramFrom:e=>`${e} 必须是 param、field、const 或 context 取值`,pathLength:e=>`${e} 必须是 1 到 4 条关系`,targetShape:e=>`${e} 必须是 { path?, field }`,readyShape:e=>`${e} 必须是 { path, field }`,onePath:e=>`${e} 必须是一条关系`,rulesCount:(e,t)=>`${e} 必须是不超过 ${t} 个规则工具`,ruleShape:e=>`${e} 必须是 { name, tool: { box, tool }, severity? }`,severity:e=>`${e} 只能是 hard 或 soft`,sourcesList:(e,t)=>`${e} 必须是不超过 ${t} 个数据源的列表`,layerList:e=>`${e} 必须是图层列表`,oneOf:(e,t)=>`${e} 只能是 ${t}`,tasksSelf:(e,t)=>`${e} 必须是 1 到 ${t} 种任务`,tasksRecord:e=>`${e} 写入计划记录时只能有一种任务`,parentOrGroup:e=>`${e} 上级字段与分组字段只能选一个`,calendarsCount:(e,t)=>`${e} 必须是不超过 ${t} 个日历`,boolean:e=>`${e} 必须是布尔值`,recordOnlyRecord:e=>`${e} 只在写入计划记录时填写`,recordRequired:e=>`${e} 写入计划记录时必填`,days:e=>`${e} 必须是 1 到 365 天`,matchCount:(e,t)=>`${e} 必须是不超过 ${t} 对字段`,matchShape:e=>`${e} 必须是 { from, to }`},kg={joiner:", ",noOption:(e,t)=>`${e} has no option ${t}`,required:e=>`${e} is required`,namesList:(e,t)=>`${e} must be a list of at most ${t} names`,name:e=>`${e} must be a non-empty name`,conditionList:e=>`${e} must be a list of conditions`,condition:e=>`${e} must be a { field, op, value? } condition`,object:e=>`${e} must be an object`,paramFrom:e=>`${e} must take its value from param, field, const or context`,pathLength:e=>`${e} must be 1 to 4 relations`,targetShape:e=>`${e} must be { path?, field }`,readyShape:e=>`${e} must be { path, field }`,onePath:e=>`${e} must be one relation`,rulesCount:(e,t)=>`${e} must be at most ${t} rule tools`,ruleShape:e=>`${e} must be { name, tool: { box, tool }, severity? }`,severity:e=>`${e} must be hard or soft`,sourcesList:(e,t)=>`${e} must be a list of at most ${t} sources`,layerList:e=>`${e} must be a list of layers`,oneOf:(e,t)=>`${e} must be one of ${t}`,tasksSelf:(e,t)=>`${e} must be 1 to ${t} kinds of task`,tasksRecord:e=>`${e} can have only one kind of task when results go into plan records`,parentOrGroup:e=>`${e} can take a parent field or a group field, not both`,calendarsCount:(e,t)=>`${e} must be at most ${t} calendars`,boolean:e=>`${e} must be true or false`,recordOnlyRecord:e=>`${e} is only for results written into plan records`,recordRequired:e=>`${e} is required when results go into plan records`,days:e=>`${e} must be 1 to 365 days`,matchCount:(e,t)=>`${e} must be at most ${t} pairs of fields`,matchShape:e=>`${e} must be { from, to }`},Me=()=>fe({"zh-CN":wg,"en-US":kg}),$l=["self","record"],vg=["title","subtitleField","daysBefore","daysAfter","tick","timeZone","timeZoneVariable","resourceSelection"],$g=["label","popoverFields","color","tone","colorField","snap","selection","filters"],Sg=["result","tasks","resource","time","rules","plan"],eo=3,mr=3,Sl=4,jl=5,se=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Le=e=>typeof e=="string"&&e!=="";function Ue(e,t,n){return Object.keys(e).filter(o=>!t.includes(o)).map(o=>Me().noOption(n,o))}function Nd(e,t,n,o=10){const s=Me();return e===void 0?n?[s.required(t)]:[]:!Array.isArray(e)||e.length>o||!e.every(Le)?[s.namesList(t,o)]:[]}function H(e,t,n=!0){return e===void 0&&!n?[]:Le(e)?[]:[Me().name(t)]}function xd(e,t){const n=Me();return e===void 0?[]:Array.isArray(e)?e.flatMap((o,s)=>se(o)&&Le(o.field)&&zn.includes(o.op)?[]:[n.condition(`${t}[${s}]`)]):[n.conditionList(t)]}function gr(e,t,n){const o=Me();if(e===void 0)return n?[o.required(t)]:[];if(!se(e))return[o.object(t)];const s=[...Ue(e,["action","params"],t),...H(e.action,`${t}.action`)];if(e.params!==void 0)if(!se(e.params))s.push(o.object(`${t}.params`));else for(const[a,r]of Object.entries(e.params))(!se(r)||!((r.from==="param"||r.from==="field")&&Le(r.name)||r.from==="const"&&(typeof r.value=="string"||typeof r.value=="number")||r.from==="context"&&zs.includes(r.name)))&&s.push(o.paramFrom(`${t}.params.${a}`));return s}function Al(e,t){return Array.isArray(e)&&e.length>0&&e.length<=4&&e.every(Le)?[]:[Me().pathLength(t)]}function jg(e,t,n){const o=Me();if(!se(e))return[o.object(t)];const s=[...Ue(e,["objectType","assignField","start","end","status","titleFields","doneWhen","groupField","target","ready","predecessors","modify","rules"],t),...H(e.objectType,`${t}.objectType`),...H(e.assignField,`${t}.assignField`,n),...H(e.start,`${t}.start`,n),...H(e.end,`${t}.end`,n),...H(e.status,`${t}.status`,!1),...H(e.groupField,`${t}.groupField`,!1),...Nd(e.titleFields,`${t}.titleFields`,!1,4),...xd(e.doneWhen,`${t}.doneWhen`),...gr(e.modify,`${t}.modify`,!1)];if(e.target!==void 0&&(se(e.target)?(s.push(...H(e.target.field,`${t}.target.field`)),e.target.path!==void 0&&s.push(...Al(e.target.path,`${t}.target.path`))):s.push(o.targetShape(`${t}.target`))),e.ready!==void 0&&(se(e.ready)?s.push(...Al(e.ready.path,`${t}.ready.path`),...H(e.ready.field,`${t}.ready.field`)):s.push(o.readyShape(`${t}.ready`))),e.predecessors!==void 0){const a=se(e.predecessors)?e.predecessors.path:void 0;(!Array.isArray(a)||a.length!==1||!Le(a[0]))&&s.push(o.onePath(`${t}.predecessors.path`))}return e.rules!==void 0&&(!Array.isArray(e.rules)||e.rules.length>jl?s.push(o.rulesCount(`${t}.rules`,jl)):e.rules.forEach((a,r)=>{const l=se(a)?a.tool:void 0;!se(a)||!Le(a.name)||!se(l)||!Le(l.box)||!Le(l.tool)?s.push(o.ruleShape(`${t}.rules[${r}]`)):a.severity!==void 0&&a.severity!=="hard"&&a.severity!=="soft"&&s.push(o.severity(`${t}.rules[${r}].severity`))})),s}function Tl(e,t,n){return e===void 0?[]:Array.isArray(e)&&e.length<=n&&e.every(o=>typeof o=="string")?[]:[Me().sourcesList(t,n)]}function Ag(e,t){return e===void 0?[]:se(e)?[...Ue(e,["tasks","resource","calendars","plan"],t),...Tl(e.tasks,`${t}.tasks`,eo),...H(e.resource,`${t}.resource`,!1),...Tl(e.calendars,`${t}.calendars`,mr),...H(e.plan,`${t}.plan`,!1)]:[Me().object(t)]}function Tg(e,t){if(e===void 0)return[];const n=Me();if(!se(e))return[n.object(t)];const o=Ue(e,["resource","demand"],t);for(const s of["resource","demand"]){const a=e[s];if(a!==void 0){if(!se(a)){o.push(n.object(`${t}.${s}`));continue}o.push(...Ue(a,[...vg,"layers"],`${t}.${s}`)),a.layers!==void 0&&(!Array.isArray(a.layers)||a.layers.length>12?o.push(n.layerList(`${t}.${s}.layers`)):a.layers.forEach((r,l)=>{se(r)?o.push(...Ue(r,$g,`${t}.${s}.layers[${l}]`)):o.push(n.object(`${t}.${s}.layers[${l}]`))}))}}return o}function Og(e,t="scheduleModel"){const n=Me();if(!se(e))return[n.object(t)];const o=Ue(e,["result","tasks","resource","calendars","record","sources","display"],t);o.push(...Ag(e.sources,`${t}.sources`),...Tg(e.display,`${t}.display`)),$l.includes(e.result)||o.push(n.oneOf(`${t}.result`,$l.join(n.joiner)));const s=e.result==="self",a=s?eo:1;!Array.isArray(e.tasks)||e.tasks.length===0||e.tasks.length>a?o.push(s?n.tasksSelf(`${t}.tasks`,eo):n.tasksRecord(`${t}.tasks`)):e.tasks.forEach((c,i)=>o.push(...jg(c,`${t}.tasks[${i}]`,s)));const r=e.resource;se(r)?(o.push(...Ue(r,["objectType","titleField","parentField","groupField","capacityField"],`${t}.resource`),...H(r.objectType,`${t}.resource.objectType`),...H(r.titleField,`${t}.resource.titleField`),...H(r.parentField,`${t}.resource.parentField`,!1),...H(r.groupField,`${t}.resource.groupField`,!1),...H(r.capacityField,`${t}.resource.capacityField`,!1)),r.parentField!==void 0&&r.groupField!==void 0&&o.push(n.parentOrGroup(`${t}.resource`))):o.push(n.object(`${t}.resource`)),e.calendars!==void 0&&(!Array.isArray(e.calendars)||e.calendars.length>mr?o.push(n.calendarsCount(`${t}.calendars`,mr)):e.calendars.forEach((c,i)=>{const d=`${t}.calendars[${i}]`;return se(c)?(o.push(...Ue(c,["objectType","resourceField","start","end","inherit"],d),...H(c.objectType,`${d}.objectType`),...H(c.resourceField,`${d}.resourceField`),...H(c.start,`${d}.start`),...H(c.end,`${d}.end`)),c.inherit!==void 0&&typeof c.inherit!="boolean"&&o.push(n.boolean(`${d}.inherit`)),o):o.push(n.object(d))}));const l=e.record;if(s)l!==void 0&&o.push(n.recordOnlyRecord(`${t}.record`));else if(!se(l))o.push(n.recordRequired(`${t}.record`));else{const c=`${t}.record`;o.push(...Ue(l,["objectType","match","resourceField","start","end","status","titleFields","active","create","modify","days","daysField"],c),...H(l.objectType,`${c}.objectType`),...H(l.resourceField,`${c}.resourceField`,!1),...H(l.start,`${c}.start`),...H(l.end,`${c}.end`),...H(l.status,`${c}.status`,!1),...Nd(l.titleFields,`${c}.titleFields`,!1,4),...H(l.daysField,`${c}.daysField`,!1),...l.days!==void 0&&(typeof l.days!="number"||!(l.days>0)||l.days>365)?[n.days(`${c}.days`)]:[],...xd(l.active,`${c}.active`),...gr(l.create,`${c}.create`,!1),...gr(l.modify,`${c}.modify`,!1)),l.match!==void 0&&(!Array.isArray(l.match)||l.match.length>Sl?o.push(n.matchCount(`${c}.match`,Sl)):l.match.forEach((i,d)=>{(!se(i)||!Le(i.from)||!Le(i.to))&&o.push(n.matchShape(`${c}.match[${d}]`))}))}return o}const Eg={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,notBoth:e=>`${e} 不能同时是 Cypher 数据源和事件数据源`,mustBe:(e,t)=>`${e} 必须是 ${t}`,typesList:e=>`${e} 必须是事件类型 id 列表`},Cg={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,notBoth:e=>`${e} cannot be both a Cypher source and an event source`,mustBe:(e,t)=>`${e} must be ${t}`,typesList:e=>`${e} must be a list of event type ids`},Ng=()=>fe({"zh-CN":Eg,"en-US":Cg}),xg="events:",yr="event_id",br=e=>`${xg}${e}`,Rg=[{name:"event_id",label:"事件 ID",type:"text"},{name:"title",label:"标题",type:"text"},{name:"event_type",label:"事件类型",type:"text"},{name:"severity",label:"严重程度",type:"text"},{name:"status",label:"状态",type:"text"},{name:"open",label:"是否未关闭",type:"text"},{name:"overdue",label:"是否超时",type:"text"},{name:"source",label:"来源",type:"text"},{name:"occurred_at",label:"发生时间",type:"date"},{name:"ended_at",label:"结束时间",type:"date"},{name:"recorded_at",label:"记录时间",type:"date"},{name:"object",label:"关联对象",type:"text"},{name:"object_key",label:"关联对象标识",type:"text"},{name:"reported_by",label:"报告人",type:"text"},{name:"verified_by",label:"核实人",type:"text"}];function _g(e,t){return{id:br(e),name:t,primaryKeys:[yr],displayKey:"title",properties:Rg}}function Pg(e,t){const n=Ng(),o=[],s=e.events;if(typeof s!="object"||s===null||Array.isArray(s))return[n.object(`${t}.events`)];e.cypher!==void 0&&o.push(n.notBoth(t)),e.objectType!==br(String(e.id))&&o.push(n.mustBe(`${t}.objectType`,br(String(e.id)))),e.key!==yr&&o.push(n.mustBe(`${t}.key`,yr));const a=s.types;a!==void 0&&!(Array.isArray(a)&&a.every(r=>typeof r=="string"))&&o.push(n.typesList(`${t}.events.types`));for(const r of Object.keys(s))r!=="types"&&o.push(n.noOption(`${t}.events`,r));return o}const Lg={joiner:"、",list:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,idFormat:e=>`${e} 必须是字母开头的标识`,idTwice:(e,t)=>`${e} 重复:${t}`,label:e=>`${e} 必须是不超过 30 字的名称`,oneOf:(e,t)=>`${e} 只能是 ${t}`,unit:e=>`${e} 必须是不超过 10 字的文字`,text:e=>`${e} 必须是文字`,number:e=>`${e} 必须是数值`,minAboveMax:e=>`${e} 不能大于 max`,outOfRange:e=>`${e} 超出范围`,rangeOnlyNumber:e=>`${e} 只有数值参数能设范围`,dayDate:e=>`${e} 必须是 YYYY-MM-DD 日期`,optionsOnlyText:e=>`${e} 只有文本参数能列可选值`,optionsCount:(e,t)=>`${e} 必须是 2 到 ${t} 个可选值`,required:e=>`${e} 必填`,scenarioName:e=>`${e} 必须是不超过 40 字的方案名`,defaultInOptions:e=>`${e} 必须是可选值之一`,saveAsName:e=>`${e} 必填:保存为知识网络对象时的对象类名称`,saveAsNameLong:(e,t)=>`${e} 不能超过 ${t} 个字`,outputTooLong:(e,t,n)=>`${e} 的字段 ${t} 超过 ${n} 个字符,不能保存为对象属性`,outputFixedName:(e,t)=>`${e} 的字段 ${t} 与结果行的固定字段同名,请改名`,objectTypeMustBe:(e,t)=>`${e} 必须是 ${t}`,notForModelSource:e=>`${e} 不能用于模型结果数据源`,tool:e=>`${e} 必须写明执行工厂的工具箱 box 与工具 tool`,inputsCount:(e,t)=>`${e} 必须是 1 到 ${t} 个输入`,inputSource:e=>`${e} 必须是页面的其他数据源`,inputBaseMissing:e=>`${e} 的来源数据源不存在`,inputEvents:e=>`${e} 不能是事件数据源`,inputFollows:e=>`${e} 是跟随筛选的子集,模型的输入不能跟随筛选`,inputQueryParam:(e,t)=>`${e} 的查询参数 $${t} 只能绑定基准日期`,inputFieldsEmpty:e=>`${e} 至少传一个字段`,inputField:e=>`${e} 必须是该数据源的字段`,inputsLoop:e=>`${e} 形成了循环:模型结果数据源不能读到自己`,paramsCount:(e,t)=>`${e} 必须是不超过 ${t} 个参数`,notScenarioParam:e=>`${e} 不是方案参数`,paramTypeDiffers:(e,t)=>`${e} 的类型是 ${t},与参数类型不同`,paramNoValue:e=>`${e} 取方案参数时不写固定值 value`,paramValue:e=>`${e} 必须是与类型相符的固定值,或改取方案参数 param`,outputsCount:(e,t)=>`${e} 必须是行标识加 1 到 ${t} 个字段`,keyMustBeOutput:e=>`${e} 必须是模型的一个输出字段(行标识)`,knObjectType:e=>`${e} 必须是知识网络中的对象类`,mustBeModelOutput:e=>`${e} 必须是模型的输出字段`,actionTarget:e=>`${e} 只能是 object(对这个对象执行)或 new(按新对象执行)`,actionType:e=>`${e} 不是知识网络中的行动类型`,actionObjectType:(e,t)=>`${e} 必须作用于对应对象的对象类 ${t}`,actionNewIsAdd:e=>`${e} 按新对象执行须是新增类行动`,prefix:(e,t)=>`${e} 必须是不超过 ${t} 字的编号前缀`,keyField:(e,t)=>`${e} 必须是 ${t} 的主键`,notPropertyOf:(e,t)=>`${e} 不是 ${t} 的属性`,numberField:e=>`${e} 是编号字段,取新编号`,mustTakeOutput:e=>`${e} 必须取模型的输出字段`,mustGive:e=>`${e} 必须给出:新建对象时这个属性必须有值,取模型的输出字段,或在 action.params 里给出来源`,notUserParam:e=>`${e} 不是该行动的用户填写参数`,fieldsAtLeastOne:e=>`${e} 至少要有一个字段`,fieldNameEmpty:e=>`${e} 的字段名不能为空`,textOrNumber:e=>`${e} 必须是文字或数值`,fromFieldOrConst:e=>`${e} 只能是 field 或 const`},Ig={joiner:", ",list:(e,t)=>`${e} must be a list of at most ${t} items`,object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,idFormat:e=>`${e} must be an identifier starting with a letter`,idTwice:(e,t)=>`${e} is used twice: ${t}`,label:e=>`${e} must be a name of at most 30 characters`,oneOf:(e,t)=>`${e} must be one of ${t}`,unit:e=>`${e} must be text of at most 10 characters`,text:e=>`${e} must be text`,number:e=>`${e} must be a number`,minAboveMax:e=>`${e} cannot be greater than max`,outOfRange:e=>`${e} is out of range`,rangeOnlyNumber:e=>`${e}: only a number parameter can have a range`,dayDate:e=>`${e} must be a date in YYYY-MM-DD`,optionsOnlyText:e=>`${e}: only a text parameter can list options`,optionsCount:(e,t)=>`${e} must list 2 to ${t} options`,required:e=>`${e} is required`,scenarioName:e=>`${e} must be a scenario name of at most 40 characters`,defaultInOptions:e=>`${e} must be one of the options`,saveAsName:e=>`${e} is required: the object type name when saved as a knowledge network object`,saveAsNameLong:(e,t)=>`${e} cannot be longer than ${t} characters`,outputTooLong:(e,t,n)=>`field ${t} of ${e} is longer than ${n} characters and cannot be saved as an object property`,outputFixedName:(e,t)=>`field ${t} of ${e} has the same name as a fixed field of the result row, please rename it`,objectTypeMustBe:(e,t)=>`${e} must be ${t}`,notForModelSource:e=>`${e} cannot be used on a model result source`,tool:e=>`${e} must name the execution factory toolbox (box) and tool`,inputsCount:(e,t)=>`${e} must list 1 to ${t} inputs`,inputSource:e=>`${e} must be another source of the page`,inputBaseMissing:e=>`the source that ${e} comes from does not exist`,inputEvents:e=>`${e} cannot be an event source`,inputFollows:e=>`${e} is a subset that follows filters, and the inputs of a model cannot follow filters`,inputQueryParam:(e,t)=>`query parameter $${t} of ${e} can only be bound to the base date`,inputFieldsEmpty:e=>`${e} must send at least one field`,inputField:e=>`${e} must be a field of that source`,inputsLoop:e=>`${e} form a loop: a model result source cannot read itself`,paramsCount:(e,t)=>`${e} must be at most ${t} parameters`,notScenarioParam:e=>`${e} is not a scenario parameter`,paramTypeDiffers:(e,t)=>`${e} has type ${t}, which differs from the parameter type`,paramNoValue:e=>`${e} takes a scenario parameter, so it must not have a fixed value`,paramValue:e=>`${e} must be a fixed value of the matching type, or take a scenario parameter with param`,outputsCount:(e,t)=>`${e} must be a row id plus 1 to ${t} fields`,keyMustBeOutput:e=>`${e} must be an output field of the model (the row id)`,knObjectType:e=>`${e} must be an object type of the knowledge network`,mustBeModelOutput:e=>`${e} must be an output field of the model`,actionTarget:e=>`${e} must be object (act on this object) or new (act on a new object)`,actionType:e=>`${e} is not an action type of the knowledge network`,actionObjectType:(e,t)=>`${e} must act on the object type ${t} of the object`,actionNewIsAdd:e=>`${e} must be an add action to act on a new object`,prefix:(e,t)=>`${e} must be a number prefix of at most ${t} characters`,keyField:(e,t)=>`${e} must be the primary key of ${t}`,notPropertyOf:(e,t)=>`${e} is not a property of ${t}`,numberField:e=>`${e} is the number field and takes the new number`,mustTakeOutput:e=>`${e} must take an output field of the model`,mustGive:e=>`${e} is required: this property must have a value when the object is created, so take an output field of the model or give its source in action.params`,notUserParam:e=>`${e} is not a parameter the user fills in for this action`,fieldsAtLeastOne:e=>`${e} must have at least one field`,fieldNameEmpty:e=>`a field name of ${e} cannot be empty`,textOrNumber:e=>`${e} must be text or a number`,fromFieldOrConst:e=>`${e} must be field or const`},bo=()=>fe({"zh-CN":Lg,"en-US":Ig}),Mg="model:",wr=e=>`${Mg}${e}`,Ol=5,El=5,Cl=8,Nl=10,xl=10,Rl=20,qn=/^[A-Za-z][A-Za-z0-9_]*$/,Rd=/^\d{4}-\d{2}-\d{2}$/,lt=["number","date","text"],te=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function _d(e){const t=Array.isArray(e.model?.outputs)?e.model.outputs:[],n=typeof e.key=="string"?e.key:"";return{id:wr(e.id),name:typeof e.label=="string"?e.label:e.id,primaryKeys:n?[n]:[],displayKey:n,properties:t.filter(o=>o&&typeof o.name=="string").map(o=>({name:o.name,label:typeof o.label=="string"&&o.label?o.label:o.name,type:lt.includes(o.type)?o.type:"text"}))}}function qg(e,t){return e.find(o=>o.id===t)?.from?.source??t}function _l(e,t){const n=new Set(e.filter(a=>a.model).map(a=>a.id)),s=(Array.isArray(t.model?.inputs)?t.model.inputs:[]).filter(a=>te(a)&&typeof a.source=="string").map(a=>qg(e,a.source)).filter(a=>n.has(a));return[...new Set(s)]}function Fg(e,t="scenarioParams"){if(e===void 0)return[];const n=bo();if(!Array.isArray(e)||e.length>Nl)return[n.list(t,Nl)];const o=new Set;return e.flatMap((s,a)=>{const r=`${t}[${a}]`;if(!te(s))return[n.object(r)];const l=Object.keys(s).filter(c=>!["name","label","type","unit","default","description","min","max","options"].includes(c)).map(c=>n.noOption(r,c));if(typeof s.name!="string"||!qn.test(s.name)?l.push(n.idFormat(`${r}.name`)):o.has(s.name)?l.push(n.idTwice(`${r}.name`,s.name)):o.add(s.name),(typeof s.label!="string"||!s.label.trim()||s.label.length>30)&&l.push(n.label(`${r}.label`)),!lt.includes(s.type))return[...l,n.oneOf(`${r}.type`,lt.join(n.joiner))];if(s.unit!==void 0&&(typeof s.unit!="string"||s.unit.length>10)&&l.push(n.unit(`${r}.unit`)),s.description!==void 0&&typeof s.description!="string"&&l.push(n.text(`${r}.description`)),s.type==="number"){(typeof s.default!="number"||!Number.isFinite(s.default))&&l.push(n.number(`${r}.default`));for(const c of["min","max"])s[c]!==void 0&&typeof s[c]!="number"&&l.push(n.number(`${r}.${c}`));typeof s.min=="number"&&typeof s.max=="number"&&s.min>s.max?l.push(n.minAboveMax(`${r}.min`)):typeof s.default=="number"&&(typeof s.min=="number"&&s.default<s.min||typeof s.max=="number"&&s.default>s.max)&&l.push(n.outOfRange(`${r}.default`))}else(s.min!==void 0||s.max!==void 0)&&l.push(n.rangeOnlyNumber(r)),s.type==="date"&&(typeof s.default!="string"||!Rd.test(s.default))&&l.push(n.dayDate(`${r}.default`)),s.type==="text"&&typeof s.default!="string"&&l.push(n.text(`${r}.default`));if(s.options!==void 0){const c=Array.isArray(s.options)?s.options:null;if(s.type!=="text")l.push(n.optionsOnlyText(`${r}.options`));else if(!c||c.length<2||c.length>xl)l.push(n.optionsCount(`${r}.options`,xl));else{const i=new Set;c.forEach((d,h)=>{const u=`${r}.options[${h}]`;return!te(d)||typeof d.value!="string"||!d.value.trim()?l.push(n.required(`${u}.value`)):(i.has(d.value)&&l.push(n.idTwice(`${u}.value`,d.value)),i.add(d.value),d.scenario!==void 0&&(typeof d.scenario!="string"||d.scenario.length>40)&&l.push(n.scenarioName(`${u}.scenario`)),l)}),typeof s.default=="string"&&!i.has(s.default)&&l.push(n.defaultInOptions(`${r}.default`))}}return l})}function Dg(e,t,n){const o=e.find(r=>r.id===t),s=o?.from?e.find(r=>r.id===o.from?.source):o;if(!o||!s)return[];const a=o.from?{...s,id:o.id,from:o.from}:o;return he(a,n).filter(r=>r.name!==rn)}const Pl=128,Ll=40,Bg=["result_id","row_key","scenario_id","scenario_name","run_id","as_of","computed_at","app_id","source_id"];function Ug(e,t,n){const o=bo(),s=`${n}.model.saveAs`;if(!te(e))return[o.object(s)];const a=Object.keys(e).filter(l=>l!=="name").map(l=>o.noOption(s,l)),r=typeof e.name=="string"?e.name.trim():"";r?[...r].length>Pl&&a.push(o.saveAsNameLong(`${s}.name`,Pl)):a.push(o.saveAsName(`${s}.name`));for(const l of t)l.length>Ll&&a.push(o.outputTooLong(`${n}.model.outputs`,l,Ll)),Bg.includes(l)&&a.push(o.outputFixedName(`${n}.model.outputs`,l));return a}function zg(e,t,n){const{sources:o,kn:s,variables:a,scenarioParams:r}=t,l=bo(),c=e.model;if(!te(c))return[l.object(`${n}.model`)];const i=Object.keys(c).filter(m=>!["tool","inputs","params","outputs","landing","saveAs"].includes(m)).map(m=>l.noOption(`${n}.model`,m));e.objectType!==wr(e.id)&&i.push(l.objectTypeMustBe(`${n}.objectType`,wr(e.id)));for(const m of["cypher","events","from","models","follows","relatedTo","computed","progress"])e[m]!==void 0&&i.push(l.notForModelSource(`${n}.${m}`));const d=te(c.tool)?c.tool:null;!d||typeof d.box!="string"||!d.box||typeof d.tool!="string"?i.push(l.tool(`${n}.model.tool`)):d.tool||i.push(l.required(`${n}.model.tool.tool`));const h=Array.isArray(c.inputs)?c.inputs:null;if(!h||h.length===0||h.length>Ol)i.push(l.inputsCount(`${n}.model.inputs`,Ol));else{const m=new Set;h.forEach((y,b)=>{const k=`${n}.model.inputs[${b}]`;if(!te(y))return i.push(l.object(k));typeof y.name!="string"||!qn.test(y.name)?i.push(l.idFormat(`${k}.name`)):m.has(y.name)?i.push(l.idTwice(`${k}.name`,y.name)):m.add(y.name);const w=o.find(j=>j.id===y.source);if(!w||w.id===e.id)return i.push(l.inputSource(`${k}.source`));const v=w.from?o.find(j=>j.id===w.from?.source):w;if(!v)return i.push(l.inputBaseMissing(`${k}.source`));if(v.events)return i.push(l.inputEvents(`${k}.source`));if(w.from?.filters?.length&&i.push(l.inputFollows(`${k}.source`)),v.cypher)for(const[j,O]of Object.entries(v.cypher.params??{}))a.find(E=>E.name===O)?.kind!=="asOf"&&i.push(l.inputQueryParam(`${k}.source`,j));const S=new Set(Dg(o,w.id,s).map(j=>j.name));return!Array.isArray(y.fields)||y.fields.length===0?i.push(l.inputFieldsEmpty(`${k}.fields`)):y.fields.forEach((j,O)=>{(typeof j!="string"||!S.has(j))&&i.push(l.inputField(`${k}.fields[${O}]`))}),i});const g=y=>{const b=new Set,k=w=>{if(w===e.id)return!0;if(b.has(w))return!1;b.add(w);const v=o.find(S=>S.id===w);return v?.model?_l(o,v).some(k):!1};return k(y)};_l(o,e).some(g)&&i.push(l.inputsLoop(`${n}.model.inputs`))}const u=c.params===void 0?[]:Array.isArray(c.params)?c.params:null;if(!u||u.length>El)i.push(l.paramsCount(`${n}.model.params`,El));else{const m=new Set;u.forEach((g,y)=>{const b=`${n}.model.params[${y}]`;if(!te(g))return i.push(l.object(b));if(typeof g.name!="string"||!qn.test(g.name)?i.push(l.idFormat(`${b}.name`)):m.has(g.name)?i.push(l.idTwice(`${b}.name`,g.name)):m.add(g.name),!lt.includes(g.type))return i.push(l.oneOf(`${b}.type`,lt.join(l.joiner)));if(g.param!==void 0){const k=r.find(w=>w.name===g.param);k?k.type!==g.type&&i.push(l.paramTypeDiffers(`${b}.param`,k.type)):i.push(l.notScenarioParam(`${b}.param`)),g.value!==void 0&&i.push(l.paramNoValue(b))}else(g.type==="number"?typeof g.value!="number":typeof g.value!="string"||g.type==="date"&&!Rd.test(g.value))&&i.push(l.paramValue(`${b}.value`));return i})}const p=Array.isArray(c.outputs)?c.outputs:null,f=new Set;return!p||p.length<2||p.length>Cl+1?i.push(l.outputsCount(`${n}.model.outputs`,Cl)):p.forEach((m,g)=>{const y=`${n}.model.outputs[${g}]`;return te(m)?(typeof m.name!="string"||!qn.test(m.name)?i.push(l.idFormat(`${y}.name`)):f.has(m.name)?i.push(l.idTwice(`${y}.name`,m.name)):f.add(m.name),(typeof m.label!="string"||!m.label.trim())&&i.push(l.required(`${y}.label`)),lt.includes(m.type)||i.push(l.oneOf(`${y}.type`,lt.join(l.joiner))),i):i.push(l.object(y))}),p&&!f.has(String(e.key))&&i.push(l.keyMustBeOutput(`${n}.key`)),c.landing!==void 0&&i.push(...Wg(c.landing,e,s,n)),c.saveAs!==void 0&&i.push(...Ug(c.saveAs,f,n)),i}function Wg(e,t,n,o){const s=bo(),a=`${o}.model.landing`;if(!te(e))return[s.object(a)];const r=[],l=_d(t).properties,c=new Set(l.map(f=>f.name));e.when!==void 0&&r.push(...xe(e.when,l,`${a}.when`));const i=te(e.object)?e.object:null,d=typeof i?.type=="string"?i.type:"",h=d&&!d.includes(":")&&Object.hasOwn(n.objectTypes,d)?n.objectTypes[d]:void 0;if(h||r.push(s.knObjectType(`${a}.object.type`)),(!i||typeof i.field!="string"||!c.has(i.field))&&r.push(s.mustBeModelOutput(`${a}.object.field`)),e.action===void 0)return r;const u=te(e.action)?e.action:null;if(!u||typeof u.id!="string")return[...r,s.required(`${a}.action.id`)];if(["object","new"].includes(String(u.target))||r.push(s.actionTarget(`${a}.action.target`)),n.actionTypes===void 0)return r;const p=cn(n,u.id);if(!p)return[...r,s.actionType(`${a}.action.id`)];if(u.target==="object"&&h&&p.objectType!==h.id&&r.push(s.actionObjectType(`${a}.action.id`,h.id)),u.target==="new"){p.kind!=="add"&&r.push(s.actionNewIsAdd(`${a}.action.id`));const f=n.objectTypes[p.objectType],m=te(u.newObject)?u.newObject:null;if(!m||typeof m.prefix!="string"||!m.prefix.trim()||m.prefix.length>Rl)r.push(s.prefix(`${a}.action.newObject.prefix`,Rl));else if(f){const g=m.keyField??f.primaryKeys[0];if((typeof g!="string"||!f.primaryKeys.includes(g))&&r.push(s.keyField(`${a}.action.newObject.keyField`,f.id)),m.fields!==void 0)if(!te(m.fields))r.push(s.object(`${a}.action.newObject.fields`));else for(const[k,w]of Object.entries(m.fields))f.properties.some(v=>v.name===k)?k===g&&r.push(s.numberField(`${a}.action.newObject.fields.${k}`)):r.push(s.notPropertyOf(`${a}.action.newObject.fields.${k}`,f.id)),(typeof w!="string"||!c.has(w))&&r.push(s.mustTakeOutput(`${a}.action.newObject.fields.${k}`));const y=te(m.fields)?m.fields:{},b=te(u.params)?u.params:{};for(const k of p.inputs)k.property&&k.name!==g&&!Object.hasOwn(y,k.name)&&!Object.hasOwn(b,k.name)&&r.push(s.mustGive(`${a}.action.newObject.fields.${k.name}`))}}if(u.params!==void 0){if(!te(u.params))return[...r,s.object(`${a}.action.params`)];const f=(m,g)=>te(m)?m.from==="field"?c.has(String(m.name))?[]:[s.mustBeModelOutput(`${g}.name`)]:m.from==="const"?typeof m.value=="string"||typeof m.value=="number"?[]:[s.textOrNumber(`${g}.value`)]:[s.fromFieldOrConst(`${g}.from`)]:[s.object(g)];for(const[m,g]of Object.entries(u.params)){const y=`${a}.action.params.${m}`;if(!p.inputs.some(b=>b.name===m)){r.push(s.notUserParam(y));continue}if(!(te(g)&&g.from==="ask")){if(te(g)&&g.from==="item"){if(!te(g.fields)||Object.keys(g.fields).length===0)r.push(s.fieldsAtLeastOne(`${y}.fields`));else for(const[b,k]of Object.entries(g.fields))b.trim()||r.push(s.fieldNameEmpty(`${y}.fields`)),r.push(...f(k,`${y}.fields.${b}`));continue}r.push(...f(g,y))}}}return r}const Kg={object:e=>`${e}.cypher 必须是对象`,objectType:(e,t)=>`${e}.objectType 必须是 ${t}`,queryRequired:e=>`${e}.cypher.query 必填`,readOnly:e=>`${e}.cypher.query 只能是只读查询,不能写数据`,columnsMin:e=>`${e}.cypher.columns 至少要有一列`,nameRequired:e=>`${e}.name 必填`,nameTwice:(e,t)=>`${e}.name ${t} 重复`,columnType:e=>`${e}.type 只能是 date、number、text`,unbound:(e,t)=>`${e} 查询里的 $${t} 没有绑定页面变量`,notVariable:(e,t)=>`${e}.cypher.params.${t} 不是页面变量`,badKind:(e,t,n)=>`${e}.cypher.params.${t} 不能绑定 ${n} 变量`},Yg={object:e=>`${e}.cypher must be an object`,objectType:(e,t)=>`${e}.objectType must be ${t}`,queryRequired:e=>`${e}.cypher.query is required`,readOnly:e=>`${e}.cypher.query must be a read-only query, it cannot write data`,columnsMin:e=>`${e}.cypher.columns needs at least one column`,nameRequired:e=>`${e}.name is required`,nameTwice:(e,t)=>`${e}.name ${t} is used twice`,columnType:e=>`${e}.type must be one of date, number, text`,unbound:(e,t)=>`${e}: $${t} in the query is not bound to a page variable`,notVariable:(e,t)=>`${e}.cypher.params.${t} is not a page variable`,badKind:(e,t,n)=>`${e}.cypher.params.${t} cannot be bound to a ${n} variable`},Pd=()=>fe({"zh-CN":Kg,"en-US":Yg}),Gg="cypher:";function kr(e){return`${Gg}${e}`}const Hg=["asOf","value","search","selection"];function Ld(e,t){if(!Array.isArray(t))return e;const n={};for(const o of t){if(o&&typeof o.id=="string"&&o.events&&!o.cypher){const r=_g(o.id,typeof o.label=="string"?o.label:o.id);n[r.id]=r;continue}if(o&&typeof o.id=="string"&&o.model&&!o.cypher){const r=_d(o);n[r.id]=r;continue}if(!o||typeof o.id!="string"||!o.cypher)continue;const s=Array.isArray(o.cypher.columns)?o.cypher.columns:[],a=kr(o.id);n[a]={id:a,name:typeof o.label=="string"?o.label:o.id,primaryKeys:typeof o.key=="string"?[o.key]:[],displayKey:typeof o.key=="string"?o.key:"",properties:s.filter(r=>r&&typeof r.name=="string").map(r=>({name:r.name,label:typeof r.label=="string"&&r.label?r.label:r.name,type:["date","number","text"].includes(r.type)?r.type:"text"}))}}return Object.keys(n).length===0?e:{...e,objectTypes:{...e.objectTypes,...n}}}function Id(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`]*`/g,t=>" ".repeat(t.length))}function Vg(e){const t=[...Id(e).matchAll(/\$([A-Za-z_][A-Za-z0-9_]*)/g)].map(n=>n[1]);return[...new Set(t)]}const Jg=/\b(CREATE|MERGE|SET|DELETE|DETACH|REMOVE|DROP|CALL|LOAD|FOREACH)\b/i;function Zg(e,t){const n=Pd(),o=[],s=e.cypher;if(typeof s!="object"||s===null)return[n.object(t)];if(e.objectType!==kr(String(e.id))&&o.push(n.objectType(t,kr(String(e.id)))),typeof s.query!="string"||s.query.trim()===""?o.push(n.queryRequired(t)):Jg.test(Id(s.query))&&o.push(n.readOnly(t)),!Array.isArray(s.columns)||s.columns.length===0)o.push(n.columnsMin(t));else{const a=new Set;s.columns.forEach((r,l)=>{const c=`${t}.cypher.columns[${l}]`;if(typeof r?.name!="string"||r.name==="")return o.push(n.nameRequired(c));a.has(r.name)&&o.push(n.nameTwice(c,r.name)),a.add(r.name),["date","number","text"].includes(r.type)||o.push(n.columnType(c))})}return o}function Xg(e,t,n){if(!e.cypher)return[];const o=Pd(),s=[],a=e.cypher.params??{};for(const r of Vg(e.cypher.query))a[r]||s.push(o.unbound(n,r));for(const[r,l]of Object.entries(a)){const c=t.find(i=>i.name===l);c?Hg.includes(c.kind)||s.push(o.badKind(n,r,c.kind)):s.push(o.notVariable(n,r))}return s}new TextEncoder;const Qg=/\{([^{}]+)\}/g;function ey(e){return[...e.matchAll(Qg)].map(t=>t[1].trim())}const ty={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,identifier:e=>`${e} 必须是字母开头的标识`,duplicate:(e,t)=>`${e} 重复:${t}`,pathCount:(e,t)=>`${e} 必须是 1 到 ${t} 个关系类 id`,notPath:(e,t)=>`${e} 不是从 ${t} 出发、沿知识网络关系的路径`,pathEnd:(e,t,n)=>`${e} 终点是 ${t},应到 ${n}`,fromSource:e=>`${e} 必须是页面中的数据源`,fromLinkable:e=>`${e} 必须是知识网络对象类的数据源,不能是子集或查询`,list:(e,t)=>`${e} 必须是不超过 ${t} 项的列表`,dateProperty:(e,t)=>`${e} 必须是 ${t} 的日期属性`,notKey:e=>`${e} 不能是对象的主键或标识`,integerRange:(e,t)=>`${e} 必须是 -${t} 到 ${t} 的整数`,sameAsField:e=>`${e} 不能与 field 相同`},ny={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,identifier:e=>`${e} must be an identifier starting with a letter`,duplicate:(e,t)=>`${e} is used twice: ${t}`,pathCount:(e,t)=>`${e} must be 1 to ${t} relation type ids`,notPath:(e,t)=>`${e} is not a path from ${t} along relations of the knowledge network`,pathEnd:(e,t,n)=>`${e} ends at ${t}, but should end at ${n}`,fromSource:e=>`${e} must be a source of the page`,fromLinkable:e=>`${e} must be a source of an object type of the knowledge network, not a subset or a query`,list:(e,t)=>`${e} must be a list of at most ${t} items`,dateProperty:(e,t)=>`${e} must be a date property of ${t}`,notKey:e=>`${e} cannot be the primary key or identifier of the object`,integerRange:(e,t)=>`${e} must be an integer from -${t} to ${t}`,sameAsField:e=>`${e} cannot be the same as field`},wo=()=>fe({"zh-CN":ty,"en-US":ny}),vr=5,$r=3,to=3,no=365,oo=1439,Md=/^[A-Za-z][A-Za-z0-9_]*$/,qd=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),oy=e=>!e.from&&!e.cypher&&!e.events;function Fd(e,t,n,o,s){if(!t)return[];const a=wo();if(!Array.isArray(e)||e.length===0||e.length>to||!e.every(c=>typeof c=="string"))return[a.pathCount(s,to)];const r=ln(o,t.objectType,e);return r?r[r.length-1].to===n.objectType?[]:[a.pathEnd(s,Ju(o,t.objectType,e),n.objectType)]:[a.notPath(s,t.objectType)]}function Dd(e,t,n){const o=wo(),s=t.find(a=>a.id===e);return s?oy(s)?{source:s,errors:[]}:{errors:[o.fromLinkable(n)]}:{errors:[o.fromSource(n)]}}const Rs=(e,t,n)=>e.objectTypes[t]?.properties.find(o=>o.name===n&&o.type==="date");function sy(e,t,n,o,s){const a=wo();if(!Array.isArray(e)||e.length>vr)return[a.list(s,vr)];const r=o.objectTypes[t.objectType],l=new Set;return e.flatMap((c,i)=>{const d=`${s}[${i}]`;if(!qd(c))return[a.object(d)];const h=Object.keys(c).filter(p=>!["id","field","from","path","fromField","gapDays","gapMinutes","keepDuration"].includes(p)).map(p=>a.noOption(d,p));typeof c.id!="string"||!Md.test(c.id)?h.push(a.identifier(`${d}.id`)):l.has(c.id)?h.push(a.duplicate(`${d}.id`,c.id)):l.add(c.id),Rs(o,t.objectType,c.field)?(c.field===t.key||r?.primaryKeys.includes(String(c.field)))&&h.push(a.notKey(`${d}.field`)):h.push(a.dateProperty(`${d}.field`,t.objectType));const u=Dd(c.from,n,`${d}.from`);return h.push(...u.errors),h.push(...Fd(c.path,u.source,t,o,`${d}.path`)),u.source&&!Rs(o,u.source.objectType,c.fromField)&&h.push(a.dateProperty(`${d}.fromField`,u.source.objectType)),(typeof c.gapDays!="number"||!Number.isInteger(c.gapDays)||Math.abs(c.gapDays)>no)&&h.push(a.integerRange(`${d}.gapDays`,no)),c.gapMinutes!==void 0&&(typeof c.gapMinutes!="number"||!Number.isInteger(c.gapMinutes)||Math.abs(c.gapMinutes)>oo)&&h.push(a.integerRange(`${d}.gapMinutes`,oo)),c.keepDuration!==void 0&&(Rs(o,t.objectType,c.keepDuration)?c.keepDuration===c.field?h.push(a.sameAsField(`${d}.keepDuration`)):r?.primaryKeys.includes(c.keepDuration)&&h.push(a.notKey(`${d}.keepDuration`)):h.push(a.dateProperty(`${d}.keepDuration`,t.objectType))),h})}function ry(e,t,n,o,s){const a=wo();if(!Array.isArray(e)||e.length>$r)return[a.list(s,$r)];const r=new Set;return e.flatMap((l,c)=>{const i=`${s}[${c}]`;if(!qd(l))return[a.object(i)];const d=Object.keys(l).filter(u=>!["id","from","path"].includes(u)).map(u=>a.noOption(i,u));typeof l.id!="string"||!Md.test(l.id)?d.push(a.identifier(`${i}.id`)):r.has(l.id)?d.push(a.duplicate(`${i}.id`,l.id)):r.add(l.id);const h=Dd(l.from,n,`${i}.from`);return d.push(...h.errors),d.push(...Fd(l.path,h.source,t,o,`${i}.path`)),d})}const ay={notString:"default 必须是字符串",noDefault:e=>`${e} 变量不能有默认值`,asOf:"基准日期的默认值必须是 today 或 YYYY-MM-DD",dateRange:"日期区间的默认值必须是 YYYY-MM-DD..YYYY-MM-DD(可省略一端)"},iy={notString:"default must be a string",noDefault:e=>`a ${e} variable cannot have a default`,asOf:"the default of a base date must be today or YYYY-MM-DD",dateRange:"the default of a date range must be YYYY-MM-DD..YYYY-MM-DD (either end may be left out)"},ly=()=>fe({"zh-CN":ay,"en-US":iy}),cy="today",Il=/^\d{4}-\d{2}-\d{2}$/,dy=["asOf","value","dateRange","search"],uy="..";function hy(e){const t=e.default;if(t===void 0)return null;const n=ly();if(typeof t!="string")return n.notString;if(!dy.includes(e.kind))return n.noDefault(e.kind);switch(e.kind){case"asOf":return t===cy||Il.test(t)&&!Number.isNaN(Date.parse(t))?null:n.asOf;case"dateRange":{const o=t.split(uy);return o.length===2&&o.every(a=>a===""||Il.test(a))&&o.some(a=>a!=="")?null:n.dateRange}default:return null}}const so=2e3,py=["title","type","severity","object","occurredAt"],Ml="detail.",fy=/\{([A-Za-z_][A-Za-z0-9_]*(?:\.[^{}\s]*)?)\}/g,my=e=>py.includes(e)||e.startsWith(Ml)&&e.length>Ml.length;function gy(e){const t=[...e.matchAll(fy)].map(n=>n[1]);return[...new Set(t.filter(n=>!my(n)))]}const yy={object:e=>`${e} 必须是对象`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,required:e=>`${e} 必填`,boolean:e=>`${e} 必须是 true 或 false`,hours:(e,t)=>`${e} 必须是 1 分钟到 ${t} 小时之间的时长,以小时计,可精确到分钟(如 0.5 为 30 分钟)`,strategyActionsObject:e=>`${e} 必须是对象:处理方案 → { action, params? }`,notStrategy:e=>`${e} 不是这个事件类型的处理方案`,boundShape:e=>`${e} 必须是 { action, params? }`,noSubjectSource:(e,t)=>`${e} 要对事件的关联对象执行行动,应用里还没有「${t}」的数据源`,eventTypesList:()=>"eventTypes 必须是列表",unknownEventType:(e,t)=>`${e} 里的 ${t} 不是应用处理的事件类型`,inNetwork:e=>`${e} 在知识网络里设置:应用只配置怎样处理这类事件`,typeCode:e=>`${e} 必须是知识网络的事件类型编码:小写字母或数字开头,只含小写字母、数字、_、. 和 -,最长 64 个字符`,duplicate:e=>`事件类型 ${e} 重复`,owners:e=>`${e} 必须是最多 8 个角色名`,reportRule:e=>`${e} 只用于用户登记的事件`,strategies:e=>`${e} 必须是最多 12 个、每个不超过 40 字的处理方案名称`,groupingShape:e=>`${e} 必须是 { mode, by? }`,groupingMode:(e,t)=>`${e} 只能是 ${t.join("、")}`,groupingByOnly:e=>`${e} 只用于按属性归并`,groupingByName:e=>`${e} 必须是属性名`,groupingNoSource:(e,t)=>`${e} 按属性归并要从关联对象取值,应用里还没有「${t}」的数据源`,groupingByProperty:e=>`${e} 必须是关联对象的属性`,analysisPage:(e,t)=>`${e} 必须是应用的页面之一${t?`:${t.join("、")}`:""}`,analysisSelection:e=>`${e} 必须是选中对象筛选`,analysisSelectionOther:e=>`${e} 选中的是另一类对象,和事件关联的对象对不上`,analysisAsOfNone:e=>`${e} 页面没有基准日期`,analysisWindowShape:e=>`${e} 必须是 { variable, days }`,analysisWindowVariable:e=>`${e} 必须是日期区间筛选`,analysisWindowDays:e=>`${e} 必须是 1 到 365 的整数(天)`,mergeHours:e=>`${e} 是事件类型的合并窗口,在知识网络里设置`,fieldsList:e=>`${e} 必须是最多 12 项的列表`,fieldName:e=>`${e} 必须是小写字母开头的字段名`,fieldDuplicate:(e,t)=>`${e} ${t} 重复`,fieldType:(e,t)=>`${e} 只能是 ${t.join("、")}`,verifier:e=>`${e} 必须是角色名`,canvasText:(e,t)=>`${e} 必须是不超过 ${t} 字的文字`,canvasPlaceholder:(e,t)=>`${e} 里的 {${t}} 不是事件的值:可用 {title}、{type}、{severity}、{object}、{occurredAt} 与 {detail.<字段>}`},by={object:e=>`${e} must be an object`,noOption:(e,t)=>`${e} has no option ${t}`,required:e=>`${e} is required`,boolean:e=>`${e} must be true or false`,hours:(e,t)=>`${e} must be a length of time from 1 minute to ${t} hours, in hours, to the minute (0.5 is 30 minutes)`,strategyActionsObject:e=>`${e} must be an object: strategy -> { action, params? }`,notStrategy:e=>`${e} is not a strategy of this event type`,boundShape:e=>`${e} must be { action, params? }`,noSubjectSource:(e,t)=>`${e} runs an action on the event's object, but the app has no source for "${t}"`,eventTypesList:()=>"eventTypes must be a list",unknownEventType:(e,t)=>`${e} has ${t}, which is not an event type the app handles`,inNetwork:e=>`${e} is set in the knowledge network: the app only configures how events of this type are handled`,typeCode:e=>`${e} must be the event type code of the knowledge network: starts with a lowercase letter or digit, only lowercase letters, digits, _, . and -, at most 64 characters`,duplicate:e=>`event type ${e} is used twice`,owners:e=>`${e} must be at most 8 role names`,reportRule:e=>`${e} is only for events reported by users`,strategies:e=>`${e} must be at most 12 strategy names, each at most 40 characters`,groupingShape:e=>`${e} must be { mode, by? }`,groupingMode:(e,t)=>`${e} must be one of ${t.join(", ")}`,groupingByOnly:e=>`${e} is only for grouping by property`,groupingByName:e=>`${e} must be a property name`,groupingNoSource:(e,t)=>`${e} groups by a property of the event's object, but the app has no source for "${t}"`,groupingByProperty:e=>`${e} must be a property of the event's object`,analysisPage:(e,t)=>`${e} must be one of the app's pages${t?`: ${t.join(", ")}`:""}`,analysisSelection:e=>`${e} must be a selected-object filter`,analysisSelectionOther:e=>`${e} selects another kind of object than the one the event is about`,analysisAsOfNone:e=>`${e} the page has no as-of date`,analysisWindowShape:e=>`${e} must be { variable, days }`,analysisWindowVariable:e=>`${e} must be a date range filter`,analysisWindowDays:e=>`${e} must be an integer from 1 to 365 (days)`,mergeHours:e=>`${e} is the merge window of the event type: set it in the knowledge network`,fieldsList:e=>`${e} must be a list of at most 12 items`,fieldName:e=>`${e} must be a field name starting with a lowercase letter`,fieldDuplicate:(e,t)=>`${e} ${t} is used twice`,fieldType:(e,t)=>`${e} must be one of ${t.join(", ")}`,verifier:e=>`${e} must be a role name`,canvasText:(e,t)=>`${e} must be text of at most ${t} characters`,canvasPlaceholder:(e,t)=>`${e}: {${t}} is not a value of the event; use {title}, {type}, {severity}, {object}, {occurredAt} or {detail.<field>}`},bt=()=>fe({"zh-CN":yy,"en-US":by}),wy=/^[a-z0-9][a-z0-9_.-]{0,63}$/,ky=/^[a-z][a-z0-9_-]{0,39}$/,ql=720,vy=new Set(["id","owners","dueHours","report","analysis","grouping","strategies","strategyActions","canvas"]),$y=new Set(["label","source","subject","severity","rule"]),ze=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Sy=(e,t)=>e===void 0||typeof e=="number"&&Math.abs(e*60-Math.round(e*60))<1e-6&&e*60>=1&&e<=ql?[]:[bt().hours(t,ql)],Bd=(e,t)=>e.objectType&&t.kn.objectTypes[e.objectType]?.name||e.objectType||"";function jy(e,t,n,o){const s=bt();if(!ze(e.strategyActions))return[s.strategyActionsObject(o)];const a=Array.isArray(e.strategies)?e.strategies:[];return Object.entries(e.strategyActions).flatMap(([r,l])=>{const c=`${o}.${r}`;if(!a.includes(r))return[s.notStrategy(c)];if(!ze(l))return[s.boundShape(c)];const i=Object.keys(l).filter(d=>d!=="action"&&d!=="params");return i.length>0?i.map(d=>s.noOption(c,d)):t.network?t.subject?yc({on:"button",...l},{on:["button"],hit:!0},n,t.subject,c):[s.noSubjectSource(c,Bd(t,n))]:[]})}function Ay(e,t,n){const o=bt();if(e!==void 0&&!Array.isArray(e))return[o.eventTypesList()];const s=Array.isArray(e)?e:[],a=Qt(t.kn.eventTypes),r=new Set,l=new Set(s.map(i=>ze(i)?i.id:void 0));return[...t.spec.sources.flatMap((i,d)=>(i.events?.types??[]).filter(h=>!l.has(h)).map(h=>o.unknownEventType(`sources[${d}].events.types`,h))),...s.flatMap((i,d)=>{const h=`eventTypes[${d}]`;if(!ze(i))return[o.object(h)];const u=[];for(const f of Object.keys(i))$y.has(f)?u.push(o.inNetwork(`${h}.${f}`)):vy.has(f)||u.push(o.noOption(h,f));if(typeof i.id!="string"||!wy.test(i.id))return u.push(o.typeCode(`${h}.id`)),u;r.has(i.id)?u.push(o.duplicate(i.id)):r.add(i.id);const p=Fc(t.spec,i,a);return i.owners!==void 0&&!(Array.isArray(i.owners)&&i.owners.length<=8&&i.owners.every(f=>typeof f=="string"&&f.trim()!==""))&&u.push(o.owners(`${h}.owners`)),u.push(...Sy(i.dueHours,`${h}.dueHours`)),i.report!==void 0&&(p.source==="rule"?u.push(o.reportRule(`${h}.report`)):u.push(...Cy(i.report,`${h}.report`))),i.analysis!==void 0&&u.push(...Oy(i.analysis,p,t,n,`${h}.analysis`)),i.grouping!==void 0&&u.push(...Ty(i.grouping,p,t,`${h}.grouping`)),i.strategies!==void 0&&!(Array.isArray(i.strategies)&&i.strategies.length<=12&&i.strategies.every(f=>typeof f=="string"&&f.trim()!==""&&f.length<=40))&&u.push(o.strategies(`${h}.strategies`)),i.strategyActions!==void 0&&u.push(...jy(i,p,t,`${h}.strategyActions`)),i.canvas!==void 0&&u.push(...Ey(i.canvas,`${h}.canvas`)),u})]}function Ty(e,t,n,o){const s=bt();if(!ze(e))return[s.groupingShape(o)];const a=[];for(const l of Object.keys(e))l!=="mode"&&l!=="by"&&a.push(s.noOption(o,l));if(!Ks.includes(e.mode))return[...a,s.groupingMode(`${o}.mode`,Ks)];if(e.mode!=="property")return e.by!==void 0&&a.push(s.groupingByOnly(`${o}.by`)),a;if(typeof e.by!="string"||e.by.trim()==="")return[...a,s.groupingByName(`${o}.by`)];if(t.source!=="report")return a;const r=pe(n.spec,t.subject);return r?he(r,n.kn).some(l=>l.name===e.by)||a.push(s.groupingByProperty(`${o}.by`)):a.push(s.groupingNoSource(o,Bd(t,n))),a}function Oy(e,t,n,o,s){const a=bt();if(!ze(e))return[a.object(s)];const r=[];for(const c of Object.keys(e))["page","selection","asOf","window"].includes(c)||r.push(a.noOption(s,c));(typeof e.page!="string"||o&&!o.includes(e.page))&&r.push(a.analysisPage(`${s}.page`,o));const l=c=>n.spec.variables.find(i=>i.name===c);if(e.selection!==void 0){const c=l(e.selection);!c||c.kind!=="selection"?r.push(a.analysisSelection(`${s}.selection`)):t.network&&pe(n.spec,c.source)?.objectType!==t.objectType&&r.push(a.analysisSelectionOther(`${s}.selection`))}if(e.asOf!==void 0&&(typeof e.asOf!="boolean"?r.push(a.boolean(`${s}.asOf`)):e.asOf&&!n.spec.variables.some(c=>c.kind==="asOf")&&r.push(a.analysisAsOfNone(`${s}.asOf`))),e.window!==void 0){const c=e.window;if(!ze(c))r.push(a.analysisWindowShape(`${s}.window`));else{l(c.variable)?.kind!=="dateRange"&&r.push(a.analysisWindowVariable(`${s}.window.variable`));const i=c.days;(typeof i!="number"||!Number.isInteger(i)||i<1||i>365)&&r.push(a.analysisWindowDays(`${s}.window.days`))}}return r}function Ey(e,t){const n=bt();if(!ze(e))return[n.object(t)];const o=[];for(const[s,a]of Object.entries(e)){const r=`${t}.${s}`;if(s!=="prompt"&&s!=="question")o.push(n.noOption(t,s));else if(typeof a!="string"||a.length>so)o.push(n.canvasText(r,so));else for(const l of gy(a))o.push(n.canvasPlaceholder(r,l))}return o}function Cy(e,t){const n=bt();if(!ze(e))return[n.object(t)];const o=[];for(const a of Object.keys(e))a==="mergeHours"?o.push(n.mergeHours(`${t}.mergeHours`)):a!=="fields"&&a!=="verifier"&&o.push(n.noOption(t,a));const s=e.fields;if(!Array.isArray(s)||s.length>12)o.push(n.fieldsList(`${t}.fields`));else{const a=new Set;s.forEach((r,l)=>{const c=`${t}.fields[${l}]`;if(!ze(r))return o.push(n.object(c));typeof r.name!="string"||!ky.test(r.name)?o.push(n.fieldName(`${c}.name`)):a.has(r.name)?o.push(n.fieldDuplicate(`${c}.name`,r.name)):a.add(r.name),(typeof r.label!="string"||r.label.trim()==="")&&o.push(n.required(`${c}.label`)),Ws.includes(r.type)||o.push(n.fieldType(`${c}.type`,Ws)),r.required!==void 0&&typeof r.required!="boolean"&&o.push(n.boolean(`${c}.required`))})}return e.verifier!==void 0&&(typeof e.verifier!="string"||e.verifier.trim()==="")&&o.push(n.verifier(`${t}.verifier`)),o}const Ny={join:e=>e.join("、"),pageNotObject:"页面定义必须是对象",appNotObject:"App Spec 必须是对象",emptyApp:"应用至少要放一个组件",pagePrefix:(e,t)=>`页面 ${e}:${t}`,component:e=>`组件 ${e}`,object:e=>`${e} 必须是对象`,array:e=>`${e} 必须是数组`,required:e=>`${e} 必填`,identifier:e=>`${e} 必须是字母开头的标识`,nonEmptyString:e=>`${e} 必须是非空字符串`,oneOf:(e,t)=>`${e} 只能是 ${t}`,either:(e,t,n)=>`${e} 只能是 ${t} 或 ${n}`,integer:(e,t,n)=>`${e} 必须是 ${t} 到 ${n} 的整数`,noOption:(e,t)=>`${e} 没有配置项 ${t}`,notField:e=>`${e} 不是数据源的字段`,version:"version 必须为 2",apiVersion:e=>`apiVersion 必须为 ${e}`,appId:"app.id 必须是字母或数字开头的标识",knDependency:(e,t)=>`dependencies.knowledgeNetwork 必须引用知识网络 ${e}(${t})`,pagesMin:"pages 至少要有一个页面",pageTwice:e=>`页面 id ${e} 重复`,navShown:"至少要有一个页面在导航中显示",variableReserved:(e,t)=>`${e} 不能以 ${t} 开头,这是自动联动保留的名称`,linkPathShape:e=>`${e} 必须是 { between: [对象类, 对象类], path: [关系…] }`,linkPathType:(e,t)=>`${e} 中的对象类 ${t} 不在知识网络中`,linkPathBroken:e=>`${e}.path 不是从 between[0] 到 between[1] 的关系路径`,linkPathLong:(e,t)=>`${e}.path 最多 ${t} 个关系`,customType:e=>`${e}.type 必须是 x-<发布者>.<名称> 形式的自定义组件类型`,customTwice:e=>`自定义组件 ${e} 登记了两次`,packageId:e=>`${e}.package 必须是上传后得到的组件包 id`,asideWidth:"layout.asideWidth(或 0)",chartPaletteSize:"theme.chartPalette 必须有 6 到 8 个颜色",chartPaletteHex:"theme.chartPalette 中的颜色必须是 #rrggbb",fontFamily:"theme.fontFamily 必须是字体名称列表",hexColor:e=>`${e} 必须是 #rrggbb 颜色`,contrast:(e,t,n,o)=>`${e} 与 ${t} 对比度 ${n},需不低于 ${o}`,sourcesMin:"sources 至少要有一个数据源",sourceTwice:e=>`数据源 ${e} 重复`,notObjectType:e=>`${e}.objectType 不是知识网络中的对象类`,notProperty:(e,t)=>`${e}.key 不是 ${t} 的属性`,onlyObjectSources:e=>`${e} 只能用于知识网络对象类的数据源`,modelOperationAction:e=>`${e}.action 模型结果数据源上的推演操作不能关联行动,请用落地`,notScenarioParam:e=>`${e} 不是方案参数`,scenarioParamType:e=>`${e} 的类型与方案参数不同`,displayShape:e=>`${e} 必须是 { template, facts? }`,templateNeedsField:e=>`${e}.template 至少要用 {字段名} 引用一个字段`,templateNotField:(e,t)=>`${e}.template 中的 {${t}} 不是数据源的字段`,factsList:(e,t)=>`${e}.facts 必须是不超过 ${t} 个字段名的列表`,factsNotField:(e,t)=>`${e}.facts 中的 ${t} 不是数据源的字段`,formatsShape:e=>`${e} 必须是 { 字段名: 格式 } 的对象`,formatShape:e=>`${e} 必须是 { unit?, decimals?, colors? }`,unitText:e=>`${e}.unit 必须是不超过 8 字的文本`,unitNumber:e=>`${e}.unit 只有数字字段有单位`,decimalsInt:(e,t)=>`${e}.decimals 必须是 0 到 ${t} 的整数`,decimalsNumber:e=>`${e}.decimals 只有数字字段有小数位`,colorsList:e=>`${e}.colors 必须是 [{ when, tone }] 的列表`,ruleShape:e=>`${e} 必须是 { when, tone }`,fromShape:e=>`${e}.from 必须是 { source, where?, filters? }`,fromNotSource:(e,t)=>`${e}.from.source 不是页面数据源:${t}`,fromSubset:e=>`${e}.from.source 不能是另一个子集`,fromCypherParams:e=>`${e}.from.source 不能是带参数的 Cypher 数据源`,sameAsBase:(e,t,n)=>`${e}.${t} 必须与来源数据源一致:${n}`,derivedOwn:(e,t)=>`${e}.${t} 子集沿用来源数据源的,不能自己定义`,variableTwice:e=>`变量 ${e} 重复`,variableDefault:(e,t)=>`${e}.default:${t}`,variableSource:e=>`${e}.source 不是页面数据源`,variableNoLonger:e=>`${e} 不再需要:筛选不绑数据源,由跟随它的组件各自指定字段`,componentTwice:e=>`组件 id ${e} 重复`,noRegion:(e,t,n)=>`${e} 布局没有区域 ${t},可用区域:${n}`,customNoPackage:(e,t)=>`${e}.type ${t} 是自定义组件,但应用的 components 里没有它的组件包:先上传组件包`,typeOneOf:(e,t)=>`${e}.type 只能是 ${t},或 components 里登记的自定义组件`,pageEmpty:"页面至少要放一个组件",detailType:e=>`detail 必须是 type 为 ${e} 的组件`,frameShape:e=>`${e} 必须给出 x、y、w、h`,frameRight:(e,t)=>`${e} 超出右边界:x + w 不能大于 ${t}`,frameSmall:(e,t,n,o)=>`${e} 太小:${t} 至少 ${n} 列宽、${o} 行高`},xy={join:e=>e.join(", "),pageNotObject:"page definition must be an object",appNotObject:"App Spec must be an object",emptyApp:"the app needs at least one component",pagePrefix:(e,t)=>`page ${e}: ${t}`,component:e=>`component ${e}`,object:e=>`${e} must be an object`,array:e=>`${e} must be an array`,required:e=>`${e} is required`,identifier:e=>`${e} must be an identifier starting with a letter`,nonEmptyString:e=>`${e} must be a non-empty string`,oneOf:(e,t)=>`${e} must be one of ${t}`,either:(e,t,n)=>`${e} must be ${t} or ${n}`,integer:(e,t,n)=>`${e} must be an integer from ${t} to ${n}`,noOption:(e,t)=>`${e} has no option ${t}`,notField:e=>`${e} is not a field of the source`,version:"version must be 2",apiVersion:e=>`apiVersion must be ${e}`,appId:"app.id must be an identifier starting with a letter or digit",knDependency:(e,t)=>`dependencies.knowledgeNetwork must refer to knowledge network ${e} (${t})`,pagesMin:"pages needs at least one page",pageTwice:e=>`page id ${e} is used twice`,navShown:"at least one page must be shown in the navigation",variableReserved:(e,t)=>`${e} cannot start with ${t}, which default linkage uses`,linkPathShape:e=>`${e} must be { between: [object type, object type], path: [relations…] }`,linkPathType:(e,t)=>`${e} names object type ${t}, which is not in the network`,linkPathBroken:e=>`${e}.path is not a relation path from between[0] to between[1]`,linkPathLong:(e,t)=>`${e}.path may have at most ${t} relations`,customType:e=>`${e}.type must be a custom component type of the form x-<publisher>.<name>`,customTwice:e=>`custom component ${e} is registered twice`,packageId:e=>`${e}.package must be the id of an uploaded component package`,asideWidth:"layout.asideWidth (or 0)",chartPaletteSize:"theme.chartPalette must have 6 to 8 colors",chartPaletteHex:"theme.chartPalette colors must be #rrggbb",fontFamily:"theme.fontFamily must be a list of font names",hexColor:e=>`${e} must be a #rrggbb color`,contrast:(e,t,n,o)=>`${e} and ${t} have a contrast of ${n}, at least ${o} is needed`,sourcesMin:"sources needs at least one source",sourceTwice:e=>`source ${e} is used twice`,notObjectType:e=>`${e}.objectType is not an object type of the knowledge network`,notProperty:(e,t)=>`${e}.key is not a property of ${t}`,onlyObjectSources:e=>`${e} only applies to sources of knowledge network object types`,modelOperationAction:e=>`${e}.action: a scenario operation on a model result source cannot link an action, use landing`,notScenarioParam:e=>`${e} is not a scenario parameter`,scenarioParamType:e=>`${e} has a different type than the scenario parameter`,displayShape:e=>`${e} must be { template, facts? }`,templateNeedsField:e=>`${e}.template must refer to at least one field as {field name}`,templateNotField:(e,t)=>`{${t}} in ${e}.template is not a field of the source`,factsList:(e,t)=>`${e}.facts must be a list of at most ${t} field names`,factsNotField:(e,t)=>`${t} in ${e}.facts is not a field of the source`,formatsShape:e=>`${e} must be an object of { field name: format }`,formatShape:e=>`${e} must be { unit?, decimals?, colors? }`,unitText:e=>`${e}.unit must be text of at most 8 characters`,unitNumber:e=>`${e}.unit applies to number fields only`,decimalsInt:(e,t)=>`${e}.decimals must be an integer from 0 to ${t}`,decimalsNumber:e=>`${e}.decimals applies to number fields only`,colorsList:e=>`${e}.colors must be a list of [{ when, tone }]`,ruleShape:e=>`${e} must be { when, tone }`,fromShape:e=>`${e}.from must be { source, where?, filters? }`,fromNotSource:(e,t)=>`${e}.from.source is not a source of the page: ${t}`,fromSubset:e=>`${e}.from.source cannot be another subset`,fromCypherParams:e=>`${e}.from.source cannot be a Cypher source with parameters`,sameAsBase:(e,t,n)=>`${e}.${t} must match the source it comes from: ${n}`,derivedOwn:(e,t)=>`${e}.${t} is taken from the source the subset comes from and cannot be set here`,variableTwice:e=>`variable ${e} is used twice`,variableDefault:(e,t)=>`${e}.default: ${t}`,variableSource:e=>`${e}.source is not a source of the page`,variableNoLonger:e=>`${e} is no longer needed: a filter is not bound to a source, each component that follows it names its own field`,componentTwice:e=>`component id ${e} is used twice`,noRegion:(e,t,n)=>`${e} layout has no region ${t}, available regions: ${n}`,customNoPackage:(e,t)=>`${e}.type ${t} is a custom component, but components of the app has no component package for it: upload the component package first`,typeOneOf:(e,t)=>`${e}.type must be one of ${t}, or a custom component registered in components`,pageEmpty:"a page needs at least one component",detailType:e=>`detail must be a component of type ${e}`,frameShape:e=>`${e} must give x, y, w, h`,frameRight:(e,t)=>`${e} goes past the right edge: x + w must not exceed ${t}`,frameSmall:(e,t,n,o)=>`${e} is too small: ${t} needs at least ${n} columns wide and ${o} rows high`},ge=()=>fe({"zh-CN":Ny,"en-US":xy}),Fl="lk_",Dl=4,Bl=/^#[0-9a-fA-F]{6}$/,ko=/^[A-Za-z][A-Za-z0-9_-]{0,39}$/,Ry=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/,_y=["colorPrimary","colorAccent","colorBg","colorSurface","colorSurfaceAlt","colorBorder","colorText","colorTextMuted","colorSuccess","colorWarning","colorDanger","colorInfo"],Sr=4.5,jr=3;function Py(e,t,n={}){const o=ge(),s=[],a=c=>s.push(c);if(!K(e))return{ok:!1,errors:[o.pageNotObject]};const r=Ld(t,e.sources);if(e.version!==2&&a(o.version),(typeof e.title!="string"||e.title.trim()==="")&&a(o.nonEmptyString("title")),Fy(e.layout,a),Dy(e.theme,a),e.linking!==void 0&&!be(e.linking,ia)&&a(o.oneOf("linking",o.join(ia))),Jy(e.linkPaths,r,a),s.length>0)return{ok:!1,errors:s};if(By(e.sources,r,a,n.allowEmpty??!1),s.length>0)return{ok:!1,errors:s};if(Hy(e.variables,e,a),s.length>0)return{ok:!1,errors:s};if(e.sources.forEach((c,i)=>Xg(c,e.variables,`sources[${i}]`).forEach(a)),s.length>0)return{ok:!1,errors:s};if(Fg(e.scenarioParams).forEach(a),s.length>0)return{ok:!1,errors:s};if(Yy(e,r,a),s.length>0)return{ok:!1,errors:s};if(Gy(e,r,a),s.length>0)return{ok:!1,errors:s};const l=e;return Vy(e,{kn:r,spec:l},a,n.allowEmpty??!1),s.length>0?{ok:!1,errors:s}:{ok:!0,spec:l}}const Ly=()=>ge().emptyApp;function Iy(e,t,n={}){const o=ge();if(!K(e))return{ok:!1,errors:[o.appNotObject]};const s=[],a=u=>s.push(u);e.apiVersion!==pt&&a(o.apiVersion(String(pt)));const r=e.app;K(r)?((typeof r.id!="string"||!Ry.test(r.id))&&a(o.appId),(typeof r.name!="string"||r.name.trim()==="")&&a(o.nonEmptyString("app.name"))):a(o.object("app"));const l=K(e.dependencies)?e.dependencies.knowledgeNetwork:void 0;(!K(l)||l.id!==t.id)&&a(o.knDependency(t.id,t.name));const c=e.pages;if(!Array.isArray(c)||c.length===0)a(o.pagesMin);else{const u=new Set;c.forEach((p,f)=>{if(!K(p))return a(o.object(`pages[${f}]`));if(typeof p.id!="string"||!ko.test(p.id))return a(o.identifier(`pages[${f}].id`));u.has(p.id)&&a(o.pageTwice(p.id)),u.add(p.id)}),c.every(p=>K(p)&&p.hidden===!0)&&a(o.navShown)}if(My(e.components,a),s.length>0)return{ok:!1,errors:s};const i=e,d=new Set;if(i.pages.reduce((u,p)=>u+Object.values(p.regions??{}).reduce((f,m)=>f+(m?.length??0),0),0)===0&&!n.allowEmpty)return{ok:!1,errors:[Ly()]};if(!n.allowEmpty&&Array.isArray(i.sources)&&i.sources.length===0)return{ok:!1,errors:[o.sourcesMin]};for(const u of i.pages){const p=Py(Ka(i,u.id),t,{allowEmpty:!0});if(!p.ok)for(const f of p.errors)d.has(f)||(d.add(f),s.push(i.pages.length>1?o.pagePrefix(u.id,f):f))}return s.length>0?{ok:!1,errors:s}:(s.push(...Ay(e.eventTypes,{kn:Ld(t,i.sources),spec:Ka(i,i.pages[0].id)},i.pages.map(u=>u.id))),e.scheduleModel!==void 0&&s.push(...Og(e.scheduleModel)),s.length>0?{ok:!1,errors:s}:{ok:!0,app:i})}function My(e,t){if(e===void 0)return;const n=ge();if(!Array.isArray(e))return t(n.array("components"));const o=new Set;e.forEach((s,a)=>{const r=`components[${a}]`;if(!K(s))return t(n.object(r));if(!xt(s.type))return t(n.customType(r));o.has(s.type)&&t(n.customTwice(s.type)),o.add(s.type),(typeof s.package!="string"||!qy.test(s.package))&&t(n.packageId(r)),s.source!==void 0&&!be(s.source,["upload","ai"])&&t(n.either(`${r}.source`,"upload","ai"))})}const qy=/^[0-9a-f]{64}$/;function Fy(e,t){const n=ge();if(!K(e))return t(n.object("layout"));be(e.type,Is)||t(n.oneOf("layout.type",n.join(Is))),Ie(e.columns,2,4,"layout.columns",t),be(e.sidePosition,["left","right"])||t(n.either("layout.sidePosition","left","right")),Ie(e.sideWidth,220,420,"layout.sideWidth",t),e.asideWidth!==0&&Ie(e.asideWidth,240,420,n.asideWidth,t),be(e.gap,["compact","normal","relaxed"])||t(n.oneOf("layout.gap",n.join(["compact","normal","relaxed"]))),e.grid!==void 0&&!be(e.grid,Ms)&&t(n.either("layout.grid",...Ms)),e.pinRows!==void 0&&Ie(e.pinRows,0,ht[Er(e)].pinRowsMax,"layout.pinRows",t)}function Dy(e,t){const n=ge();if(!K(e))return t(n.object("theme"));const o=[],s=c=>o.push(c);(typeof e.name!="string"||e.name.trim()==="")&&s(n.nonEmptyString("theme.name")),be(e.mode,["light","dark"])||s(n.either("theme.mode","light","dark"));for(const c of _y)(typeof e[c]!="string"||!Bl.test(e[c]))&&s(n.hexColor(`theme.${c}`));const a=e.chartPalette;if(!Array.isArray(a)||a.length<6||a.length>8?s(n.chartPaletteSize):a.every(c=>typeof c=="string"&&Bl.test(c))||s(n.chartPaletteHex),(typeof e.fontFamily!="string"||e.fontFamily.trim()===""||/[;{}<>]/.test(e.fontFamily))&&s(n.fontFamily),Ie(e.fontSize,12,16,"theme.fontSize",s),Ie(e.radius,0,16,"theme.radius",s),be(e.shadow,qs)||s(n.oneOf("theme.shadow",n.join(qs))),be(e.density,Fs)||s(n.oneOf("theme.density",n.join(Fs))),e.surface!==void 0&&!be(e.surface,Rt)&&s(n.oneOf("theme.surface",n.join(Rt))),o.forEach(t),o.length>0)return;const r=e.colorText;for(const c of["colorBg","colorSurface"]){const i=zl(r,e[c]);i<Sr&&t(n.contrast("colorText",c,i.toFixed(2),Sr))}const l=zl(e.colorTextMuted,e.colorSurface);l<jr&&t(n.contrast("colorTextMuted","colorSurface",l.toFixed(2),jr))}function By(e,t,n,o){const s=ge();if(!Array.isArray(e))return n(s.sourcesMin);if(e.length===0)return o?void 0:n(s.sourcesMin);const a=new Set;e.forEach((r,l)=>{const c=`sources[${l}]`;if(!K(r))return n(s.object(c));if(typeof r.id!="string"||!ko.test(r.id)?n(s.identifier(`${c}.id`)):a.has(r.id)?n(s.sourceTwice(r.id)):a.add(r.id),(typeof r.label!="string"||r.label.trim()==="")&&n(s.required(`${c}.label`)),r.from!==void 0)return Wy(r,e,t,c).forEach(n);if(r.model!==void 0){if(!K(r.model))return n(s.object(`${c}.model`))}else if(r.events!==void 0){const u=Pg(r,c);if(u.forEach(n),u.length>0)return}else if(r.cypher!==void 0){const u=Zg(r,c);if(u.forEach(n),u.length>0)return}const i=typeof r.objectType=="string"&&Object.hasOwn(t.objectTypes,r.objectType)?t.objectTypes[r.objectType]:void 0;if(!i)return n(s.notObjectType(c));((u,p)=>i.properties.find(m=>m.name===u)&&!0)(r.key)||n(s.notProperty(c,i.id)),of(r.progress,i.properties,`${c}.progress`).forEach(n);const h=K(r.progress)&&Array.isArray(r.progress.steps);Dh(r.computed,[...i.properties,...h?hc(r.progress):[]],`${c}.computed`,{kn:t,objectType:i.id,cypher:r.cypher!==void 0,progress:h,sources:e.filter(K),...typeof r.id=="string"?{source:r.id}:{}}).forEach(n),r.display!==void 0&&Uy(r.display,r,t,`${c}.display`).forEach(n),r.formats!==void 0&&zy(r.formats,r,t,`${c}.formats`).forEach(n),r.operations!==void 0&&(r.cypher!==void 0||r.events!==void 0?n(s.onlyObjectSources(`${c}.operations`)):Qh(r.operations,r,t,`${c}.operations`).forEach(n)),r.models!==void 0&&(r.cypher!==void 0||r.events!==void 0||r.model!==void 0?n(s.onlyObjectSources(`${c}.models`)):rp(r.models,r,t,`${c}.models`).forEach(n));for(const u of["follows","relatedTo"]){if(r[u]===void 0)continue;if(r.cypher!==void 0||r.events!==void 0||r.model!==void 0){n(s.onlyObjectSources(`${c}.${u}`));continue}(u==="follows"?sy:ry)(r[u],r,e.filter(K),t,`${c}.${u}`).forEach(n)}})}function Uy(e,t,n,o){const s=ge();if(!K(e)||typeof e.template!="string")return[s.displayShape(o)];const a=[...t.cypher?.columns??[],...he(t,n)],r=i=>a.some(d=>d.name===i),l=Object.keys(e).filter(i=>!["template","facts"].includes(i)).map(i=>s.noOption(o,i)),c=ey(e.template);c.length===0&&l.push(s.templateNeedsField(o));for(const i of c)r(i)||l.push(s.templateNotField(o,i));if(e.facts!==void 0)if(!Array.isArray(e.facts)||e.facts.length>ra||!e.facts.every(i=>typeof i=="string"))l.push(s.factsList(o,ra));else for(const i of e.facts)r(i)||l.push(s.factsNotField(o,i));return l}function zy(e,t,n,o){const s=ge();if(!K(e))return[s.formatsShape(o)];const a=he(t,n),r=dn(t),l=[];for(const[c,i]of Object.entries(e)){const d=`${o}.${c}`,h=a.find(u=>u.name===c);if(!h){l.push(s.notField(d));continue}if(!K(i)){l.push(s.formatShape(d));continue}for(const u of Object.keys(i))["unit","decimals","colors"].includes(u)||l.push(s.noOption(d,u));if(i.unit!==void 0&&(typeof i.unit!="string"||i.unit.length>8?l.push(s.unitText(d)):h.type!=="number"&&l.push(s.unitNumber(d))),i.decimals!==void 0){const u=i.decimals;typeof u!="number"||!Number.isInteger(u)||u<0||u>Bs?l.push(s.decimalsInt(d,Bs)):h.type!=="number"&&l.push(s.decimalsNumber(d))}if(i.colors!==void 0){if(!Array.isArray(i.colors)){l.push(s.colorsList(d));continue}i.colors.forEach((u,p)=>{const f=`${d}.colors[${p}]`;if(!K(u))return l.push(s.ruleShape(f));be(u.tone,_t)||l.push(s.oneOf(`${f}.tone`,s.join(_t))),l.push(...xe(u.when,a,`${f}.when`,r))})}}return l}function Wy(e,t,n,o){const s=ge(),a=e.from;if(!K(a)||typeof a.source!="string")return[s.fromShape(o)];const r=t.find(c=>K(c)&&c.id===a.source);if(!K(r))return[s.fromNotSource(o,a.source)];if(r.from!==void 0)return[s.fromSubset(o)];const l=[];K(r.cypher)&&K(r.cypher.params)&&Object.keys(r.cypher.params).length&&l.push(s.fromCypherParams(o)),e.objectType!==r.objectType&&l.push(s.sameAsBase(o,"objectType",String(r.objectType))),e.key!==r.key&&l.push(s.sameAsBase(o,"key",String(r.key)));for(const c of["progress","computed","cypher","formats","display","operations","follows","relatedTo","models"])c in e&&l.push(s.derivedOwn(o,c));for(const c of Object.keys(a))["source","where","filters"].includes(c)||l.push(s.noOption(`${o}.from`,c));if(a.where!==void 0){const c=pe({sources:t},e.id),i=c?he(c,n):[];l.push(...xe(a.where,i,`${o}.from.where`,dn(c)))}return l}const Ky=[{key:"source",label:"来源数据源",kind:"source"},{key:"filters",label:"跟随的筛选",kind:"bindings",optional:!0}];function Yy(e,t,n){const o=ge(),s=e.scenarioParams??[];e.sources.forEach((a,r)=>{const l=`sources[${r}]`;a.model&&(zg(a,{sources:e.sources,kn:t,variables:e.variables,scenarioParams:s},l).forEach(n),(a.operations??[]).forEach((c,i)=>{c?.action!==void 0&&n(o.modelOperationAction(`${l}.operations[${i}]`))})),(a.models??[]).forEach((c,i)=>(Array.isArray(c?.params)?c.params:[]).forEach((d,h)=>{if(d?.scenarioParam===void 0)return;const u=s.find(f=>f.name===d.scenarioParam),p=`${l}.models[${i}].params[${h}].scenarioParam`;u?u.type!==d.type&&n(o.scenarioParamType(p)):n(o.notScenarioParam(p))}))})}function Gy(e,t,n){e.sources.forEach((o,s)=>{if(!o.from?.filters)return;const a={source:o.from.source,filters:o.from.filters};Ad(Ky,a,{kn:t,spec:e},`sources[${s}].from`).forEach(n)})}function Hy(e,t,n){const o=ge();if(!Array.isArray(e))return n(o.array("variables"));const s=new Set;e.forEach((a,r)=>{const l=`variables[${r}]`;if(!K(a))return n(o.object(l));if(typeof a.name!="string"||!ko.test(a.name))return n(o.identifier(`${l}.name`));if(s.has(a.name)&&n(o.variableTwice(a.name)),s.add(a.name),t.linking==="auto"&&a.name.startsWith(Fl)&&n(o.variableReserved(`${l}.name`,Fl)),(typeof a.label!="string"||a.label.trim()==="")&&n(o.required(`${l}.label`)),!be(a.kind,Wn))return n(o.oneOf(`${l}.kind`,o.join(Wn)));const c=hy(a);if(c&&n(o.variableDefault(l,c)),a.kind==="selection"||a.kind==="set")t.sources.some(i=>i.id===a.source)||n(o.variableSource(l));else for(const i of["source","field","fields"])i in a&&n(o.variableNoLonger(`${l}.${i}`))})}function Vy(e,t,n,o){const s=ge(),{layout:a,regions:r}=t.spec;if(!K(r))return n(s.object("regions"));const l=cc[a.type],c=new Set,i=new Set((t.spec.components??[]).map(p=>p.type));let d=0;const h=(p,f)=>{if(typeof p!="string"||!ko.test(p))return n(s.identifier(`${f}.id`));c.has(p)&&n(s.componentTwice(p)),c.add(p)};for(const[p,f]of Object.entries(r)){if(!l.includes(p)){n(s.noRegion(a.type,p,s.join(l)));continue}if(!Array.isArray(f)){n(s.array(`regions.${p}`));continue}f.forEach((m,g)=>{const y=`regions.${p}[${g}]`;if(!K(m))return n(s.object(y));h(m.id,y);const b=xt(m.type);if(b&&!i.has(m.type))return n(s.customNoPackage(y,String(m.type)));if(!b&&!be(m.type,Ve))return n(s.typeOneOf(y,s.join(Ve)));const k=m.type;d++,m.span!==void 0&&Ie(m.span,1,4,`${y}.span`,n),m.surface!==void 0&&!be(m.surface,Rt)&&n(s.oneOf(`${y}.surface`,s.join(Rt))),m.follow!==void 0&&typeof m.follow!="boolean"&&n(s.oneOf(`${y}.follow`,"true、false")),m.click!==void 0&&!be(m.click,la)&&n(s.oneOf(`${y}.click`,s.join(la))),a.type==="free"&&Zy(m.frame,k,Er(a),`${s.component(String(m.id))}.frame`,n),Ul(k,xt(k)&&K(m.config)?bf(k,m.config):m.config,t,s.component(String(m.id)),n)})}d===0&&!o&&n(s.pageEmpty);const u=e.detail;if(u!==void 0){if(!K(u)||u.type!==Te)return n(s.detailType(Te));h(u.id,"detail"),Ul(Te,u.config,t,s.component(String(u.id)),n)}}function Ul(e,t,n,o,s){const a=un(e),r=Ad(a.descriptors,t,n,o,a.free);r.forEach(s),r.length===0&&a.check&&a.check(t,n,o).forEach(s)}function Jy(e,t,n){if(e===void 0)return;const o=ge();if(!Array.isArray(e))return n(o.array("linkPaths"));e.forEach((s,a)=>{const r=`linkPaths[${a}]`;if(!K(s)||!Array.isArray(s.between)||s.between.length!==2||!s.between.every(u=>typeof u=="string")||!Array.isArray(s.path)||!s.path.every(u=>typeof u=="string"))return n(o.linkPathShape(r));const[l,c]=s.between,i=[l,c].find(u=>!t.objectTypes[u]);if(i)return n(o.linkPathType(r,i));const d=s.path;if(d.length===0)return;if(d.length>Dl)return n(o.linkPathLong(r,Dl));const h=ln(t,l,d);(!h||h[h.length-1].to!==c)&&n(o.linkPathBroken(r))})}function Zy(e,t,n,o,s){const a=ge();if(!K(e))return s(a.frameShape(o));const{columns:r,maxY:l,maxH:c}=ht[n];Ie(e.x,0,r-1,`${o}.x`,s),Ie(e.w,1,r,`${o}.w`,s),Ie(e.y,0,l,`${o}.y`,s),Ie(e.h,2,c,`${o}.h`,s),typeof e.x=="number"&&typeof e.w=="number"&&e.x+e.w>r&&s(a.frameRight(o,r));const[i,d]=hf(t,n);(typeof e.w=="number"&&e.w<i||typeof e.h=="number"&&e.h<d)&&s(a.frameSmall(o,t,i,d))}function zl(e,t){const[n,o]=[Wl(e),Wl(t)].sort((s,a)=>a-s);return(n+.05)/(o+.05)}function Wl(e){const t=n=>{const o=parseInt(e.slice(n,n+2),16)/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4};return .2126*t(1)+.7152*t(3)+.0722*t(5)}function K(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function be(e,t){return typeof e=="string"&&t.includes(e)}function Ie(e,t,n,o,s){(typeof e!="number"||!Number.isInteger(e)||e<t||e>n)&&s(ge().integer(o,t,n))}const Xy="scheduleWorkbench",Qy=[{id:"topBottom",name:"上下布局 · 总览",description:"顶部是基准日期和关键指标,中间是趋势与地区分布,底部是整宽的明细表。",theme:"default",pages:[{title:"总览",cells:[["asOfSlider",0,0,12,3],["metricCards",0,3,12,4],["trendChart",0,7,8,8],["regionMap",8,7,4,8],["objectTable",0,15,12,11]]}]},{id:"leftRight",name:"左右布局 · 列表 + 详情",description:"左侧是待处理对象的长列表,右侧是指标、明细表和选中对象的关系子图。",theme:"default",pages:[{title:"列表与详情",cells:[["objectList",0,0,4,26],["metricCards",4,0,8,4],["objectTable",4,4,8,12],["subgraph",4,16,8,10]]}]},{id:"workbench",name:"三栏工作台",description:"左边收件箱、中间指标与明细、右边 Agent 对话,适合每天处理事务的岗位。",theme:"default",pages:[{title:"工作台",cells:[["objectList",0,0,3,24],["asOfSlider",3,0,6,3],["metricCards",3,3,6,4],["objectTable",3,7,6,17],["agentChat",9,0,3,24]]}]},{id:"cockpit",name:"驾驶舱",description:"深色大屏:大地图居中,配趋势、告警、关系链路与甘特图。",theme:"tech",pages:[{title:"驾驶舱",cells:[["metricCards",0,0,12,4],["regionMap",0,4,6,12],["trendChart",6,4,6,6],["alertList",6,10,6,6],["stageChain",0,16,12,4],["ganttChart",0,20,12,8]]}]},{id:"alertDesk",name:"告警处置台",description:"按规则列出告警,点一条只看它命中的对象,旁边看明细、关系子图并问 Agent。",theme:"default",pages:[{title:"告警处置",cells:[["alertList",0,0,4,12],["objectTable",4,0,8,12],["subgraph",0,12,6,10],["agentChat",6,12,6,10]]}]},{id:"analysis",name:"分析看板",description:"分组汇总、月度趋势、关系链路与地区分布并排,适合周会和复盘。",theme:"dark",pages:[{title:"分析",cells:[["asOfSlider",0,0,12,3],["pivotTable",0,3,6,8],["trendChart",6,3,6,8],["stageChain",0,11,12,4],["regionMap",0,15,5,9],["objectTable",5,15,7,9]]}]},{id:"production",name:"排程台",description:"按基准日期看甘特图,下方是明细与告警,盯住临近和超期的对象。",theme:"default",pages:[{title:"排程",cells:[["asOfSlider",0,0,5,4],["metricCards",5,0,7,4],["ganttChart",0,4,12,9],["objectTable",0,13,8,11],["alertList",8,13,4,11]]}]},{id:Xy,name:"资源排程工作台",description:"按向导回答排什么、排在哪、何时完成、结果写到哪里,生成按资源排行的调度甘特与方案改动;结果写入计划记录时另有只读的需求视角,可选再加一页所需资源与就绪。拖动改排程,采用前检查约束。",theme:"default",wizard:!0,pages:[{title:"排程",cells:[["scenarioBar",0,0,12,2,{title:"方案",style:"compact"}],["scheduleGantt",0,2,8,14,{title:"排程(按资源)"}],["scheduleGantt",0,16,8,9,{title:"所需资源与就绪(可选)"}],["scenarioBar",8,2,4,23,{title:"方案改动",style:"assumptions"}]]}]}],eb={id:"blank"};function tb(e,t,n,o,{scenarios:s=!0}={}){Qy.find(r=>r.id===e);const a={apiVersion:pt,app:t,dependencies:{knowledgeNetwork:{id:n.id,name:n.name}},sources:[],variables:[{name:"asOf",label:"基准日期",kind:"asOf"}],pages:[{id:"main",title:"页面 1",layout:structuredClone(ag.free),regions:{},linking:"auto"}],theme:{...structuredClone(Zr.default),surface:"plain"}};return{spec:nb(a),skipped:[]}}function nb(e){return{...e,pages:e.pages.map(t=>t.layout.type==="free"?rg(t):t)}}const ob={usage:e=>`用法:workshop <命令> [参数] [选项]
|
|
158
160
|
|
|
159
161
|
list 列出能看到的应用
|
|
160
162
|
create <网络> <名称> [目录] 在知识网络上新建一个空应用并拉取;<网络> 为网络 id 或名称,目录默认以应用名命名
|
|
@@ -187,7 +189,7 @@ ${n}`,networkNotFound:(e,t,n,o)=>`没有找到知识网络「${e}」,或你没
|
|
|
187
189
|
- \`components/<目录>/\`:应用的自定义组件,每个目录是一个组件包(见下文“自定义组件”)。
|
|
188
190
|
- \`.workshop/guides/app-spec.md\`:App Spec 的规则;\`.workshop/app-spec.schema.json\`:它的结构。
|
|
189
191
|
- \`.workshop/guides/components/<组件类型>.md\`:各组件的说明,配置某个组件前先读它的说明。
|
|
190
|
-
- \`.workshop/guides/prototype.md\`:照 HTML
|
|
192
|
+
- \`.workshop/guides/prototype.md\`:照 HTML 原型或原型截图做应用时的做法。
|
|
191
193
|
- \`.workshop/network.json\`:知识网络的结构。对象类、属性、关系、行动、事件类型与指标的 id 一律以它为准,不要编造。
|
|
192
194
|
- \`.workshop/\` 下的其他文件由命令写出,不要改。
|
|
193
195
|
|
|
@@ -214,7 +216,7 @@ ${n}`,networkNotFound:(e,t,n,o)=>`没有找到知识网络「${e}」,或你没
|
|
|
214
216
|
- \`app.yaml\` 的 \`components\` 列出应用用到的组件包,其中的 \`package\` 由 \`workshop push\` 按目录的内容填写,不要手改。
|
|
215
217
|
- 删除组件:删掉它的目录,并从 \`app.yaml\` 的 \`components\` 与页面中删掉它。
|
|
216
218
|
- 这里放的是组件包本身。用 React 等模板写的组件,源码放在别处,构建后把产物放进这里。
|
|
217
|
-
`},
|
|
219
|
+
`},sb={usage:e=>`Usage: workshop <command> [arguments] [options]
|
|
218
220
|
|
|
219
221
|
list Lists the apps you can see
|
|
220
222
|
create <network> <name> [dir] Makes an empty app on a knowledge network and pulls it; <network> is its id or name; the folder is named after the app unless named
|
|
@@ -247,7 +249,7 @@ This folder is the project of a Workshop app, pulled with \`workshop pull\`. Cha
|
|
|
247
249
|
- \`components/<folder>/\`: the app's custom components; each folder is a component package (see "Custom components" below).
|
|
248
250
|
- \`.workshop/guides/app-spec.md\`: the App Spec's rules; \`.workshop/app-spec.schema.json\`: its structure.
|
|
249
251
|
- \`.workshop/guides/components/<component type>.md\`: each component's guide; read it before configuring that component.
|
|
250
|
-
- \`.workshop/guides/prototype.md\`: how to make the app from an HTML prototype.
|
|
252
|
+
- \`.workshop/guides/prototype.md\`: how to make the app from an HTML prototype or screenshots of one.
|
|
251
253
|
- \`.workshop/network.json\`: the knowledge network's structure. The ids of object types, properties, relations, actions, event types and metrics are always taken from it; never make them up.
|
|
252
254
|
- The other files under \`.workshop/\` are written by the command; do not change them.
|
|
253
255
|
|
|
@@ -274,15 +276,15 @@ Each folder under \`components/\` is a component package: \`manifest.json\`, \`i
|
|
|
274
276
|
- \`components\` in \`app.yaml\` lists the packages the app uses; their \`package\` is filled in by \`workshop push\` from the folders' content. Do not edit it by hand.
|
|
275
277
|
- To delete a component, delete its folder and remove it from \`components\` in \`app.yaml\` and from the pages.
|
|
276
278
|
- What goes here is the package itself. For a component written with React or another framework, keep the source elsewhere and put the built output here.
|
|
277
|
-
`};let Xr="zh-CN";function
|
|
278
|
-
`)[0],line:t.linePos(l.pos[0]).line})),s=o.length===0?n.toJS():void 0,
|
|
279
|
+
`};let Xr="zh-CN";function Kl(e){Xr=e,yh({language:e})}function Lt(){return Xr}function D(){return Xr==="en-US"?sb:ob}(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let o=0;o<8;o++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();const rb=e=>e.replace(/^x-/,"").replace(/[^A-Za-z0-9-]+/g,"-"),ie="components",Ud=(e,t)=>Buffer.compare(Buffer.from(e),Buffer.from(t));function zd(e){const t=ic("sha256");for(const n of[...e].sort((o,s)=>Ud(o.name,s.name)))t.update(n.name),t.update("\0"),t.update(String(n.data.length)),t.update("\0"),t.update(n.data);return t.digest("hex")}const ab=e=>zd(bn(e).map(t=>({name:t.name,data:ct(t.path)}))),ib=e=>!e.startsWith(".")&&e!=="node_modules";function wn(e){const t=G(e,ie);return we(t)?en(t,{withFileTypes:!0}).filter(n=>n.isDirectory()&&ib(n.name)).map(n=>n.name).sort(Ud).map(n=>{const o=G(t,n),s=eg(o,{language:Lt()}),r=(s.manifest?s.files:bn(o)).map(c=>({name:c.name,data:ct(c.path)})),l=s.manifest?.type;return{folder:n,...xt(l)?{type:l,manifest:s.manifest}:{},hash:zd(r),files:r,check:s}}):[]}function lb(e){return!e||e.startsWith("/")||e.includes("\\")||e.includes("\0")?null:e.split("/").every(n=>n!==""&&!n.startsWith("."))?e:null}function Qr(e,t){if(we(e)){for(const n of en(e,{withFileTypes:!0}))n.isDirectory()&&Qr(G(e,n.name),!0);t&&en(e).length===0&&Au(e)}}function cb(e){if(we(e)){for(const t of bn(e))ut(t.path);Qr(e,!0)}}function Yl(e,t){const n=t.find(o=>lb(o.name)===null);if(n)throw new Error(D().unsafePath(n.name));if(we(e))for(const o of bn(e))ut(o.path);for(const o of t){const s=G(e,o.name);Bn(At(s),{recursive:!0}),rc(s,o.data)}Qr(e,!1)}const db=new Set(["title","layout","regions","detail"]);function Gl(e){const t=[];for(const[,n,o]of e.matchAll(/([^.[\]]+)|\[(\d+)\]/g))t.push(o!==void 0?Number(o):n);return t}const ub=/^[A-Za-z][A-Za-z0-9_]*(?:\[\d+\]|\.[A-Za-z_$][A-Za-z0-9_$-]*)*/,hb=/(?:组件|\b[Cc]omponent) ([A-Za-z][A-Za-z0-9_-]*)((?:\[\d+\]|\.[A-Za-z_$][A-Za-z0-9_$-]*)*)/,Hl=/^(?:页面 (\S+?):|page (\S+?): )/;function pb(e,t,n){const o=t>=0?[t]:e.pages.map((s,a)=>a);for(const s of o){const a=e.pages[s];if(a?.detail?.id===n)return["pages",s,"detail"];const r=a?.regions&&typeof a.regions=="object"?a.regions:{};for(const[l,c]of Object.entries(r)){const i=Array.isArray(c)?c.findIndex(d=>d?.id===n):-1;if(i>=0)return["pages",s,"regions",l,i]}}}function fb(e,t){const n=Hl.exec(t),o=n?.[1]??n?.[2],s=t.replace(Hl,""),a=o?e.pages.findIndex(i=>i.id===o):e.pages.length===1?0:-1,r=[],l=hb.exec(s);if(l){const i=pb(e,a,l[1]);if(i){const d=Gl(l[2]);d[0]==="frame"||d[0]==="span"?r.push([...i,...d]):d.length>0&&r.push([...i,"config",...d]),r.push(i)}}const c=ub.exec(s)?.[0];if(c){const i=Gl(c);db.has(String(i[0]))?a>=0&&r.push(["pages",a,...i]):r.push(i)}return a>=0&&o&&r.push(["pages",a]),r}function mb(e,t){let n=e.contents,o;for(const s of t)if(Ye.isMap(n)){const a=n.items.find(r=>Ye.isScalar(r.key)&&String(r.key.value)===String(s));if(!a)break;o=a.key.range?.[0]??o,n=a.value}else if(Ye.isSeq(n)&&typeof s=="number"&&s<n.items.length)n=n.items[s],o=n.range?.[0]??o;else break;return o}function gb(e){const t=new Ye.LineCounter,n=Ye.parseDocument(e,{lineCounter:t,prettyErrors:!1}),o=n.errors.map(l=>({message:l.message.split(`
|
|
280
|
+
`)[0],line:t.linePos(l.pos[0]).line})),s=o.length===0?n.toJS():void 0,a=Ye.isMap(n.contents)&&Ye.isSeq(n.get("pages",!0));return{spec:s,syntax:o,locate:l=>{if(!a)return{message:l};for(const c of fb(s,l)){const i=mb(n,c);if(i!==void 0)return{message:l,line:t.linePos(i).line}}return{message:l}}}}const yb=Object.assign({"./actionButton.en-US.md":()=>Promise.resolve().then(()=>Ww).then(e=>e.default),"./actionButton.md":()=>Promise.resolve().then(()=>Yw).then(e=>e.default),"./agentChat.en-US.md":()=>Promise.resolve().then(()=>Hw).then(e=>e.default),"./agentChat.md":()=>Promise.resolve().then(()=>Jw).then(e=>e.default),"./alertList.en-US.md":()=>Promise.resolve().then(()=>Xw).then(e=>e.default),"./alertList.md":()=>Promise.resolve().then(()=>ek).then(e=>e.default),"./asOfSlider.en-US.md":()=>Promise.resolve().then(()=>nk).then(e=>e.default),"./asOfSlider.md":()=>Promise.resolve().then(()=>sk).then(e=>e.default),"./customComponents.en-US.md":()=>Promise.resolve().then(()=>pu).then(e=>e.default),"./customComponents.md":()=>Promise.resolve().then(()=>fu).then(e=>e.default),"./dateRange.en-US.md":()=>Promise.resolve().then(()=>lk).then(e=>e.default),"./dateRange.md":()=>Promise.resolve().then(()=>dk).then(e=>e.default),"./dropdownFilter.en-US.md":()=>Promise.resolve().then(()=>hk).then(e=>e.default),"./dropdownFilter.md":()=>Promise.resolve().then(()=>fk).then(e=>e.default),"./eventList.en-US.md":()=>Promise.resolve().then(()=>gk).then(e=>e.default),"./eventList.md":()=>Promise.resolve().then(()=>bk).then(e=>e.default),"./eventReport.en-US.md":()=>Promise.resolve().then(()=>kk).then(e=>e.default),"./eventReport.md":()=>Promise.resolve().then(()=>$k).then(e=>e.default),"./ganttChart.en-US.md":()=>Promise.resolve().then(()=>jk).then(e=>e.default),"./ganttChart.md":()=>Promise.resolve().then(()=>Tk).then(e=>e.default),"./metricCards.en-US.md":()=>Promise.resolve().then(()=>Ek).then(e=>e.default),"./metricCards.md":()=>Promise.resolve().then(()=>Nk).then(e=>e.default),"./modelTrial.en-US.md":()=>Promise.resolve().then(()=>Rk).then(e=>e.default),"./modelTrial.md":()=>Promise.resolve().then(()=>Pk).then(e=>e.default),"./objectDetail.en-US.md":()=>Promise.resolve().then(()=>Ik).then(e=>e.default),"./objectDetail.md":()=>Promise.resolve().then(()=>qk).then(e=>e.default),"./objectList.en-US.md":()=>Promise.resolve().then(()=>Dk).then(e=>e.default),"./objectList.md":()=>Promise.resolve().then(()=>Uk).then(e=>e.default),"./objectTable.en-US.md":()=>Promise.resolve().then(()=>Wk).then(e=>e.default),"./objectTable.md":()=>Promise.resolve().then(()=>Yk).then(e=>e.default),"./pivotTable.en-US.md":()=>Promise.resolve().then(()=>Hk).then(e=>e.default),"./pivotTable.md":()=>Promise.resolve().then(()=>Jk).then(e=>e.default),"./regionMap.en-US.md":()=>Promise.resolve().then(()=>Xk).then(e=>e.default),"./regionMap.md":()=>Promise.resolve().then(()=>ev).then(e=>e.default),"./scenarioBar.en-US.md":()=>Promise.resolve().then(()=>nv).then(e=>e.default),"./scenarioBar.md":()=>Promise.resolve().then(()=>sv).then(e=>e.default),"./scheduleGantt.en-US.md":()=>Promise.resolve().then(()=>av).then(e=>e.default),"./scheduleGantt.md":()=>Promise.resolve().then(()=>lv).then(e=>e.default),"./searchBox.en-US.md":()=>Promise.resolve().then(()=>dv).then(e=>e.default),"./searchBox.md":()=>Promise.resolve().then(()=>hv).then(e=>e.default),"./segmentedFilter.en-US.md":()=>Promise.resolve().then(()=>fv).then(e=>e.default),"./segmentedFilter.md":()=>Promise.resolve().then(()=>gv).then(e=>e.default),"./stageChain.en-US.md":()=>Promise.resolve().then(()=>bv).then(e=>e.default),"./stageChain.md":()=>Promise.resolve().then(()=>kv).then(e=>e.default),"./subgraph.en-US.md":()=>Promise.resolve().then(()=>$v).then(e=>e.default),"./subgraph.md":()=>Promise.resolve().then(()=>jv).then(e=>e.default),"./taskInbox.en-US.md":()=>Promise.resolve().then(()=>Tv).then(e=>e.default),"./taskInbox.md":()=>Promise.resolve().then(()=>Ev).then(e=>e.default),"./text.en-US.md":()=>Promise.resolve().then(()=>Nv).then(e=>e.default),"./text.md":()=>Promise.resolve().then(()=>Rv).then(e=>e.default),"./trendChart.en-US.md":()=>Promise.resolve().then(()=>Pv).then(e=>e.default),"./trendChart.md":()=>Promise.resolve().then(()=>Iv).then(e=>e.default)}),bb=new Set([...Ve,Te]),Ct={};for(const[e,t]of Object.entries(yb)){const[,n,o]=/^\.\/([A-Za-z]+)(\.en-US)?\.md$/.exec(e)??[];!n||!bb.has(n)||(Ct[n]??={load:()=>Promise.reject(new Error(`no guide for ${n}`))},o?Ct[n].loadEnglish=t:Ct[n].load=t)}const wb={scheduleGantt:["排产","排程","调度","派工","检修","维修","齐套","甘特","产能","schedul","dispatch","gantt","kitting"]},kb=Object.keys(Ct).sort();Object.keys(wb).filter(e=>e in Ct);async function vb(e,t="zh-CN"){const n=Ct[e];if(!n)throw new Error(`no guide for ${e}`);return(!Wd(t)&&n.loadEnglish?n.loadEnglish:n.load)()}async function $b(e="zh-CN"){return(Wd(e)?await Promise.resolve().then(()=>fu):await Promise.resolve().then(()=>pu)).default}function Wd(e){return e.startsWith("zh")}function Sb(e,t,n){const o=(e.actionTypes??[]).filter(a=>!0).map(a=>{const r=(a.inputs??[]).map(l=>l.label&&l.label!==l.name?`${l.name}(${l.label})`:l.name);return`- ${a.id}:${a.name},对象类 ${a.objectType},${a.kind}${r.length>0?`;输入:${r.join("、")}`:""}`}),s=t.map(a=>`- box "${a.box}"(${a.boxName}),tool "${a.tool}":${a.toolName}${a.description?`;${a.description}`:""}`);return`
|
|
279
281
|
## 调度模型(排产、派工、检修等调度场景)
|
|
280
282
|
请求要把任务排到资源上(排产、排程、派工、检修、齐套、产能等),或要改调度甘特排什么、排在哪、何时完成、查哪些规则、怎么写回时,不要自己写 scheduleGantt 的图层、数据源和情景操作,而是只输出调度模型的答案;系统据此生成页面,并在向导里请用户逐项确认:
|
|
281
283
|
{"scheduleModel": {...}, "needs": [{"step": "rules", "text": "..."}]}
|
|
282
284
|
|
|
283
285
|
scheduleModel 的结构(只填知识网络里确有依据的项;没把握的项省略,由向导按知识网络建议):
|
|
284
286
|
- result:"self"(直接改任务本身的资源与时间,由任务的修改行动写回)或 "record"(写入计划记录,任务本身不改,由计划记录的新建、修改行动写回)。
|
|
285
|
-
- tasks:[{ objectType, assignField?, start?, end?, status?, doneWhen?: [{ field, op: "eq", value }], groupField?, target?: { path?, field }, ready?: { path, field }, predecessors?: { path: [关系] }, modify?: { action }, rules?: [{ name, tool: { box, tool }, severity?: "hard" | "soft" }] }]:被排的东西,1 到 ${
|
|
287
|
+
- tasks:[{ objectType, assignField?, start?, end?, status?, doneWhen?: [{ field, op: "eq", value }], groupField?, target?: { path?, field }, ready?: { path, field }, predecessors?: { path: [关系] }, modify?: { action }, rules?: [{ name, tool: { box, tool }, severity?: "hard" | "soft" }] }]:被排的东西,1 到 ${eo} 类共用同一类资源。assignField 为取值是资源标识的字段;target 为何时要完成(任务自己的日期,或沿 path 到达的对象的日期,如工单的交期);ready 为开工前要就绪的对象及其就绪日;predecessors 为同类任务之间的前序关系(一条)。result 为 record 时只能 1 类任务,不写 assignField、start、end、modify,可写 groupField(成批的字段,如预测单号)。
|
|
286
288
|
- resource:{ objectType, titleField, parentField?, groupField?, capacityField? }:资源(产线、机台、班组),parentField 为上级资源标识(与 groupField 二选一),capacityField 为并行上限(数字)。
|
|
287
289
|
- calendars?:[{ objectType, resourceField, start, end }]:资源不可用的时段(停线、停机、请假),最多 3 个。
|
|
288
290
|
- record(result 为 record 时):{ objectType, match: [{ from: 计划记录的字段, to: 任务的字段 }], resourceField, start, end, status?, active?: [{ field, op: "ne", value }], create?: { action }, modify?: { action }, daysField? }。match 是计划认出“为哪条需求排的”的字段:只用单号、编码这类编号(如 单号 ↔ 单号、产品编码 ↔ 物料编码),合起来要能唯一确定一条需求(一张单有多个产品时,单号之外再加产品编码);不要用数量、日期、状态,它们碰巧相等不代表是同一条需求。
|
|
@@ -297,9 +299,9 @@ ${o.length>0?o.join(`
|
|
|
297
299
|
${s.length>0?s.join(`
|
|
298
300
|
`):"(知识网络没有挂载带规则函数的工具箱)"}
|
|
299
301
|
|
|
300
|
-
needs:知识网络缺对象类、属性、关系或行动,或没有合适的规则函数时,逐条写清楚要补什么,step 取 ${
|
|
302
|
+
needs:知识网络缺对象类、属性、关系或行动,或没有合适的规则函数时,逐条写清楚要补什么,step 取 ${Sg.join("、")} 之一。needs 的 text 是给业务人员看的:对象类、属性、行动一律写显示名(如“预测单号”),不要写 id 或属性名(如 billno)。不要编造 id,也不要用别的对象、属性凑;规则函数没有合适的就不写进 rules,在 needs 里写“建议新建:XX 检查(读哪些对象、判断什么)”。
|
|
301
303
|
当前 App Spec 已有 scheduleModel 时,输出修改后的完整 scheduleModel:用户没提到的答案原样保留。只改调度甘特的显示时,在 scheduleModel 里写 display:{ resource?: { title?, tick?, daysBefore?, daysAfter?, layers?: [{ color?, tone?, colorField?, popoverFields? }] }, demand?: 同 },layers 按甘特现有图层的顺序。
|
|
302
|
-
请求与调度无关(例如加一张指标卡)时,照常输出 patch 或 spec,不要写 scheduleModel。`}const
|
|
304
|
+
请求与调度无关(例如加一张指标卡)时,照常输出 patch 或 spec,不要写 scheduleModel。`}const Kd=e=>Object.entries(e).filter(([t])=>!Cr.has(t)).map(([t,[n,o]])=>`${t} ${n}×${o}`).join("、"),jb=Kd(uc),Ab=Kd(dc),Tb=Ve.filter(e=>He[e].category==="scenario"),Ob=`## 页面写法
|
|
303
305
|
1. 一页一个任务:页面标题写谁要做什么(如“今日缺料”“待回复采购单”),不写功能名。
|
|
304
306
|
2. 首屏先说结论:页面开头放一个文字组件(text),一句话说清现在怎么样、先干什么,数字用 values 引用;下面最多 4 个关键数字,一个按紧急程度或日期排好的清单(告警、事件列表或表格),再加最多两张图。其余放到下一页或详情抽屉。
|
|
305
307
|
3. 数字带一句说明:指标卡每项写 description,说明它的含义或该干什么;表格、告警、事件列表、图表也写一句 description。
|
|
@@ -311,11 +313,11 @@ needs:知识网络缺对象类、属性、关系或行动,或没有合适的
|
|
|
311
313
|
9. 组件大小跟内容走:行数少的清单不要占满一屏高;自由布局里规则不多于 3 条的告警高度不超过 7 行。
|
|
312
314
|
10. 空状态说清楚:没有数据时写明原因和下一步。
|
|
313
315
|
11. 页面不超过 7 页:按“每天看”“偶尔用”“设置”分组。
|
|
314
|
-
`;function Eb(e,t,n=[],{scenarios:o=!0,ruleTools:s,scheduling:
|
|
315
|
-
`),c=
|
|
316
|
+
`;function Eb(e,t,n=[],{scenarios:o=!0,ruleTools:s,scheduling:a=n.some(r=>r.type==="scheduleGantt")}={}){const r=s&&a?Sb(e,s):"",l=Object.entries(cc).map(([d,h])=>`- ${d}:区域 ${h.join("、")}`).join(`
|
|
317
|
+
`),c=Af(o).map(d=>{const h=He[d];return`### ${d}(${h.label})
|
|
316
318
|
${h.description}
|
|
317
319
|
config:
|
|
318
|
-
${
|
|
320
|
+
${Qn(h.descriptors)}`}).join(`
|
|
319
321
|
|
|
320
322
|
`),i=o?"":`
|
|
321
323
|
方案推演需要企业版,当前环境不提供:不要加方案类组件(${Tb.join("、")});用户要求方案推演时,只输出不含它们的 App Spec。`;return`## App Spec 结构
|
|
@@ -331,18 +333,22 @@ ${l}
|
|
|
331
333
|
- workbench:side 为侧栏(宽 sideWidth 220–420,位置 sidePosition left/right),main 为主区,aside 为右栏(宽 asideWidth,0 表示隐藏,否则 240–420)。
|
|
332
334
|
- dashboard:header 为顶部整行;grid 为网格,列数 columns 2–4,组件用 span 指定跨列数。
|
|
333
335
|
- detail:header 顶部整行;main 主区;aside 右栏。
|
|
334
|
-
- free
|
|
336
|
+
- free:自由网格,区域只有 cells;每个组件必须带 frame { x, y, w, h }(列与行,从左上角数起);同一行的组件 y 相同,不要重叠。网格有两种,由 layout.grid 决定,frame 与 pinRows 都按本页网格计数:
|
|
337
|
+
- grid: "fine"(细网格):24 列,每行连同间距约 27 像素;frame { x: 0–23, y: 0–800, w: 1–24, h: 2–80 },且 x + w ≤ 24;w、h 不得小于组件的最小尺寸(列×行):${jb}。新建的自由网格页面一律写 grid: "fine"。
|
|
338
|
+
- 不写 grid 或 grid: "standard"(标准网格):12 列,行高 40 像素;frame { x: 0–11, y: 0–400, w: 1–12, h: 2–40 },且 x + w ≤ 12;最小尺寸:${Ab}。
|
|
339
|
+
- 修改已有页面时不要改它的 grid,frame 按它原来的网格写。
|
|
340
|
+
- pinRows(可选,标准网格 0–12、细网格 0–24)为页面滚动时固定在顶部的行数:完全落在前 pinRows 行里的组件(如基准日期、筛选)一直显示在顶部;有组件从这几行开始、又延伸到下面时整页不固定,所以固定的组件要整个放在这几行里。
|
|
335
341
|
- gap 为 compact、normal、relaxed。
|
|
336
342
|
|
|
337
343
|
## 数据源(sources)
|
|
338
344
|
每项 { id, label, objectType, key, progress?, computed? }:objectType 为对象类 id;key 为标识对象的属性。
|
|
339
345
|
子集 { id, label, objectType, key, from: { source, where?, filters? } }:另一个数据源的子集,组件的 source 可以选它。from.source 为来源数据源 id(不能再是子集,也不能是带参数的 Cypher 数据源);where 为对象须全部满足的条件,可读来源的属性、进度列和计算列,写法同计算列的条件;filters 为它跟随的筛选,写法同组件的 filters。objectType、key 必须与来源一致;progress、computed 沿用来源,不能自己写。同一个子集(如“执行中的订单”)要给多个组件用,或要按条件统计时,定义成子集。
|
|
340
346
|
字段格式 formats(可选):{ 字段名: { unit?, decimals?, colors? } },所有组件显示这个字段时都沿用。unit 为数字的单位(如 件、万元),decimals 为小数位(0–6),colors 为着色规则列表 [{ when: 条件列表, tone }]:行满足条件时该字段显示为这个颜色(tone 同计算列的色调:neutral/info/success/warning/danger),条件可读本行任何字段,第一条成立的生效。子集沿用来源的格式。
|
|
341
|
-
${
|
|
342
|
-
${
|
|
347
|
+
${rf}
|
|
348
|
+
${Gh}
|
|
343
349
|
|
|
344
350
|
## 自动联动(页面的 linking)
|
|
345
|
-
页面 linking 为 auto
|
|
351
|
+
页面 linking 为 auto 时自动联动(新建的页面都写 linking: "auto"):点击任一组件(表格的行、指标卡、分段与下拉筛选、透视表的行、趋势图、地图、告警、搜索框、日期区间)就是整页共享的一个条件,其他组件自动跟随——同类对象按同一字段或同一批对象筛,另一类对象沿知识网络里两类对象之间最短的关系连接筛(3 跳以内;一样短的有几条时沿任一条关联到即保留);详情抽屉、关系子图、Agent 自动读取最近点中的对象。所以这样的页面不要写 variables 里的取值、日期区间、搜索、选中对象、对象集合筛选,也不要写组件的 writes、selection、filters;基准日期 asOf 照旧是 variables 里的一项。
|
|
346
352
|
只在需要判断时写这几项:
|
|
347
353
|
- 组件的 follow: false(写在组件这一层,与 id、type 并列):总量参照、目标值、对比基准这类不该随点击变的组件。
|
|
348
354
|
- 组件的 click(同一层):select 只选中对象、不筛选页面,用于只看详情的明细表;none 点击不产生条件。不写为筛选页面。
|
|
@@ -381,20 +387,20 @@ linking 不写或为 manual 时按下一节手动联动。修改已有页面时
|
|
|
381
387
|
regions 中每项 { id, type, span?, frame?, surface?, config };id 在页面内唯一,字母开头;span 只用于 dashboard,frame 只用于 free;surface(可选)为 card 或 plain,只给要和主题不同的组件写,如不带框的页面里给一张很密的表格加底色。${i}
|
|
382
388
|
${c}
|
|
383
389
|
|
|
384
|
-
### 详情抽屉 detail(type 固定为 ${
|
|
390
|
+
### 详情抽屉 detail(type 固定为 ${Te},不放在 regions 里)
|
|
385
391
|
${dt.description}
|
|
386
392
|
config:
|
|
387
|
-
${
|
|
388
|
-
${Cb(n,
|
|
393
|
+
${Qn(dt.descriptors)}
|
|
394
|
+
${Cb(n,r!=="")}${r}
|
|
389
395
|
${Ob}
|
|
390
396
|
## 主题(theme)
|
|
391
397
|
surface(可选)为组件外观:card 每个组件带底色和边框,plain 组件直接放在页面上、靠间距分开,不写为 card。新建应用写 plain;改已有应用时,用户没要求就保留原值。
|
|
392
|
-
颜色一律 #rrggbb;chartPalette 6–8 个颜色;colorText 与 colorBg、colorSurface 对比度不低于 ${
|
|
398
|
+
颜色一律 #rrggbb;chartPalette 6–8 个颜色;colorText 与 colorBg、colorSurface 对比度不低于 ${Sr},colorTextMuted 与 colorSurface 不低于 ${jr};mode 为 light 或 dark;fontSize 12–16;radius 0–16;shadow 为 none、subtle、strong;density 为 compact、comfortable。
|
|
393
399
|
用户说的“强调色、主色”指 colorPrimary(chartPalette 第一个颜色通常与它一致);点名的颜色要在所选模板基础上改进去。主题模板:
|
|
394
|
-
${Object.values(
|
|
400
|
+
${Object.values(Zr).map(d=>`- ${d.name}:${JSON.stringify(d)}`).join(`
|
|
395
401
|
`)}
|
|
396
402
|
|
|
397
|
-
${
|
|
403
|
+
${_b(e,t)}${Nb(e)}${xb(e)}`}function Cb(e,t=!1){return e.length===0?"":`
|
|
398
404
|
## 组件说明
|
|
399
405
|
以下组件附有说明,配置它们时以说明为准:先按“本体契约”把业务对象对应到组件的角色,再按“扩展点”接知识网络上的规则工具、逻辑属性或指标。说明中要求的对象类、属性、关系或工具在上面的知识网络里找不到时,不要用别的对象或计算列凑,也不要在配置里写业务规则,相应的可选项留空。${t?"调度甘特按“调度模型”一节输出答案:规则函数只从那里列出的选,要补的内容写进 needs。其他组件里要填 { box, tool } 的配置项一律不写,不要编造工具箱或工具的 id,由构建者在配置面板中选择。":"本提示不含执行工厂的工具清单:说明里提到的规则工具(如“齐套检查”)以及任何要填 { box, tool } 的配置项一律不写,不要编造工具箱或工具的 id,由构建者在配置面板中选择。说明里“问用户”“列出要补的内容”在这里不适用:只输出 App Spec。"}
|
|
400
406
|
|
|
@@ -403,73 +409,77 @@ ${o.text.trim()}
|
|
|
403
409
|
</guide>`).join(`
|
|
404
410
|
|
|
405
411
|
`)}
|
|
406
|
-
`}function Nb(e,t){const n=
|
|
412
|
+
`}function Nb(e,t){const n=Qp(e);return n?`
|
|
407
413
|
|
|
408
414
|
## 对象指标
|
|
409
|
-
${n}`:""}
|
|
410
|
-
|
|
411
|
-
|
|
415
|
+
${n}`:""}function xb(e,t){const n=vh(e);return n?`
|
|
416
|
+
|
|
417
|
+
## 行动
|
|
418
|
+
${n}`:""}const Rb=30;function _b(e,t){const n=Object.values(e.objectTypes),o=s=>!t;return`## 知识网络 ${e.name}(${e.id})
|
|
419
|
+
对象类(id:名称;业务说明;属性 名称:类型(显示名))${n.length>Rb&&t?";网络较大,只列出与本次要求相关的对象类的属性,其余只列名称,需要时请用户点名":""}:
|
|
420
|
+
${n.map(s=>`- ${s.id}:${s.name}${s.comment?`;${s.comment}`:""}${o(s.id)?`;${s.properties.map(a=>`${a.name}:${a.type}(${a.label})`).join(",")}`:""}`).join(`
|
|
412
421
|
`)}
|
|
413
422
|
关系(id:名称,起点 → 终点;路径可以反向经过关系):
|
|
414
423
|
${e.relations.map(s=>`- ${s.id}:${s.name},${s.source} → ${s.target}`).join(`
|
|
415
|
-
`)}${
|
|
424
|
+
`)}${Pb(e)}`}function Pb(e){if(!e.eventTypes)return"";const t=e.eventTypes.map(n=>`- ${n.code}:${n.name},${n.source==="rule"?"规则命中":"用户登记"}${n.subject?`,关于 ${n.subject}`:""}`);return`
|
|
416
425
|
事件类型(编码:名称,来源,关于的对象类):
|
|
417
426
|
${t.length>0?t.join(`
|
|
418
|
-
`):"(暂无)"}`}const
|
|
427
|
+
`):"(暂无)"}`}const Lb=["对应:一组数字卡合成一个 metricCards;表格、列表做成 objectTable 或 objectList;图表做成 trendChart,类型照原型(柱、线、饼);下拉、分段按钮、搜索框、日期框做成 dropdownFilter、segmentedFilter、searchBox、dateRange;结论和说明文字做成 text;导航、页眉、装饰不做。","原型里的数字、表格行和图上的值都是示例:按列名、指标名、图例对应到知识网络中含义相同的对象类和属性,统计方式照原型(计数、合计、按月等),一律从知识网络取数,不要把示例数字写进配置。","数字卡、按类别的图表的名称与知识网络中已发布的对象指标同名或同义时(如“可用库存数量”“未完结采购订单数”),写 metric 用这个指标:平台按全部对象计算,不受数据源读取行数的限制;不要自己再统计一遍。按时间的图表只在指标是按月等的时间序列时才用,否则照常从数据源统计。","原型的数字带“较上月”“环比”“同比”时,这张卡要按期统计(basis: period,periodField 用单据的业务日期),数字是本期的,才有两期可比;与按当前状态统计的卡(如在途、逾期)口径不同时分成两组,两组在同一行并排,宽度按卡片数分配。","同一个状态(如在途、逾期)只定义一次:用数据源的进度(progress)或一个计算列,数字卡的条件和表格的状态列都引用它,两处口径一致。","名称带“近期”“最新”的表格按日期从近到远排(sortOrder: desc)。","标题和说明只写配置实际的口径:原型写的条件做不到时(如卡片写“本月有订单”却没有按本月统计),改写或去掉这句,并说明没有照做;不要写配置里没有的排序和条件(如“逾期在前”)。","对应不上知识网络的项去掉;整个区块都对应不上时不做这个区块。不要编造对象类、属性或关系。","主题参照原型的底色、文字色、强调色和深浅,仍须满足对比度要求;原型的区块有底色、边框或阴影时 theme.surface 用 card,否则用 plain。","原型里对对象的操作按钮(如“催交”“新建采购单”),网络里有对应行动时配成组件的行动;没有完全对应的不配,说明没有照做时写出最接近的行动名称(如有),由用户决定。","这次以原型的排布为准,不用遵守“页面写法”里首屏先放结论、数字个数的要求。"];function Ib(){return`# 照原型做应用
|
|
419
428
|
|
|
420
429
|
> 由 \`workshop\` 命令生成,与构建器里“照原型做应用”交给 AI 的规则同出一处。
|
|
421
430
|
|
|
422
|
-
用户给出一个 HTML 原型(手写或 AI
|
|
431
|
+
用户给出一个 HTML 原型(手写或 AI 生成的单文件页面)或原型截图,要照它在当前知识网络上做这个应用时,按下面做。
|
|
423
432
|
|
|
424
433
|
## 读原型
|
|
425
434
|
|
|
426
435
|
- 直接读 HTML 文件:页面结构、样式里的颜色、脚本里的图表配置(如 ECharts 的 option、Chart.js 的 config)都在里面。
|
|
436
|
+
- 给的是截图时直接看图:每张截图是一个视图,同一页面分段截的合成一个;看不清的文字不写,不要猜。
|
|
427
437
|
- 原型里靠导航、侧栏或页签切换的每个视图做成一页,页面标题用视图名称。应用已有的页面保留不动,原型的页面加在后面;用户另有要求时按要求做。不改 \`app.name\`。
|
|
428
438
|
- 不把原型原样放进自定义组件。标准组件做不到的展示(如桑基图)列进最后的清单,用户要时再写自定义组件。
|
|
429
439
|
|
|
430
440
|
## 照着做
|
|
431
441
|
|
|
432
|
-
- 页面用 free
|
|
433
|
-
${
|
|
442
|
+
- 页面用 free 布局、细网格(layout.grid 写 fine):按原型里各块的位置和大小估 frame。24 列铺满内容区(不含侧栏和页边距),每行 20 像素;为满足组件最小尺寸可以适当调整,组件之间不要重叠。
|
|
443
|
+
${Lb.map(e=>`- ${e}`).join(`
|
|
434
444
|
`)}
|
|
435
445
|
|
|
436
446
|
## 做完
|
|
437
447
|
|
|
438
448
|
- 照常 \`workshop validate\`、\`workshop push\`,再给出预览地址。
|
|
439
449
|
- 告诉用户哪些没有照做、或做法与原型明显不同,以及原因,每项一句,如“表格列‘承运商’在网络中没有对应属性,已去掉”。
|
|
440
|
-
`}const Ee={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]{0,39}$"},Ib={type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$"},Mb={type:"number",minimum:1/60,maximum:720},Jl={type:"string",pattern:"^#[0-9a-fA-F]{6}$"},Ye={type:"object",required:["field","op"],properties:{field:{type:"string"},op:{enum:[...Gn]},ref:{type:"string"},value:{type:["string","number"]},values:{type:"array",items:{type:"string"}}}};function qb(e){const t={title:e.label};switch(e.kind){case"text":return{...t,type:"string",...e.max===null?{}:{maxLength:e.max??80}};case"number":return{...t,type:e.decimal?"number":"integer",minimum:e.min,maximum:e.max};case"enum":return{...t,enum:e.options.map(([n])=>n)};case"bool":return{...t,type:"boolean"};case"source":return{...t,type:"string",description:"sources[].id"};case"field":return{...t,type:"string",description:"数据源或对象类的属性名"};case"fields":return{...t,type:"array",items:{type:"string"},minItems:1};case"variable":return{...t,type:"string",description:`variables[].name,类型为 ${e.accepts.join(" 或 ")}`};case"bindings":return{...t,type:"array",items:{type:"object",additionalProperties:!1,required:["variable"],properties:{variable:{type:"string",description:"variables[].name"},field:{type:"string",description:"value、dateRange 筛选:按数据源的哪个字段比对"},fields:{type:"array",items:{type:"string"},description:"search 筛选:在数据源的哪些文本字段里查找"}}}};case"values":return{...t,type:"array",items:{type:"string"}};case"conditions":return{...t,type:"array",items:Ye};case"objectType":return{...t,type:"string",description:"知识网络中的对象类 id"};case"operation":return{...t,type:"string",description:"数据源里定义的情景操作 id"};case"relationPath":return e.single?{...t,type:"array",items:{type:"string"},minItems:1,maxItems:1,description:"一条直接相连的关系 id"}:{...t,type:"array",items:{type:"string"},description:"关系 id 列表"};case"eventType":return e.multiple?{...t,type:"array",items:{type:"string"},description:"eventTypes[].id"}:{...t,type:"string",description:"eventTypes[].id"};case"tool":return{...t,type:"object",additionalProperties:!1,required:["box","tool"],properties:{box:{type:"string",description:"执行工厂工具箱 id"},tool:{type:"string",description:"工具箱里的工具 id"},boxName:{type:"string",description:"工具箱名称,编号在别的环境不同时按它找回"},toolName:{type:"string",description:"工具名称,编号在别的环境不同时按它找回"}}};case"mcpTool":return{...t,type:"object",additionalProperties:!1,required:["mcp","tool"],properties:{mcp:{type:"string",description:"执行工厂 MCP 服务 id"},agentId:{type:"string",description:"服务中默认智能体的 id"},agentName:{type:"string",description:"默认智能体名称"},tool:{type:"string",description:"MCP 服务里的工具名称"},mcpName:{type:"string",description:"MCP 服务名称,只用于显示;不写时对话框向执行工厂取"}}};case"list":return{...t,type:"array",minItems:e.min,maxItems:e.max,items:Tr(e.item)};case"interactions":{const n={type:"object",properties:{from:{type:"string",enum:["input","var","const"]},label:{type:"string",maxLength:20},variable:{type:"string"},value:{type:["string","number","boolean"]}},required:["from"]},o={type:"object",additionalProperties:!1,properties:{kind:{const:"ask"},question:{type:"string",maxLength:300},agent:{type:"string",enum:["analyst"]},context:{type:"array",items:{type:"string",enum:[...or]}},send:{type:"string",enum:[...sr]},maxObjects:{type:"integer",minimum:1,maximum:rr}},required:["kind","question"]},s={type:"object",additionalProperties:!1,properties:{kind:{const:"act"},action:{type:"string",description:"行动类型 id"},targets:{oneOf:[...e.hit?[{const:"hit"}]:[],{type:"object",properties:{selection:{type:"string"}},required:["selection"]},{type:"object",properties:{set:{type:"string"}},required:["set"]}]},params:{type:"object",additionalProperties:n},confirm:{type:"string",maxLength:120},maxObjects:{type:"integer",minimum:1,maximum:Fs}},required:["kind","action"]},r={type:"object",additionalProperties:!1,properties:{kind:{const:"simulate"},operation:{type:"string",description:"数据源的推演操作 id"}},required:["kind","operation"]};return{...t,type:"array",maxItems:e.max,items:{type:"object",additionalProperties:!1,properties:{on:{type:"string",enum:[...e.on]},label:{type:"string",maxLength:20},do:{type:"array",minItems:1,maxItems:Jn,items:e.actOn.length>0?{oneOf:[o,s,r]}:o}},required:["on","do"]}}}case"actionTypes":return{...t,type:"array",items:{type:"string"},description:"行动类型 id"};case"metric":return{...t,type:"object",additionalProperties:!1,required:["id","version"],properties:{id:{type:"string",description:"知识网络中已发布的对象指标 id"},version:{type:"integer",minimum:1}}}}}function Tr(e){return{type:"object",additionalProperties:!1,properties:Object.fromEntries(e.map(t=>[t.key,qb(t)])),required:e.filter(t=>!t.optional&&!t.notNeeded).map(t=>t.key)}}const Zl=Object.keys(Xn.default).filter(e=>e.startsWith("color"));function Fb(){const e=t=>({type:"object",additionalProperties:!1,required:["id","type","config"],properties:{id:Ee,type:{const:t},span:{type:"integer",minimum:1,maximum:4},frame:{type:"object",additionalProperties:!1,required:["x","y","w","h"],properties:{x:{type:"integer",minimum:0,maximum:At-1},y:{type:"integer",minimum:0},w:{type:"integer",minimum:1,maximum:At},h:{type:"integer",minimum:1}}},surface:{enum:[..._t]},config:{$ref:`#/$defs/config_${t}`}}});return{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://openbkn.ai/schemas/workshop/app-spec/v1.json",title:"Workshop App Spec",type:"object",additionalProperties:!1,required:["apiVersion","app","dependencies","sources","variables","pages","theme"],properties:{scheduleModel:{type:"object",description:"调度向导的答案(结果落点、任务、资源、日历、计划记录),由向导维护;页面上的调度配置由它生成"},apiVersion:{const:pt},app:{type:"object",additionalProperties:!1,required:["id","name"],properties:{id:Ib,name:{type:"string"},description:{type:"string"}}},dependencies:{type:"object",additionalProperties:!1,required:["knowledgeNetwork"],properties:{knowledgeNetwork:{type:"object",required:["id","name"],properties:{id:{type:"string"},name:{type:"string"}}}}},sources:{type:"array",minItems:1,items:{$ref:"#/$defs/source"}},variables:{type:"array",items:{$ref:"#/$defs/variable"}},eventTypes:{type:"array",items:{$ref:"#/$defs/eventType"}},pages:{type:"array",minItems:1,items:{$ref:"#/$defs/page"}},navigation:{type:"object",additionalProperties:!1,required:["style"],properties:{style:{enum:[...Yf]}}},theme:{$ref:"#/$defs/theme"}},$defs:{source:{type:"object",additionalProperties:!1,required:["id","label","objectType","key"],properties:{id:Ee,label:{type:"string"},objectType:{type:"string"},key:{type:"string"},progress:{type:"object",additionalProperties:!1,required:["steps"],properties:{steps:{type:"array",minItems:1,maxItems:8,items:{type:"object",additionalProperties:!1,required:["label","field"],properties:{label:{type:"string"},field:{type:"string"},done:{type:"array",items:Ye}}}},due:{type:"object",additionalProperties:!1,required:["field"],properties:{field:{type:"string"},label:{type:"string"}}}}},formats:{type:"object",description:"字段显示格式,键为字段名:{ unit?, decimals?, colors?: [{ when, tone }] }",additionalProperties:{type:"object",additionalProperties:!1,properties:{unit:{type:"string"},decimals:{type:"integer",minimum:0,maximum:Ws},colors:{type:"array",items:{type:"object",required:["when","tone"],properties:{when:{type:"array",items:Ye},tone:{enum:[...Pt]}}}}}}},events:{type:"object",additionalProperties:!1,description:"事件数据源:objectType 为 events:<id>,key 为 event_id",properties:{types:{type:"array",items:{type:"string"}}}},from:{type:"object",additionalProperties:!1,required:["source"],description:"子集:来源数据源 id、对象须满足的条件、跟随的筛选",properties:{source:{type:"string"},where:{type:"array",items:Ye},filters:{type:"array",items:{type:"object"}}}},computed:{type:"array",items:{type:"object",required:["name","label","kind"],properties:{name:Ee,label:{type:"string"},kind:{enum:[...Zt]},cases:{type:"array",items:{type:"object"}},otherwise:{type:"object"},from:{type:"string"},to:{type:"string"},when:{type:"array",items:Ye},expr:{type:"string"},template:{type:"string"},path:{type:"array",items:{type:"string"}},aggregate:{enum:[...zs]},field:{type:"string"},type:{enum:["date","number","text"]},where:{type:"array",items:Ye},source:{type:"string"},pairs:{type:"array",items:{type:"object",required:["field","other"],properties:{field:{type:"string"},other:{type:"string"}}}}}}},operations:{type:"array",maxItems:Js,description:"推演操作:业务用户在方案中可做的假设;effects 只改知识网络属性,shiftDays/add 按当前值增减,set 设为参数值(日期属性可用 date 或 datetime 参数,datetime 精确到分钟),fromAsOf 设为基准日期起若干天;action 为采用方案时执行的行动",items:{type:"object",additionalProperties:!1,required:["id","label","params","effects"],properties:{id:Ee,label:{type:"string",maxLength:30},when:{type:"array",items:Ye},params:{type:"array",minItems:1,maxItems:Vn,items:{type:"object",additionalProperties:!1,required:["name","label","type"],properties:{name:Ee,label:{type:"string"},type:{enum:["number","date","datetime","text"]},min:{type:"number"},max:{type:"number"},default:{type:["string","number"]}}}},effects:{type:"array",description:"新建对象的行动(如为需求新建计划)可以没有效果",maxItems:Zs,items:{type:"object",additionalProperties:!1,required:["field","kind","param"],properties:{field:{type:"string"},kind:{enum:[...Ks]},param:{type:"string"}}}},action:{type:"object",additionalProperties:!1,required:["id"],properties:{id:{type:"string",description:"行动类型 id"},params:{type:"object",additionalProperties:{type:"object",properties:{from:{enum:["param","field","const"]},name:{type:"string"},value:{type:["string","number"]}},required:["from"]}},unique:{type:"array",items:{type:"string"},description:"新建行动的查重属性:已有对象这些属性相同(为空表示不限)时阻止新建,如计划的预测单号与产品编码"},active:{type:"array",items:Ye,description:"查重时只算满足这些条件的已有对象,如状态不是已取消"}}}}}},follows:{type:"array",maxItems:$r,description:"联动规则:方案中,本数据源的日期 field 不早于 from 数据源(页面中知识网络对象类的数据源)沿 path(从 from 的对象类到本对象类的关系类 id)关联到的对象的 fromField 加 gapDays 天。只有被直接改动、日期推迟的对象才往下推,推迟量减去余量;联动的值不再触发别的规则。取值带时刻(非零点)或设了 gapMinutes 时按分钟计算,否则按天。keepDuration 为本数据源的结束日期属性,随 field 移动同样的时长",items:{type:"object",additionalProperties:!1,required:["id","field","from","path","fromField","gapDays"],properties:{id:Ee,field:{type:"string"},from:{type:"string",description:"sources[].id"},path:{type:"array",minItems:1,maxItems:no,items:{type:"string"}},fromField:{type:"string"},gapDays:{type:"integer",minimum:-oo,maximum:oo},gapMinutes:{type:"integer",minimum:-so,maximum:so},keepDuration:{type:"string",description:"本数据源的结束日期属性"}}}},models:{type:"array",maxItems:Qs,description:"模型试算:业务用户选一批本数据源的对象,按几组参数各调用一次执行工厂的工具(tool.box 工具箱、tool.tool 工具),比较结果。页面把每个对象的 key 与 inputs 中的字段、params、asOf 发给工具,工具为每个对象返回 outputs 中的字段;measures 汇总结果,可读本数据源字段与 outputs;结果不写回知识网络。action 为按结果执行的行动",items:{type:"object",additionalProperties:!1,required:["id","label","tool","inputs","params","outputs","measures"],properties:{id:Ee,label:{type:"string",maxLength:30},description:{type:"string"},tool:{type:"object",additionalProperties:!1,required:["box","tool"],properties:{box:{type:"string",description:"执行工厂工具箱 id"},tool:{type:"string",description:"工具 id"},name:{type:"string",description:"工具名,供人阅读;编号在别的环境不同时按它找回"},boxName:{type:"string",description:"工具箱名称,编号在别的环境不同时按它找回"}}},inputs:{type:"array",minItems:1,maxItems:er,items:{type:"string"}},params:{type:"array",minItems:1,maxItems:Vn,items:{type:"object",additionalProperties:!1,required:["name","label","type"],properties:{name:Ee,label:{type:"string"},type:{enum:["number","date","text"]},min:{type:"number"},max:{type:"number"},default:{type:["string","number"]}}}},outputs:{type:"array",minItems:1,maxItems:tr,items:{type:"object",additionalProperties:!1,required:["name","label","type"],properties:{name:Ee,label:{type:"string"},type:{enum:["number","date","text"]}}}},measures:{type:"array",minItems:1,maxItems:nr,items:{type:"object",additionalProperties:!1,required:["label","aggregate"],properties:{label:{type:"string"},when:{type:"array",items:Ye},aggregate:{enum:[...Xs]},valueField:{type:"string"}}}},action:{type:"object",additionalProperties:!1,required:["id"],properties:{id:{type:"string",description:"行动类型 id"},params:{type:"object",additionalProperties:{type:"object",properties:{from:{enum:["param","field","output","const"]},name:{type:"string"},value:{type:["string","number"]}},required:["from"]}}}}}}},relatedTo:{type:"array",maxItems:Sr,description:"相关对象:方案中,from 数据源里有变化(改动或联动)的对象沿 path 关联到的本数据源对象标为相关,值不变",items:{type:"object",additionalProperties:!1,required:["id","from","path"],properties:{id:Ee,from:{type:"string",description:"sources[].id"},path:{type:"array",minItems:1,maxItems:no,items:{type:"string"}}}}}}},eventType:{type:"object",additionalProperties:!1,description:"应用怎样处理知识网络里的一类事件。事件类型(名称、来源、关联对象类、严重程度、规则)在知识网络里建模,这里只按编码引用并配置处理方式",required:["id"],properties:{id:{type:"string",pattern:"^[a-z0-9][a-z0-9_.-]{0,63}$",description:"知识网络里事件类型的编码"},owners:{type:"array",maxItems:8,items:{type:"string"}},dueHours:Mb,grouping:{type:"object",additionalProperties:!1,required:["mode"],properties:{mode:{enum:[...Hs]},by:{type:"string",description:"按属性归并时:用户登记的事件取关联对象的属性名;规则命中的事件取识别规则命中返回的列名"}}},strategies:{type:"array",maxItems:12,items:{type:"string",maxLength:40}},canvas:{type:"object",additionalProperties:!1,description:"把一条事件发到分析画布时交给画布 AI 的要求;可引用 {title}、{type}、{severity}、{object}、{occurredAt}、{detail.<字段>}",properties:{prompt:{type:"string",maxLength:ro,description:"提示词:告诉 AI 怎样分析,放在问题之前发送,不显示为提问"},question:{type:"string",maxLength:ro,description:"问题:这一次要回答的事,在 AI 栏里显示为用户的提问"}}},strategyActions:{type:"object",description:"处理方案名 → 提交这种处理时对事件关联对象执行的行动",additionalProperties:{type:"object",additionalProperties:!1,required:["action"],properties:{action:{type:"string",description:"关联对象类上的行动类型 id"},params:{type:"object",description:"行动参数名 → 取值;{ from: 'input' } 表示确认时由人填写"}}}},analysis:{type:"object",additionalProperties:!1,required:["page"],properties:{page:{type:"string",description:"分析从哪个页面开始:pages[].id"},selection:{type:"string",description:"选中事件关联对象的选中对象筛选"},asOf:{type:"boolean",description:"基准日期设为事件发生那天"},window:{type:"object",additionalProperties:!1,required:["variable","days"],properties:{variable:{type:"string",description:"日期区间筛选"},days:{type:"integer",minimum:1,maximum:365}}}}},report:{type:"object",additionalProperties:!1,description:"只用于用户登记的事件类型:登记表单与核实角色",required:["fields"],properties:{fields:{type:"array",maxItems:12,items:{type:"object",additionalProperties:!1,required:["name","label","type"],properties:{name:{type:"string",pattern:"^[a-z][a-z0-9_-]{0,39}$"},label:{type:"string"},type:{enum:[...Gs]},required:{type:"boolean"}}}},verifier:{type:"string"}}}}},variable:{type:"object",required:["name","label","kind"],properties:{name:Ee,label:{type:"string"},kind:{enum:[...Hn]},source:{type:"string",description:"只有 selection、set:对象来自哪个数据源"},default:{type:"string",description:"asOf:today 或 YYYY-MM-DD;dateRange:YYYY-MM-DD..YYYY-MM-DD(可省略一端);value、search:文本;selection、set 没有默认值"}}},page:{type:"object",additionalProperties:!1,required:["id","title","layout","regions"],properties:{id:Ee,title:{type:"string"},icon:{enum:[...Gf]},group:{type:"string"},hidden:{type:"boolean"},badge:{enum:[...Hf]},layout:{$ref:"#/$defs/layout"},regions:{type:"object",additionalProperties:{type:"array",items:{oneOf:Ve.map(t=>e(t))}}},detail:{type:"object",additionalProperties:!1,required:["id","type","config"],properties:{id:Ee,type:{const:me},config:{$ref:`#/$defs/config_${me}`}}}}},layout:{type:"object",required:["type","columns","sidePosition","sideWidth","asideWidth","gap"],properties:{type:{enum:[...Ds]},columns:{type:"integer",minimum:2,maximum:4},sidePosition:{enum:["left","right"]},sideWidth:{type:"integer",minimum:220,maximum:420},asideWidth:{anyOf:[{const:0},{type:"integer",minimum:240,maximum:420}]},gap:{enum:["compact","normal","relaxed"]},pinRows:{type:"integer",minimum:0,maximum:xr}}},theme:{type:"object",required:["name","mode",...Zl,"chartPalette","fontFamily"],properties:{name:{type:"string"},mode:{enum:["light","dark"]},...Object.fromEntries(Zl.map(t=>[t,Jl])),chartPalette:{type:"array",minItems:6,maxItems:8,items:Jl},fontFamily:{type:"string"},fontSize:{type:"integer",minimum:12,maximum:16},radius:{type:"integer",minimum:0,maximum:16},shadow:{enum:[...Bs]},density:{enum:[...Us]},surface:{enum:[..._t]}}},...Object.fromEntries(Ve.map(t=>[`config_${t}`,{title:ze[t].label,description:ze[t].description,...Tr(ze[t].descriptors)}])),[`config_${me}`]:{title:dt.label,description:dt.description,...Tr(dt.descriptors)}}}}const Db={string:"文本属性",number:"数字属性",date:"日期属性",datetime:"日期属性"},Bb=new Set(["title","source","filters","selection",ot]);function Ub(e,t){return t.length===0?"":`## 本应用的自定义组件
|
|
450
|
+
`}const Ee={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]{0,39}$"},Mb={type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$"},qb={type:"number",minimum:1/60,maximum:720},Vl={type:"string",pattern:"^#[0-9a-fA-F]{6}$"},Ke={type:"object",required:["field","op"],properties:{field:{type:"string"},op:{enum:[...zn]},ref:{type:"string"},value:{type:["string","number"]},values:{type:"array",items:{type:"string"}}}};function Fb(e){const t={title:e.label};switch(e.kind){case"text":return{...t,type:"string",...e.max===null?{}:{maxLength:e.max??80}};case"number":return{...t,type:e.decimal?"number":"integer",minimum:e.min,maximum:e.max};case"enum":return{...t,enum:e.options.map(([n])=>n)};case"bool":return{...t,type:"boolean"};case"source":return{...t,type:"string",description:"sources[].id"};case"field":return{...t,type:"string",description:"数据源或对象类的属性名"};case"fields":return{...t,type:"array",items:{type:"string"},minItems:1};case"variable":return{...t,type:"string",description:`variables[].name,类型为 ${e.accepts.join(" 或 ")}`};case"bindings":return{...t,type:"array",items:{type:"object",additionalProperties:!1,required:["variable"],properties:{variable:{type:"string",description:"variables[].name"},field:{type:"string",description:"value、dateRange 筛选:按数据源的哪个字段比对"},fields:{type:"array",items:{type:"string"},description:"search 筛选:在数据源的哪些文本字段里查找"}}}};case"values":return{...t,type:"array",items:{type:"string"}};case"conditions":return{...t,type:"array",items:Ke};case"objectType":return{...t,type:"string",description:"知识网络中的对象类 id"};case"operation":return{...t,type:"string",description:"数据源里定义的情景操作 id"};case"relationPath":return e.single?{...t,type:"array",items:{type:"string"},minItems:1,maxItems:1,description:"一条直接相连的关系 id"}:{...t,type:"array",items:{type:"string"},description:"关系 id 列表"};case"eventType":return e.multiple?{...t,type:"array",items:{type:"string"},description:"eventTypes[].id"}:{...t,type:"string",description:"eventTypes[].id"};case"tool":return{...t,type:"object",additionalProperties:!1,required:["box","tool"],properties:{box:{type:"string",description:"执行工厂工具箱 id"},tool:{type:"string",description:"工具箱里的工具 id"},boxName:{type:"string",description:"工具箱名称,编号在别的环境不同时按它找回"},toolName:{type:"string",description:"工具名称,编号在别的环境不同时按它找回"}}};case"mcpTool":return{...t,type:"object",additionalProperties:!1,required:["mcp","tool"],properties:{mcp:{type:"string",description:"执行工厂 MCP 服务 id"},agentId:{type:"string",description:"服务中默认智能体的 id"},agentName:{type:"string",description:"默认智能体名称"},tool:{type:"string",description:"MCP 服务里的工具名称"},mcpName:{type:"string",description:"MCP 服务名称,只用于显示;不写时对话框向执行工厂取"}}};case"list":return{...t,type:"array",minItems:e.min,maxItems:e.max,items:Ar(e.item)};case"interactions":{const n={type:"object",properties:{from:{type:"string",enum:["input","var","const"]},label:{type:"string",maxLength:20},variable:{type:"string"},value:{type:["string","number","boolean"]}},required:["from"]},o={type:"object",additionalProperties:!1,properties:{kind:{const:"ask"},question:{type:"string",maxLength:300},agent:{type:"string",enum:["analyst"]},context:{type:"array",items:{type:"string",enum:[...nr]}},send:{type:"string",enum:[...or]},maxObjects:{type:"integer",minimum:1,maximum:sr}},required:["kind","question"]},s={type:"object",additionalProperties:!1,properties:{kind:{const:"act"},action:{type:"string",description:"行动类型 id"},targets:{oneOf:[...e.hit?[{const:"hit"}]:[],{type:"object",properties:{selection:{type:"string"}},required:["selection"]},{type:"object",properties:{set:{type:"string"}},required:["set"]}]},params:{type:"object",additionalProperties:n},confirm:{type:"string",maxLength:120},maxObjects:{type:"integer",minimum:1,maximum:Gs}},required:["kind","action"]},a={type:"object",additionalProperties:!1,properties:{kind:{const:"simulate"},operation:{type:"string",description:"数据源的推演操作 id"}},required:["kind","operation"]};return{...t,type:"array",maxItems:e.max,items:{type:"object",additionalProperties:!1,properties:{on:{type:"string",enum:[...e.on]},label:{type:"string",maxLength:20},do:{type:"array",minItems:1,maxItems:Jn,items:e.actOn.length>0?{oneOf:[o,s,a]}:o}},required:["on","do"]}}}case"actionTypes":return{...t,type:"array",items:{type:"string"},description:"行动类型 id"};case"metric":return{...t,type:"object",additionalProperties:!1,required:["id","version"],properties:{id:{type:"string",description:"知识网络中已发布的对象指标 id"},version:{type:"integer",minimum:1}}}}}function Ar(e){return{type:"object",additionalProperties:!1,properties:Object.fromEntries(e.map(t=>[t.key,Fb(t)])),required:e.filter(t=>!t.optional&&!t.notNeeded).map(t=>t.key)}}const Jl=Object.keys(Zr.default).filter(e=>e.startsWith("color"));function Db(){const e=t=>({type:"object",additionalProperties:!1,required:["id","type","config"],properties:{id:Ee,type:{const:t},span:{type:"integer",minimum:1,maximum:4},frame:{type:"object",additionalProperties:!1,required:["x","y","w","h"],properties:{x:{type:"integer",minimum:0,maximum:ht.fine.columns-1},y:{type:"integer",minimum:0},w:{type:"integer",minimum:1,maximum:ht.fine.columns},h:{type:"integer",minimum:1}}},surface:{enum:[...Rt]},config:{$ref:`#/$defs/config_${t}`}}});return{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://openbkn.ai/schemas/workshop/app-spec/v1.json",title:"Workshop App Spec",type:"object",additionalProperties:!1,required:["apiVersion","app","dependencies","sources","variables","pages","theme"],properties:{scheduleModel:{type:"object",description:"调度向导的答案(结果落点、任务、资源、日历、计划记录),由向导维护;页面上的调度配置由它生成"},apiVersion:{const:pt},app:{type:"object",additionalProperties:!1,required:["id","name"],properties:{id:Mb,name:{type:"string"},description:{type:"string"}}},dependencies:{type:"object",additionalProperties:!1,required:["knowledgeNetwork"],properties:{knowledgeNetwork:{type:"object",required:["id","name"],properties:{id:{type:"string"},name:{type:"string"}}}}},sources:{type:"array",minItems:1,items:{$ref:"#/$defs/source"}},variables:{type:"array",items:{$ref:"#/$defs/variable"}},eventTypes:{type:"array",items:{$ref:"#/$defs/eventType"}},pages:{type:"array",minItems:1,items:{$ref:"#/$defs/page"}},navigation:{type:"object",additionalProperties:!1,required:["style"],properties:{style:{enum:[...Gf]}}},theme:{$ref:"#/$defs/theme"}},$defs:{source:{type:"object",additionalProperties:!1,required:["id","label","objectType","key"],properties:{id:Ee,label:{type:"string"},objectType:{type:"string"},key:{type:"string"},progress:{type:"object",additionalProperties:!1,required:["steps"],properties:{steps:{type:"array",minItems:1,maxItems:8,items:{type:"object",additionalProperties:!1,required:["label","field"],properties:{label:{type:"string"},field:{type:"string"},done:{type:"array",items:Ke}}}},due:{type:"object",additionalProperties:!1,required:["field"],properties:{field:{type:"string"},label:{type:"string"}}}}},formats:{type:"object",description:"字段显示格式,键为字段名:{ unit?, decimals?, colors?: [{ when, tone }] }",additionalProperties:{type:"object",additionalProperties:!1,properties:{unit:{type:"string"},decimals:{type:"integer",minimum:0,maximum:Bs},colors:{type:"array",items:{type:"object",required:["when","tone"],properties:{when:{type:"array",items:Ke},tone:{enum:[..._t]}}}}}}},events:{type:"object",additionalProperties:!1,description:"事件数据源:objectType 为 events:<id>,key 为 event_id",properties:{types:{type:"array",items:{type:"string"}}}},from:{type:"object",additionalProperties:!1,required:["source"],description:"子集:来源数据源 id、对象须满足的条件、跟随的筛选",properties:{source:{type:"string"},where:{type:"array",items:Ke},filters:{type:"array",items:{type:"object"}}}},computed:{type:"array",items:{type:"object",required:["name","label","kind"],properties:{name:Ee,label:{type:"string"},kind:{enum:[...Ht]},cases:{type:"array",items:{type:"object"}},otherwise:{type:"object"},from:{type:"string"},to:{type:"string"},when:{type:"array",items:Ke},expr:{type:"string"},template:{type:"string"},path:{type:"array",items:{type:"string"}},aggregate:{enum:[...Ds]},field:{type:"string"},type:{enum:["date","number","text"]},where:{type:"array",items:Ke},source:{type:"string"},pairs:{type:"array",items:{type:"object",required:["field","other"],properties:{field:{type:"string"},other:{type:"string"}}}}}}},operations:{type:"array",maxItems:Vs,description:"推演操作:业务用户在方案中可做的假设;effects 只改知识网络属性,shiftDays/add 按当前值增减,set 设为参数值(日期属性可用 date 或 datetime 参数,datetime 精确到分钟),fromAsOf 设为基准日期起若干天;action 为采用方案时执行的行动",items:{type:"object",additionalProperties:!1,required:["id","label","params","effects"],properties:{id:Ee,label:{type:"string",maxLength:30},when:{type:"array",items:Ke},params:{type:"array",minItems:1,maxItems:Vn,items:{type:"object",additionalProperties:!1,required:["name","label","type"],properties:{name:Ee,label:{type:"string"},type:{enum:["number","date","datetime","text"]},min:{type:"number"},max:{type:"number"},default:{type:["string","number"]}}}},effects:{type:"array",description:"新建对象的行动(如为需求新建计划)可以没有效果",maxItems:Js,items:{type:"object",additionalProperties:!1,required:["field","kind","param"],properties:{field:{type:"string"},kind:{enum:[...Us]},param:{type:"string"}}}},action:{type:"object",additionalProperties:!1,required:["id"],properties:{id:{type:"string",description:"行动类型 id"},params:{type:"object",additionalProperties:{type:"object",properties:{from:{enum:["param","field","const"]},name:{type:"string"},value:{type:["string","number"]}},required:["from"]}},unique:{type:"array",items:{type:"string"},description:"新建行动的查重属性:已有对象这些属性相同(为空表示不限)时阻止新建,如计划的预测单号与产品编码"},active:{type:"array",items:Ke,description:"查重时只算满足这些条件的已有对象,如状态不是已取消"}}}}}},follows:{type:"array",maxItems:vr,description:"联动规则:方案中,本数据源的日期 field 不早于 from 数据源(页面中知识网络对象类的数据源)沿 path(从 from 的对象类到本对象类的关系类 id)关联到的对象的 fromField 加 gapDays 天。只有被直接改动、日期推迟的对象才往下推,推迟量减去余量;联动的值不再触发别的规则。取值带时刻(非零点)或设了 gapMinutes 时按分钟计算,否则按天。keepDuration 为本数据源的结束日期属性,随 field 移动同样的时长",items:{type:"object",additionalProperties:!1,required:["id","field","from","path","fromField","gapDays"],properties:{id:Ee,field:{type:"string"},from:{type:"string",description:"sources[].id"},path:{type:"array",minItems:1,maxItems:to,items:{type:"string"}},fromField:{type:"string"},gapDays:{type:"integer",minimum:-no,maximum:no},gapMinutes:{type:"integer",minimum:-oo,maximum:oo},keepDuration:{type:"string",description:"本数据源的结束日期属性"}}}},models:{type:"array",maxItems:Xs,description:"模型试算:业务用户选一批本数据源的对象,按几组参数各调用一次执行工厂的工具(tool.box 工具箱、tool.tool 工具),比较结果。页面把每个对象的 key 与 inputs 中的字段、params、asOf 发给工具,工具为每个对象返回 outputs 中的字段;measures 汇总结果,可读本数据源字段与 outputs;结果不写回知识网络。action 为按结果执行的行动",items:{type:"object",additionalProperties:!1,required:["id","label","tool","inputs","params","outputs","measures"],properties:{id:Ee,label:{type:"string",maxLength:30},description:{type:"string"},tool:{type:"object",additionalProperties:!1,required:["box","tool"],properties:{box:{type:"string",description:"执行工厂工具箱 id"},tool:{type:"string",description:"工具 id"},name:{type:"string",description:"工具名,供人阅读;编号在别的环境不同时按它找回"},boxName:{type:"string",description:"工具箱名称,编号在别的环境不同时按它找回"}}},inputs:{type:"array",minItems:1,maxItems:Qs,items:{type:"string"}},params:{type:"array",minItems:1,maxItems:Vn,items:{type:"object",additionalProperties:!1,required:["name","label","type"],properties:{name:Ee,label:{type:"string"},type:{enum:["number","date","text"]},min:{type:"number"},max:{type:"number"},default:{type:["string","number"]}}}},outputs:{type:"array",minItems:1,maxItems:er,items:{type:"object",additionalProperties:!1,required:["name","label","type"],properties:{name:Ee,label:{type:"string"},type:{enum:["number","date","text"]}}}},measures:{type:"array",minItems:1,maxItems:tr,items:{type:"object",additionalProperties:!1,required:["label","aggregate"],properties:{label:{type:"string"},when:{type:"array",items:Ke},aggregate:{enum:[...Zs]},valueField:{type:"string"}}}},action:{type:"object",additionalProperties:!1,required:["id"],properties:{id:{type:"string",description:"行动类型 id"},params:{type:"object",additionalProperties:{type:"object",properties:{from:{enum:["param","field","output","const"]},name:{type:"string"},value:{type:["string","number"]}},required:["from"]}}}}}}},relatedTo:{type:"array",maxItems:$r,description:"相关对象:方案中,from 数据源里有变化(改动或联动)的对象沿 path 关联到的本数据源对象标为相关,值不变",items:{type:"object",additionalProperties:!1,required:["id","from","path"],properties:{id:Ee,from:{type:"string",description:"sources[].id"},path:{type:"array",minItems:1,maxItems:to,items:{type:"string"}}}}}}},eventType:{type:"object",additionalProperties:!1,description:"应用怎样处理知识网络里的一类事件。事件类型(名称、来源、关联对象类、严重程度、规则)在知识网络里建模,这里只按编码引用并配置处理方式",required:["id"],properties:{id:{type:"string",pattern:"^[a-z0-9][a-z0-9_.-]{0,63}$",description:"知识网络里事件类型的编码"},owners:{type:"array",maxItems:8,items:{type:"string"}},dueHours:qb,grouping:{type:"object",additionalProperties:!1,required:["mode"],properties:{mode:{enum:[...Ks]},by:{type:"string",description:"按属性归并时:用户登记的事件取关联对象的属性名;规则命中的事件取识别规则命中返回的列名"}}},strategies:{type:"array",maxItems:12,items:{type:"string",maxLength:40}},canvas:{type:"object",additionalProperties:!1,description:"把一条事件发到分析画布时交给画布 AI 的要求;可引用 {title}、{type}、{severity}、{object}、{occurredAt}、{detail.<字段>}",properties:{prompt:{type:"string",maxLength:so,description:"提示词:告诉 AI 怎样分析,放在问题之前发送,不显示为提问"},question:{type:"string",maxLength:so,description:"问题:这一次要回答的事,在 AI 栏里显示为用户的提问"}}},strategyActions:{type:"object",description:"处理方案名 → 提交这种处理时对事件关联对象执行的行动",additionalProperties:{type:"object",additionalProperties:!1,required:["action"],properties:{action:{type:"string",description:"关联对象类上的行动类型 id"},params:{type:"object",description:"行动参数名 → 取值;{ from: 'input' } 表示确认时由人填写"}}}},analysis:{type:"object",additionalProperties:!1,required:["page"],properties:{page:{type:"string",description:"分析从哪个页面开始:pages[].id"},selection:{type:"string",description:"选中事件关联对象的选中对象筛选"},asOf:{type:"boolean",description:"基准日期设为事件发生那天"},window:{type:"object",additionalProperties:!1,required:["variable","days"],properties:{variable:{type:"string",description:"日期区间筛选"},days:{type:"integer",minimum:1,maximum:365}}}}},report:{type:"object",additionalProperties:!1,description:"只用于用户登记的事件类型:登记表单与核实角色",required:["fields"],properties:{fields:{type:"array",maxItems:12,items:{type:"object",additionalProperties:!1,required:["name","label","type"],properties:{name:{type:"string",pattern:"^[a-z][a-z0-9_-]{0,39}$"},label:{type:"string"},type:{enum:[...Ws]},required:{type:"boolean"}}}},verifier:{type:"string"}}}}},variable:{type:"object",required:["name","label","kind"],properties:{name:Ee,label:{type:"string"},kind:{enum:[...Wn]},source:{type:"string",description:"只有 selection、set:对象来自哪个数据源"},default:{type:"string",description:"asOf:today 或 YYYY-MM-DD;dateRange:YYYY-MM-DD..YYYY-MM-DD(可省略一端);value、search:文本;selection、set 没有默认值"}}},page:{type:"object",additionalProperties:!1,required:["id","title","layout","regions"],properties:{id:Ee,title:{type:"string"},icon:{enum:[...Hf]},group:{type:"string"},hidden:{type:"boolean"},badge:{enum:[...Vf]},layout:{$ref:"#/$defs/layout"},regions:{type:"object",additionalProperties:{type:"array",items:{oneOf:Ve.map(t=>e(t))}}},detail:{type:"object",additionalProperties:!1,required:["id","type","config"],properties:{id:Ee,type:{const:Te},config:{$ref:`#/$defs/config_${Te}`}}}}},layout:{type:"object",required:["type","columns","sidePosition","sideWidth","asideWidth","gap"],properties:{type:{enum:[...Is]},columns:{type:"integer",minimum:2,maximum:4},sidePosition:{enum:["left","right"]},sideWidth:{type:"integer",minimum:220,maximum:420},asideWidth:{anyOf:[{const:0},{type:"integer",minimum:240,maximum:420}]},gap:{enum:["compact","normal","relaxed"]},grid:{enum:[...Ms]},pinRows:{type:"integer",minimum:0,maximum:Fu}}},theme:{type:"object",required:["name","mode",...Jl,"chartPalette","fontFamily"],properties:{name:{type:"string"},mode:{enum:["light","dark"]},...Object.fromEntries(Jl.map(t=>[t,Vl])),chartPalette:{type:"array",minItems:6,maxItems:8,items:Vl},fontFamily:{type:"string"},fontSize:{type:"integer",minimum:12,maximum:16},radius:{type:"integer",minimum:0,maximum:16},shadow:{enum:[...qs]},density:{enum:[...Fs]},surface:{enum:[...Rt]}}},...Object.fromEntries(Ve.map(t=>[`config_${t}`,{title:He[t].label,description:He[t].description,...Ar(He[t].descriptors)}])),[`config_${Te}`]:{title:dt.label,description:dt.description,...Ar(dt.descriptors)}}}}const Bb={string:"文本属性",number:"数字属性",date:"日期属性",datetime:"日期属性"},Ub=new Set(["title","source","filters","selection",ot]);function zb(e,t){return t.length===0?"":`## 本应用的自定义组件
|
|
441
451
|
按 ${ie}/ 下各组件的清单生成,放法与上面的标准组件相同:
|
|
442
452
|
- type 写清单里的 type;app.yaml 的 components 由 workshop push 填写,不要手写。
|
|
443
453
|
- ${ot}.<角色> 在 app.yaml 里写成 ${ot}: { <角色>: 属性名 },角色来自清单的 data.fields。
|
|
444
454
|
- 新建的组件要先运行一次 workshop validate,这里才会列出它。
|
|
445
455
|
|
|
446
|
-
${t.map(n=>
|
|
456
|
+
${t.map(n=>Wb(e,n)).join(`
|
|
447
457
|
|
|
448
|
-
`)}`}function
|
|
449
|
-
清单读不出来,这里列不出它的配置:运行 workshop validate 查看错误。`;if(!o)return s;let
|
|
450
|
-
`)}function
|
|
451
|
-
`)}const Re="app.yaml",Ae=".workshop",
|
|
452
|
-
${
|
|
453
|
-
`)}const
|
|
454
|
-
`),Ne(e,
|
|
455
|
-
`);const s=
|
|
458
|
+
`)}`}function Wb(e,t){const n=`${ie}/${t.folder}`,o=t.manifest,s=`### ${n}
|
|
459
|
+
清单读不出来,这里列不出它的配置:运行 workshop validate 查看错误。`;if(!o)return s;let a;try{a=Uc(o)}catch{return s}const r=o.defaultSize??{w:6,h:6},l=o.minSize??{w:3,h:3},c=ht.fine.scale,i={w:r.w*c,h:r.h*c},d=we(G(e,n,"README.md"))?`,组件说明 ${n}/README.md`:"";return[`### ${o.type}(${a.label})`,...o.description?[o.description]:[],`目录:${n}${d}`,`大小(free 布局的 frame,列×行):细网格默认 ${i.w}×${i.h},最小 ${l.w*c}×${l.h*c};标准网格默认 ${r.w}×${r.h},最小 ${l.w}×${l.h}`,"config:",...a.descriptors.map(h=>Qn([h])+(h.hint?`;${h.hint}`:"")),"示例(细网格页面):",Kb(o,i)].join(`
|
|
460
|
+
`)}function Kb(e,t){const n=[];e.data.source&&n.push("source: <数据源 id>");const o=Array.isArray(e.data.fields)?e.data.fields:[];o.length>0&&n.push(`${ot}: { ${o.map(l=>`${l.role}: <${Bb[l.type]??"属性"}>`).join(", ")} }`);const s=e.configSchema.properties??{};for(const l of e.configSchema.required??[]){if(Ub.has(l))continue;const c=s[l],i=c?.default!==void 0?JSON.stringify(c.default):`<${c?.title??l}>`;n.push(`${l}: ${i}`)}const a=e.type.slice(e.type.indexOf(".")+1).replace(/[^A-Za-z0-9]/g,"");return[` - id: ${/^[A-Za-z]/.test(a)?a:`custom${a}`}`,` type: ${e.type}`,` frame: { x: 0, y: 0, w: ${t.w}, h: ${t.h} }`,...n.length>0?[" config:",...n.map(l=>` ${l}`)]:[" config: {}"]].join(`
|
|
461
|
+
`)}const Re="app.yaml",Ae=".workshop",Yd=`${Ae}/app-spec.schema.json`,vo=`${Ae}/remote`,Gd=`${vo}/${Re}`,Hd=`${vo}/${ie}`,Yb=`# yaml-language-server: $schema=./${Yd}`,it=e=>ic("sha256").update(e).digest("hex");function Zl(e){return`${Yb}
|
|
462
|
+
${Ye.stringify(e,{lineWidth:0})}`}function Ne(e,t,n){const o=G(e,t);Bn(At(o),{recursive:!0}),rc(o,n)}function on(e,t){const n=G(e,t);return we(n)?ct(n,"utf8"):null}function Pe(e){const t=on(e,`${Ae}/state.json`);return t===null?null:JSON.parse(t)}function Vd(e,t){Ne(e,`${Ae}/state.json`,`${JSON.stringify(t,null,2)}
|
|
463
|
+
`)}const $o=e=>on(e,Re),Tr=(e,t)=>Ne(e,Re,t),Gb=e=>we(G(e,vo)),Hb=(e,t)=>Ne(e,Gd,t);function Jd(e){ut(G(e,vo),{recursive:!0,force:!0})}function Zd(e){const t=G(e,Hd);return[...we(G(e,Gd))?[Re]:[],...we(t)?en(t).sort().map(n=>`${ie}/${n}`):[]]}const Vb=()=>kb.filter(e=>!Cr.has(e));async function Xd(e,t,n=wn(e)){const o=Lt();Ne(e,`${Ae}/network.json`,`${JSON.stringify(t,null,2)}
|
|
464
|
+
`),Ne(e,Yd,`${JSON.stringify(Db(),null,2)}
|
|
465
|
+
`);const s=zb(e,n);Ne(e,`${Ae}/guides/app-spec.md`,`${D().rulesHeader}
|
|
456
466
|
|
|
457
467
|
${Eb(t)}
|
|
458
468
|
${s?`
|
|
459
469
|
${s}
|
|
460
|
-
`:""}`),Ne(e,`${Ae}/guides/custom-components.md`,await
|
|
461
|
-
`)}function
|
|
470
|
+
`:""}`),Ne(e,`${Ae}/guides/custom-components.md`,await $b(o)),Ne(e,`${Ae}/guides/prototype.md`,Ib()),ut(G(e,Ae,"guides","components"),{recursive:!0,force:!0});for(const a of Vb())Ne(e,`${Ae}/guides/components/${a}.md`,await vb(a,o))}function Qd(e,t){on(e,"AGENTS.md")===null&&Ne(e,"AGENTS.md",D().agents(t.name)),on(e,"CLAUDE.md")===null&&Ne(e,"CLAUDE.md",`@AGENTS.md
|
|
471
|
+
`)}function Jb(e,t){Qd(e,t);const n=on(e,".gitignore");n===null?Ne(e,".gitignore",`${Ae}/
|
|
462
472
|
`):n.split(/\r?\n/).some(o=>o.trim().replace(/\/$/,"")===Ae)||Ne(e,".gitignore",`${n.replace(/\n?$/,`
|
|
463
473
|
`)}${Ae}/
|
|
464
|
-
`)}class F extends Error{}const
|
|
465
|
-
`))):new F(D().appNotFound(t))}function
|
|
466
|
-
`)));const r=D(),a=n.slice(0,30).map(l=>r.quoted(l.name));throw new F(r.networkNotFound(t,a.join(r.and),n.length,n.length>a.length))}async function nw(e,t,n,o,s){const r=o.trim(),a=D();if(!r)throw new F(a.emptyName);const l=Pe(t);if(l)throw new F(a.alreadyProject(t,l.app.name));if(we(t)&&jo(t)!==null)throw new F(a.hasAppFile(t,Re));const c=await tw(e,n);let i;try{i=await e.createApp(r,c)}catch(d){throw d instanceof Fr?new F(a.noCreateRight(c.name)):d}return s.out(a.created(c.name,i.name,i.id)),await na(e,t,i.id,null,s.out,s),0}async function ow(e,t,n,o){const s=D(),r=Pe(t);if(r&&n&&n!==r.app.id&&n!==r.app.name)throw new F(s.otherProject(t,r.app.name,r.app.id,n));if(!r&&!n)throw new F(s.firstPullNeedsApp);if(!r&&we(t)&&jo(t)!==null)throw new F(s.notPulled(t,Re));const a=r?.app.id??(await Zb(e,n)).id;return await na(e,t,a,r,o.out,o),0}const Dn=e=>typeof e=="object"&&e!==null&&"type"in e;function sw(e,t,n){const o=D(),s=[],r=[],a=[],l=new Map;for(const p of t){const f=`${ie}/${p.folder}`;if(s.push(...p.check.errors.map(y=>({file:f,message:y}))),!p.type)continue;const m=l.get(p.type);if(m){s.push({file:f,message:o.sameType(`${ie}/${m.folder}`,p.type)});continue}l.set(p.type,p);const g=n[p.type];if(!(p.hash===g?.hash||g?.behind&&p.hash===g.package)){if(g?.behind){s.push({file:f,message:o.behindChanged(p.type)});continue}a.push(p),r.push(...p.check.warnings.map(y=>o.at(f,y)))}}const c=p=>a.includes(p)?p.hash:n[p.type]?.package,i=Array.isArray(e)?e:[],d=i.map(p=>{const f=Dn(p)?l.get(p.type):void 0;return f?{...p,package:c(f),...a.includes(f)?{source:"upload"}:{}}:p});for(const[p,f]of l)i.some(m=>Dn(m)&&m.type===p)||d.push({type:p,package:c(f),source:"upload"});const h={};for(const[p,f]of l){const m=n[p];h[p]=m?.behind&&f.hash===m.hash?m:{folder:f.folder,package:c(f),hash:f.hash}}for(const[p,f]of Object.entries(n))!h[p]&&d.some(m=>Dn(m)&&m.type===p)&&(h[p]=f);const u=new Set([...l.keys()].filter(p=>h[p]?.behind));return{components:d,uploads:a,tracked:h,problems:s,warnings:r,usable:l,behind:u}}function rw(e,t){const n=Ge.parseDocument(e),o=n.toJS()?.components;return Su(o??[],t)?e:(t.length===0?n.delete("components"):n.set("components",t),n.toString({lineWidth:0}))}async function nu(e,t,n,o,s=wn(t)){const{spec:r,syntax:a,locate:l}=yb(o);if(a.length>0)return{ok:!1,errors:a,warnings:[]};const c=r?.apiVersion,i=[],d=D();typeof c=="string"&&c!==pt&&i.push(d.apiVersion(Re,c,pt));const h=await e.readNetwork(n.network);await Qd(t,h,s);const u=r?.components,p=sw(u,s,n.components??{});i.push(...p.warnings);for(const[k,w]of p.usable)!p.behind.has(k)&&vd(w.manifest,It()).length===0&&Bc(p.components.find(v=>v.type===k)?.package??w.hash,w.manifest);const f=p.components.filter(k=>Dn(k)&&(!p.usable.has(k.type)||p.behind.has(k.type)));for(const k of await e.registerComponents(f))i.push(d.manifestUnreadable(k));const g=(Array.isArray(u)||u===void 0&&p.components.length>0)&&r&&typeof r=="object"?{...r,components:p.components}:r,y=Ud(g,h,{allowEmpty:!0}),b=[...p.problems,...y.ok?[]:y.errors.map(l)];return!y.ok||b.length>0?{ok:!1,errors:b,warnings:i}:{ok:!0,spec:y.app,components:p.components,uploads:p.uploads,tracked:p.tracked,warnings:i}}function ou(e,t){const n=D();for(const o of t.warnings)e.err(n.note(o));if(!t.ok){for(const o of t.errors)e.err(`${o.file??Re}${o.line?`:${o.line}`:""} ${o.message}`);e.err(n.errorCount(t.errors.length))}}async function aw(e,t,n){const{state:o,text:s}=ta(t),r=await nu(e,t,o,s);return ou(n,r),r.ok&&n.out(D().validated),r.ok?0:1}function Ql(e,t){const n=D();return e instanceof Fr?new F(n.forbidden):e instanceof qr?new F(n.appGone(t)):e instanceof Vc?new F(n.tooLarge):null}function iw(e,t){const n={};for(const[o,s]of Object.entries(e))n[o]={...s,package:t(s.package)};return n}function su(e,t,n){const o=e.components??{},s=n.every(r=>r.type&&r.hash===o[r.type]?.hash);return it(t)!==e.appHash||!s}function lw(e){const{state:t,text:n}=ta(e);return su(t,n,wn(e))}async function ru(e,t,{merged:n=!1},o){const s=D(),{state:r,text:a}=ta(t);if(n&&r.remoteRevision===void 0)throw new F(s.nothingToMerge);if(!n&&Yb(t))return o.err(tu(r.remoteRevision??r.revision,Xd(t))),"merge";const l=wn(t);if(!n&&!su(r,a,l))return o.out(s.unchanged),"unchanged";const c=await nu(e,t,r,a,l);if(ou(o,c),!c.ok)return o.err(s.invalidNotPushed),"invalid";const i=n?r.remoteRevision:r.revision,d=async()=>await na(e,t,r.app.id,r,o.err,o)?"merge":"synced";if(c.uploads.length>0){const w=await e.getApp(r.app.id);if(!w)throw new F(s.appGone(r.app.id));if(w.revision!==i)return await d()}const h=new Map;for(const w of c.uploads){const v=`${ie}/${w.folder}`;try{const S=await e.uploadPackage(r.app.id,tg(w.files));for(const j of S.warnings)o.err(s.note(s.at(v,j)));S.id!==w.hash&&h.set(w.hash,S.id),o.out(s.uploaded(v,w.type))}catch(S){throw Ql(S,r.app.id)??new F(s.uploadRefused(v,Fn(S)))}}const u=w=>h.get(w)??w,p=c.components.map(w=>({...w,package:u(w.package)})),f=c.spec.components?{...c.spec,components:c.spec.components.map(w=>({...w,package:u(w.package)}))}:c.spec,m=rw(a,p);let g;try{g=await e.saveDraft(r.app.id,f,i)}catch(w){if(w instanceof Hc)return await d();throw Ql(w,r.app.id)??w}m!==a&&Or(t,m);const{remoteRevision:y,blankHash:b,...k}=r;return Jd(t,{...k,app:{id:g.id,name:g.name},revision:g.revision,appHash:it(m),components:iw(c.tracked,u)}),Zd(t),o.out(s.pushed(g.revision)),o.out(s.preview(ea(r))),"pushed"}async function cw(e,t,n,o){const s=await ru(e,t,n,o);return s==="synced"&&o.err(D().syncedPushAgain),s==="pushed"||s==="unchanged"?0:1}const au=e=>new Promise((t,n)=>{bu("openbkn",e,{shell:process.platform==="win32",timeout:6e4},(o,s,r)=>{if(!o)return t(s.trim());if(o.code==="ENOENT")return n(new F(D().noOpenbkn));n(new F(D().openbknFailed(e.join(" "),(r||o.message).trim())))})}),Ht=e=>e.trim().replace(/\/+$/,"");async function Pn({state:e,insecure:t,near:n},o=process.env,s=au){const r=D(),a=o.BKN_BASE_URL?Ht(o.BKN_BASE_URL):void 0;if(e&&a&&a!==Ht(e.baseUrl))throw new F(r.otherPlatform(e.baseUrl,a));let l=a??(e?Ht(e.baseUrl):void 0);const c=typeof n?.baseUrl=="string"?Ht(n.baseUrl):void 0,i=h=>t||e?.insecure||n?.insecure&&c===h||void 0,d=o.BKN_TOKEN?.trim();if(!d){const h=JSON.parse(await s(["auth","status"])),u=h.baseUrl?Ht(h.baseUrl):void 0;if(!u)throw new F(r.notLoggedIn);if(l&&l!==u)throw new F(r.otherLogin(u,l));return l=u,{baseUrl:l,token:await s(["auth","token"]),insecure:i(l)}}if(!l)throw new F(r.tokenWithoutBase);return{baseUrl:l,token:d,insecure:i(l)}}const dw=(e,t)=>{const n=Ou(e,{recursive:!0},(o,s)=>{s&&t(String(s))});return()=>n.close()};function uw(e){const t=e.split(/[\\/]/);return t.length===1?t[0]===Re:t[0]===ie&&t.slice(1).every(n=>!n.startsWith(".")&&n!=="node_modules")}const hw=e=>e instanceof Error?e.message:String(e);async function pw(e,t,n,{signal:o,watch:s=dw,settle:r=1e3}){const a=D(),l=Pe(t);if(!l)throw new F(a.notProject(t,t));n.out(a.devStarted(Re,ie)),n.out(a.preview(ea(l)));let c,i,d=!1,h=!1;const u=async g=>{try{if(!g&&!lw(t)){h&&n.out(a.backToPushed),h=!1;return}for(let y=0;y<2;y+=1){const b=await ru(await e(),t,{},n);if(h=b==="invalid",b!=="synced")break;n.err(a.syncedPushing)}}catch(y){h=!0,n.err(hw(y))}},p=(g=!1)=>{i=u(g).finally(()=>{i=void 0,d&&!o.aborted&&(d=!1,p())})},f=()=>{clearTimeout(c),c=setTimeout(()=>{i?d=!0:p()},r)},m=s(t,g=>{uw(g)&&f()});for(p(!0),await new Promise(g=>{o.aborted?g():o.addEventListener("abort",()=>g(),{once:!0})}),m(),clearTimeout(c);i;)await i;return 0}const xt=100,Ao=e=>`/bkn-backend/v1/knowledge-networks/${encodeURIComponent(e)}`;async function fw(e,t){const n=[];for(let o=0;;o+=xt){const{data:s}=await e.get(`${Ao(t)}/object-types`,{params:{direction:"desc",limit:xt,offset:o,sort:"update_time"}}),r=s.entries??[];if(n.push(...r),r.length<xt||n.length>=(s.total_count??0))break}return n.map(o=>({id:o.id,...o.color?.trim()?{color:o.color.trim()}:{},...o.icon?{icon:o.icon}:{}}))}async function mw(e,t,n){const{data:o}=await e.get(`${Ao(t)}/object-types/${encodeURIComponent(n)}`),s=o&&"entries"in o?o.entries?.[0]??null:o;return s?{id:s.id,name:s.name,description:s.comment??"",primaryKeys:s.primary_keys??[],displayKey:s.display_key??"",dataProperties:(s.data_properties??[]).map(r=>{const a=r.name??r.original_name??r.display_name??"";return{name:a,displayName:r.display_name??a,type:r.type??"string"}})}:null}async function gw(e,t){const{data:n}=await e.get(`${Ao(t)}/relation-types`,{params:{direction:"desc",limit:-1,offset:0,sort:"update_time"}});return(n.entries??[]).map(o=>({id:o.id,name:o.name,sourceObjectTypeId:o.source_object_type_id??o.source_object_type?.id??"",targetObjectTypeId:o.target_object_type_id??o.target_object_type?.id??""}))}async function yw(e){const t=[];for(let n=0;;n+=xt){const{data:o}=await e.get("/bkn-backend/v1/knowledge-networks",{params:{direction:"asc",limit:xt,offset:n,sort:"name"}}),s=o.entries??[];if(t.push(...s),s.length<xt||t.length>=(o.total_count??0))break}return t.map(({id:n,name:o})=>({id:n,name:o}))}function Is(){throw new Error(D().notInCli)}function bw(e){return{useOffered:()=>"yes",list:async(t,n)=>(await e.get(`${Ao(t)}/object-metrics`,{params:{limit:n.limit,offset:n.offset,status:n.status}})).data,get:Is,query:Is,participants:Is}}function ww(e){return{http:e,userName:()=>{},userId:()=>{},listNetworks:()=>yw(e),listObjectTypes:t=>fw(e,t),getObjectType:(t,n)=>mw(e,t,n),listRelationTypes:t=>gw(e,t),objectMetrics:bw(e)}}function kw(e){Lu(ww(e))}class iu extends Error{constructor(t,n){super(D().httpStatus(n,t.status,$w(t.data))),this.response=t}response}const vw=new Set(["DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_VERIFY_LEAF_SIGNATURE","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","ERR_TLS_CERT_ALTNAME_INVALID","CERT_HAS_EXPIRED"]),ec=6e4;function $w(e){if(!e||typeof e!="object")return"";const t=e,n=[t.description,t.message,t.error_code].find(o=>typeof o=="string"&&o.trim()!=="");return n?String(n):""}function Sw(e){if(!e)return"";const n=(e instanceof URLSearchParams?new URLSearchParams(e):new URLSearchParams(Object.entries(e).filter(([,o])=>o!=null).map(([o,s])=>[o,String(s)]))).toString();return n?`?${n}`:""}function lu(e,t){if(!(e?/json/i.test(e):/^\s*[[{]/.test(t))||t==="")return t;try{return JSON.parse(t)}catch{return t}}async function jw(e){if(e===void 0)return;if(e instanceof Uint8Array)return{data:Buffer.from(e),type:"application/octet-stream"};const t=e;return typeof t?.arrayBuffer=="function"?{data:Buffer.from(await t.arrayBuffer()),type:t.type||"application/octet-stream"}:{data:Buffer.from(JSON.stringify(e)),type:"application/json"}}async function cu(e,t,n,o,s={}){const r=new URL(`${e.baseUrl.replace(/\/+$/,"")}/api${n}${Sw(s.params)}`),a=await jw(o),l={method:t,headers:{Accept:"application/json, text/plain, */*","Accept-Language":It(),...e.token?{Authorization:`Bearer ${e.token}`}:{},...a?{"Content-Type":a.type,"Content-Length":String(a.data.length)}:{},...s.headers},timeout:s.timeout??ec,...s.signal?{signal:s.signal}:{},...r.protocol==="https:"&&e.insecure?{rejectUnauthorized:!1}:{}},c=r.protocol==="https:"?Pu:_u;return new Promise((i,d)=>{const h=c(r,l,u=>{const p=[];u.on("data",f=>p.push(f)),u.on("error",d),u.on("end",()=>i({status:u.statusCode??0,type:u.headers["content-type"],bytes:Buffer.concat(p)}))});h.on("timeout",()=>h.destroy(new Error(D().timeout(n,ec/1e3)))),h.on("error",u=>{u.code&&vw.has(u.code)?d(new Error(D().certificate(e.baseUrl,u.code))):u.code==="ECONNREFUSED"||u.code==="ENOTFOUND"?d(new Error(D().unreachable(e.baseUrl,u.code))):d(u)}),a&&h.write(a.data),h.end()})}const du=e=>e.status>=200&&e.status<300;async function Ln(e,t,n,o,s){const r=await cu(e,t,n,o,s),a=lu(r.type,r.bytes.toString("utf8"));if(!du(r))throw new iu({status:r.status,data:a},n);return{data:a}}async function Aw(e,t){const n=await cu(e,"GET",t,void 0,{headers:{Accept:"application/zip, application/octet-stream, */*"}});if(du(n))return n.bytes;const o=lu(n.type,n.bytes.toString("utf8"));throw new iu({status:n.status,data:o},t)}function Tw(e){return{get:(t,n)=>Ln(e,"GET",t,void 0,n),delete:(t,n)=>Ln(e,"DELETE",t,void 0,n),post:(t,n,o)=>Ln(e,"POST",t,n,o),put:(t,n,o)=>Ln(e,"PUT",t,n,o)}}const Ow=e=>`/workshop/v1/component-frames/${e}/`;async function Ew(e){return((await st.get(`/bkn-backend/v1/knowledge-networks/${encodeURIComponent(e)}/action-types`,{params:{limit:-1,offset:0,sort:"update_time",direction:"desc"},skipErrorToast:!0})).data.entries??[]).filter(n=>n.lifecycle?.status!=="deprecated"&&n.operation_config?.type!=="relation").map(n=>{const o=n.operations??[],s=n.operation_config?.type,r=n.action_type??"",a=io({operation:s,kind:r})==="create",l=d=>d.comment?.trim()?{label:d.comment.trim()}:{},c=[];for(const d of n.parameters??[])d.value_from==="input"&&d.name?c.push({name:d.name,type:d.type??"string",...l(d)}):a&&d.value_from==="property"&&typeof d.value=="string"&&d.value!==""&&!c.some(h=>h.name===d.value)&&c.push({name:d.value,type:d.type??"string",...l(d),property:!0});const i=n.action_source;return{id:n.id,name:n.name,...n.comment?{comment:n.comment}:{},objectType:n.object_type_id??"",kind:r,...s?{operation:s}:{},inputs:c,canExecute:o.includes("*")||o.includes("execute"),...i?.type==="tool"&&i.box_id&&i.tool_id?{tool:{box:i.box_id,tool:i.tool_id}}:{}}})}async function Cw(e,t){const[n,o,s,r]=await Promise.all([pp(e),mp(e),Ew(e).catch(()=>{}),sm(e).catch(()=>{})]),a=await Promise.all(n.map(i=>fp(e,i.id))),l=new Map(n.map(i=>[i.id,i])),c={};for(const i of a){if(!i)continue;const d=i.dataProperties.filter(h=>!gh.has(h.type.toLowerCase())).map(h=>({name:h.name,label:h.displayName||h.name,type:yh(h.type),...h.type.toLowerCase().trim()==="date"?{day:!0}:{}}));c[i.id]={id:i.id,name:i.name,primaryKeys:i.primaryKeys.length>0?i.primaryKeys:[d[0]?.name??""],displayKey:i.displayKey||i.primaryKeys[0]||"",...i.description?{comment:i.description}:{},...l.get(i.id)?.color?{color:l.get(i.id)?.color}:{},...l.get(i.id)?.icon?{icon:l.get(i.id)?.icon}:{},properties:d}}return{id:e,name:t,objectTypes:c,relations:o.map(i=>({id:i.id,name:i.name,source:i.sourceObjectTypeId,target:i.targetObjectTypeId})),...s?{actionTypes:s}:{},...r?{eventTypes:r}:{}}}function Nw(){const e=Iu()?.objectMetrics;if(!e)throw new Error("This page's host offers no object metrics.");return e}const Ms=100;async function tc(e,t){const n=[];for(let o=0;;o+=Ms){const s=await Nw().list(e,{status:t,limit:Ms,offset:o});if(n.push(...s.entries),s.entries.length<Ms||n.length>=s.total_count)return n}}async function xw(e){const[t,n]=await Promise.all([tc(e,"published"),tc(e,"deprecated").catch(()=>[])]);return Gp(t,n)}async function Rw(e){const[t,n]=await Promise.all([Cw(e.id,e.name),xw(e.id).catch(()=>{})]);return{...t,name:e.name,...n?{metrics:n}:{}}}async function _w(e){const t=[];return await Promise.all((e??[]).map(async n=>{try{const{data:o}=await st.get(`${Ow(n.package)}manifest.json`);o?.type===n.type?Bc(n.package,o):t.push(n.package)}catch{t.push(n.package)}})),t}const He="openbkn-workshop",nc="SKILL.en-US.md",Pw=/^\s*source:\s*["']?@openbkn(?:-ai)?\/workshop["']?\s*$/m;function uu(e){const t=[{agent:"Claude Code",path:G(e,".claude","skills",He)}];return we(G(e,".codex"))&&t.push({agent:"Codex",path:G(e,".codex","skills",He)}),we(G(e,".workbuddy"))&&t.push({agent:"WorkBuddy",path:G(e,".workbuddy","skills",He)}),{files:G(e,".agents","skills",He),links:t}}const Lw=e=>{try{return Pw.test(ct(G(e,"SKILL.md"),"utf8"))}catch{return!1}};function hu(e){try{return ic(e),!0}catch{return!1}}function pu(e,t){if(Lw(e))return!0;try{return ic(e).isSymbolicLink()&&tt(Tt(e),Cu(e))===t}catch{return!1}}const an=(e,t)=>e.startsWith(`${t}/`)||e.startsWith(`${t}\\`)?`~${e.slice(t.length)}`:e,Iw=(e,t)=>new F(D().skillTaken(an(e,t)));function Mw(e,t,n,{platform:o=process.platform}={}){const s=D();if(!we(G(e,"SKILL.md")))throw new F(s.noSkillFiles(e));const{files:r,links:a}=uu(t);for(const c of[r,...a.map(i=>i.path)])if(hu(c)&&!pu(c,r))throw Iw(c,t);ut(r,{recursive:!0,force:!0}),Bn(Tt(r),{recursive:!0}),To(e,r,{recursive:!0,filter:c=>c!==G(e,nc)});const l=G(e,nc);It()==="en-US"&&we(l)&&To(l,G(r,"SKILL.md")),n.out(s.skillInstalled(He,an(r,t)));for(const c of a){ut(c.path,{recursive:!0,force:!0}),Bn(Tt(c.path),{recursive:!0});let i=o==="win32";if(!i)try{Eu(rc(Tt(c.path),r),c.path,"dir")}catch{i=!0}i&&To(r,c.path,{recursive:!0}),n.out(s.skillLink(c.agent,an(c.path,t),i))}return n.out(s.skillNext),0}function qw(e,t){const n=D(),{files:o,links:s}=uu(e);let r=0;for(const a of[...s.map(l=>l.path),o])if(hu(a)){if(!pu(a,o)){t.err(n.skillNotOurs(an(a,e)));continue}ut(a,{recursive:!0,force:!0}),t.out(n.removed(an(a,e))),r+=1}return r===0&&t.out(n.noSkill(He)),0}const Fw={out:e=>process.stdout.write(`${e}
|
|
474
|
+
`)}class F extends Error{}const Zb="/studio";function ea(e){return`${e.baseUrl.replace(/\/+$/,"")}${Zb}/workshop/apps/${encodeURIComponent(e.app.id)}/preview`}const Fn=e=>e instanceof Error?e.message:String(e);function ta(e){const t=Pe(e);if(!t)throw new F(D().notProject(e,e));const n=$o(e);if(n===null)throw new F(D().noAppFile(e,Re));return{state:t,text:n}}async function Xb(e,t){const n=await e.listApps(),o=n.find(a=>a.id===t);if(o)return o;const s=n.filter(a=>a.name===t);if(s.length===1)return s[0];throw s.length>1?new F(D().ambiguousApp(s.length,t,s.map(a=>` ${a.id}`).join(`
|
|
475
|
+
`))):new F(D().appNotFound(t))}function Qb(e,t){return e.draft?Zl(e.draft):Zl(tb(eb.id,{id:e.id,name:e.name},t).spec)}const _s=(e,t,n,o)=>({baseUrl:e.baseUrl,...e.insecure?{insecure:!0}:{},app:{id:t.id,name:t.name},network:t.network,revision:n,appHash:o}),eu=(e,t)=>{const n=D();return n.conflict(e,t.join(n.and),t.map(o=>`${Ae}/remote/${o}`).join(n.and))};async function ew(e,t,n,o,s,a){const r=new Map((n.draft?.components??[]).map(m=>[m.type,m.package])),l=wn(t),c=new Map(l.flatMap(m=>m.type?[[m.type,m]]:[])),i=new Set(l.map(m=>m.folder)),d={...o},h=[],u=D(),p=async m=>og(await e.downloadPackage(n.id,m),Lt()),f=[...new Set([...r.keys(),...Object.keys(o)])];for(const m of f.sort()){const g=r.get(m),y=o[m],b=c.get(m),k=b?b.hash!==y?.hash:y!==void 0,w=b?.folder??y?.folder??rb(m);try{if(g===void 0){if(b&&k){s.push(u.componentKept(m,`${ie}/${w}`));continue}b&&(cb(G(t,ie,w)),s.push(u.componentRemoved(`${ie}/${w}`,m))),delete d[m];continue}if(y&&g===y.package&&!y.behind)continue;if(b&&b.hash===g){d[m]={folder:w,package:g,hash:b.hash};continue}if(k){Yl(G(t,Hd,w),await p(g)),h.push(`${ie}/${w}`);continue}if(!b&&i.has(w)){a.err(u.note(u.folderTaken(`${ie}/${w}`,m)));continue}const v=G(t,ie,w);Yl(v,await p(g)),d[m]={folder:w,package:g,hash:ab(v)},s.push(u.downloaded(m,`${ie}/${w}`))}catch(v){g===void 0?a.err(u.note(u.at(`${ie}/${w}`,Fn(v)))):y||b?(d[m]={folder:w,package:g,hash:y?.hash??"",behind:!0},a.err(u.note(u.notDownloadedBehind(m,Fn(v),`${ie}/${w}`)))):a.err(u.note(u.notDownloaded(m,Fn(v))))}}return{tracked:d,conflicts:h}}async function na(e,t,n,o,s,a){const r=D(),l=await e.getApp(n);if(!l)throw new F(r.appIdNotFound(n));const c=await e.readNetwork(l.network),i=Qb(l,c),d=l.draft?it(i):"",h=$o(t);Jd(t);const u=[],p=await ew(e,t,l,o?.components??{},u,a);await Xd(t,c);let f=_s(e,l,o?.revision??l.revision,o?.appHash??d),m=l.draft?void 0:o?.blankHash,g=[],y=!1;!o||h===null?(Tr(t,i),Jb(t,l),f=_s(e,l,l.revision,d),l.draft||(m=it(i)),g=[r.pulled(l.name,l.revision,t),...l.draft?[]:[r.blankApp],r.networkAt(l.network.name,`${t}/.workshop/network.json`)]):it(h)===o.appHash||it(h)===o.blankHash?l.revision===o.revision?g=[r.upToDate(l.revision)]:(Tr(t,i),f=_s(e,l,l.revision,d),l.draft||(m=it(i)),g=[r.updatedTo(l.revision)]):l.revision===o.revision?g=[r.localOnly(Re)]:(Hb(t,i),y=!0),Qd(t,l);const b=y||p.conflicts.length>0;Vd(t,{...f,...m?{blankHash:m}:{},components:p.tracked,...b?{remoteRevision:l.revision}:{}});for(const k of[...g,...u])s(k);return b&&s(eu(l.revision,Zd(t))),b}async function tw(e,t){const n=[...await e.listApps()].sort((s,a)=>a.updatedAt-s.updatedAt),o=D();n.length===0&&t.out(o.noApps);for(const s of n)t.out(o.appLine(s.id,s.name,s.network.name,s.revision,s.version));return 0}async function nw(e,t){const n=await e.listNetworks(),o=n.find(l=>l.id===t);if(o)return o;const s=n.filter(l=>l.name===t);if(s.length===1)return s[0];if(s.length>1)throw new F(D().ambiguousNetwork(s.length,t,s.map(l=>` ${l.id}`).join(`
|
|
476
|
+
`)));const a=D(),r=n.slice(0,30).map(l=>a.quoted(l.name));throw new F(a.networkNotFound(t,r.join(a.and),n.length,n.length>r.length))}async function ow(e,t,n,o,s){const a=o.trim(),r=D();if(!a)throw new F(r.emptyName);const l=Pe(t);if(l)throw new F(r.alreadyProject(t,l.app.name));if(we(t)&&$o(t)!==null)throw new F(r.hasAppFile(t,Re));const c=await nw(e,n);let i;try{i=await e.createApp(a,c)}catch(d){throw d instanceof qr?new F(r.noCreateRight(c.name)):d}return s.out(r.created(c.name,i.name,i.id)),await na(e,t,i.id,null,s.out,s),0}async function sw(e,t,n,o){const s=D(),a=Pe(t);if(a&&n&&n!==a.app.id&&n!==a.app.name)throw new F(s.otherProject(t,a.app.name,a.app.id,n));if(!a&&!n)throw new F(s.firstPullNeedsApp);if(!a&&we(t)&&$o(t)!==null)throw new F(s.notPulled(t,Re));const r=a?.app.id??(await Xb(e,n)).id;return await na(e,t,r,a,o.out,o),0}const Dn=e=>typeof e=="object"&&e!==null&&"type"in e;function rw(e,t,n){const o=D(),s=[],a=[],r=[],l=new Map;for(const p of t){const f=`${ie}/${p.folder}`;if(s.push(...p.check.errors.map(y=>({file:f,message:y}))),!p.type)continue;const m=l.get(p.type);if(m){s.push({file:f,message:o.sameType(`${ie}/${m.folder}`,p.type)});continue}l.set(p.type,p);const g=n[p.type];if(!(p.hash===g?.hash||g?.behind&&p.hash===g.package)){if(g?.behind){s.push({file:f,message:o.behindChanged(p.type)});continue}r.push(p),a.push(...p.check.warnings.map(y=>o.at(f,y)))}}const c=p=>r.includes(p)?p.hash:n[p.type]?.package,i=Array.isArray(e)?e:[],d=i.map(p=>{const f=Dn(p)?l.get(p.type):void 0;return f?{...p,package:c(f),...r.includes(f)?{source:"upload"}:{}}:p});for(const[p,f]of l)i.some(m=>Dn(m)&&m.type===p)||d.push({type:p,package:c(f),source:"upload"});const h={};for(const[p,f]of l){const m=n[p];h[p]=m?.behind&&f.hash===m.hash?m:{folder:f.folder,package:c(f),hash:f.hash}}for(const[p,f]of Object.entries(n))!h[p]&&d.some(m=>Dn(m)&&m.type===p)&&(h[p]=f);const u=new Set([...l.keys()].filter(p=>h[p]?.behind));return{components:d,uploads:r,tracked:h,problems:s,warnings:a,usable:l,behind:u}}function aw(e,t){const n=Ye.parseDocument(e),o=n.toJS()?.components;return $u(o??[],t)?e:(t.length===0?n.delete("components"):n.set("components",t),n.toString({lineWidth:0}))}async function tu(e,t,n,o,s=wn(t)){const{spec:a,syntax:r,locate:l}=gb(o);if(r.length>0)return{ok:!1,errors:r,warnings:[]};const c=a?.apiVersion,i=[],d=D();typeof c=="string"&&c!==pt&&i.push(d.apiVersion(Re,c,pt));const h=await e.readNetwork(n.network);await Xd(t,h,s);const u=a?.components,p=rw(u,s,n.components??{});i.push(...p.warnings);for(const[k,w]of p.usable)!p.behind.has(k)&&vd(w.manifest,Lt()).length===0&&Bc(p.components.find(v=>v.type===k)?.package??w.hash,w.manifest);const f=p.components.filter(k=>Dn(k)&&(!p.usable.has(k.type)||p.behind.has(k.type)));for(const k of await e.registerComponents(f))i.push(d.manifestUnreadable(k));const g=(Array.isArray(u)||u===void 0&&p.components.length>0)&&a&&typeof a=="object"?{...a,components:p.components}:a,y=Iy(g,h,{allowEmpty:!0}),b=[...p.problems,...y.ok?[]:y.errors.map(l)];return!y.ok||b.length>0?{ok:!1,errors:b,warnings:i}:{ok:!0,spec:y.app,components:p.components,uploads:p.uploads,tracked:p.tracked,warnings:i}}function nu(e,t){const n=D();for(const o of t.warnings)e.err(n.note(o));if(!t.ok){for(const o of t.errors)e.err(`${o.file??Re}${o.line?`:${o.line}`:""} ${o.message}`);e.err(n.errorCount(t.errors.length))}}async function iw(e,t,n){const{state:o,text:s}=ta(t),a=await tu(e,t,o,s);return nu(n,a),a.ok&&n.out(D().validated),a.ok?0:1}function Xl(e,t){const n=D();return e instanceof qr?new F(n.forbidden):e instanceof Mr?new F(n.appGone(t)):e instanceof Vc?new F(n.tooLarge):null}function lw(e,t){const n={};for(const[o,s]of Object.entries(e))n[o]={...s,package:t(s.package)};return n}function ou(e,t,n){const o=e.components??{},s=n.every(a=>a.type&&a.hash===o[a.type]?.hash);return it(t)!==e.appHash||!s}function cw(e){const{state:t,text:n}=ta(e);return ou(t,n,wn(e))}async function su(e,t,{merged:n=!1},o){const s=D(),{state:a,text:r}=ta(t);if(n&&a.remoteRevision===void 0)throw new F(s.nothingToMerge);if(!n&&Gb(t))return o.err(eu(a.remoteRevision??a.revision,Zd(t))),"merge";const l=wn(t);if(!n&&!ou(a,r,l))return o.out(s.unchanged),"unchanged";const c=await tu(e,t,a,r,l);if(nu(o,c),!c.ok)return o.err(s.invalidNotPushed),"invalid";const i=n?a.remoteRevision:a.revision,d=async()=>await na(e,t,a.app.id,a,o.err,o)?"merge":"synced";if(c.uploads.length>0){const w=await e.getApp(a.app.id);if(!w)throw new F(s.appGone(a.app.id));if(w.revision!==i)return await d()}const h=new Map;for(const w of c.uploads){const v=`${ie}/${w.folder}`;try{const S=await e.uploadPackage(a.app.id,ng(w.files));for(const j of S.warnings)o.err(s.note(s.at(v,j)));S.id!==w.hash&&h.set(w.hash,S.id),o.out(s.uploaded(v,w.type))}catch(S){throw Xl(S,a.app.id)??new F(s.uploadRefused(v,Fn(S)))}}const u=w=>h.get(w)??w,p=c.components.map(w=>({...w,package:u(w.package)})),f=c.spec.components?{...c.spec,components:c.spec.components.map(w=>({...w,package:u(w.package)}))}:c.spec,m=aw(r,p);let g;try{g=await e.saveDraft(a.app.id,f,i)}catch(w){if(w instanceof Hc)return await d();throw Xl(w,a.app.id)??w}m!==r&&Tr(t,m);const{remoteRevision:y,blankHash:b,...k}=a;return Vd(t,{...k,app:{id:g.id,name:g.name},revision:g.revision,appHash:it(m),components:lw(c.tracked,u)}),Jd(t),o.out(s.pushed(g.revision)),o.out(s.preview(ea(a))),"pushed"}async function dw(e,t,n,o){const s=await su(e,t,n,o);return s==="synced"&&o.err(D().syncedPushAgain),s==="pushed"||s==="unchanged"?0:1}const ru=e=>new Promise((t,n)=>{yu("openbkn",e,{shell:process.platform==="win32",timeout:6e4},(o,s,a)=>{if(!o)return t(s.trim());if(o.code==="ENOENT")return n(new F(D().noOpenbkn));n(new F(D().openbknFailed(e.join(" "),(a||o.message).trim())))})}),Gt=e=>e.trim().replace(/\/+$/,"");async function Pn({state:e,insecure:t,near:n},o=process.env,s=ru){const a=D(),r=o.BKN_BASE_URL?Gt(o.BKN_BASE_URL):void 0;if(e&&r&&r!==Gt(e.baseUrl))throw new F(a.otherPlatform(e.baseUrl,r));let l=r??(e?Gt(e.baseUrl):void 0);const c=typeof n?.baseUrl=="string"?Gt(n.baseUrl):void 0,i=h=>t||e?.insecure||n?.insecure&&c===h||void 0,d=o.BKN_TOKEN?.trim();if(!d){const h=JSON.parse(await s(["auth","status"])),u=h.baseUrl?Gt(h.baseUrl):void 0;if(!u)throw new F(a.notLoggedIn);if(l&&l!==u)throw new F(a.otherLogin(u,l));return l=u,{baseUrl:l,token:await s(["auth","token"]),insecure:i(l)}}if(!l)throw new F(a.tokenWithoutBase);return{baseUrl:l,token:d,insecure:i(l)}}const uw=(e,t)=>{const n=Tu(e,{recursive:!0},(o,s)=>{s&&t(String(s))});return()=>n.close()};function hw(e){const t=e.split(/[\\/]/);return t.length===1?t[0]===Re:t[0]===ie&&t.slice(1).every(n=>!n.startsWith(".")&&n!=="node_modules")}const pw=e=>e instanceof Error?e.message:String(e);async function fw(e,t,n,{signal:o,watch:s=uw,settle:a=1e3}){const r=D(),l=Pe(t);if(!l)throw new F(r.notProject(t,t));n.out(r.devStarted(Re,ie)),n.out(r.preview(ea(l)));let c,i,d=!1,h=!1;const u=async g=>{try{if(!g&&!cw(t)){h&&n.out(r.backToPushed),h=!1;return}for(let y=0;y<2;y+=1){const b=await su(await e(),t,{},n);if(h=b==="invalid",b!=="synced")break;n.err(r.syncedPushing)}}catch(y){h=!0,n.err(pw(y))}},p=(g=!1)=>{i=u(g).finally(()=>{i=void 0,d&&!o.aborted&&(d=!1,p())})},f=()=>{clearTimeout(c),c=setTimeout(()=>{i?d=!0:p()},a)},m=s(t,g=>{hw(g)&&f()});for(p(!0),await new Promise(g=>{o.aborted?g():o.addEventListener("abort",()=>g(),{once:!0})}),m(),clearTimeout(c);i;)await i;return 0}const Nt=100,So=e=>`/bkn-backend/v1/knowledge-networks/${encodeURIComponent(e)}`;async function mw(e,t){const n=[];for(let o=0;;o+=Nt){const{data:s}=await e.get(`${So(t)}/object-types`,{params:{direction:"desc",limit:Nt,offset:o,sort:"update_time"}}),a=s.entries??[];if(n.push(...a),a.length<Nt||n.length>=(s.total_count??0))break}return n.map(o=>({id:o.id,...o.color?.trim()?{color:o.color.trim()}:{},...o.icon?{icon:o.icon}:{}}))}async function gw(e,t,n){const{data:o}=await e.get(`${So(t)}/object-types/${encodeURIComponent(n)}`),s=o&&"entries"in o?o.entries?.[0]??null:o;return s?{id:s.id,name:s.name,description:s.comment??"",primaryKeys:s.primary_keys??[],displayKey:s.display_key??"",dataProperties:(s.data_properties??[]).map(a=>{const r=a.name??a.original_name??a.display_name??"";return{name:r,displayName:a.display_name??r,type:a.type??"string"}})}:null}async function yw(e,t){const{data:n}=await e.get(`${So(t)}/relation-types`,{params:{direction:"desc",limit:-1,offset:0,sort:"update_time"}});return(n.entries??[]).map(o=>({id:o.id,name:o.name,sourceObjectTypeId:o.source_object_type_id??o.source_object_type?.id??"",targetObjectTypeId:o.target_object_type_id??o.target_object_type?.id??""}))}async function bw(e){const t=[];for(let n=0;;n+=Nt){const{data:o}=await e.get("/bkn-backend/v1/knowledge-networks",{params:{direction:"asc",limit:Nt,offset:n,sort:"name"}}),s=o.entries??[];if(t.push(...s),s.length<Nt||t.length>=(o.total_count??0))break}return t.map(({id:n,name:o})=>({id:n,name:o}))}function Ps(){throw new Error(D().notInCli)}function ww(e){return{useOffered:()=>"yes",list:async(t,n)=>(await e.get(`${So(t)}/object-metrics`,{params:{limit:n.limit,offset:n.offset,status:n.status}})).data,get:Ps,query:Ps,participants:Ps}}function kw(e){return{http:e,userName:()=>{},userId:()=>{},listNetworks:()=>bw(e),listObjectTypes:t=>mw(e,t),getObjectType:(t,n)=>gw(e,t,n),listRelationTypes:t=>yw(e,t),objectMetrics:ww(e)}}function vw(e){Pu(kw(e))}class au extends Error{constructor(t,n){super(D().httpStatus(n,t.status,Sw(t.data))),this.response=t}response}const $w=new Set(["DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_VERIFY_LEAF_SIGNATURE","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","ERR_TLS_CERT_ALTNAME_INVALID","CERT_HAS_EXPIRED"]),Ql=6e4;function Sw(e){if(!e||typeof e!="object")return"";const t=e,n=[t.description,t.message,t.error_code].find(o=>typeof o=="string"&&o.trim()!=="");return n?String(n):""}function jw(e){if(!e)return"";const n=(e instanceof URLSearchParams?new URLSearchParams(e):new URLSearchParams(Object.entries(e).filter(([,o])=>o!=null).map(([o,s])=>[o,String(s)]))).toString();return n?`?${n}`:""}function iu(e,t){if(!(e?/json/i.test(e):/^\s*[[{]/.test(t))||t==="")return t;try{return JSON.parse(t)}catch{return t}}async function Aw(e){if(e===void 0)return;if(e instanceof Uint8Array)return{data:Buffer.from(e),type:"application/octet-stream"};const t=e;return typeof t?.arrayBuffer=="function"?{data:Buffer.from(await t.arrayBuffer()),type:t.type||"application/octet-stream"}:{data:Buffer.from(JSON.stringify(e)),type:"application/json"}}async function lu(e,t,n,o,s={}){const a=new URL(`${e.baseUrl.replace(/\/+$/,"")}/api${n}${jw(s.params)}`),r=await Aw(o),l={method:t,headers:{Accept:"application/json, text/plain, */*","Accept-Language":Lt(),...e.token?{Authorization:`Bearer ${e.token}`}:{},...r?{"Content-Type":r.type,"Content-Length":String(r.data.length)}:{},...s.headers},timeout:s.timeout??Ql,...s.signal?{signal:s.signal}:{},...a.protocol==="https:"&&e.insecure?{rejectUnauthorized:!1}:{}},c=a.protocol==="https:"?_u:Ru;return new Promise((i,d)=>{const h=c(a,l,u=>{const p=[];u.on("data",f=>p.push(f)),u.on("error",d),u.on("end",()=>i({status:u.statusCode??0,type:u.headers["content-type"],bytes:Buffer.concat(p)}))});h.on("timeout",()=>h.destroy(new Error(D().timeout(n,Ql/1e3)))),h.on("error",u=>{u.code&&$w.has(u.code)?d(new Error(D().certificate(e.baseUrl,u.code))):u.code==="ECONNREFUSED"||u.code==="ENOTFOUND"?d(new Error(D().unreachable(e.baseUrl,u.code))):d(u)}),r&&h.write(r.data),h.end()})}const cu=e=>e.status>=200&&e.status<300;async function Ln(e,t,n,o,s){const a=await lu(e,t,n,o,s),r=iu(a.type,a.bytes.toString("utf8"));if(!cu(a))throw new au({status:a.status,data:r},n);return{data:r}}async function Tw(e,t){const n=await lu(e,"GET",t,void 0,{headers:{Accept:"application/zip, application/octet-stream, */*"}});if(cu(n))return n.bytes;const o=iu(n.type,n.bytes.toString("utf8"));throw new au({status:n.status,data:o},t)}function Ow(e){return{get:(t,n)=>Ln(e,"GET",t,void 0,n),delete:(t,n)=>Ln(e,"DELETE",t,void 0,n),post:(t,n,o)=>Ln(e,"POST",t,n,o),put:(t,n,o)=>Ln(e,"PUT",t,n,o)}}const Ew=e=>`/workshop/v1/component-frames/${e}/`;async function Cw(e){return((await st.get(`/bkn-backend/v1/knowledge-networks/${encodeURIComponent(e)}/action-types`,{params:{limit:-1,offset:0,sort:"update_time",direction:"desc"},skipErrorToast:!0})).data.entries??[]).filter(n=>n.lifecycle?.status!=="deprecated"&&n.operation_config?.type!=="relation").map(n=>{const o=n.operations??[],s=n.operation_config?.type,a=n.action_type??"",r=an({operation:s,kind:a})==="create",l=d=>d.comment?.trim()?{label:d.comment.trim()}:{},c=[];for(const d of n.parameters??[])d.value_from==="input"&&d.name?c.push({name:d.name,type:d.type??"string",...l(d)}):r&&d.value_from==="property"&&typeof d.value=="string"&&d.value!==""&&!c.some(h=>h.name===d.value)&&c.push({name:d.value,type:d.type??"string",...l(d),property:!0});const i=n.action_source;return{id:n.id,name:n.name,...n.comment?{comment:n.comment}:{},objectType:n.object_type_id??"",kind:a,...s?{operation:s}:{},inputs:c,canExecute:o.includes("*")||o.includes("execute"),...i?.type==="tool"&&i.box_id&&i.tool_id?{tool:{box:i.box_id,tool:i.tool_id}}:{}}})}async function Nw(e,t){const[n,o,s,a]=await Promise.all([fp(e),gp(e),Cw(e).catch(()=>{}),rm(e).catch(()=>{})]),r=await Promise.all(n.map(i=>mp(e,i.id))),l=new Map(n.map(i=>[i.id,i])),c={};for(const i of r){if(!i)continue;const d=i.dataProperties.filter(h=>!Wu.has(h.type.toLowerCase())).map(h=>({name:h.name,label:h.displayName||h.name,type:Ku(h.type),...h.type.toLowerCase().trim()==="date"?{day:!0}:{}}));c[i.id]={id:i.id,name:i.name,primaryKeys:i.primaryKeys.length>0?i.primaryKeys:[d[0]?.name??""],displayKey:i.displayKey||i.primaryKeys[0]||"",...i.description?{comment:i.description}:{},...l.get(i.id)?.color?{color:l.get(i.id)?.color}:{},...l.get(i.id)?.icon?{icon:l.get(i.id)?.icon}:{},properties:d}}return{id:e,name:t,objectTypes:c,relations:o.map(i=>({id:i.id,name:i.name,source:i.sourceObjectTypeId,target:i.targetObjectTypeId})),...s?{actionTypes:s}:{},...a?{eventTypes:a}:{}}}function xw(){const e=Lu()?.objectMetrics;if(!e)throw new Error("This page's host offers no object metrics.");return e}const Ls=100;async function ec(e,t){const n=[];for(let o=0;;o+=Ls){const s=await xw().list(e,{status:t,limit:Ls,offset:o});if(n.push(...s.entries),s.entries.length<Ls||n.length>=s.total_count)return n}}async function Rw(e){const[t,n]=await Promise.all([ec(e,"published"),ec(e,"deprecated").catch(()=>[])]);return Hp(t,n)}async function _w(e){const[t,n]=await Promise.all([Nw(e.id,e.name),Rw(e.id).catch(()=>{})]);return{...t,name:e.name,...n?{metrics:n}:{}}}async function Pw(e){const t=[];return await Promise.all((e??[]).map(async n=>{try{const{data:o}=await st.get(`${Ew(n.package)}manifest.json`);o?.type===n.type?Bc(n.package,o):t.push(n.package)}catch{t.push(n.package)}})),t}const Ge="openbkn-workshop",tc="SKILL.en-US.md",Lw=/^\s*source:\s*["']?@openbkn(?:-ai)?\/workshop["']?\s*$/m;function du(e){const t=[{agent:"Claude Code",path:G(e,".claude","skills",Ge)}];return we(G(e,".codex"))&&t.push({agent:"Codex",path:G(e,".codex","skills",Ge)}),we(G(e,".workbuddy"))&&t.push({agent:"WorkBuddy",path:G(e,".workbuddy","skills",Ge)}),{files:G(e,".agents","skills",Ge),links:t}}const Iw=e=>{try{return Lw.test(ct(G(e,"SKILL.md"),"utf8"))}catch{return!1}};function uu(e){try{return ac(e),!0}catch{return!1}}function hu(e,t){if(Iw(e))return!0;try{return ac(e).isSymbolicLink()&&tt(At(e),Eu(e))===t}catch{return!1}}const sn=(e,t)=>e.startsWith(`${t}/`)||e.startsWith(`${t}\\`)?`~${e.slice(t.length)}`:e,Mw=(e,t)=>new F(D().skillTaken(sn(e,t)));function qw(e,t,n,{platform:o=process.platform}={}){const s=D();if(!we(G(e,"SKILL.md")))throw new F(s.noSkillFiles(e));const{files:a,links:r}=du(t);for(const c of[a,...r.map(i=>i.path)])if(uu(c)&&!hu(c,a))throw Mw(c,t);ut(a,{recursive:!0,force:!0}),Bn(At(a),{recursive:!0}),jo(e,a,{recursive:!0,filter:c=>c!==G(e,tc)});const l=G(e,tc);Lt()==="en-US"&&we(l)&&jo(l,G(a,"SKILL.md")),n.out(s.skillInstalled(Ge,sn(a,t)));for(const c of r){ut(c.path,{recursive:!0,force:!0}),Bn(At(c.path),{recursive:!0});let i=o==="win32";if(!i)try{Ou(sc(At(c.path),a),c.path,"dir")}catch{i=!0}i&&jo(a,c.path,{recursive:!0}),n.out(s.skillLink(c.agent,sn(c.path,t),i))}return n.out(s.skillNext),0}function Fw(e,t){const n=D(),{files:o,links:s}=du(e);let a=0;for(const r of[...s.map(l=>l.path),o])if(uu(r)){if(!hu(r,o)){t.err(n.skillNotOurs(sn(r,e)));continue}ut(r,{recursive:!0,force:!0}),t.out(n.removed(sn(r,e))),a+=1}return a===0&&t.out(n.noSkill(Ge)),0}const Dw={out:e=>process.stdout.write(`${e}
|
|
467
477
|
`),err:e=>process.stderr.write(`${e}
|
|
468
|
-
`)};function
|
|
478
|
+
`)};function Bw(e){return vw(Ow(e)),{baseUrl:e.baseUrl,...e.insecure?{insecure:!0}:{},listApps:mm,getApp:gm,listNetworks:pp,createApp:(t,n)=>bm(t,n,null),saveDraft:wm,readNetwork:_w,registerComponents:Pw,downloadPackage:(t,n)=>Tw(e,`/workshop/v1/apps/${encodeURIComponent(t)}/component-packages/${encodeURIComponent(n)}/zip`),uploadPackage:async(t,n)=>{const o=await km(t,new Blob([new Uint8Array(n)]));return{id:o.id,warnings:o.warnings}}}}function Uw(e){const[t,n]=process.platform==="darwin"?["open",[e]]:process.platform==="win32"?["cmd",["/c","start","",e]]:["xdg-open",[e]];return new Promise(o=>{const s=bu(t,n,{stdio:"ignore",detached:!0});s.on("error",()=>o(!1)),s.on("spawn",()=>{s.unref(),o(!0)})})}async function Qv(e,t=Dw,{env:n=process.env,openbkn:o=ru,workshopOf:s=Bw,open:a=Uw,skillSource:r,home:l=wu(),signal:c,version:i}={}){let d;try{d=Su({args:e,allowPositionals:!0,options:{insecure:{type:"boolean",short:"k"},merged:{type:"boolean"},"no-open":{type:"boolean"},lang:{type:"string"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}}})}catch(g){const y=e.indexOf("--lang");return Kl(oa(y<0?void 0:e[y+1],n)),t.err(`${g instanceof Error?g.message:String(g)}
|
|
469
479
|
|
|
470
|
-
${D().usage(
|
|
480
|
+
${D().usage(Ge)}`),1}const{positionals:h,values:u}=d;Kl(oa(u.lang,n));const p=D(),[f,...m]=h;if(u.version)return t.out(i??p.noVersion),0;if(u.help||!f)return t.out(p.usage(Ge)),f||u.help?0:1;try{if(f==="skill"){const[g]=m;if(g==="remove")return Fw(l,t);if(g!=="add")throw new F(p.skillUsage);if(!r)throw new F(p.noSkillSource);return qw(r,l,t)}if(f==="list"||f==="create"){let g=null;try{g=Pe(tt("."))}catch{}const y=await Pn({state:null,near:g,insecure:u.insecure},n,o);if(f==="list")return await tw(s(y),t);const[b,k,w]=m;if(!b||!k)throw new F(p.createUsage);return await ow(s(y),tt(w??nc(k)),b,k,t)}if(f==="pull"){const[g,y]=m,b=g!==void 0&&y===void 0&&Pe(tt(g)),k=b?void 0:g,w=tt(b?g:y??(g?nc(g):".")),v=Pe(w),S=await Pn({state:v,insecure:u.insecure},n,o);return await sw(s(S),w,k,t)}if(f==="validate"||f==="push"){const g=tt(m[0]??"."),y=Pe(g);if(!y)throw new F(p.notProject(g,m[0]??"."));const b=s(await Pn({state:y,insecure:u.insecure},n,o));return f==="validate"?await iw(b,g,t):await dw(b,g,{merged:u.merged},t)}if(f==="dev"){const g=tt(m[0]??".");if(!Pe(g))throw new F(p.notProject(g,m[0]??"."));const y=c?void 0:new AbortController;return y&&process.once("SIGINT",()=>y.abort()),await fw(async()=>s(await Pn({state:Pe(g),insecure:u.insecure},n,o)),g,t,{signal:c??y.signal})}if(f==="preview"){const g=tt(m[0]??"."),y=Pe(g);if(!y)throw new F(p.notProject(g,m[0]??"."));const b=ea(y);return t.out(b),!u["no-open"]&&!await a(b)&&t.err(p.noBrowser),0}throw new F(`${p.noCommand(f)}
|
|
471
481
|
|
|
472
|
-
${p.usage(
|
|
482
|
+
${p.usage(Ge)}`)}catch(g){return t.err(g instanceof Error?g.message:String(g)),1}}function nc(e){return e.replace(/[\\/:*?"<>|\s]+/g,"-").replace(/^-+|-+$/g,"")||"app"}const zw=`# Button (actionButton)
|
|
473
483
|
|
|
474
484
|
A button on the page: one click takes the configured steps in order, asking the Agent or running an action of the knowledge network on the selected or ticked objects. Use it to put "the step to take after reading the data" on the page; it always asks for confirmation before running.
|
|
475
485
|
|
|
@@ -559,7 +569,7 @@ A button that only asks the Agent needs no action and no object source.
|
|
|
559
569
|
- One confirmation runs at most 100 objects, 20 by default.
|
|
560
570
|
- It does not follow or write filters.
|
|
561
571
|
- Actions run with the user's own permissions.
|
|
562
|
-
`,
|
|
572
|
+
`,Ww=Object.freeze(Object.defineProperty({__proto__:null,default:zw},Symbol.toStringTag,{value:"Module"})),Kw=`# 按钮(actionButton)
|
|
563
573
|
|
|
564
574
|
页面上的一个按钮,点一下按顺序做配置好的动作:向 Agent 提问,或对选中、勾选的对象执行知识网络里的行动。用来把“看完数据后要做的那一步”放在页面上,执行前总会先确认。
|
|
565
575
|
|
|
@@ -649,7 +659,7 @@ A button that only asks the Agent needs no action and no object source.
|
|
|
649
659
|
- 一次确认最多执行 100 个对象,默认 20。
|
|
650
660
|
- 不跟随筛选,不写入筛选。
|
|
651
661
|
- 行动按用户本人的权限执行。
|
|
652
|
-
`,
|
|
662
|
+
`,Yw=Object.freeze(Object.defineProperty({__proto__:null,default:Kw},Symbol.toStringTag,{value:"Module"})),Gw=`# Agent chat (agentChat)
|
|
653
663
|
|
|
654
664
|
A chat box that asks and answers about the data on the page. The Agent can query all the page's data sources and the whole knowledge network, read the current filters and the selected object, and when allowed set filters for the user and suggest actions. Use it so business users can follow up in plain language with "why", "which" and "what now".
|
|
655
665
|
|
|
@@ -761,7 +771,7 @@ Do not keep a definition only here: a judgement that can be computed belongs in
|
|
|
761
771
|
### Selecting an agent within a service
|
|
762
772
|
|
|
763
773
|
When an MCP exposes list_agents returning structuredContent.agents: [{id, name}] and an ask tool accepting agent_id, builders can choose a default agent. Enable runtime agent switching to show the selector. Switching clears the conversation and creates a new conversation ID; switching is disabled while a reply is pending. Like ask, list_agents is sent only the parameters it declares: \`app_id\`, \`kn_id\`, \`workspace_id\`, and \`bkn_token\` when "Hand over the user's sign-in token" is on (the builder's own token in the builder). The server decides which agents to list and whether a call may run: one that declares these parameters can filter by app and user; one that does not can only go by the integration account. When a default agent is chosen, the chat also calls list_agents on opening, even with switching off, and asks nothing until it answers (a question from a click is sent once it does): if the chosen agent is not in the result, it shows "Agent unavailable", takes no questions, and does not show the agent's name; if the list cannot be read, questions go ahead and the server decides. Servers without list_agents keep their behavior.
|
|
764
|
-
`,
|
|
774
|
+
`,Hw=Object.freeze(Object.defineProperty({__proto__:null,default:Gw},Symbol.toStringTag,{value:"Module"})),Vw=`# Agent 对话(agentChat)
|
|
765
775
|
|
|
766
776
|
围绕页面上的数据提问和回答的对话框。Agent 能查页面上全部数据源和整个知识网络,读当前筛选和选中的对象,允许时还能替用户设置筛选、建议行动。用来让业务人员用自然语言追问“为什么”“哪些”“怎么办”。
|
|
767
777
|
|
|
@@ -873,7 +883,7 @@ When an MCP exposes list_agents returning structuredContent.agents: [{id, name}]
|
|
|
873
883
|
### 选择服务中的智能体
|
|
874
884
|
|
|
875
885
|
外部 MCP 提供 list_agents(返回 structuredContent.agents: [{id, name}])和接受 agent_id 的 ask 时,组件配置可选择默认智能体。打开“允许使用者切换智能体”后,对话框显示智能体选择框。切换会清空当前对话并生成新的会话标识;回答期间不可切换。list_agents 与 ask 一样只收它声明了的参数:\`app_id\`、\`kn_id\`、\`workspace_id\`,以及打开“交出使用者的登录令牌”时的 \`bkn_token\`(在构建器里是构建者自己的)。列出哪些智能体、能否调用由服务端决定:声明了这些参数的服务可以按应用和使用者筛选,没有声明的只能按集成账号。选了默认智能体时,即使没有打开切换,对话框打开时也会调用 list_agents,返回之前不提问(点击带来的问题等列表返回再发):所选智能体不在返回结果里,就显示“智能体暂不可用”,不能提问,也不显示原名称;读不到列表时照常提问,由服务端核对。服务不提供 list_agents 时保持原有行为。
|
|
876
|
-
`,
|
|
886
|
+
`,Jw=Object.freeze(Object.defineProperty({__proto__:null,default:Vw},Symbol.toStringTag,{value:"Module"})),Zw=`# Alerts (alertList)
|
|
877
887
|
|
|
878
888
|
Lists, in real time, the objects that hit rules written beforehand, most severe first. Use it to answer "which objects need attention now"; click a rule and the page narrows to the objects it hits.
|
|
879
889
|
|
|
@@ -953,7 +963,7 @@ None. The component only counts by the configured conditions and calls no outsid
|
|
|
953
963
|
- 1 to 8 rules; 3 to 20 rows when expanded.
|
|
954
964
|
- It computes only what hits now; it keeps no history and has no owner or handling state.
|
|
955
965
|
- Missing-link rules read relations, so the count shows a spinner while loading.
|
|
956
|
-
`,
|
|
966
|
+
`,Xw=Object.freeze(Object.defineProperty({__proto__:null,default:Zw},Symbol.toStringTag,{value:"Module"})),Qw=`# 告警(alertList)
|
|
957
967
|
|
|
958
968
|
按事先写好的规则,实时列出当前命中的对象,按严重程度排序。用来回答“现在有哪些对象需要关注”,点一条规则就把页面收窄到它命中的对象。
|
|
959
969
|
|
|
@@ -1033,7 +1043,7 @@ None. The component only counts by the configured conditions and calls no outsid
|
|
|
1033
1043
|
- 规则 1 到 8 条;展开显示 3 到 20 条。
|
|
1034
1044
|
- 只计算此刻命中,不保存历史,也没有负责人、处理状态。
|
|
1035
1045
|
- 缺失关联查询需要读取关系,命中数加载时显示转圈。
|
|
1036
|
-
`,
|
|
1046
|
+
`,ek=Object.freeze(Object.defineProperty({__proto__:null,default:Qw},Symbol.toStringTag,{value:"Module"})),tk=`# Base date (asOfSlider)
|
|
1037
1047
|
|
|
1038
1048
|
Drag a slider to pick a date, and the whole page is computed as of that day. Use it to answer "what did it look like on a given day" or "how many items were overdue at the end of last month".
|
|
1039
1049
|
|
|
@@ -1112,7 +1122,7 @@ None. The component only writes the base date and calls no tool. Industry rules
|
|
|
1112
1122
|
- Steps are day, week and month only; a month is fixed at 30 days.
|
|
1113
1123
|
- One base date variable per page.
|
|
1114
1124
|
- The range depends on the rows already read; an object type data source reads at most 5000 rows and a Cypher data source 10,000 (1,000 when its query sets no LIMIT).
|
|
1115
|
-
`,
|
|
1125
|
+
`,nk=Object.freeze(Object.defineProperty({__proto__:null,default:tk},Symbol.toStringTag,{value:"Module"})),ok=`# 基准日期(asOfSlider)
|
|
1116
1126
|
|
|
1117
1127
|
拖动滑块选一个日期,整页按这一天计算。用来回答“截至某天是什么样”“上个月底有多少项已超期”这类问题。
|
|
1118
1128
|
|
|
@@ -1191,7 +1201,7 @@ None. The component only writes the base date and calls no tool. Industry rules
|
|
|
1191
1201
|
- 步长只有天、周、月三种;月固定按 30 天。
|
|
1192
1202
|
- 一个页面一个基准日期变量。
|
|
1193
1203
|
- 范围依据已读入的数据,对象类数据源最多读 5000 行,Cypher 数据源最多 10000 行(查询没写 LIMIT 时 1000 行)。
|
|
1194
|
-
`,
|
|
1204
|
+
`,sk=Object.freeze(Object.defineProperty({__proto__:null,default:ok},Symbol.toStringTag,{value:"Module"})),rk=`# Custom components: building and extending
|
|
1195
1205
|
|
|
1196
1206
|
When the standard components cannot show or do what you need, you can build your own component, pack it and upload it to this app. It runs in an isolated frame: it reads data and runs actions only through what Workshop gives it, never sees the sign-in, and cannot reach the network freely.
|
|
1197
1207
|
|
|
@@ -1266,7 +1276,7 @@ Write it under these headings, with "None" under a heading that has nothing:
|
|
|
1266
1276
|
- **Let the Agent read it.** Report what the component shows and what is selected with \`describe\`, so the page's Agent can answer from it.
|
|
1267
1277
|
- **Change the guide with the code.** When settings, limits or extension points change, update \`README.md\` in the same change and raise the manifest's version.
|
|
1268
1278
|
- **The same holds when the AI builds or changes a component.** When a rule is missing, add it to the network, not to the code.
|
|
1269
|
-
`,
|
|
1279
|
+
`,pu=Object.freeze(Object.defineProperty({__proto__:null,default:rk},Symbol.toStringTag,{value:"Module"})),ak='# 自定义组件:开发与二次开发\n\n标准组件满足不了的展示与交互,可以自己开发组件,打成组件包上传到这个应用。组件跑在隔离的框架里,只能通过 Workshop 给的接口读数据、执行行动,拿不到登录信息,也不能随意联网。\n\n## 一 怎样开发一个组件\n\n1. **装开发包。** 在自己的项目里装 `@openbkn/workshop`(发布在公开 npm 源上,直接安装):\n\n ```bash\n npm install --save-dev @openbkn/workshop@rc\n ```\n\n2. **新建组件包。** 目录名就是组件名,类型为 `x-<前缀>.<名称>`:\n\n ```bash\n npx workshop-component init supplier-ranking --prefix acme --label 供应商排行\n ```\n\n 生成四个文件:`manifest.json`(清单:类型、名称、配置项、数据角色、联动)、`index.js`(入口,定义一个自定义元素)、`preview.json`(本地预览用的示例数据)、`README.md`(组件说明,见第三节)。\n\n3. **本地预览。** `npx workshop-component dev supplier-ranking`,打开 `http://localhost:8765/`。组件在与 Workshop 相同的隔离框架里运行,可以切换主题、语言、宽度,模拟空结果、无权限和行动确认框。\n\n4. **校验并打包。** `npx workshop-component validate` 按上传时的检查校验;`npx workshop-component pack --out dist` 打出 zip。\n\n5. **上传。** 在左侧组件库「自定义组件」里点「上传组件包」。上传后组件会放到当前页面上,配置面板按清单生成;同一类型再次上传会换成新包。发布前,应用里用到的每个组件包都要能找到,否则发布会被拦下。\n\n## 二 组件能做什么、不能做什么\n\n| 能做 | 怎么做 |\n| --- | --- |\n| 显示数据源里的对象 | 配置项里的数据源与字段角色,组件从 `data` 拿到已经取好的行 |\n| 补查数据 | `workshop.query`:只读 Cypher,或在已有数据源里再筛选(见下文“取数与提问的现状”) |\n| 选中、筛选别的组件 | 清单 `emits` 声明后,写入共享筛选 |\n| 执行行动 | `workshop.act`:一定先弹 Workshop 的确认框,用户点确定才执行。行动有名为 `app_id` 的参数时,由 Workshop 填入当前应用的 ID,组件传的值不生效 |\n| 让页面的 Agent 读懂组件 | `workshop.describe`:告诉 Agent 组件现在显示什么 |\n| 向 Agent 提问 | `workshop.ask`:把问题交给页面上的 Agent 对话 |\n\n**取数与提问的现状。** 下面这些是现在的实际行为,写组件时按它来:\n\n- `query({ kind: "objects" })` 不查服务端,只在页面上已有的、这个对象类的数据源里筛选:页面没有这样的数据源时返回 `unavailable`;`where` 只支持等值条件;最多返回 5000 行,超出时 `truncated` 为 true。选中方案时,返回的是方案里的数据,与组件自己的 `data` 一致,计算列也一样算好。要查更多数据或更复杂的条件,用 Cypher。\n- `query({ kind: "cypher" })` 以使用者的身份查知识网络当前的数据,不带方案里的改动;拿不到页面数据源上的计算列。\n- `query({ kind: "metric" })` 还没有提供,调用会以 `unavailable` 拒绝。要用指标,先在页面上放指标卡,或把指标的结果放进数据源。\n- `ask` 只带问题,`context` 里的对象暂不发送;问题填进 Agent 对话的输入框,由使用者确认发送。页面上有 Agent 对话组件时交给它;没有时在页面旁边的抽屉里打开一个对话,关掉抽屉对话还在,下次提问再打开。\n- 配置项里没有 `x-workshop` 控件的数组、对象,配置面板不显示,可以在应用的 `app.yaml` 里直接写,组件拿到写的值或清单里的默认值;应用校验只检查它是数组还是对象。\n\n不能做:读写浏览器存储与 Cookie;访问清单没有声明的网络地址;绕过确认框执行行动;在构建器设计和预览时执行行动或打开页面;拿使用者的令牌,或以使用者的身份做上表以外的事(比如建分析画布)。清单 `network` 里声明的地址可以访问,但请求不带使用者的身份。\n\n包的限制:总大小 5 MB、最多 500 个文件,入口建议不超过 300 KB;只收 js、css、json、svg、png、jpg、webp、woff2、md 文件。\n\n## 三 每个组件都要附说明\n\n组件包里放一份 `README.md`,上传后在组件库和配置面板上点「说明」就能看到,构建应用的人和 AI 都靠它配置组件。没有说明的包,校验时会给出提醒。\n\n说明按下面的标题写,没有内容的节写“无”:\n\n- **概述**:写在标题下的第一段,说明展示什么、用来做什么决策。\n- **适用与不适用**:不适用时改用什么。\n- **本体契约**:组件里有哪些角色(如“项”“资源”“任务”),每个角色要哪类对象、哪些属性、哪些关系、是否必填。\n- **组件内置的判断**:组件自己做的、与行业无关的检查,是硬约束还是只标出。\n- **扩展点**:场景判断从哪里接进来,接逻辑属性、指标还是规则工具,输入输出是什么。\n- **交互与联动**:写入、读取哪些筛选,能触发哪些行动。\n- **场景配方**:每个场景怎样对应角色、要在知识网络里补什么、扩展点挂什么。\n- **给 AI 的指引**:配置步骤、先问用户什么、常见错误。\n- **限制**:数量上限、不支持的情况。\n\n## 四 二次开发建议\n\n- **业务判断放在知识网络里,不写进组件。** “是否超期”“是否齐套”“风险高低”这类判断,写成知识网络的属性、逻辑属性、指标或规则工具,组件只读结果。这样同一个问题在各处答案一致,改规则不用改组件。\n- **组件只做通用能力。** 排行、矩阵、甘特、拖动、重叠检查这类与行业无关的展示和交互放在组件里;行业规则通过扩展点接进来。\n- **为新场景复用组件,先改知识网络。** 按说明里的本体契约把场景对象对应到组件角色,缺的对象、属性、关系在知识网络里补;再把场景判断挂到扩展点上。\n- **不要写死对象类和属性名。** 对象类、关系、字段都从配置项和数据源里取,不要在代码里写死 `supplier` 这样的名字,换一个网络组件照样能用。\n- **改数据只走行动。** 组件不直接写数据,需要改动时调用知识网络的行动,用户在确认框里确认。\n- **让 Agent 能读懂。** 用 `describe` 报告组件当前显示的内容和选中项,页面上的 Agent 才能基于它回答问题。\n- **说明与代码一起改。** 配置项、上限、扩展点变了,同一次改动更新 `README.md`,并把清单里的版本号加一。\n- **AI 生成或修改组件时也一样。** 缺判断时补知识网络,不补代码。\n',fu=Object.freeze(Object.defineProperty({__proto__:null,default:ak},Symbol.toStringTag,{value:"Module"})),ik=`# Date range (dateRange)
|
|
1270
1280
|
|
|
1271
1281
|
Pick a start and an end date, and the components that follow it show only the objects whose date falls in that span. Use it for "how many were signed this month" or "what was added in the last 30 days".
|
|
1272
1282
|
|
|
@@ -1341,7 +1351,7 @@ None. The quick picks are fixed and cannot come from the knowledge network, so f
|
|
|
1341
1351
|
- One component writes one date range; filtering by several dates separately takes several ranges.
|
|
1342
1352
|
- There are 7 fixed quick picks; they can only be turned on or off.
|
|
1343
1353
|
- Dates are compared by day, without time of day.
|
|
1344
|
-
`,
|
|
1354
|
+
`,lk=Object.freeze(Object.defineProperty({__proto__:null,default:ik},Symbol.toStringTag,{value:"Module"})),ck=`# 日期区间(dateRange)
|
|
1345
1355
|
|
|
1346
1356
|
选起点和终点两个日期,页面上跟随它的组件只显示某个日期落在这段时间里的对象。用来回答“这个月签了多少”“近 30 天新增了哪些”。
|
|
1347
1357
|
|
|
@@ -1416,7 +1426,7 @@ None. The quick picks are fixed and cannot come from the knowledge network, so f
|
|
|
1416
1426
|
- 一个组件写一个日期区间;一个对象类里要按几个日期分别筛,需要几个区间。
|
|
1417
1427
|
- 快捷项固定为 7 个,无法增删,只能开或关。
|
|
1418
1428
|
- 日期按天比较,不含时分。
|
|
1419
|
-
`,
|
|
1429
|
+
`,dk=Object.freeze(Object.defineProperty({__proto__:null,default:ck},Symbol.toStringTag,{value:"Module"})),uk=`# Dropdown filter (dropdownFilter)
|
|
1420
1430
|
|
|
1421
1431
|
Pick one or several values from a dropdown, and the components that follow it show only the chosen values. Options come from the data automatically, with counts, and can be searched. Use it for fields with many values, such as city, customer or team.
|
|
1422
1432
|
|
|
@@ -1488,7 +1498,7 @@ None. Options come only from the data and cannot be supplied by the knowledge ne
|
|
|
1488
1498
|
|
|
1489
1499
|
- The options are at most the distinct values that appear in the data; an object type data source reads at most 5000 rows and a Cypher data source 10,000 (1,000 when its query sets no LIMIT); beyond that only the values read appear.
|
|
1490
1500
|
- It filters by equal values only, with no range or fuzzy match.
|
|
1491
|
-
`,
|
|
1501
|
+
`,hk=Object.freeze(Object.defineProperty({__proto__:null,default:uk},Symbol.toStringTag,{value:"Module"})),pk=`# 下拉筛选(dropdownFilter)
|
|
1492
1502
|
|
|
1493
1503
|
下拉选择一个或多个值,页面上跟随它的组件只显示所选值。选项从数据里自动取,带数量,可以搜索。用在取值很多的字段上,如城市、客户、球队。
|
|
1494
1504
|
|
|
@@ -1560,7 +1570,7 @@ None. Options come only from the data and cannot be supplied by the knowledge ne
|
|
|
1560
1570
|
|
|
1561
1571
|
- 选项最多等于数据中出现过的不同取值;对象类数据源最多读 5000 行,Cypher 数据源最多 10000 行(查询没写 LIMIT 时 1000 行),超过时只有读到的取值。
|
|
1562
1572
|
- 只按取值相等筛选,不支持范围或模糊匹配。
|
|
1563
|
-
`,
|
|
1573
|
+
`,fk=Object.freeze(Object.defineProperty({__proto__:null,default:pk},Symbol.toStringTag,{value:"Module"})),mk=`# Event list (eventList)
|
|
1564
1574
|
|
|
1565
1575
|
Lists the business events the app handles, open ones first and by severity, so people can verify, reject or close them and move on to analysis. Use it to decide which events to look at first, whether they are real, and whether they need handling.
|
|
1566
1576
|
|
|
@@ -1671,7 +1681,7 @@ Whether an event is created, what a check found, and which actions a status allo
|
|
|
1671
1681
|
- The reason for reject, close and reopen is at most 200 characters.
|
|
1672
1682
|
- When a chosen event type is missing from the knowledge network, the list says events of that type cannot come in.
|
|
1673
1683
|
- The app needs at least one event type. Without any, the component asks you to choose some on the "Events" tab.
|
|
1674
|
-
`,
|
|
1684
|
+
`,gk=Object.freeze(Object.defineProperty({__proto__:null,default:mk},Symbol.toStringTag,{value:"Module"})),yk=`# 事件列表(eventList)
|
|
1675
1685
|
|
|
1676
1686
|
列出应用处理的业务事件,未关闭的在前、按严重程度排,由人核实、驳回、关闭,并从事件进入分析。用来做“哪些事要先看、是不是真的、要不要处理”的决策。
|
|
1677
1687
|
|
|
@@ -1782,7 +1792,7 @@ Whether an event is created, what a check found, and which actions a status allo
|
|
|
1782
1792
|
- 驳回、关闭、重新打开的原因不超过 200 字。
|
|
1783
1793
|
- 知识网络里没有某个已选的事件类型时,列表提示该类型的事件进不来。
|
|
1784
1794
|
- 应用至少要选一个事件类型;没有时组件提示先到“事件”页签选择。
|
|
1785
|
-
`,
|
|
1795
|
+
`,bk=Object.freeze(Object.defineProperty({__proto__:null,default:yk},Symbol.toStringTag,{value:"Module"})),wk=`# Event report (eventReport)
|
|
1786
1796
|
|
|
1787
1797
|
A button that opens a form to report a business event, which then starts as unverified. Use it to let people on the floor record anomalies rules cannot find and pass them to someone with the right to verify.
|
|
1788
1798
|
|
|
@@ -1854,7 +1864,7 @@ None. The form's fields are configuration, not business judgment. Whether a repo
|
|
|
1854
1864
|
- One component serves one event type. To report several kinds, place several components.
|
|
1855
1865
|
- The form has at most 12 fields, of type text, number or date.
|
|
1856
1866
|
- The title is at most 80 characters and a text field at most 200.
|
|
1857
|
-
`,
|
|
1867
|
+
`,kk=Object.freeze(Object.defineProperty({__proto__:null,default:wk},Symbol.toStringTag,{value:"Module"})),vk=`# 事件登记(eventReport)
|
|
1858
1868
|
|
|
1859
1869
|
一个按钮,点开表单登记一条业务事件,登记后状态为待核实。用来让现场人员把规则发现不了的异常记下来,交给有权限的人核实。
|
|
1860
1870
|
|
|
@@ -1926,7 +1936,7 @@ None. The form's fields are configuration, not business judgment. Whether a repo
|
|
|
1926
1936
|
- 一个组件对应一个事件类型;要登记多类事件,放多个组件。
|
|
1927
1937
|
- 登记表单最多 12 个字段,类型只有文本、数字、日期。
|
|
1928
1938
|
- 标题不超过 80 字,文本字段不超过 200 字。
|
|
1929
|
-
|
|
1939
|
+
`,$k=Object.freeze(Object.defineProperty({__proto__:null,default:vk},Symbol.toStringTag,{value:"Module"})),Sk=`# Gantt chart (ganttChart)
|
|
1930
1940
|
|
|
1931
1941
|
Draws objects as bars from start to end date, one row per group, around the page's base date. Use it to see how plans and progress are spread out: which items crowd together and which have run late.
|
|
1932
1942
|
|
|
@@ -1999,7 +2009,7 @@ None. Put judgements such as late or at risk in logical properties on the knowle
|
|
|
1999
2009
|
- Days shown 14 to 365; max rows 3 to 40; one data source.
|
|
2000
2010
|
- No click or drag, and it writes no filter.
|
|
2001
2011
|
- Only the rows with the most bars are shown; the rest are not.
|
|
2002
|
-
`,
|
|
2012
|
+
`,jk=Object.freeze(Object.defineProperty({__proto__:null,default:Sk},Symbol.toStringTag,{value:"Module"})),Ak=`# 甘特图(ganttChart)
|
|
2003
2013
|
|
|
2004
2014
|
按开始、结束日期把对象画成条,每行一组,围绕页面的基准日期显示一段时间。用来看计划与进度的整体分布,判断哪些项挤在一起、哪些已拖期。
|
|
2005
2015
|
|
|
@@ -2072,7 +2082,7 @@ None. Put judgements such as late or at risk in logical properties on the knowle
|
|
|
2072
2082
|
- 显示天数 14 到 365;最多行数 3 到 40;一个数据源。
|
|
2073
2083
|
- 不能点击、拖动,不写入任何筛选。
|
|
2074
2084
|
- 只显示条数最多的前若干行,其余行不显示。
|
|
2075
|
-
`,
|
|
2085
|
+
`,Tk=Object.freeze(Object.defineProperty({__proto__:null,default:Ak},Symbol.toStringTag,{value:"Module"})),Ok=`# Metric cards (metricCards)
|
|
2076
2086
|
|
|
2077
2087
|
A row of number cards, each counting one metric, with optional year-over-year and period-over-period change and a trend; clicking a card can filter the page. Use it to answer "how many are there now, how many are overdue, and is that up or down on last month".
|
|
2078
2088
|
|
|
@@ -2172,7 +2182,7 @@ Business rules in a metric's definition or conditions belong in the knowledge ne
|
|
|
2172
2182
|
- Page-counted cards use the rows read; an object type data source reads at most 5000 rows and a Cypher data source 10,000 (1,000 when its query sets no LIMIT); beyond that only what was read is counted. Object metrics are computed by the platform and are not limited this way.
|
|
2173
2183
|
- Object metric cards write no filter.
|
|
2174
2184
|
- The trend line covers at most the last 6 periods.
|
|
2175
|
-
`,
|
|
2185
|
+
`,Ek=Object.freeze(Object.defineProperty({__proto__:null,default:Ok},Symbol.toStringTag,{value:"Module"})),Ck=`# 指标卡组(metricCards)
|
|
2176
2186
|
|
|
2177
2187
|
一排数字卡片,每张统计一项指标,可显示同比环比与趋势;点击卡片可以筛选页面。用来回答“现在有多少、多少已超期、比上月涨了还是降了”。
|
|
2178
2188
|
|
|
@@ -2272,7 +2282,7 @@ Business rules in a metric's definition or conditions belong in the knowledge ne
|
|
|
2272
2282
|
- 页面内统计读入的对象有行数上限(对象类数据源最多 5000 行,Cypher 数据源最多 10000 行,查询没写 LIMIT 时 1000 行),超过时只统计读到的部分;对象指标由平台算,不受此限。
|
|
2273
2283
|
- 对象指标卡不写入筛选。
|
|
2274
2284
|
- 同比环比的趋势线最多画最近 6 期。
|
|
2275
|
-
`,
|
|
2285
|
+
`,Nk=Object.freeze(Object.defineProperty({__proto__:null,default:Ck},Symbol.toStringTag,{value:"Module"})),xk=`# Model trial (modelTrial)
|
|
2276
2286
|
|
|
2277
2287
|
Runs a model on a batch of objects once for each of 2 to 4 parameter sets, and compares the totals and details of the sets side by side. Results show only on the page and do not change the objects. Use it to decide what happens if the parameters are set this way.
|
|
2278
2288
|
|
|
@@ -2405,7 +2415,7 @@ Independent of industry, the component does these itself:
|
|
|
2405
2415
|
- 2 to 4 parameter sets, and the first is the baseline.
|
|
2406
2416
|
- A call is cut after about 30 seconds, and the set that timed out shows as failed.
|
|
2407
2417
|
- Trial results are not saved to the service, only in the current browser.
|
|
2408
|
-
`,
|
|
2418
|
+
`,Rk=Object.freeze(Object.defineProperty({__proto__:null,default:xk},Symbol.toStringTag,{value:"Module"})),_k=`# 模型试算(modelTrial)
|
|
2409
2419
|
|
|
2410
2420
|
对一批对象,按 2 到 4 组参数各调用一次模型,并排比较各组的汇总与明细;结果只显示在页面上,不改对象。用来做“参数这样调、结果会怎样”的决策。
|
|
2411
2421
|
|
|
@@ -2538,7 +2548,7 @@ Independent of industry, the component does these itself:
|
|
|
2538
2548
|
- 参数组 2 到 4 个;第一组是基准。
|
|
2539
2549
|
- 一次调用最长约 30 秒;超时的组显示失败。
|
|
2540
2550
|
- 试算结果不保存到服务,只保存在当前浏览器。
|
|
2541
|
-
`,
|
|
2551
|
+
`,Pk=Object.freeze(Object.defineProperty({__proto__:null,default:_k},Symbol.toStringTag,{value:"Module"})),Lk=`# Object detail (objectDetail)
|
|
2542
2552
|
|
|
2543
2553
|
When an object is selected, a drawer on the right shows its progress, its properties and the related records found along relations. Use it after a click in a list or a summary, to see the whole picture of that item and handle it on the spot.
|
|
2544
2554
|
|
|
@@ -2651,7 +2661,7 @@ What counts as "done" or "overdue" is defined by the data source's progress, not
|
|
|
2651
2661
|
- The drawer has a fixed width, and properties are laid out in two columns.
|
|
2652
2662
|
- Actions on click: up to 8 items with up to 5 steps each.
|
|
2653
2663
|
- At most 5000 objects are read per object type data source, and at most 10,000 rows per Cypher data source (1,000 when its query sets no LIMIT); a selected object outside what was read is not found and the drawer does not open.
|
|
2654
|
-
`,
|
|
2664
|
+
`,Ik=Object.freeze(Object.defineProperty({__proto__:null,default:Lk},Symbol.toStringTag,{value:"Module"})),Mk=`# 对象详情(objectDetail)
|
|
2655
2665
|
|
|
2656
2666
|
选中一个对象后,从右侧抽屉里显示它的进度、属性,以及沿关系查到的关联记录。用来在列表或汇总里点中一项后,看这一项的全貌并就地处理。
|
|
2657
2667
|
|
|
@@ -2764,7 +2774,7 @@ What counts as "done" or "overdue" is defined by the data source's progress, not
|
|
|
2764
2774
|
- 抽屉宽度固定,属性按两列排。
|
|
2765
2775
|
- 点击后的动作最多 8 项,每项最多 5 个动作。
|
|
2766
2776
|
- 对象类数据源最多读入 5000 个对象,Cypher 数据源最多 10000 行(查询没写 LIMIT 时 1000 行);选中的对象不在已读取的部分时找不到,抽屉不打开。
|
|
2767
|
-
`,
|
|
2777
|
+
`,qk=Object.freeze(Object.defineProperty({__proto__:null,default:Mk},Symbol.toStringTag,{value:"Module"})),Fk=`# Object list (objectList)
|
|
2768
2778
|
|
|
2769
2779
|
A list of cards: each item has a title, a few lines of description and a status badge; clicking an item selects the object. Use it as the entry point of a to-do or inbox: see which few come first and open them to deal with.
|
|
2770
2780
|
|
|
@@ -2857,7 +2867,7 @@ What a business means by "needs handling" or "urgent" is not judged in the list;
|
|
|
2857
2867
|
- "Show at most" is 3 to 30 items (default 8); the rest are only counted in a note, with no paging.
|
|
2858
2868
|
- At most 5000 objects are read per object type data source, and at most 10,000 rows per Cypher data source (1,000 when its query sets no LIMIT); beyond that a note shows above and the list covers only what was read.
|
|
2859
2869
|
- Actions on click: up to 8 items with up to 5 steps each; one execution confirmation covers at most 100 objects.
|
|
2860
|
-
`,
|
|
2870
|
+
`,Dk=Object.freeze(Object.defineProperty({__proto__:null,default:Fk},Symbol.toStringTag,{value:"Module"})),Bk=`# 对象列表(objectList)
|
|
2861
2871
|
|
|
2862
2872
|
卡片式列表:每项一个标题,加几行说明和一个状态徽标;点一项选中对象。用来做待办、收件箱这类“先看哪几项、点开处理”的入口。
|
|
2863
2873
|
|
|
@@ -2950,7 +2960,7 @@ What a business means by "needs handling" or "urgent" is not judged in the list;
|
|
|
2950
2960
|
- “最多显示”3 到 30 项(默认 8);超出的只提示个数,不翻页。
|
|
2951
2961
|
- 对象类数据源最多读入 5000 个对象,Cypher 数据源最多 10000 行(查询没写 LIMIT 时 1000 行),超过时上方提示,列表只覆盖已读取部分。
|
|
2952
2962
|
- 点击后的动作最多 8 项,每项最多 5 个动作;一次执行确认最多 100 个对象。
|
|
2953
|
-
`,
|
|
2963
|
+
`,Uk=Object.freeze(Object.defineProperty({__proto__:null,default:Bk},Symbol.toStringTag,{value:"Module"})),zk=`# Object table (objectTable)
|
|
2954
2964
|
|
|
2955
2965
|
Lists one type of object as a detail table that can be sorted, paged and ticked; clicking a row selects the object. Use it to check items one by one and to pick a batch for other components or actions.
|
|
2956
2966
|
|
|
@@ -3073,7 +3083,7 @@ What a business means by "overdue", "high risk" or "short of material" is not ju
|
|
|
3073
3083
|
- At most 5000 objects are read per object type data source, and at most 10,000 rows per Cypher data source (1,000 when its query sets no LIMIT); beyond that a note above the table says only the first N of M were read (a Cypher data source does not know M, so the note only says there may be more), and the table and its figures cover only what was read.
|
|
3074
3084
|
- Actions on click: up to 8 items with up to 5 steps each; one execution confirmation covers at most 100 objects, and a single action config defaults to 20.
|
|
3075
3085
|
- Search runs only on the objects already read into the browser; it does not query the knowledge network again.
|
|
3076
|
-
`,
|
|
3086
|
+
`,Wk=Object.freeze(Object.defineProperty({__proto__:null,default:zk},Symbol.toStringTag,{value:"Module"})),Kk=`# 对象表(objectTable)
|
|
3077
3087
|
|
|
3078
3088
|
把一类对象列成明细表,可排序、分页、勾选,点一行选中对象。用来逐项核对、挑出一批对象交给别的组件或行动处理。
|
|
3079
3089
|
|
|
@@ -3196,7 +3206,7 @@ What a business means by "overdue", "high risk" or "short of material" is not ju
|
|
|
3196
3206
|
- 对象类数据源最多读入 5000 个对象,Cypher 数据源最多 10000 行(查询没写 LIMIT 时 1000 行);超过时表上方提示“仅读取前 N 条(共 M 条)”(Cypher 数据源不知道总数,只提示可能不完整),表里的数据与统计只覆盖已读取部分。
|
|
3197
3207
|
- 点击后的动作最多 8 项,每项最多 5 个动作;一次执行确认最多 100 个对象,单个行动配置默认最多 20 个。
|
|
3198
3208
|
- 搜索只在浏览器已读入的对象上做,不去知识网络再查。
|
|
3199
|
-
`,
|
|
3209
|
+
`,Yk=Object.freeze(Object.defineProperty({__proto__:null,default:Kk},Symbol.toStringTag,{value:"Module"})),Gk=`# Pivot table (pivotTable)
|
|
3200
3210
|
|
|
3201
3211
|
Groups objects by one property, one row per group and one statistic per column; clicking a row makes the whole page look at that group only. Use it to answer "how many, how much and what share in each class", and to move from a total to its details.
|
|
3202
3212
|
|
|
@@ -3294,7 +3304,7 @@ Sum, average, least and greatest need a number property; count and share do not.
|
|
|
3294
3304
|
- Up to 5 measures; 5 to 50 rows shown (default 10), further groups are not shown.
|
|
3295
3305
|
- At most 5000 objects are read per object type data source, and at most 10,000 rows per Cypher data source (1,000 when its query sets no LIMIT); beyond that a note shows above and the figures cover only what was read.
|
|
3296
3306
|
- Actions on click: up to 8 items with up to 5 steps each; one execution confirmation covers at most 100 objects.
|
|
3297
|
-
`,
|
|
3307
|
+
`,Hk=Object.freeze(Object.defineProperty({__proto__:null,default:Gk},Symbol.toStringTag,{value:"Module"})),Vk=`# 透视表(pivotTable)
|
|
3298
3308
|
|
|
3299
3309
|
按一个属性把对象分组,每组一行,每列一个统计数;点一行,整页只看这一组。用来回答“各类里分别有多少、多少金额、占比多少”,并从汇总点进明细。
|
|
3300
3310
|
|
|
@@ -3392,7 +3402,7 @@ Sum, average, least and greatest need a number property; count and share do not.
|
|
|
3392
3402
|
- 度量最多 5 个;最多显示 5 到 50 行(默认 10),超出的组不显示。
|
|
3393
3403
|
- 对象类数据源最多读入 5000 个对象,Cypher 数据源最多 10000 行(查询没写 LIMIT 时 1000 行),超过时上方提示,统计只覆盖已读取部分。
|
|
3394
3404
|
- 点击后的动作最多 8 项,每项最多 5 个动作;一次执行确认最多 100 个对象。
|
|
3395
|
-
`,
|
|
3405
|
+
`,Jk=Object.freeze(Object.defineProperty({__proto__:null,default:Vk},Symbol.toStringTag,{value:"Module"})),Zk=`# Map (regionMap)
|
|
3396
3406
|
|
|
3397
3407
|
Colors a map by region: the China map by province, the world map by country, with deeper color for a greater count or amount of objects; it can draw lines between related objects and these objects, and clicking a region makes the whole page look at it only. Use it to answer "where are these objects, where are they most concentrated, where do goods come from and go to".
|
|
3398
3408
|
|
|
@@ -3516,7 +3526,7 @@ What counts as a "risk region" or a "key area" is not judged on the map; propert
|
|
|
3516
3526
|
- Up to 2 relation lines, each one direct relation only.
|
|
3517
3527
|
- At most 5000 objects are read per object type data source, and at most 10,000 rows per Cypher data source (1,000 when its query sets no LIMIT); beyond that a note shows above and the figures cover only what was read.
|
|
3518
3528
|
- Actions on click: up to 8 items with up to 5 steps each.
|
|
3519
|
-
`,
|
|
3529
|
+
`,Xk=Object.freeze(Object.defineProperty({__proto__:null,default:Zk},Symbol.toStringTag,{value:"Module"})),Qk=`# 地图(regionMap)
|
|
3520
3530
|
|
|
3521
3531
|
按地区给地图着色:中国地图按省份,世界地图按国家,颜色深浅表示该地区对象的数量或金额;可画出关联对象到这些对象之间的连线,点一个地区,整页只看它。用来回答“这些对象分布在哪里、哪里最集中、货从哪里来到哪里去”。
|
|
3522
3532
|
|
|
@@ -3640,7 +3650,7 @@ What counts as a "risk region" or a "key area" is not judged on the map; propert
|
|
|
3640
3650
|
- 关系连线最多 2 条,每条只能是一条直接关系。
|
|
3641
3651
|
- 对象类数据源最多读入 5000 个对象,Cypher 数据源最多 10000 行(查询没写 LIMIT 时 1000 行),超过时上方提示,统计只覆盖已读取部分。
|
|
3642
3652
|
- 点击后的动作最多 8 项,每项最多 5 个动作。
|
|
3643
|
-
`,
|
|
3653
|
+
`,ev=Object.freeze(Object.defineProperty({__proto__:null,default:Qk},Symbol.toStringTag,{value:"Module"})),tv=`# Scenario (scenarioBar)
|
|
3644
3654
|
|
|
3645
3655
|
Chooses whether the page shows the data as it is or a scenario, creates, copies, saves, applies and voids scenarios, lists and adjusts the assumptions in a scenario, and compares the indicators of scenarios side by side with the data as it is. Use it to decide: if we change this, what happens, and should we really apply it.
|
|
3646
3656
|
|
|
@@ -3758,7 +3768,7 @@ Independent of industry, the component does these itself:
|
|
|
3758
3768
|
- Each source has at most 10 operations, each with at most 5 inputs and 5 effects. There are at most 10 scenario parameters, each text parameter with at most 10 values.
|
|
3759
3769
|
- A scenario name is at most 40 characters.
|
|
3760
3770
|
- A model result reads at most 5000 rows per input and 25000 in total.
|
|
3761
|
-
`,
|
|
3771
|
+
`,nv=Object.freeze(Object.defineProperty({__proto__:null,default:tv},Symbol.toStringTag,{value:"Module"})),ov=`# 方案(scenarioBar)
|
|
3762
3772
|
|
|
3763
3773
|
选择页面显示现状还是某个方案,新建、复制、保存、采用、作废方案,查看并调整方案里的改动,并排对比各方案与现状的指标。用来做“如果这样改,结果会怎样,要不要真的采用”的决策。
|
|
3764
3774
|
|
|
@@ -3876,7 +3886,7 @@ Independent of industry, the component does these itself:
|
|
|
3876
3886
|
- 每个数据源最多 10 个推演操作,每个操作最多 5 个参数、5 个效果;方案参数最多 10 个,每个文本参数最多 10 个可选值。
|
|
3877
3887
|
- 方案名称不超过 40 字。
|
|
3878
3888
|
- 模型结果每次最多读 5000 行、合计 25000 行。
|
|
3879
|
-
`,
|
|
3889
|
+
`,sv=Object.freeze(Object.defineProperty({__proto__:null,default:ov},Symbol.toStringTag,{value:"Module"})),rv=`# Schedule Gantt (scheduleGantt)
|
|
3880
3890
|
|
|
3881
3891
|
Resources as rows and time running across: in a scenario you drag tasks to change their resource and time, and built-in constraints plus rules on the knowledge network decide whether the scenario can be applied. Use it for decisions that put tasks on resources, such as production scheduling, maintenance and dispatching.
|
|
3882
3892
|
|
|
@@ -4052,7 +4062,7 @@ Tasks that meet "Done when" take no part in these checks. Hard constraints block
|
|
|
4052
4062
|
- A rule tool gets at most 200 tasks per call; a call waits up to 30 seconds and is tried once more after a failure, 90 seconds in all.
|
|
4053
4063
|
- Predecessor relations are one hop only.
|
|
4054
4064
|
- Rule tools are called in the browser as needed and their results are not saved; the same scenario opened in another page is judged again.
|
|
4055
|
-
`,
|
|
4065
|
+
`,av=Object.freeze(Object.defineProperty({__proto__:null,default:rv},Symbol.toStringTag,{value:"Module"})),iv=`# 调度甘特(scheduleGantt)
|
|
4056
4066
|
|
|
4057
4067
|
资源排成行、时间横向展开,在一个方案里拖动任务改资源与时间,由内置约束和知识网络上的规则判断方案能否采用。用来做排产、检修、派工这类“把任务排到资源上”的决策。
|
|
4058
4068
|
|
|
@@ -4228,7 +4238,7 @@ Tasks that meet "Done when" take no part in these checks. Hard constraints block
|
|
|
4228
4238
|
- 规则工具每次最多收 200 个任务;一次调用最长等 30 秒,失败后自动重试一次,合计不超过 90 秒。
|
|
4229
4239
|
- 前序关系只支持一跳关系。
|
|
4230
4240
|
- 规则工具在浏览器中按需调用,结果不保存;同一方案在另一页面打开时会重新判断。
|
|
4231
|
-
`,
|
|
4241
|
+
`,lv=Object.freeze(Object.defineProperty({__proto__:null,default:iv},Symbol.toStringTag,{value:"Module"})),cv=`# Search box (searchBox)
|
|
4232
4242
|
|
|
4233
4243
|
Type a keyword, and the components that follow it show only the objects whose text columns contain it. Use it to find objects quickly by name or number.
|
|
4234
4244
|
|
|
@@ -4291,7 +4301,7 @@ None. The component only does text containment; it calls no tool and does no syn
|
|
|
4291
4301
|
|
|
4292
4302
|
- Text containment only; no multiple words, pinyin or fuzzy matching.
|
|
4293
4303
|
- It searches only the rows already read; an object type data source reads at most 5000 rows and a Cypher data source 10,000 (1,000 when its query sets no LIMIT).
|
|
4294
|
-
`,
|
|
4304
|
+
`,dv=Object.freeze(Object.defineProperty({__proto__:null,default:cv},Symbol.toStringTag,{value:"Module"})),uv=`# 搜索框(searchBox)
|
|
4295
4305
|
|
|
4296
4306
|
输入关键词,页面上跟随它的组件只显示在文本列里包含这个词的对象。用来按名称、编号快速找到对象。
|
|
4297
4307
|
|
|
@@ -4354,7 +4364,7 @@ None. The component only does text containment; it calls no tool and does no syn
|
|
|
4354
4364
|
|
|
4355
4365
|
- 只做文字包含匹配,不支持多个词、拼音或模糊匹配。
|
|
4356
4366
|
- 只在已读入的数据里查找;对象类数据源最多读 5000 行,Cypher 数据源最多 10000 行(查询没写 LIMIT 时 1000 行)。
|
|
4357
|
-
`,
|
|
4367
|
+
`,hv=Object.freeze(Object.defineProperty({__proto__:null,default:uv},Symbol.toStringTag,{value:"Module"})),pv=`# Segmented filter (segmentedFilter)
|
|
4358
4368
|
|
|
4359
4369
|
A row of buttons with counts, splitting by the value of one field; one click and the page shows only that group. Use it to switch quickly between a few groups such as all, in progress and overdue.
|
|
4360
4370
|
|
|
@@ -4430,7 +4440,7 @@ None. The segments come from the configured values. Industry judgments (such as
|
|
|
4430
4440
|
- 2 to 6 options.
|
|
4431
4441
|
- One button selected at a time.
|
|
4432
4442
|
- Counts come from the rows already read; an object type data source reads at most 5000 rows and a Cypher data source 10,000 (1,000 when its query sets no LIMIT).
|
|
4433
|
-
`,
|
|
4443
|
+
`,fv=Object.freeze(Object.defineProperty({__proto__:null,default:pv},Symbol.toStringTag,{value:"Module"})),mv=`# 分段筛选(segmentedFilter)
|
|
4434
4444
|
|
|
4435
4445
|
一排带数量的按钮,按一个字段的取值分段,点一下页面只看这一类。用来在“全部 / 进行中 / 已超期”这类少数几类之间快速切换。
|
|
4436
4446
|
|
|
@@ -4506,7 +4516,7 @@ None. The segments come from the configured values. Industry judgments (such as
|
|
|
4506
4516
|
- 选项 2 到 6 个。
|
|
4507
4517
|
- 一次只选一个按钮。
|
|
4508
4518
|
- 数量按已读入的数据统计;对象类数据源最多读 5000 行,Cypher 数据源最多 10000 行(查询没写 LIMIT 时 1000 行)。
|
|
4509
|
-
`,
|
|
4519
|
+
`,gv=Object.freeze(Object.defineProperty({__proto__:null,default:mv},Symbol.toStringTag,{value:"Module"})),yv=`# Stage chain (stageChain)
|
|
4510
4520
|
|
|
4511
4521
|
Lines up several object types in business order and shows how many related objects each stage has; click a stage to see the records. Use it to see how many objects have reached each stage and to spot where they pile up or drop off.
|
|
4512
4522
|
|
|
@@ -4576,7 +4586,7 @@ None. Which objects count at a stage is decided by the relation path; to limit b
|
|
|
4576
4586
|
- 1 to 9 stages; up to 20 records when expanded.
|
|
4577
4587
|
- One data source; it counts reachable objects only and shows no conversion rate between stages.
|
|
4578
4588
|
- A stage without a relation path does not follow filters.
|
|
4579
|
-
`,
|
|
4589
|
+
`,bv=Object.freeze(Object.defineProperty({__proto__:null,default:yv},Symbol.toStringTag,{value:"Module"})),wv=`# 环节链路(stageChain)
|
|
4580
4590
|
|
|
4581
4591
|
把几类对象按业务顺序排成一排,每个环节显示关联的对象数量,点开可看具体记录。用来看一批对象流转到各环节的数量,判断哪个环节堆积或断档。
|
|
4582
4592
|
|
|
@@ -4646,7 +4656,7 @@ None. Which objects count at a stage is decided by the relation path; to limit b
|
|
|
4646
4656
|
- 环节 1 到 9 个;展开最多 20 条。
|
|
4647
4657
|
- 一个数据源,只数关系可达的对象,不显示环节之间的转化率。
|
|
4648
4658
|
- 没配关系路径的环节不跟随筛选。
|
|
4649
|
-
`,
|
|
4659
|
+
`,kv=Object.freeze(Object.defineProperty({__proto__:null,default:wv},Symbol.toStringTag,{value:"Module"})),vv=`# Related graph (subgraph)
|
|
4650
4660
|
|
|
4651
4661
|
Takes the object selected on the page as the center, follows the configured relation paths to the objects around it, and draws them as a graph. Use it to see what an object connects to, to judge its reach or trace its source.
|
|
4652
4662
|
|
|
@@ -4713,7 +4723,7 @@ None.
|
|
|
4713
4723
|
- 1 to 6 paths; 1 to 50 nodes per path; height 240 to 640.
|
|
4714
4724
|
- One center object at a time.
|
|
4715
4725
|
- Only objects reachable along the paths are shown, not other links between them.
|
|
4716
|
-
|
|
4726
|
+
`,$v=Object.freeze(Object.defineProperty({__proto__:null,default:vv},Symbol.toStringTag,{value:"Module"})),Sv=`# 关系子图(subgraph)
|
|
4717
4727
|
|
|
4718
4728
|
以页面上选中的对象为中心,沿配置的关系路径展开它关联的对象,画成一张关系图。用来看一个对象和哪些对象相连,判断影响范围或追溯来源。
|
|
4719
4729
|
|
|
@@ -4780,7 +4790,7 @@ None.
|
|
|
4780
4790
|
- 展开路径 1 到 6 条;每条最多节点 1 到 50;高度 240 到 640。
|
|
4781
4791
|
- 一次只显示一个中心对象。
|
|
4782
4792
|
- 只显示关系路径可达的对象,不显示路径之外的连线。
|
|
4783
|
-
`,
|
|
4793
|
+
`,jv=Object.freeze(Object.defineProperty({__proto__:null,default:Sv},Symbol.toStringTag,{value:"Module"})),Av=`# Task inbox (taskInbox)
|
|
4784
4794
|
|
|
4785
4795
|
Lists the tasks that events were gathered into. Open one to see its events, analyses and handlings, pick a handling choice and record the decision, and run the action bound to that choice when there is one. Use it to decide how a batch of events is handled, by whom, and whether anything is overdue.
|
|
4786
4796
|
|
|
@@ -4894,7 +4904,7 @@ The same as in the event list (\`eventList\`): when the event type has an analys
|
|
|
4894
4904
|
- Each event type has at most 12 handling choices, each at most 40 characters.
|
|
4895
4905
|
- A handling cannot be reverted once its action has run or been accepted on any object.
|
|
4896
4906
|
- Without event types the component asks you to choose some on the "Events" tab.
|
|
4897
|
-
`,
|
|
4907
|
+
`,Tv=Object.freeze(Object.defineProperty({__proto__:null,default:Av},Symbol.toStringTag,{value:"Module"})),Ov=`# 任务收件箱(taskInbox)
|
|
4898
4908
|
|
|
4899
4909
|
列出由事件归并成的任务,打开一个任务查看事件、分析与处理,选处理方案并记录决定,必要时直接执行方案绑定的行动。用来做“这批事件怎么处理、谁处理、有没有逾期”的决策。
|
|
4900
4910
|
|
|
@@ -5008,7 +5018,7 @@ The same as in the event list (\`eventList\`): when the event type has an analys
|
|
|
5008
5018
|
- 每个事件类型最多 12 个处理方案,每个方案名不超过 40 字。
|
|
5009
5019
|
- 处理的行动已有对象成功执行或受理后,不能回退。
|
|
5010
5020
|
- 没有事件类型时,组件提示先到“事件”页签选择。
|
|
5011
|
-
`,
|
|
5021
|
+
`,Ev=Object.freeze(Object.defineProperty({__proto__:null,default:Ov},Symbol.toStringTag,{value:"Module"})),Cv=`# Text (text)
|
|
5012
5022
|
|
|
5013
5023
|
A passage of text for a page's opening conclusion, section headings and notes, in the Basic group. Picked while building, it is edited right on the page. It can name numbers, which follow the page's filters and base date.
|
|
5014
5024
|
|
|
@@ -5086,7 +5096,7 @@ None. The component counts objects of its sources or reads object metrics; it ca
|
|
|
5086
5096
|
- Counts only the data read: up to 5000 rows for an object type source, up to 10000 for a Cypher source (1000 when the query has no LIMIT). Object metrics are counted by the platform over every object and are not limited.
|
|
5087
5097
|
- Only the layout Markdown itself gives, and the alignment of the whole passage: no font colors or sizes.
|
|
5088
5098
|
- While it is edited on the page, the text shows \`{name}\` itself rather than the number; leave it to see the numbers.
|
|
5089
|
-
`,
|
|
5099
|
+
`,Nv=Object.freeze(Object.defineProperty({__proto__:null,default:Cv},Symbol.toStringTag,{value:"Module"})),xv=`# 文本(text)
|
|
5090
5100
|
|
|
5091
5101
|
一段文字,用来写页面开头的结论、分节标题和说明段落,在「基础」分类里。搭建时选中它就能在页面上直接编辑。正文里可以引用数字,数字跟着页面的筛选和基准日期变。
|
|
5092
5102
|
|
|
@@ -5164,7 +5174,7 @@ None. The component counts objects of its sources or reads object metrics; it ca
|
|
|
5164
5174
|
- 只统计已读入的数据;对象类数据源最多读 5000 行,Cypher 数据源最多 10000 行(查询没写 LIMIT 时 1000 行)。对象指标由平台按全部对象计算,不受这个限制。
|
|
5165
5175
|
- 只支持 Markdown 本身的排版和整段对齐,不支持字体颜色、字号这类设置。
|
|
5166
5176
|
- 在页面上直接编辑时,正文里显示 \`{引用名}\` 本身,不显示数字;离开文本后显示数字。
|
|
5167
|
-
`,
|
|
5177
|
+
`,Rv=Object.freeze(Object.defineProperty({__proto__:null,default:xv},Symbol.toStringTag,{value:"Module"})),_v=`# Chart (trendChart)
|
|
5168
5178
|
|
|
5169
5179
|
A bar, line or pie chart: see how counts or amounts change over time, or compare sizes across categories; clicking a period or a category makes the whole page look at it only. Use it to answer "how has it gone over the last months" and "which few classes are biggest".
|
|
5170
5180
|
|
|
@@ -5295,7 +5305,7 @@ What counts as a "defect" or as "finished" is decided by the data source and the
|
|
|
5295
5305
|
- At most 6 parts in a split (a status column uses its own values).
|
|
5296
5306
|
- With counting on the page, at most 5000 objects are read per object type data source, and at most 10,000 rows per Cypher data source (1,000 when its query sets no LIMIT); beyond that a note shows above and the figures cover only what was read.
|
|
5297
5307
|
- Actions on click: up to 8 items with up to 5 steps each.
|
|
5298
|
-
`,
|
|
5308
|
+
`,Pv=Object.freeze(Object.defineProperty({__proto__:null,default:_v},Symbol.toStringTag,{value:"Module"})),Lv=`# 图表(trendChart)
|
|
5299
5309
|
|
|
5300
5310
|
柱状图、折线图或饼图:按时间看数量或金额的变化,或按类别比较大小;点一个周期或类别,整页只看它。用来回答“最近几个月走势如何”“哪几类最多”。
|
|
5301
5311
|
|
|
@@ -5426,4 +5436,4 @@ What counts as a "defect" or as "finished" is decided by the data source and the
|
|
|
5426
5436
|
- 拆分最多 6 部分(判断状态列按其自身取值)。
|
|
5427
5437
|
- 页面内统计时,对象类数据源最多读入 5000 个对象,Cypher 数据源最多 10000 行(查询没写 LIMIT 时 1000 行),超过时上方提示,统计只覆盖已读取部分。
|
|
5428
5438
|
- 点击后的动作最多 8 项,每项最多 5 个动作。
|
|
5429
|
-
`,
|
|
5439
|
+
`,Iv=Object.freeze(Object.defineProperty({__proto__:null,default:Lv},Symbol.toStringTag,{value:"Module"}));export{Bw as liveWorkshop,Qv as run};
|