@smartkomm/plexus-cli 0.1.313 → 0.1.315
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/cli.mjs
CHANGED
|
@@ -8328,7 +8328,7 @@ forwarded) \u2014 and no \`completableIf\`, \`--locks-evidence\` or family reque
|
|
|
8328
8328
|
(\`[workItems/feedback*]\`). A recommendation or choice shows its options on the page; the words land in
|
|
8329
8329
|
the chat like any result. \`--clear-feedback\` removes it.
|
|
8330
8330
|
|
|
8331
|
-
The mail is \`staff.feedbackRequested\`, on by default for every staff member, sent once the row can be answered; the school rewords it like any letter (\`notifications/reword-a-letter.md\`).
|
|
8331
|
+
The mail is \`staff.feedbackRequested\`, on by default for every staff member, sent once the row can be answered; the school rewords it like any letter (\`notifications/reword-a-letter.md\`). It goes to one person: whoever holds the task, or \u2014 while it waits unassigned in the team's queue \u2014 the application's responsible person, who answers or assigns it; the person assigned then gets an own link.
|
|
8332
8332
|
|
|
8333
8333
|
\`\`\`bash
|
|
8334
8334
|
plexus-cli offer workflow node task add --dir "$DIR" --node <node> --key feedbackLehrkraft \\
|
|
@@ -11396,7 +11396,7 @@ plexus-cli --env prod jobs list --status running # nothing unexpectedly in
|
|
|
11396
11396
|
## Related
|
|
11397
11397
|
- Command reference: \`plexus-cli jobs list --help\`, \`plexus-cli platform workers reap --help\`,
|
|
11398
11398
|
\`plexus-cli platform imports cleanup-orphaned --help\`.
|
|
11399
|
-
`,"references/worker-ops/set-import-default-unit.md":"# Set the default unit of an import source\n\n**When to use:** a unit that an import source uses as its default unit has to\ngo, or imported records should attach to another unit by default.\n`org unit delete` refuses the default unit of an import source\n(`[unit/importSourceDefault]`). Point the source at another unit first.\n\n## Prerequisites\n- **Auth:** a platform operator's token with `_platform.config.manage`. A\n school's own token is refused, because the import source belongs to the operator.\n- **Env:** a writing run needs `--env <local|staging|prod>` on the command line,\n and `--allow-prod` against production.\n- You need the source key (`imports status --tenant <slug>`, column `config`)\n and the new unit's config key (`org tree`, column `key`).\n\n## Steps\n\n```bash\n# Plan: shows the current default and the new one, and writes nothing\nplexus-cli --env prod --allow-prod platform imports source set-default-unit <source> --unit <unit-key>\n# Write\nplexus-cli --env prod --allow-prod platform imports source set-default-unit <source> --unit <unit-key> --confirm\n```\n\n## Verify\nRun the plan again. It reports `unchanged`, with the new unit as the default.\n\n## Idempotency / gotchas\n- The unit must be one the source already knows by key (every unit of the\n tenant at the time the source was set up). Otherwise the command refuses with\n `[import-source/unitUnknown]` and lists the keys the source knows.\n- Deleting any other unit removes it from the source's key list automatically.\n Only the default unit blocks a delete.\n- The tenant config names the default unit by key: `source.defaultUnitKey`\n (the order of `foundation.units` means nothing). `config export` writes the\n current default there, so an apply from a fresh export keeps it. **An apply\n from an export taken before this change names the old default and sets it\n back**; its plan shows an update on `source`. Export again after setting the\n default, or set `source.defaultUnitKey` in the scratch export by hand.\n- `config apply` refuses a source without `defaultUnitKey`\n (`[import/defaultUnitMissing]`) or with a key that is not in\n `foundation.units` (`[import/defaultUnitUnknown]`). There is no fallback to\n the first unit. An export taken before this change carries no key: add it before\n the apply.\n\n## Related\n- [Edit a school's organisation structure](../organization/edit-org-structure.md)\n- [Debug a stuck/failed import or worker job](./debug-worker-jobs.md)\n"};var rp="165dfc0a6d7d436702ad82137e8708534e878d8889601cf3ad3f2a5bfd907f7c",lw=MO;var k2=new Set(["ENOENT","ENOTDIR","EISDIR","EACCES","EPERM"]);function b2(e){return typeof e=="object"&&e!==null&&"code"in e?e.code:void 0}s(b2,"codeOf");function qO(e){return e instanceof Error?e.message:String(e)}s(qO,"messageOf");function dw(e,n){try{return Ce(e)}catch(t){throw k2.has(b2(t))?new g(`${n}: ${e} is not readable (${qO(t)})`,{cause:t}):t}}s(dw,"readBytesFile");function cw(e,n){return dw(e,n).toString("utf8")}s(cw,"readTextFile");function Zr(e,n){try{return JSON.parse(e)}catch(t){throw new g(`${n} is no JSON (${qO(t)})`,{cause:t})}}s(Zr,"parseJsonText");function Be(e,n){return Zr(cw(e,n),`${n}: ${e}`)}s(Be,"readJsonFile");var uw=class extends Se{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=E.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:rp,tools:Hl}),0}},fw=class extends Se{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=E.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new g("plexus: pipe the tool's JSON input on stdin.");let n=Zr(await aw(this.context.stdin),"stdin"),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},KO=[uw,fw];var pw=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],dfe=new Set(pw.map(e=>e.key));var Ge=["de","en"];function Zs(e,n){return Ge.every(t=>e[t]===n[t])}s(Zs,"sameText");function Mn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!Ge.includes(r))?"not-localized":Ge.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Mn,"missingLocales");function Zi(e){let n=Mn(e);return n!=="not-localized"&&n.length===0}s(Zi,"isLocalizedText");function Jl(e,n){let t={};for(let r of Ge){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(Jl,"composeTexts");function ip(e){return e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}s(ip,"slugify");var jO="tenant";function VO(e){if(e.length===0||ip(e)!==e)return"must be lowercase a-z/0-9 words joined by single dashes";if(e===jO)return`"${jO}" is reserved for the tenant-wide scope`}s(VO,"unitSlugError");var v2=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function ir(e,n){return`${e}-${n}`}s(ir,"runStorageKey");function BO(e,n){typeof n!="string"&&de("CONFLICT",{de:`[run/keyNotServed] Das Deployment liefert f\xFCr ein Schuljahr von \u201E${e}\u201C keinen Schl\xFCssel \u2014 es l\xE4uft ein \xE4lteres Release als die CLI. Nach dem n\xE4chsten Release erneut versuchen.`,en:`[run/keyNotServed] The deployment provides no key for a school year of "${e}" \u2014 it runs an older release than the CLI. Try again after the next release.`});let t=`${e}-`;return(!n.startsWith(t)||n.length===t.length)&&de("CONFLICT",{de:`[run/foreignKey] Der Schl\xFCssel \u201E${n}\u201C des Schuljahrs liegt nicht unter dem Programm \u201E${e}\u201C (erwartet: \u201E${t}<key>\u201C).`,en:`[run/foreignKey] The key "${n}" of the school year is not under the program "${e}" (expected: "${t}<key>").`}),n.slice(t.length)}s(BO,"bareRunKey");function op(e){let n=[],t=new Map;return e.forEach((r,i)=>{let o=Mn(r.name),a=o!=="not-localized"&&!o.includes("de")?r.name.de:void 0,l=`program.runs[${i}]${a!==void 0?` ("${a}")`:""}`;o==="not-localized"||o.length===2?n.push({code:"run/nameMissing",index:i,message:{de:`[run/nameMissing] ${l}: jedes Schuljahr braucht einen \`name\` auf Deutsch und Englisch (\`{ de, en }\`)`,en:`[run/nameMissing] ${l}: every run needs a \`name\` in German and English (\`{ de, en }\`)`}}):o.length>0&&n.push({code:"run/nameUntranslated",index:i,message:{de:`[i18n/missingTranslation] ${l}.name fehlt in: ${o.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${l}.name is missing in: ${o.join(", ")} \u2014 every displayed text needs German and English.`}});let d=r.key;if(d==null||d===""){n.push({code:"run/keyMissing",index:i,message:{de:`[run/keyMissing] ${l}: jedes Schuljahr braucht einen stabilen \`key\` \u2014 der Name dient nur der Anzeige`,en:`[run/keyMissing] ${l}: every run needs a stable \`key\` \u2014 the name is display only`}});return}if(typeof d!="string"||!v2.test(d)){n.push({code:"run/keyInvalid",index:i,message:{de:`[run/keyInvalid] ${l}: der Schl\xFCssel ${JSON.stringify(d)} muss ein kleingeschriebener Slug sein (a-z, 0-9, einzelnes \u201E-\u201C)`,en:`[run/keyInvalid] ${l}: key ${JSON.stringify(d)} must be a lowercase slug string (a-z, 0-9, single "-")`}});return}let c=t.get(d);if(c!==void 0){n.push({code:"run/duplicateKey",index:i,message:{de:`[run/duplicateKey] ${l}: der Schl\xFCssel \u201E${d}\u201C wird bereits von program.runs[${c}] verwendet`,en:`[run/duplicateKey] ${l}: key "${d}" is already used by program.runs[${c}]`}});return}t.set(d,i)}),n}s(op,"runSpecIssues");var x2="-stufe-",S2=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function mw(e){return`${e}${x2}`}s(mw,"stageKeyPrefix");function Xs(e,n){return`${mw(e)}${n}`}s(Xs,"stageStorageKey");function GO(e,n){let t=mw(e);return n.startsWith(t)&&n.length>t.length}s(GO,"isUnderProgram");function Xr(e,n){let t=mw(e);return GO(e,n)||de("CONFLICT",{de:`[stage/foreignKey] Der Stufenschl\xFCssel \u201E${n}\u201C liegt nicht unter dem Programm \u201E${e}\u201C (erwartet: \u201E${t}<key>\u201C). F\xFChren Sie die Stufe in bundle.yaml unter einem neuen Schl\xFCssel auf; der n\xE4chste Apply archiviert diese Zeile (hinter der Archivsperre) und legt die Stufe mit dem neuen Schl\xFCssel an.`,en:`[stage/foreignKey] The level key "${n}" is not under the program "${e}" (expected: "${t}<key>"). List the level in bundle.yaml under a new key; the next apply archives this row (behind the archive lock) and creates the level with the new key.`}),n.slice(t.length)}s(Xr,"bareStageKey");function sp(e){let n=[],t=new Map;return e.forEach((r,i)=>{let o=Mn(r.name),a=o!=="not-localized"&&!o.includes("de")?r.name.de:void 0,l=`program.stages[${i}]${a!==void 0?` ("${a}")`:""}`;o==="not-localized"||o.length===2?n.push({code:"stage/nameMissing",index:i,message:{de:`[stage/nameMissing] ${l}: jede Klassenstufe braucht einen \`name\` auf Deutsch und Englisch (\`{ de, en }\`)`,en:`[stage/nameMissing] ${l}: every stage needs a \`name\` in German and English (\`{ de, en }\`)`}}):o.length>0&&n.push({code:"stage/nameUntranslated",index:i,message:{de:`[i18n/missingTranslation] ${l}.name fehlt in: ${o.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${l}.name is missing in: ${o.join(", ")} \u2014 every displayed text needs German and English.`}});let d=r.key;if(d==null||d===""){n.push({code:"stage/keyMissing",index:i,message:{de:`[stage/keyMissing] ${l}: jede Klassenstufe braucht einen stabilen \`key\` \u2014 der Name dient nur der Anzeige`,en:`[stage/keyMissing] ${l}: every stage needs a stable \`key\` \u2014 the name is display only`}});return}if(typeof d!="string"||!S2.test(d)){n.push({code:"stage/keyInvalid",index:i,message:{de:`[stage/keyInvalid] ${l}: der Schl\xFCssel ${JSON.stringify(d)} muss ein kleingeschriebener Slug sein (a-z, 0-9, einzelnes \u201E-\u201C)`,en:`[stage/keyInvalid] ${l}: key ${JSON.stringify(d)} must be a lowercase slug string (a-z, 0-9, single "-")`}});return}let c=t.get(d);if(c!==void 0){n.push({code:"stage/duplicateKey",index:i,message:{de:`[stage/duplicateKey] ${l}: der Schl\xFCssel \u201E${d}\u201C wird bereits von program.stages[${c}] verwendet`,en:`[stage/duplicateKey] ${l}: key "${d}" is already used by program.stages[${c}]`}});return}t.set(d,i)}),n}s(sp,"stageSpecIssues");function UO(e){return{de:e.de.trim(),en:e.en.trim()}}s(UO,"trimmedText");function A2(e,n){let t=[];return e.de!==n.de&&t.push(`"${e.de}" \u2192 "${n.de}"`),e.en!==n.en&&t.push(`en "${e.en}" \u2192 "${n.en}"`),t.join(", ")}s(A2,"describeNameChange");function ap(e,n,t){if(e===null)return n.length>0&&M("planStageReconcile: stages exist but the offer has no program key"),t.map((a,l)=>({op:"insert",key:a.key,name:UO(a.name),...a.gradeLevel!==void 0?{gradeLevel:a.gradeLevel}:{},sequence:l+1}));let r=new Map(n.map(a=>[a.key,a])),i=new Set,o=[];t.forEach(({name:a,...l},d)=>{let c={...l,name:UO(a)},u=Xs(e,c.key);i.add(u);let p=d+1,h=r.get(u);if(h===void 0){o.push({op:"insert",key:c.key,name:c.name,...c.gradeLevel!==void 0?{gradeLevel:c.gradeLevel}:{},sequence:p});return}let y={};Zs(h.name,c.name)||(y.name=[h.name,c.name]);let b=h.gradeLevel??null,k=c.gradeLevel??null;b!==k&&(y.gradeLevel=[b,k]),h.sequence!==p&&(y.sequence=[h.sequence,p]),(Object.keys(y).length>0||h.archived)&&o.push({op:"update",key:c.key,stageId:h.stageId,name:c.name,changes:y,unarchive:h.archived})});for(let a of[...n].sort((l,d)=>l.sequence-d.sequence))a.archived||i.has(a.key)||o.push({op:"archive",key:GO(e,a.key)?Xr(e,a.key):a.key,stageId:a.stageId,name:a.name});return o}s(ap,"planStageReconcile");function lp(e){switch(e.op){case"insert":return`+stage ${e.key} (${e.name.de})`;case"archive":{let n=e.occupancy,t=[...n&&n.activeApplications>0?[`REFUSED: ${n.activeApplications} active application(s) \u2014 [stage/hasActiveApplications]`]:[],...n&&n.openLeads>0?[`${n.openLeads} open lead(s)`]:[]];return`-stage ${e.key} (${e.name.de})${t.length>0?` \u2014 ${t.join("; ")}`:""}`}case"update":{let n=[];if(e.unarchive&&n.push("restored"),e.changes.name&&n.push(A2(e.changes.name[0],e.changes.name[1])),e.changes.gradeLevel){let[t,r]=e.changes.gradeLevel;n.push(`grade ${t??"\u2013"} \u2192 ${r??"\u2013"}`)}return e.changes.sequence&&n.push(`position ${e.changes.sequence[0]} \u2192 ${e.changes.sequence[1]}`),`~stage ${e.key} (${n.join(", ")})`}}}s(lp,"describeStageStep");function dp(e,n){return n.startsWith(e)&&n.length>e.length?n.slice(e.length):void 0}s(dp,"bareUnder");function WO(e,n,t,r){let i=e.flatMap(y=>y.angebote).find(y=>y.offerKey===n);if(i===void 0){let y=e.flatMap(b=>b.angebote.map(k=>k.offerKey));throw new g(`applications start-test: no offer "${n}" (offers: ${y.join(", ")||"none"})`)}if(i.programKey===void 0)throw new g("applications start-test: the deployment does not serve the offer's program key \u2014 it runs an older release than the CLI; try again after the next release");let o=i.programKey;if(o===null)throw new g(`applications start-test: ${n} has no program yet \u2014 no level to start on`);let a=Xs(o,""),l=ir(o,""),d=s(y=>dp(a,y)??"(no bundle key)","stageLabel"),c=s(y=>dp(l,y)??"(no bundle key)","runLabel"),u=i.stages.find(y=>y.stageKey===Xs(o,r)||y.stageId===r);if(u===void 0){let y=i.stages.map(v=>`${d(v.stageKey)} (${v.stageId})`).join(", "),b=dp(a,r),k=b!==void 0&&i.stages.some(v=>v.stageKey===r)?` \u2014 "${r}" is the stored key; the export names it "${b}"`:"";throw new g(`applications start-test: no level "${r}" in ${n}${k} \u2014 name it by its bundle key or id: ${y}`)}let p=d(u.stageKey),h=u.runs.find(y=>y.runKey===ir(o,t)||y.runId===t);if(h===void 0){let y=u.runs.map(v=>`${c(v.runKey)} (${v.runId})`).join(", "),b=dp(l,t),k=b!==void 0&&u.runs.some(v=>v.runKey===t)?` \u2014 "${t}" is the stored key; the export names it "${b}"`:"";throw new g(`applications start-test: no school year "${t}" for level ${p}${k} \u2014 name it by its bundle key or id: ${y}`)}if(!h.isOpen)throw new g(`applications start-test: school year ${c(h.runKey)} is closed for level ${p}`);return{programRunId:h.runId,programStageId:u.stageId}}s(WO,"resolveStartTarget");function T2(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(T2,"applicantText");function YO(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:T2(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(YO,"applicationRows");var zO=pw.map(e=>e.email);function HO(e,n,t,r){if(t===void 0&&r===void 0)throw new g("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(t!==void 0&&r!==void 0)throw new g("applications start-test: --party or --applicant, not both");if(iw(e,n)&&(r===void 0||!zO.includes(r.trim().toLowerCase())))throw new g(`applications start-test: on prod only for the test account ${zO.join(", ")} (--applicant) \u2014 never a real family's`)}s(HO,"assertStartApplicant");function JO(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(JO,"processStoreJson");function R2(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.snapshotNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.snapshotNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(R2,"refText");function $2(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?R2(e.ref):JSON.stringify(e.value)}s($2,"holds");function QO(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:$2(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(QO,"storeRows");function cp(e){let n={},t={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new g(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(t,o))throw new g(`'${o}' is given twice.`);let a=r.slice(i+1);t[o]=a;try{n[o]=JSON.parse(a)}catch{n[o]=a}}return{values:n,raw:t}}s(cp,"parseKv");var hw="started",up="submitted",fp="submitted",ZO="load-scenario:";var XO="(Bewerbung)";function e_(e){return{nodeId:XO,actions:e.map(n=>({id:n.id,label:{de:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`,en:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`},...n.disabledReason===void 0?{}:{disabledReason:n.disabledReason}}))}}s(e_,"sharedAsList");function n_(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(n_,"disabledText");function t_(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:n_(r)})))}s(t_,"actionRows");function r_(e,n,t=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===n));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new g(`test-actions run: no current node offers "${n}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new g(`test-actions run: "${n}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===n);if(a.disabledReason!==void 0)throw new g(`test-actions run: "${n}" on ${i} is disabled: ${n_(a)}`);if(i!==XO)return i;let l=t[0];if(l===void 0)throw new g(`test-actions run: "${n}" needs a current node \u2014 the application has none`);return l}s(r_,"nodeOfferingAction");function i_(e,n,t){if(e.startsWith(ZO)){if(Object.hasOwn(t,"autoSubmit"))throw new g(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:n,...t}}return Object.keys(t).length===0?void 0:{...t}}s(i_,"runParams");var E2=/^[0-9a-hjkmnp-tv-z]{31,37}$/;function ne(e,n){if(!E2.test(e))throw new g(`"${e}" is not a ${n} id \u2014 a Convex id is 31\u201337 characters of 0-9 and a-z without i, l, o, u.`);return e}s(ne,"parseDocumentId");async function I2(e,n){let t=await e.query(S.workflow.getInstance,{applicationId:n});if(t===null)throw new g(`test-actions: application ${n} has no workflow instance`);return t.instance.currentNodeIds}s(I2,"currentNodeIds");function O2(e,n){switch(n){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${n} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(O2,"refusalText");async function pp(e,n,t){let r=await e.query(S.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new g(`test-actions: not permitted \u2014 ${O2(n,r.reason)}`);let i=[];for(let o of t){let a=await e.query(S.workflow.listTestActions,{applicationId:n,nodeId:o});if(a===null)throw new g(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,e_(r.actions)]}s(pp,"actionsOf");async function o_(e,n,t){return t!==void 0?[t]:await I2(e,n)}s(o_,"nodesOf");var gw=class extends P{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=E.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=ne(this.application,"application"),t=await this.caller(),r=await pp(t,n,await o_(t,n,this.node));return this.print(r,t_,["node","action","label","disabled"]),0}},yw=class extends P{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=E.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=i_(this.action,this.autoSubmit,cp(this.param??[]).values),t=ne(this.application,"application"),r=await this.caller(),i=await o_(r,t,this.node),o=r_(await pp(r,t,i),this.action,i);return await r.mutation(S.workflow.runTestAction,{applicationId:t,nodeId:o,actionId:this.action,...n===void 0?{}:{params:n}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},s_=[gw,yw];var Rr=/^[a-z][A-Za-z0-9]*$/;function ww(e){return typeof e=="string"&&Rr.test(e)}s(ww,"isNodeId");function ea(e,n){ww(e)||M(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${Rr.source}.`);let t=new Set(n);if(!t.has(e))return e;let r=2;for(;t.has(`${e}${r}`);)r++;return`${e}${r}`}s(ea,"makeNodeId");var eo="$env";function ue(e){if(e.scope==="env")return`${eo}.${e.key}`;let n=`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(ue,"formatAddress");var Xi=/^[a-z][a-zA-Z0-9_]*$/,_2=/^[A-Za-z_][A-Za-z0-9_]*$/;function Vo(e){return typeof e=="string"&&e.split(".").every(n=>_2.test(n))}s(Vo,"isPath");function wi(e){if(!e.startsWith("$"))return null;let n=e.slice(1).split("."),[t,...r]=n;switch(t){case"env":{let i=r.join(".");return r.length>0&&Vo(i)?{scope:"env",key:i}:null}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Xi.test(o)||(t==="node"?!Rr.test(i):!Xi.test(i))?null:C2({scope:t,owner:i,key:o},a)}default:return null}}s(wi,"tryParseAddress");function C2(e,n){if(n.length===0)return e;let t=n.join(".");return Vo(t)?{...e,path:t}:null}s(C2,"withPath");function ke(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!Vo(n.path))return!1;switch(n.scope){case"env":return Vo(n.key);case"node":return typeof n.owner=="string"&&Rr.test(n.owner)&&typeof n.key=="string"&&Xi.test(n.key);case"task":return typeof n.owner=="string"&&Xi.test(n.owner)&&typeof n.key=="string"&&Xi.test(n.key);default:return!1}}s(ke,"isAddress");var no={offer:{key:"string",title:"string"},unit:{key:"string",name:"string"},stage:{key:"string",name:"string",gradeLevel:"number"},run:{key:"string",name:"string",startDate:"date"},applicant:{language:"enum",channel:"enum"}},na=Object.keys(no);function to(e){return Object.hasOwn(no,e)}s(to,"isEnvKey");var kw=["self-service","staff"];function a_(e,n){return{kind:"fixed",values:e,labels:n}}s(a_,"fixedSet");var mp={of:"applicant.language",withoutValue:"de"},ki={"offer.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Angebot",en:"Offer"}},"offer.title":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Titel des Angebots",en:"Offer title"},nameLanguage:mp},"unit.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Einheit",en:"Unit"}},"unit.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Einheit",en:"Unit name"},nameLanguage:mp},"stage.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Klassenstufe (Schl\xFCssel)",en:"Grade (key)"},cohortBound:!0},"stage.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Klassenstufe",en:"Grade name"},cohortBound:!0,nameLanguage:mp},"stage.gradeLevel":{valueSet:{kind:"open"},nullable:!0,absent:{de:"Die Stufe hat keine Klassenstufe (Kindergarten).",en:"The stage has no grade level (Kindergarten)."},label:{de:"Klassenstufe",en:"Grade level"},cohortBound:!0},"run.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Schuljahr",en:"School year"},cohortBound:!0},"run.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name des Schuljahrs",en:"School year name"},cohortBound:!0,nameLanguage:mp},"run.startDate":{valueSet:{kind:"open"},nullable:!0,absent:{de:"F\xFCr das Schuljahr ist kein Beginn erfasst.",en:"The school year has no start date."},label:{de:"Beginn des Schuljahrs",en:"School year start"},cohortBound:!0},"applicant.language":{valueSet:a_(Ge,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:a_(kw,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},hp={types:no,fields:ki},gp=na.flatMap(e=>Object.keys(no[e]).map(n=>`${e}.${n}`));function or(e){return Object.hasOwn(ki,e)}s(or,"isEnvLeaf");function yp(e){return`${eo}.${e}`}s(yp,"envIdentifier");function Bo(e){let n=ki[e],[t,r]=e.split("."),i=no[t][r];i===void 0&&M(`[env] leaf "${e}" has no type`);let o=n.valueSet;return{leaf:e,type:i,label:n.label,nullable:n.nullable,...n.absent===void 0?{}:{absent:n.absent},...n.nameLanguage===void 0?{}:{nameLanguage:n.nameLanguage},...n.cohortBound===void 0?{}:{cohortBound:n.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&M(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(Bo,"envLeaf");var l_="staffInput";var P2=["boolean"],Ql=/^[a-z][A-Za-z0-9]*$/;function wp(e){return e.staffInputs??[]}s(wp,"staffInputsOf");function kp(e){return`${l_}.${e}`}s(kp,"staffInputLeaf");function d_(e){return`${eo}.${kp(e)}`}s(d_,"staffInputIdentifier");function N2(e){let n=`${l_}.`;return e.startsWith(n)?e.slice(n.length):null}s(N2,"staffInputKeyOfLeaf");function ta(e,n){let t=N2(n);return t===null?void 0:wp(e).find(r=>r.key===t)}s(ta,"declaredStaffInput");function c_(e){return[...wp(e).map(n=>({leaf:kp(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...gp.map(n=>{let t=Bo(n);return{leaf:n,type:t.type,label:t.label,valueSet:ki[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(c_,"envLeavesFor");function u_(e){return c_(e).filter(n=>!n.cohortBound)}s(u_,"conditionEnvLeaves");function f_(e){return m_(u_(e))}s(f_,"envConditionSchemaFor");function D2(e){return c_(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(D2,"offerConditionEnvLeaves");function p_(e){return m_(D2(e))}s(p_,"offerConditionSchemaFor");function m_(e){let n={},t={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of e){let[l="",d=""]=r.split(".");n[l]={...n[l]??{},[d]:i},t[r]={valueSet:o,nullable:a}}return{types:n,fields:t}}s(m_,"schemaOfLeaves");function h_(e){let n=e.staffInputs;if(n===void 0)return[];if(!Array.isArray(n))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let t=[],r=new Set;return n.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){t.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};Ql.test(l.key)||t.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&t.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),P2.includes(l.type)||t.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=Mn(l.label);c==="not-localized"?t.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&t.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),t}s(h_,"staffInputIssues");function qn(e,n){if(e instanceof Re)return new Re(n(e.message),{cause:e});if(e instanceof g)return new g(n(e.message),{cause:e});let t=zr(e);if(t!==null&&(t.message.de!==""||t.message.en!=="")){let r=e.data,i=typeof r=="string"?n(r):{...r,message:{de:t.message.de===""?"":n(t.message.de),en:t.message.en===""?"":n(t.message.en)}},o=new Ln(i);return o.cause=e,o}return new Error(n(Fl(e)),{cause:e})}s(qn,"withContext");var Ow={required:!0,description:"Offer slug (its offerKey)"},bw=class extends P{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=E.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",Ow);testOnly=f.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let n=await this.caller(),t=await n.query(S.admission.listForAngebot,{client:this.requireTenant(n),offerKey:this.offer}),r=YO(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},vw=class extends P{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=E.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",Ow);async execute(){let n=await this.caller(),t=await n.query(S.admission.getCountsByListForAngebot,{client:this.requireTenant(n),offerKey:this.offer});return this.print(t,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},xw=class extends P{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=E.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=ne(this.application,"application"),r=await n.query(S.admission.get,{applicationId:t});if(r===null)throw new g(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(S.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},Sw=class extends P{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=E.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(S.processStoreView.get,{applicationId:ne(this.application,"application")});return this.print(JO(t),()=>QO(t),["address","state","holds","producer","written"]),0}},Aw=class extends P{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=E.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",Ow);run=f.String("--run",{required:!0,description:"School year: its bundle key as offer export shows it (program.runs[].key) or id \u2014 never its name"});stage=f.String("--stage",{required:!0,description:"Level: its bundle key as offer export shows it (program.stages[].key) or id \u2014 never its name"});party=f.String("--party",{description:"Applicant party id"});applicant=f.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=f.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=f.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=f.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let n=await this.caller();HO(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=WO(await n.query(S.admission.listAdmissionTree,{client:t}),this.offer,this.run,this.stage),i=this.party===void 0?void 0:ne(this.party,"party");if(this.applicant!==void 0){let d=await n.query(S.applicants.partyByEmail,{client:t,email:this.applicant});if(d===null)throw new g(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await n.mutation(S.admission.staffStartApplicationForParty,{client:t,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:y_(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:ne(this.version,"offer version")}}),a,l;try{let d=await n.query(S.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await pp(n,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw qn(d,c=>`applications start-test: started ${o.applicationId}, but reading its state failed: ${c}`)}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},Tw=class extends P{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=E.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new g("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new g("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(S.admission.discardTest,{applicationId:ne(this.application,"application")}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new g("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new g("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new g("applications discard-test: --dry-run and --confirm exclude each other");let n=F2(this.olderThan),t=await this.caller(),r=this.requireTenant(t),i=[],o=null;for(;;){let c=await t.query(S.admission.testTtlPlan,{client:r,olderThanDays:n,cursor:o});if(i.push(...c.rows),c.isDone)break;o=c.continueCursor}let a=i.map(c=>({...c,result:c.verdict!=="expired"?"kept":c.block!==null?"blocked":this.confirm?"pending":"would discard"})),l=i.filter(c=>c.verdict==="expired"&&c.protectedDemo).map(c=>c.applicationId);if(this.confirm&&l.length>0)throw new g(`applications discard-test --all-test: protected demo application(s) in the discard set, nothing discarded: ${l.join(", ")}`);let d=0;if(this.confirm)for(let c of a.filter(u=>u.result==="pending"))try{await t.mutation(S.admission.discardExpiredTest,{applicationId:c.applicationId,olderThanDays:n}),c.result="discarded"}catch(u){d++,c.result=`failed: ${u instanceof Error?u.message:String(u)}`}return this.print({olderThanDays:n,confirm:this.confirm,rows:a},c=>c.rows.map(u=>({id:u.applicationId,lastActivity:new Date(u.lastActivityAt).toISOString().slice(0,10),verdict:u.verdict,block:u.block??"",result:u.result})),["id","lastActivity","verdict","block","result"]),d>0?1:0}};function F2(e){let n=/^(\d+)d$/.exec(e.trim());if(n===null)throw new g(`--older-than "${e}": expected <N>d, e.g. 14d`);return Number(n[1])}s(F2,"parseDays");var Rw=class extends P{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=E.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(S.admission.setKeepAsDemo,{applicationId:ne(this.application,"application"),keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},$w=class extends P{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=E.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(S.admission.staffInputsOfApplication,{applicationId:ne(this.application,"application")});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},Ew=class extends P{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=E.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=y_([this.input]);return await n.mutation(S.admission.correctStaffInput,{applicationId:ne(this.application,"application"),key:t,value:r,reason:this.reason}),this.print({application:this.application,key:t,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},Iw=class extends P{static{s(this,"ApplicationsPurgeCommand")}static paths=[["platform","applications","purge"]];static usage=E.Usage({category:"Admission",description:"Hard-delete one real application staff started for a colleague and already deleted (plan unless --confirm). Needs _platform.config.manage.",details:"Refused unless all hold: a real application (a test one goes with `applications discard-test`), soft-deleted by staff, started by staff, its applicant an internal staff member of the school (also a switched-off one) whose person existed before, no data about anyone else (only empty drafts the form opened), nothing committed yet, and no contract, signing process, payment or Engage push. Deletes the application and every row it created; the staff member's person stays. Afterwards the responsible person can be deactivated.",examples:[["Plan","plexus-cli --env prod --tenant <slug> platform applications purge <applicationId>"],["Apply","plexus-cli --env prod --tenant <slug> --allow-prod platform applications purge <applicationId> --confirm"]]});application=f.String({required:!0});confirm=f.Boolean("--confirm",!1,{description:"Delete for good (without it, only the checks run)."});async execute(){let n=await this.caller(),t=await n.mutation(S.admission.purgeDeletedStaffApplication,{tenantSlug:this.requireTenant(n),applicationId:ne(this.application,"application"),dryRun:!this.confirm});if(this.json)return this.print(t),0;let r=this.context.stdout;return r.write(`${t.applied?"Deleted":"Would delete"} application ${t.applicationId} `),r.write(`(applicant ${t.applicantPartyId}, soft-deleted ${new Date(t.deletedAt).toISOString()})
|
|
11399
|
+
`,"references/worker-ops/set-import-default-unit.md":"# Set the default unit of an import source\n\n**When to use:** a unit that an import source uses as its default unit has to\ngo, or imported records should attach to another unit by default.\n`org unit delete` refuses the default unit of an import source\n(`[unit/importSourceDefault]`). Point the source at another unit first.\n\n## Prerequisites\n- **Auth:** a platform operator's token with `_platform.config.manage`. A\n school's own token is refused, because the import source belongs to the operator.\n- **Env:** a writing run needs `--env <local|staging|prod>` on the command line,\n and `--allow-prod` against production.\n- You need the source key (`imports status --tenant <slug>`, column `config`)\n and the new unit's config key (`org tree`, column `key`).\n\n## Steps\n\n```bash\n# Plan: shows the current default and the new one, and writes nothing\nplexus-cli --env prod --allow-prod platform imports source set-default-unit <source> --unit <unit-key>\n# Write\nplexus-cli --env prod --allow-prod platform imports source set-default-unit <source> --unit <unit-key> --confirm\n```\n\n## Verify\nRun the plan again. It reports `unchanged`, with the new unit as the default.\n\n## Idempotency / gotchas\n- The unit must be one the source already knows by key (every unit of the\n tenant at the time the source was set up). Otherwise the command refuses with\n `[import-source/unitUnknown]` and lists the keys the source knows.\n- Deleting any other unit removes it from the source's key list automatically.\n Only the default unit blocks a delete.\n- The tenant config names the default unit by key: `source.defaultUnitKey`\n (the order of `foundation.units` means nothing). `config export` writes the\n current default there, so an apply from a fresh export keeps it. **An apply\n from an export taken before this change names the old default and sets it\n back**; its plan shows an update on `source`. Export again after setting the\n default, or set `source.defaultUnitKey` in the scratch export by hand.\n- `config apply` refuses a source without `defaultUnitKey`\n (`[import/defaultUnitMissing]`) or with a key that is not in\n `foundation.units` (`[import/defaultUnitUnknown]`). There is no fallback to\n the first unit. An export taken before this change carries no key: add it before\n the apply.\n\n## Related\n- [Edit a school's organisation structure](../organization/edit-org-structure.md)\n- [Debug a stuck/failed import or worker job](./debug-worker-jobs.md)\n"};var rp="a1b0054edc4e8c09b7b08cbaa4e3d32fb61c274cfbb089b872fae7237a1d41e7",lw=MO;var k2=new Set(["ENOENT","ENOTDIR","EISDIR","EACCES","EPERM"]);function b2(e){return typeof e=="object"&&e!==null&&"code"in e?e.code:void 0}s(b2,"codeOf");function qO(e){return e instanceof Error?e.message:String(e)}s(qO,"messageOf");function dw(e,n){try{return Ce(e)}catch(t){throw k2.has(b2(t))?new g(`${n}: ${e} is not readable (${qO(t)})`,{cause:t}):t}}s(dw,"readBytesFile");function cw(e,n){return dw(e,n).toString("utf8")}s(cw,"readTextFile");function Zr(e,n){try{return JSON.parse(e)}catch(t){throw new g(`${n} is no JSON (${qO(t)})`,{cause:t})}}s(Zr,"parseJsonText");function Be(e,n){return Zr(cw(e,n),`${n}: ${e}`)}s(Be,"readJsonFile");var uw=class extends Se{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=E.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:rp,tools:Hl}),0}},fw=class extends Se{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=E.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new g("plexus: pipe the tool's JSON input on stdin.");let n=Zr(await aw(this.context.stdin),"stdin"),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},KO=[uw,fw];var pw=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],dfe=new Set(pw.map(e=>e.key));var Ge=["de","en"];function Zs(e,n){return Ge.every(t=>e[t]===n[t])}s(Zs,"sameText");function Mn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!Ge.includes(r))?"not-localized":Ge.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Mn,"missingLocales");function Zi(e){let n=Mn(e);return n!=="not-localized"&&n.length===0}s(Zi,"isLocalizedText");function Jl(e,n){let t={};for(let r of Ge){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(Jl,"composeTexts");function ip(e){return e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}s(ip,"slugify");var jO="tenant";function VO(e){if(e.length===0||ip(e)!==e)return"must be lowercase a-z/0-9 words joined by single dashes";if(e===jO)return`"${jO}" is reserved for the tenant-wide scope`}s(VO,"unitSlugError");var v2=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function ir(e,n){return`${e}-${n}`}s(ir,"runStorageKey");function BO(e,n){typeof n!="string"&&de("CONFLICT",{de:`[run/keyNotServed] Das Deployment liefert f\xFCr ein Schuljahr von \u201E${e}\u201C keinen Schl\xFCssel \u2014 es l\xE4uft ein \xE4lteres Release als die CLI. Nach dem n\xE4chsten Release erneut versuchen.`,en:`[run/keyNotServed] The deployment provides no key for a school year of "${e}" \u2014 it runs an older release than the CLI. Try again after the next release.`});let t=`${e}-`;return(!n.startsWith(t)||n.length===t.length)&&de("CONFLICT",{de:`[run/foreignKey] Der Schl\xFCssel \u201E${n}\u201C des Schuljahrs liegt nicht unter dem Programm \u201E${e}\u201C (erwartet: \u201E${t}<key>\u201C).`,en:`[run/foreignKey] The key "${n}" of the school year is not under the program "${e}" (expected: "${t}<key>").`}),n.slice(t.length)}s(BO,"bareRunKey");function op(e){let n=[],t=new Map;return e.forEach((r,i)=>{let o=Mn(r.name),a=o!=="not-localized"&&!o.includes("de")?r.name.de:void 0,l=`program.runs[${i}]${a!==void 0?` ("${a}")`:""}`;o==="not-localized"||o.length===2?n.push({code:"run/nameMissing",index:i,message:{de:`[run/nameMissing] ${l}: jedes Schuljahr braucht einen \`name\` auf Deutsch und Englisch (\`{ de, en }\`)`,en:`[run/nameMissing] ${l}: every run needs a \`name\` in German and English (\`{ de, en }\`)`}}):o.length>0&&n.push({code:"run/nameUntranslated",index:i,message:{de:`[i18n/missingTranslation] ${l}.name fehlt in: ${o.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${l}.name is missing in: ${o.join(", ")} \u2014 every displayed text needs German and English.`}});let d=r.key;if(d==null||d===""){n.push({code:"run/keyMissing",index:i,message:{de:`[run/keyMissing] ${l}: jedes Schuljahr braucht einen stabilen \`key\` \u2014 der Name dient nur der Anzeige`,en:`[run/keyMissing] ${l}: every run needs a stable \`key\` \u2014 the name is display only`}});return}if(typeof d!="string"||!v2.test(d)){n.push({code:"run/keyInvalid",index:i,message:{de:`[run/keyInvalid] ${l}: der Schl\xFCssel ${JSON.stringify(d)} muss ein kleingeschriebener Slug sein (a-z, 0-9, einzelnes \u201E-\u201C)`,en:`[run/keyInvalid] ${l}: key ${JSON.stringify(d)} must be a lowercase slug string (a-z, 0-9, single "-")`}});return}let c=t.get(d);if(c!==void 0){n.push({code:"run/duplicateKey",index:i,message:{de:`[run/duplicateKey] ${l}: der Schl\xFCssel \u201E${d}\u201C wird bereits von program.runs[${c}] verwendet`,en:`[run/duplicateKey] ${l}: key "${d}" is already used by program.runs[${c}]`}});return}t.set(d,i)}),n}s(op,"runSpecIssues");var x2="-stufe-",S2=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function mw(e){return`${e}${x2}`}s(mw,"stageKeyPrefix");function Xs(e,n){return`${mw(e)}${n}`}s(Xs,"stageStorageKey");function GO(e,n){let t=mw(e);return n.startsWith(t)&&n.length>t.length}s(GO,"isUnderProgram");function Xr(e,n){let t=mw(e);return GO(e,n)||de("CONFLICT",{de:`[stage/foreignKey] Der Stufenschl\xFCssel \u201E${n}\u201C liegt nicht unter dem Programm \u201E${e}\u201C (erwartet: \u201E${t}<key>\u201C). F\xFChren Sie die Stufe in bundle.yaml unter einem neuen Schl\xFCssel auf; der n\xE4chste Apply archiviert diese Zeile (hinter der Archivsperre) und legt die Stufe mit dem neuen Schl\xFCssel an.`,en:`[stage/foreignKey] The level key "${n}" is not under the program "${e}" (expected: "${t}<key>"). List the level in bundle.yaml under a new key; the next apply archives this row (behind the archive lock) and creates the level with the new key.`}),n.slice(t.length)}s(Xr,"bareStageKey");function sp(e){let n=[],t=new Map;return e.forEach((r,i)=>{let o=Mn(r.name),a=o!=="not-localized"&&!o.includes("de")?r.name.de:void 0,l=`program.stages[${i}]${a!==void 0?` ("${a}")`:""}`;o==="not-localized"||o.length===2?n.push({code:"stage/nameMissing",index:i,message:{de:`[stage/nameMissing] ${l}: jede Klassenstufe braucht einen \`name\` auf Deutsch und Englisch (\`{ de, en }\`)`,en:`[stage/nameMissing] ${l}: every stage needs a \`name\` in German and English (\`{ de, en }\`)`}}):o.length>0&&n.push({code:"stage/nameUntranslated",index:i,message:{de:`[i18n/missingTranslation] ${l}.name fehlt in: ${o.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${l}.name is missing in: ${o.join(", ")} \u2014 every displayed text needs German and English.`}});let d=r.key;if(d==null||d===""){n.push({code:"stage/keyMissing",index:i,message:{de:`[stage/keyMissing] ${l}: jede Klassenstufe braucht einen stabilen \`key\` \u2014 der Name dient nur der Anzeige`,en:`[stage/keyMissing] ${l}: every stage needs a stable \`key\` \u2014 the name is display only`}});return}if(typeof d!="string"||!S2.test(d)){n.push({code:"stage/keyInvalid",index:i,message:{de:`[stage/keyInvalid] ${l}: der Schl\xFCssel ${JSON.stringify(d)} muss ein kleingeschriebener Slug sein (a-z, 0-9, einzelnes \u201E-\u201C)`,en:`[stage/keyInvalid] ${l}: key ${JSON.stringify(d)} must be a lowercase slug string (a-z, 0-9, single "-")`}});return}let c=t.get(d);if(c!==void 0){n.push({code:"stage/duplicateKey",index:i,message:{de:`[stage/duplicateKey] ${l}: der Schl\xFCssel \u201E${d}\u201C wird bereits von program.stages[${c}] verwendet`,en:`[stage/duplicateKey] ${l}: key "${d}" is already used by program.stages[${c}]`}});return}t.set(d,i)}),n}s(sp,"stageSpecIssues");function UO(e){return{de:e.de.trim(),en:e.en.trim()}}s(UO,"trimmedText");function A2(e,n){let t=[];return e.de!==n.de&&t.push(`"${e.de}" \u2192 "${n.de}"`),e.en!==n.en&&t.push(`en "${e.en}" \u2192 "${n.en}"`),t.join(", ")}s(A2,"describeNameChange");function ap(e,n,t){if(e===null)return n.length>0&&M("planStageReconcile: stages exist but the offer has no program key"),t.map((a,l)=>({op:"insert",key:a.key,name:UO(a.name),...a.gradeLevel!==void 0?{gradeLevel:a.gradeLevel}:{},sequence:l+1}));let r=new Map(n.map(a=>[a.key,a])),i=new Set,o=[];t.forEach(({name:a,...l},d)=>{let c={...l,name:UO(a)},u=Xs(e,c.key);i.add(u);let p=d+1,h=r.get(u);if(h===void 0){o.push({op:"insert",key:c.key,name:c.name,...c.gradeLevel!==void 0?{gradeLevel:c.gradeLevel}:{},sequence:p});return}let y={};Zs(h.name,c.name)||(y.name=[h.name,c.name]);let b=h.gradeLevel??null,k=c.gradeLevel??null;b!==k&&(y.gradeLevel=[b,k]),h.sequence!==p&&(y.sequence=[h.sequence,p]),(Object.keys(y).length>0||h.archived)&&o.push({op:"update",key:c.key,stageId:h.stageId,name:c.name,changes:y,unarchive:h.archived})});for(let a of[...n].sort((l,d)=>l.sequence-d.sequence))a.archived||i.has(a.key)||o.push({op:"archive",key:GO(e,a.key)?Xr(e,a.key):a.key,stageId:a.stageId,name:a.name});return o}s(ap,"planStageReconcile");function lp(e){switch(e.op){case"insert":return`+stage ${e.key} (${e.name.de})`;case"archive":{let n=e.occupancy,t=[...n&&n.activeApplications>0?[`REFUSED: ${n.activeApplications} active application(s) \u2014 [stage/hasActiveApplications]`]:[],...n&&n.openLeads>0?[`${n.openLeads} open lead(s)`]:[]];return`-stage ${e.key} (${e.name.de})${t.length>0?` \u2014 ${t.join("; ")}`:""}`}case"update":{let n=[];if(e.unarchive&&n.push("restored"),e.changes.name&&n.push(A2(e.changes.name[0],e.changes.name[1])),e.changes.gradeLevel){let[t,r]=e.changes.gradeLevel;n.push(`grade ${t??"\u2013"} \u2192 ${r??"\u2013"}`)}return e.changes.sequence&&n.push(`position ${e.changes.sequence[0]} \u2192 ${e.changes.sequence[1]}`),`~stage ${e.key} (${n.join(", ")})`}}}s(lp,"describeStageStep");function dp(e,n){return n.startsWith(e)&&n.length>e.length?n.slice(e.length):void 0}s(dp,"bareUnder");function WO(e,n,t,r){let i=e.flatMap(y=>y.angebote).find(y=>y.offerKey===n);if(i===void 0){let y=e.flatMap(b=>b.angebote.map(k=>k.offerKey));throw new g(`applications start-test: no offer "${n}" (offers: ${y.join(", ")||"none"})`)}if(i.programKey===void 0)throw new g("applications start-test: the deployment does not serve the offer's program key \u2014 it runs an older release than the CLI; try again after the next release");let o=i.programKey;if(o===null)throw new g(`applications start-test: ${n} has no program yet \u2014 no level to start on`);let a=Xs(o,""),l=ir(o,""),d=s(y=>dp(a,y)??"(no bundle key)","stageLabel"),c=s(y=>dp(l,y)??"(no bundle key)","runLabel"),u=i.stages.find(y=>y.stageKey===Xs(o,r)||y.stageId===r);if(u===void 0){let y=i.stages.map(v=>`${d(v.stageKey)} (${v.stageId})`).join(", "),b=dp(a,r),k=b!==void 0&&i.stages.some(v=>v.stageKey===r)?` \u2014 "${r}" is the stored key; the export names it "${b}"`:"";throw new g(`applications start-test: no level "${r}" in ${n}${k} \u2014 name it by its bundle key or id: ${y}`)}let p=d(u.stageKey),h=u.runs.find(y=>y.runKey===ir(o,t)||y.runId===t);if(h===void 0){let y=u.runs.map(v=>`${c(v.runKey)} (${v.runId})`).join(", "),b=dp(l,t),k=b!==void 0&&u.runs.some(v=>v.runKey===t)?` \u2014 "${t}" is the stored key; the export names it "${b}"`:"";throw new g(`applications start-test: no school year "${t}" for level ${p}${k} \u2014 name it by its bundle key or id: ${y}`)}if(!h.isOpen)throw new g(`applications start-test: school year ${c(h.runKey)} is closed for level ${p}`);return{programRunId:h.runId,programStageId:u.stageId}}s(WO,"resolveStartTarget");function T2(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(T2,"applicantText");function YO(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:T2(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(YO,"applicationRows");var zO=pw.map(e=>e.email);function HO(e,n,t,r){if(t===void 0&&r===void 0)throw new g("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(t!==void 0&&r!==void 0)throw new g("applications start-test: --party or --applicant, not both");if(iw(e,n)&&(r===void 0||!zO.includes(r.trim().toLowerCase())))throw new g(`applications start-test: on prod only for the test account ${zO.join(", ")} (--applicant) \u2014 never a real family's`)}s(HO,"assertStartApplicant");function JO(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(JO,"processStoreJson");function R2(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.snapshotNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.snapshotNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(R2,"refText");function $2(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?R2(e.ref):JSON.stringify(e.value)}s($2,"holds");function QO(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:$2(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(QO,"storeRows");function cp(e){let n={},t={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new g(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(t,o))throw new g(`'${o}' is given twice.`);let a=r.slice(i+1);t[o]=a;try{n[o]=JSON.parse(a)}catch{n[o]=a}}return{values:n,raw:t}}s(cp,"parseKv");var hw="started",up="submitted",fp="submitted",ZO="load-scenario:";var XO="(Bewerbung)";function e_(e){return{nodeId:XO,actions:e.map(n=>({id:n.id,label:{de:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`,en:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`},...n.disabledReason===void 0?{}:{disabledReason:n.disabledReason}}))}}s(e_,"sharedAsList");function n_(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(n_,"disabledText");function t_(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:n_(r)})))}s(t_,"actionRows");function r_(e,n,t=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===n));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new g(`test-actions run: no current node offers "${n}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new g(`test-actions run: "${n}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===n);if(a.disabledReason!==void 0)throw new g(`test-actions run: "${n}" on ${i} is disabled: ${n_(a)}`);if(i!==XO)return i;let l=t[0];if(l===void 0)throw new g(`test-actions run: "${n}" needs a current node \u2014 the application has none`);return l}s(r_,"nodeOfferingAction");function i_(e,n,t){if(e.startsWith(ZO)){if(Object.hasOwn(t,"autoSubmit"))throw new g(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:n,...t}}return Object.keys(t).length===0?void 0:{...t}}s(i_,"runParams");var E2=/^[0-9a-hjkmnp-tv-z]{31,37}$/;function ne(e,n){if(!E2.test(e))throw new g(`"${e}" is not a ${n} id \u2014 a Convex id is 31\u201337 characters of 0-9 and a-z without i, l, o, u.`);return e}s(ne,"parseDocumentId");async function I2(e,n){let t=await e.query(S.workflow.getInstance,{applicationId:n});if(t===null)throw new g(`test-actions: application ${n} has no workflow instance`);return t.instance.currentNodeIds}s(I2,"currentNodeIds");function O2(e,n){switch(n){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${n} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(O2,"refusalText");async function pp(e,n,t){let r=await e.query(S.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new g(`test-actions: not permitted \u2014 ${O2(n,r.reason)}`);let i=[];for(let o of t){let a=await e.query(S.workflow.listTestActions,{applicationId:n,nodeId:o});if(a===null)throw new g(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,e_(r.actions)]}s(pp,"actionsOf");async function o_(e,n,t){return t!==void 0?[t]:await I2(e,n)}s(o_,"nodesOf");var gw=class extends P{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=E.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=ne(this.application,"application"),t=await this.caller(),r=await pp(t,n,await o_(t,n,this.node));return this.print(r,t_,["node","action","label","disabled"]),0}},yw=class extends P{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=E.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=i_(this.action,this.autoSubmit,cp(this.param??[]).values),t=ne(this.application,"application"),r=await this.caller(),i=await o_(r,t,this.node),o=r_(await pp(r,t,i),this.action,i);return await r.mutation(S.workflow.runTestAction,{applicationId:t,nodeId:o,actionId:this.action,...n===void 0?{}:{params:n}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},s_=[gw,yw];var Rr=/^[a-z][A-Za-z0-9]*$/;function ww(e){return typeof e=="string"&&Rr.test(e)}s(ww,"isNodeId");function ea(e,n){ww(e)||M(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${Rr.source}.`);let t=new Set(n);if(!t.has(e))return e;let r=2;for(;t.has(`${e}${r}`);)r++;return`${e}${r}`}s(ea,"makeNodeId");var eo="$env";function ue(e){if(e.scope==="env")return`${eo}.${e.key}`;let n=`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(ue,"formatAddress");var Xi=/^[a-z][a-zA-Z0-9_]*$/,_2=/^[A-Za-z_][A-Za-z0-9_]*$/;function Vo(e){return typeof e=="string"&&e.split(".").every(n=>_2.test(n))}s(Vo,"isPath");function wi(e){if(!e.startsWith("$"))return null;let n=e.slice(1).split("."),[t,...r]=n;switch(t){case"env":{let i=r.join(".");return r.length>0&&Vo(i)?{scope:"env",key:i}:null}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Xi.test(o)||(t==="node"?!Rr.test(i):!Xi.test(i))?null:C2({scope:t,owner:i,key:o},a)}default:return null}}s(wi,"tryParseAddress");function C2(e,n){if(n.length===0)return e;let t=n.join(".");return Vo(t)?{...e,path:t}:null}s(C2,"withPath");function ke(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!Vo(n.path))return!1;switch(n.scope){case"env":return Vo(n.key);case"node":return typeof n.owner=="string"&&Rr.test(n.owner)&&typeof n.key=="string"&&Xi.test(n.key);case"task":return typeof n.owner=="string"&&Xi.test(n.owner)&&typeof n.key=="string"&&Xi.test(n.key);default:return!1}}s(ke,"isAddress");var no={offer:{key:"string",title:"string"},unit:{key:"string",name:"string"},stage:{key:"string",name:"string",gradeLevel:"number"},run:{key:"string",name:"string",startDate:"date"},applicant:{language:"enum",channel:"enum"}},na=Object.keys(no);function to(e){return Object.hasOwn(no,e)}s(to,"isEnvKey");var kw=["self-service","staff"];function a_(e,n){return{kind:"fixed",values:e,labels:n}}s(a_,"fixedSet");var mp={of:"applicant.language",withoutValue:"de"},ki={"offer.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Angebot",en:"Offer"}},"offer.title":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Titel des Angebots",en:"Offer title"},nameLanguage:mp},"unit.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Einheit",en:"Unit"}},"unit.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Einheit",en:"Unit name"},nameLanguage:mp},"stage.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Klassenstufe (Schl\xFCssel)",en:"Grade (key)"},cohortBound:!0},"stage.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Klassenstufe",en:"Grade name"},cohortBound:!0,nameLanguage:mp},"stage.gradeLevel":{valueSet:{kind:"open"},nullable:!0,absent:{de:"Die Stufe hat keine Klassenstufe (Kindergarten).",en:"The stage has no grade level (Kindergarten)."},label:{de:"Klassenstufe",en:"Grade level"},cohortBound:!0},"run.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Schuljahr",en:"School year"},cohortBound:!0},"run.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name des Schuljahrs",en:"School year name"},cohortBound:!0,nameLanguage:mp},"run.startDate":{valueSet:{kind:"open"},nullable:!0,absent:{de:"F\xFCr das Schuljahr ist kein Beginn erfasst.",en:"The school year has no start date."},label:{de:"Beginn des Schuljahrs",en:"School year start"},cohortBound:!0},"applicant.language":{valueSet:a_(Ge,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:a_(kw,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},hp={types:no,fields:ki},gp=na.flatMap(e=>Object.keys(no[e]).map(n=>`${e}.${n}`));function or(e){return Object.hasOwn(ki,e)}s(or,"isEnvLeaf");function yp(e){return`${eo}.${e}`}s(yp,"envIdentifier");function Bo(e){let n=ki[e],[t,r]=e.split("."),i=no[t][r];i===void 0&&M(`[env] leaf "${e}" has no type`);let o=n.valueSet;return{leaf:e,type:i,label:n.label,nullable:n.nullable,...n.absent===void 0?{}:{absent:n.absent},...n.nameLanguage===void 0?{}:{nameLanguage:n.nameLanguage},...n.cohortBound===void 0?{}:{cohortBound:n.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&M(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(Bo,"envLeaf");var l_="staffInput";var P2=["boolean"],Ql=/^[a-z][A-Za-z0-9]*$/;function wp(e){return e.staffInputs??[]}s(wp,"staffInputsOf");function kp(e){return`${l_}.${e}`}s(kp,"staffInputLeaf");function d_(e){return`${eo}.${kp(e)}`}s(d_,"staffInputIdentifier");function N2(e){let n=`${l_}.`;return e.startsWith(n)?e.slice(n.length):null}s(N2,"staffInputKeyOfLeaf");function ta(e,n){let t=N2(n);return t===null?void 0:wp(e).find(r=>r.key===t)}s(ta,"declaredStaffInput");function c_(e){return[...wp(e).map(n=>({leaf:kp(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...gp.map(n=>{let t=Bo(n);return{leaf:n,type:t.type,label:t.label,valueSet:ki[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(c_,"envLeavesFor");function u_(e){return c_(e).filter(n=>!n.cohortBound)}s(u_,"conditionEnvLeaves");function f_(e){return m_(u_(e))}s(f_,"envConditionSchemaFor");function D2(e){return c_(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(D2,"offerConditionEnvLeaves");function p_(e){return m_(D2(e))}s(p_,"offerConditionSchemaFor");function m_(e){let n={},t={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of e){let[l="",d=""]=r.split(".");n[l]={...n[l]??{},[d]:i},t[r]={valueSet:o,nullable:a}}return{types:n,fields:t}}s(m_,"schemaOfLeaves");function h_(e){let n=e.staffInputs;if(n===void 0)return[];if(!Array.isArray(n))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let t=[],r=new Set;return n.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){t.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};Ql.test(l.key)||t.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&t.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),P2.includes(l.type)||t.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=Mn(l.label);c==="not-localized"?t.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&t.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),t}s(h_,"staffInputIssues");function qn(e,n){if(e instanceof Re)return new Re(n(e.message),{cause:e});if(e instanceof g)return new g(n(e.message),{cause:e});let t=zr(e);if(t!==null&&(t.message.de!==""||t.message.en!=="")){let r=e.data,i=typeof r=="string"?n(r):{...r,message:{de:t.message.de===""?"":n(t.message.de),en:t.message.en===""?"":n(t.message.en)}},o=new Ln(i);return o.cause=e,o}return new Error(n(Fl(e)),{cause:e})}s(qn,"withContext");var Ow={required:!0,description:"Offer slug (its offerKey)"},bw=class extends P{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=E.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",Ow);testOnly=f.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let n=await this.caller(),t=await n.query(S.admission.listForAngebot,{client:this.requireTenant(n),offerKey:this.offer}),r=YO(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},vw=class extends P{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=E.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",Ow);async execute(){let n=await this.caller(),t=await n.query(S.admission.getCountsByListForAngebot,{client:this.requireTenant(n),offerKey:this.offer});return this.print(t,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},xw=class extends P{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=E.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=ne(this.application,"application"),r=await n.query(S.admission.get,{applicationId:t});if(r===null)throw new g(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(S.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},Sw=class extends P{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=E.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(S.processStoreView.get,{applicationId:ne(this.application,"application")});return this.print(JO(t),()=>QO(t),["address","state","holds","producer","written"]),0}},Aw=class extends P{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=E.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",Ow);run=f.String("--run",{required:!0,description:"School year: its bundle key as offer export shows it (program.runs[].key) or id \u2014 never its name"});stage=f.String("--stage",{required:!0,description:"Level: its bundle key as offer export shows it (program.stages[].key) or id \u2014 never its name"});party=f.String("--party",{description:"Applicant party id"});applicant=f.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=f.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=f.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=f.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let n=await this.caller();HO(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=WO(await n.query(S.admission.listAdmissionTree,{client:t}),this.offer,this.run,this.stage),i=this.party===void 0?void 0:ne(this.party,"party");if(this.applicant!==void 0){let d=await n.query(S.applicants.partyByEmail,{client:t,email:this.applicant});if(d===null)throw new g(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await n.mutation(S.admission.staffStartApplicationForParty,{client:t,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:y_(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:ne(this.version,"offer version")}}),a,l;try{let d=await n.query(S.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await pp(n,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw qn(d,c=>`applications start-test: started ${o.applicationId}, but reading its state failed: ${c}`)}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},Tw=class extends P{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=E.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new g("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new g("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(S.admission.discardTest,{applicationId:ne(this.application,"application")}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new g("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new g("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new g("applications discard-test: --dry-run and --confirm exclude each other");let n=F2(this.olderThan),t=await this.caller(),r=this.requireTenant(t),i=[],o=null;for(;;){let c=await t.query(S.admission.testTtlPlan,{client:r,olderThanDays:n,cursor:o});if(i.push(...c.rows),c.isDone)break;o=c.continueCursor}let a=i.map(c=>({...c,result:c.verdict!=="expired"?"kept":c.block!==null?"blocked":this.confirm?"pending":"would discard"})),l=i.filter(c=>c.verdict==="expired"&&c.protectedDemo).map(c=>c.applicationId);if(this.confirm&&l.length>0)throw new g(`applications discard-test --all-test: protected demo application(s) in the discard set, nothing discarded: ${l.join(", ")}`);let d=0;if(this.confirm)for(let c of a.filter(u=>u.result==="pending"))try{await t.mutation(S.admission.discardExpiredTest,{applicationId:c.applicationId,olderThanDays:n}),c.result="discarded"}catch(u){d++,c.result=`failed: ${u instanceof Error?u.message:String(u)}`}return this.print({olderThanDays:n,confirm:this.confirm,rows:a},c=>c.rows.map(u=>({id:u.applicationId,lastActivity:new Date(u.lastActivityAt).toISOString().slice(0,10),verdict:u.verdict,block:u.block??"",result:u.result})),["id","lastActivity","verdict","block","result"]),d>0?1:0}};function F2(e){let n=/^(\d+)d$/.exec(e.trim());if(n===null)throw new g(`--older-than "${e}": expected <N>d, e.g. 14d`);return Number(n[1])}s(F2,"parseDays");var Rw=class extends P{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=E.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(S.admission.setKeepAsDemo,{applicationId:ne(this.application,"application"),keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},$w=class extends P{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=E.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(S.admission.staffInputsOfApplication,{applicationId:ne(this.application,"application")});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},Ew=class extends P{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=E.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=y_([this.input]);return await n.mutation(S.admission.correctStaffInput,{applicationId:ne(this.application,"application"),key:t,value:r,reason:this.reason}),this.print({application:this.application,key:t,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},Iw=class extends P{static{s(this,"ApplicationsPurgeCommand")}static paths=[["platform","applications","purge"]];static usage=E.Usage({category:"Admission",description:"Hard-delete one real application staff started for a colleague and already deleted (plan unless --confirm). Needs _platform.config.manage.",details:"Refused unless all hold: a real application (a test one goes with `applications discard-test`), soft-deleted by staff, started by staff, its applicant an internal staff member of the school (also a switched-off one) whose person existed before, no data about anyone else (only empty drafts the form opened), nothing committed yet, and no contract, signing process, payment or Engage push. Deletes the application and every row it created; the staff member's person stays. Afterwards the responsible person can be deactivated.",examples:[["Plan","plexus-cli --env prod --tenant <slug> platform applications purge <applicationId>"],["Apply","plexus-cli --env prod --tenant <slug> --allow-prod platform applications purge <applicationId> --confirm"]]});application=f.String({required:!0});confirm=f.Boolean("--confirm",!1,{description:"Delete for good (without it, only the checks run)."});async execute(){let n=await this.caller(),t=await n.mutation(S.admission.purgeDeletedStaffApplication,{tenantSlug:this.requireTenant(n),applicationId:ne(this.application,"application"),dryRun:!this.confirm});if(this.json)return this.print(t),0;let r=this.context.stdout;return r.write(`${t.applied?"Deleted":"Would delete"} application ${t.applicationId} `),r.write(`(applicant ${t.applicantPartyId}, soft-deleted ${new Date(t.deletedAt).toISOString()})
|
|
11400
11400
|
`),t.applied?(r.write(`Rows deleted: ${t.deleted}${t.continuing?" so far \u2014 the purge goes on in scheduled steps":""}
|
|
11401
11401
|
`),0):(r.write(`Dry run \u2014 every check passed; re-run with --confirm to delete.
|
|
11402
11402
|
`),0)}},g_=[bw,vw,xw,Sw,Aw,Tw,Iw,Rw,$w,Ew];function y_(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!Ql.test(t)||r!=="true"&&r!=="false"||i.length>0)throw new g(`--staff-input "${n}": expected key=true or key=false`);return{key:t,value:r==="true"}})}s(y_,"parseStaffInputs");var et="contractGenerator",Uo="documentTemplate";function Zl(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=Object.keys(n);return(n.kind==="generator"||n.kind==="package")&&typeof n.key=="string"&&n.key.length>0&&(n.revision===void 0||typeof n.revision=="number"&&Number.isInteger(n.revision)&&n.revision>0)&&t.every(r=>r==="kind"||r==="key"||r==="revision")}s(Zl,"isGeneratorRef");function w_(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(w_,"literalOf");function bi(e){let n=w_(e,et);return Zl(n)?n:null}s(bi,"generatorRefOfNode");function $r(e){let n=w_(e,Uo);return typeof n=="string"&&n.length>0?n:null}s($r,"documentTemplateKeyOfNode");function k_(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(k_,"generatorRefLabel");var L2=["formExports","generatorStamp"];function b_(e,n,t){let r=e.inputs?.[et];(r?.kind!=="literal"||!Zl(r.value))&&M(`applyGeneratorStamp: the node names no generator in inputs.${et} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[et]={kind:"literal",value:{...r.value,revision:n.revision}}),e.generatorStamp={inputSchema:n.inputSchema,parties:n.parties,schemaDigest:n.schemaDigest,...n.parts===void 0?{}:{parts:n.parts},...n.coverLetter===void 0?{}:{coverLetter:n.coverLetter}}}s(b_,"applyGeneratorStamp");var M2=["reads"];function ra(e){if(e===null||typeof e!="object")return e;let n={...e};return Array.isArray(n.nodes)&&(n.nodes=n.nodes.map(t=>{if(t===null||typeof t!="object")return t;let r={...t};for(let i of L2)delete r[i];for(let i of M2)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),n}s(ra,"comparableWorkflowGraph");var Xl={id:{de:"die Identit\xE4t ist der Slug des Angebots (bundle.yaml slugs.manifest)",en:"the identity is the offer's slug (bundle.yaml slugs.manifest)"},label:{de:"der Titel steht in bundle.yaml `label`",en:"the title is bundle.yaml `label`"},version:{de:"die Revision z\xE4hlt die Datenbank",en:"the database counts the revision"},applicantMode:{de:"von nichts gelesen",en:"read by nothing"},signatureLevel:{de:"von nichts gelesen",en:"read by nothing"},roleInstances:{de:"die Rollen kommen aus den Formular-Effekten",en:"roles come from the form effects"},leistungen:{de:"von nichts gelesen",en:"read by nothing"},capacity:{de:"die Kapazit\xE4t geh\xF6rt der Kohorte (program.runs[].capacities)",en:"capacity belongs to the cohort (program.runs[].capacities)"},progressLayoutId:{de:"von nichts gelesen",en:"read by nothing"},bewerbungsfenster:{de:"die Kohorte besitzt die \xD6ffnung (isOpen / applicationOpensAt)",en:"the cohort owns opening (isOpen / applicationOpensAt)"},selection:{de:"die Reihenfolge ist der Eingang `waitlistOrder` des Wartelistenknotens (automatisches Nachr\xFCcken gibt es nicht mehr; Freigabe-Strategie und Stichtag las nichts)",en:"the order is the waitlist node's input `waitlistOrder` (automatic promotion is gone; release strategy and deadline were read by nothing)"},progressLayout:{de:"das Fortschrittslayout geh\xF6rt zum Workflow: den Block nach workflow.json `progressLayout` verschieben (ohne Workflow l\xF6schen)",en:"the progress layout belongs to the workflow: move the block to workflow.json `progressLayout` (without a workflow: delete it)"}};function bp(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=Xl[n];return t!==void 0?`manifest: \`${n}\` is no longer part of manifest.json (${t.en}). Delete the line.`:`manifest: unknown key \`${n}\` \u2014 manifest.json carries no key.`})}s(bp,"manifestIssues");function q2(e){let n=[],t=e.buses;if(!Array.isArray(t))return n;let r=t.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return n;for(let i of r.states){if(!i||typeof i!="object")continue;let o=i;if(o.terminal!==!0&&(!o.external||typeof o.external!="object")){let a=typeof o.id=="string"?o.id:"?";n.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return n}s(q2,"validateProgressLayoutExternalCopy");function v_(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let n=e.buses;return!Array.isArray(n)||!n.some(t=>!!t&&typeof t=="object"&&t.key==="process")?["progressLayout: the layout must declare the `process` bus"]:q2(e)}s(v_,"progressLayoutIssues");var x_=new Set(["nodes","assignmentRules","channels","processStore","staffInputs"]);var K2=new Set(["sections","effects","outcomes","testScenarios","env","views"]),vp={id:{de:"der Schl\xFCssel des Formulars ist sein Slug",en:"the form's key is its slug"},label:{de:"der Name steht in der Formularzeile (createSmartForm.label)",en:"the name is the form row's (createSmartForm.label)"},outcomeIds:{de:"die Ergebnisse sind die ids von outcomes[]",en:"the outcomes are the ids of outcomes[]"},schoolSlug:{de:"von nichts gelesen",en:"read by nothing"}};function S_(e,n){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${n}: die Formulardefinition muss ein Objekt sein.`,en:`${n}: the form definition must be an object.`}];let t=[];for(let i of Object.keys(e)){if(K2.has(i))continue;let o=vp[i];t.push(o!==void 0?{de:`${n}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${n}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${n}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${n}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||t.push({de:`${n}: \`${i}\` muss eine Liste sein.`,en:`${n}: \`${i}\` must be a list.`});return t}s(S_,"smartFormDefinitionShapeIssues");var Ot=["granted","rejected","waitlisted","other"];function ro(e){return typeof e=="string"&&Ot.includes(e)}s(ro,"isOutcomeSemantic");var sr=["arrival","manual"],A_={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function j2(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(j2,"literal");function _w(e){let n=j2(e,"waitlistOrder");return sr.includes(n)?{waitlistOrder:n}:null}s(_w,"waitlistPolicyOrNull");var vn="responsible",Cw="team:";function xp(e){return`${Cw}${e}`}s(xp,"teamSlot");function Sp(e){return e.startsWith(Cw)?e.slice(Cw.length):null}s(Sp,"teamKeyOfSlot");function T_(e){return e.kind==="responsible"?vn:xp(e.groupKey)}s(T_,"slotIdOf");function Ap(e){if(e===vn)return{kind:"responsible"};let n=Sp(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(Ap,"slotOfId");var Pw="review",Nw="checkField",R_="reviewed",Dw="reviewing",Tp=["rejected","waitlisted"];function Fw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Fw,"isObject");var V2=new Set(["decision",Pw]),$_={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function Lw(e){return Object.hasOwn($_,e)?$_[e]:void 0}s(Lw,"legacySemanticOfId");function B2(e){return e===Pw?Ot.filter(n=>!Tp.includes(n)):Ot}s(B2,"allowedSemanticsFor");var U2="other";function E_(e){return Fw(e)&&V2.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(E_,"outcomesOf");function I_(e){return(e?.nodes??[]).some(n=>E_(n).some(t=>Fw(t)&&!("semantic"in t)))}s(I_,"needsOutcomeSemantics");function O_(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=E_(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=B2(u),h=!1,y=l.map(b=>{if(!Fw(b))return b;let k=String(b.id);if("semantic"in b)return ro(b.semantic)||i.push({nodeId:c,outcomeId:k,value:String(b.semantic)}),b;let v=`${c}.${k}`,$=Object.hasOwn(n,v)?n[v]:void 0;if($!==void 0)return p.includes($)?(t.push({nodeId:c,outcomeId:k,semantic:$,source:"answer"}),h=!0,{...b,semantic:$}):(r.push({nodeId:c,nodeType:u,outcomeId:k,allowed:p,answer:$}),b);let R=Lw(k),I=R??U2;return p.includes(I)?(t.push({nodeId:c,outcomeId:k,semantic:I,source:R===void 0?"formerDefault":"legacyTable"}),h=!0,{...b,semantic:I}):(r.push({nodeId:c,nodeType:u,outcomeId:k,allowed:p}),b)});return h?{...d,outcomes:y}:a});return t.length===0?{graph:e,written:t,refused:r,invalid:i}:{graph:{...e,nodes:o},written:t,refused:r,invalid:i}}s(O_,"addOutcomeSemantics");var Vt="bewerbungOffen";function Go(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Go,"isObject");var Mw=["event","effect"];function __(e){return Go(e)&&e.type==="eventTrigger"}s(__,"isTrigger");function C_(e){let n=Go(e.inputs)?e.inputs:{};return"outcomes"in e||Mw.some(t=>t in e||t in n)}s(C_,"oldShape");function P_(e){return(e?.nodes??[]).some(n=>__(n)&&C_(n))}s(P_,"needsEventTriggerStartMove");function G2(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>Go(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===Vt))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(Go(e.next)?e.next:{});if(!(i.length===1&&i[0]===Vt))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=Go(e.inputs)?{...e.inputs}:{};for(let l of Mw){let d=o[l];if(Go(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of Mw)delete a[l],delete o[l];return Go(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(G2,"moveNode");function N_(e){let n=[],t=[],r=e.nodes.map(i=>{if(!__(i)||!C_(i))return i;let o=G2(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(N_,"moveEventTriggerStart");function ed(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ed,"isObject");var D_={waitlistOrder:"arrival"};function F_(e){return!ed(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(ed(e.inputs)?e.inputs:{}))}s(F_,"lacksPolicy");function z2(e){return(e?.nodes??[]).some(F_)}s(z2,"needsWaitlistPolicyMove");function qw(e){return ed(e)&&sr.includes(e.waitlistOrder)}s(qw,"isWaitlistPolicy");function W2(e){if(e===void 0)return{policy:D_,stated:!1};if(!ed(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!sr.includes(n)?"malformed":{policy:{waitlistOrder:n??D_.waitlistOrder},stated:n!==void 0}}s(W2,"policyOfSelection");function L_(e,n,t={}){let r=[],i=[];if(!z2(e))return{graph:e,moved:r,refused:i};let o=W2(n),a=e.nodes.map(l=>{if(!F_(l))return l;let d=l,c=String(d.id),u=ed(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(t,c)?t[c]:void 0,h,y;if(p!==void 0)h=p,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;h=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:h.waitlistOrder},r.push({nodeId:c,policy:h,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(L_,"moveWaitlistPolicyToInputs");function zo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(zo,"isObject");var Y2=[et,Uo],H2=["inputSchema","parties","schemaDigest","parts"];function M_(e){return zo(e)&&e.type==="governedDocument"&&("resolver"in e||zo(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(M_,"oldShape");function q_(e){return(e?.nodes??[]).some(M_)}s(q_,"needsGeneratorInputMove");function J2(e){let n=zo(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!zo(i))return{unmoved:"resolverNotObject"};if(et in n)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((zo(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>zo(d)&&Y2.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[et]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(H2.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(t.generatorStamp=l),r=i.cockpitFields,delete t.resolver}if(zo(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(Uo in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[Uo]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}t.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};t.cockpitFields=r}return t.inputs=n,{node:t}}s(J2,"moveNode");function K_(e){let n=[],t=[],r=e.nodes.map(i=>{if(!M_(i))return i;let o=J2(i);return"unmoved"in o?(t.push({nodeId:String(i.id),reason:o.unmoved}),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(K_,"moveGeneratorPinsToInputs");var j_=/^\d{4}-\d{2}-\d{2}$/;function Er(e,n){return{de:e,en:n}}s(Er,"issue");function Wo(e){if(typeof e!="object"||e===null)return Er("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:Er('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return Er(`unbekannte Art ${JSON.stringify(n.kind)}`,`unknown kind ${JSON.stringify(n.kind)}`);let{amount:t,activeFrom:r,activeTo:i}=n;return typeof t!="number"||!Number.isFinite(t)||t<=0?Er("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((t*100).toFixed(6)))?typeof r!="string"||!j_.test(r)?Er("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!j_.test(i)?Er("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?Er("das Ende liegt vor dem Beginn","the end is before the start"):n.floorTotal!==void 0&&(typeof n.floorTotal!="number"||!Number.isSafeInteger(n.floorTotal)||n.floorTotal<0)?Er("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):n.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(n.pricePeriod))?Er("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?Er("unbekannte Angaben","unknown details"):null:Er("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(Wo,"reductionShapeIssue");function io(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.itemKey=="string"&&n.itemKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||Wo(n.reduction)===null&&n.reduction.kind==="amount")}s(io,"isPricedItemValue");var ia=["freetext","recommendation","choice","pricedItem","record","reduction"],oa=[...ia,"appointment"];function B_(e){return typeof e=="string"&&oa.includes(e)}s(B_,"isTaskResultKind");function sa(e){return typeof e=="string"&&ia.includes(e)}s(sa,"isRecordedTaskResultKind");function aa(e){return sa(e.kind)}s(aa,"isRecordedTaskResult");var Rp=["number","boolean","enum","text","person","assignment"];function Kw(e){return typeof e=="string"&&Rp.includes(e)}s(Kw,"isRecordFieldType");function U_(e){return e==="number"||e==="boolean"||e==="enum"}s(U_,"isSuggestibleFieldType");var jw=["form","siblingRank"],$p=500;function Q2(e){switch(e.type){case"number":case"boolean":case"enum":return e.type;case"text":return"string";case"person":return e.multiple===!0?"staffUserList":"staffUser";case"assignment":return"taskAssignment"}}s(Q2,"recordFieldValueType");var vi={freetext:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Freitext",en:"Free text"}},recommendation:{choiceValueType:"enum",valueType:null,textValueType:"string",label:{de:"Empfehlung",en:"Recommendation"}},choice:{choiceValueType:"enum",valueType:"enum",textValueType:"string",label:{de:"Auswahl",en:"Choice"}},pricedItem:{choiceValueType:"enum",valueType:"pricedItem",textValueType:"string",label:{de:"Preisposition",en:"Priced item"}},reduction:{choiceValueType:null,valueType:"reduction",textValueType:"string",label:{de:"Reduktion",en:"Reduction"}},record:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Erfassung",en:"Record"}},appointment:{choiceValueType:null,valueType:null,textValueType:null,label:{de:"Termin",en:"Appointment"}}};function Vw(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(Vw,"isProseResult");function Ep(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&Kw(n.type)).map(n=>({key:n.writes,valueType:Q2(n),field:n})):Z2(e)}s(Ep,"draftResultStoreWrites");function Z2(e){let n=vi[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(Z2,"singleStoreWrite");var V_="team:";function la(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(V_)){let n=e.slice(V_.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(la,"parseTaskResultChat");var Ye={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",recordText:"[taskResult/recordText]",recordPerson:"[taskResult/recordPerson]",recordAssignment:"[taskResult/recordAssignment]",reductionPrices:"[taskResult/reductionPrices]"};var X2=new Set(["if","else","in","true","false","null"]),eY=new Set(["==","!=","<=",">=","&&","||"]);function nY(e){return e>="0"&&e<="9"}s(nY,"isDigit");function tY(e){return/[a-zA-Z_$]/.test(e)}s(tY,"isIdentStart");function rY(e){return/[a-zA-Z0-9_.$]/.test(e)}s(rY,"isIdentCont");function iY(e){let n=[],t=0;for(;t<e.length;){let r=e.charAt(t);if(r===" "||r===" "||r===`
|
|
@@ -11484,7 +11484,7 @@ You can check the current status at any time here:
|
|
|
11484
11484
|
|
|
11485
11485
|
{{taskLink}}`,en:`Go straight to the task:
|
|
11486
11486
|
|
|
11487
|
-
{{taskLink}}`}}]},ZH={key:"feedbackLink",label:"Link zum Feedback",required:!0,link:!0,actionLabel:{de:"Feedback abgeben",en:"Give feedback"},previewValue:{de:"https://beispiel.plexus.schule/schule/respond?token=BEISPIEL",en:"https://beispiel.plexus.schule/schule/respond?token=BEISPIEL"}},XH={key:"appointmentWhen",label:"Datum und Uhrzeit des Termins"},XP={plain:["intro","outro"],appointment:["intro","appointment","outro"]},eJ={id:"staff.feedbackRequested",category:"staffFeedback",label:"Bitte um Feedback",occasion:{de:"Sobald eine Feedback-Aufgabe beantwortet werden kann \u2014 an die Person, die sie hat, oder an
|
|
11487
|
+
{{taskLink}}`}}]},ZH={key:"feedbackLink",label:"Link zum Feedback",required:!0,link:!0,actionLabel:{de:"Feedback abgeben",en:"Give feedback"},previewValue:{de:"https://beispiel.plexus.schule/schule/respond?token=BEISPIEL",en:"https://beispiel.plexus.schule/schule/respond?token=BEISPIEL"}},XH={key:"appointmentWhen",label:"Datum und Uhrzeit des Termins"},XP={plain:["intro","outro"],appointment:["intro","appointment","outro"]},eJ={id:"staff.feedbackRequested",category:"staffFeedback",label:"Bitte um Feedback",occasion:{de:"Sobald eine Feedback-Aufgabe beantwortet werden kann \u2014 an die Person, die sie hat, oder \u2014 solange niemand sie hat \u2014 an die verantwortliche Person des Prozesses",en:"When a feedback task can be answered \u2014 to the person who has it, or \u2014 while nobody has it \u2014 to the process's responsible person"},audience:"internal",deputyCopy:!1,frame:"notice",timeline:"hidden",paramsValidator:iN,channels:["email"],portalVisible:!1,placeholders:[_k,ZH,XH],bodyVariants:[XP.plain,XP.appointment],slots:[Ie({de:"Bitte um Feedback: {{taskTitle}}",en:"Feedback requested: {{taskTitle}}"}),{key:"intro",label:"Einleitung",multiline:!0,default:{de:"Ihre Schule hat eine Aufgabe f\xFCr Sie: {{taskTitle}}.",en:"Your school has a task for you: {{taskTitle}}."}},{key:"appointment",label:"Termin",multiline:!0,default:{de:"Termin: {{appointmentWhen}}",en:"Appointment: {{appointmentWhen}}"}},{key:"outro",label:"Abschluss",multiline:!0,default:{de:`{{feedbackLink}}
|
|
11488
11488
|
|
|
11489
11489
|
Der Link gilt 30 Tage und antwortet in Ihrem Namen. Bitte leiten Sie diese E-Mail nicht weiter.`,en:`{{feedbackLink}}
|
|
11490
11490
|
|
|
@@ -11652,7 +11652,7 @@ The link is valid for {{gueltigkeit}} and works once. Afterwards you are signed
|
|
|
11652
11652
|
|
|
11653
11653
|
{{einstellungenLink}}`,en:`Open Plexus and, in the user menu, \u201CSettings\u201D \u2192 \u201CSignature\u201D:
|
|
11654
11654
|
|
|
11655
|
-
{{einstellungenLink}}`}}]},Dk=[AH,OH,PH,DH,qH,KH,GH,UH,pJ,hJ,RJ,EJ,OJ,PJ,FJ,MJ,jJ,UJ,WJ,HJ,gJ,yJ,wJ,JJ,QJ,ZJ,zH,WH,JH,MH,QH,eJ,rJ,sJ,uJ,SJ,y6,k6,RH,EH,e6,t6,i6,s6,l6,c6,f6];function Fk(e){let n=Dk.find(t=>t.id===e);return n===void 0&&M(`notifications: unknown letter "${e}"`),n}s(Fk,"letterDefFor");function Lk(e){return Dk.some(n=>n.id===e)}s(Lk,"hasLetterDef");function Mk(e,n){return n===void 0?!0:Dp(e,n)}s(Mk,"letterArgCompatible");function hd(e){return e==="localizedText"?{de:"Text in jeder Sprache (localizedText)",en:"Text in every language (localizedText)"}:{de:`${ft(e)} (${e})`,en:`${ft(e)} (${e})`}}s(hd,"letterArgTypeLabel");function aN(e){let n=new Map,t=s((r,i)=>{let o=n.get(r);o===void 0?n.set(r,[i]):o.push(i)},"add");for(let r of e.args)t(r.key,{source:`Ereignis "${e.id}"`,type:r.type,always:r.required===!0});for(let r of UP)t(r.key,{source:"Kontext des Versands",type:r.type,always:!0});return n}s(aN,"eventArgSources");function lN(e,n){let t=e.type===void 0?[...n]:n.filter(r=>Mk(r.type,e.type));if(t.length>1)return{status:"ambiguous",matches:t};if(t.length===1){let r=t[0];return!e.required||r.always?{status:"resolved",source:r}:{status:"sometimes",source:r}}return e.required?{status:"missing",rejected:[...n]}:{status:"unused"}}s(lN,"resolveLetterParam");var qk=["booked","rescheduled","cancelled"],b6={booked:"admission.appointmentBooked",rescheduled:"admission.appointmentRescheduled",cancelled:"admission.appointmentCancelled"},cN=":";function uN(e,n){return`${e}${cN}${n}`}s(uN,"appointmentEventId");function v6(e){let n=e.lastIndexOf(cN);if(n<=0)return null;let t=e.slice(n+1);return qk.includes(t)?{taskKey:e.slice(0,n),kind:t}:null}s(v6,"parseAppointmentEventId");var dN={booked:{de:"Termin vereinbart",en:"Appointment booked"},rescheduled:{de:"Termin verschoben",en:"Appointment moved"},cancelled:{de:"Termin abgesagt",en:"Appointment cancelled"}};function Ta(e){return Array.isArray(e.tasks)?e.tasks.filter(n=>typeof n?.key=="string"&&n.result?.kind==="appointment"):[]}s(Ta,"appointmentTasksOf");function x6(e){return qk.map(n=>({id:uN(e.key,n),label:{de:`${dN[n].de} \u2013 \u201E${e.title.de}\u201C`,en:`${dN[n].en} \u2013 \u201C${e.title.en}\u201D`},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"bookingId",type:"string",required:!0}]}))}s(x6,"appointmentTaskEvents");function fN(e,n){let t=n.notificationEvents?.(e)??[],r=Ta(e).flatMap(x6);return r.length===0?t:[...t,...r]}s(fN,"nodeNotificationEvents");function S6(e){return Object.fromEntries(qk.map(n=>[uN(e,n),{templateId:b6[n]}]))}s(S6,"defaultAppointmentBindings");function A6(e,n){if(e===void 0)return{notifications:e,dropped:[]};let t=[],r={};for(let[i,o]of Object.entries(e))v6(i)?.taskKey===n?t.push(i):r[i]=o;return t.length===0?{notifications:e,dropped:t}:{notifications:Object.keys(r).length===0?void 0:r,dropped:t}}s(A6,"withoutAppointmentBindings");function lm(e,n,t){let r=new Set(Ta(n).map(d=>d.key)),i=new Set(Ta(t).map(d=>d.key)),o=e,a=[];for(let d of r){if(i.has(d))continue;let c=A6(o,d);o=c.notifications,a.push(...c.dropped)}let l=[];for(let d of i)if(!r.has(d))for(let[c,u]of Object.entries(S6(d)))o?.[c]===void 0&&(o={...o??{},[c]:u},l.push(c));return{notifications:o,bound:l,dropped:a}}s(lm,"syncAppointmentBindings");function T6(e){return e.kind==="task"&&!("title"in e)}s(T6,"isLegacyFreeTodoContext");function Kk(e){let{context:n}=e;if(T6(n)&&M(`[workItems/legacyFreeTodo] work_item ${e._id} is a free to-do in its former shape \u2014 run migrations:freeTodosToContext`),n.kind==="task")return{...e,context:n,kind:"task",createdVia:"human",partyId:n.partyId};let{anchor:t,task:r,kind:i,title:o,description:a,...l}=n,d=t.scope==="node"?{nodeId:t.nodeId,templateKey:t.templateKey,gatesNode:t.gatesNode,blocks:t.blocks}:t.scope==="application"?{scope:"application",templateKey:t.templateKey}:t.scope==="crossNode"?{scope:"application",nodeId:t.nodeId,templateKey:t.templateKey,blocks:t.blocks}:{};return{...e,context:n,...l,...d,...r??{},kind:i}}s(Kk,"readWorkItem");async function Ra(e,n){let t;if(n.nodeId!==void 0){let r=n.nodeId;t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",i=>i.eq("context.applicationId",n.applicationId).eq("context.anchor.nodeId",r)).collect()}else if(n.isOpen!==void 0){let r=n.isOpen;t=await e.db.query("work_items").withIndex("by_applicationId_and_isOpen",i=>i.eq("context.applicationId",n.applicationId).eq("isOpen",r)).collect()}else t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",r=>r.eq("context.applicationId",n.applicationId)).collect();return t.filter(r=>n.isOpen===void 0||r.isOpen===n.isOpen).map(Kk)}s(Ra,"listWorkItemsForApplication");var eke=m.union(m.literal("approved"),m.literal("rejected")),gd=new Set(["task","approval"]);function $6(e,n){switch(e){case"task":return n?.gatesNode===!0&&M("expandComposedTask: gatesNode is approval-only \u2014 a 'task' template never gates its node (use blocks to hold a gating sibling back)"),{kind:"task",recipient:"internal",gatesNode:!1};case"approval":return{kind:"approval",recipient:"internal",isApproval:!0,gatesNode:n?.gatesNode??!0};default:M(`expandComposedTask: unknown composed-task kind ${JSON.stringify(e)} \u2014 authorable: ${[...gd].join(", ")}`)}}s($6,"expandComposedTask");for(let e of["task","approval"]){let n=$6(e);n.kind==="approval"!=(n.isApproval===!0)&&M(`composed-task kind "${e}": isApproval must be present iff kind === 'approval'`)}var pN=eo,ho=`${pN}.`,E6=new Set(["text","number","date","boolean","option","edge"]);function jk(e,n){let t=e[n];return t===void 0&&M(`[env/unknownKey] no environment key '${n}'`),typeof t=="string"?null:Object.keys(t)}s(jk,"contextFields");function mN(e,n){return Object.hasOwn(e,n)}s(mN,"isContextKey");function hN(e){let n=[];for(let t of Object.keys(e)){let r=jk(e,t);if(r===null)n.push(t);else for(let i of r)n.push(`${t}.${i}`)}return n}s(hN,"leafPaths");function yd(e,n){let[t="",r,...i]=n.split(".");if(!mN(e,t)||i.length>0)return;let o=e[t];if(typeof o=="string")return r===void 0?o:void 0;if(!(r===void 0||!Object.hasOwn(o,r)))return o[r]}s(yd,"leafType");function gN(e){let n=new Set;for(let t of e){let r=$a(t);r!==null&&n.add(r.split(".")[0])}return[...n]}s(gN,"contextKeysOf");function $a(e){return e.startsWith(ho)?e.slice(ho.length):null}s($a,"contextPathOf");function wd(e){return e===pN||e.startsWith(ho)}s(wd,"isContextIdentifier");function dm(e,n){let t=$a(n)??"",[r=""]=t.split("."),i=Object.keys(e);if(!mN(e,r))return{code:"env/unknownKey",message:{de:`'${n}' nennt keinen Umgebungsschl\xFCssel \u2014 bekannt: ${i.join(", ")}.`,en:`'${n}' names no environment key \u2014 known: ${i.join(", ")}.`}};if(yd(e,t)!==void 0)return null;let o=jk(e,r);return{code:"env/unknownKey",message:o===null?{de:`'${n}': der Umgebungsschl\xFCssel '${r}' ist ein einzelner Wert \u2014 lies ihn als '${ho}${r}'.`,en:`'${n}': environment key '${r}' is a single value \u2014 read it as '${ho}${r}'.`}:{de:`'${n}': der Umgebungsschl\xFCssel '${r}' hat die Felder ${o.join(", ")}.`,en:`'${n}': environment key '${r}' has the fields ${o.join(", ")}.`}}}s(dm,"identifierIssue");function cm(e,n,t=Object.keys(e)){let r={};for(let i of t){let o=jk(e,i),a=Object.hasOwn(n,i)?n[i]:void 0;if(a===void 0&&M(`[env/missing] context key '${i}' was not supplied`),o===null){r[`${ho}${i}`]=a;continue}for(let l of o){let d=typeof a=="object"&&a!==null&&Object.hasOwn(a,l)?a[l]:void 0;d===void 0&&M(`[env/missing] context key '${i}' carries no '${l}'`),r[`${ho}${i}.${l}`]=d}}return r}s(cm,"flatten");function I6(e,n){switch(n){case"number":return typeof e=="number"&&Number.isFinite(e);case"boolean":return typeof e=="boolean";case"date":return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}/.test(e);default:return typeof e=="string"}}s(I6,"valueMatchesDataType");function yN(e,n,t=Object.keys(e.types)){let r=new Set(t);for(let i of hN(e.types)){if(!r.has(i.split(".")[0]))continue;let o=n[`${ho}${i}`];o===void 0&&M(`[env/missing] context path '${i}' was not supplied`);let a=e.fields[i];if(o===null){a.nullable||M(`[env/null] context path '${i}' is not nullable but carries null`);continue}let l=ft(yd(e.types,i));I6(o,l)||M(`[env/type] context path '${i}' expects ${l}, got ${JSON.stringify(o)}`),a.valueSet.kind==="fixed"&&!a.valueSet.values.includes(o)&&M(`[env/value] context path '${i}' carries '${String(o)}', outside ${a.valueSet.values.join(" | ")}`)}}s(yN,"assertContextValues");function O6(e){let n=[],t=hN(e.types);for(let r of t){let i=yd(e.types,r),o=ft(i);if(!oo(i)||o===void 0||!E6.has(o)){n.push(`'${r}' has type '${String(i)}', not a scalar value type`);continue}let a=Object.hasOwn(e.fields,r)?e.fields[r]:void 0;if(a===void 0){n.push(`'${r}' has no field spec (value set + nullability)`);continue}a.valueSet.kind==="fixed"&&(a.valueSet.values.length===0&&n.push(`'${r}' has an empty fixed value set`),o!=="text"&&o!=="option"&&n.push(`'${r}' is ${o}; a fixed value set needs a text or option leaf`))}for(let r of Object.keys(e.fields))t.includes(r)||n.push(`field spec '${r}' names no leaf of the schema`);return n}s(O6,"schemaIssues");function Ea(e){let n=O6(e);n.length>0&&M(`[env/schema] ${n.join("; ")}`)}s(Ea,"assertSchema");var um={length:{params:["text"],returns:"number"},years_between:{params:["date","date"],returns:"number"}};function go(e){return JSON.stringify(e)}s(go,"canonical");function Oa(e){return e.kind==="binary"&&e.op==="&&"?[...Oa(e.left),...Oa(e.right)]:[e]}s(Oa,"conjuncts");function bN(e,n){let t;try{t=Kn(e)}catch{return!1}let r=go(Kn(n));return Oa(t).some(i=>go(i)===r)}s(bN,"hasConjunct");function vN(e,n){try{return go(Kn(e))===go(Kn(n))}catch{return!1}}s(vN,"sameCondition");function xN(e){let n=[];for(let t of e)n.push(...jn(Ai(t)));return gN(n)}s(xN,"contextKeysRead");function SN(e){try{return jn(Kn(e)).some(wd)}catch{return!1}}s(SN,"readsContext");var _6=/^\d{4}-\d{2}-\d{2}$/,C6=new Set(["==","!=","<","<=",">",">=","in"]),P6=new Set(["<","<=",">",">="]);function pm(e,n,t=[]){Ea(n);let r;try{r=Kn(e)}catch(a){let l=a.message;return[rt("condition/parse",`Bedingung '${e}' ist nicht lesbar: ${l}`,`condition '${e}' does not parse: ${l}`)]}let i=[];for(let a of jn(r)){if(!wd(a)){i.push(rt("condition/foreignIdentifier",`'${a}' ist kein Umgebungswert \u2014 Bedingungen lesen nur '$env.*'`,`'${a}' is not a context identifier \u2014 conditions read only '$env.*'`));continue}let l=dm(n.types,a);l!==null&&i.push(rt("condition/unknownIdentifier",l.message.de,l.message.en))}if(i.length>0)return i;let o=ii(r,n,i);kd(o)||i.push(rt("condition/notBoolean",`Bedingung '${e}' ist kein Ja/Nein-Ausdruck`,`condition '${e}' is not a yes/no expression`)),L6(r,n,i);for(let{identifier:a,op:l}of Uk(r,n))i.push(rt("condition/unguardedNullable",`'${l}' \xFCber '${a}', das leer sein kann, braucht davor eine Absicherung '${a} != null &&'`,`'${l}' over '${a}', which may be null, needs a guard '${a} != null &&' before it`));return i.push(...N6(r,t)),i}s(pm,"conditionIssues");function N6(e,n){let t=Oa(e).map(go);return n.flatMap(r=>{let i=Kn(r),o=D6(i);return o===null||!t.includes(go(o))?[]:[{severity:"info",code:"condition/guardForm",message:{de:`[condition/guardForm] eine gespiegelte Absicherung z\xE4hlt nicht \u2014 schreibe sie genau als '${r}'`,en:`[condition/guardForm] a mirrored guard does not count \u2014 write it exactly as '${r}'`}}]})}s(N6,"guardFormHints");function D6(e){if(e.kind!=="binary"||e.op!=="=="&&e.op!=="!=")return null;let n={...e,left:e.right,right:e.left};return go(n)===go(e)?null:n}s(D6,"mirror");function kd(e){return e.t==="unknown"||e.t==="data"&&e.dt==="boolean"}s(kd,"isBooleanish");function AN(e){let n=$a(e);return n===null&&M(`[condition/invariant] '${e}' reached a pass that only sees $env identifiers`),n}s(AN,"contextPath");function TN(e,n){let t=$a(n);return t!==null&&e.fields[t]?.nullable===!0}s(TN,"isNullableLeaf");function F6(e,n){let t=ft(yd(e.types,AN(n)));return t===void 0?{t:"unknown"}:{t:"data",dt:t}}s(F6,"identType");function fm(e,n){return e.t==="unknown"||n.t==="unknown"||e.t==="null"||n.t==="null"?!0:e.t==="array"||n.t==="array"?!1:e.t==="str"&&n.t==="str"?!0:e.t==="str"?wN(e.value,n.dt):n.t==="str"?wN(n.value,e.dt):e.dt===n.dt}s(fm,"fits");function wN(e,n){return n==="text"||n==="option"||n==="edge"?!0:n==="date"?_6.test(e):!1}s(wN,"strFits");function kN(e){return e.t==="unknown"?"unknown":e.t==="data"&&e.dt==="number"?"number":null}s(kN,"orderedCategory");function ii(e,n,t){switch(e.kind){case"num":return{t:"data",dt:"number"};case"bool":return{t:"data",dt:"boolean"};case"str":return{t:"str",value:e.value};case"null":return{t:"null"};case"ident":return F6(n,e.path);case"arr":for(let r of e.items)ii(r,n,t);return{t:"array"};case"unary":{let r=ii(e.operand,n,t);return kd(r)||t.push(rt("condition/notBoolean","'!' braucht einen Ja/Nein-Operanden","'!' needs a yes/no operand")),{t:"data",dt:"boolean"}}case"call":{let r=Object.hasOwn(um,e.name)?um[e.name]:void 0,i=e.args.map(l=>ii(l,n,t));return r===void 0?(t.push(rt("condition/functionNotAllowed",`Funktion '${e.name}' ist nicht erlaubt \u2014 erlaubt: ${Object.keys(um).join(", ")}`,`function '${e.name}' is not allowed \u2014 allowed: ${Object.keys(um).join(", ")}`)),{t:"unknown"}):(i.length===r.params.length&&i.every((l,d)=>l.t!=="null"&&fm(l,{t:"data",dt:r.params[d]}))||t.push(rt("condition/typeMismatch",`'${e.name}' nimmt (${r.params.join(", ")})`,`'${e.name}' takes (${r.params.join(", ")})`)),{t:"data",dt:r.returns})}case"if":{let r=ii(e.cond,n,t);kd(r)||t.push(rt("condition/notBoolean","'if' braucht eine Ja/Nein-Bedingung","'if' needs a yes/no condition"));let i=ii(e.then,n,t),o=ii(e.else,n,t);return fm(i,o)||t.push(rt("condition/typeMismatch","die beiden Zweige von 'if' haben verschiedene Typen","the two arms of 'if' differ in type")),i.t==="null"?o:i}case"binary":{let r=ii(e.left,n,t),i=ii(e.right,n,t);if(e.op==="&&"||e.op==="||")(!kd(r)||!kd(i))&&t.push(rt("condition/notBoolean",`'${e.op}' braucht Ja/Nein-Operanden`,`'${e.op}' needs yes/no operands`));else if(e.op==="in")e.right.kind!=="arr"?t.push(rt("condition/inWithoutArray","'in' braucht rechts eine Liste, z. B. ['a', 'b']","'in' needs a list on its right, e.g. ['a', 'b']")):e.right.items.every(o=>fm(r,ii(o,n,[])))||t.push(rt("condition/typeMismatch","ein Listeneintrag von 'in' passt nicht zum Typ des linken Operanden","a list item of 'in' does not match the left operand's type"));else if(P6.has(e.op)){let o=kN(r),a=kN(i);(o===null||a===null||o!=="unknown"&&a!=="unknown"&&o!==a)&&t.push(rt("condition/orderedComparison",`'${e.op}' vergleicht nur Zahlen \u2014 f\xFCr Daten years_between(\u2026) verwenden`,`'${e.op}' compares only numbers \u2014 for dates use years_between(\u2026)`))}else fm(r,i)||t.push(rt("condition/typeMismatch",`'${e.op}' vergleicht Werte verschiedener Typen`,`'${e.op}' compares values of different types`));return{t:"data",dt:"boolean"}}}}s(ii,"typeOf");function Vk(e){return e.kind==="str"||e.kind==="num"||e.kind==="bool"}s(Vk,"isLiteral");function RN(e){let n=[],t=s(r=>{if(r.kind==="binary"&&C6.has(r.op)){if(r.left.kind==="ident"){let i=r.op==="in"&&r.right.kind==="arr"?r.right.items.filter(Vk):Vk(r.right)?[r.right]:[];i.length>0&&n.push({ident:r.left.path,literals:i})}r.right.kind==="ident"&&Vk(r.left)&&n.push({ident:r.right.path,literals:[r.left]})}$N(r,t)},"visit");return t(e),n}s(RN,"comparedLiterals");function L6(e,n,t){for(let{ident:r,literals:i}of RN(e)){let o=M6(r,i,n);o!==null&&t.push(o)}}s(L6,"literalIssues");function Bk(e,n){let t;try{t=Kn(e)}catch{return[]}let r=[];for(let{ident:i,literals:o}of RN(t)){let a=$a(i);if(!(a===null||n.fields[a]?.valueSet.kind!=="live"))for(let l of o)l.kind==="str"&&r.push({path:a,value:l.value})}return r}s(Bk,"liveLiterals");function M6(e,n,t){let r=t.fields[AN(e)]?.valueSet;if(r?.kind==="unstable")return rt("condition/literalOnUnstable",`'${e}' ist nicht \xFCber Umgebungen stabil \u2014 vergleiche ihn mit keinem festen Wert; verzweige stattdessen \xFCber ein stabiles Merkmal`,`'${e}' is not stable across environments \u2014 compare it to no literal; branch on a stable attribute instead`);if(r?.kind!=="fixed")return null;let i=n.flatMap(a=>a.kind==="str"&&!r.values.includes(a.value)?[`'${a.value}'`]:[]);if(i.length===0)return null;let o=r.values.map(a=>`'${a}'`).join(", ");return rt("condition/literalOutsideSet",`'${e}' kennt nur ${o} \u2014 nicht ${i.join(", ")}`,`'${e}' takes only ${o} \u2014 not ${i.join(", ")}`)}s(M6,"valueSetIssue");function $N(e,n){switch(e.kind){case"binary":n(e.left),n(e.right);return;case"unary":n(e.operand);return;case"call":e.args.forEach(n);return;case"arr":e.items.forEach(n);return;case"if":n(e.cond),n(e.then),n(e.else);return;default:return}}s($N,"forEachChild");function EN(e){return e.kind==="binary"&&(e.op==="=="||e.op==="!=")&&(e.left.kind==="ident"&&e.right.kind==="null"||e.left.kind==="null"&&e.right.kind==="ident")}s(EN,"isNullTest");function IN(e){return Oa(e).flatMap(n=>{let t=ON(n);return t===null?[]:[t]})}s(IN,"guardsOf");function bd(e,n,t){switch(e.kind){case"ident":return TN(n,e.path)&&!t.has(e.path)?e.path:null;case"call":for(let r of e.args){let i=bd(r,n,t);if(i!==null)return i}return null;case"if":return bd(e.then,n,new Set([...t,...IN(e.cond)]))??bd(e.else,n,t);default:return null}}s(bd,"unguardedNullSource");function ON(e){return!EN(e)||e.kind!=="binary"||e.op!=="!="?null:e.left.kind==="ident"?e.left.path:e.right.kind==="ident"?e.right.path:null}s(ON,"guardedIdent");function Ia(e,n,t,r){if(e.kind==="binary"&&e.op==="&&"){let i=new Set(t);for(let o of Oa(e)){Ia(o,n,i,r);let a=ON(o);a!==null&&i.add(a)}return}if(e.kind==="if"){Ia(e.cond,n,t,r),Ia(e.then,n,new Set([...t,...IN(e.cond)]),r),Ia(e.else,n,t,r);return}if(e.kind==="binary"&&e.op==="!="&&e.left.kind!=="null"&&e.right.kind!=="null"){let i=bd(e.left,n,t)??bd(e.right,n,t);i!==null&&r(i,"!=")}if(e.kind==="unary"&&!EN(e.operand)){let i=jn(e.operand).filter(o=>TN(n,o)&&!t.has(o));i.length>0&&r(i[0],"!")}$N(e,i=>Ia(i,n,t,r))}s(Ia,"nullableReads");function Uk(e,n){Ea(n);let t=[];return Ia(e,n,new Set,(r,i)=>{t.some(o=>o.identifier===r)||t.push({identifier:r,op:i})}),t}s(Uk,"unguardedNullableReads");function rt(e,n,t){return{severity:"error",code:e,message:{de:`[${e}] ${n}`,en:`[${e}] ${t}`}}}s(rt,"error");function vd(e){let n=Array.isArray(e.nodes)?e.nodes:[],t=new Set;for(let r of n)for(let i of zp(r))i.key!==null&&ma[i.leaf].involves&&t.add(i.key);return t}s(vd,"declaredGroupKeys");var _a=hp;var q6="unit.key",K6="offer.key";function _N(e,n){return e===q6?n.unitKeys:e===K6?n.offerKeys:null}s(_N,"liveKeyUniverse");function mm(e){return[vn,...[...vd(e)].sort((n,t)=>n.localeCompare(t)).map(xp)]}s(mm,"requiredSlots");var yo=`${yp("applicant.channel")} == 'staff'`;var zk=["strict","leastLoaded"];var Gk=2;function CN(e){return e.some(n=>n.length===0)?{de:"nennt einen leeren Personenschl\xFCssel",en:"names an empty person key"}:new Set(e).size!==e.length?{de:"nennt eine Person zweimal",en:"names a person twice"}:e.length<Gk?{de:`braucht mindestens ${Gk} Personen`,en:`needs at least ${Gk} people`}:null}s(CN,"rotationPoolProblem");function j6(e,n){let t=n===null?-1:e.indexOf(n);return[...e.slice(t+1),...e.slice(0,t+1)]}s(j6,"strictOrder");function PN(e){let n=j6(e.pool,e.previous).filter(i=>e.eligible.has(i));if(n.length===0)return null;if(e.mode==="strict")return n[0];let t=e.openCounts;t===void 0&&M("[assignment/rotation] leastLoaded needs the open counts");let r=s(i=>{let o=t.get(i);return o===void 0&&M(`[assignment/rotation] no open count for '${i}'`),o},"load");return n.reduce((i,o)=>r(o)<r(i)?o:i)}s(PN,"pickFromPool");function DN(e){return e.map(n=>({slot:T_(n.slot),rules:[...n.rules]}))}s(DN,"rulesOfStored");function FN(e){return e.map(n=>({slot:V6(n.slot),rules:[...n.rules]}))}s(FN,"storedOfRules");function V6(e){let n=Ap(e);return n===null&&M(`[assignment/unknownSlot] '${e}' is no slot \u2014 'responsible' or 'team:<teamKey>'`),n}s(V6,"slotOf");function LN(e,n){let t=e?.assignmentRules;t===void 0&&M(`[assignment/noRules] ${n}: the workflow has no assignment rule`);let r=jN(t);return r.length>0&&M(`${r.join("; ")} (${n})`),DN(t)}s(LN,"rulesOfGraph");function B6(e){return e===vn?{slot:e,rules:[{when:yo,assign:{kind:"creator"}},{when:null,assign:{kind:"unassigned"}}]}:{slot:e,rules:[{when:null,assign:{kind:"queue"}}]}}s(B6,"defaultSlotRules");function MN(e,n){let t=new Set(e.map(o=>o.slot)),r=n.filter(o=>!t.has(o)).map(B6);return[...r.filter(o=>o.slot===vn),...e,...r.filter(o=>o.slot!==vn)]}s(MN,"withRequiredSlots");function Bn(e,n){return n===void 0?`slot '${e}'`:`slot '${e}' row #${n+1}`}s(Bn,"where");function Gt(e,n){return n===void 0?`Liste '${e}'`:`Liste '${e}', Zeile #${n+1}`}s(Gt,"whereDe");function Ct(e,n,t={},r="error"){return{severity:r,code:e,message:{de:`[${e}] ${n.de}`,en:`[${e}] ${n.en}`},...t}}s(Ct,"issue");function NN(e){if(e===vn)return!0;let n=Sp(e);return n!==null&&n.length>0}s(NN,"isKnownSlot");function U6(e,n){Ea(_a);let t=[],r=new Set;e.forEach((o,a)=>{let{slot:l}=o;NN(l)||t.push(Ct("assignment/unknownSlot",{de:`'${l}' ist keine Liste \u2014 'responsible' oder 'team:<teamKey>'`,en:`'${l}' is no slot \u2014 'responsible' or 'team:<teamKey>'`},{slot:l})),r.has(l)&&t.push(Ct("assignment/duplicateSlot",{de:`${Gt(l)} steht zweimal da`,en:`${Bn(l)} is listed twice`},{slot:l})),r.add(l),l===vn&&a!==0&&t.push(Ct("assignment/responsibleFirst",{de:`'${vn}' muss die erste Liste sein \u2014 Team-Zeilen \xFCbernehmen sie`,en:`'${vn}' must be the first slot \u2014 team rows copy it`},{slot:l})),t.push(...G6(o))});for(let o of n)r.has(o)||t.push(Ct("assignment/slotMissing",{de:`${Gt(o)} hat keine Regeln \u2014 der Workflow braucht sie`,en:`${Bn(o)} has no rule list \u2014 the workflow needs it`},{slot:o}));let i=new Set(n);for(let{slot:o}of e)o!==vn&&!i.has(o)&&NN(o)&&t.push(Ct("assignment/unusedSlot",{de:`${Gt(o)} wird hier nicht gebraucht \u2014 erlaubt, und nicht ausgewertet`,en:`${Bn(o)} is not needed here \u2014 allowed, and not evaluated`},{slot:o},"info"));return t}s(U6,"validateRules");function G6({slot:e,rules:n}){let t=[];return(n.length===0||n[n.length-1].when!==null)&&t.push(Ct("assignment/defaultRowMissing",{de:`${Gt(e)} muss mit einer Zeile ohne Bedingung enden (\u201Esonst\u201C)`,en:`${Bn(e)} must end with a row without condition ("otherwise")`},{slot:e})),n.forEach((r,i)=>{let o={slot:e,row:i},{when:a,assign:l}=r;if(a===null&&i<n.length-1&&t.push(Ct("assignment/ruleAfterDefault",{de:`${Gt(e,i)} hat keine Bedingung, aber es folgen Zeilen \u2014 sie treffen nie zu`,en:`${Bn(e,i)} has no condition, but rows follow it \u2014 they can never match`},o)),a!==null){let d=pm(a,_a,[yo]);for(let c of d)t.push({...c,message:{de:`${c.message.de} (${Gt(e,i)})`,en:`${c.message.en} (${Bn(e,i)})`},...o});if(d.every(c=>c.severity!=="error")){SN(a)||t.push(Ct("assignment/shadowedRule",{de:`${Gt(e,i)} liest nichts aus dem Vorgang \u2014 sie gilt immer oder nie`,en:`${Bn(e,i)} reads nothing of the application \u2014 it holds for every application or for none`},o));let c=n.slice(0,i).findIndex(u=>u.when!==null&&vN(u.when,a));c!==-1&&t.push(Ct("assignment/shadowedRule",{de:`${Gt(e,i)} wiederholt die Bedingung von Zeile #${c+1} \u2014 sie trifft nie zu`,en:`${Bn(e,i)} repeats the condition of row #${c+1} \u2014 it can never match`},o))}}if(e===vn&&l.kind==="slot"&&t.push(Ct("assignment/slotForwardRef",{de:`${Gt(e,i)} \xFCbernimmt '${l.slot}' \u2014 das darf nur eine Team-Liste nach '${vn}'`,en:`${Bn(e,i)} copies '${l.slot}' \u2014 only a team slot after '${vn}' may`},o)),e===vn&&l.kind==="queue"&&t.push(Ct("assignment/queueOnProcessSlot",{de:`${Gt(e,i)} weist die Queue zu \u2014 die Prozesszust\xE4ndigkeit ist immer eine Person`,en:`${Bn(e,i)} assigns the queue \u2014 the responsible slot is always a person`},o)),l.kind==="unassigned"&&t.push(Ct("assignment/targetMissing",{de:`${Gt(e,i)} nennt noch niemanden \u2014 Person w\xE4hlen`,en:`${Bn(e,i)} names no one yet \u2014 choose a person`},o)),l.kind==="rotation"){let d=CN(l.configKeys);d!==null&&t.push(Ct("assignment/rotationPool",{de:`${Gt(e,i)}: die Reihum-Liste ${d.de}`,en:`${Bn(e,i)} rotates over a pool that ${d.en}`},o))}l.kind==="creator"&&(a===null||!bN(a,yo))&&t.push(Ct("assignment/unguardedTarget",{de:`${Gt(e,i)} weist die anlegende Person zu \u2014 die gibt es nur, wenn die Bedingung der Zeile '${yo}' ist (oder enth\xE4lt)`,en:`${Bn(e,i)} assigns the creator, which exists only when the row's condition is (or has the conjunct) '${yo}'`},o))}),t}s(G6,"rowIssues");function qN(e,n){for(let r of n)e.some(i=>i.slot===r)||M(`[assignment/slotMissing] ${Bn(r)} has no rule list`);let t=new Set(n);return e.filter(r=>t.has(r.slot))}s(qN,"selectSlots");function z6(e,n){return xN(qN(e,n).flatMap(t=>t.rules.flatMap(r=>r.when===null?[]:[r.when])))}s(z6,"contextKeysOfRules");function KN(e,n,t,r){Ea(_a);let i=qN(e,t),o=z6(e,t),a=cm(_a.types,n,o);yN(_a,a,o);let l=[];for(let{slot:d,rules:c}of i){let u=c.findIndex((h,y)=>{if(h.when===null)return!0;for(let b of jn(Ai(h.when)))Object.hasOwn(a,b)||M(`[condition/unknownIdentifier] ${Bn(d,y)} reads '${b}', which the context does not carry`);return X_(h.when,{values:a})});u===-1&&M(`[assignment/defaultRowMissing] ${Bn(d)}: no row matched and there is no default row`);let p=c[u].assign;l.push({slot:d,ruleIndex:u,assign:p,value:W6(d,u,p,l,r)})}return l}s(KN,"evaluateRules");function W6(e,n,t,r,i){switch(t.kind){case"person":return{kind:"value",value:i.person(t.configKey)};case"creator":return{kind:"value",value:i.creator()};case"rotation":return{kind:"value",value:i.rotation(t,{slot:e,row:n})};case"unassigned":return M(`[assignment/targetMissing] ${Bn(e,n)} names no one`);case"queue":return e===vn&&M(`[assignment/queueOnProcessSlot] ${Bn(e,n)} assigns the queue`),{kind:"queue"};case"slot":{let o=e===vn?void 0:r.find(a=>a.slot===t.slot);return o===void 0&&M(`[assignment/slotForwardRef] ${Bn(e,n)} copies '${t.slot}', which is not decided before it`),o.value}}}s(W6,"resolveTarget");var Wk={person:["kind","configKey"],creator:["kind"],slot:["kind","slot"],queue:["kind"],rotation:["kind","configKeys","mode"],unassigned:["kind"]};function Y6(e){if(typeof e!="object"||e===null)return!1;let{kind:n,groupKey:t,...r}=e;return Object.keys(r).length>0?!1:n==="responsible"?t===void 0:n==="team"&&typeof t=="string"&&t.length>0}s(Y6,"isStoredSlot");function jN(e){let n=[],t=s((r,i)=>n.push(`[assignment/shape] ${r}: ${i}`),"bad");return Array.isArray(e)?(e.forEach((r,i)=>{let o=`slots[${i}]`;if(typeof r!="object"||r===null)return t(o,"must be { slot, rules }");let{slot:a,rules:l,...d}=r;if(Object.keys(d).length>0&&t(o,`unknown field(s) ${Object.keys(d).join(", ")}`),Y6(a)||t(o,"slot must be { kind: 'responsible' } or { kind: 'team', groupKey: '<team key>' }"),!Array.isArray(l))return t(o,"rules must be a list");l.forEach((c,u)=>{let p=`${o}.rules[${u}]`;if(typeof c!="object"||c===null)return t(p,"must be { when, assign }");let{when:h,assign:y,...b}=c;Object.keys(b).length>0&&t(p,`unknown field(s) ${Object.keys(b).join(", ")}`),h!==null&&typeof h!="string"&&t(p,"when must be a condition string or null (\u201Esonst\u201C)");let k=y?.kind;if(typeof y!="object"||y===null||typeof k!="string"||!Object.hasOwn(Wk,k))return t(p,`assign must be one of ${Object.keys(Wk).map(I=>`{kind:'${I}'}`).join(", ")}`);let v=Wk[k],$=Object.keys(y);($.some(I=>!v.includes(I))||v.some(I=>!$.includes(I)))&&t(p,`a '${k}' target has exactly the field(s) ${v.join(", ")}`);let R=y;if(k==="person"&&(typeof R.configKey!="string"||R.configKey.length===0)&&t(p,"a 'person' target needs a non-empty configKey"),k==="rotation"){let I=R.configKeys;(!Array.isArray(I)||I.some(D=>typeof D!="string"))&&t(p,"a 'rotation' target needs configKeys, a list of person keys"),zk.includes(R.mode)||t(p,`a 'rotation' target's mode is one of ${zk.map(D=>`'${D}'`).join(", ")}`)}k==="slot"&&R.slot!==vn&&t(p,`a 'slot' target copies '${vn}' and nothing else`)})}),n):(t("slots","must be a list of { slot, rules }"),n)}s(jN,"ruleShapeIssues");function VN(e){let n=e??{},t=[];if(n.teamOwnerBindings!==void 0&&t.push({de:"[assignment/legacyBindings] der Workflow tr\xE4gt noch teamOwnerBindings \u2014 die Zust\xE4ndigkeitsregel ersetzt sie; das Feld entfernen",en:"[assignment/legacyBindings] the workflow still carries teamOwnerBindings \u2014 the assignment rule replaces them; remove the field"}),n.assignmentRules===void 0)return t.push({de:"[assignment/noRules] der Workflow hat keine Zust\xE4ndigkeitsregel (graph.assignmentRules) \u2014 jeder Workflow muss sagen, wer zust\xE4ndig wird",en:"[assignment/noRules] the workflow has no assignment rule (graph.assignmentRules) \u2014 every workflow must say who becomes responsible"}),t;let r=jN(n.assignmentRules);if(r.length>0)return[...t,...r.map(o=>({de:o,en:o}))];let i=mm({nodes:Array.isArray(n.nodes)?n.nodes:[]});for(let o of U6(DN(n.assignmentRules),i))o.severity==="error"&&t.push(o.message);return t}s(VN,"workflowAssignmentIssues");function hm(e,n){let o=new Map;for(let d of e)o.set(d,0);let a=new Map,l=[];for(let d of e){if((o.get(d)??0)!==0)continue;let c=[{id:d,edges:n(d),idx:0}];for(o.set(d,1),a.set(d,null);c.length>0;){let u=c[c.length-1];if(u.idx>=u.edges.length){o.set(u.id,2),c.pop();continue}let{target:p,edge:h}=u.edges[u.idx];u.idx++;let y=o.get(p)??0;if(y===1){let b=[p],k=u.id;for(;k&&k!==p;)b.push(k),k=a.get(k)??null;b.reverse(),l.push({edge:h,source:u.id,target:p,cycle:b})}else y===0&&(o.set(p,1),a.set(p,u.id),c.push({id:p,edges:n(p),idx:0}))}}return l}s(hm,"detectBackEdges");var Yk="team:",H6=/^[a-z0-9][a-z0-9-]*$/;function J6(e){if(!e.startsWith(Yk))return null;let n=e.slice(Yk.length);return n.length>0?n:null}s(J6,"teamKeyOfMember");function gm(e){return`${Yk}${e}`}s(gm,"teamMember");function Ca(e){let n=e.channels;return n===void 0?[]:(Array.isArray(n)||M("graph.channels must be an array"),n)}s(Ca,"readAuthoredChannels");function BN(e){return[...vd(e)].sort()}s(BN,"derivedChannelTeamKeys");function UN(e,n){let t=e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"channel";if(!n.has(t))return t;for(let r=2;;r++){let i=`${t}-${r}`;if(!n.has(i))return i}}s(UN,"mintChannelKey");function GN(e,n){let t=e.channels;if(t===void 0)return[];if(!Array.isArray(t))return[{path:"channels",reason:{de:"[channels/shape] graph.channels muss eine Liste sein.",en:"[channels/shape] graph.channels must be a list."}}];let r=[],i=vd(e),o=new Set,a=new Map;return t.forEach((l,d)=>{let c=`channels[${d}]`,u=l;if(u===null||typeof u!="object"||typeof u.key!="string"||Mn(u.label)==="not-localized"||!Array.isArray(u.members)||!u.members.every($=>typeof $=="string")){r.push({path:c,reason:{de:"[channels/shape] Ein Kanal braucht key, label ({ de, en }) und members (Liste von Texten).",en:"[channels/shape] A channel needs key, label ({ de, en }) and members (a list of texts)."}});return}let p={de:`Kanal "${u.key}"`,en:`Channel "${u.key}"`};H6.test(u.key)||r.push({path:`${c}.key`,reason:{de:`[channels/invalidKey] ${p.de}: Schl\xFCssel nur aus Kleinbuchstaben, Ziffern und Bindestrich.`,en:`[channels/invalidKey] ${p.en}: key only from lowercase letters, digits and hyphens.`}}),o.has(u.key)&&r.push({path:`${c}.key`,reason:{de:`[channels/duplicateKey] ${p.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[channels/duplicateKey] ${p.en}: key is used twice.`}}),o.add(u.key);let h=Mn(u.label);if(h!=="not-localized"&&h.length===2?r.push({path:`${c}.label`,reason:{de:`[channels/emptyLabel] ${p.de}: Bezeichnung fehlt.`,en:`[channels/emptyLabel] ${p.en}: name is missing.`}}):h!=="not-localized"&&h.length>0&&r.push({path:`${c}.label`,reason:{de:`[i18n/missingTranslation] ${p.de}: Bezeichnung fehlt in: ${h.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${p.en}: name is missing in: ${h.join(", ")} \u2014 every displayed text needs German and English.`}}),u.members.length===0){r.push({path:`${c}.members`,reason:{de:`[channels/emptyMembers] ${p.de}: mindestens ein Team.`,en:`[channels/emptyMembers] ${p.en}: at least one team.`}});return}let y=[];for(let $ of u.members){let R=J6($);if(R===null){r.push({path:`${c}.members`,reason:{de:`[channels/invalidMember] ${p.de}: "${$}" ist kein "team:<schl\xFCssel>".`,en:`[channels/invalidMember] ${p.en}: "${$}" is not a "team:<key>".`}});continue}if(y.includes(R)){r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMember] ${p.de}: Team "${R}" ist doppelt genannt.`,en:`[channels/duplicateMember] ${p.en}: team "${R}" is named twice.`}});continue}n!==void 0&&!n.has(R)&&r.push({path:`${c}.members`,reason:{de:`[channels/unknownTeam] ${p.de}: Team "${R}" gibt es in diesem Mandanten nicht (oder es ist die Bewerbergruppe).`,en:`[channels/unknownTeam] ${p.en}: team "${R}" does not exist at this school (or it is the applicant group).`}}),y.push(R)}if(y.length===0)return;let b=[...y].sort().join("+"),[k]=y;y.length===1&&k!==void 0&&i.has(k)&&r.push({path:`${c}.members`,reason:{de:`[channels/duplicatesDerived] ${p.de}: Team "${k}" ist am Prozess beteiligt und hat seinen Kanal schon automatisch.`,en:`[channels/duplicatesDerived] ${p.en}: team "${k}" takes part in the process and already has its channel automatically.`}});let v=a.get(b);v!==void 0?r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMembership] ${p.de}: dieselben Teams wie Kanal "${v}" \u2014 zwei Tabs w\xE4ren derselbe Chat.`,en:`[channels/duplicateMembership] ${p.en}: the same teams as channel "${v}" \u2014 two tabs would be the same chat.`}}):a.set(b,u.key)}),r}s(GN,"channelIssues");var Hke=Object.freeze({});function zN(e,n){return Object.freeze(cm(no,e,n))}s(zN,"formContextEntries");function WN(e){return e.env??[]}s(WN,"declaredContextKeys");function Jk(e){return wd(e)}s(Jk,"isContextIdentifier");function Q6(e,n,t){let r=dm(no,e);if(r!==null)return{severity:"error",path:t,code:"env/unknownKey",message:r.message};let[,i=""]=e.split(".");return n.has(i)?null:{severity:"error",path:t,code:"env/undeclared",message:{de:`'${e}' liest den Umgebungsschl\xFCssel '${i}', den das Formular nicht in \`env\` deklariert.`,en:`'${e}' reads the environment key '${i}', which the form does not declare in \`env\`.`}}}s(Q6,"contextIdentifierIssue");var Hk=yp("stage.key");function Z6(e){let n=[],t=s(i=>i.kind==="ident"&&i.path===Hk,"isStageKey"),r=s(i=>{switch(i.kind){case"binary":if((i.op==="=="||i.op==="!=")&&(t(i.left)&&i.right.kind==="str"&&n.push(i.right.value),t(i.right)&&i.left.kind==="str"&&n.push(i.left.value)),i.op==="in"&&t(i.left)&&i.right.kind==="arr")for(let o of i.right.items)o.kind==="str"&&n.push(o.value);r(i.left),r(i.right);return;case"unary":r(i.operand);return;case"if":r(i.cond),r(i.then),r(i.else);return;case"call":i.args.forEach(r);return;case"arr":i.items.forEach(r);return;default:return}},"walk");return r(e),n}s(Z6,"stageKeyLiterals");function ym(e,n,t){return n===void 0?[]:Z6(e).filter(r=>!n.has(r)).map(r=>X6(r,n,t))}s(ym,"stageKeyAstIssues");function X6(e,n,t){let r=[...n].sort();return{severity:"error",path:t,code:"env/unknownStageKey",message:{de:`'${e}' ist kein Stufenschl\xFCssel des Programms dieses Angebots \u2014 `+(r.length>0?`bekannt: ${r.join(", ")}.`:"das Angebot hat kein Programm mit Stufen.")+` \`${Hk}\` ist der Bundle-Schl\xFCssel (\`program.stages[].key\`), nie das gespeicherte \`<program>-stufe-<key>\`.`,en:`'${e}' is not a stage key of the offer's program \u2014 `+(r.length>0?`known: ${r.join(", ")}.`:"the offer has no program with stages.")+` \`${Hk}\` is the bundle key (\`program.stages[].key\`), never the stored \`<program>-stufe-<key>\`.`}}}s(X6,"unknownStageKeyIssue");function YN(e,n,t){let r=[];for(let i of jn(e)){if(!Jk(i))continue;let o=Q6(i,n,t);o!==null&&r.push(o)}if(r.length>0)return r;for(let{identifier:i,op:o}of Uk(e,hp))r.push({severity:"error",path:t,code:"env/unguardedNullable",message:{de:`'${o}' \xFCber '${i}', das bei manchen Bewerbungen leer ist, braucht davor eine Absicherung '${i} != null &&' \u2014 lege fest, was ein leerer Wert bedeutet.`,en:`'${o}' over '${i}', which is empty for some applications, needs a guard '${i} != null &&' before it \u2014 say what an empty value means.`}});return r}s(YN,"contextAstIssues");function HN(e,n){let t=[...e3(e)];for(let r of e.env??[]){if(!to(r)){t.push({severity:"error",path:"env",code:"env/unknownKey",message:{de:`Der deklarierte Umgebungsschl\xFCssel '${r}' geh\xF6rt nicht zum Vokabular (${na.join(", ")}).`,en:`Declared environment key '${r}' is not in the vocabulary (${na.join(", ")}).`}});continue}n!==void 0&&!n.has(r)&&t.push({severity:"error",path:"env",code:"env/unsupplied",message:{de:`Das Formular deklariert den Umgebungsschl\xFCssel '${r}', aber sein Host liefert ihn nicht.`,en:`The form declares environment key '${r}', but its host does not supply it.`}})}return t}s(HN,"formContextIssues");function e3(e){let n=[];Object.hasOwn(e,"context")&&n.push({severity:"error",path:"context",code:"env/retiredField",message:{de:"`context` ist abgeschafft \u2014 ein Formular deklariert die gelesene Umgebung als `env`.",en:"`context` is retired \u2014 a form declares the environment it reads as `env`."}});let t=e.testScenarios;for(let r of Array.isArray(t)?t:[]){if(r===null||typeof r!="object")continue;let i=String(r.id);Object.hasOwn(r,"context")&&n.push({severity:"error",path:`scenario:${i}/context`,code:"env/retiredField",message:{de:"`context` ist abgeschafft \u2014 ein Szenario belegt keine Umgebung; die liefert der Testmodus.",en:"`context` is retired \u2014 a scenario samples no environment; test mode supplies it."}}),Object.hasOwn(r,"env")&&n.push({severity:"error",path:`scenario:${i}/env`,code:"env/retiredField",message:{de:`Szenario '${i}' belegt eine Umgebung (\`env\`) \u2014 das ist abgeschafft: ein Szenario passt auf jede Umgebung des Angebots, die liefert der Testmodus. \`plexus-cli offer upgrade\` entfernt es.`,en:`Scenario '${i}' samples an environment (\`env\`) \u2014 retired: a scenario fits every environment of the offer, test mode supplies it. \`plexus-cli offer upgrade\` removes it.`}})}return n}s(e3,"retiredContextFields");function wm(e,n,t){let r=pm(e,n).filter(o=>o.severity==="error").map(o=>o.message);if(r.length>0)return r;let i=[];if(t?.liveEnvKeys!==void 0)for(let o of Bk(e,n)){let a=_N(o.path,t.liveEnvKeys);a===null&&M(`[condition] no live-key universe for '${o.path}' \u2014 extend liveKeyUniverse`),a.has(o.value)||i.push({de:`$env.${o.path} == '${o.value}' nennt keinen Schl\xFCssel dieses Mandanten.`,en:`$env.${o.path} == '${o.value}' names no key of this school.`})}for(let o of ym(Kn(e),t?.stageKeys,""))i.push({de:`[${o.code}] ${o.message.de}`,en:`[${o.code}] ${o.message.en}`});return i}s(wm,"envConditionFindings");function km(e){return e.kind==="entered"&&!e.repeated&&e.reviewRequired}s(km,"isReviewField");function Pa(e){let n=[],t=[];function r(k,v){try{return Kn(k)}catch($){n.push({path:v,src:k,reason:$ instanceof Error?$.message:String($)});return}}s(r,"tryParse");function i(k,v){return{...k,visibleIf:k.visibleIf?r(k.visibleIf,`${v}.visibleIf`):void 0,requiredIf:k.requiredIf?r(k.requiredIf,`${v}.requiredIf`):void 0,disabledIf:k.disabledIf?r(k.disabledIf,`${v}.disabledIf`):void 0,defaultValue:k.defaultValue?r(k.defaultValue,`${v}.defaultValue`):void 0}}s(i,"compileField");function o(k,v){return{...k,visibleIf:k.visibleIf?r(k.visibleIf,`${v}.visibleIf`):void 0,fields:k.fields.map(($,R)=>i($,`${v}.fields[${R}]`))}}s(o,"compileGroup");function a(k,v){return{...k,itemTemplate:k.itemTemplate.map(($,R)=>i($,`${v}.itemTemplate[${R}]`)),effects:k.effects?.map(($,R)=>d($,`${v}.effects[${R}]`)),itemVisibleIf:k.itemVisibleIf?r(k.itemVisibleIf,`${v}.itemVisibleIf`):void 0}}s(a,"compileRepeated");function l(k,v){let $=[];return k.fields.forEach((R,I)=>{if(R.externalFlag){t.push({key:R.key,label:R.label,defaultValue:R.defaultValue?r(R.defaultValue,`${v}.fields[${I}].defaultValue`):void 0});return}$.push(i(R,`${v}.fields[${I}]`))}),{...k,visibleIf:k.visibleIf?r(k.visibleIf,`${v}.visibleIf`):void 0,fields:$,groups:k.groups?.map((R,I)=>o(R,`${v}.groups[${I}]`)),computed:k.computed?.map((R,I)=>{let D=r(R.expression,`${v}.computed[${I}].expression`);return{key:R.key,expression:D??{kind:"null"}}}),subsections:k.subsections?.map((R,I)=>l(R,`${v}.subsections[${I}]`)),repeated:k.repeated?.map((R,I)=>a(R,`${v}.repeated[${I}]`)),validators:k.validators}}s(l,"compileSection");function d(k,v){return{...k,when:k.when?r(k.when,`${v}.when`):void 0}}s(d,"compileEffect");function c(k,v){let $=r(k.when,`${v}.when`);return $?{...k,when:$}:null}s(c,"compileOutcome");let u=e.sections.map((k,v)=>l(k,`sections[${v}]`)),p=(e.effects??[]).map((k,v)=>d(k,`effects[${v}]`)),h=[],y=e.outcomes??[];for(let k=0;k<y.length;k++){let v=y[k],$=c(v,`outcomes[${k}]`);$&&h.push($)}return{compiled:{...e,sections:u,effects:p,outcomes:h,flags:t},errors:n}}s(Pa,"compileForm");var n3=new Set(["decision","review","governedDocument"]);function QN(e){return n3.has(e.type)&&!(e.type==="governedDocument"&&e.production==="none")}s(QN,"isReadinessGatedNode");function t3(e){let n=new Map,t=i3(e),r=s((i,o)=>{let a=Qk(o),l=[...i.fields,...(i.groups??[]).flatMap(d=>d.fields)];for(let d of l)d.externalFlag!==!0&&n.set(d.key,{kind:"entered",key:d.key,label:d.label,qualifier:r3(d.bucket,t,a),section:a,type:d.type,enumSource:JN(d),repeated:!1,reviewRequired:d.reviewRequired===!0});for(let d of i.repeated??[])for(let c of d.itemTemplate){let u=`${d.key}.${c.key}`;n.set(u,{kind:"entered",key:u,label:c.label,qualifier:Qk(d),section:a,type:c.type,enumSource:JN(c),repeated:!0,reviewRequired:!1})}for(let d of i.computed??[]){let c=jn(Kn(d.expression));n.set(d.key,{kind:"computed",key:d.key,label:d.label??{de:d.key,en:d.key},qualifier:a,deps:c})}for(let d of i.subsections??[])r(d,o)},"visit");for(let i of e.sections)r(i,i);return n}s(t3,"formFieldCatalog");function JN(e){return e.type==="enum"?e:null}s(JN,"enumSourceOf");function r3(e,n,t){return e===void 0?t:n.get(e)??t}s(r3,"fieldQualifier");function i3(e){let n=new Map,t=s((r,i)=>{i===void 0||n.has(r)||n.set(r,Qk(i))},"add");for(let r of XN(e))r.kind==="person"?t(r.bucket,r.display):r.kind==="organization"&&t(r.id.replace(/^o\./,""),r.display);return n}s(i3,"bucketWordings");function ZN(e){return e.flatMap(n=>[n,...ZN(n.subsections??[])])}s(ZN,"allSections");function XN(e){return[...e.effects,...ZN(e.sections).flatMap(n=>(n.repeated??[]).flatMap(t=>t.effects??[]))]}s(XN,"allEffects");function Qk(e){return{label:e.label}}s(Qk,"wordingOf");function eD(e){return id(e).flatMap(({slot:n,address:t})=>{let r=oC(t);return r===null||rd.includes(r.path)?[]:[{slotId:n,owner:r.owner,fieldKey:r.path}]})}s(eD,"admissionBindingLeaves");function o3(e,n){let t=e.get(n);if(t===void 0)return null;let r=[],i=new Set,o=s(a=>{if(!i.has(a.key)&&(i.add(a.key),r.push({fieldKey:a.key,kind:a.kind}),a.kind==="computed"))for(let l of a.deps){let d=e.get(l);d!==void 0&&o(d)}},"walk");return o(t),r}s(o3,"expandKey");function s3(e){let n=new Set;for(let t of XN(e))if(!(t.kind!=="person"||t.contractParty===void 0)&&t.when!==void 0)for(let r of jn(Kn(t.when)))n.add(r);return[...n]}s(s3,"contractPartyConditionKeys");function a3(e){return Pa(e).compiled.flags.map(n=>({key:n.key,name:n.label}))}s(a3,"formExternalFlags");function nD(e){return{readinessFormFieldsByFormNode:new Map([...e].map(([n,t])=>[n,t3(t)])),readinessPartyConditionKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set(s3(t))])),formFlagKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set(a3(t).map(r=>r.key))])),formViewKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set((t.views??[]).map(r=>r.key))]))}}s(nD,"readinessUniverse");function Zk(e,n){let t=new Set;for(let r of n)for(let i of o3(e,r)??[])i.kind==="entered"&&t.add(i.fieldKey);return t}s(Zk,"enteredFieldsBehind");var l3=new Set(["label","sublabel","title","description","body","chipLabel","nextAction","confirmLabel","placeholder","helpText","subject","heading","hint","notice","reason"]);function d3(e){return l3.has(e)?!0:tD(e)?!1:/(Label|Title|Body|Description|Text|Hint|Heading|Placeholder)$/.test(e)}s(d3,"isTextKey");function tD(e){return/^localized[A-Z]/.test(e)}s(tD,"isLegacyTwinKey");var c3=new Set(["titles","responseLabels","outputLabels","enumOptionLabels"]),u3=new Set(["inputs","resolver","library"]);function vm(e,n){let t=[];return Xk(e,n,t),t}s(vm,"findUnlocalizedTexts");function Xk(e,n,t){if(Array.isArray(e)){e.forEach((i,o)=>Xk(i,`${n}[${p3(i,o)}]`,t));return}if(e===null||typeof e!="object")return;let r=e;for(let[i,o]of Object.entries(r)){let a=`${n}.${i}`;if(!u3.has(i)){if(tD(i)){t.push({path:a,missing:"legacy-twin"});continue}if(d3(i)){f3(o,a,t);continue}if(c3.has(i)&&o!==null&&typeof o=="object"){for(let[l,d]of Object.entries(o))d!==void 0&&rD(d,`${a}.${l}`,t);continue}Xk(o,a,t)}}}s(Xk,"walk");function f3(e,n,t){e!=null&&rD(e,n,t)}s(f3,"checkText");function rD(e,n,t){let r=Mn(e);(r==="not-localized"||r.length>0)&&t.push({path:n,missing:r})}s(rD,"report");function p3(e,n){if(e!==null&&typeof e=="object"){let t=e;if(typeof t.id=="string")return t.id;if(typeof t.key=="string")return t.key}return String(n)}s(p3,"keyOf");function bm(e,n){return e==="not-localized"?n==="de"?"ist kein zweisprachiger Text ({ de, en })":"is not a bilingual text ({ de, en })":e==="legacy-twin"?n==="de"?'ist ein Zwilling der alten Form \u2014 der Text geh\xF6rt in das Feld ohne \u201Elocalized"':'is a twin of the old shape \u2014 the text belongs in the field without "localized"':n==="de"?`fehlt in: ${e.join(", ")}`:`is missing in: ${e.join(", ")}`}s(bm,"describe");function eb({path:e,missing:n}){return n==="legacy-twin"?{de:`[i18n/legacyTwin] ${e} ${bm(n,"de")}.`,en:`[i18n/legacyTwin] ${e} ${bm(n,"en")}.`}:{de:`[i18n/missingTranslation] ${e} ${bm(n,"de")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch; die Sprache folgt dem Konto des Lesenden.`,en:`[i18n/missingTranslation] ${e} ${bm(n,"en")} \u2014 every displayed text needs German and English; the language follows the reader's account.`}}s(eb,"unlocalizedTextReason");var m3={engagePush:["engage"]};function h3(e){let n=m3[e.type];return n===void 0?e:Object.fromEntries(Object.entries(e).filter(([t])=>!n.includes(t)))}s(h3,"withoutMachineData");function iD(e,n){return[...vm(e.nodes.map(h3),"nodes"),...n===void 0?[]:vm(n,`layout.${n.id}`)].map(r=>({layer:"GRAPH",kind:"i18n",path:r.path,reason:eb(r),severity:"error"}))}s(iD,"checkLocalizedTexts");var g3="optionalAction:";function oD(e){return`${g3}${e}:trigger`}s(oD,"optionalActionTriggerActionId");var y3="processDecide";function sD(e){let n=e.optionalActions;return n==null?[]:(Array.isArray(n)||M(`[optionalAction/corrupt-section] node's 'optionalActions' is ${typeof n}, not an array \u2014 corrupt pinned graph (publish stores the section as authored)`),n)}s(sD,"optionalActionBindings");function aD(e){return sD(e).map(n=>({id:oD(n.key),kind:"internal",label:n.label,surface:y3,placement:"overflow",superUserOnly:!0}))}s(aD,"optionalActionTriggers");function lD(e){let n=e.tasks;return Array.isArray(n)?n:[]}s(lD,"authoredTemplates");function dD(e){let n=e?.result;return n?.kind!=="appointment"?[]:n.participants?.feedback?.tasks??[]}s(dD,"personTasksOf");function nb(e){let n=lD(e);return sD(e).map(t=>{let r=new Set(t.tasks??[]),i=new Set;for(let o of r)for(let a of dD(n.find(l=>l.key===o)))i.add(a);return{binding:t,tasks:r,personTasks:i,keys:new Set([...r,...i])}})}s(nb,"optionalActionMembership");function w3(e){let n=new Set;for(let t of lD(e))for(let r of dD(t))n.add(r);return n}s(w3,"personRowTemplateKeys");function cD(e){let n=new Set(w3(e));for(let{keys:t}of nb(e))for(let r of t)n.add(r);return n}s(cD,"referencedTaskTemplateKeys");var Ir={shape:"[taskInput/shape]",notInRound:"[taskInput/notInRound]",notRecord:"[taskInput/notRecord]",prefillNotDeclared:"[taskInput/prefillNotDeclared]",prefillType:"[taskInput/prefillType]",feedbackTasks:"[appointment/feedbackTasks]",feedbackOptional:"[appointment/feedbackOptional]",recordAssignment:"[taskResult/recordAssignment]"},tb=60;function Na(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${n} ${t.de}`,en:`${n} ${t.en}`},severity:"error"}}s(Na,"error");function os(e){return Array.isArray(e.tasks)?e.tasks:[]}s(os,"tasksOf");function uD(e){return(Array.isArray(e.optionalActions)?e.optionalActions:[]).filter(t=>t.action==="spawnTasks")}s(uD,"spawnBindingsOf");function xd(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}s(xd,"stringList");function oi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(oi,"record");function ib(e){let n=oi(e?.result);return n?.kind==="appointment"?oi(n.participants):null}s(ib,"participantsOf");function rb(e){return xd(oi(ib(e)?.feedback)?.tasks)}s(rb,"feedbackTasksOf");function fD(e,n){return nb(e).find(t=>t.keys.has(n))}s(fD,"roundOf");function k3(e,n,t){let r=s(u=>({code:Ir.notInRound,reason:u}),"notInRound"),i=fD(e,n);if(i===void 0)return r({de:`Aufgabe "${n}" geh\xF6rt zu keiner optionalen Aktion \u2014 Vorgaben liest nur eine Aufgabe einer Runde.`,en:`Task "${n}" belongs to no optional action \u2014 only a task of a round reads inputs.`});if(t.scope!=="task"||t.path!==void 0)return r({de:`${ue(t)} ist kein Wert einer Aufgabe ($task.<aufgabe>.<schl\xFCssel>).`,en:`${ue(t)} is no value of a task ($task.<task>.<key>).`});let{binding:o}=i,a=t.owner;if(a===n)return r({de:`Aufgabe "${n}" liest ihren eigenen Wert.`,en:`Task "${n}" reads its own value.`});let l=os(e).find(u=>u.key===a),d=oi(l?.blocks),c=i.tasks.has(a)&&d?.templateKey===n&&(d.node===void 0||d.node===e.id);return a!==o.input&&!c?r({de:`"${a}" ist weder die Eingabe der Aktion "${o.key}" noch eine ihrer Aufgaben, die "${n}" per 'blocks' zur\xFCckh\xE4lt \u2014 der Wert st\xFCnde nicht fest, wenn die Aufgabe \xF6ffnet.`,en:`"${a}" is neither the input of the action "${o.key}" nor one of its tasks that holds "${n}" through 'blocks' \u2014 the value would not be settled when the task opens.`}):oi(l?.result)?.kind!=="record"?{code:Ir.notRecord,reason:{de:`"${a}" hat kein Ergebnis vom Typ 'record' \u2014 Vorgaben sind Felder einer Eingabe.`,en:`"${a}" has no result of kind 'record' \u2014 inputs are fields of an input task.`}}:null}s(k3,"taskInputRefusal");function b3(e,n){if(n.scope!=="task")return;let t=os(e).find(i=>i.key===n.owner),r=oi(t?.result);if(r?.kind==="record")return(Array.isArray(r.fields)?r.fields:[]).map(oi).find(i=>i?.writes===n.key)??void 0}s(b3,"writerField");function v3(e,n,t){let r=String(n.key);if(n.inputs===void 0)return[];if(!Array.isArray(n.inputs))return[Na(`${t}.inputs`,Ir.shape,{de:"'inputs' ist eine Liste von Adressen.",en:"'inputs' is a list of addresses."})];let i=[],o=new Set;for(let[a,l]of n.inputs.entries()){if(!ke(l))continue;let d=ue(l);if(o.has(d)){i.push(Na(`${t}.inputs.${a}`,Ir.shape,{de:`${d} steht zweimal in 'inputs'.`,en:`${d} is listed twice in 'inputs'.`}));continue}o.add(d);let c=k3(e,r,l);c!==null&&i.push(Na(`${t}.inputs.${a}`,c.code,c.reason))}return i}s(v3,"inputIssues");function x3(e,n,t,r){let i=t;if(VP(r))return rb(i).length===1?null:{code:Ir.prefillType,reason:{de:"Ein Team belegt nur vor, wenn 'feedback.tasks' genau eine Feedback-Art nennt \u2014 sonst w\xE4re offen, wer welche Art gibt.",en:"A team prefills only when 'feedback.tasks' names exactly one feedback kind \u2014 otherwise who gives which kind would be open."}};let o=Array.isArray(i.inputs)?i.inputs.filter(ke).map(ue):[];if(!ke(r)||!o.includes(ue(r)))return{code:Ir.prefillNotDeclared,reason:{de:"Die Vorbelegung der Teilnehmenden ist keine der Vorgaben ('inputs') der Aufgabe.",en:"The participants' prefill is none of the task's inputs ('inputs')."}};let a=s(c=>({code:Ir.prefillType,reason:c}),"prefillType"),l=rb(i),d=td(e,r);if(d===void 0)return null;if(ft(d)==="staffUser")return l.length===1?null:a({de:"Eine Personenliste belegt nur vor, wenn 'feedback.tasks' genau eine Feedback-Art nennt \u2014 sonst w\xE4re offen, wer welche Art gibt.",en:"A list of persons prefills only when 'feedback.tasks' names exactly one feedback kind \u2014 otherwise who gives which kind would be open."});if(d==="taskAssignment"){let u=xd(b3(n,r)?.tasks).filter(p=>!l.includes(p));return u.length===0?null:a({de:`Die Zuordnung ordnet ${u.map(p=>`"${p}"`).join(", ")} zu, die 'feedback.tasks' nicht nennt.`,en:`The assignment assigns ${u.map(p=>`"${p}"`).join(", ")}, which 'feedback.tasks' does not name.`})}return a({de:`Vorbelegt werden Teilnehmende nur aus Personen ('person') oder einer Zuordnung ('assignment'), nicht aus "${d}".`,en:`Participants are prefilled only from persons ('person') or an assignment ('assignment'), not from "${d}".`})}s(x3,"participantPrefillRefusal");function S3(e,n,t,r){let i=ib(t)?.prefill;if(i===void 0)return[];let o=x3(e,n,t,i);return o===null?[]:[Na(`${r}.result.participants.prefill`,o.code,o.reason)]}s(S3,"prefillIssues");function A3(e,n){return uD(e).some(t=>xd(t.tasks).includes(n))}s(A3,"belongsToOptionalAction");function T3(e,n,t){let r=n.key,i=os(e).find(c=>c.key===t),o=s(c=>({code:Ir.feedbackTasks,reason:c}),"feedbackTasks");if(i===void 0)return[o({de:`"${t}" ist keine Aufgabe dieses Knotens.`,en:`"${t}" is no task of this node.`})];let a=[];i.feedback!==!0&&a.push(o({de:`"${t}" ist keine Feedback-Aufgabe ('feedback: true').`,en:`"${t}" is no feedback task ('feedback: true').`})),uD(e).some(c=>xd(c.tasks).includes(t))&&a.push(o({de:`"${t}" steht in den Aufgaben einer optionalen Aktion \u2014 eine Personenzeile entsteht nur beim Buchen.`,en:`"${t}" is among an optional action's tasks \u2014 a person row exists only through a booking.`}));let l=os(e).find(c=>c.key!==r&&rb(c).includes(t));l!==void 0&&a.push(o({de:`"${t}" wird auch von "${String(l.key)}" angelegt \u2014 jede Feedback-Art geh\xF6rt zu genau einem Termin.`,en:`"${t}" is also created by "${String(l.key)}" \u2014 each feedback kind belongs to exactly one appointment.`}));let d=["when","blocks"].filter(c=>i[c]!==void 0);return d.length>0&&a.push(o({de:`"${t}" tr\xE4gt ${d.map(c=>`'${c}'`).join(", ")} \u2014 eine Personenzeile entsteht nur beim Buchen und h\xE4lt nur ihre Runde.`,en:`"${t}" carries ${d.map(c=>`'${c}'`).join(", ")} \u2014 a person row exists only through a booking and holds only its round.`})),i.optional!==void 0&&a.push({code:Ir.feedbackOptional,reason:{de:`"${t}" ist optional \u2014 eine Personenzeile h\xE4lt ihre Runde und damit die Pause, sie kann nicht \xFCbersprungen werden.`,en:`"${t}" is optional \u2014 a person row holds its round and with it the pause; it cannot be skipped.`}}),a}s(T3,"participantFeedbackRefusals");function R3(e,n,t){let r=ib(n);if(r===null||r.feedback===void 0)return[];let i=String(n.key),o=`${t}.result.participants.feedback`,a=oi(r.feedback),l=a?.tasks,d=[],c=s((p,h,y=Ir.feedbackTasks)=>d.push(Na(p,y,h)),"fail");if(!Array.isArray(l)||l.length===0||l.some(p=>typeof p!="string")||new Set(l).size!==l.length)return c(`${o}.tasks`,{de:"'feedback.tasks' nennt mindestens eine Feedback-Aufgabe, jede einmal.",en:"'feedback.tasks' names at least one feedback task, each once."}),d;let u=a?.dueDaysAfterEnd;(typeof u!="number"||!Number.isInteger(u)||u<0||u>tb)&&c(`${o}.dueDaysAfterEnd`,{de:`'feedback.dueDaysAfterEnd' ist eine ganze Zahl von 0 bis ${tb}.`,en:`'feedback.dueDaysAfterEnd' is a whole number from 0 to ${tb}.`}),A3(e,i)||c(o,{de:`Aufgabe "${i}" legt Personenzeilen an, geh\xF6rt aber zu keiner optionalen Aktion \u2014 Personenzeilen geh\xF6ren zur Runde einer Aktion.`,en:`Task "${i}" creates person rows but belongs to no optional action \u2014 person rows belong to an action's round.`});for(let p of l)for(let h of T3(e,n,p))c(`${o}.tasks`,h.reason,h.code);return d}s(R3,"feedbackIssues");function $3(e,n){let t=fD(e,n)?.personTasks??new Set;return os(e).filter(r=>r.feedback===!0&&typeof r.key=="string"&&t.has(r.key)).map(r=>r.key)}s($3,"assignableFeedbackTasks");function E3(e,n,t){let r=oi(n.result);if(r?.kind!=="record"||!Array.isArray(r.fields))return[];let i=$3(e,String(n.key)),o=new Map(os(e).map(l=>[l.key,l])),a=[];for(let[l,d]of r.fields.entries()){let c=oi(d);if(c?.type!=="assignment")continue;let u=xd(c.tasks).filter(p=>o.get(p)?.feedback===!0&&!i.includes(p));u.length!==0&&a.push(Na(`${t}.result.fields.${l}.tasks`,Ir.recordAssignment,{de:`Feld "${String(c.key)}": ${u.map(p=>`"${p}"`).join(", ")} legt kein Termin derselben optionalen Aktion an ('participants.feedback.tasks') \u2014 die Zuordnung h\xE4tte keine Zeile, die sie erh\xE4lt.`,en:`Field "${String(c.key)}": ${u.map(p=>`"${p}"`).join(", ")} is created by no appointment of the same optional action ('participants.feedback.tasks') \u2014 the assignment would have no row to receive it.`}))}return a}s(E3,"assignmentIssues");function pD(e,n){let t=[];for(let r of os(n)){if(typeof r.key!="string")continue;let i=`nodes.${n.id}.tasks.${r.key}`;t.push(...v3(n,r,i)),t.push(...S3(e,n,r,i)),t.push(...R3(n,r,i)),t.push(...E3(n,r,i))}return t}s(pD,"taskInputIssues");var Pt={notOptionalAction:"[workItems/familyRequestNotOptionalAction]",notTask:"[workItems/familyRequestNotTask]",closedOtherwise:"[workItems/familyRequestClosedOtherwise]",blocks:"[workItems/familyRequestBlocks]",noDeadline:"[workItems/familyRequestNoDeadline]",fields:"[workItems/familyRequestFields]",unknownField:"[workItems/familyRequestUnknownField]",shape:"[workItems/familyRequestShape]",twicePerAction:"[workItems/familyRequestTwicePerAction]",deadlock:"[workItems/familyRequestOnlyWayButAsked]"};function Nt(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${n} ${t.de}`,en:`${n} ${t.en}`},severity:"error"}}s(Nt,"issue");function I3(e,n,t){return e.flatMap(r=>(Array.isArray(r.tasks)?r.tasks:[]).filter(i=>{let o=i.blocks,a=typeof o?.node=="string"?o.node:r.id;return o?.templateKey===t&&a===n}).map(i=>({nodeId:r.id,key:String(i.key)})))}s(I3,"blockersOf");function mD(e){let{graph:n,node:t,task:r}=e,i=r.familyRequest;if(i===void 0)return[];let o=typeof r.key=="string"?r.key:"?",a=`nodes.${t.id}.tasks.${o}`,l={de:`Task "${o}" auf Knoten \u201E${Pe(n,t.id,"de")}\u201C (${t.id})`,en:`Task "${o}" on node "${Pe(n,t.id,"en")}" (${t.id})`},d=[];if(typeof i!="object"||i===null||Array.isArray(i))return[Nt(`${a}.familyRequest`,Pt.shape,{de:`${l.de}: 'familyRequest' muss ein Objekt { fields } oder { from } sein.`,en:`${l.en}: 'familyRequest' must be an object { fields } or { from }.`})];let c=Object.keys(i).filter(b=>b!=="fields"&&b!=="from");c.length>0&&d.push(Nt(`${a}.familyRequest.${c[0]}`,Pt.shape,{de:`${l.de}: 'familyRequest' kennt nur 'fields' oder 'from', nicht ${c.map(b=>`'${b}'`).join(", ")} \u2014 was angefordert wird und der Text an die Familie werden beim Ausl\xF6sen gew\xE4hlt.`,en:`${l.en}: 'familyRequest' only knows 'fields' or 'from', not ${c.map(b=>`'${b}'`).join(", ")} \u2014 what is requested and the text to the family are chosen when the action is triggered.`}));let{fields:u,from:p}=i;u===void 0==(p===void 0)&&d.push(Nt(`${a}.familyRequest`,Pt.shape,{de:`${l.de}: 'familyRequest' nennt genau eines \u2014 'fields' (die anforderbaren Felder) oder 'from' (das Formular, dessen Dateifelder alle zur Wahl stehen).`,en:`${l.en}: 'familyRequest' names exactly one \u2014 'fields' (the fields that can be requested) or 'from' (the form whose file fields are all available).`})),e.onTrigger.has(o)||d.push(Nt(`${a}.familyRequest`,Pt.notOptionalAction,{de:`${l.de} fordert bei der Familie an, geh\xF6rt aber zu keiner optionalen Aktion (spawnTasks) \u2014 nur deren Ausl\xF6sen \xF6ffnet die Anfrage an die Familie.`,en:`${l.en} requests from the family but belongs to no optional action (spawnTasks) \u2014 only triggering one opens the request to the family.`})),r.kind!=="task"&&d.push(Nt(`${a}.kind`,Pt.notTask,{de:`${l.de} fordert bei der Familie an und muss die Art 'task' haben, nicht ${JSON.stringify(r.kind)}.`,en:`${l.en} requests from the family and must have the kind 'task', not ${JSON.stringify(r.kind)}.`}));for(let b of["result","when","locksEvidence","gatesNode"])r[b]!==void 0&&d.push(Nt(`${a}.${b}`,Pt.closedOtherwise,{de:`${l.de} wartet auf die Familie und erledigt sich mit ihrer Antwort \u2014 '${b}' passt nicht dazu.`,en:`${l.en} waits for the family and completes with their answer \u2014 '${b}' does not fit that.`}));r.blocks!==void 0&&d.push(Nt(`${a}.blocks`,Pt.blocks,{de:`${l.de} wartet auf die Familie und darf nichts zur\xFCckhalten ('blocks') \u2014 sie h\xE4lt ihren Knoten schon als Aufgabe einer optionalen Aktion.`,en:`${l.en} waits for the family and must not hold anything back ('blocks') \u2014 as the task of an optional action it already holds its node.`}));for(let b of I3(n.nodes,t.id,o))d.push(Nt(`nodes.${b.nodeId}.tasks.${b.key}.blocks`,Pt.blocks,{de:`Task "${b.key}" auf Knoten "${b.nodeId}" h\xE4lt ${l.de} zur\xFCck \u2014 eine Nachforderung darf nie zur\xFCckgehalten werden: zur\xFCckgehalten h\xE4tte sie keine Frist und k\xF6nnte mit der Antwort der Familie nicht erledigt werden.`,en:`Task "${b.key}" on node "${b.nodeId}" holds back ${l.en} \u2014 a follow-up request must never be held back: held back, it would have no deadline and could not be completed by the family's answer.`}));let h=r.params?.dueInDays;if((typeof h!="number"||!Number.isInteger(h)||h<1)&&d.push(Nt(`${a}.params.dueInDays`,Pt.noDeadline,{de:`${l.de} fordert bei der Familie an und braucht eine Frist in ganzen Tagen ('params.dueInDays' \u2265 1) \u2014 sie ist die Frist der Familie und Anlass der Erinnerung.`,en:`${l.en} requests from the family and needs a deadline in whole days ('params.dueInDays' \u2265 1) \u2014 it is the family's deadline and the reason for the reminder.`})),u===void 0)return d;if(!Array.isArray(u)||u.length===0)return d.push(Nt(`${a}.familyRequest.fields`,Pt.fields,{de:`${l.de}: 'familyRequest.fields' muss mindestens ein Feld eines Formulars nennen \u2014 oder statt dessen 'from' das Formular, dann stehen alle seine Dateifelder zur Wahl.`,en:`${l.en}: 'familyRequest.fields' must name at least one field of a form \u2014 or 'from' the form instead, then all its file fields are available.`})),d;let y=new Set;for(let b of u){if(!ke(b))continue;let k=ue(b);if(y.has(k)){d.push(Nt(`${a}.familyRequest.fields`,Pt.fields,{de:`${l.de}: 'familyRequest.fields' nennt ${Ue(n,b,"de")} mehrfach.`,en:`${l.en}: 'familyRequest.fields' names ${Ue(n,b,"en")} more than once.`}));continue}y.add(k),mn(b)||d.push(Nt(`${a}.familyRequest.fields`,Pt.unknownField,{de:`${l.de}: 'familyRequest.fields' nennt ${Ue(n,b,"de")} \u2014 anfordern l\xE4sst sich nur ein Feld eines Formulars ($node.<formular>.admission.<feld>).`,en:`${l.en}: 'familyRequest.fields' names ${Ue(n,b,"en")} \u2014 only a field of a form ($node.<form>.admission.<field>) can be requested.`}))}return d}s(mD,"familyRequestIssues");function hD(e){let n=new Set((Array.isArray(e.tasks)?e.tasks:[]).flatMap(r=>r.familyRequest!==void 0&&typeof r.key=="string"?[r.key]:[]));return(Array.isArray(e.optionalActions)?e.optionalActions:[]).flatMap((r,i)=>{if(r.action!=="spawnTasks"||!Array.isArray(r.tasks))return[];let o=r.tasks.filter(a=>typeof a=="string"&&n.has(a));return o.length<=1?[]:[Nt(`nodes.${e.id}.optionalActions.${i}.tasks`,Pt.twicePerAction,{de:`Optionale Aktion \u201E${String(r.key)}\u201C auf Knoten "${e.id}" startet ${o.length} Nachforderungen (${o.join(", ")}) \u2014 ein Ausl\xF6sen fragt die Familie nach EINER Sache; h\xF6chstens eine Nachforderung je Aktion.`,en:`Optional action "${String(r.key)}" on node "${e.id}" starts ${o.length} follow-up requests (${o.join(", ")}) \u2014 one trigger asks the family for ONE thing; at most one follow-up request per action.`})]})}s(hD,"familyRequestActionIssues");function gD(e,n){let t=e.nodes,r=new Map;for(let a of t)if(!(a.type!=="completenessCheck"||!Array.isArray(a.requires)))for(let l of a.requires)mn(l)&&r.set(ue(l),l);if(r.size===0)return[];let i=s(a=>{let l=ri(n,a);return l===void 0||l!==null&&l.kind==="entered"&&l.type==="docRef"},"isFileField"),o=s(a=>{let{fields:l,from:d}=a??{};return Array.isArray(l)?l.filter(mn):!ke(d)||d.scope!=="node"?[]:[...r.values()].filter(c=>c.owner===d.owner&&i(c))},"offeredBy");return t.flatMap(a=>{let l=Array.isArray(a.requiresOneOf)?a.requiresOneOf:[],c=(Array.isArray(a.optionalActions)?a.optionalActions:[]).filter(h=>l.includes(h.key)),u=Array.isArray(a.tasks)?a.tasks:[];return c.filter(h=>Array.isArray(h.tasks)&&c.every(y=>y===h||y.when!==void 0)).flatMap(h=>u.flatMap(y=>{if(y.familyRequest===void 0||!h.tasks.includes(y.key))return[];let b=o(y.familyRequest).filter(k=>r.has(ue(k)));return b.length===0?[]:[{...Nt(`nodes.${a.id}.requiresOneOf`,Pt.deadlock,{de:`Auf Knoten \u201E${Pe(e,a.id,"de")}\u201C (${a.id}) ist die Nachforderung \u201E${String(h.key)}\u201C der einzige Weg durch 'requiresOneOf', und eine Vollst\xE4ndigkeitspr\xFCfung fragt dieselben Felder an (${b.map(k=>Ue(e,k,"de")).join(", ")}). Ist deren Anfrage offen, lassen sich diese Felder nicht nachfordern \u2014 die Entscheidung bliebe gesperrt. Eine zweite Aktion in 'requiresOneOf' oder andere Felder l\xF6sen das.`,en:`On node "${Pe(e,a.id,"en")}" (${a.id}) the follow-up request "${String(h.key)}" is the only way through 'requiresOneOf', and a completeness check asks for the same fields (${b.map(k=>Ue(e,k,"en")).join(", ")}). While its request is open, these fields cannot be requested \u2014 the decision would stay locked. A second action in 'requiresOneOf' or other fields solve this.`}),severity:"warning"}]}))})}s(gD,"familyRequestDeadlockWarnings");var ob={key:!0,kind:!0,title:!0,assign:!0,gatesNode:!0,blocks:!0,completableIf:!0,result:!0,when:!0,onConditionReturn:!0,reads:!0,locksEvidence:!0,feedback:!0,description:!0,documents:!0,view:!0,familyRequest:!0,optional:!0,inputs:!0,params:!0},sb={appointment:s((e,n)=>({de:`Aufgabe "${e}" an ${n.de}: \`appointment\` (Terminaufgabe) gibt es nicht mehr \u2014 ein Termin hat keine Leitung, die sie hielte. Was die Teilnehmenden nach dem Termin festhalten, ist je Person eine R\xFCckmeldung (\`result.participants.feedback\` der Terminvereinbarung).`,en:`Task "${e}" on ${n.en}: \`appointment\` (appointment task) no longer exists \u2014 an appointment has no lead to hold it. What the participants record after the appointment is one feedback per person (\`result.participants.feedback\` of the booking task).`}),"appointment")};function O3(e){let n=Qe(e);return new Map((typeof n.workItemTemplates=="function"?n.workItemTemplates(e):[]).map(t=>[t.key,t]))}s(O3,"intrinsicTemplatesOf");function yD(e,n,t){if(t!==void 0&&typeof t!="string")return null;let r=t??n,i=e.nodes.find(l=>l.id===r);if(i===void 0)return null;let o=i,a=Qe(i);return{node:o,composedKeys:new Set((Array.isArray(o.tasks)?o.tasks:[]).map(l=>l.key).filter(l=>typeof l=="string")),intrinsicByKey:O3(i),refuse:s(l=>typeof a.refuseBlocksTarget=="function"?a.refuseBlocksTarget(i,l):null,"refuse")}}s(yD,"resolveBlocksTargetNode");function _3(e){let n=new Map;for(let r of Ut(e.nodes)){let i=n.get(r.source)??[];i.push(r.target),n.set(r.source,i)}let t=new Map;return r=>{let i=t.get(r);if(i!==void 0)return i;let o=new Set,a=[...n.get(r)??[]];for(;a.length>0;){let l=a.shift();o.has(l)||(o.add(l),a.push(...n.get(l)??[]))}return t.set(r,o),o}}s(_3,"reachability");function wD(e){let n=[],t=new Map;for(let o of e.nodes){let a=o;for(let l of Array.isArray(a.tasks)?a.tasks:[]){let d=typeof l.key=="string"?l.key:void 0,c=l.blocks;if(d===void 0||typeof c?.templateKey!="string")continue;let u=typeof c.node=="string"?c.node:o.id;t.set(`${o.id}::${d}`,`${u}::${c.templateKey}`)}}let r=new Map,i=s((o,a)=>{if(r.get(o)==="done")return;if(r.get(o)==="visiting"){let d=[...a.slice(a.indexOf(o)),o],[c,u]=o.split("::");n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${c}.tasks.${u}.blocks`,reason:{de:`[workItems/blocksCycle] Zyklus im 'blocks'-Graphen: ${d.map(p=>`"${p.replace("::"," \xB7 ")}"`).join(" \u2192 ")} \u2014 jedes Mitglied w\xFCrde auf ein anderes warten, keines w\xFCrde je frei.`,en:`[workItems/blocksCycle] Cycle in the 'blocks' graph: ${d.map(p=>`"${p.replace("::"," \xB7 ")}"`).join(" \u2192 ")} \u2014 every member would wait for another, none would ever be released.`},severity:"error"});return}r.set(o,"visiting");let l=t.get(o);l!==void 0&&t.has(l)&&i(l,[...a,o]),r.set(o,"done")},"walk");for(let o of t.keys())i(o,[]);return n}s(wD,"checkBlocksCycles");function C3(e){let{requiresOneOf:n,optionalActions:t}=e;if(!Array.isArray(n)||!Array.isArray(t))return new Set;let r=new Set(n.filter(o=>typeof o=="string")),i=new Set;for(let o of t)if(!(typeof o.key!="string"||!r.has(o.key)||!Array.isArray(o.tasks)))for(let a of o.tasks)typeof a=="string"&&i.add(a);return i}s(C3,"tasksOfRequiresOneOf");function kD(e){if(typeof e!="object"||e===null)return!1;let{de:n,en:t}=e;return typeof n=="string"&&n.trim().length>0&&typeof t=="string"&&t.trim().length>0}s(kD,"isFilledBilingual");var P3=["blocks","gatesNode","locksEvidence","completableIf"];function N3(e,n){let t={de:`Task "${n.key}" (Knoten "${n.nodeId}")`,en:`Task "${n.key}" (node "${n.nodeId}")`},r=[];e.feedback!==!0&&r.push(Nn(`${n.base}.feedback`,{de:`[workItems/feedbackNotTrue] ${t.de}: 'feedback' kennt nur true; erhalten ${JSON.stringify(e.feedback)}.`,en:`[workItems/feedbackNotTrue] ${t.en}: 'feedback' only knows true; got ${JSON.stringify(e.feedback)}.`}));let i=e.result;if(e.kind!=="task"||typeof i?.kind!="string"||!Vw({kind:i.kind,writes:i.writes})){let a=e.kind==="task"&&i?.writes!==void 0,l={de:e.kind!=="task"?`kind ${String(e.kind)}`:`Ergebnis ${String(i?.kind)}${a?" mit writes":""}`,en:e.kind!=="task"?`kind ${String(e.kind)}`:`result ${String(i?.kind)}${a?" with writes":""}`};r.push(Nn(`${n.base}.feedback`,{de:`[workItems/feedbackNeedsProse] ${t.de} ist eine Feedback-Aufgabe und schlie\xDFt daher mit Freitext, einer Empfehlung oder einer Auswahl ohne 'writes' \u2014 ein Wert, den ein sp\xE4terer Schritt liest, k\xE4me von einem wom\xF6glich weitergeleiteten Link; erhalten ${l.de}.`,en:`[workItems/feedbackNeedsProse] ${t.en} is a feedback task, so it closes with free text, a recommendation or a choice without 'writes' \u2014 a value a later step reads would come from a link that may have been forwarded; got ${l.en}.`}))}let o=["blocks","gatesNode","completableIf","locksEvidence","familyRequest"].filter(a=>e[a]!==void 0);return o.length>0&&r.push(Nn(`${n.base}.feedback`,{de:`[workItems/feedbackSteersProcess] ${t.de} ist eine Feedback-Aufgabe; die Antwort kommt von einer Seite ohne weitere Daten und darf deshalb nicht von ${o.join(", ")} abh\xE4ngen.`,en:`[workItems/feedbackSteersProcess] ${t.en} is a feedback task; its answer comes from a page without application data, so it may not depend on ${o.join(", ")}.`})),r}s(N3,"feedbackTaskIssues");function D3(e,n){let t=[],r={de:`Task "${n.key}" (Knoten "${n.nodeId}")`,en:`Task "${n.key}" (node "${n.nodeId}")`},i=e.optional;(!(typeof i=="object"&&i!==null&&Object.keys(i).every(d=>d==="skipLabel"))||!kD(i.skipLabel))&&t.push(Nn(`${n.base}.optional.skipLabel`,{de:`[workItems/optionalSkipLabel] ${r.de} ist optional, braucht daf\xFCr '{ skipLabel: { de, en } }' \u2014 die Worte des Knopfs, mit dem die zust\xE4ndige Person ohne Ergebnis abschlie\xDFt (\u201EKeine Einsch\xE4tzung abgeben"); erhalten ${JSON.stringify(i)}.`,en:`[workItems/optionalSkipLabel] ${r.en} is optional and needs '{ skipLabel: { de, en } }' for that \u2014 the words of the button the responsible person uses to finish without a result ("Give no assessment"); got ${JSON.stringify(i)}.`})),e.kind!=="task"&&t.push(Nn(`${n.base}.optional`,{de:`[workItems/optionalOnApproval] ${r.de} ist eine Freigabe \u2014 optional ist nur eine Aufgabe; eine Freigabe schlie\xDFt mit ihrem Urteil.`,en:`[workItems/optionalOnApproval] ${r.en} is an approval \u2014 only a task can be optional; an approval ends with its verdict.`}));let a=e.result;(a===void 0||typeof a.kind!="string"||!Vw({kind:a.kind,writes:a.writes}))&&t.push(Nn(`${n.base}.optional`,{de:`[workItems/optionalNeedsProseResult] ${r.de} ist optional, schlie\xDFt aber ${a===void 0?"ohne Ergebnis":`mit einem ${String(a.kind)}-Ergebnis${a.writes!==void 0?" mit Wert":""}`} \u2014 optional ist nur eine Aufgabe mit Freitext, Empfehlung oder einer Auswahl ohne 'writes': einen Wert, den ein sp\xE4terer Schritt liest, g\xE4be es dann nie.`,en:`[workItems/optionalNeedsProseResult] ${r.en} is optional but ends ${a===void 0?"without a result":`with a ${String(a.kind)} result${a.writes!==void 0?" with a value":""}`} \u2014 only a task with free text, a recommendation or a choice without 'writes' can be optional: a value a later step reads would then never arrive.`}));let l=P3.filter(d=>e[d]!==void 0);return l.length>0&&t.push(Nn(`${n.base}.${l[0]}`,{de:`[workItems/optionalHolds] ${r.de} ist optional und tr\xE4gt ${l.map(d=>`'${d}'`).join(", ")} \u2014 auf eine optionale Aufgabe wartet nichts: sie h\xE4lt keinen Schritt zur\xFCck. Entweder optional oder zur\xFCckhaltend.`,en:`[workItems/optionalHolds] ${r.en} is optional and carries ${l.map(d=>`'${d}'`).join(", ")} \u2014 nothing waits for an optional task: it holds no step back. Either optional or holding back.`})),n.requiredByRule&&t.push(Nn(`${n.base}.optional`,{de:`[workItems/optionalInRequiresOneOf] ${r.de} ist optional, geh\xF6rt aber zu einer Aktion, die 'requiresOneOf' verlangt \u2014 \u201EKeine Einsch\xE4tzung abgeben" w\xFCrde die Regel erf\xFCllen, ohne dass etwas geschehen ist.`,en:`[workItems/optionalInRequiresOneOf] ${r.en} is optional but belongs to an action that 'requiresOneOf' requires \u2014 "Give no assessment" would satisfy the rule without anything having happened.`})),t}s(D3,"optionalTaskIssues");function Nn(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(Nn,"issue");function bD(e,n){let t=[],r=_3(e),i=new Set(Ca(e).map(o=>o.key));t.push(...gD(e,n));for(let o of e.nodes){let a=o,l=cD(a);t.push(...hD(a));let d=C3(a);t.push(...pD(e,a));let c=new Map((Array.isArray(a.tasks)?a.tasks:[]).filter(u=>typeof u.key=="string").map(u=>[u.key,{feedback:u.feedback===!0}]));for(let u of Array.isArray(a.tasks)?a.tasks:[]){let p=typeof u.key=="string"?u.key:"?",h=`nodes.${o.id}.tasks.${p}`,y=u.kind,b=u.result,k=u.blocks,v=typeof k?.node=="string"&&k.node!==o.id?k.node:void 0;if(typeof k?.templateKey=="string"){let N=typeof k.node=="string"?k.node:o.id,T=e.nodes.find(ae=>ae.id===N),G=(Array.isArray(T?.tasks)?T.tasks:[]).find(ae=>ae.key===k.templateKey)?.blocks;typeof G?.node=="string"&&G.node!==N&&t.push(Nn(`${h}.blocks.templateKey`,{de:`[workItems/blocksCrossNodeTask] Task "${p}" auf Knoten "${o.id}" h\xE4lt "${k.templateKey}" auf Knoten "${N}" zur\xFCck \u2014 das ist selbst eine knoten\xFCbergreifende Aufgabe, die ihren Knoten \xFCberlebt; zur\xFCckgehalten k\xF6nnte sie nach dessen Verlassen weder bearbeitet noch freigegeben werden. Nur Aufgaben, die an ihrem Knoten bleiben, und intrinsische Vorlagen sind Ziele.`,en:`[workItems/blocksCrossNodeTask] Task "${p}" on node "${o.id}" holds back "${k.templateKey}" on node "${N}" \u2014 that is itself a cross-node task that outlives its node; held back, it could be neither worked nor released after the node is left. Only tasks that stay on their node and intrinsic templates are targets.`}))}if(v!==void 0){let N=v;e.nodes.some(T=>T.id===N)&&!r(o.id).has(N)&&t.push(Nn(`${h}.blocks.node`,{de:`[workItems/blocksTargetNotAfter] Task "${p}" auf Knoten "${o.id}" blockiert Knoten "${N}", der von hier aus nicht erreichbar ist \u2014 die Aufgabe entst\xFCnde erst, wenn ihr Ziel schon hinter dem Prozess liegt. Ziel ist derselbe Knoten oder ein sp\xE4terer.`,en:`[workItems/blocksTargetNotAfter] Task "${p}" on node "${o.id}" blocks node "${N}", which cannot be reached from here \u2014 the task would only be created when its target is already behind the process. The target is the same node or a later one.`})),(b===void 0||!sa(b.kind))&&t.push(Nn(`${h}.blocks.node`,{de:`[workItems/crossNodeBlocksNeedsResult] Task "${p}" auf Knoten "${o.id}" blockiert einen anderen Knoten ("${N}"), hat aber kein 'result' \u2014 eine knoten\xFCbergreifende Aufgabe \xFCberlebt ihren Knoten und wird \xFCber ihr Ergebnis abgeschlossen (Freitext, Empfehlung oder Auswahl).`,en:`[workItems/crossNodeBlocksNeedsResult] Task "${p}" on node "${o.id}" blocks another node ("${N}") but has no 'result' \u2014 a cross-node task outlives its node and is completed through its result (free text, recommendation or choice).`})),l.has(p)&&t.push(Nn(`${h}.blocks.node`,{de:`[optionalAction/crossNodeBlocks] Task "${p}" geh\xF6rt zu einer optionalen Aktion (spawnTasks) auf Knoten "${o.id}" und darf keinen anderen Knoten blockieren \u2014 ihre Zeilen sind die Runde der Aktion.`,en:`[optionalAction/crossNodeBlocks] Task "${p}" belongs to an optional action (spawnTasks) on node "${o.id}" and must not block another node \u2014 its rows are the round of the action.`}))}for(let N of KP(String(y),b,{channelKeys:i,nodeTasks:c,...n?.billingItemKeys!==void 0?{billingItemKeys:n.billingItemKeys}:{},...n?.offerProgram!==void 0?{offerProgram:n.offerProgram}:{}}))t.push(Nn(`${h}.${N.field}`,{de:`${N.code} ${N.message.de} (Task "${p}" auf Knoten "${o.id}").`,en:`${N.code} ${N.message.en} (task "${p}" on node "${o.id}").`}));let $=u.when,R=s((N,T,q)=>{!ke(T)||mn(T)||t.push(Nn(N,{de:`[workItems/evidenceNotFormField] ${q} auf Task "${p}" (Knoten "${o.id}") nennt ${Ue(e,T,"de")} \u2014 Bedingung und Belege einer Aufgabe sind Felder eines Formulars ($node.<formular>.admission.<feld>).`,en:`[workItems/evidenceNotFormField] ${q} on task "${p}" (node "${o.id}") names ${Ue(e,T,"en")} \u2014 the condition and evidence of a task are fields of a form ($node.<form>.admission.<field>).`}))},"notFormField");$!==void 0?(R(`${h}.when`,$,"'when'"),u.onConditionReturn!=="respawn"&&u.onConditionReturn!=="stayClosed"&&t.push(Nn(`${h}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] Task "${p}" (Knoten "${o.id}") hat eine Bedingung, aber kein 'onConditionReturn' ('respawn' | 'stayClosed') \u2014 was bei der R\xFCckkehr der Bedingung geschieht, muss entschieden sein.`,en:`[workItems/whenNeedsOnConditionReturn] Task "${p}" (node "${o.id}") has a condition but no 'onConditionReturn' ('respawn' | 'stayClosed') \u2014 what happens when the condition returns must be decided.`}))):u.onConditionReturn!==void 0&&t.push(Nn(`${h}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' ohne 'when' auf Task "${p}" (Knoten "${o.id}") \u2014 ohne Bedingung kehrt nichts zur\xFCck.`,en:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' without 'when' on task "${p}" (node "${o.id}") \u2014 without a condition nothing returns.`}));let I=u.reads;if(I!==void 0)if(!Array.isArray(I))t.push(Nn(`${h}.reads`,{de:`[workItems/readsUnknownField] 'reads' auf Task "${p}" (Knoten "${o.id}") muss eine Liste von Feldadressen sein.`,en:`[workItems/readsUnknownField] 'reads' on task "${p}" (node "${o.id}") must be a list of field addresses.`}));else for(let[N,T]of I.entries())R(`${h}.reads.${N}`,T,"'reads'");let D=u.locksEvidence,F=s((N,T)=>t.push(Nn(`${h}.locksEvidence`,{de:`[workItems/${N}] Task "${p}" (Knoten "${o.id}") ${T.de}`,en:`[workItems/${N}] Task "${p}" (node "${o.id}") ${T.en}`})),"lockIssue");D!==void 0&&D!==!0&&F("locksEvidenceNotTrue",{de:`tr\xE4gt 'locksEvidence' ${JSON.stringify(D)} \u2014 nur 'true' ist erlaubt; ohne Sperre entf\xE4llt das Feld.`,en:`carries 'locksEvidence' ${JSON.stringify(D)} \u2014 only 'true' is allowed; without a lock the field is dropped.`}),D===!0&&(I===void 0&&$===void 0&&F("locksEvidenceWithoutEvidence",{de:"sperrt seine Belege, hat aber weder 'reads' noch 'when' \u2014 es gibt nichts, worauf die Entscheidung beruht.",en:"locks its evidence but has neither 'reads' nor 'when' \u2014 there is nothing the decision rests on."}),(b===void 0||!sa(b.kind))&&F("locksEvidenceNeedsRecordedResult",{de:"sperrt seine Belege, schlie\xDFt aber nicht mit einem erfassten Ergebnis (Freitext, Empfehlung, Auswahl) \u2014 nur eine Entscheidung, die das Team wieder\xF6ffnen kann, darf Belege sperren (ein Termin bleibt gebucht).",en:"locks its evidence but does not end with a recorded result (free text, recommendation, choice) \u2014 only a decision the team can reopen may lock evidence (an appointment stays booked)."}),l.has(p)&&F("locksEvidenceOnOptionalAction",{de:"geh\xF6rt zu einer optionalen Aktion (spawnTasks) \u2014 ihre Zeilen sind die Runde der Aktion, wieder\xF6ffnen l\xE4sst sie sich nicht; Belege sperrt nur eine Knotenaufgabe.",en:"belongs to an optional action (spawnTasks) \u2014 its rows are the round of the action and cannot be reopened; only a node task locks evidence."})),t.push(...mD({graph:e,node:a,task:u,onTrigger:l,specCtx:n}));let C=Object.keys(u).filter(N=>!Object.hasOwn(ob,N)&&!Object.hasOwn(sb,N));C.length>0&&t.push(Nn(`${h}.${C[0]}`,{de:`[workItems/unknownKey] Task "${p}" (Knoten "${o.id}") tr\xE4gt ${C.map(N=>`'${N}'`).join(", ")} \u2014 kein Feld einer Aufgabe. Erlaubt: ${Object.keys(ob).join(", ")}. (Checklisten gibt es nicht mehr: Text als 'description', mehrere Arbeitsschritte sind mehrere Aufgaben.)`,en:`[workItems/unknownKey] Task "${p}" (node "${o.id}") carries ${C.map(N=>`'${N}'`).join(", ")} \u2014 not a field of a task. Allowed: ${Object.keys(ob).join(", ")}. (Checklists no longer exist: text goes in 'description', several work steps are several tasks.)`}));let x=u.description;x!==void 0&&!kD(x)&&t.push(Nn(`${h}.description`,{de:`[workItems/descriptionInvalid] 'description' auf Task "${p}" (Knoten "${o.id}") braucht Text in beiden Sprachen ({ de, en }), erhalten ${JSON.stringify(x)}.`,en:`[workItems/descriptionInvalid] 'description' on task "${p}" (node "${o.id}") needs text in both languages ({ de, en }), got ${JSON.stringify(x)}.`})),u.feedback!==void 0&&t.push(...N3(u,{key:p,nodeId:o.id,base:h})),u.optional!==void 0&&t.push(...D3(u,{key:p,nodeId:o.id,base:h,requiredByRule:d.has(p)}))}}return t}s(bD,"checkNodeTasks");function vD(e){let n=e.indexOf(":"),t=n===-1?"":e.slice(0,n),r=n===-1?"":e.slice(n+1).trim();if(t==="artifact"&&r.length>0)return{kind:t,key:r};let i=wi(r);return t==="field"&&i!==null?{kind:t,address:i}:de("INVALID",{de:`Dokument-Verweis "${e}" ist ung\xFCltig \u2014 erwartet artifact:<Slot-Schl\xFCssel> (auch der Slot eines anderen Knotens) oder field:$node.<Formular>.admission.<Feld>.`,en:`Document reference "${e}" is invalid \u2014 expected artifact:<slot key> (another node's slot too) or field:$node.<form>.admission.<field>.`})}s(vD,"parseTaskDocumentRef");function ab(e){return e.kind==="artifact"?`artifact:${e.key}`:`field:${ue(e.address)}`}s(ab,"taskDocumentId");function Ei(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(Ei,"issue");function xD(e){return Array.isArray(e.tasks)?e.tasks:[]}s(xD,"tasksOf");function Sd(e){let n=new Map;for(let t of e){let{id:r,artifacts:i}=t;for(let o of Array.isArray(i)?i:[])typeof o?.key=="string"&&n.set(o.key,[...n.get(o.key)??[],{nodeId:r,slot:o}])}return n}s(Sd,"artifactSlotDeclarations");function F3(e){return e.flatMap(n=>{let{id:t,artifacts:r}=n;return(Array.isArray(r)?r:[]).filter(i=>!tm(i?.type)).map(i=>({nodeId:String(t),slotKey:String(i?.key),type:JSON.stringify(i?.type??null)}))})}s(F3,"unknownArtifactSlotTypes");function SD(e){let n=[];for(let{nodeId:t,slotKey:r,type:i}of F3(e.nodes))n.push(Ei(`nodes.${t}.artifacts.${r}.type`,{de:`[artifact/unknownType] Knoten "${t}" deklariert den Dokument-Slot \u201E${r}" mit der Art ${i} \u2014 erlaubt sind ${xa.join(", ")}.`,en:`[artifact/unknownType] Node "${t}" declares the document slot "${r}" with the type ${i} \u2014 allowed are ${xa.join(", ")}.`}));for(let[t,r]of Sd(e.nodes))for(let i of r.slice(1))n.push(Ei(`nodes.${i.nodeId}.artifacts`,{de:`[governedDocument/slotKeyTaken] Knoten "${i.nodeId}" deklariert den Dokument-Slot \u201E${t}", den schon "${r[0].nodeId}" deklariert \u2014 jeder Slot-Schl\xFCssel geh\xF6rt genau einem Knoten.`,en:`[governedDocument/slotKeyTaken] Node "${i.nodeId}" declares the document slot "${t}", which "${r[0].nodeId}" already declares \u2014 every slot key belongs to exactly one node.`}));return n}s(SD,"checkArtifactSlotKeys");function L3(e,n,t,r=Sd(e.nodes)){let i=r.get(n)?.[0]?.nodeId;return i===void 0?{reason:"unknown"}:ga(e,i,t)?null:{reason:"notBefore",owner:i}}s(L3,"slotLinkRefusal");function AD(e){if(!Array.isArray(e)||e.length===0)return null;let n=[];for(let t of e){let r=typeof t=="object"&&t!==null?t:{},i=Object.keys(r).sort().join(",");if(r.kind==="artifact"&&i==="key,kind"&&typeof r.key=="string"&&r.key.length>0)n.push({kind:"artifact",key:r.key});else if(r.kind==="field"&&i==="address,kind")n.push({kind:"field",address:r.address});else return null}return n}s(AD,"authoredRefs");function TD(e){let n=[],t=Sd(e.nodes);for(let r of e.nodes)for(let i of xD(r)){if(i.documents===void 0)continue;let o=typeof i.key=="string"?i.key:"?",a=`nodes.${r.id}.tasks.${o}.documents`,l={de:`Task "${o}" (Knoten "${r.id}")`,en:`Task "${o}" (node "${r.id}")`},d=AD(i.documents);if(d===null){n.push(Ei(a,{de:`[workItems/documentsInvalid] 'documents' auf ${l.de} muss eine nicht leere Liste von { kind: 'artifact', key } (Dokument-Slot eines Knotens) oder { kind: 'field', address } (Dateifeld eines Formulars) sein, erhalten ${JSON.stringify(i.documents)} \u2014 ein { kind: 'document', address } schreibt \`plexus-cli offer upgrade\` auf den Slot um.`,en:`[workItems/documentsInvalid] 'documents' on ${l.en} must be a non-empty list of { kind: 'artifact', key } (document slot of a node) or { kind: 'field', address } (file field of a form), got ${JSON.stringify(i.documents)} \u2014 \`plexus-cli offer upgrade\` rewrites a { kind: 'document', address } onto its slot.`}));continue}let c=new Set;for(let u of d){if(u.kind!=="artifact"&&!ke(u.address))continue;let p=u.kind==="artifact"?ab(u):ab({kind:"field",address:u.address});if(c.has(p)&&n.push(Ei(a,{de:`[workItems/documentsDuplicate] ${l.de} verweist zweimal auf ${p}.`,en:`[workItems/documentsDuplicate] ${l.en} refers to ${p} twice.`})),c.add(p),u.kind==="artifact"){let h=L3(e,u.key,r.id,t);h?.reason==="unknown"?n.push(Ei(a,{de:`[workItems/documentsUnknownArtifact] ${l.de} verweist auf das Dokument "${u.key}", aber kein Knoten deklariert einen solchen Slot.`,en:`[workItems/documentsUnknownArtifact] ${l.en} refers to the document "${u.key}", but no node declares such a slot.`})):h?.reason==="notBefore"&&n.push(Ei(a,{de:`[workItems/documentsNotBefore] ${l.de} verweist auf das Dokument "${u.key}" des Knotens "${h.owner}", der nicht auf jedem Weg vor "${r.id}" liegt \u2014 auf einem Weg an ihm vorbei g\xE4be es das Dokument nie.`,en:`[workItems/documentsNotBefore] ${l.en} refers to the document "${u.key}" of node "${h.owner}", which does not lie on every path before "${r.id}" \u2014 on a path around it the document would never exist.`}))}u.kind==="field"&&!mn(u.address)&&n.push(Ei(a,{de:`[workItems/documentsInvalid] ${l.de}: ein Feld-Dokument nennt ein Feld eines Formulars ($node.<formular>.admission.<feld>), nicht ${Ue(e,u.address,"de")}.`,en:`[workItems/documentsInvalid] ${l.en}: a field document names a field of a form ($node.<form>.admission.<field>), not ${Ue(e,u.address,"en")}.`}))}}return n}s(TD,"checkTaskDocuments");function RD(e,n){let t=[];for(let r of e.nodes)for(let i of xD(r)){let o=AD(i.documents);if(o===null)continue;let a=typeof i.key=="string"?i.key:"?",l=`nodes.${r.id}.tasks.${a}.documents`;for(let d of o){if(d.kind!=="field"||!mn(d.address))continue;let c=ri(n,d.address);if(c==null)continue;let u={de:Ue(e,d.address,"de"),en:Ue(e,d.address,"en")},p=wa("taskDocument",ya(c));if(p==="repeated"){t.push(Ei(l,{de:`[workItems/documentsUnknownField] Task "${a}" (Knoten "${r.id}") verweist auf das Feld ${u.de} \u2014 ein Feld in einer Wiederholgruppe ist kein einzelnes Dokument der Anmeldung.`,en:`[workItems/documentsUnknownField] Task "${a}" (node "${r.id}") refers to the field ${u.en} \u2014 a field in a repeated group is not a single document of the application.`}));continue}p==="notDocument"&&t.push(Ei(l,{de:`[workItems/documentsNotDocument] Task "${a}" (Knoten "${r.id}") verweist auf das Feld ${u.de}, das keine Datei enth\xE4lt \u2014 nur Datei-Felder (docRef) sind Dokumente.`,en:`[workItems/documentsNotDocument] Task "${a}" (node "${r.id}") refers to the field ${u.en}, which holds no file \u2014 only file fields (docRef) are documents.`}))}}return t}s(RD,"checkTaskDocumentFields");var db=["form","artifact","field"],Fa=["coverLetter","contract"],ED="form",$D=/^[A-Za-z0-9_.-]+$/;function M3(e){return Fa.includes(e)}s(M3,"isArtifactPart");function Da(e){return de("INVALID",{de:`Ansichts-Adresse "${e}" ist ung\xFCltig \u2014 erwartet form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Fa.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`View address "${e}" is invalid \u2014 expected form:<form node>#<view>, artifact:<slot>[#${Fa.join("|")}] or field:$node.<form>.admission.<field>.`})}s(Da,"invalid");function cb(e){let n=e.indexOf(":");if(n===-1)return Da(e);let t=e.slice(0,n),r=e.slice(n+1);if(t==="field"){let l=wi(r);return l===null?Da(e):{kind:t,address:l}}let i=r.indexOf("#"),o=i===-1?r:r.slice(0,i),a=i===-1?null:r.slice(i+1);return $D.test(o)?t==="form"?a!==null&&$D.test(a)?{kind:t,form:o,view:a}:Da(e):t==="artifact"?a===null?{kind:t,slot:o}:M3(a)?{kind:t,slot:o,part:a}:Da(e):Da(e):Da(e)}s(cb,"parseViewAddress");function ID(e){let n=K3(e);if(n===null)return null;let t=q3(n);return t!==null&&JSON.stringify(lb(t))===JSON.stringify(lb(e))?t:null}s(ID,"viewAddressOf");function q3(e){try{return cb(e)}catch{return null}}s(q3,"tryParseViewAddress");function K3(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e;if(n.kind==="form"&&typeof n.form=="string"&&typeof n.view=="string")return`form:${n.form}#${n.view}`;if(n.kind==="artifact"&&typeof n.slot=="string")return n.part===void 0?`artifact:${n.slot}`:typeof n.part=="string"?`artifact:${n.slot}#${n.part}`:null;if(n.kind==="field"&&n.address!==null&&typeof n.address=="object"){let t=n.address;return typeof t.scope!="string"||typeof t.key!="string"?null:`field:${ue(t)}`}return null}s(K3,"spellingOf");function lb(e){return e===null||typeof e!="object"||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).sort(([n],[t])=>n<t?-1:n>t?1:0).map(([n,t])=>[n,lb(t)]))}s(lb,"canonical");function OD(e){switch(e.kind){case"form":return`form:${e.form}#${e.view}`;case"artifact":return e.part===void 0?`artifact:${e.slot}`:`artifact:${e.slot}#${e.part}`;case"field":return`field:${ue(e.address)}`}}s(OD,"formatViewAddress");var ub=["form","documents"],j3=/^[a-z][a-zA-Z0-9_-]*$/;function V3(e){let n=new Map,t=s(r=>{for(let i of[...r.fields,...(r.groups??[]).flatMap(o=>o.fields)])n.set(i.key,i.type==="docRef"?"document":"other");for(let i of r.repeated??[]){n.set(i.key,"other");for(let o of i.itemTemplate)n.set(`${i.key}[].${o.key}`,o.type==="docRef"?"row":"other")}r.subsections?.forEach(t)},"visit");return e.sections.forEach(t),n}s(V3,"fieldPlaces");function _D(e,n,t){let r=[],i=new Set;return e.forEach((o,a)=>{if(typeof o!="string"||!j3.test(o)){r.push({severity:"error",path:`${t(a)}.key`,code:"view.invalid-key",message:{de:`${n.de}: '${String(o)}' ist kein g\xFCltiger Schl\xFCssel (Kleinbuchstabe am Anfang, dann Buchstaben, Ziffern, - oder _).`,en:`${n.en}: '${String(o)}' is no valid key (a lower-case letter first, then letters, digits, - or _).`}});return}i.has(o)&&r.push({severity:"error",path:`${t(a)}.key`,code:"view.duplicate-key",message:{de:`${n.de}: Der Schl\xFCssel '${o}' kommt doppelt vor.`,en:`${n.en}: the key '${o}' occurs twice.`}}),i.add(o)}),r}s(_D,"keyIssues");function B3(e,n,t){return e==="document"?null:e===void 0?{severity:"error",path:t,code:"view.unknown-field",message:{de:`Ansicht: Das Formular hat kein Feld '${n}'.`,en:`View: the form has no field '${n}'.`}}:e==="row"?{severity:"error",path:t,code:"view.field-in-row",message:{de:`Ansicht: Das Dateifeld '${n}' liegt in einem wiederholten Block und kann nicht einzeln genannt werden.`,en:`View: the file field '${n}' sits in a repeated block and cannot be named on its own.`}}:{severity:"error",path:t,code:"view.not-a-document",message:{de:`Ansicht: Das Feld '${n}' enth\xE4lt keine Datei.`,en:`View: the field '${n}' holds no file.`}}}s(B3,"fieldIssue");function U3(e,n,t){let r=[];ub.includes(e.key)&&r.push({severity:"error",path:`${n}.key`,code:"view.reserved-key",message:{de:`Der Ansichtsschl\xFCssel '${e.key}' ist f\xFCr die Standardansicht reserviert.`,en:`The view key '${e.key}' is reserved for the standard view.`}});let i=e.groups;i.length===0&&r.push({severity:"error",path:`${n}.groups`,code:"view.empty",message:{de:`Ansicht '${e.key}' hat keine Gruppen.`,en:`View '${e.key}' has no groups.`}}),r.push(..._D(i.map(a=>a.key),{de:`Gruppe der Ansicht '${e.key}'`,en:`Group of view '${e.key}'`},a=>`${n}.groups[${a}]`));let o=new Set;return i.forEach((a,l)=>{let d=`${n}.groups[${l}]`,c=a.fields;c.length===0&&r.push({severity:"error",path:`${d}.fields`,code:"view.empty",message:{de:`Gruppe '${a.key}' der Ansicht '${e.key}' hat keine Felder.`,en:`Group '${a.key}' of view '${e.key}' has no fields.`}}),c.forEach((u,p)=>{let h=`${d}.fields[${p}]`,y=B3(t.get(u),u,h);y!==null&&r.push(y),o.has(u)&&r.push({severity:"error",path:h,code:"view.field-twice",message:{de:`Ansicht '${e.key}': Das Feld '${u}' steht mehrfach; eine Datei hat einen Platz.`,en:`View '${e.key}': the field '${u}' is listed more than once; a file has one place.`}}),o.add(u)})}),r}s(U3,"viewIssues");function G3(e){if(!Array.isArray(e))return"views";for(let[n,t]of e.entries()){let r=t?.groups;if(!Array.isArray(r))return`views[${n}].groups`;for(let[i,o]of r.entries()){let a=o?.fields;if(!Array.isArray(a)||a.some(l=>typeof l!="string"))return`views[${n}].groups[${i}].fields`}}return null}s(G3,"malformedAt");function CD(e){let n=e.views;if(n===void 0)return[];let t=G3(n);if(t!==null)return[{severity:"error",path:t,code:"view.malformed",message:{de:`${t} hat nicht die Form einer Ansicht: views ist eine Liste von { key, label, groups }, groups eine Liste von { key, label, fields }, fields eine Liste von Feldschl\xFCsseln.`,en:`${t} is not shaped like a view: views is a list of { key, label, groups }, groups a list of { key, label, fields }, fields a list of field keys.`}}];let r=V3(e);return[..._D(n.map(i=>i.key),{de:"Ansicht",en:"View"},i=>`views[${i}]`),...n.flatMap((i,o)=>U3(i,`views[${o}]`,r))]}s(CD,"formViewIssues");function La(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(La,"issue");function PD(e,n,t,r,i){let o=ID(e);if(o===null)return[La(n,{de:`[view/invalid] 'view' auf ${t.de} ist keine Ansichts-Adresse \u2014 erwartet { kind: ${db.join(" | ")}, \u2026 }: form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Fa.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] 'view' on ${t.en} is no view address \u2014 expected { kind: ${db.join(" | ")}, \u2026 }: form:<form node>#<view>, artifact:<slot>[#${Fa.join("|")}] or field:$node.<form>.admission.<field>.`})];let a=OD(o);switch(o.kind){case"artifact":return r.has(o.slot)?[]:[La(n,{de:`[view/unknownSlot] ${t.de} nennt "${a}", aber kein Knoten dieses Graphen hat den Dokument-Slot "${o.slot}".`,en:`[view/unknownSlot] ${t.en} names "${a}", but no node of this graph has the document slot "${o.slot}".`})];case"form":case"field":{let l=o.kind==="form"?o.form:o.address.scope==="node"?o.address.owner:null;if(l===null)return[La(n,{de:`[view/invalid] ${t.de} nennt "${a}" \u2014 ein Dateifeld liegt in einem Formular: field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] ${t.en} names "${a}" \u2014 a file field lives in a form: field:$node.<form>.admission.<field>.`})];let d=i?.formViewKeysByFormNode;if(d===void 0)return[];let c=d.get(l);return c===void 0?[La(n,{de:`[view/unknownForm] ${t.de} nennt "${a}", aber kein Formularknoten hei\xDFt so.`,en:`[view/unknownForm] ${t.en} names "${a}", but no form node has that id.`})]:o.kind==="field"?[]:c.has(o.view)||ub.includes(o.view)?[]:[La(n,{de:`[view/unknownView] ${t.de} nennt "${a}", aber das Formular "${o.form}" hat keine Ansicht "${o.view}".`,en:`[view/unknownView] ${t.en} names "${a}", but the form "${o.form}" has no view "${o.view}".`})]}}}s(PD,"viewIssues");function ND(e,n){let t=[],r=new Set(Sd(e.nodes).keys());for(let i of e.nodes){if(i.view!==void 0){let o={de:`Knoten "${i.id}"`,en:`node "${i.id}"`};i.type!=="decision"?t.push(La(`nodes.${i.id}.view`,{de:`[view/invalid] ${o.de}: 'view' am Knoten gilt nur f\xFCr eine Entscheidung; eine Aufgabe tr\xE4gt ihre eigene.`,en:`[view/invalid] ${o.en}: 'view' on a node applies to a decision only; a task carries its own.`})):t.push(...PD(i.view,`nodes.${i.id}.view`,o,r,n))}for(let o of Array.isArray(i.tasks)?i.tasks:[]){if(o.view===void 0)continue;let a=String(o.key);t.push(...PD(o.view,`nodes.${i.id}.tasks.${a}.view`,{de:`Task "${a}" (Knoten "${i.id}")`,en:`Task "${a}" (node "${i.id}")`},r,n))}}return t}s(ND,"checkTaskViews");var zt="traeger",DD={de:"Tr\xE4ger",en:"Provider"};function Ma(e){let n=e.inputs?.[zt];return n?.kind==="literal"&&typeof n.value=="string"&&n.value.length>0?n.value:null}s(Ma,"traegerKeyOfNode");var xm={name:"input.traeger.name",address:"input.traeger.anschrift"},$ve=Object.values(xm);var FD="governedDocument",ss="prepareDocument",Ad="prepareDocument:revision",Or="releaseApproval",as="documentResponse",wo="coverLetterResponse",Sm="confirmCoverLetter",Am="requestCoverLetterRevision",qa="coverLetterConfirmation",si="responseCheck",Tm="returnSigned";var LD="requestApproval";var MD="issueDocument",qD="correctInPlace",KD="rescindAndReissue",Rm="requestChange";var Ka="releaseArtifact",mt="signingRecovery",$m="resendESignature",ls="switchToPaper";var Td=new Set([ss,Ad]),jD=["pending","producing","producingHeld","deferred","awaitingApproval","awaitingCoverLetter","awaitingResponse","responseReturned","responseInCheck","awaitingSignature","signatureStalled","done"],Em=["upload","resolver","template","none"],ds=1,cs=366,Ii="responseDueInDays";function us(e){let n=e.inputs?.[qa];return n?.kind==="literal"&&n.value===!0}s(us,"coverLetterConfirmationOf");function Rd(e){let n=e.inputs?.[Ii];return n?.kind==="literal"&&$d(n.value)?n.value:void 0}s(Rd,"responseDueInDaysForVocabulary");function $d(e){return typeof e=="number"&&Number.isInteger(e)&&e>=ds&&e<=cs}s($d,"isValidResponseDueInDays");var Im=["generatedAt","responseDueInDays","countersignature"],fs=["release","none"],Om=["confirm","signedUpload","signedUploadChecked","eSignature"];var z3={kind:"confirm",acceptOutcomeId:"accepted",declineOutcomeId:"declined",outcomeSemantics:{accept:"granted",decline:"rejected"},acceptEvent:"userTaskResolved",producesResponseArtifact:!1,declineIsAnswer:!0,acceptStatus:"accepted",checksReturn:!1,issuesBy:"paper",defaultLabels:{accept:{de:"Annehmen",en:"Accept"},decline:{de:"Ablehnen",en:"Decline"}}},VD={kind:"signedUpload",acceptOutcomeId:"signed",declineOutcomeId:"absage",outcomeSemantics:{accept:"other",decline:"rejected"},acceptEvent:"userTaskResolved",producesResponseArtifact:!0,declineIsAnswer:!1,acceptStatus:"signed",checksReturn:!1,issuesBy:"paper",defaultLabels:{accept:{de:"Unterschrieben zur\xFCcksenden",en:"Return signed"},decline:{de:"Ablehnen",en:"Decline"}}},BD={...VD,kind:"signedUploadChecked",acceptEvent:"contractEvent",checksReturn:!0},W3={...BD,kind:"eSignature",issuesBy:"provider"},Oi={confirm:z3,signedUpload:VD,signedUploadChecked:BD,eSignature:W3};function _i(e){let n=e.responseStrategy;if(typeof n=="string"&&n in Oi)return Oi[n];M(`governedDocument node "${e.id}" declares no valid responseStrategy (got ${JSON.stringify(n)}) \u2014 publish validation should have blocked this; corrupt pinned graph`)}s(_i,"responseStrategyOf");function _m(e){if(e.type!==FD||e.production!=="resolver")return!1;let n=e.responseStrategy;return typeof n=="string"&&n in Oi?Oi[n].acceptEvent==="contractEvent":!1}s(_m,"isFamilySignedContractNode");function Va(e){return e.label}s(Va,"governedDocTitle");function fb(e){return e.approval==="release"?LD:MD}s(fb,"submitActionId");function UD(e,n,t){return{key:n,recipient:"internal",title:t,unlocks:[fb(e)],gatesNode:!0,advancesNode:!0}}s(UD,"producerTemplate");function Y3(e){return e.titles?.respond??e.label}s(Y3,"responseTitle");var ja={de:"\u27E8Titel fehlt\u27E9",en:"\u27E8title missing\u27E9"};function Cm(e){let n=_i(e),t=[];if(e.production!=="none"&&t.push(UD(e,ss,e.titles?.prepare??ja),UD(e,Ad,e.titles?.revise??ja)),e.approval==="release"&&t.push({key:Or,recipient:"internal",title:e.titles?.approve??ja,unlocks:[],verdictResolved:!0,gatesNode:!0,advancesNode:!0}),t.push({key:as,recipient:"external",title:Y3(e),unlocks:n.producesResponseArtifact?[n.checksReturn?Tm:n.acceptOutcomeId,n.declineOutcomeId,Rm]:[n.acceptOutcomeId,n.declineOutcomeId],advancesNode:!0,...Rd(e)!==void 0?{dueInDays:Rd(e)}:{}}),us(e)){let r=Va(e);t.push({key:wo,recipient:"external",title:{de:`${r.de}: Angebot best\xE4tigen`,en:`${r.en}: confirm offer`},unlocks:[Sm,Am,n.declineOutcomeId],advancesNode:!0,...Rd(e)!==void 0?{dueInDays:Rd(e)}:{}})}if(n.checksReturn&&t.push({key:si,recipient:"internal",title:e.titles?.check??ja,unlocks:[],verdictResolved:!0,gatesNode:!1,advancesNode:!0}),n.issuesBy==="provider"){let r=Va(e);t.push({key:mt,recipient:"internal",title:{de:`${r.de}: elektronische Unterschrift kl\xE4ren`,en:`${r.en}: resolve the e-signature`},unlocks:[$m,ls],gatesNode:!1,advancesNode:!1})}return t}s(Cm,"governedDocIntrinsicTemplates");function H3(e){e.production==="none"&&M(`governedDocSlot: node "${e.id}" has production 'none' \u2014 it governs no artifact slot`);let n=e.artifacts??[];n.length!==1&&M(`governedDocSlot: node "${e.id}" declares ${n.length} artifact slots \u2014 exactly ONE is required (publish validation [governedDocument/slotContract])`);let t=n[0];return(typeof t.key!="string"||t.key.length===0)&&M(`governedDocSlot: node "${e.id}" declares an artifact slot without a key \u2014 corrupt pinned graph`),t}s(H3,"governedDocSlot");function Pm(e){return H3(e).key}s(Pm,"governedDocSlotKey");var dr="processFooter";var Ed="countersign",pb="countersign",GD="countersigned",mb="countersigning",zD="countersigned";var WD={de:"Vertrag gegenzeichnen",en:"Countersign the contract"},Id=["scan","eSignature"],Nm="service_provider:1",YD=["countersigning","awaitingSignature","signatureStalled","done"],HD={de:"Elektronische Gegenzeichnung kl\xE4ren",en:"Resolve the electronic countersignature"};function JD(e){return{de:`[countersign/traegerSignatoryMissing] Die Schule zeichnet elektronisch gegen, aber f\xFCr ${e} ist keine Unterschriftsperson hinterlegt, die unterschreiben kann (Rechtstr\xE4ger \u2192 signatoryUserKey, aktives Personal der Schule).`,en:`[countersign/traegerSignatoryMissing] The school countersigns electronically, but no signatory who can sign is on file for ${e} (legal entity \u2192 signatoryUserKey, active staff of the school).`}}s(JD,"traegerSignatoryMissingReason");function cr(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${n}`,reason:t,severity:"error"}}s(cr,"issue");function Dm(e,n){return e.nodes.filter(t=>{let r=t.contract;return t.type==="countersign"&&ke(r)&&r.scope==="node"&&r.owner===n})}s(Dm,"countersignersOf");function Od(e){return e.signing==="eSignature"}s(Od,"isElectronic");function J3(e,n){if(n===void 0||n.sendable||!Od(e))return[];let t=e.label?.de??e.id,r=e.label?.en||e.id;return[cr(e,"signing",{de:`[countersign/eSignatureNeedsProvider] \u201E${t}\u201C zeichnet elektronisch gegen, aber die Schule kann nicht senden: ${n.reason.de}`,en:`[countersign/eSignatureNeedsProvider] "${r}" countersigns electronically, but the school cannot send: ${n.reason.en}`})]}s(J3,"countersignProviderIssues");function Q3(e,n,t){if(t.scope!=="node")return[];let r=e.nodes.find(o=>o.id===t.owner);if(r===void 0)return[];let i=[];return _m(r)||i.push("sourceNotCheckedContract"),Dm(e,r.id).some(o=>o.id!==n)&&i.push("twice"),i}s(Q3,"countersignContractRefusals");function QD(e){let n=e.inputs?.dueInDays;return n?.kind==="literal"&&typeof n.value=="number"&&Number.isInteger(n.value)&&n.value>=1?n.value:void 0}s(QD,"validDueInDays");function Z3(e,n,t){let r=e.label?.de??e.id,i=e.label?.en||e.id,o=e.signing;if(o!==void 0&&!Id.includes(o))return[cr(e,"signing",{de:`[countersign/unknownSigning] \u201E${r}\u201C: signing ist scan oder eSignature (gefunden: ${JSON.stringify(o)}).`,en:`[countersign/unknownSigning] "${i}": signing is scan or eSignature (found: ${JSON.stringify(o)}).`})];let a=e.assign?.[mt];if(!Od(e))return a===void 0?[]:[cr(e,"assign",{de:`[countersign/recoveryAssign] \u201E${r}\u201C zeichnet auf Papier gegen \u2014 \`assign.signingRecovery\` h\xE4lt keine Aufgabe und geh\xF6rt entfernt.`,en:`[countersign/recoveryAssign] "${i}" countersigns on paper \u2014 \`assign.signingRecovery\` holds no task and must be removed.`})];let l=[];return a===void 0&&l.push(cr(e,"assign",{de:`[countersign/recoveryAssign] \u201E${r}\u201C zeichnet elektronisch gegen \u2014 wer eine gescheiterte Gegenzeichnung kl\xE4rt, fehlt: \`assign.signingRecovery\` nennt das Team.`,en:`[countersign/recoveryAssign] "${i}" countersigns electronically \u2014 who resolves a failed countersignature is missing: \`assign.signingRecovery\` names the team.`})),l.push(...X3(e,n,t),...e4(e,n,t),...J3(e,t?.signingProvider)),l}s(Z3,"signingIssues");function XD(e,n){let t=e.contract;if(!(!ke(t)||t.scope!=="node"))return n.nodes.find(r=>r.id===t.owner)}s(XD,"contractNodeOf");function X3(e,n,t){let r=XD(e,n),i=r===void 0?null:Ma(r),o=i===null?void 0:t?.traeger?.get(i);return o===void 0||o.hasSignatory?[]:[cr(e,"signing",JD(o.name))]}s(X3,"traegerSignatoryIssues");function e4(e,n,t){let r=XD(e,n);if(r===void 0)return[];let i=t?.resolverDocumentAnchors?.get(r.id);if(i===void 0)return[];let o=e.label?.de??e.id,a=e.label?.en||e.id,l=[];for(let d of i)d.documentAnchors===null?l.push(cr(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage des Generators \u201E${d.pin}\u201C wurde nie auf Unterschriftsanker gelesen \u2014 Vorlage neu hochladen und den Generator neu versiegeln.`,en:`[countersign/eSignatureAnchorMissing] "${a}" countersigns electronically, but the template of generator "${d.pin}" was never read for signature anchors \u2014 upload the template again and seal the generator again.`})):d.documentAnchors.has(Nm)||l.push(cr(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage von \u201E${d.pin}\u201C tr\xE4gt keinen Anker /unterschrift:${Nm}/ \u2014 der Anbieter f\xE4nde f\xFCr die Schule kein Unterschriftsfeld.`,en:`[countersign/eSignatureAnchorMissing] "${a}" countersigns electronically, but the template of "${d.pin}" carries no anchor /unterschrift:${Nm}/ \u2014 the provider would find no signature field for the school.`}));return l}s(e4,"traegerAnchorIssues");var hb=100;async function n4(e,n){let t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",o=>o.eq("context.applicationId",n.applicationId).eq("context.anchor.nodeId",n.node.id)).take(hb+1);t.length>hb&&M(`countersign node "${n.node.id}" of ${n.applicationId} holds more than ${hb} rows`);let r=t.filter(o=>o.isOpen),i=s(o=>{if(o.context.kind!=="admission")return;let a=o.context.anchor;return"templateKey"in a?a.templateKey:void 0},"templateKeyOf");return r.some(o=>i(o)===mt)?"signatureStalled":r.some(o=>i(o)===Ed)?"countersigning":Od(n.node)?"awaitingSignature":"done"}s(n4,"countersignCurrentState");var ZD={[mb]:{label:ie("Gegenzeichnung","Countersignature"),tone:"teal",phase:{key:"gegenzeichnung",label:ie("Gegenzeichnung","Countersignature"),scope:"node"},external:rn(ie("Vertrag unterschrieben","Contract signed"),"blue",ie("Die Schule zeichnet Ihren Vertrag gegen","The school is countersigning your contract"),ie("Vielen Dank f\xFCr Ihre Unterschrift. Sobald die Schule gegengezeichnet hat, finden Sie Ihr Exemplar hier.","Thank you for signing. As soon as the school has countersigned, you will find your copy here."))}},eF={inputs:s(()=>[{id:"dueInDays",label:{de:"Frist der Aufgabe (Tage)",en:"Task due in (days)"},type:"number",inspector:"literal-only"}],"inputs"),role:"user-action",effect:"side-effect",outcomes:[{id:GD,label:{de:"Gegengezeichnet",en:"Countersigned"}}],progressDefaults:ZD,progressEvents:Hn(ZD),entryProgressEvent:s(()=>mb,"entryProgressEvent"),notificationEvents:s(()=>[{id:zD,label:{de:"Vertrag gegengezeichnet",en:"Contract countersigned"},audience:"external",required:!0,args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0}]}],"notificationEvents"),actions:s(e=>[{id:pb,kind:"internal",label:WD,surface:dr,availableIn:["countersigning"]},...Od(e)?[{id:ls,kind:"internal",surface:dr,label:{de:"Auf Papier umstellen",en:"Switch to paper"},availableIn:["signatureStalled"]}]:[]],"actions"),workItemTemplates:s(e=>[{key:Ed,recipient:"internal",title:e.titles?.countersign??ja,unlocks:[pb],advancesNode:!0,...QD(e)!==void 0?{dueInDays:QD(e)}:{}},...Od(e)?[{key:mt,recipient:"internal",title:HD,unlocks:[ls],gatesNode:!1,advancesNode:!1}]:[]],"workItemTemplates"),placelessTasks:{[Ed]:"Worked in its own step: the contract it countersigns is another node's slot, which this node names by address only.",[mt]:"Worked in its own step (\u201EAuf Papier umstellen\u201C): it is about the Tr\xE4ger's Vorgang, which has no view of its own."},states:YD,currentState:n4,validate:s((e,n,t)=>{let r=[],i=e.label?.de??e.id,o=e.label?.en||e.id;e.assign?.[Ed]===void 0&&r.push(cr(e,"assign",{de:`[countersign/assign] \u201E${i}": wer gegenzeichnet, fehlt \u2014 \`assign.countersign\` nennt das Team.`,en:`[countersign/assign] "${o}": who countersigns is missing \u2014 \`assign.countersign\` names the team.`})),Zi(e.titles?.countersign)||r.push(cr(e,"titles",{de:`[countersign/missingTitle] \u201E${i}": der Titel der Aufgabe fehlt \u2014 \`titles.countersign\` auf Deutsch und Englisch.`,en:`[countersign/missingTitle] "${o}": the task title is missing \u2014 \`titles.countersign\` in German and English.`}));let l=e.inputs?.dueInDays;l!==void 0&&l.kind!=="unset"&&!(l.kind==="literal"&&typeof l.value=="number"&&Number.isInteger(l.value)&&l.value>=1)&&r.push(cr(e,"inputs.dueInDays",{de:`[countersign/dueInDays] \u201E${i}": dueInDays ist eine ganze Zahl \u2265 1.`,en:`[countersign/dueInDays] "${o}": dueInDays is a whole number \u2265 1.`})),r.push(...Z3(e,n,t));let d=e.contract;if(!ke(d))return r;let c=Q3(n,e.id,d);if(c.length===0)return r;let u=n.nodes.find(p=>d.scope==="node"&&p.id===d.owner);if(c.includes("sourceNotCheckedContract")&&r.push(cr(e,"contract",{de:`[countersign/sourceNotCheckedContract] \u201E${i}" zeichnet das Dokument von \u201E${u.label?.de??u.id}" (${u.id}) gegen \u2014 gegenzeichnen l\xE4sst sich nur ein erzeugter Vertrag, den die Familie mit verbuchten Unterschriften unterschreibt (governedDocument mit production: resolver und responseStrategy: signedUploadChecked oder eSignature).`,en:`[countersign/sourceNotCheckedContract] "${o}" countersigns the document of "${u.label?.en||u.id}" (${u.id}) \u2014 only a generated contract that the family signs with booked signatures can be countersigned (governedDocument with production: resolver and responseStrategy: signedUploadChecked or eSignature).`})),c.includes("twice")){let p=Dm(n,u.id).filter(h=>h.id!==e.id);r.push(cr(e,"contract",{de:`[countersign/twice] \u201E${i}": \u201E${u.label?.de??u.id}" (${u.id}) wird schon von ${p.map(h=>`"${h.id}"`).join(", ")} gegengezeichnet \u2014 ein Vertrag hat eine Gegenzeichnung.`,en:`[countersign/twice] "${o}": "${u.label?.en||u.id}" (${u.id}) is already countersigned by ${p.map(h=>`"${h.id}"`).join(", ")} \u2014 a contract has one countersignature.`}))}return r},"validate")};function t4(e){return _m(e)?Ma(e):null}s(t4,"traegerSignerOf");var r4=s(e=>e.type==="end"&&ts(e)==="approved","isApprovedEnd");function nF(e){let n=[];for(let t of e.nodes){let r=t4(t);if(r===null)continue;let i=Dm(e,t.id).map(u=>u.id),o=mP(e,t.id,new Set(i),r4);if(o===null)continue;let a=t.label?.de||t.id,l=t.label?.en||t.id,d={de:`Einen Knoten \u201EUnterschrift (intern)\u201C (countersign) mit contract: $node.${t.id}.contract auf jeden Weg zu einem Ende mit Ergebnis approved setzen.`,en:`Place an "Internal signature" node (countersign) with contract: $node.${t.id}.contract on every path to an end with outcome approved.`},c=i.length===0?{de:`[countersign/missingForContract] \u201E${a}\u201C (${t.id}) erzeugt einen Vertrag, den der Tr\xE4ger \u201E${r}\u201C mitunterschreibt, aber keine Gegenzeichnung nennt ihn \u2014 der Vertrag w\xFCrde nie unterschrieben und nie abgerechnet. ${d.de}`,en:`[countersign/missingForContract] "${l}" (${t.id}) generates a contract the legal entity "${r}" co-signs, but no countersignature names it \u2014 the contract would never be signed and never billed. ${d.en}`}:{de:`[countersign/missingForContract] \u201E${a}\u201C (${t.id}): ein Weg erreicht das Ende \u201E${o}\u201C (Ergebnis approved), ohne durch die Gegenzeichnung ${i.map(u=>`\u201E${u}\u201C`).join(", ")} zu laufen \u2014 dort bliebe der Vertrag ohne Unterschrift des Tr\xE4gers \u201E${r}\u201C und w\xFCrde nie abgerechnet. ${d.de}`,en:`[countersign/missingForContract] "${l}" (${t.id}): a path reaches the end "${o}" (outcome approved) without passing the countersignature ${i.map(u=>`"${u}"`).join(", ")} \u2014 there the contract would lack the signature of the legal entity "${r}" and never be billed. ${d.en}`};n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}`,reason:c,severity:"error"})}return n}s(nF,"checkCountersignCoverage");var i4=[{key:"blocks",why:{de:"sie h\xE4lt nichts zur\xFCck, sie ist mit dem Ausl\xF6sen erledigt",en:"it holds nothing back, it is done with the press"}},{key:"when",why:{de:"sie entsteht bei jedem Ausl\xF6sen",en:"it is created on every press"}},{key:"optional",why:{de:"wer ausl\xF6st, beantwortet sie immer",en:"whoever presses always answers it"}},{key:"familyRequest",why:{de:"sie fragt nicht die Familie",en:"it does not ask the family"}},{key:"feedback",why:{de:"sie beantwortet die ausl\xF6sende Person, nicht ein Link",en:"the presser answers it, not a link"}},{key:"completableIf",why:{de:"sie wird beim Ausl\xF6sen erledigt, eine Vorbedingung w\xFCrde jedes Ausl\xF6sen ablehnen",en:"it is completed at the press, a precondition would refuse every press"}},{key:"locksEvidence",why:{de:"eine offene Korrektur w\xFCrde jedes Ausl\xF6sen ablehnen",en:"an open correction would refuse every press"}}];function tF(e){let{nodeId:n,bindingKey:t,binding:r}=e,i=[],o=`nodes.${n}.optionalActions.${t}.input`,a=s((u,p=o)=>{i.push({layer:"GRAPH",kind:"nodeRule",path:p,severity:"error",reason:{de:`[optionalAction/input] Optionale Aktion "${t}" auf Knoten "${n}": ${u.de}`,en:`[optionalAction/input] Optional action "${t}" on node "${n}": ${u.en}`}})},"push");if(r.input===void 0)return r.submitLabel!==void 0&&a({de:"'submitLabel' beschriftet das Absenden des Eingabedialogs \u2014 ohne 'input' \xF6ffnet das Ausl\xF6sen keinen Dialog.",en:"'submitLabel' names the input dialog's submit button \u2014 without 'input' the press opens no dialog."},`nodes.${n}.optionalActions.${t}.submitLabel`),i;let l=r.input;if(typeof l!="string"||l.trim().length===0)return a({de:"'input' muss der Schl\xFCssel einer ihrer Aufgaben sein.",en:"'input' must be the key of one of its tasks."}),i;let d=Array.isArray(r.tasks)?r.tasks:[];if(!d.includes(l))return a({de:`Die Eingabe "${l}" ist keine ihrer Aufgaben ('tasks') \u2014 die Eingabe geh\xF6rt zur Runde der Aktion.`,en:`The input "${l}" is none of its tasks ('tasks') \u2014 the input belongs to the action's round.`}),i;let c=s(u=>{let p=e.templates.find(h=>h.key===u);return p!==void 0&&p.optional===void 0&&p.blocks===void 0},"holdsNode");d.some(u=>u!==l&&c(u))||a({de:`Neben der Eingabe "${l}" hat die Aktion keine Aufgabe, die den Schritt zur\xFCckh\xE4lt (weder 'optional' noch hinter 'blocks') \u2014 die Runde w\xE4re mit dem Ausl\xF6sen schon erledigt.`,en:`Besides the input "${l}" the action has no task that holds the step (neither 'optional' nor behind 'blocks') \u2014 the round would be done with the press.`});for(let u of o4({nodeId:n,binding:r,templates:e.templates,input:l}))a(u);return i}s(tF,"optionalActionInputIssues");function o4(e){let{nodeId:n,binding:t,templates:r,input:i}=e,o=r.find(u=>u.key===i);if(o===void 0)return[];let a=[];o.result?.kind!=="record"&&a.push({de:`Die Eingabe "${i}" braucht ein Ergebnis der Art 'record' \u2014 nur dessen Werte lesen die anderen Aufgaben der Runde.`,en:`The input "${i}" needs a result of kind 'record' \u2014 only its values are read by the round's other tasks.`});let l=o.assign?.group;typeof t.trigger!="string"?a.push({de:"Mit einer Eingabe braucht die Aktion ein 'trigger'-Team \u2014 die Eingabe ist eine Aufgabe dieses Teams.",en:"With an input the action needs a 'trigger' team \u2014 the input is a task of that team."}):l!==void 0&&l!==t.trigger&&a.push({de:`Die Eingabe "${i}" geh\xF6rt dem Team "${String(l)}", ausgel\xF6st wird die Aktion vom Team "${t.trigger}" \u2014 wer ausl\xF6st, beantwortet die Eingabe, also ist es dasselbe Team.`,en:`The input "${i}" belongs to the team "${String(l)}", the action is pressed by the team "${t.trigger}" \u2014 whoever presses answers the input, so it is the same team.`});let d=o.result,c=d?.fields;for(let u of Array.isArray(c)?c:[])u.evidence===!0&&a.push({de:`Das Feld "${String(u.key)}" der Eingabe "${i}" verlangt eine Datei ('evidence') \u2014 das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The field "${String(u.key)}" of the input "${i}" demands a file ('evidence') \u2014 the press carries values only.`}),u.suggest!==void 0&&a.push({de:`Das Feld "${String(u.key)}" der Eingabe "${i}" tr\xE4gt einen Vorschlag ('suggest') \u2014 eine Abweichung verlangt eine Begr\xFCndung, das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The field "${String(u.key)}" of the input "${i}" carries a suggestion ('suggest') \u2014 a departure demands a reason, the press carries values only.`});d?.textRequired===!0&&a.push({de:`Die Eingabe "${i}" verlangt einen Text ('textRequired') \u2014 das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The input "${i}" demands a text ('textRequired') \u2014 the press carries values only.`});for(let{key:u,why:p}of i4)o[u]!==void 0&&a.push({de:`Die Eingabe "${i}" tr\xE4gt '${u}' \u2014 ${p.de}.`,en:`The input "${i}" carries '${u}' \u2014 ${p.en}.`});for(let u of r){let p=u.blocks;p?.templateKey!==i||p.node!==void 0&&p.node!==n||a.push({de:`"${String(u.key)}" h\xE4lt die Eingabe "${i}" per 'blocks' zur\xFCck \u2014 sie ist beim Anlegen der Runde schon erledigt, es gibt nichts zur\xFCckzuhalten.`,en:`"${String(u.key)}" holds the input "${i}" back through 'blocks' \u2014 it is already done when the round is created, there is nothing to hold back.`})}return a}s(o4,"optionalActionInputRefusals");function s4(e){let n="error",t=new Map;for(let a of Ut(e.nodes)){let l=t.get(a.source)??[];l.push({id:a.id,target:a.target}),t.set(a.source,l)}let r=[],i=new Set,o=hm(e.nodes.map(a=>a.id),a=>(t.get(a)??[]).map(({id:l,target:d})=>({target:d,edge:l})));for(let a of o)i.has(a.edge)||(i.add(a.edge),r.push({layer:"GRAPH",kind:"cycle",path:`edge.${a.edge}`,reason:{de:`Zyklus \xFCber Kante ${a.source} \u2192 ${a.target}`,en:`Cycle through edge ${a.source} \u2192 ${a.target}`},severity:n}));return r}s(s4,"checkAcyclic");function a4(e){let n=[],t=new Set(e.nodes.map(i=>i.id)),r="error";for(let i of e.nodes){let o=i.next;if(o)for(let[a,l]of Object.entries(o))t.has(l.to)||n.push({layer:"GRAPH",kind:"routing",path:`node.${i.id}.next.${a}`,reason:{de:`${i.label.de}: next.${a} verweist auf nicht-existenten Knoten '${l.to}'`,en:`${i.label.en}: next.${a} points to a node that does not exist: '${l.to}'`},severity:"error"});if(i.type!=="end"&&!(!i.outcomes||i.outcomes.length===0))for(let a of i.outcomes)(!o||!(a.id in o))&&n.push({layer:"GRAPH",kind:"routing",path:`node.${i.id}.outcome.${a.id}`,reason:{de:`${i.label.de}: Outcome '${a.label.de}' fehlt im next-Mapping`,en:`${i.label.en}: outcome '${a.label.en}' is missing from the next mapping`},severity:r})}return n}s(a4,"checkNextTargets");function l4(e){let n=[];for(let t of e.nodes){let r=t.next;if(!r)continue;let i=Rk(t),o=new Set(i?i.map(a=>a.id):[Sa]);for(let a of Object.keys(r))o.has(a)||n.push({layer:"GRAPH",kind:"unknownOutcome",path:`node.${t.id}.next.${a}`,reason:{de:`${t.label.de}: next-Schl\xFCssel '${a}' ist kein g\xFCltiges Outcome dieses Knotens (erlaubt: ${[...o].join(", ")}) \u2014 die Kante w\xFCrde im Editor verschwinden`,en:`${t.label.en}: next key '${a}' is not a valid outcome of this node (allowed: ${[...o].join(", ")}) \u2014 the edge would disappear in the editor`},severity:"error"})}return n}s(l4,"checkNextOutcomesKnown");function d4(e){let n=[],t=new Set(Ut(e.nodes).map(o=>o.target)),r=e.nodes.filter(o=>!t.has(o.id));return r.length===0?n.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein Start-Knoten",en:"No start node"},severity:"error"}):r.length>1&&n.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:`Mehrere Start-Knoten (${r.map(o=>o.label.de).join(", ")})`,en:`Multiple start nodes (${r.map(o=>o.label.en).join(", ")})`},severity:"warning"}),e.nodes.filter(o=>o.type==="end").length===0&&n.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein End-Knoten",en:"No end node"},severity:"warning"}),n}s(d4,"checkStartEnd");function c4(e){let n=new Map;for(let r of Ut(e.nodes))n.set(r.source,(n.get(r.source)??0)+1);let t=[];for(let r of e.nodes)r.type!=="end"&&(n.get(r.id)??0)===0&&t.push({layer:"GRAPH",kind:"startEnd",path:`node.${r.id}`,reason:{de:`${r.label.de}: keine ausgehende Kante`,en:`${r.label.en}: no outgoing edge`},severity:"warning"});return t}s(c4,"checkNoOutgoingEdge");function u4(e){return e.nodes.filter(n=>!ww(n.id)).map(n=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.id`,reason:{de:`[graph/nodeIdFormat] Knoten "${n.id}": eine Knoten-ID ist ein Bezeichner ohne Punkt (${Rr.source}), z. B. "reviewEingereicht". Ein Bundle von vor der Umstellung neu exportieren.`,en:`[graph/nodeIdFormat] Node "${n.id}": a node id is an identifier without a dot (${Rr.source}), e.g. "reviewSubmitted". Export a bundle from before the change again.`},severity:"error"}))}s(u4,"checkNodeIdFormat");function f4(e){let n=new Set(e.nodes.map(r=>r.id)),t=[];for(let r of Ut(e.nodes))n.has(r.source)||t.push({layer:"GRAPH",kind:"startEnd",path:`edge.${r.id}`,reason:{de:`Kante ${r.id}: Quelle '${r.source}' nicht gefunden`,en:`Edge ${r.id}: source '${r.source}' not found`},severity:"error"}),n.has(r.target)||t.push({layer:"GRAPH",kind:"startEnd",path:`edge.${r.id}`,reason:{de:`Kante ${r.id}: Ziel '${r.target}' nicht gefunden`,en:`Edge ${r.id}: target '${r.target}' not found`},severity:"error"});return t}s(f4,"checkEdgeEndpoints");function p4(e){let n=[];for(let t of e.nodes)for(let r of t.tasks??[]){let i=r.result;i===null||typeof i!="object"||!(nm in i)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.tasks.${r.key}.result.${nm}`,reason:{de:`[graph/retiredField] Aufgabe "${r.key}": \`primaryHostTeams\` hei\xDFt jetzt \`primaryParticipantTeams\` \u2014 der alte Name wird nicht mehr gelesen, die Teilnehmer-Auswahl zeigt die Teams nicht oben. Bitte umbenennen.`,en:`[graph/retiredField] Task "${r.key}": \`primaryHostTeams\` is now called \`primaryParticipantTeams\` \u2014 the old name is no longer read, so the participant picker does not list the teams first. Please rename it.`},severity:"error"})}return n}s(p4,"checkRenamedFields");var m4=new Set(["countersignature"]);function h4(e){let n=[],t=s((o,a)=>{n.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:{de:`[graph/retiredField] ${a.de}`,en:`[graph/retiredField] ${a.en}`},severity:"error"})},"retired"),r={de:"Preise rechnet der Vertragsgenerator (`prices`), nicht der Workflow \u2014 binde Rang und Reduktion an seine Eing\xE4nge.",en:"Prices are computed by the contract generator (`prices`), not the workflow \u2014 bind rank and reduction to its inputs."},i=e;"pricingRules"in i&&t("pricingRules",r);for(let[o,a]of(Array.isArray(i.processStore)?i.processStore:[]).entries())for(let l of["derive","absentValue"])a!==null&&typeof a=="object"&&l in a&&t(`processStore.${o}.${l}`,r);for(let o of e.nodes)for(let a of o.tasks??[]){let l=a.result;l!==null&&typeof l=="object"&&"prices"in l&&t(`nodes.${o.id}.tasks.${a.key}.result.prices`,r)}for(let o of e.nodes){let a=o,l={de:`Knoten \u201E${Pe(e,o.id,"de")}\u201C (${o.id})`,en:`Node "${Pe(e,o.id,"en")}" (${o.id})`};for(let[c,u]of Object.entries(a.next??{}))u!==null&&typeof u=="object"&&"emits"in u&&t(`nodes.${o.id}.next.${c}.emits`,{de:`${l.de}: \`next.${c}.emits\` gibt es nicht mehr \u2014 ein Ausgang routet nur; ein Knoten liest Daten \xFCber Adressen in seinen eigenen Feldern.`,en:`${l.en}: \`next.${c}.emits\` no longer exists \u2014 an outcome only routes; a node reads data through addresses in its own fields.`});for(let c of Array.isArray(a.outcomes)?a.outcomes:[])c!==null&&typeof c=="object"&&"emits"in c&&t(`nodes.${o.id}.outcomes.${String(c.id)}.emits`,{de:`${l.de}: \`emits\` am Ausgang "${String(c.id)}" gibt es nicht mehr \u2014 ein Knoten liest Daten \xFCber Adressen in seinen eigenen Feldern.`,en:`${l.en}: \`emits\` on the outcome "${String(c.id)}" no longer exists \u2014 a node reads data through addresses in its own fields.`});"targetFormNodeId"in a&&t(`nodes.${o.id}.targetFormNodeId`,{de:`${l.de}: \`targetFormNodeId\` gibt es nicht mehr \u2014 welches Formular freigeschaltet wird, sagt die Adresse, an die der Eingang \`inputs.target\` gebunden ist ($node.<formular>.admission).`,en:`${l.en}: \`targetFormNodeId\` no longer exists \u2014 the address the input \`inputs.target\` is bound to says which form is unlocked ($node.<form>.admission).`}),"wires"in a&&t(`nodes.${o.id}.wires`,{de:`${l.de}: Datenkanten (\`wires\`) gibt es nicht mehr \u2014 jedes Feld, das Daten eines anderen Knotens liest, tr\xE4gt selbst die volle Adresse ($node.\u2026, $task.\u2026, $env.\u2026).`,en:`${l.en}: data edges (\`wires\`) no longer exist \u2014 every field that reads data of another node carries the full address itself ($node.\u2026, $task.\u2026, $env.\u2026).`});for(let[c,u]of Object.entries(a.inputs??{}))u!==null&&typeof u=="object"&&u.kind==="binding"&&"path"in u&&t(`nodes.${o.id}.inputs.${c}.path`,{de:`${l.de}: Der Eingang \u201E${c}\u201C ist \xFCber einen Pfad (\`path\`) gebunden \u2014 eine Bindung tr\xE4gt die volle Adresse (\`address\`) dessen, was sie liest.`,en:`${l.en}: The input "${c}" is bound through a path (\`path\`) \u2014 a binding carries the full address (\`address\`) of what it reads.`});o.type==="governedDocument"&&"resolver"in a&&t(`nodes.${o.id}.resolver`,{de:`${l.de}: \`resolver\` gibt es nicht mehr \u2014 der Generator ist der Eingang \`inputs.contractGenerator\` ({ kind, key }), seine Parameter stempelt die Plattform (\`generatorStamp\`), ein im Cockpit erg\xE4nzter Parameter ist sein Eingang \`{ kind: "cockpit" }\`.`,en:`${l.en}: \`resolver\` no longer exists \u2014 the generator is the input \`inputs.contractGenerator\` ({ kind, key }), the platform stamps its parameters (\`generatorStamp\`), a parameter completed in the cockpit is its input \`{ kind: "cockpit" }\`.`});let d=a.template;if(o.type==="governedDocument"&&d!==null&&typeof d=="object")for(let c of["key","cockpitFields"])c in d&&t(`nodes.${o.id}.template.${c}`,{de:`${l.de}: \`template.${c}\` gibt es nicht mehr \u2014 ${c==="key"?"die Vorlage ist der Eingang `inputs.documentTemplate`":'ein im Cockpit erg\xE4nzter Parameter ist sein Eingang `{ kind: "cockpit" }`'}.`,en:`${l.en}: \`template.${c}\` no longer exists \u2014 ${c==="key"?"the template is the input `inputs.documentTemplate`":'a parameter completed in the cockpit is its input `{ kind: "cockpit" }`'}.`});if(o.type==="setFlag")for(let c of["target","flagKey","value"])c in a&&t(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es am setFlag-Knoten nicht mehr \u2014 Formular, Merkmal und Wert sind die Eing\xE4nge \`inputs.target\` (gebunden an die Adresse $node.<formular>.admission), \`inputs.flagKey\` und \`inputs.value\` (feste Werte).`,en:`${l.en}: \`${c}\` no longer exists on a setFlag node \u2014 form, flag and value are the inputs \`inputs.target\` (bound to the address $node.<form>.admission), \`inputs.flagKey\` and \`inputs.value\` (literals).`});for(let c of Object.keys(nk[o.type]??{}))c in a&&t(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es als Knoteneigenschaft nicht mehr \u2014 es ist der Eingang \`inputs.${c}\` (ein fester Wert im Parameter-Bereich).`,en:`${l.en}: \`${c}\` no longer exists as a node property \u2014 it is the input \`inputs.${c}\` (a fixed value among the parameters).`});for(let c of Array.isArray(a.tasks)?a.tasks:[]){if(c===null||typeof c!="object")continue;let u=String(c.key),p=c.assign;p!==null&&typeof p=="object"&&"userId"in p&&t(`nodes.${o.id}.tasks.${u}.assign.userId`,{de:`Aufgabe "${u}" an ${l.de}: \`assign.userId\` gibt es nicht mehr \u2014 eine Aufgabe nennt ihr Team (\`assign.group\`), nie eine feste Person.`,en:`Task "${u}" on ${l.en}: \`assign.userId\` no longer exists \u2014 a task names its team (\`assign.group\`), never a fixed person.`});for(let[h,y]of Object.entries(sb))h in c&&t(`nodes.${o.id}.tasks.${u}.${h}`,y(u,l))}for(let c of tk[o.type]??[])c in a&&t(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es nicht mehr \u2014 dieser Knotentyp liest es nicht.`,en:`${l.en}: \`${c}\` no longer exists \u2014 this node type does not read it.`});for(let[c,u]of Object.entries(_C[o.type]??{}))c in a&&t(`nodes.${o.id}.${c}`,{de:`${l.de}: ${u.de}`,en:`${l.en}: ${u.en}`});a.adoptForm===!0&&t(`nodes.${o.id}.adoptForm`,{de:`${l.de}: \`adoptForm: true\` gibt es nicht mehr \u2014 \`adoptForm\` ist die Adresse des \xFCbernommenen Formulars ($node.<anlegender Formularknoten>.admission).`,en:`${l.en}: \`adoptForm: true\` no longer exists \u2014 \`adoptForm\` is the address of the adopted form ($node.<creating form node>.admission).`});for(let c of Array.isArray(a.tasks)?a.tasks:[]){let u=c?.result?.kind;typeof u=="string"&&m4.has(u)&&t(`nodes.${o.id}.tasks.${String(c.key)}.result`,{de:`Aufgabe "${String(c.key)}" an ${l.de}: das Ergebnis \u201E${u}" gibt es nicht mehr \u2014 die Gegenzeichnung ist der Knotentyp \u201EUnterschrift (intern)" (countersign).`,en:`Task "${String(c.key)}" on ${l.en}: the result "${u}" no longer exists \u2014 the countersignature is the node type "Signature (internal)" (countersign).`})}}return n}s(h4,"checkRetiredDataFields");function ps(e,n){return n?.wiring&&n.layout?{wiring:n.wiring,layout:n.layout}:null}s(ps,"resolveLayoutContext");function g4(e,n){let t=ps(e,n);if(!t)return e.nodes.some(o=>(Qe(o)?.progressEvents?.length??0)>0)?[{layer:"GRAPH",kind:"progressState",path:"graph.progressWiring",reason:{de:`Graph emittiert Progress-Events, aber (Layout, Wiring) konnte nicht aufgel\xF6st werden (Wiring ${n?.wiring?"vorhanden":"fehlt"}, Layout ${n?.layout?"vorhanden":"fehlt"}) \u2014 der Engine wirft beim Spiegeln zur Laufzeit. Der Workflow-Entwurf muss progressLayout und progressWiring tragen.`,en:`The graph emits progress events, but (layout, wiring) could not be resolved (wiring ${n?.wiring?"present":"missing"}, layout ${n?.layout?"present":"missing"}) \u2014 the engine throws at runtime when mirroring. The workflow draft must carry progressLayout and progressWiring.`},severity:"error"}]:[];let r=[];for(let i of e.nodes){let a=Qe(i)?.progressEvents;if(a)for(let l of a){let d=es(t.wiring,{id:i.id,type:i.type},l);if(!d){r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Progress-Event '${l}' ist im Wiring (Layout '${t.layout.id}') keinem (Bus, State) zugeordnet \u2014 der Engine wirft beim Spiegeln`,en:`${i.type} '${i.id}': progress event '${l}' is not mapped to any (bus, state) in the wiring (layout '${t.layout.id}') \u2014 the engine throws when mirroring`},severity:"error"});continue}let c;try{c=Hp(t.layout,d.bus)}catch{r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Event '${l}' verweist auf unbekannten Bus '${d.bus}' im Layout '${t.layout.id}'`,en:`${i.type} '${i.id}': event '${l}' points to unknown bus '${d.bus}' in layout '${t.layout.id}'`},severity:"error"});continue}ud(c,d.state)||r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Event '${l}' verweist auf State '${d.state}', der nicht im Bus '${d.bus}' deklariert ist`,en:`${i.type} '${i.id}': event '${l}' points to state '${d.state}', which is not declared in bus '${d.bus}'`},severity:"error"})}}return r}s(g4,"checkProgressEventMappings");function y4(e,n){let t=ps(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses){if(!i.boards||i.boards.length===0)continue;let o=new Set(i.unboarded??[]),a=new Set;for(let l of i.boards)for(let d of l.columns)for(let c of d.states)a.add(c),ud(i,c)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.board.${l.id}.column.${d.id}.${c}`,reason:{de:`Board '${l.id}', Spalte '${d.id}' referenziert State '${c}', der nicht im Bus '${i.key}' deklariert ist`,en:`Board '${l.id}', column '${d.id}' references state '${c}', which is not declared in bus '${i.key}'`},severity:"error"});for(let l of i.states)a.has(l.id)||o.has(l.id)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.${l.id}`,reason:{de:`State '${l.id}' (${l.label.de}) erscheint in keiner Board-Spalte und nicht in 'unboarded' \u2014 nicht darstellbar`,en:`State '${l.id}' (${l.label.en}) appears in no board column and not in 'unboarded' \u2014 it cannot be displayed`},severity:"error"})}return r}s(y4,"checkProgressBoardCoverage");function w4(e,n){let t=ps(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses)if(!(!i.boards||i.boards.length===0))for(let o of i.boards)for(let a of Ge){let l=new Map;for(let d of o.columns){if(!Zi(d.label))continue;let c=d.label[a],u=c.trim().toLocaleLowerCase(a),p=l.get(u);if(p===void 0){l.set(u,d.id);continue}r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.board.${o.id}.column.${d.id}.label.${a}`,reason:{de:`Board '${o.id}' hat zwei Spalten mit dem Label '${c}' (${a}) ('${p}' und '${d.id}') \u2014 f\xFCr Lesende nicht unterscheidbar. F\xFChre die Spalten zusammen (states beider in EINE Spalte) oder vergib unterschiedliche Labels.`,en:`Board '${o.id}' has two columns with the label '${c}' (${a}) ('${p}' and '${d.id}') \u2014 readers cannot tell them apart. Merge the columns (put the states of both into ONE column) or give them different labels.`},severity:"error"})}}return r}s(w4,"checkProgressBoardDistinctLabels");function k4(e,n){let t=ps(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses)for(let o of i.states){let a=Jp(i,o.id);o.terminal&&!a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.${o.id}.terminalSemantics`,reason:{de:`Terminal-State '${o.id}' hat keine Terminal-Semantik im Bus '${i.key}' \u2014 der Engine wirft beim Versiegeln`,en:`Terminal state '${o.id}' has no terminal semantics in bus '${i.key}' \u2014 the engine throws when sealing`},severity:"error"}),!o.terminal&&a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.${o.id}.terminalSemantics`,reason:{de:`State '${o.id}' ist nicht terminal, hat aber Terminal-Semantik im Bus '${i.key}' \u2014 Inkonsistenz`,en:`State '${o.id}' is not terminal but has terminal semantics in bus '${i.key}' \u2014 inconsistent`},severity:"error"})}return r}s(k4,"checkProgressTerminalSemantics");function b4(e,n){let t=ps(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses){let o=new Set(i.holdsSeat??[]);for(let a of i.holdsSeat??[])ud(i,a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.holdsSeat.${a}`,reason:{de:`holdsSeat referenziert '${a}', das kein State im Bus '${i.key}' ist`,en:`holdsSeat references '${a}', which is not a state in bus '${i.key}'`},severity:"error"});for(let a of i.commitsSeat??[])ud(i,a)?o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.commitsSeat.${a}`,reason:{de:`commitsSeat '${a}' ist nicht in holdsSeat \u2014 ein fest belegter Platz muss auch belegt sein`,en:`commitsSeat '${a}' is not in holdsSeat \u2014 a firmly committed seat must also be held`},severity:"error"}):r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.commitsSeat.${a}`,reason:{de:`commitsSeat referenziert '${a}', das kein State im Bus '${i.key}' ist`,en:`commitsSeat references '${a}', which is not a state in bus '${i.key}'`},severity:"error"});for(let[a,l]of Object.entries(i.terminalSemantics??{}))l.outcome==="approved"&&(o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.holdsSeat`,reason:{de:`Endzustand '${a}' schlie\xDFt den Prozess positiv ab (outcome 'approved'), steht aber nicht in holdsSeat \u2014 damit z\xE4hlt er als Absage und f\xE4llt aus dem Fortschrittsbalken. Nimm '${a}' in holdsSeat (und in commitsSeat, wenn der Platz damit wirklich belegt ist) auf.`,en:`Final state '${a}' ends the process positively (outcome 'approved'), but is not in holdsSeat \u2014 so it counts as a rejection and drops out of the progress bar. Add '${a}' to holdsSeat (and to commitsSeat, if the seat is really taken by it).`},severity:"error"}))}return r}s(b4,"checkProgressSeatStates");var Fm={de:"Abhilfe: nach dem Formularknoten einen review-Knoten einf\xFCgen und dessen 'reviewing' auf diesen Zustand mappen",en:"Remedy: insert a review node after the form node and map its 'reviewing' to this state"};function v4(e,n,t){let r=new Map(e.nodes.map(y=>[y.id,y])),i=new Set(Ut(e.nodes).map(y=>y.target)),o=e.nodes.filter(y=>!i.has(y.id)),a=o.some(y=>y.type==="eventTrigger"),l=s(y=>Object.values(y.next??{}).map(b=>b.to),"routesOf"),d=[],c=s((y,b,k)=>{let v=r.get(y);if(!v||k.has(y)){d.push({at:y,state:null});return}let $=new Set([...k,y]);if(a&&o.includes(v)&&v.type!=="eventTrigger")return;if(v.type==="eventTrigger"&&o.includes(v)){let F=v.next?.[Vt]?.to;F===void 0?d.push({at:y,state:null}):c(F,b,$);return}let R=Qe(v);if(gb[v.type]===!1){if(Qe(v).progressEvents?.length){d.push({at:y,state:null});return}let F=l(v);F.length===0&&d.push({at:y,state:null});for(let C of F)c(C,b,$);return}let I=R.entryProgressEvent?.(v),D=b;if(I!==void 0){let F=es(n,v,I);F?.bus==="process"&&(D=F.state)}if(R.advancesAtEntry?.(v)===!0)for(let F of l(v))c(F,b,$);d.push({at:y,state:D})},"walk");for(let y of o)c(y.id,null,new Set);let u=d.map(y=>`'${y.at}'${y.state===null?"":` \u2192 '${y.state}'`}`),p=d.map(y=>y.state===null?null:t.columns.find(b=>b.states.includes(y.state))?.id??null);if(p.length===0||p.includes(null))return{kind:"none",landings:u};let h=[...new Set(p)];return h.length>1?{kind:"many",columnIds:h,landings:u}:{kind:"one",columnId:h[0]}}s(v4,"startColumnOf");function x4(e,n){let t=ps(e,n);if(!t)return[];if(!t.layout.buses.some(l=>l.key==="process"))return[];let r=vk(t.layout);if(!r)return[];let i=v4(e,t.wiring,r);if(i.kind==="one"){let l=r.columns.find(d=>d.id===i.columnId);return l.defaultCollapsed!==!0&&!vP(l)?[]:[{layer:"GRAPH",kind:"progressState",path:`progressLayout.process.boards.${r.id}.columns.${l.id}`,reason:{de:`[progress/startColumnHidden] Neue Vorg\xE4nge landen in Spalte '${l.id}' (Board '${r.id}'), die ${l.defaultCollapsed===!0?"eingeklappt":"die Warteliste"} ist \u2014 dort w\xE4re das Plus zum Hinzuf\xFCgen nicht zu sehen.`,en:`[progress/startColumnHidden] New applications land in column '${l.id}' (board '${r.id}'), which is ${l.defaultCollapsed===!0?"collapsed":"the waitlist"} \u2014 the add plus would not show there.`},severity:"error"}]}let o=i.landings.join(", "),a=i.kind==="none"?{de:`[progress/startColumnNone] Ein neuer Vorgang landet auf keiner Spalte des Boards '${r.id}' (Start endet bei ${o}) \u2014 ordne den Zustand, mit dem er anh\xE4lt, einer Spalte zu.`,en:`[progress/startColumnNone] A new application lands in no column of board '${r.id}' (the start stops at ${o}) \u2014 put the state it parks with into a column.`}:{de:`[progress/startColumnAmbiguous] Ein neuer Vorgang kann in mehreren Spalten des Boards '${r.id}' landen (${i.columnIds.join(", ")}; Start endet bei ${o}) \u2014 das Plus zum Hinzuf\xFCgen braucht genau eine Startspalte.`,en:`[progress/startColumnAmbiguous] A new application can land in several columns of board '${r.id}' (${i.columnIds.join(", ")}; the start stops at ${o}) \u2014 the add plus needs exactly one start column.`};return[{layer:"GRAPH",kind:"progressState",path:`progressLayout.process.boards.${r.id}`,reason:a,severity:"error"}]}s(x4,"checkProgressStartColumn");function S4(e){return e==="both"?{de:`${Fm.de} \u2014 die Spalte ist auch der Schritt, den die Familie sieht; den Zustand in die Spalte des Nachfolgers zu legen, n\xE4hme ihr diesen Schritt.`,en:`${Fm.en} \u2014 the column is also the step the family sees; moving the state into the successor's column would take that step away from them.`}:{de:`${Fm.de}, oder den Zustand in die Spalte des Nachfolgers legen.`,en:`${Fm.en}, or move the state into the successor's column.`}}s(S4,"passThroughRemedy");function A4(e,n){let t=ps(e,n);if(!t)return[];let{layout:r,wiring:i}=t;if(!r.buses.some(v=>v.key==="process"))return[];let o=vk(r);if(!o)return[];let a=new Map(e.nodes.map(v=>[v.id,v])),l=s(v=>Qe(v).progressEvents??[],"eventsOf"),d=s(v=>Object.values(v.next??{}).map($=>$.to),"routesOf"),c=s((v,$)=>{let R=a.get(v);if(!R||$.has(v))return null;if(l(R).length>0)return[R];if(gb[R.type]!==!1)return null;let I=d(R);if(I.length===0)return null;let D=[];for(let F of I){let C=c(F,new Set([...$,v]));if(!C)return null;D.push(...C)}return D},"firstProgressNodes"),u=s((v,$)=>{let R=[];for(let I of l(v)){let D=es(i,v,I);if(!D||D.bus!==$.bus||D.state===$.state)return null;R.push(D.state)}return[...new Set(R)].join("' / '")},"overwrites"),p=s((v,$)=>{let R=d(v);if(R.length===0)return null;let I=[];for(let D of R){let F=c(D,new Set([v.id]));if(!F)return null;for(let C of F){let x=u(C,$);if(x===null)return null;I.push({de:`'${C.id}' (${C.type}) mit '${x}'`,en:`'${C.id}' (${C.type}) with '${x}'`})}}return[...new Map(I.map(D=>[D.de,D])).values()]},"submitOverwrittenBy"),h=new Map;for(let v of e.nodes)for(let $ of l(v)){let R=es(i,v,$);if(!R||R.bus!=="process")continue;let I=v.type==="form"&&$===up?p(v,R):null,D=I?{de:`'${v.id}'.${$} erreicht ihn, und ${I.map(F=>F.de).join(", ")} \xFCberschreibt ihn in derselben Transaktion`,en:`'${v.id}'.${$} reaches it, and ${I.map(F=>F.en).join(", ")} overwrites it in the same transaction`}:null;h.set(R.state,[...h.get(R.state)??[],D])}let y=Hp(r,"process"),b=new Map;for(let[v,$]of h){if(!$.every(I=>I!==null))continue;let R=[...new Map($.map(I=>[I.de,I])).values()];b.set(v,{de:R.map(I=>I.de).join("; "),en:R.map(I=>I.en).join("; ")})}let k=[];for(let v of o.columns){if(v.states.length===0||!v.states.every(I=>b.has(I)))continue;let $=v.states.map(I=>{let D=y.holdsSeat?.includes(I)===!0,F=b.get(I);return{de:`Zustand '${I}'${D?" (steht in holdsSeat, belegt aber nie einen Platz)":""}: ${F.de}`,en:`State '${I}'${D?" (is in holdsSeat, but never takes a seat)":""}: ${F.en}`}}),R=S4(o.audience);k.push({layer:"GRAPH",kind:"progressState",path:`progressLayout.process.boards.${o.id}.columns.${v.id}`,reason:{de:`[progress/passThroughState] Spalte \u201E${v.label.de}" ('${v.id}', Board '${o.id}') bleibt immer leer \u2014 ${$.map(I=>I.de).join("; ")}. ${R.de}`,en:`[progress/passThroughState] Column "${v.label.en}" ('${v.id}', board '${o.id}') always stays empty \u2014 ${$.map(I=>I.en).join("; ")}. ${R.en}`},severity:"warning"})}return k}s(A4,"checkProgressPassThroughColumns");function T4(e){let n=["workItems","workitems","work_items","taskTemplates"],t=[];for(let r of e.nodes){let i=r;for(let o of n){let a=i[o];a!=null&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.${o}`,reason:{de:`[workItems/misnamedTasksKey] Knoten "${r.id}" deklariert "${o}" \u2014 komponierte Aufgaben werden ausschlie\xDFlich unter "tasks" gelesen. So wie es dasteht, w\xFCrde die Aufgabenkette stillschweigend nie entstehen. Benenne den Schl\xFCssel in "tasks" um.`,en:`[workItems/misnamedTasksKey] Node "${r.id}" declares "${o}" \u2014 composed tasks are read only from "tasks". As it stands, the task chain would silently never be created. Rename the key to "tasks".`},severity:"error"})}}return t}s(T4,"checkMisnamedTasksKey");function R4(e){let n=[];for(let t of e.nodes){let r=t,i=Array.isArray(r.tasks)?r.tasks:[],o=new Set;for(let c of i){let u=typeof c.key=="string"?c.key:void 0;u!==void 0&&(o.has(u)&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}`,reason:{de:`[workItems/duplicateTemplateKey] Doppelter Template-Key "${u}" auf Knoten "${r.id}".`,en:`[workItems/duplicateTemplateKey] Duplicate template key "${u}" on node "${r.id}".`},severity:"error"}),o.add(u))}let a=new Set;for(let c of Array.isArray(r.artifacts)?r.artifacts:[])typeof c.key=="string"&&a.add(`${c.key}Uploaded`);let l=Qe(t),d=new Map((typeof l.workItemTemplates=="function"?l.workItemTemplates(t):[]).map(c=>[c.key,c]));for(let c of i){let u=typeof c.key=="string"?c.key:"?",p=typeof c.kind=="string"?c.kind:void 0;if(p===void 0||!gd.has(p)){n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.kind`,reason:{de:`[workItems/invalidKind] Task "${u}" auf Knoten "${r.id}" hat Art ${JSON.stringify(c.kind)}; komponierbar sind: ${[...gd].join(", ")}.`,en:`[workItems/invalidKind] Task "${u}" on node "${r.id}" has kind ${JSON.stringify(c.kind)}; composable kinds are: ${[...gd].join(", ")}.`},severity:"error"});continue}p==="task"&&c.gatesNode!==void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.gatesNode`,reason:{de:`[workItems/gatesNodeOnTask] 'gatesNode' ist nur f\xFCr die Art 'approval' zul\xE4ssig \u2014 eine Task gated ihren Knoten nie direkt. Um eine gatende Freigabe zur\xFCckzuhalten, 'blocks' verwenden (Task "${u}" auf Knoten "${r.id}").`,en:`[workItems/gatesNodeOnTask] 'gatesNode' is only allowed for the kind 'approval' \u2014 a task never gates its node directly. To hold back a gating approval, use 'blocks' (task "${u}" on node "${r.id}").`},severity:"error"});let h=c.blocks,y=h===void 0?void 0:yD(e,r.id,h.node);if(h!==void 0&&y===null)n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.node`,reason:{de:`[workItems/blocksUnknownNode] 'blocks.node' auf Task "${u}" (Knoten "${r.id}") nennt ${JSON.stringify(h.node)} \u2014 diesen Knoten gibt es im Workflow nicht.`,en:`[workItems/blocksUnknownNode] 'blocks.node' on task "${u}" (node "${r.id}") names ${JSON.stringify(h.node)} \u2014 there is no such node in the workflow.`},severity:"error"});else if(h!==void 0&&y!==void 0&&y!==null){let k=y.node.id===r.id,v=y.node.id,$=k?o:y.composedKeys,R=k?d:y.intrinsicByKey,I=y.node.assign??{};p==="approval"&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks`,reason:{de:`[workItems/blocksOnApproval] 'blocks' ist auf der Art 'approval' verboten \u2014 nur Task-Zeilen d\xFCrfen einen Geschwister-Spawn zur\xFCckhalten (Approval "${u}" auf Knoten "${r.id}").`,en:`[workItems/blocksOnApproval] 'blocks' is forbidden on the kind 'approval' \u2014 only task rows may hold back a sibling spawn (approval "${u}" on node "${r.id}").`},severity:"error"});let D=h.templateKey,F=[...new Set([...$,...R.keys()])].filter(x=>!k||x!==u).join(", "),C={de:F||"keine",en:F||"none"};if(typeof D!="string"||k&&D===u||!$.has(D)&&!R.has(D))n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:{de:`[workItems/blocksUnknownTarget] 'blocks' muss ein Template auf dem Zielknoten benennen \u2014 komponiert ODER intrinsisch (nie sich selbst, nie ohne 'templateKey': die zielfreie Form geh\xF6rt der Maschine, nicht dem Autor). Ziel ${JSON.stringify(D)} auf Knoten "${v}"; zul\xE4ssige Ziele: ${C.de}.`,en:`[workItems/blocksUnknownTarget] 'blocks' must name a template on the target node \u2014 composed OR intrinsic (never itself, never without 'templateKey': the target-less form belongs to the engine, not the author). Target ${JSON.stringify(D)} on node "${v}"; allowed targets: ${C.en}.`},severity:"error"});else if(y.refuse(D)!==null)n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:y.refuse(D),severity:"error"});else{let x=R.get(D);h.except!==void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.except`,reason:{de:`[workItems/blocksExceptRetired] 'blocks.except' auf Task "${u}" (Knoten "${r.id}") gibt es nicht mehr: eine blockierende Aufgabe sperrt die ganze Aktionsgruppe ihres Ziels (bei einer Entscheidung Freigeben, Warteliste, Ablehnen und das Nachr\xFCcken). 'except' entfernen.`,en:`[workItems/blocksExceptRetired] 'blocks.except' on task "${u}" (node "${r.id}") no longer exists: a blocking task locks the whole action group of its target (for a decision: approve, waitlist, reject and promote). Remove 'except'.`},severity:"error"}),x!==void 0&&x.recipient!=="external"&&x.verdictResolved!==!0&&I[D]===void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:{de:`[workItems/blocksUnwiredTarget] Task "${u}" auf Knoten "${r.id}" h\xE4lt "${D}" (Knoten "${v}") zur\xFCck, aber der Knoten weist "${D}" keiner Gruppe zu \u2014 ohne 'assign.${D}' entsteht diese Zeile nie: kein Team bekommt die zur\xFCckgehaltene Arbeit, niemand au\xDFer der verantwortlichen Person kann sie tun. Entweder 'assign.${D}' erg\xE4nzen oder das 'blocks' entfernen.`,en:`[workItems/blocksUnwiredTarget] Task "${u}" on node "${r.id}" holds back "${D}" (node "${v}"), but the node assigns "${D}" to no group \u2014 without 'assign.${D}' this row is never created: no team receives the held-back work, and nobody except the responsible person can do it. Either add 'assign.${D}' or remove the 'blocks'.`},severity:"error"})}}{let k=c.completableIf;if(typeof k=="string"&&k.trim().length>0){let v=k.trim().replace(/^!/,"").trim();a.has(v)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.completableIf`,reason:{de:`[workItems/unknownExport] completableIf "${k}" verweist auf unbekannten Node-Export "${v}"; bekannt: ${[...a].join(", ")||"keine"}.`,en:`[workItems/unknownExport] completableIf "${k}" refers to unknown node export "${v}"; known: ${[...a].join(", ")||"none"}.`},severity:"error"})}}let b=c.params;if(b?.commentRequired!==void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.commentRequired`,reason:{de:"[workItems/removedParam] 'params.commentRequired' wurde entfernt \u2014 Kommentar-Pflichten werden am Decision-Node ('commentRequired') autorisiert.",en:"[workItems/removedParam] 'params.commentRequired' was removed \u2014 comment requirements are authored on the decision node ('commentRequired')."},severity:"error"}),p!=="approval"){let k=[];b?.onReject!==void 0&&k.push("params.onReject"),b?.revisionGroup!==void 0&&k.push("params.revisionGroup");for(let v of k)n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.${v}`,reason:{de:`[workItems/approvalOnlyField] '${v}' gilt nur f\xFCr die Art 'approval' (Task "${u}" ist '${p}').`,en:`[workItems/approvalOnlyField] '${v}' only applies to the kind 'approval' (task "${u}" is '${p}').`},severity:"error"});continue}b?.onReject!==void 0&&b.onReject!=="spawnRevision"&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.onReject`,reason:{de:`[workItems/invalidOnReject] Erwartet 'spawnRevision', erhalten ${JSON.stringify(b.onReject)}.`,en:`[workItems/invalidOnReject] Expected 'spawnRevision', got ${JSON.stringify(b.onReject)}.`},severity:"error"}),b?.onReject==="spawnRevision"&&(typeof b.revisionGroup!="string"||b.revisionGroup.length===0)&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.revisionGroup`,reason:{de:`[workItems/spawnRevisionNoTarget] Approval "${u}" mit 'params.onReject: spawnRevision' ohne 'params.revisionGroup' \u2014 die \xDCberarbeitung h\xE4tte keine Ziel-Gruppe.`,en:`[workItems/spawnRevisionNoTarget] Approval "${u}" with 'params.onReject: spawnRevision' but no 'params.revisionGroup' \u2014 the revision would have no target group.`},severity:"error"})}}return n.push(...wD(e)),n}s(R4,"checkWorkItemTemplates");var $4=new Set(["complete","approve","reject"]),gb={form:!0,decision:!0,review:!0,waitlist:!0,completenessCheck:!0,collectPayment:!0,eventTrigger:!0,join:!1,roleAssign:!1,setFlag:!1,if:!1,end:!1,countersign:!0,engagePush:!1,governedDocument:!0};function E4(e){let n=[];for(let t of e.nodes){let r=t,i=Qe(t),o=Array.isArray(r.tasks)?r.tasks.length:0,a=i.workItemTemplates?.(t)??[];if(o+a.length>0){let v=gb[r.type];v===void 0?n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks`,reason:{de:`[workItems/unknownParkSemantics] Knotentyp "${r.type}" hat keine bekannte Park-Semantik \u2014 NODE_TYPE_PARKS in validators.ts erg\xE4nzen.`,en:`[workItems/unknownParkSemantics] Node type "${r.type}" has no known parking semantics \u2014 add it to NODE_TYPE_PARKS in validators.ts.`},severity:"error"}):v||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks`,reason:{de:`[workItems/templatesOnNonParkingNode] Knoten "${r.id}" (Typ "${r.type}") parkt nie \u2014 seine Work-Item-Templates w\xFCrden im selben Dispatch gespawnt und storniert (totes Muster).`,en:`[workItems/templatesOnNonParkingNode] Node "${r.id}" (type "${r.type}") never parks \u2014 its work-item templates would be spawned and cancelled in the same dispatch (dead pattern).`},severity:"error"})}let l=i.actions?.(t)??[];if(l.length===0&&a.length===0)continue;let d=new Map(l.map(v=>[v.id,v]));for(let v of l)$4.has(v.id)&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}`,reason:{de:`[capability/reservedActionId] Knotentyp "${r.type}" deklariert die Action "${v.id}" \u2014 reserviert f\xFCr den generischen Complete-/Verdict-Pfad (complete, approve, reject); die Spec muss eine andere Action-Id w\xE4hlen.`,en:`[capability/reservedActionId] Node type "${r.type}" declares the action "${v.id}" \u2014 reserved for the generic complete/verdict path (complete, approve, reject); the spec must choose a different action id.`},severity:"error"});let c=new Set(i.states??[BP]);for(let v of l)if(v.availableIn!==void 0)for(let $ of v.availableIn)c.has($)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}.availableIn`,reason:{de:`[capability/unknownActionState] Action "${v.id}" auf Knotentyp "${r.type}" ist f\xFCr Zustand "${$}" deklariert \u2014 der Typ kennt nur: ${[...c].join(", ")}.`,en:`[capability/unknownActionState] Action "${v.id}" on node type "${r.type}" is declared for state "${$}" \u2014 the type only knows: ${[...c].join(", ")}.`},severity:"error"});let u=Rk(t),p=new Set(u?u.map(v=>v.id):[Sa]);for(let v of l){if(v.external===void 0)continue;let $=jP(v.external.event),R={de:"hat keine Beschriftung (der Empf\xE4nger bekommt einen leeren Button)",en:"has no label (the recipient would get an empty button)"},I=$?v.kind==="advance"?{de:`ist als "advance" deklariert, l\xF6st den Knoten aber nicht auf (Ereignis "${v.external.event}") \u2014 solche Aktionen sind "internal"`,en:`is declared as "advance", but does not resolve the node (event "${v.external.event}") \u2014 such actions are "internal"`}:v.outcome!==void 0?{de:`nennt das Outcome "${v.outcome}", l\xF6st den Knoten aber nicht auf (Ereignis "${v.external.event}") \u2014 ein Outcome w\xFCrde eine zweite, stille Routing-Vokabel behaupten`,en:`names the outcome "${v.outcome}", but does not resolve the node (event "${v.external.event}") \u2014 an outcome would claim a second, silent routing vocabulary`}:v.label===void 0?R:null:v.kind!=="advance"?{de:`ist als "${v.kind}" deklariert (externe Aktionen l\xF6sen den Knoten auf und m\xFCssen "advance" sein)`,en:`is declared as "${v.kind}" (external actions resolve the node and must be "advance")`}:v.outcome===void 0?{de:"nennt kein Outcome",en:"names no outcome"}:p.has(v.outcome)?v.label===void 0?R:null:{de:`verweist auf das unbekannte Outcome "${v.outcome}" (deklariert: ${[...p].join(", ")||"keine"})`,en:`refers to the unknown outcome "${v.outcome}" (declared: ${[...p].join(", ")||"none"})`};I!==null&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}.external`,reason:{de:`[capability/externalActionNeedsOutcome] Externe Aktion "${v.id}" auf Knotentyp "${r.type}" ${I.de}.`,en:`[capability/externalActionNeedsOutcome] External action "${v.id}" on node type "${r.type}" ${I.en}.`},severity:"error"})}for(let v of a){let $=v.unlocks;if($.length===0&&v.verdictResolved!==!0&&v.informational!==!0){n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${v.key}.unlocks`,reason:{de:`[capability/emptyUnlocks] Intrinsisches Template "${v.key}" auf Knoten "${r.id}" schaltet keine Action frei (B5).`,en:`[capability/emptyUnlocks] Intrinsic template "${v.key}" on node "${r.id}" unlocks no action (B5).`},severity:"error"});continue}for(let R of $)d.get(R)===void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${v.key}.unlocks`,reason:{de:`[capability/danglingUnlock] Template "${v.key}" auf Knoten "${r.id}" schaltet unbekannte Action "${R}" frei; deklariert: ${[...d.keys()].join(", ")||"keine"}.`,en:`[capability/danglingUnlock] Template "${v.key}" on node "${r.id}" unlocks the unknown action "${R}"; declared: ${[...d.keys()].join(", ")||"none"}.`},severity:"error"})}let h=new Set(a.map(v=>v.key));for(let v of Object.keys(r.assign??{}))h.has(v)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.assign.${v}`,reason:{de:`[capability/unknownAssignKey] assign-Key "${v}" auf Knoten "${r.id}" ist kein intrinsisches Template dieses Knotentyps; bekannt: ${[...h].join(", ")||"keine"}.`,en:`[capability/unknownAssignKey] assign key "${v}" on node "${r.id}" is not an intrinsic template of this node type; known: ${[...h].join(", ")||"none"}.`},severity:"error"});for(let[v,$]of Object.entries(r.assign??{})){if($===void 0)continue;let R=`nodes.${r.id}.assign.${v}`,I={de:`Team der Vorlage "${v}" (Knoten "${r.id}")`,en:`team of the template "${v}" (node "${r.id}")`};n.push(...rP($,R,I));for(let[D,F]of(Array.isArray($)?$:[]).entries()){let C=F?.when;C==null||!ke(C)||mn(C)||n.push({layer:"GRAPH",kind:"nodeRule",path:`${R}.${D}.when`,severity:"error",reason:{de:`[assign/conditionNotFormField] ${I.de}, Zeile ${D+1}: die Bedingung nennt ${Ue(e,C,"de")} \u2014 ein Team wird nach einem Ja/Nein-Feld eines Formulars gew\xE4hlt ($node.<formular>.admission.<feld>).`,en:`[assign/conditionNotFormField] ${I.en}, row ${D+1}: the condition names ${Ue(e,C,"en")} \u2014 a team is chosen by a yes/no field of a form ($node.<form>.admission.<field>).`}})}}let y=l.filter(v=>v.teamAssignable===!0).map(v=>v.id);for(let v of Object.keys(r.actionTeams??{}))y.includes(v)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actionTeams.${v}`,reason:{de:`[capability/unknownActionTeam] Knoten "${r.id}" nennt ein Team f\xFCr "${v}", aber diese Aktion l\xE4sst sich hier keinem Team geben; m\xF6glich: ${y.join(", ")||"keine"}.`,en:`[capability/unknownActionTeam] Node "${r.id}" names a team for "${v}", but this action cannot be given to a team here; possible: ${y.join(", ")||"none"}.`},severity:"error"});let b=new Set;for(let v of a)if(v.recipient==="external"||(r.assign??{})[v.key]!==void 0)for(let R of v.unlocks)b.add(R);let k=i.strictActionCoverage===!0;for(let v of l){if(b.has(v.id)||v.superUserOnly===!0)continue;let $=a.find(I=>I.unlocks.includes(v.id)),R=$!==void 0?{de:` Fehlt die Zuweisung assign.${$.key}?`,en:` Is the assignment assign.${$.key} missing?`}:{de:"",en:""};n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}`,reason:{de:`[capability/superUserOnly] Action "${v.id}" auf Knoten "${r.id}" ist von keinem verdrahteten Work-Item freigeschaltet \u2014 nur die verantwortliche Person (Super-User) kann sie ausf\xFChren.${R.de}`,en:`[capability/superUserOnly] Action "${v.id}" on node "${r.id}" is unlocked by no wired work item \u2014 only the responsible person (super user) can perform it.${R.en}`},severity:k?"error":"warning"})}}return n}s(E4,"checkNodeCapabilityWiring");function I4(e){let n=new Set(rC()),t=[];for(let r of e.nodes)n.has(r.type)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.type`,reason:{de:`[graph/unknownNodeType] Knoten "${r.id}" hat den unbekannten Typ "${String(r.type)}". Registrierte Typen: ${[...n].join(", ")}.`,en:`[graph/unknownNodeType] Node "${r.id}" has the unknown type "${String(r.type)}". Registered types: ${[...n].join(", ")}.`},severity:"error"});return t}s(I4,"checkKnownNodeTypes");function O4(e,n){let t=[],r=s((a,l)=>{t.push({layer:"GRAPH",kind:"nodeRule",path:a,reason:l,severity:"error"})},"push"),i=p_(e),o=s(a=>typeof a=="object"&&a!==null&&Object.values(a).some(l=>typeof l=="string"&&l.trim().length>0),"hasText");for(let a of e.nodes){let l=a,d=Array.isArray(l.optionalActions)?l.optionalActions:[];if(t.push(...z4(l,d)),d.length===0)continue;let c=Qe(a),u=new Set(c.optionalActionKinds??[]),p=Array.isArray(l.tasks)?l.tasks:[],h=new Map;for(let k of p)typeof k.key=="string"&&h.set(k.key,k);let y=new Set,b=new Map;for(let k of d){let v=k.key,$=typeof v=="string"&&v.trim().length>0?v:void 0,R=$??"?",I=`nodes.${l.id}.optionalActions.${R}`,D=typeof k.action=="string"?k.action:void 0;if(k.when!==void 0){let F=s(C=>r(`${I}.when`,{de:`[optionalAction/when] Optionale Aktion "${R}" auf Knoten "${l.id}": ${C.de}`,en:`[optionalAction/when] Optional action "${R}" on node "${l.id}": ${C.en}`}),"conditionFinding");if(typeof k.when!="string"||k.when.trim()==="")F({de:"Die Bedingung ist leer \u2014 ohne Bedingung das Feld weglassen.",en:"The condition is empty \u2014 without a condition, omit the field."});else for(let C of wm(k.when,i,n))F(C)}if((D===void 0||!u.has(D))&&r(`${I}.action`,{de:`[optionalAction/kindNotDeclared] Optionale Aktion "${R}" auf Knoten "${l.id}" hat die Art ${JSON.stringify(k.action)} \u2014 `+(u.size===0?`Knotentyp "${l.type}" deklariert keine Familien (spec.optionalActionKinds fehlt).`:`Knotentyp "${l.type}" deklariert nur: ${[...u].join(", ")}.`),en:`[optionalAction/kindNotDeclared] Optional action "${R}" on node "${l.id}" has the kind ${JSON.stringify(k.action)} \u2014 `+(u.size===0?`node type "${l.type}" declares no families (spec.optionalActionKinds is missing).`:`node type "${l.type}" only declares: ${[...u].join(", ")}.`)}),$===void 0?r(`${I}.key`,{de:`[optionalAction/missingKey] Optionale Aktion auf Knoten "${l.id}" ohne (oder mit leerem) 'key' \u2014 Trigger-Action und Template-Keys w\xE4ren namenlos ('optionalAction::\u2026').`,en:`[optionalAction/missingKey] Optional action on node "${l.id}" without (or with an empty) 'key' \u2014 the trigger action and template keys would be nameless ('optionalAction::\u2026').`}):(y.has($)&&r(`${I}.key`,{de:`[optionalAction/duplicateKey] Doppelter Aktions-Key "${$}" auf Knoten "${l.id}" \u2014 die projizierten Trigger-Actions w\xFCrden kollidieren.`,en:`[optionalAction/duplicateKey] Duplicate action key "${$}" on node "${l.id}" \u2014 the projected trigger actions would collide.`}),y.add($)),o(k.label)||r(`${I}.label`,{de:`[optionalAction/missingLabel] Optionale Aktion "${R}" auf Knoten "${l.id}" ohne Label \u2014 der Trigger-Button w\xE4re unbeschriftet.`,en:`[optionalAction/missingLabel] Optional action "${R}" on node "${l.id}" without a label \u2014 the trigger button would be unlabeled.`}),D==="skipRule"){t.push(...C4(l,k,I,R,d));continue}if(D==="spawnTasks"){k.except!==void 0&&r(`${I}.except`,{de:`[optionalAction/exceptRetired] Optionale Aktion "${R}" auf Knoten "${l.id}" tr\xE4gt 'except' \u2014 das gibt es nicht mehr: solange die Aufgaben offen sind, ist die ganze Aktionsgruppe des Knotens gesperrt. 'except' entfernen.`,en:`[optionalAction/exceptRetired] Optional action "${R}" on node "${l.id}" carries 'except' \u2014 that no longer exists: while the tasks are open, the node's whole action group is locked. Remove 'except'.`}),t.push(...tF({nodeId:l.id,bindingKey:R,binding:k,templates:p})),t.push(..._4(l.id,k,I,R,h));let F=Array.isArray(k.tasks)?k.tasks:void 0;if(F===void 0||F.length===0)r(`${I}.tasks`,{de:`[optionalAction/tasksEmpty] Optionale Aktion "${R}" auf Knoten "${l.id}" referenziert keine Aufgaben-Templates \u2014 der Trigger w\xFCrde nichts erzeugen.`,en:`[optionalAction/tasksEmpty] Optional action "${R}" on node "${l.id}" references no task templates \u2014 the trigger would create nothing.`});else{let C=new Set,x=new Set(F.filter(N=>typeof N=="string"));for(let N of F){let T=typeof N=="string"?N:void 0;if(T===void 0||T.length===0){r(`${I}.tasks`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${R}" auf Knoten "${l.id}" enth\xE4lt eine leere/ung\xFCltige Template-Referenz.`,en:`[optionalAction/unknownTaskRef] Optional action "${R}" on node "${l.id}" contains an empty or invalid template reference.`});continue}if(C.has(T)){r(`${I}.tasks.${T}`,{de:`[optionalAction/duplicateTaskRef] Template "${T}" ist in der Aktion "${R}" auf Knoten "${l.id}" doppelt referenziert.`,en:`[optionalAction/duplicateTaskRef] Template "${T}" is referenced twice in the action "${R}" on node "${l.id}".`});continue}C.add(T);let q=h.get(T);if(q===void 0){r(`${I}.tasks.${T}`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${R}" auf Knoten "${l.id}" referenziert das Template "${T}", das node.tasks nicht deklariert. Vorhanden: ${[...h.keys()].join(", ")||"keine"}.`,en:`[optionalAction/unknownTaskRef] Optional action "${R}" on node "${l.id}" references the template "${T}", which node.tasks does not declare. Present: ${[...h.keys()].join(", ")||"none"}.`});continue}let G=b.get(T);G!==void 0&&G!==R?r(`${I}.tasks.${T}`,{de:`[optionalAction/taskDoublyBound] Template "${T}" auf Knoten "${l.id}" ist bereits von der Aktion "${G}" referenziert \u2014 ein Template geh\xF6rt zu h\xF6chstens einer optionalen Aktion.`,en:`[optionalAction/taskDoublyBound] Template "${T}" on node "${l.id}" is already referenced by the action "${G}" \u2014 a template belongs to at most one optional action.`}):b.set(T,R);let ae=q.blocks?.templateKey;typeof ae=="string"&&!x.has(ae)&&r(`${I}.tasks.${T}`,{de:`[optionalAction/taskRefBlocks] Template "${T}" auf Knoten "${l.id}" tr\xE4gt 'blocks' auf "${ae}", das nicht zur selben Aktion "${R}" geh\xF6rt \u2014 eine Referenz darf nur eine Referenz DERSELBEN Aktion zur\xFCckhalten (Checklisten-Reihenfolge), nie ein Template au\xDFerhalb.`,en:`[optionalAction/taskRefBlocks] Template "${T}" on node "${l.id}" carries 'blocks' on "${ae}", which does not belong to the same action "${R}" \u2014 a reference may only hold back a reference of the SAME action (checklist order), never a template outside it.`});for(let Z of p){let oe=typeof Z.key=="string"?Z.key:void 0;Z.blocks?.templateKey===T&&(oe!==void 0&&x.has(oe)||r(`${I}.tasks.${T}`,{de:`[optionalAction/taskRefBlocks] Template "${T}" auf Knoten "${l.id}" ist Ziel eines 'blocks' von ${oe!==void 0?`"${oe}"`:"einem Template"} au\xDFerhalb der Aktion "${R}" \u2014 ein Template au\xDFerhalb darf eine Referenz nie zur\xFCckhalten (ihr Spawn geh\xF6rt dem Trigger, nicht onEnter).`,en:`[optionalAction/taskRefBlocks] Template "${T}" on node "${l.id}" is the target of a 'blocks' from ${oe!==void 0?`"${oe}"`:"a template"} outside the action "${R}" \u2014 a template outside may never hold back a reference (its spawn belongs to the trigger, not to onEnter).`}))}}}}}}return t}s(O4,"checkOptionalActions");function _4(e,n,t,r,i){if(n.auto===void 0)return[];let o=s((d,c,u,p)=>({layer:"GRAPH",kind:"nodeRule",path:d,reason:{de:`[optionalAction/${c}] Optionale Aktion "${r}" auf Knoten "${e}": ${u}`,en:`[optionalAction/${c}] Optional action "${r}" on node "${e}": ${p}`},severity:"error"}),"issue");if(typeof n.auto!="boolean")return[o(`${t}.auto`,"autoType","'auto' ist true oder false.","'auto' is true or false.")];if(!n.auto)return[];let a=[];for(let d of["input","submitLabel"])n[d]!==void 0&&a.push(o(`${t}.${d}`,"autoInput",`startet beim Betreten des Schritts, niemand f\xFCllt den Dialog \u2014 '${d}' entfernen.`,`starts when the step is entered, nobody fills in the dialog \u2014 remove '${d}'.`));let l=Array.isArray(n.tasks)?n.tasks:[];for(let d of l)typeof d=="string"&&i.get(d)?.familyRequest!==void 0&&a.push(o(`${t}.tasks.${d}`,"autoFamilyRequest",`startet beim Betreten des Schritts, aber \u201E${d}\u201C fragt die Familie \u2014 was gefragt wird, w\xE4hlt erst ein Klick.`,`starts when the step is entered, but "${d}" asks the family \u2014 what it asks is chosen only by a click.`));return a}s(_4,"autoIssues");function C4(e,n,t,r,i){let o=[],a=s((u,p,h,y)=>{o.push({layer:"GRAPH",kind:"nodeRule",path:u,reason:{de:`[optionalAction/${p}] Optionale Aktion "${r}" auf Knoten "${e.id}": ${h}`,en:`[optionalAction/${p}] Optional action "${r}" on node "${e.id}": ${y}`},severity:"error"})},"push"),l=Array.isArray(e.requiresOneOf)?e.requiresOneOf:[];l.length===0&&a(`${t}.action`,"skipRuleWithoutRule","\xFCberspringt die Entscheidungsregel, aber der Knoten hat keine (`requiresOneOf`).","skips the decision rule, but the node has none (`requiresOneOf`)."),l.includes(n.key)&&a(`nodes.${e.id}.requiresOneOf`,"skipRuleListed","steht selbst in `requiresOneOf` \u2014 die Regel, die sie aufhebt, kann sie nicht erf\xFCllen.","is itself listed in `requiresOneOf` \u2014 it cannot meet the rule it lifts.");let d=e.assign?.decision;(!Array.isArray(d)||d.length===0)&&a(`${t}.action`,"skipRuleNeedsDecisionRow","braucht eine Entscheidungszeile (`assign.decision`), die festh\xE4lt, wer die Regel aufgehoben hat.","needs a decision row (`assign.decision`) that records who lifted the rule."),i.find(u=>u.action==="skipRule")!==n&&a(`${t}.action`,"skipRuleTwice","ist die zweite Aktion dieser Art am Knoten \u2014 eine reicht.","is the second action of this kind on the node \u2014 one is enough.");for(let u of["tasks","input","repeatable","submitLabel","auto"])n[u]!==void 0&&a(`${t}.${u}`,"skipRuleShape",`tr\xE4gt '${u}' \u2014 sie legt keine Aufgaben an.`,`carries '${u}' \u2014 it creates no tasks.`);return o}s(C4,"skipRuleIssues");function P4(e){return typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string"}s(P4,"literalValueType");function N4(e,n){let t=[],r=n?.notificationTemplates;for(let i of e.nodes){let o=i,a=fN(i,Qe(i)),l=o.notifications??{};if(a.length===0&&Object.keys(l).length===0)continue;let d=new Map(a.map(c=>[c.id,c]));for(let c of Object.keys(l))d.has(c)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.notifications.${c}`,reason:{de:`[notification/unknownEvent] Knoten "${o.id}" bindet eine Benachrichtigung an das Ereignis "${c}", das der Knotentyp "${o.type}" nicht kennt. Angeboten werden: ${a.map(u=>u.id).join(", ")||"(keine)"}.`,en:`[notification/unknownEvent] Node "${o.id}" binds a notification to the event "${c}", which the node type "${o.type}" does not know. Offered: ${a.map(u=>u.id).join(", ")||"(none)"}.`},severity:"error"});for(let c of a){let u=l[c.id];if(c.required===!0&&(u===void 0||u.disabled===!0)){t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.notifications.${c.id}`,reason:{de:`[notification/missingBinding] Knoten "${o.id}" muss beim Ereignis "${c.label.de}" (${c.id}) eine Benachrichtigung verschicken \u2014 es ist ${u===void 0?"keine gebunden":"eine gebunden, aber abgeschaltet"}.`,en:`[notification/missingBinding] Node "${o.id}" must send a notification on the event "${c.label.en}" (${c.id}) \u2014 ${u===void 0?"none is bound":"one is bound, but switched off"}.`},severity:"error"});continue}if(u===void 0||u.disabled===!0)continue;let p=`nodes.${o.id}.notifications.${c.id}`;if(c.audience!=="external"){t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/internalAudienceUnsupported] Knoten "${o.id}": das Ereignis "${c.id}" richtet sich an die Schule, und Benachrichtigungen an die Schule k\xF6nnen noch nicht zugestellt werden \u2014 die gebundene Benachrichtigung "${u.templateId}" w\xFCrde den Vorgang beim Versand abbrechen.`,en:`[notification/internalAudienceUnsupported] Node "${o.id}": the event "${c.id}" is addressed to the school, and notifications to the school cannot be delivered yet \u2014 the bound notification "${u.templateId}" would abort the process when it is sent.`},severity:"error"});continue}if(r===void 0)continue;let h=r.get(u.templateId);if(h===void 0){t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/unknownTemplate] Knoten "${o.id}": die Benachrichtigung "${u.templateId}" ist nicht im Katalog. Bekannt sind: ${[...r.keys()].sort().join(", ")||"(keine)"}.`,en:`[notification/unknownTemplate] Node "${o.id}": the notification "${u.templateId}" is not in the catalog. Known: ${[...r.keys()].sort().join(", ")||"(none)"}.`},severity:"error"});continue}h.audience!==void 0&&h.audience!==c.audience&&t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/audienceMismatch] Die Benachrichtigung "${h.id}" ist f\xFCr ${h.audience==="internal"?"die Schule":"die Familie"} geschrieben, das Ereignis "${c.id}" richtet sich aber an die Familie.`,en:`[notification/audienceMismatch] The notification "${h.id}" is written for ${h.audience==="internal"?"the school":"the family"}, but the event "${c.id}" is addressed to the family.`},severity:"warning"});let y=aN(c),b=new Set(h.params.map(k=>k.key));for(let k of Object.keys(u.args??{}))b.has(k)||t.push({layer:"GRAPH",kind:"nodeRule",path:`${p}.args.${k}`,reason:{de:`[notification/unknownArg] Die Benachrichtigung "${h.id}" hat kein Argument "${k}" \u2014 erwartet werden: ${h.params.map(v=>v.key).join(", ")||"(keine)"}.`,en:`[notification/unknownArg] The notification "${h.id}" has no argument "${k}" \u2014 expected: ${h.params.map(v=>v.key).join(", ")||"(none)"}.`},severity:"error"});for(let k of h.params){let v=u.args?.[k.key],$=`${p}.args.${k.key}`;if(v!==void 0&&"literal"in v){let I=P4(v.literal);k.type!==void 0&&!Mk(I,k.type)&&t.push({layer:"GRAPH",kind:"nodeRule",path:$,reason:{de:`[notification/argTypeMismatch] "${k.key}" erwartet ${hd(k.type).de}, festgelegt ist aber ${JSON.stringify(v.literal)} (${I}).`,en:`[notification/argTypeMismatch] "${k.key}" expects ${hd(k.type).en}, but ${JSON.stringify(v.literal)} (${I}) is set.`},severity:"error"});continue}if(v!==void 0){t.push({layer:"GRAPH",kind:"nodeRule",path:$,reason:{de:`[notification/unsupportedArg] "${k.key}" ist an ${JSON.stringify(v)} gebunden \u2014 ein Argument einer Benachrichtigung kann nur ein Festwert ({ literal }) sein oder automatisch aus ${rF(y,"de")} kommen.`,en:`[notification/unsupportedArg] "${k.key}" is bound to ${JSON.stringify(v)} \u2014 a notification argument can only be a fixed value ({ literal }) or come automatically from ${rF(y,"en")}.`},severity:"error"});continue}let R=lN(k,y.get(k.key)??[]);if(!(R.status==="resolved"||R.status==="unused")){if(R.status==="sometimes"){t.push({layer:"GRAPH",kind:"nodeRule",path:$,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${k.key}" immer, ${R.source.source} liefert es aber nur manchmal. In notifications.${c.id}.args.${k.key} einen Festwert benennen \u2014 oder eine Benachrichtigung w\xE4hlen, die ohne "${k.key}" auskommt.`,en:`[notification/unresolvedArg] The notification "${h.id}" always needs "${k.key}", but ${R.source.source} provides it only sometimes. Name a fixed value in notifications.${c.id}.args.${k.key} \u2014 or choose a notification that works without "${k.key}".`},severity:"error"});continue}if(R.status==="ambiguous"){t.push({layer:"GRAPH",kind:"nodeRule",path:$,reason:{de:`[notification/ambiguousArg] "${k.key}" hat mehrere passende Quellen \u2014 ${R.matches.map(I=>I.source).join(", ")}. In notifications.${c.id}.args.${k.key} einen Festwert setzen.`,en:`[notification/ambiguousArg] "${k.key}" has several matching sources \u2014 ${R.matches.map(I=>I.source).join(", ")}. Set a fixed value in notifications.${c.id}.args.${k.key}.`},severity:"error"});continue}t.push({layer:"GRAPH",kind:"nodeRule",path:$,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${k.key}"${k.type!==void 0?` (${hd(k.type).de})`:""}, und der Knoten hat daf\xFCr ${R.rejected.length===0?"keine Quelle":`nur unpassende Quellen: ${R.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`,en:`[notification/unresolvedArg] The notification "${h.id}" needs "${k.key}"${k.type!==void 0?` (${hd(k.type).en})`:""}, and the node has ${R.rejected.length===0?"no source for it":`only unsuitable sources for it: ${R.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`},severity:"error"})}}}}return t}s(N4,"checkNotificationBindings");function D4(e){return VN(e).map(n=>({layer:"GRAPH",kind:"assignment",path:"assignmentRules",reason:n,severity:"error"}))}s(D4,"checkAssignmentRules");function rF(e,n){let t=[...e.keys()].sort();return t.length===0?n==="de"?"(nichts)":"(nothing)":t.join(", ")}s(rF,"describeCandidates");function F4(e,n){return GN(e,n?.teamKeys).map(t=>({layer:"GRAPH",kind:"nodeRule",path:t.path,reason:t.reason,severity:"error"}))}s(F4,"checkChannels");function L4(e){return h_(e).map(n=>({layer:"GRAPH",kind:"nodeRule",path:n.path,reason:n.reason,severity:"error"}))}s(L4,"checkStaffInputs");function M4(e,n){let t=[];for(let r of e.nodes){let i=r.reads;if(i===void 0)continue;let o=`nodes.${r.id}.reads`,a={de:`Knoten \u201E${Pe(e,r.id,"de")}\u201C (${r.id})`,en:`Node "${Pe(e,r.id,"en")}" (${r.id})`},l=s(c=>{t.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:c,severity:"error"})},"issue");if(!QN(r)){l({de:`[readiness/readsNotGated] ${a.de} (${r.type}) deklariert \`reads\`, aber die Bereitschaftspr\xFCfung h\xE4lt nur Entscheidungs-Knoten und Dokument-Knoten mit Produktion \u2014 hier w\xFCrde \`reads\` nichts bewirken.`,en:`[readiness/readsNotGated] ${a.en} (${r.type}) declares \`reads\`, but the readiness check only holds decision nodes and document nodes with production \u2014 here \`reads\` would have no effect.`});continue}if(!Array.isArray(i)){l({de:`[readiness/readsDuplicate] \`reads\` von ${a.de} muss eine Liste von Feldadressen sein, erhalten ${JSON.stringify(i)}.`,en:`[readiness/readsDuplicate] \`reads\` of ${a.en} must be a list of field addresses, got ${JSON.stringify(i)}.`});continue}let d=new Set;for(let c of i){if(!ke(c))continue;let u=ue(c);if(d.has(u)){l({de:`[readiness/readsDuplicate] ${a.de} liest ${Ue(e,c,"de")} mehrfach.`,en:`[readiness/readsDuplicate] ${a.en} reads ${Ue(e,c,"en")} more than once.`});continue}if(d.add(u),!mn(c)){l({de:`[readiness/readsUnknownField] ${a.de} liest ${Ue(e,c,"de")} \u2014 \`reads\` nennt nur Felder eines Formulars ($node.<formular>.admission.<feld>).`,en:`[readiness/readsUnknownField] ${a.en} reads ${Ue(e,c,"en")} \u2014 \`reads\` only names fields of a form ($node.<form>.admission.<field>).`});continue}let p=ri(n,c);p!=null&&wa("nodeReads",ya(p))==="repeated"&&l({de:`[readiness/readsUnknownField] ${a.de} liest ${Ue(e,c,"de")} \u2014 ein Feld in einer Wiederholgruppe ist kein einzelnes Feld der Anmeldung und kann nicht gelesen werden.`,en:`[readiness/readsUnknownField] ${a.en} reads ${Ue(e,c,"en")} \u2014 a field in a repeated group is not a single field of the application and cannot be read.`})}}return t}s(M4,"checkReadinessReads");function q4(e,n){let t=[];for(let r of e.nodes){if(r.type!=="setFlag")continue;let i=hC(r),o=Pp(r);if(i===null||o===null)continue;let a=n?.formFlagKeysByFormNode?.get(i);if(a===void 0||a.has(o))continue;let l=[...a].sort();t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.inputs.${Vn.flagKey}`,reason:{de:`[setFlag/unknownFlag] Knoten \u201E${Pe(e,r.id,"de")}\u201C (${r.id}) setzt \u201E${o}\u201C, aber das Formular von \u201E${Pe(e,i,"de")}\u201C hat kein externes Merkmal dieses Namens`+(l.length>0?` (vorhanden: ${l.join(", ")}).`:" \u2014 es deklariert gar keins."),en:`[setFlag/unknownFlag] Node "${Pe(e,r.id,"en")}" (${r.id}) sets "${o}", but the form of "${Pe(e,i,"en")}" has no external flag of that name`+(l.length>0?` (present: ${l.join(", ")}).`:" \u2014 it declares none at all.")},severity:"error"})}return t}s(q4,"checkSetFlagKeys");function K4(e,n){let t=n?.readinessFormFieldsByFormNode,r=n?.readinessPartyConditionKeysByFormNode;if(t===void 0||r===void 0)return[];let i=[];for(let o of e.nodes){if(o.type!=="governedDocument"||o.production!=="resolver")continue;let a=o.form;if(!ke(a)||!ar(a))continue;let l=t.get(a.owner),d=r.get(a.owner);if(l===void 0||d===void 0||d.size===0)continue;let c=Zk(l,d);if(c.size===0)continue;let u=o.reads,p=(Array.isArray(u)?u:[]).filter(k=>mn(k)&&k.owner===a.owner),h=Zk(l,[...p.map(k=>k.path),...eD(o).filter(k=>k.owner===a.owner).map(k=>k.fieldKey)]),y=[...c].filter(k=>!h.has(k)).sort();if(y.length===0)continue;let b={de:Pe(e,a.owner,"de"),en:Pe(e,a.owner,"en")};i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.reads`,reason:{de:`[readiness/readsMissesPartyCondition] Knoten \u201E${Pe(e,o.id,"de")}\u201C (${o.id}) erzeugt ein Dokument, dessen Vertragsparteien von Angaben im Formular \u201E${b.de}\u201C abh\xE4ngen, die er weder liest noch bindet: ${y.join(", ")}. Eine Korrektur darauf h\xE4lt den Knoten nicht an und kann nach der Ausstellung eine Vertragspartei entfernen \u2014 die Felder (oder den berechneten Schl\xFCssel) aus \u201E${b.de}\u201C in \`reads\` erg\xE4nzen.`,en:`[readiness/readsMissesPartyCondition] Node "${Pe(e,o.id,"en")}" (${o.id}) generates a document whose contract parties depend on answers in the form "${b.en}" that it neither reads nor binds: ${y.join(", ")}. A correction to them does not hold the node and can remove a contract party after issuing \u2014 add the fields (or the computed key) from "${b.en}" to \`reads\`.`},severity:"warning"})}return i}s(K4,"checkReadinessPartyConditions");function yb(e){let n=Object.keys(e.inputs??{});if(n.length===0)return[];let t=e.generatorStamp,r=e.production,i=e.templateStamp;if(e.type==="governedDocument"&&(r==="resolver"&&!Array.isArray(t?.inputSchema?.fields)||r==="template"&&!Array.isArray(i?.fields)))return[];let a=new Set(va(e).map(l=>l.id));return n.filter(l=>!a.has(l))}s(yb,"undeclaredInputKeys");function j4(e,n){return e.nodes.flatMap(t=>[...B4(e,t,va(t),n),...V4(e,t,n)])}s(j4,"checkUnknownResources");function V4(e,n,t){let r=[],i=new Set((Qe(n).workItemTemplates?.(n)??[]).map(a=>a.key)),o=new Set((n.tasks??[]).filter(a=>a.familyRequest!==void 0).map(a=>String(a.key)));for(let a of zp(n)){if(a.leaf==="assign{}"&&!i.has(a.owner)||a.leaf==="tasks[].assign.group"&&a.missing&&o.has(a.owner))continue;let l=ma[a.leaf],d=`nodes.${n.id}.${a.path}`,c=s(h=>h==="de"?`Knoten \u201E${Pe(e,n.id,"de")}\u201C (${n.id}), ${l.what.de} \u201E${a.owner}\u201C`:`node "${Pe(e,n.id,"en")}" (${n.id}), ${l.what.en} "${a.owner}"`,"where");if(a.missing){if(!l.required){r.push({layer:"GRAPH",kind:"nodeRule",path:d,severity:"error",reason:{de:`[inputs/emptyReference] ${c("de")}: der Eintrag ist leer oder kein Schl\xFCssel \u2014 ${l.consequence.de}. Team w\xE4hlen oder den Eintrag entfernen.`,en:`[inputs/emptyReference] ${c("en")}: the entry is empty or no key \u2014 ${l.consequence.en}. Choose a team or remove the entry.`}});continue}r.push({layer:"GRAPH",kind:"nodeRule",path:d,severity:"error",reason:{de:`[workItems/needsTeam] ${c("de")}: kein Team gew\xE4hlt \u2014 ${l.consequence.de}. Jede Aufgabe geh\xF6rt der Warteschlange eines Teams.`,en:`[workItems/needsTeam] ${c("en")}: no team chosen \u2014 ${l.consequence.en}. Every task belongs to a team's queue.`}});continue}if(a.key===null)continue;let u=t?.teamKeys;if(u===void 0||u.has(a.key))continue;let p=[...u].sort().join(", ")||"\u2014";r.push({layer:"GRAPH",kind:"nodeRule",path:d,severity:"error",reason:{de:`[inputs/unknownResource] ${c("de")}: \u201E${a.key}\u201C ist kein Team dieses Mandanten \u2014 ${l.consequence.de}. Teams: ${p}.`,en:`[inputs/unknownResource] ${c("en")}: "${a.key}" is no team of this school \u2014 ${l.consequence.en}. Teams: ${p}.`}})}return r}s(V4,"referenceIssues");function B4(e,n,t,r){let i=[];for(let o of t){if(!Np(o.type))continue;let a=ua[o.type].existence;if(a.check!=="generic")continue;let l=r?.[a.catalog];if(l===void 0)continue;let d=n.inputs?.[o.id];if(d?.kind!=="literal"||typeof d.value!="string"||l.has(d.value))continue;let c=ua[o.type].label;i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${o.id}`,reason:{de:`[inputs/unknownResource] Knoten \u201E${Pe(e,n.id,"de")}\u201C (${n.id}) nennt im Eingang \u201E${o.label.de}\u201C ${c.de} \u201E${d.value}\u201C \u2014 diesen Schl\xFCssel kennt dieser Mandant nicht.`,en:`[inputs/unknownResource] Node "${Pe(e,n.id,"en")}" (${n.id}) names the ${c.en.toLowerCase()} "${d.value}" in its input "${o.label.en}", which does not exist in this school.`},severity:"error"})}return i}s(B4,"unknownResourceIssues");function U4(e){let n=[];for(let t of e.nodes)for(let r of yb(t))n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${r}`,reason:{de:`[inputs/undeclared] Knoten \u201E${Pe(e,t.id,"de")}\u201C (${t.id}) hat einen Eingang \u201E${r}\u201C, den sein Typ nicht deklariert \u2014 ein Rest einer fr\xFCheren Einstellung (z. B. eines anderen Generators). Im Parameter-Bereich ist er nicht sichtbar; entfernen.`,en:`[inputs/undeclared] Node "${Pe(e,t.id,"en")}" (${t.id}) has an input "${r}" its type does not declare \u2014 a leftover of an earlier setting (e.g. another generator). It is not visible among the parameters; remove it.`},severity:"error"});return n}s(U4,"checkUndeclaredInputs");function G4(e){let n=[];for(let t of e.nodes){let r=new Set;for(let i of va(t)){if(!r.has(i.id)){r.add(i.id);continue}n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${i.id}`,reason:{de:`[inputs/duplicateSlot] Knoten \u201E${Pe(e,t.id,"de")}\u201C (${t.id}) hat den Eingang \u201E${i.id}\u201C zweimal \u2014 ein Parameter des Generators oder der Vorlage tr\xE4gt den Namen eines Eingangs des Knotentyps. Den Parameter umbenennen.`,en:`[inputs/duplicateSlot] Node "${Pe(e,t.id,"en")}" (${t.id}) has the input "${i.id}" twice \u2014 a parameter of the generator or template carries the name of an input of the node type. Rename the parameter.`},severity:"error"})}}return n}s(G4,"checkDuplicateSlots");function iF(e,n,t){let r=[],i=I4(e);if(i.length>0)return i;r.push(...u4(e)),r.push(...d4(e)),r.push(...f4(e)),r.push(...c4(e)),r.push(...s4(e)),r.push(...a4(e)),r.push(...l4(e)),r.push(...h4(e)),r.push(...p4(e)),r.push(...RP(e,n)),r.push(...g4(e,n)),r.push(...y4(e,n)),r.push(...w4(e,n)),r.push(...iD(e,n?.layout)),r.push(...k4(e,n)),r.push(...b4(e,n)),r.push(...A4(e,n)),r.push(...x4(e,n)),r.push(...yP(e,t)),r.push(...OP(e)),r.push(...DP(e)),r.push(...EP(e)),r.push(...IP(e)),r.push(...U4(e)),r.push(...j4(e,t)),r.push(...G4(e)),r.push(...T4(e)),r.push(...R4(e)),r.push(...bD(e,t)),r.push(...TD(e)),r.push(...SD(e)),r.push(...RD(e,t)),r.push(...ND(e,t)),r.push(...E4(e)),r.push(...N4(e,t)),r.push(...O4(e,t)),r.push(...D4(e)),r.push(...M4(e,t)),r.push(...K4(e,t)),r.push(...q4(e,t)),r.push(...F4(e,t)),r.push(...L4(e)),r.push(...nF(e));for(let o of e.nodes){let a=Qe(o);a.validate&&r.push(...a.validate(o,e,t))}return r}s(iF,"checkGraph");function z4(e,n){let t=e.requiresOneOf;if(t===void 0)return[];let r=`nodes.${e.id}.requiresOneOf`,i=s(d=>({layer:"GRAPH",kind:"nodeRule",path:r,reason:d,severity:"error"}),"issue");if(e.type!=="decision")return[i({de:`[decision/requiresOneOfNotDecision] Knoten "${e.id}" (Typ "${e.type}") tr\xE4gt 'requiresOneOf' \u2014 die Regel gilt nur an Entscheidungsknoten (decision).`,en:`[decision/requiresOneOfNotDecision] Node "${e.id}" (type "${e.type}") carries 'requiresOneOf' \u2014 the rule only applies to decision nodes (decision).`})];if(!Array.isArray(t)||t.length===0||t.some(d=>typeof d!="string"||d.length===0))return[i({de:`[decision/requiresOneOfEmpty] 'requiresOneOf' an Knoten "${e.id}" muss eine nicht-leere Liste von Aktions-Keys sein \u2014 sonst Feld weglassen.`,en:`[decision/requiresOneOfEmpty] 'requiresOneOf' on node "${e.id}" must be a non-empty list of action keys \u2014 otherwise omit the field.`})];let o=n.map(d=>d.key).filter(d=>typeof d=="string"),a=[],l=new Set;for(let d of t){if(l.has(d)){a.push(i({de:`[decision/requiresOneOfDuplicate] 'requiresOneOf' an Knoten "${e.id}" nennt "${d}" doppelt.`,en:`[decision/requiresOneOfDuplicate] 'requiresOneOf' on node "${e.id}" names "${d}" twice.`}));continue}l.add(d),o.includes(d)||a.push(i({de:`[decision/requiresOneOfUnknownAction] 'requiresOneOf' an Knoten "${e.id}" nennt "${d}", aber dieser Knoten hat keine optionale Aktion mit diesem Key \u2014 die Regel w\xE4re nie erf\xFCllbar. `+(o.length===0?"Der Knoten hat keine optionalen Aktionen.":`Optionale Aktionen dieses Knotens: ${o.join(", ")}.`),en:`[decision/requiresOneOfUnknownAction] 'requiresOneOf' on node "${e.id}" names "${d}", but this node has no optional action with that key \u2014 the rule could never be met. `+(o.length===0?"The node has no optional actions.":`Optional actions of this node: ${o.join(", ")}.`)}))}return a}s(z4,"checkRequiresOneOf");function W4(e){return e.nodes.flatMap(n=>yb(n).map(t=>({nodeId:n.id,key:t,binding:n.inputs?.[t]?.kind==="binding"})))}s(W4,"undeclaredInputCells");function oF(e,n){let t=W4(e).filter(o=>n.bindings||!o.binding);if(t.length===0)return{graph:e,dropped:t};let r=new Map;for(let o of t)r.set(o.nodeId,(r.get(o.nodeId)??new Set).add(o.key));let i=e.nodes.map(o=>{let a=r.get(String(o.id));if(a===void 0)return o;let l=Object.fromEntries(Object.entries(o.inputs).filter(([d])=>!a.has(d)));return{...o,inputs:l}});return{graph:{...e,nodes:i},dropped:t}}s(oF,"dropUndeclaredInputs");function wb(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(wb,"isObject");function sF(e){return wb(e)&&e.type==="governedDocument"&&("template"in e||"cockpitFields"in e)}s(sF,"oldShape");function aF(e){return(e?.nodes??[]).some(sF)}s(aF,"needsTemplateStampMove");function Y4(e){let n=e.generatorStamp?.inputSchema?.fields;if(e.production==="resolver")return Array.isArray(n)?n:null;let t=e.templateStamp?.fields;return e.production==="template"&&Array.isArray(t)?t:null}s(Y4,"stampedFields");function H4(e){let n=String(e.id);if("template"in e&&"templateStamp"in e)return{unmoved:{nodeId:n,reason:"templateAndStamp"}};let t={...e},r=[];if("template"in e){let{template:i}=e;if(delete t.template,wb(i))t.templateStamp={fields:Array.isArray(i.fields)?i.fields:[],...i.localeField===void 0?{}:{localeField:i.localeField}};else return{unmoved:{nodeId:n,reason:"templateNotObject"}}}if("cockpitFields"in e){let i=Array.isArray(e.cockpitFields)?e.cockpitFields.filter(l=>typeof l=="string"):[];delete t.cockpitFields;let o=wb(e.inputs)?{...e.inputs}:{},a=Y4(t);if(a===null&&i.length>0)return{unmoved:{nodeId:n,key:i[0],reason:"noStamp"}};for(let l of i){let d=l in o&&o[l]?.kind!=="unset",c=(a??[]).find(u=>u.key===l);if(c===void 0)r.push({nodeId:n,key:l,reason:"unknownKey"});else{if(c.type==="party"||c.type==="personList")continue;c.processSource!==void 0?r.push({nodeId:n,key:l,reason:"processSource"}):d?r.push({nodeId:n,key:l,reason:"cellExists"}):o[l]={kind:"cockpit"}}}t.inputs=o}return{node:t,reports:r}}s(H4,"moveNode");function lF(e){let n=[],t=[],r=[],i=e.nodes.map(o=>{if(!sF(o))return o;let a=H4(o);return"unmoved"in a?(r.push(a.unmoved),o):(n.push(String(o.id)),t.push(...a.reports),a.node)});return n.length===0?{graph:e,moved:n,reports:t,unmoved:r}:{graph:{...e,nodes:i},moved:n,reports:t,unmoved:r}}s(lF,"moveTemplateStampAndCockpit");var dF=fp,J4="applicant.applicationSubmitted";function Lm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Lm,"isObject");function cF(e){return Lm(e)&&e.type==="form"&&typeof e.id=="string"&&!_t(e)}s(cF,"isCreatingFormNode");function Q4(e){return Lm(e.notifications)&&dF in e.notifications}s(Q4,"hasSubmittedBinding");function kb(e){let n={toBind:[],alreadyBound:[],malformed:[]};for(let t of e?.nodes??[])cF(t)&&(t.notifications!==void 0&&!Lm(t.notifications)?n.malformed.push(t.id):Q4(t)?n.alreadyBound.push(t.id):n.toBind.push(t.id));return n}s(kb,"submitReceiptInventory");function uF(e){let{toBind:n}=kb(e);if(n.length===0)return{graph:e,bound:[]};let t=new Set(n),r=e.nodes.map(i=>{if(!cF(i)||!t.has(i.id))return i;let o=Lm(i.notifications)?i.notifications:{};return{...i,notifications:{...o,[dF]:{templateId:J4}}}});return{graph:{...e,nodes:r},bound:n}}s(uF,"bindSubmitReceipt");var ms=["park","advance"],ur="whenNothingOwed",fF={park:{de:"Jemand schaut drauf",en:"Someone looks at it"},advance:{de:"Durchreichen",en:"Pass through"}};function bb(e){let n=e.inputs?.[ur],t=n?.kind==="literal"?n.value:void 0;return vb(t)?t:null}s(bb,"reviewModeOrNull");function vb(e){return ms.includes(e)}s(vb,"isReviewMode");function xb(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(xb,"isObject");function pF(e){return xb(e)&&e.type==="review"&&!(xb(e.inputs)&&ur in e.inputs)}s(pF,"lacksMode");function mF(e){return(e?.nodes??[]).some(pF)}s(mF,"needsReviewMode");function hF(e){let n=[],t=e.nodes.map(r=>{if(!pF(r))return r;n.push(r.id);let i=xb(r.inputs)?r.inputs:{};return{...r,inputs:{...i,[ur]:{kind:"literal",value:"park"}}}});return{graph:{...e,nodes:t},set:n}}s(hF,"setReviewModePark");function Mm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Mm,"isObject");function gF(e){let{notifications:n,bound:t}=lm(e.notifications,{tasks:[]},e);return{next:n,bound:t}}s(gF,"bindingsFor");function yF(e){let n={toBind:[],malformed:[]};for(let t of e?.nodes??[])if(!(!Mm(t)||typeof t.id!="string"||Ta(t).length===0)){if(t.notifications!==void 0&&!Mm(t.notifications)){n.malformed.push(t.id);continue}for(let r of gF(t).bound)n.toBind.push(`${t.id}.${r}`)}return n}s(yF,"appointmentLetterInventory");function wF(e){let n=[],t=!1,r=e.nodes.map(i=>{if(!Mm(i)||typeof i.id!="string"||Ta(i).length===0||i.notifications!==void 0&&!Mm(i.notifications))return i;let{next:o,bound:a}=gF(i);return a.length===0?i:(t=!0,n.push(...a.map(l=>`${i.id}.${l}`)),{...i,notifications:o})});return t?{graph:{...e,nodes:r},bound:n}:{graph:e,bound:[]}}s(wF,"bindAppointmentLetters");function Ba(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ba,"isObject");var kF=["id","label","dataFlow"],bF=["audience","populates","stages","expectedOutcomes"];function vF(e){return Array.isArray(e.assignmentRules)&&e.assignmentRules.some(n=>Ba(n)&&typeof n.slot=="string")}s(vF,"carriesStringSlots");function xF(e){return(e.nodes??[]).some(n=>Ba(n)&&n.type==="form"&&bF.some(t=>t in n))}s(xF,"carriesRetiredFormNodeKey");var Z4=[{key:"generatorPin",editor:!0,holds:q_,what:{de:"Generator als `resolver`",en:"generator as `resolver`"}},{key:"setFlagProperties",editor:!0,holds:bC,what:{de:"Formular und Merkmal eines \u201EFlag setzen\u201C-Knotens als Eigenschaften",en:'form and flag of a "Set flag" node as properties'}},{key:"scalarProperties",editor:!0,holds:RC,what:{de:"Einstellungen eines Knotens als Eigenschaften statt als Eing\xE4nge",en:"a node's settings as properties instead of inputs"}},{key:"nodeConfigProperties",editor:!0,holds:NC,what:{de:"Hinweis einer Zahlung als Eigenschaft oder ein entferntes Muster-Dokument",en:"a payment's note as a property, or a removed sample document"}},{key:"outcomeWithoutSemantic",editor:!0,holds:I_,what:{de:"Entscheidungsausg\xE4nge ohne Bedeutung",en:"decision outcomes without a meaning"}},{key:"startNodeOutcomes",editor:!0,holds:P_,what:{de:"ein Start-Knoten mit eigenen Ausg\xE4ngen",en:"a start node with its own outcomes"}},{key:"templateParameters",editor:!0,holds:aF,what:{de:"Parameter einer Vorlage am Knoten oder Cockpit-Felder als Liste",en:"a template's parameters on the node, or cockpit fields as a list"}},{key:"paymentSettlement",editor:!0,holds:jC,what:{de:"Zahlungsknoten mit \u201EAbrechnung\u201C (`inputs.settlement`) statt \u201EZahlungsweg\u201C (`inputs.mode`)",en:'payment node with "Settlement" (`inputs.settlement`) instead of "Payment mode" (`inputs.mode`)'}},{key:"documentRef",editor:!0,holds:XC,what:{de:"Dokument eines anderen Knotens als `document:$node.<Knoten>.document` statt als Slot `artifact:<Slot>`",en:"another node's document as `document:$node.<node>.document` instead of the slot `artifact:<slot>`"}},{key:"formView",editor:!0,holds:GC,what:{de:"Ansicht einer Aufgabe als `formView` statt als Ansichts-Adresse `view`",en:"a task's view as `formView` instead of the view address `view`"}},{key:"nodeAssignString",editor:!0,holds:QC,what:{de:"Team einer Knoten-Aufgabe als Text (`assign.<Vorlage>`) statt als Regelliste",en:"a node task's team as text (`assign.<template>`) instead of a rule list"}},{key:"reviewWithoutMode",editor:!0,holds:mF,what:{de:"Pr\xFCfknoten ohne \u201EWenn nichts zu pr\xFCfen ist\u201C",en:'review nodes without "When nothing is owed"'}},{key:"taskAssignUser",editor:!1,holds:s(e=>Up(e).length>0,"holds"),what:{de:"eine Aufgabe mit fester Person (`assign.userId`)",en:"a task with a fixed person (`assign.userId`)"}},{key:"retiredGraphKey",editor:!1,holds:s(e=>kF.some(n=>n in e),"holds"),what:{de:"`graph.id` / `graph.label` / `graph.dataFlow`",en:"`graph.id` / `graph.label` / `graph.dataFlow`"}},{key:"assignmentSlotString",editor:!1,holds:vF,what:{de:"Zust\xE4ndigkeitsregeln mit Slot als Text (`responsible` / `team:<Schl\xFCssel>`)",en:"assignment rules with a slot as text (`responsible` / `team:<key>`)"}},{key:"retiredFormNodeKey",editor:!1,holds:xF,what:{de:"Formularknoten mit `audience` / `populates` / `stages` / `expectedOutcomes`",en:"form nodes with `audience` / `populates` / `stages` / `expectedOutcomes`"}}];function SF(e){if(!Ba(e)||!Array.isArray(e.nodes))return[];let n=e;return Z4.filter(t=>t.holds(n)).map(({key:t,what:r,editor:i})=>({key:t,what:r,editor:i}))}s(SF,"legacyGraphShapes");function AF(e,n){let t=n.answers??{},r=[],i=[],o=e,a=kF.filter(T=>T in o);if(a.length>0){let T={...o};for(let q of a)delete T[q],r.push({message:`graph.${q}: deleted (read by nothing)`});o=T}if(xF(o)&&(o={...o,nodes:o.nodes.map(T=>{if(!Ba(T)||T.type!=="form")return T;let q=bF.filter(ae=>ae in T);if(q.length===0)return T;let G={...T};for(let ae of q)delete G[ae];return r.push({nodeId:String(T.id),message:`form node: deleted ${q.map(ae=>`\`${ae}\``).join(", ")} (read by nothing)`}),G})}),vF(o)){let T=o.assignmentRules.map((q,G)=>{if(!Ba(q)||typeof q.slot!="string")return q;let ae=Ap(q.slot);return ae===null?(i.push({code:"assignment/slotUnknown",answer:"edit",message:`assignmentRules[${G}].slot "${q.slot}" is neither \`responsible\` nor \`team:<key>\` \u2014 edit it by hand`}),q):(r.push({message:`assignmentRules[${G}].slot "${q.slot}" \u2192 ${JSON.stringify(ae)}`}),{...q,slot:ae})});o={...o,assignmentRules:T}}let l=K_(o);o=l.graph;for(let T of l.moved)r.push({nodeId:T,message:"generator / template pin moved into its input"});for(let T of l.unmoved)i.push({code:`generatorPin/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`the generator or template pin cannot be moved (${T.reason}) \u2014 edit the node by hand`});let d=vC(o);o=d.graph;for(let T of d.moved)r.push({nodeId:T,message:"setFlag `target` / `flagKey` / `value` moved into its inputs"});for(let T of d.unmoved)i.push({code:`setFlag/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`the setFlag properties cannot be moved (${T.reason}) \u2014 edit the node by hand`});let c=$C(o);o=c.graph;for(let T of c.moved)r.push({nodeId:T,message:"scalar settings moved into inputs"});for(let T of c.unmoved)i.push({code:`scalar/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`\`${T.key}\` cannot be moved into an input (${T.reason}) \u2014 edit the node by hand`});let u=DC(o);o=u.graph;for(let T of u.moved)r.push({nodeId:T,message:"payment note moved into `inputs.reason` / retired sample document deleted"});for(let T of u.unmoved)i.push({code:`nodeConfig/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`\`${T.key}\` cannot be moved into an input (${T.reason}) \u2014 edit the node by hand`});let p=lF(o);o=p.graph;for(let T of p.moved){let q=o.nodes.find(Z=>Ba(Z)&&Z.id===T),G=q?.inputs?.documentTemplate,ae=G?.kind==="literal"&&typeof G.value=="string"?G.value:null;r.push({nodeId:T,message:q!==void 0&&"templateStamp"in q&&ae!==null?`template parameters moved onto \`templateStamp\` / cockpit list into cells \u2014 the record \`${ae}\` must declare the same parameters (tenant catalog \`documentTemplates[].parameters\` / \`templates:setParameters\`) before publish, else [governedDocument/templateWithoutParameters]`:"cockpit list moved into `{ kind: 'cockpit' }` cells"})}for(let T of p.reports)r.push({nodeId:T.nodeId,message:`cockpit field \`${T.key??""}\` deleted (${T.reason}: ${T.reason==="unknownKey"?"the stamp declares no such parameter":T.reason==="processSource"?"the case fills it itself":"the input already holds a cell"})`});for(let T of p.unmoved)i.push({code:`templateStamp/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:T.reason==="noStamp"?"the cockpit list cannot be judged: the node carries no parameter stamp \u2014 run `offer workflow restamp-pins` against the environment, then upgrade again":T.reason==="templateAndStamp"?"the node carries both `template` and `templateStamp` \u2014 delete one by hand":"`template` is no object \u2014 edit the node by hand"});let h=N_(o);o=h.graph;for(let T of h.moved)r.push({nodeId:T,message:"start node: own `outcomes` / `event` / `effect` deleted (the node type declares its outcome)"});for(let T of h.unmoved)i.push({code:`eventTrigger/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`the start node cannot be reduced to its type's outcome (${T.reason}) \u2014 edit the node by hand`});let y=O_(o,t.semantics);o=y.graph;for(let T of y.written){if(T.source==="formerDefault"){r.push({nodeId:T.nodeId,message:`outcome \`${T.outcomeId}\`: semantic "${T.semantic}" (DEFAULT \u2014 the meaning it ran with; the retired id parser knew no other)`,defaulted:{answer:"semantic",answerKey:`${T.nodeId}.${T.outcomeId}`,value:T.semantic}});continue}r.push({nodeId:T.nodeId,message:`outcome \`${T.outcomeId}\`: semantic "${T.semantic}" (${T.source==="answer"?"answered":"the meaning the retired id parser gave this id"})`})}for(let T of y.refused)i.push({code:T.answer===void 0?"outcome/formerMeaningNotAllowed":"outcome/semanticNotAllowed",nodeId:T.nodeId,answer:"semantic",answerKey:`${T.nodeId}.${T.outcomeId}`,candidates:T.allowed,message:T.answer===void 0?`${T.nodeType} outcome \`${T.outcomeId}\` ran as "${Lw(T.outcomeId)??""}", which a ${T.nodeType} outcome may no longer carry \u2014 say which one it is`:`${T.nodeType} outcome \`${T.outcomeId}\`: "${T.answer}" is not a meaning a ${T.nodeType} outcome may carry`});for(let T of y.invalid)i.push({code:"outcome/semanticInvalid",nodeId:T.nodeId,answer:"edit",candidates:Ot,message:`outcome \`${T.outcomeId}\` carries the semantic "${T.value}", which is no meaning \u2014 edit it`});let b=L_(o,n.selection,t.waitlistPolicy);o=b.graph;for(let T of b.moved){let q=T.policy.waitlistOrder;r.push({nodeId:T.nodeId,message:`waitlist policy into inputs: ${X4(T.policy)} (${T.source==="answer"?"answered":T.source==="manifest"?"from manifest `selection`":"DEFAULT \u2014 the manifest stated no `selection.waitlistOrder`; the former code default it ran with"})`,...T.source==="formerDefault"?{defaulted:{answer:"waitlistPolicy",answerKey:T.nodeId,value:q}}:{}})}for(let T of b.refused)i.push({code:`waitlist/${T.reason}`,nodeId:T.nodeId,answer:"waitlistPolicy",answerKey:T.nodeId,candidates:sr,message:"manifest `selection` is malformed \u2014 say the queue order of this waitlist"});let k=VC(o);o=k.graph;for(let T of k.moved)r.push({nodeId:T,message:"payment: `inputs.settlement` \u2192 `inputs.mode` (separate \u2192 manual)"});for(let T of k.refused)i.push({code:`collectPayment/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:T.reason==="bothCells"?"the payment node carries both `inputs.settlement` and `inputs.mode` \u2014 delete `settlement` by hand":"`inputs.settlement` is no literal online | separate \u2014 set `inputs.mode` by hand"});let v=zC(o);o=v.graph;for(let T of v.moved)r.push({nodeId:T.split(".")[0],message:`\`formView\` \u2192 \`view\` (${T})`});for(let T of v.refused){let q=T.taskKey===void 0?"the node":`task "${T.taskKey}"`;i.push({code:`view/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:T.reason==="bothFields"?`${q} carries both \`formView\` and \`view\` \u2014 delete \`formView\` by hand`:`${q}'s \`formView\` is no { form, key } \u2014 set \`view\` by hand`})}let $=ZC(o);o=$.graph;for(let T of $.moved)r.push({nodeId:T.nodeId,message:`\`assign.${T.templateKey}\`: team \u2192 rule list`});for(let T of $.refused)i.push({code:"assign/shape",nodeId:T.nodeId,answer:"edit",message:`\`assign.${T.templateKey}\` is neither a team key nor a rule list \u2014 set it by hand`});let R=eP(o);o=R.graph;for(let T of R.moved)r.push({nodeId:T.split(".")[0],message:`documents: \`document:$node.<node>.document\` \u2192 \`artifact:<slot>\` (${T})`});for(let T of R.refused)i.push({code:`workItems/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`task "${T.taskKey}" links a document whose node declares no single slot \u2014 name the slot as \`artifact:<slot>\` by hand`});if(LC(o)){let T=MC(o,t.payee);o=T.graph;for(let q of T.set)r.push({nodeId:q.nodeId,message:`online payment: payee "${q.payee}" (answered)`});for(let q of T.refused)i.push({code:"collectPayment/payeeMissing",nodeId:q,answer:"payee",answerKey:q,message:"an online payment names the Tr\xE4ger its money goes to \u2014 say its key (a `legal_entities.configKey` of the tenant)"})}for(let T of kb(o).malformed)i.push({code:"submitReceipt/notificationsMalformed",nodeId:T,answer:"edit",message:"the form node's `notifications` is no record \u2014 edit it by hand"});let I=uF(o);o=I.graph;for(let T of I.bound)r.push({nodeId:T,message:"submit receipt bound to `notifications.submitted` (`applicant.applicationSubmitted`, sent by code before)"});let D=hF(o);o=D.graph;for(let T of D.set)r.push({nodeId:T,message:"review: `whenNothingOwed` = park (every review parked before the input existed)"});for(let T of yF(o).malformed)i.push({code:"appointmentLetters/notificationsMalformed",nodeId:T,answer:"edit",message:"the node's `notifications` is no record \u2014 edit it by hand"});let F=wF(o);o=F.graph;for(let T of F.bound){let q=T.indexOf(".");r.push({nodeId:T.slice(0,q),message:`appointment letter bound to \`notifications.${T.slice(q+1)}\` (the standard letter, sent by code before)`})}let C=Up(o).filter(T=>!T.hasTeam);for(let T of C)i.push({code:"task/userWithoutTeam",nodeId:T.nodeId,answer:"edit",message:`task \`${T.taskKey}\` names a fixed person and no team \u2014 give it a team (\`assign.group\`) by hand`});let x=nP(o);o=x.graph;for(let T of x.dropped.filter(q=>q.hasTeam))r.push({nodeId:T.nodeId,message:`task \`${T.taskKey}\`: \`assign.userId\` deleted (the team holds the row)`});let N=oF(o,{bindings:!0});o=N.graph;for(let T of N.dropped){if(!T.binding){r.push({nodeId:T.nodeId,message:`input \`${T.key}\` deleted (no slot of the node declares it)`});continue}r.push({nodeId:T.nodeId,message:`input \`${T.key}\` deleted (DEFAULT \u2014 a binding no slot declares: no slot handed its value to the node, but the readiness gate waited for it; the node no longer waits for that value)`,defaulted:{answer:"undeclaredBinding",answerKey:`${T.nodeId}.${T.key}`,value:"deleted"}})}return{graph:o,changes:r,refusals:i}}s(AF,"upgradeGraph");function X4(e){return`waitlistOrder=${e.waitlistOrder}`}s(X4,"formatPolicy");function _r(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(_r,"isObject");var TF="admission.generic",RF=Object.keys(vp).filter(e=>e!=="label");function $F(e){return(Array.isArray(e.testScenarios)?e.testScenarios:[]).filter(t=>_r(t)&&"env"in t).map(t=>String(t.id))}s($F,"sampledScenarioIds");function EF(e){return _r(e.smartforms)?Object.entries(e.smartforms):[]}s(EF,"smartformEntries");function e5(e){let n=[];EF(e.index).some(([,i])=>_r(i)&&"outcomeFnRef"in i)&&n.push({de:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml",en:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml"});let t=Object.keys(e.manifest).filter(i=>Object.hasOwn(Xl,i));if(t.length>0){let i=t.map(o=>`\`${o}\``).join(", ");n.push({de:`manifest.json mit ${i}`,en:`manifest.json with ${i}`})}Object.values(e.smartforms??{}).some(i=>RF.some(o=>o in i))&&n.push({de:"Formulardateien mit `id` / `outcomeIds` / `schoolSlug`",en:"form files with `id` / `outcomeIds` / `schoolSlug`"}),Object.values(e.smartforms??{}).some(i=>$F(i).length>0)&&n.push({de:"Testszenarien mit Umgebungs-Sample (`testScenarios[].env`)",en:"test scenarios with an environment sample (`testScenarios[].env`)"});let r=e.workflow;return r!==void 0&&(_r(r.progressWiring)&&"layoutId"in r.progressWiring&&n.push({de:"`progressWiring.layoutId`",en:"`progressWiring.layoutId`"}),n.push(...SF(r.graph).map(i=>i.what))),n}s(e5,"legacyBundleShapes");function Km(e,n){let t=e5(e);t.length!==0&&de("BUNDLE_NEEDS_UPGRADE",{de:`offer: ${n} stammt aus einem \xE4lteren Bundle-Format (${t.map(r=>r.de).join("; ")}). Zuerst \`plexus-cli offer upgrade --dir <Bundle>\` ausf\xFChren (Probelauf, beantwortet die offenen Fragen), dann mit \`--write\` schreiben und erneut pr\xFCfen.`,en:`offer: ${n} is in an older bundle format (${t.map(r=>r.en).join("; ")}). Run \`plexus-cli offer upgrade --dir <bundle>\` first (a dry run that asks what it cannot decide), then write with \`--write\` and validate again.`})}s(Km,"assertBundleCurrent");function qm(e){let n=s(t=>Array.isArray(t)?t.map(n):_r(t)?Object.fromEntries(Object.keys(t).sort().map(r=>[r,n(t[r])])):t,"sort");return JSON.stringify(n(e))}s(qm,"canonical");function IF(e,n={}){let t=[],r=[],i=e.index,o=EF(i);if(o.some(([,u])=>_r(u)&&Object.keys(u).length>0)){let u={};for(let[p,h]of o){if(!_r(h)||Object.keys(h).length===0){u[p]=h;continue}let{outcomeFnRef:y,...b}=h;if(Object.keys(b).length>0||y!==void 0&&y!==TF){r.push({file:"bundle.yaml",code:"index/smartformEntry",answer:"edit",message:`smartforms.${p} carries ${Object.keys(h).map(k=>`\`${k}\``).join(", ")} \u2014 only \`outcomeFnRef: ${TF}\` is known; edit the entry to {} by hand`}),u[p]=h;continue}t.push({file:"bundle.yaml",message:`smartforms.${p}.outcomeFnRef deleted (a form routes by its own declared outcomes)`}),u[p]={}}i={...i,smartforms:u}}let a={},l=e.workflow,d;for(let[u,p]of Object.entries(e.manifest)){if(u==="selection"){d=p,t.push({file:"manifest.json",message:"`selection` deleted (its queue policy goes to the waitlist node's inputs; release strategy and deadline were read by nothing)"});continue}if(u==="progressLayout"){l===void 0?t.push({file:"manifest.json",message:"`progressLayout` deleted (the bundle has no workflow it could belong to)"}):l.progressLayout===void 0?(l={...l,progressLayout:p},t.push({file:"manifest.json",message:"`progressLayout` moved to workflow.json `progressLayout`"})):qm(l.progressLayout)===qm(p)?t.push({file:"manifest.json",message:"`progressLayout` deleted (workflow.json carries the same layout)"}):(r.push({file:"manifest.json",code:"manifest/progressLayoutTwice",answer:"edit",message:"`progressLayout` differs from workflow.json `progressLayout` \u2014 keep one by hand"}),a[u]=p);continue}let h=Object.hasOwn(Xl,u)?Xl[u]:void 0;if(h===void 0){r.push({file:"manifest.json",code:"manifest/unknownKey",answer:"edit",message:`unknown key \`${u}\` \u2014 manifest.json carries no key; decide by hand where it belongs`}),a[u]=p;continue}t.push({file:"manifest.json",message:`\`${u}\` deleted (${h.en})`})}if(l!==void 0){if(_r(l.progressWiring)&&"layoutId"in l.progressWiring){let{layoutId:p,...h}=l.progressWiring;l={...l,progressWiring:h},t.push({file:"workflow.json",message:"`progressWiring.layoutId` deleted (the layout is the workflow's own)"})}let u=l.graph;if(_r(u)&&Array.isArray(u.nodes)){let p=AF(u,{selection:d,answers:n});l={...l,graph:p.graph},t.push(...p.changes.map(h=>({...h,file:"workflow.json"}))),r.push(...p.refusals.map(h=>({...h,file:"workflow.json"})))}else r.push({file:"workflow.json",code:"workflow/graphShape",answer:"edit",message:"`graph` is no object with a node list"})}let c=e.smartforms;if(c!==void 0){let u={};for(let[p,h]of Object.entries(c)){let y={...h},b=`smartforms/${p}.json`;for(let v of RF)if(v in h){if(v==="outcomeIds"){let $=Array.isArray(h.outcomes)?h.outcomes.map(R=>_r(R)?R.id:void 0):[];if(qm([...Array.isArray(h.outcomeIds)?h.outcomeIds:[]].map(String).sort())!==qm($.map(String).sort())){r.push({file:b,code:"smartform/outcomeIdsDiffer",answer:"edit",message:"`outcomeIds` differs from the ids of `outcomes[]` \u2014 reconcile them by hand"});continue}}delete y[v],t.push({file:b,message:`\`${v}\` deleted (${vp[v].en})`})}let k=$F(h);k.length>0&&(y.testScenarios=h.testScenarios.map(v=>{if(!_r(v)||!("env"in v))return v;let{env:$,...R}=v;return R}),t.push({file:b,message:`\`env\` deleted from test scenario(s) ${k.join(", ")} (a scenario fits every grade and school year; scenarios that only differed by stage are now duplicates \u2014 delete them)`})),u[p]=y}c=u}return{bundle:{index:i,manifest:a,...c!==void 0?{smartforms:c}:{},...l!==void 0?{workflow:l}:{}},changes:t,refusals:r}}s(IF,"upgradeOfferBundle");var n5={createManifest:S.workflow.createManifest,publishManifest:S.workflow.publishManifest,publishOfferInternal:S.workflow.publishOfferInternal,publishOfferExternal:S.workflow.publishOfferExternal,getOfferPublishState:S.workflow.getOfferPublishState,upsertCustomField:S.admission.upsertCustomField,upsertDerivedAttributeRule:S.admission.upsertDerivedAttributeRule,createSmartForm:S.forms.createSmartForm,getSmartFormBySlug:S.forms.getSmartFormBySlug,saveSmartFormDraft:S.forms.saveSmartFormDraft,publishSmartForm:S.forms.publishSmartForm,createWorkflow:S.workflow.createWorkflow,getWorkflowGraph:S.workflow.getWorkflowGraph,saveWorkflowDraft:S.workflow.saveWorkflowDraft,publishWorkflow:S.workflow.publishWorkflow},QSe={createManifest:ut.workflow.createManifestInternal,publishManifest:ut.workflow.publishManifestInternal,publishOfferInternal:ut.workflow.publishOfferInternalInternal,publishOfferExternal:ut.workflow.publishOfferExternalInternal,getOfferPublishState:ut.workflow.getOfferPublishStateInternal,upsertCustomField:ut.admission.upsertCustomFieldInternal,upsertDerivedAttributeRule:ut.admission.upsertDerivedAttributeRuleInternal,createSmartForm:ut.forms.createSmartFormInternal,getSmartFormBySlug:ut.forms.getSmartFormBySlugInternal,saveSmartFormDraft:ut.forms.saveSmartFormDraftInternal,publishSmartForm:ut.forms.publishSmartFormInternal,createWorkflow:ut.workflow.createWorkflowInternal,getWorkflowGraph:ut.workflow.getWorkflowGraphInternal,saveWorkflowDraft:ut.workflow.saveWorkflowDraftInternal,publishWorkflow:ut.workflow.publishWorkflowInternal};function Sb(e,n){for(let[t,r]of Object.entries(e.smartforms??{})){(r===null||typeof r!="object"||Array.isArray(r))&&de("INVALID",{de:`offer: ${n}: smartforms.${t} muss eine leere Zuordnung ({}) sein.`,en:`offer: ${n}: smartforms.${t} must be an empty mapping ({}).`});let i=Object.keys(r);if(i.length===0)continue;let o=i.map(l=>`\`${l}\``).join(", "),a=i.includes("outcomeFnRef");de("INVALID",{de:`offer: ${n}: smartforms.${t} enth\xE4lt unbekannte Schl\xFCssel ${o} \u2014 der Eintrag muss leer sein ({}).${a?" `outcomeFnRef` geh\xF6rt nicht mehr zum Bundle-Format: ein Formular entscheidet \xFCber seine eigenen Ergebnisse. Die Zeile l\xF6schen.":""}`,en:`offer: ${n}: smartforms.${t} carries unknown key(s) ${o} \u2014 the entry must be empty ({}).${a?" `outcomeFnRef` is no longer part of the bundle format: a form routes by its own declared outcomes. Delete the line.":""}`})}}s(Sb,"assertSmartformEntries");function OF(e){let n=s(t=>Array.isArray(t)?t.map(n):t&&typeof t=="object"?Object.fromEntries(Object.keys(t).sort().map(r=>[r,n(t[r])])):t,"sort");return JSON.stringify(n(e))}s(OF,"canonicalJson");function _F(e,n){return n==null?!0:OF(e)!==OF(n)}s(_F,"changed");async function CF(e,n,t,r={},i=n5){let{index:o}=n;Km({index:o,manifest:n.manifest,...n.smartforms!==void 0?{smartforms:n.smartforms}:{},...n.workflow!==void 0?{workflow:n.workflow}:{}},`bundle of ${o.slugs.manifest}`),Sb(o,`bundle of ${o.slugs.manifest}`);let a=bp(n.manifest);a.length>0&&de("INVALID",{de:`offer: manifest.json von ${o.slugs.manifest} ist ung\xFCltig:
|
|
11655
|
+
{{einstellungenLink}}`}}]},Dk=[AH,OH,PH,DH,qH,KH,GH,UH,pJ,hJ,RJ,EJ,OJ,PJ,FJ,MJ,jJ,UJ,WJ,HJ,gJ,yJ,wJ,JJ,QJ,ZJ,zH,WH,JH,MH,QH,eJ,rJ,sJ,uJ,SJ,y6,k6,RH,EH,e6,t6,i6,s6,l6,c6,f6];function Fk(e){let n=Dk.find(t=>t.id===e);return n===void 0&&M(`notifications: unknown letter "${e}"`),n}s(Fk,"letterDefFor");function Lk(e){return Dk.some(n=>n.id===e)}s(Lk,"hasLetterDef");function Mk(e,n){return n===void 0?!0:Dp(e,n)}s(Mk,"letterArgCompatible");function hd(e){return e==="localizedText"?{de:"Text in jeder Sprache (localizedText)",en:"Text in every language (localizedText)"}:{de:`${ft(e)} (${e})`,en:`${ft(e)} (${e})`}}s(hd,"letterArgTypeLabel");function aN(e){let n=new Map,t=s((r,i)=>{let o=n.get(r);o===void 0?n.set(r,[i]):o.push(i)},"add");for(let r of e.args)t(r.key,{source:`Ereignis "${e.id}"`,type:r.type,always:r.required===!0});for(let r of UP)t(r.key,{source:"Kontext des Versands",type:r.type,always:!0});return n}s(aN,"eventArgSources");function lN(e,n){let t=e.type===void 0?[...n]:n.filter(r=>Mk(r.type,e.type));if(t.length>1)return{status:"ambiguous",matches:t};if(t.length===1){let r=t[0];return!e.required||r.always?{status:"resolved",source:r}:{status:"sometimes",source:r}}return e.required?{status:"missing",rejected:[...n]}:{status:"unused"}}s(lN,"resolveLetterParam");var qk=["booked","rescheduled","cancelled"],b6={booked:"admission.appointmentBooked",rescheduled:"admission.appointmentRescheduled",cancelled:"admission.appointmentCancelled"},cN=":";function uN(e,n){return`${e}${cN}${n}`}s(uN,"appointmentEventId");function v6(e){let n=e.lastIndexOf(cN);if(n<=0)return null;let t=e.slice(n+1);return qk.includes(t)?{taskKey:e.slice(0,n),kind:t}:null}s(v6,"parseAppointmentEventId");var dN={booked:{de:"Termin vereinbart",en:"Appointment booked"},rescheduled:{de:"Termin verschoben",en:"Appointment moved"},cancelled:{de:"Termin abgesagt",en:"Appointment cancelled"}};function Ta(e){return Array.isArray(e.tasks)?e.tasks.filter(n=>typeof n?.key=="string"&&n.result?.kind==="appointment"):[]}s(Ta,"appointmentTasksOf");function x6(e){return qk.map(n=>({id:uN(e.key,n),label:{de:`${dN[n].de} \u2013 \u201E${e.title.de}\u201C`,en:`${dN[n].en} \u2013 \u201C${e.title.en}\u201D`},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"bookingId",type:"string",required:!0}]}))}s(x6,"appointmentTaskEvents");function fN(e,n){let t=n.notificationEvents?.(e)??[],r=Ta(e).flatMap(x6);return r.length===0?t:[...t,...r]}s(fN,"nodeNotificationEvents");function S6(e){return Object.fromEntries(qk.map(n=>[uN(e,n),{templateId:b6[n]}]))}s(S6,"defaultAppointmentBindings");function A6(e,n){if(e===void 0)return{notifications:e,dropped:[]};let t=[],r={};for(let[i,o]of Object.entries(e))v6(i)?.taskKey===n?t.push(i):r[i]=o;return t.length===0?{notifications:e,dropped:t}:{notifications:Object.keys(r).length===0?void 0:r,dropped:t}}s(A6,"withoutAppointmentBindings");function lm(e,n,t){let r=new Set(Ta(n).map(d=>d.key)),i=new Set(Ta(t).map(d=>d.key)),o=e,a=[];for(let d of r){if(i.has(d))continue;let c=A6(o,d);o=c.notifications,a.push(...c.dropped)}let l=[];for(let d of i)if(!r.has(d))for(let[c,u]of Object.entries(S6(d)))o?.[c]===void 0&&(o={...o??{},[c]:u},l.push(c));return{notifications:o,bound:l,dropped:a}}s(lm,"syncAppointmentBindings");function T6(e){return e.kind==="task"&&!("title"in e)}s(T6,"isLegacyFreeTodoContext");function Kk(e){let{context:n}=e;if(T6(n)&&M(`[workItems/legacyFreeTodo] work_item ${e._id} is a free to-do in its former shape \u2014 run migrations:freeTodosToContext`),n.kind==="task")return{...e,context:n,kind:"task",createdVia:"human",partyId:n.partyId};let{anchor:t,task:r,kind:i,title:o,description:a,...l}=n,d=t.scope==="node"?{nodeId:t.nodeId,templateKey:t.templateKey,gatesNode:t.gatesNode,blocks:t.blocks}:t.scope==="application"?{scope:"application",templateKey:t.templateKey}:t.scope==="crossNode"?{scope:"application",nodeId:t.nodeId,templateKey:t.templateKey,blocks:t.blocks}:{};return{...e,context:n,...l,...d,...r??{},kind:i}}s(Kk,"readWorkItem");async function Ra(e,n){let t;if(n.nodeId!==void 0){let r=n.nodeId;t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",i=>i.eq("context.applicationId",n.applicationId).eq("context.anchor.nodeId",r)).collect()}else if(n.isOpen!==void 0){let r=n.isOpen;t=await e.db.query("work_items").withIndex("by_applicationId_and_isOpen",i=>i.eq("context.applicationId",n.applicationId).eq("isOpen",r)).collect()}else t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",r=>r.eq("context.applicationId",n.applicationId)).collect();return t.filter(r=>n.isOpen===void 0||r.isOpen===n.isOpen).map(Kk)}s(Ra,"listWorkItemsForApplication");var eke=m.union(m.literal("approved"),m.literal("rejected")),gd=new Set(["task","approval"]);function $6(e,n){switch(e){case"task":return n?.gatesNode===!0&&M("expandComposedTask: gatesNode is approval-only \u2014 a 'task' template never gates its node (use blocks to hold a gating sibling back)"),{kind:"task",recipient:"internal",gatesNode:!1};case"approval":return{kind:"approval",recipient:"internal",isApproval:!0,gatesNode:n?.gatesNode??!0};default:M(`expandComposedTask: unknown composed-task kind ${JSON.stringify(e)} \u2014 authorable: ${[...gd].join(", ")}`)}}s($6,"expandComposedTask");for(let e of["task","approval"]){let n=$6(e);n.kind==="approval"!=(n.isApproval===!0)&&M(`composed-task kind "${e}": isApproval must be present iff kind === 'approval'`)}var pN=eo,ho=`${pN}.`,E6=new Set(["text","number","date","boolean","option","edge"]);function jk(e,n){let t=e[n];return t===void 0&&M(`[env/unknownKey] no environment key '${n}'`),typeof t=="string"?null:Object.keys(t)}s(jk,"contextFields");function mN(e,n){return Object.hasOwn(e,n)}s(mN,"isContextKey");function hN(e){let n=[];for(let t of Object.keys(e)){let r=jk(e,t);if(r===null)n.push(t);else for(let i of r)n.push(`${t}.${i}`)}return n}s(hN,"leafPaths");function yd(e,n){let[t="",r,...i]=n.split(".");if(!mN(e,t)||i.length>0)return;let o=e[t];if(typeof o=="string")return r===void 0?o:void 0;if(!(r===void 0||!Object.hasOwn(o,r)))return o[r]}s(yd,"leafType");function gN(e){let n=new Set;for(let t of e){let r=$a(t);r!==null&&n.add(r.split(".")[0])}return[...n]}s(gN,"contextKeysOf");function $a(e){return e.startsWith(ho)?e.slice(ho.length):null}s($a,"contextPathOf");function wd(e){return e===pN||e.startsWith(ho)}s(wd,"isContextIdentifier");function dm(e,n){let t=$a(n)??"",[r=""]=t.split("."),i=Object.keys(e);if(!mN(e,r))return{code:"env/unknownKey",message:{de:`'${n}' nennt keinen Umgebungsschl\xFCssel \u2014 bekannt: ${i.join(", ")}.`,en:`'${n}' names no environment key \u2014 known: ${i.join(", ")}.`}};if(yd(e,t)!==void 0)return null;let o=jk(e,r);return{code:"env/unknownKey",message:o===null?{de:`'${n}': der Umgebungsschl\xFCssel '${r}' ist ein einzelner Wert \u2014 lies ihn als '${ho}${r}'.`,en:`'${n}': environment key '${r}' is a single value \u2014 read it as '${ho}${r}'.`}:{de:`'${n}': der Umgebungsschl\xFCssel '${r}' hat die Felder ${o.join(", ")}.`,en:`'${n}': environment key '${r}' has the fields ${o.join(", ")}.`}}}s(dm,"identifierIssue");function cm(e,n,t=Object.keys(e)){let r={};for(let i of t){let o=jk(e,i),a=Object.hasOwn(n,i)?n[i]:void 0;if(a===void 0&&M(`[env/missing] context key '${i}' was not supplied`),o===null){r[`${ho}${i}`]=a;continue}for(let l of o){let d=typeof a=="object"&&a!==null&&Object.hasOwn(a,l)?a[l]:void 0;d===void 0&&M(`[env/missing] context key '${i}' carries no '${l}'`),r[`${ho}${i}.${l}`]=d}}return r}s(cm,"flatten");function I6(e,n){switch(n){case"number":return typeof e=="number"&&Number.isFinite(e);case"boolean":return typeof e=="boolean";case"date":return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}/.test(e);default:return typeof e=="string"}}s(I6,"valueMatchesDataType");function yN(e,n,t=Object.keys(e.types)){let r=new Set(t);for(let i of hN(e.types)){if(!r.has(i.split(".")[0]))continue;let o=n[`${ho}${i}`];o===void 0&&M(`[env/missing] context path '${i}' was not supplied`);let a=e.fields[i];if(o===null){a.nullable||M(`[env/null] context path '${i}' is not nullable but carries null`);continue}let l=ft(yd(e.types,i));I6(o,l)||M(`[env/type] context path '${i}' expects ${l}, got ${JSON.stringify(o)}`),a.valueSet.kind==="fixed"&&!a.valueSet.values.includes(o)&&M(`[env/value] context path '${i}' carries '${String(o)}', outside ${a.valueSet.values.join(" | ")}`)}}s(yN,"assertContextValues");function O6(e){let n=[],t=hN(e.types);for(let r of t){let i=yd(e.types,r),o=ft(i);if(!oo(i)||o===void 0||!E6.has(o)){n.push(`'${r}' has type '${String(i)}', not a scalar value type`);continue}let a=Object.hasOwn(e.fields,r)?e.fields[r]:void 0;if(a===void 0){n.push(`'${r}' has no field spec (value set + nullability)`);continue}a.valueSet.kind==="fixed"&&(a.valueSet.values.length===0&&n.push(`'${r}' has an empty fixed value set`),o!=="text"&&o!=="option"&&n.push(`'${r}' is ${o}; a fixed value set needs a text or option leaf`))}for(let r of Object.keys(e.fields))t.includes(r)||n.push(`field spec '${r}' names no leaf of the schema`);return n}s(O6,"schemaIssues");function Ea(e){let n=O6(e);n.length>0&&M(`[env/schema] ${n.join("; ")}`)}s(Ea,"assertSchema");var um={length:{params:["text"],returns:"number"},years_between:{params:["date","date"],returns:"number"}};function go(e){return JSON.stringify(e)}s(go,"canonical");function Oa(e){return e.kind==="binary"&&e.op==="&&"?[...Oa(e.left),...Oa(e.right)]:[e]}s(Oa,"conjuncts");function bN(e,n){let t;try{t=Kn(e)}catch{return!1}let r=go(Kn(n));return Oa(t).some(i=>go(i)===r)}s(bN,"hasConjunct");function vN(e,n){try{return go(Kn(e))===go(Kn(n))}catch{return!1}}s(vN,"sameCondition");function xN(e){let n=[];for(let t of e)n.push(...jn(Ai(t)));return gN(n)}s(xN,"contextKeysRead");function SN(e){try{return jn(Kn(e)).some(wd)}catch{return!1}}s(SN,"readsContext");var _6=/^\d{4}-\d{2}-\d{2}$/,C6=new Set(["==","!=","<","<=",">",">=","in"]),P6=new Set(["<","<=",">",">="]);function pm(e,n,t=[]){Ea(n);let r;try{r=Kn(e)}catch(a){let l=a.message;return[rt("condition/parse",`Bedingung '${e}' ist nicht lesbar: ${l}`,`condition '${e}' does not parse: ${l}`)]}let i=[];for(let a of jn(r)){if(!wd(a)){i.push(rt("condition/foreignIdentifier",`'${a}' ist kein Umgebungswert \u2014 Bedingungen lesen nur '$env.*'`,`'${a}' is not a context identifier \u2014 conditions read only '$env.*'`));continue}let l=dm(n.types,a);l!==null&&i.push(rt("condition/unknownIdentifier",l.message.de,l.message.en))}if(i.length>0)return i;let o=ii(r,n,i);kd(o)||i.push(rt("condition/notBoolean",`Bedingung '${e}' ist kein Ja/Nein-Ausdruck`,`condition '${e}' is not a yes/no expression`)),L6(r,n,i);for(let{identifier:a,op:l}of Uk(r,n))i.push(rt("condition/unguardedNullable",`'${l}' \xFCber '${a}', das leer sein kann, braucht davor eine Absicherung '${a} != null &&'`,`'${l}' over '${a}', which may be null, needs a guard '${a} != null &&' before it`));return i.push(...N6(r,t)),i}s(pm,"conditionIssues");function N6(e,n){let t=Oa(e).map(go);return n.flatMap(r=>{let i=Kn(r),o=D6(i);return o===null||!t.includes(go(o))?[]:[{severity:"info",code:"condition/guardForm",message:{de:`[condition/guardForm] eine gespiegelte Absicherung z\xE4hlt nicht \u2014 schreibe sie genau als '${r}'`,en:`[condition/guardForm] a mirrored guard does not count \u2014 write it exactly as '${r}'`}}]})}s(N6,"guardFormHints");function D6(e){if(e.kind!=="binary"||e.op!=="=="&&e.op!=="!=")return null;let n={...e,left:e.right,right:e.left};return go(n)===go(e)?null:n}s(D6,"mirror");function kd(e){return e.t==="unknown"||e.t==="data"&&e.dt==="boolean"}s(kd,"isBooleanish");function AN(e){let n=$a(e);return n===null&&M(`[condition/invariant] '${e}' reached a pass that only sees $env identifiers`),n}s(AN,"contextPath");function TN(e,n){let t=$a(n);return t!==null&&e.fields[t]?.nullable===!0}s(TN,"isNullableLeaf");function F6(e,n){let t=ft(yd(e.types,AN(n)));return t===void 0?{t:"unknown"}:{t:"data",dt:t}}s(F6,"identType");function fm(e,n){return e.t==="unknown"||n.t==="unknown"||e.t==="null"||n.t==="null"?!0:e.t==="array"||n.t==="array"?!1:e.t==="str"&&n.t==="str"?!0:e.t==="str"?wN(e.value,n.dt):n.t==="str"?wN(n.value,e.dt):e.dt===n.dt}s(fm,"fits");function wN(e,n){return n==="text"||n==="option"||n==="edge"?!0:n==="date"?_6.test(e):!1}s(wN,"strFits");function kN(e){return e.t==="unknown"?"unknown":e.t==="data"&&e.dt==="number"?"number":null}s(kN,"orderedCategory");function ii(e,n,t){switch(e.kind){case"num":return{t:"data",dt:"number"};case"bool":return{t:"data",dt:"boolean"};case"str":return{t:"str",value:e.value};case"null":return{t:"null"};case"ident":return F6(n,e.path);case"arr":for(let r of e.items)ii(r,n,t);return{t:"array"};case"unary":{let r=ii(e.operand,n,t);return kd(r)||t.push(rt("condition/notBoolean","'!' braucht einen Ja/Nein-Operanden","'!' needs a yes/no operand")),{t:"data",dt:"boolean"}}case"call":{let r=Object.hasOwn(um,e.name)?um[e.name]:void 0,i=e.args.map(l=>ii(l,n,t));return r===void 0?(t.push(rt("condition/functionNotAllowed",`Funktion '${e.name}' ist nicht erlaubt \u2014 erlaubt: ${Object.keys(um).join(", ")}`,`function '${e.name}' is not allowed \u2014 allowed: ${Object.keys(um).join(", ")}`)),{t:"unknown"}):(i.length===r.params.length&&i.every((l,d)=>l.t!=="null"&&fm(l,{t:"data",dt:r.params[d]}))||t.push(rt("condition/typeMismatch",`'${e.name}' nimmt (${r.params.join(", ")})`,`'${e.name}' takes (${r.params.join(", ")})`)),{t:"data",dt:r.returns})}case"if":{let r=ii(e.cond,n,t);kd(r)||t.push(rt("condition/notBoolean","'if' braucht eine Ja/Nein-Bedingung","'if' needs a yes/no condition"));let i=ii(e.then,n,t),o=ii(e.else,n,t);return fm(i,o)||t.push(rt("condition/typeMismatch","die beiden Zweige von 'if' haben verschiedene Typen","the two arms of 'if' differ in type")),i.t==="null"?o:i}case"binary":{let r=ii(e.left,n,t),i=ii(e.right,n,t);if(e.op==="&&"||e.op==="||")(!kd(r)||!kd(i))&&t.push(rt("condition/notBoolean",`'${e.op}' braucht Ja/Nein-Operanden`,`'${e.op}' needs yes/no operands`));else if(e.op==="in")e.right.kind!=="arr"?t.push(rt("condition/inWithoutArray","'in' braucht rechts eine Liste, z. B. ['a', 'b']","'in' needs a list on its right, e.g. ['a', 'b']")):e.right.items.every(o=>fm(r,ii(o,n,[])))||t.push(rt("condition/typeMismatch","ein Listeneintrag von 'in' passt nicht zum Typ des linken Operanden","a list item of 'in' does not match the left operand's type"));else if(P6.has(e.op)){let o=kN(r),a=kN(i);(o===null||a===null||o!=="unknown"&&a!=="unknown"&&o!==a)&&t.push(rt("condition/orderedComparison",`'${e.op}' vergleicht nur Zahlen \u2014 f\xFCr Daten years_between(\u2026) verwenden`,`'${e.op}' compares only numbers \u2014 for dates use years_between(\u2026)`))}else fm(r,i)||t.push(rt("condition/typeMismatch",`'${e.op}' vergleicht Werte verschiedener Typen`,`'${e.op}' compares values of different types`));return{t:"data",dt:"boolean"}}}}s(ii,"typeOf");function Vk(e){return e.kind==="str"||e.kind==="num"||e.kind==="bool"}s(Vk,"isLiteral");function RN(e){let n=[],t=s(r=>{if(r.kind==="binary"&&C6.has(r.op)){if(r.left.kind==="ident"){let i=r.op==="in"&&r.right.kind==="arr"?r.right.items.filter(Vk):Vk(r.right)?[r.right]:[];i.length>0&&n.push({ident:r.left.path,literals:i})}r.right.kind==="ident"&&Vk(r.left)&&n.push({ident:r.right.path,literals:[r.left]})}$N(r,t)},"visit");return t(e),n}s(RN,"comparedLiterals");function L6(e,n,t){for(let{ident:r,literals:i}of RN(e)){let o=M6(r,i,n);o!==null&&t.push(o)}}s(L6,"literalIssues");function Bk(e,n){let t;try{t=Kn(e)}catch{return[]}let r=[];for(let{ident:i,literals:o}of RN(t)){let a=$a(i);if(!(a===null||n.fields[a]?.valueSet.kind!=="live"))for(let l of o)l.kind==="str"&&r.push({path:a,value:l.value})}return r}s(Bk,"liveLiterals");function M6(e,n,t){let r=t.fields[AN(e)]?.valueSet;if(r?.kind==="unstable")return rt("condition/literalOnUnstable",`'${e}' ist nicht \xFCber Umgebungen stabil \u2014 vergleiche ihn mit keinem festen Wert; verzweige stattdessen \xFCber ein stabiles Merkmal`,`'${e}' is not stable across environments \u2014 compare it to no literal; branch on a stable attribute instead`);if(r?.kind!=="fixed")return null;let i=n.flatMap(a=>a.kind==="str"&&!r.values.includes(a.value)?[`'${a.value}'`]:[]);if(i.length===0)return null;let o=r.values.map(a=>`'${a}'`).join(", ");return rt("condition/literalOutsideSet",`'${e}' kennt nur ${o} \u2014 nicht ${i.join(", ")}`,`'${e}' takes only ${o} \u2014 not ${i.join(", ")}`)}s(M6,"valueSetIssue");function $N(e,n){switch(e.kind){case"binary":n(e.left),n(e.right);return;case"unary":n(e.operand);return;case"call":e.args.forEach(n);return;case"arr":e.items.forEach(n);return;case"if":n(e.cond),n(e.then),n(e.else);return;default:return}}s($N,"forEachChild");function EN(e){return e.kind==="binary"&&(e.op==="=="||e.op==="!=")&&(e.left.kind==="ident"&&e.right.kind==="null"||e.left.kind==="null"&&e.right.kind==="ident")}s(EN,"isNullTest");function IN(e){return Oa(e).flatMap(n=>{let t=ON(n);return t===null?[]:[t]})}s(IN,"guardsOf");function bd(e,n,t){switch(e.kind){case"ident":return TN(n,e.path)&&!t.has(e.path)?e.path:null;case"call":for(let r of e.args){let i=bd(r,n,t);if(i!==null)return i}return null;case"if":return bd(e.then,n,new Set([...t,...IN(e.cond)]))??bd(e.else,n,t);default:return null}}s(bd,"unguardedNullSource");function ON(e){return!EN(e)||e.kind!=="binary"||e.op!=="!="?null:e.left.kind==="ident"?e.left.path:e.right.kind==="ident"?e.right.path:null}s(ON,"guardedIdent");function Ia(e,n,t,r){if(e.kind==="binary"&&e.op==="&&"){let i=new Set(t);for(let o of Oa(e)){Ia(o,n,i,r);let a=ON(o);a!==null&&i.add(a)}return}if(e.kind==="if"){Ia(e.cond,n,t,r),Ia(e.then,n,new Set([...t,...IN(e.cond)]),r),Ia(e.else,n,t,r);return}if(e.kind==="binary"&&e.op==="!="&&e.left.kind!=="null"&&e.right.kind!=="null"){let i=bd(e.left,n,t)??bd(e.right,n,t);i!==null&&r(i,"!=")}if(e.kind==="unary"&&!EN(e.operand)){let i=jn(e.operand).filter(o=>TN(n,o)&&!t.has(o));i.length>0&&r(i[0],"!")}$N(e,i=>Ia(i,n,t,r))}s(Ia,"nullableReads");function Uk(e,n){Ea(n);let t=[];return Ia(e,n,new Set,(r,i)=>{t.some(o=>o.identifier===r)||t.push({identifier:r,op:i})}),t}s(Uk,"unguardedNullableReads");function rt(e,n,t){return{severity:"error",code:e,message:{de:`[${e}] ${n}`,en:`[${e}] ${t}`}}}s(rt,"error");function vd(e){let n=Array.isArray(e.nodes)?e.nodes:[],t=new Set;for(let r of n)for(let i of zp(r))i.key!==null&&ma[i.leaf].involves&&t.add(i.key);return t}s(vd,"declaredGroupKeys");var _a=hp;var q6="unit.key",K6="offer.key";function _N(e,n){return e===q6?n.unitKeys:e===K6?n.offerKeys:null}s(_N,"liveKeyUniverse");function mm(e){return[vn,...[...vd(e)].sort((n,t)=>n.localeCompare(t)).map(xp)]}s(mm,"requiredSlots");var yo=`${yp("applicant.channel")} == 'staff'`;var zk=["strict","leastLoaded"];var Gk=2;function CN(e){return e.some(n=>n.length===0)?{de:"nennt einen leeren Personenschl\xFCssel",en:"names an empty person key"}:new Set(e).size!==e.length?{de:"nennt eine Person zweimal",en:"names a person twice"}:e.length<Gk?{de:`braucht mindestens ${Gk} Personen`,en:`needs at least ${Gk} people`}:null}s(CN,"rotationPoolProblem");function j6(e,n){let t=n===null?-1:e.indexOf(n);return[...e.slice(t+1),...e.slice(0,t+1)]}s(j6,"strictOrder");function PN(e){let n=j6(e.pool,e.previous).filter(i=>e.eligible.has(i));if(n.length===0)return null;if(e.mode==="strict")return n[0];let t=e.openCounts;t===void 0&&M("[assignment/rotation] leastLoaded needs the open counts");let r=s(i=>{let o=t.get(i);return o===void 0&&M(`[assignment/rotation] no open count for '${i}'`),o},"load");return n.reduce((i,o)=>r(o)<r(i)?o:i)}s(PN,"pickFromPool");function DN(e){return e.map(n=>({slot:T_(n.slot),rules:[...n.rules]}))}s(DN,"rulesOfStored");function FN(e){return e.map(n=>({slot:V6(n.slot),rules:[...n.rules]}))}s(FN,"storedOfRules");function V6(e){let n=Ap(e);return n===null&&M(`[assignment/unknownSlot] '${e}' is no slot \u2014 'responsible' or 'team:<teamKey>'`),n}s(V6,"slotOf");function LN(e,n){let t=e?.assignmentRules;t===void 0&&M(`[assignment/noRules] ${n}: the workflow has no assignment rule`);let r=jN(t);return r.length>0&&M(`${r.join("; ")} (${n})`),DN(t)}s(LN,"rulesOfGraph");function B6(e){return e===vn?{slot:e,rules:[{when:yo,assign:{kind:"creator"}},{when:null,assign:{kind:"unassigned"}}]}:{slot:e,rules:[{when:null,assign:{kind:"queue"}}]}}s(B6,"defaultSlotRules");function MN(e,n){let t=new Set(e.map(o=>o.slot)),r=n.filter(o=>!t.has(o)).map(B6);return[...r.filter(o=>o.slot===vn),...e,...r.filter(o=>o.slot!==vn)]}s(MN,"withRequiredSlots");function Bn(e,n){return n===void 0?`slot '${e}'`:`slot '${e}' row #${n+1}`}s(Bn,"where");function Gt(e,n){return n===void 0?`Liste '${e}'`:`Liste '${e}', Zeile #${n+1}`}s(Gt,"whereDe");function Ct(e,n,t={},r="error"){return{severity:r,code:e,message:{de:`[${e}] ${n.de}`,en:`[${e}] ${n.en}`},...t}}s(Ct,"issue");function NN(e){if(e===vn)return!0;let n=Sp(e);return n!==null&&n.length>0}s(NN,"isKnownSlot");function U6(e,n){Ea(_a);let t=[],r=new Set;e.forEach((o,a)=>{let{slot:l}=o;NN(l)||t.push(Ct("assignment/unknownSlot",{de:`'${l}' ist keine Liste \u2014 'responsible' oder 'team:<teamKey>'`,en:`'${l}' is no slot \u2014 'responsible' or 'team:<teamKey>'`},{slot:l})),r.has(l)&&t.push(Ct("assignment/duplicateSlot",{de:`${Gt(l)} steht zweimal da`,en:`${Bn(l)} is listed twice`},{slot:l})),r.add(l),l===vn&&a!==0&&t.push(Ct("assignment/responsibleFirst",{de:`'${vn}' muss die erste Liste sein \u2014 Team-Zeilen \xFCbernehmen sie`,en:`'${vn}' must be the first slot \u2014 team rows copy it`},{slot:l})),t.push(...G6(o))});for(let o of n)r.has(o)||t.push(Ct("assignment/slotMissing",{de:`${Gt(o)} hat keine Regeln \u2014 der Workflow braucht sie`,en:`${Bn(o)} has no rule list \u2014 the workflow needs it`},{slot:o}));let i=new Set(n);for(let{slot:o}of e)o!==vn&&!i.has(o)&&NN(o)&&t.push(Ct("assignment/unusedSlot",{de:`${Gt(o)} wird hier nicht gebraucht \u2014 erlaubt, und nicht ausgewertet`,en:`${Bn(o)} is not needed here \u2014 allowed, and not evaluated`},{slot:o},"info"));return t}s(U6,"validateRules");function G6({slot:e,rules:n}){let t=[];return(n.length===0||n[n.length-1].when!==null)&&t.push(Ct("assignment/defaultRowMissing",{de:`${Gt(e)} muss mit einer Zeile ohne Bedingung enden (\u201Esonst\u201C)`,en:`${Bn(e)} must end with a row without condition ("otherwise")`},{slot:e})),n.forEach((r,i)=>{let o={slot:e,row:i},{when:a,assign:l}=r;if(a===null&&i<n.length-1&&t.push(Ct("assignment/ruleAfterDefault",{de:`${Gt(e,i)} hat keine Bedingung, aber es folgen Zeilen \u2014 sie treffen nie zu`,en:`${Bn(e,i)} has no condition, but rows follow it \u2014 they can never match`},o)),a!==null){let d=pm(a,_a,[yo]);for(let c of d)t.push({...c,message:{de:`${c.message.de} (${Gt(e,i)})`,en:`${c.message.en} (${Bn(e,i)})`},...o});if(d.every(c=>c.severity!=="error")){SN(a)||t.push(Ct("assignment/shadowedRule",{de:`${Gt(e,i)} liest nichts aus dem Vorgang \u2014 sie gilt immer oder nie`,en:`${Bn(e,i)} reads nothing of the application \u2014 it holds for every application or for none`},o));let c=n.slice(0,i).findIndex(u=>u.when!==null&&vN(u.when,a));c!==-1&&t.push(Ct("assignment/shadowedRule",{de:`${Gt(e,i)} wiederholt die Bedingung von Zeile #${c+1} \u2014 sie trifft nie zu`,en:`${Bn(e,i)} repeats the condition of row #${c+1} \u2014 it can never match`},o))}}if(e===vn&&l.kind==="slot"&&t.push(Ct("assignment/slotForwardRef",{de:`${Gt(e,i)} \xFCbernimmt '${l.slot}' \u2014 das darf nur eine Team-Liste nach '${vn}'`,en:`${Bn(e,i)} copies '${l.slot}' \u2014 only a team slot after '${vn}' may`},o)),e===vn&&l.kind==="queue"&&t.push(Ct("assignment/queueOnProcessSlot",{de:`${Gt(e,i)} weist die Queue zu \u2014 die Prozesszust\xE4ndigkeit ist immer eine Person`,en:`${Bn(e,i)} assigns the queue \u2014 the responsible slot is always a person`},o)),l.kind==="unassigned"&&t.push(Ct("assignment/targetMissing",{de:`${Gt(e,i)} nennt noch niemanden \u2014 Person w\xE4hlen`,en:`${Bn(e,i)} names no one yet \u2014 choose a person`},o)),l.kind==="rotation"){let d=CN(l.configKeys);d!==null&&t.push(Ct("assignment/rotationPool",{de:`${Gt(e,i)}: die Reihum-Liste ${d.de}`,en:`${Bn(e,i)} rotates over a pool that ${d.en}`},o))}l.kind==="creator"&&(a===null||!bN(a,yo))&&t.push(Ct("assignment/unguardedTarget",{de:`${Gt(e,i)} weist die anlegende Person zu \u2014 die gibt es nur, wenn die Bedingung der Zeile '${yo}' ist (oder enth\xE4lt)`,en:`${Bn(e,i)} assigns the creator, which exists only when the row's condition is (or has the conjunct) '${yo}'`},o))}),t}s(G6,"rowIssues");function qN(e,n){for(let r of n)e.some(i=>i.slot===r)||M(`[assignment/slotMissing] ${Bn(r)} has no rule list`);let t=new Set(n);return e.filter(r=>t.has(r.slot))}s(qN,"selectSlots");function z6(e,n){return xN(qN(e,n).flatMap(t=>t.rules.flatMap(r=>r.when===null?[]:[r.when])))}s(z6,"contextKeysOfRules");function KN(e,n,t,r){Ea(_a);let i=qN(e,t),o=z6(e,t),a=cm(_a.types,n,o);yN(_a,a,o);let l=[];for(let{slot:d,rules:c}of i){let u=c.findIndex((h,y)=>{if(h.when===null)return!0;for(let b of jn(Ai(h.when)))Object.hasOwn(a,b)||M(`[condition/unknownIdentifier] ${Bn(d,y)} reads '${b}', which the context does not carry`);return X_(h.when,{values:a})});u===-1&&M(`[assignment/defaultRowMissing] ${Bn(d)}: no row matched and there is no default row`);let p=c[u].assign;l.push({slot:d,ruleIndex:u,assign:p,value:W6(d,u,p,l,r)})}return l}s(KN,"evaluateRules");function W6(e,n,t,r,i){switch(t.kind){case"person":return{kind:"value",value:i.person(t.configKey)};case"creator":return{kind:"value",value:i.creator()};case"rotation":return{kind:"value",value:i.rotation(t,{slot:e,row:n})};case"unassigned":return M(`[assignment/targetMissing] ${Bn(e,n)} names no one`);case"queue":return e===vn&&M(`[assignment/queueOnProcessSlot] ${Bn(e,n)} assigns the queue`),{kind:"queue"};case"slot":{let o=e===vn?void 0:r.find(a=>a.slot===t.slot);return o===void 0&&M(`[assignment/slotForwardRef] ${Bn(e,n)} copies '${t.slot}', which is not decided before it`),o.value}}}s(W6,"resolveTarget");var Wk={person:["kind","configKey"],creator:["kind"],slot:["kind","slot"],queue:["kind"],rotation:["kind","configKeys","mode"],unassigned:["kind"]};function Y6(e){if(typeof e!="object"||e===null)return!1;let{kind:n,groupKey:t,...r}=e;return Object.keys(r).length>0?!1:n==="responsible"?t===void 0:n==="team"&&typeof t=="string"&&t.length>0}s(Y6,"isStoredSlot");function jN(e){let n=[],t=s((r,i)=>n.push(`[assignment/shape] ${r}: ${i}`),"bad");return Array.isArray(e)?(e.forEach((r,i)=>{let o=`slots[${i}]`;if(typeof r!="object"||r===null)return t(o,"must be { slot, rules }");let{slot:a,rules:l,...d}=r;if(Object.keys(d).length>0&&t(o,`unknown field(s) ${Object.keys(d).join(", ")}`),Y6(a)||t(o,"slot must be { kind: 'responsible' } or { kind: 'team', groupKey: '<team key>' }"),!Array.isArray(l))return t(o,"rules must be a list");l.forEach((c,u)=>{let p=`${o}.rules[${u}]`;if(typeof c!="object"||c===null)return t(p,"must be { when, assign }");let{when:h,assign:y,...b}=c;Object.keys(b).length>0&&t(p,`unknown field(s) ${Object.keys(b).join(", ")}`),h!==null&&typeof h!="string"&&t(p,"when must be a condition string or null (\u201Esonst\u201C)");let k=y?.kind;if(typeof y!="object"||y===null||typeof k!="string"||!Object.hasOwn(Wk,k))return t(p,`assign must be one of ${Object.keys(Wk).map(I=>`{kind:'${I}'}`).join(", ")}`);let v=Wk[k],$=Object.keys(y);($.some(I=>!v.includes(I))||v.some(I=>!$.includes(I)))&&t(p,`a '${k}' target has exactly the field(s) ${v.join(", ")}`);let R=y;if(k==="person"&&(typeof R.configKey!="string"||R.configKey.length===0)&&t(p,"a 'person' target needs a non-empty configKey"),k==="rotation"){let I=R.configKeys;(!Array.isArray(I)||I.some(D=>typeof D!="string"))&&t(p,"a 'rotation' target needs configKeys, a list of person keys"),zk.includes(R.mode)||t(p,`a 'rotation' target's mode is one of ${zk.map(D=>`'${D}'`).join(", ")}`)}k==="slot"&&R.slot!==vn&&t(p,`a 'slot' target copies '${vn}' and nothing else`)})}),n):(t("slots","must be a list of { slot, rules }"),n)}s(jN,"ruleShapeIssues");function VN(e){let n=e??{},t=[];if(n.teamOwnerBindings!==void 0&&t.push({de:"[assignment/legacyBindings] der Workflow tr\xE4gt noch teamOwnerBindings \u2014 die Zust\xE4ndigkeitsregel ersetzt sie; das Feld entfernen",en:"[assignment/legacyBindings] the workflow still carries teamOwnerBindings \u2014 the assignment rule replaces them; remove the field"}),n.assignmentRules===void 0)return t.push({de:"[assignment/noRules] der Workflow hat keine Zust\xE4ndigkeitsregel (graph.assignmentRules) \u2014 jeder Workflow muss sagen, wer zust\xE4ndig wird",en:"[assignment/noRules] the workflow has no assignment rule (graph.assignmentRules) \u2014 every workflow must say who becomes responsible"}),t;let r=jN(n.assignmentRules);if(r.length>0)return[...t,...r.map(o=>({de:o,en:o}))];let i=mm({nodes:Array.isArray(n.nodes)?n.nodes:[]});for(let o of U6(DN(n.assignmentRules),i))o.severity==="error"&&t.push(o.message);return t}s(VN,"workflowAssignmentIssues");function hm(e,n){let o=new Map;for(let d of e)o.set(d,0);let a=new Map,l=[];for(let d of e){if((o.get(d)??0)!==0)continue;let c=[{id:d,edges:n(d),idx:0}];for(o.set(d,1),a.set(d,null);c.length>0;){let u=c[c.length-1];if(u.idx>=u.edges.length){o.set(u.id,2),c.pop();continue}let{target:p,edge:h}=u.edges[u.idx];u.idx++;let y=o.get(p)??0;if(y===1){let b=[p],k=u.id;for(;k&&k!==p;)b.push(k),k=a.get(k)??null;b.reverse(),l.push({edge:h,source:u.id,target:p,cycle:b})}else y===0&&(o.set(p,1),a.set(p,u.id),c.push({id:p,edges:n(p),idx:0}))}}return l}s(hm,"detectBackEdges");var Yk="team:",H6=/^[a-z0-9][a-z0-9-]*$/;function J6(e){if(!e.startsWith(Yk))return null;let n=e.slice(Yk.length);return n.length>0?n:null}s(J6,"teamKeyOfMember");function gm(e){return`${Yk}${e}`}s(gm,"teamMember");function Ca(e){let n=e.channels;return n===void 0?[]:(Array.isArray(n)||M("graph.channels must be an array"),n)}s(Ca,"readAuthoredChannels");function BN(e){return[...vd(e)].sort()}s(BN,"derivedChannelTeamKeys");function UN(e,n){let t=e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"channel";if(!n.has(t))return t;for(let r=2;;r++){let i=`${t}-${r}`;if(!n.has(i))return i}}s(UN,"mintChannelKey");function GN(e,n){let t=e.channels;if(t===void 0)return[];if(!Array.isArray(t))return[{path:"channels",reason:{de:"[channels/shape] graph.channels muss eine Liste sein.",en:"[channels/shape] graph.channels must be a list."}}];let r=[],i=vd(e),o=new Set,a=new Map;return t.forEach((l,d)=>{let c=`channels[${d}]`,u=l;if(u===null||typeof u!="object"||typeof u.key!="string"||Mn(u.label)==="not-localized"||!Array.isArray(u.members)||!u.members.every($=>typeof $=="string")){r.push({path:c,reason:{de:"[channels/shape] Ein Kanal braucht key, label ({ de, en }) und members (Liste von Texten).",en:"[channels/shape] A channel needs key, label ({ de, en }) and members (a list of texts)."}});return}let p={de:`Kanal "${u.key}"`,en:`Channel "${u.key}"`};H6.test(u.key)||r.push({path:`${c}.key`,reason:{de:`[channels/invalidKey] ${p.de}: Schl\xFCssel nur aus Kleinbuchstaben, Ziffern und Bindestrich.`,en:`[channels/invalidKey] ${p.en}: key only from lowercase letters, digits and hyphens.`}}),o.has(u.key)&&r.push({path:`${c}.key`,reason:{de:`[channels/duplicateKey] ${p.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[channels/duplicateKey] ${p.en}: key is used twice.`}}),o.add(u.key);let h=Mn(u.label);if(h!=="not-localized"&&h.length===2?r.push({path:`${c}.label`,reason:{de:`[channels/emptyLabel] ${p.de}: Bezeichnung fehlt.`,en:`[channels/emptyLabel] ${p.en}: name is missing.`}}):h!=="not-localized"&&h.length>0&&r.push({path:`${c}.label`,reason:{de:`[i18n/missingTranslation] ${p.de}: Bezeichnung fehlt in: ${h.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${p.en}: name is missing in: ${h.join(", ")} \u2014 every displayed text needs German and English.`}}),u.members.length===0){r.push({path:`${c}.members`,reason:{de:`[channels/emptyMembers] ${p.de}: mindestens ein Team.`,en:`[channels/emptyMembers] ${p.en}: at least one team.`}});return}let y=[];for(let $ of u.members){let R=J6($);if(R===null){r.push({path:`${c}.members`,reason:{de:`[channels/invalidMember] ${p.de}: "${$}" ist kein "team:<schl\xFCssel>".`,en:`[channels/invalidMember] ${p.en}: "${$}" is not a "team:<key>".`}});continue}if(y.includes(R)){r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMember] ${p.de}: Team "${R}" ist doppelt genannt.`,en:`[channels/duplicateMember] ${p.en}: team "${R}" is named twice.`}});continue}n!==void 0&&!n.has(R)&&r.push({path:`${c}.members`,reason:{de:`[channels/unknownTeam] ${p.de}: Team "${R}" gibt es in diesem Mandanten nicht (oder es ist die Bewerbergruppe).`,en:`[channels/unknownTeam] ${p.en}: team "${R}" does not exist at this school (or it is the applicant group).`}}),y.push(R)}if(y.length===0)return;let b=[...y].sort().join("+"),[k]=y;y.length===1&&k!==void 0&&i.has(k)&&r.push({path:`${c}.members`,reason:{de:`[channels/duplicatesDerived] ${p.de}: Team "${k}" ist am Prozess beteiligt und hat seinen Kanal schon automatisch.`,en:`[channels/duplicatesDerived] ${p.en}: team "${k}" takes part in the process and already has its channel automatically.`}});let v=a.get(b);v!==void 0?r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMembership] ${p.de}: dieselben Teams wie Kanal "${v}" \u2014 zwei Tabs w\xE4ren derselbe Chat.`,en:`[channels/duplicateMembership] ${p.en}: the same teams as channel "${v}" \u2014 two tabs would be the same chat.`}}):a.set(b,u.key)}),r}s(GN,"channelIssues");var Hke=Object.freeze({});function zN(e,n){return Object.freeze(cm(no,e,n))}s(zN,"formContextEntries");function WN(e){return e.env??[]}s(WN,"declaredContextKeys");function Jk(e){return wd(e)}s(Jk,"isContextIdentifier");function Q6(e,n,t){let r=dm(no,e);if(r!==null)return{severity:"error",path:t,code:"env/unknownKey",message:r.message};let[,i=""]=e.split(".");return n.has(i)?null:{severity:"error",path:t,code:"env/undeclared",message:{de:`'${e}' liest den Umgebungsschl\xFCssel '${i}', den das Formular nicht in \`env\` deklariert.`,en:`'${e}' reads the environment key '${i}', which the form does not declare in \`env\`.`}}}s(Q6,"contextIdentifierIssue");var Hk=yp("stage.key");function Z6(e){let n=[],t=s(i=>i.kind==="ident"&&i.path===Hk,"isStageKey"),r=s(i=>{switch(i.kind){case"binary":if((i.op==="=="||i.op==="!=")&&(t(i.left)&&i.right.kind==="str"&&n.push(i.right.value),t(i.right)&&i.left.kind==="str"&&n.push(i.left.value)),i.op==="in"&&t(i.left)&&i.right.kind==="arr")for(let o of i.right.items)o.kind==="str"&&n.push(o.value);r(i.left),r(i.right);return;case"unary":r(i.operand);return;case"if":r(i.cond),r(i.then),r(i.else);return;case"call":i.args.forEach(r);return;case"arr":i.items.forEach(r);return;default:return}},"walk");return r(e),n}s(Z6,"stageKeyLiterals");function ym(e,n,t){return n===void 0?[]:Z6(e).filter(r=>!n.has(r)).map(r=>X6(r,n,t))}s(ym,"stageKeyAstIssues");function X6(e,n,t){let r=[...n].sort();return{severity:"error",path:t,code:"env/unknownStageKey",message:{de:`'${e}' ist kein Stufenschl\xFCssel des Programms dieses Angebots \u2014 `+(r.length>0?`bekannt: ${r.join(", ")}.`:"das Angebot hat kein Programm mit Stufen.")+` \`${Hk}\` ist der Bundle-Schl\xFCssel (\`program.stages[].key\`), nie das gespeicherte \`<program>-stufe-<key>\`.`,en:`'${e}' is not a stage key of the offer's program \u2014 `+(r.length>0?`known: ${r.join(", ")}.`:"the offer has no program with stages.")+` \`${Hk}\` is the bundle key (\`program.stages[].key\`), never the stored \`<program>-stufe-<key>\`.`}}}s(X6,"unknownStageKeyIssue");function YN(e,n,t){let r=[];for(let i of jn(e)){if(!Jk(i))continue;let o=Q6(i,n,t);o!==null&&r.push(o)}if(r.length>0)return r;for(let{identifier:i,op:o}of Uk(e,hp))r.push({severity:"error",path:t,code:"env/unguardedNullable",message:{de:`'${o}' \xFCber '${i}', das bei manchen Bewerbungen leer ist, braucht davor eine Absicherung '${i} != null &&' \u2014 lege fest, was ein leerer Wert bedeutet.`,en:`'${o}' over '${i}', which is empty for some applications, needs a guard '${i} != null &&' before it \u2014 say what an empty value means.`}});return r}s(YN,"contextAstIssues");function HN(e,n){let t=[...e4(e)];for(let r of e.env??[]){if(!to(r)){t.push({severity:"error",path:"env",code:"env/unknownKey",message:{de:`Der deklarierte Umgebungsschl\xFCssel '${r}' geh\xF6rt nicht zum Vokabular (${na.join(", ")}).`,en:`Declared environment key '${r}' is not in the vocabulary (${na.join(", ")}).`}});continue}n!==void 0&&!n.has(r)&&t.push({severity:"error",path:"env",code:"env/unsupplied",message:{de:`Das Formular deklariert den Umgebungsschl\xFCssel '${r}', aber sein Host liefert ihn nicht.`,en:`The form declares environment key '${r}', but its host does not supply it.`}})}return t}s(HN,"formContextIssues");function e4(e){let n=[];Object.hasOwn(e,"context")&&n.push({severity:"error",path:"context",code:"env/retiredField",message:{de:"`context` ist abgeschafft \u2014 ein Formular deklariert die gelesene Umgebung als `env`.",en:"`context` is retired \u2014 a form declares the environment it reads as `env`."}});let t=e.testScenarios;for(let r of Array.isArray(t)?t:[]){if(r===null||typeof r!="object")continue;let i=String(r.id);Object.hasOwn(r,"context")&&n.push({severity:"error",path:`scenario:${i}/context`,code:"env/retiredField",message:{de:"`context` ist abgeschafft \u2014 ein Szenario belegt keine Umgebung; die liefert der Testmodus.",en:"`context` is retired \u2014 a scenario samples no environment; test mode supplies it."}}),Object.hasOwn(r,"env")&&n.push({severity:"error",path:`scenario:${i}/env`,code:"env/retiredField",message:{de:`Szenario '${i}' belegt eine Umgebung (\`env\`) \u2014 das ist abgeschafft: ein Szenario passt auf jede Umgebung des Angebots, die liefert der Testmodus. \`plexus-cli offer upgrade\` entfernt es.`,en:`Scenario '${i}' samples an environment (\`env\`) \u2014 retired: a scenario fits every environment of the offer, test mode supplies it. \`plexus-cli offer upgrade\` removes it.`}})}return n}s(e4,"retiredContextFields");function wm(e,n,t){let r=pm(e,n).filter(o=>o.severity==="error").map(o=>o.message);if(r.length>0)return r;let i=[];if(t?.liveEnvKeys!==void 0)for(let o of Bk(e,n)){let a=_N(o.path,t.liveEnvKeys);a===null&&M(`[condition] no live-key universe for '${o.path}' \u2014 extend liveKeyUniverse`),a.has(o.value)||i.push({de:`$env.${o.path} == '${o.value}' nennt keinen Schl\xFCssel dieses Mandanten.`,en:`$env.${o.path} == '${o.value}' names no key of this school.`})}for(let o of ym(Kn(e),t?.stageKeys,""))i.push({de:`[${o.code}] ${o.message.de}`,en:`[${o.code}] ${o.message.en}`});return i}s(wm,"envConditionFindings");function km(e){return e.kind==="entered"&&!e.repeated&&e.reviewRequired}s(km,"isReviewField");function Pa(e){let n=[],t=[];function r(k,v){try{return Kn(k)}catch($){n.push({path:v,src:k,reason:$ instanceof Error?$.message:String($)});return}}s(r,"tryParse");function i(k,v){return{...k,visibleIf:k.visibleIf?r(k.visibleIf,`${v}.visibleIf`):void 0,requiredIf:k.requiredIf?r(k.requiredIf,`${v}.requiredIf`):void 0,disabledIf:k.disabledIf?r(k.disabledIf,`${v}.disabledIf`):void 0,defaultValue:k.defaultValue?r(k.defaultValue,`${v}.defaultValue`):void 0}}s(i,"compileField");function o(k,v){return{...k,visibleIf:k.visibleIf?r(k.visibleIf,`${v}.visibleIf`):void 0,fields:k.fields.map(($,R)=>i($,`${v}.fields[${R}]`))}}s(o,"compileGroup");function a(k,v){return{...k,itemTemplate:k.itemTemplate.map(($,R)=>i($,`${v}.itemTemplate[${R}]`)),effects:k.effects?.map(($,R)=>d($,`${v}.effects[${R}]`)),itemVisibleIf:k.itemVisibleIf?r(k.itemVisibleIf,`${v}.itemVisibleIf`):void 0}}s(a,"compileRepeated");function l(k,v){let $=[];return k.fields.forEach((R,I)=>{if(R.externalFlag){t.push({key:R.key,label:R.label,defaultValue:R.defaultValue?r(R.defaultValue,`${v}.fields[${I}].defaultValue`):void 0});return}$.push(i(R,`${v}.fields[${I}]`))}),{...k,visibleIf:k.visibleIf?r(k.visibleIf,`${v}.visibleIf`):void 0,fields:$,groups:k.groups?.map((R,I)=>o(R,`${v}.groups[${I}]`)),computed:k.computed?.map((R,I)=>{let D=r(R.expression,`${v}.computed[${I}].expression`);return{key:R.key,expression:D??{kind:"null"}}}),subsections:k.subsections?.map((R,I)=>l(R,`${v}.subsections[${I}]`)),repeated:k.repeated?.map((R,I)=>a(R,`${v}.repeated[${I}]`)),validators:k.validators}}s(l,"compileSection");function d(k,v){return{...k,when:k.when?r(k.when,`${v}.when`):void 0}}s(d,"compileEffect");function c(k,v){let $=r(k.when,`${v}.when`);return $?{...k,when:$}:null}s(c,"compileOutcome");let u=e.sections.map((k,v)=>l(k,`sections[${v}]`)),p=(e.effects??[]).map((k,v)=>d(k,`effects[${v}]`)),h=[],y=e.outcomes??[];for(let k=0;k<y.length;k++){let v=y[k],$=c(v,`outcomes[${k}]`);$&&h.push($)}return{compiled:{...e,sections:u,effects:p,outcomes:h,flags:t},errors:n}}s(Pa,"compileForm");var n4=new Set(["decision","review","governedDocument"]);function QN(e){return n4.has(e.type)&&!(e.type==="governedDocument"&&e.production==="none")}s(QN,"isReadinessGatedNode");function t4(e){let n=new Map,t=i4(e),r=s((i,o)=>{let a=Qk(o),l=[...i.fields,...(i.groups??[]).flatMap(d=>d.fields)];for(let d of l)d.externalFlag!==!0&&n.set(d.key,{kind:"entered",key:d.key,label:d.label,qualifier:r4(d.bucket,t,a),section:a,type:d.type,enumSource:JN(d),repeated:!1,reviewRequired:d.reviewRequired===!0});for(let d of i.repeated??[])for(let c of d.itemTemplate){let u=`${d.key}.${c.key}`;n.set(u,{kind:"entered",key:u,label:c.label,qualifier:Qk(d),section:a,type:c.type,enumSource:JN(c),repeated:!0,reviewRequired:!1})}for(let d of i.computed??[]){let c=jn(Kn(d.expression));n.set(d.key,{kind:"computed",key:d.key,label:d.label??{de:d.key,en:d.key},qualifier:a,deps:c})}for(let d of i.subsections??[])r(d,o)},"visit");for(let i of e.sections)r(i,i);return n}s(t4,"formFieldCatalog");function JN(e){return e.type==="enum"?e:null}s(JN,"enumSourceOf");function r4(e,n,t){return e===void 0?t:n.get(e)??t}s(r4,"fieldQualifier");function i4(e){let n=new Map,t=s((r,i)=>{i===void 0||n.has(r)||n.set(r,Qk(i))},"add");for(let r of XN(e))r.kind==="person"?t(r.bucket,r.display):r.kind==="organization"&&t(r.id.replace(/^o\./,""),r.display);return n}s(i4,"bucketWordings");function ZN(e){return e.flatMap(n=>[n,...ZN(n.subsections??[])])}s(ZN,"allSections");function XN(e){return[...e.effects,...ZN(e.sections).flatMap(n=>(n.repeated??[]).flatMap(t=>t.effects??[]))]}s(XN,"allEffects");function Qk(e){return{label:e.label}}s(Qk,"wordingOf");function eD(e){return id(e).flatMap(({slot:n,address:t})=>{let r=oC(t);return r===null||rd.includes(r.path)?[]:[{slotId:n,owner:r.owner,fieldKey:r.path}]})}s(eD,"admissionBindingLeaves");function o4(e,n){let t=e.get(n);if(t===void 0)return null;let r=[],i=new Set,o=s(a=>{if(!i.has(a.key)&&(i.add(a.key),r.push({fieldKey:a.key,kind:a.kind}),a.kind==="computed"))for(let l of a.deps){let d=e.get(l);d!==void 0&&o(d)}},"walk");return o(t),r}s(o4,"expandKey");function s4(e){let n=new Set;for(let t of XN(e))if(!(t.kind!=="person"||t.contractParty===void 0)&&t.when!==void 0)for(let r of jn(Kn(t.when)))n.add(r);return[...n]}s(s4,"contractPartyConditionKeys");function a4(e){return Pa(e).compiled.flags.map(n=>({key:n.key,name:n.label}))}s(a4,"formExternalFlags");function nD(e){return{readinessFormFieldsByFormNode:new Map([...e].map(([n,t])=>[n,t4(t)])),readinessPartyConditionKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set(s4(t))])),formFlagKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set(a4(t).map(r=>r.key))])),formViewKeysByFormNode:new Map([...e].map(([n,t])=>[n,new Set((t.views??[]).map(r=>r.key))]))}}s(nD,"readinessUniverse");function Zk(e,n){let t=new Set;for(let r of n)for(let i of o4(e,r)??[])i.kind==="entered"&&t.add(i.fieldKey);return t}s(Zk,"enteredFieldsBehind");var l4=new Set(["label","sublabel","title","description","body","chipLabel","nextAction","confirmLabel","placeholder","helpText","subject","heading","hint","notice","reason"]);function d4(e){return l4.has(e)?!0:tD(e)?!1:/(Label|Title|Body|Description|Text|Hint|Heading|Placeholder)$/.test(e)}s(d4,"isTextKey");function tD(e){return/^localized[A-Z]/.test(e)}s(tD,"isLegacyTwinKey");var c4=new Set(["titles","responseLabels","outputLabels","enumOptionLabels"]),u4=new Set(["inputs","resolver","library"]);function vm(e,n){let t=[];return Xk(e,n,t),t}s(vm,"findUnlocalizedTexts");function Xk(e,n,t){if(Array.isArray(e)){e.forEach((i,o)=>Xk(i,`${n}[${p4(i,o)}]`,t));return}if(e===null||typeof e!="object")return;let r=e;for(let[i,o]of Object.entries(r)){let a=`${n}.${i}`;if(!u4.has(i)){if(tD(i)){t.push({path:a,missing:"legacy-twin"});continue}if(d4(i)){f4(o,a,t);continue}if(c4.has(i)&&o!==null&&typeof o=="object"){for(let[l,d]of Object.entries(o))d!==void 0&&rD(d,`${a}.${l}`,t);continue}Xk(o,a,t)}}}s(Xk,"walk");function f4(e,n,t){e!=null&&rD(e,n,t)}s(f4,"checkText");function rD(e,n,t){let r=Mn(e);(r==="not-localized"||r.length>0)&&t.push({path:n,missing:r})}s(rD,"report");function p4(e,n){if(e!==null&&typeof e=="object"){let t=e;if(typeof t.id=="string")return t.id;if(typeof t.key=="string")return t.key}return String(n)}s(p4,"keyOf");function bm(e,n){return e==="not-localized"?n==="de"?"ist kein zweisprachiger Text ({ de, en })":"is not a bilingual text ({ de, en })":e==="legacy-twin"?n==="de"?'ist ein Zwilling der alten Form \u2014 der Text geh\xF6rt in das Feld ohne \u201Elocalized"':'is a twin of the old shape \u2014 the text belongs in the field without "localized"':n==="de"?`fehlt in: ${e.join(", ")}`:`is missing in: ${e.join(", ")}`}s(bm,"describe");function eb({path:e,missing:n}){return n==="legacy-twin"?{de:`[i18n/legacyTwin] ${e} ${bm(n,"de")}.`,en:`[i18n/legacyTwin] ${e} ${bm(n,"en")}.`}:{de:`[i18n/missingTranslation] ${e} ${bm(n,"de")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch; die Sprache folgt dem Konto des Lesenden.`,en:`[i18n/missingTranslation] ${e} ${bm(n,"en")} \u2014 every displayed text needs German and English; the language follows the reader's account.`}}s(eb,"unlocalizedTextReason");var m4={engagePush:["engage"]};function h4(e){let n=m4[e.type];return n===void 0?e:Object.fromEntries(Object.entries(e).filter(([t])=>!n.includes(t)))}s(h4,"withoutMachineData");function iD(e,n){return[...vm(e.nodes.map(h4),"nodes"),...n===void 0?[]:vm(n,`layout.${n.id}`)].map(r=>({layer:"GRAPH",kind:"i18n",path:r.path,reason:eb(r),severity:"error"}))}s(iD,"checkLocalizedTexts");var g4="optionalAction:";function oD(e){return`${g4}${e}:trigger`}s(oD,"optionalActionTriggerActionId");var y4="processDecide";function sD(e){let n=e.optionalActions;return n==null?[]:(Array.isArray(n)||M(`[optionalAction/corrupt-section] node's 'optionalActions' is ${typeof n}, not an array \u2014 corrupt pinned graph (publish stores the section as authored)`),n)}s(sD,"optionalActionBindings");function aD(e){return sD(e).map(n=>({id:oD(n.key),kind:"internal",label:n.label,surface:y4,placement:"overflow",superUserOnly:!0}))}s(aD,"optionalActionTriggers");function lD(e){let n=e.tasks;return Array.isArray(n)?n:[]}s(lD,"authoredTemplates");function dD(e){let n=e?.result;return n?.kind!=="appointment"?[]:n.participants?.feedback?.tasks??[]}s(dD,"personTasksOf");function nb(e){let n=lD(e);return sD(e).map(t=>{let r=new Set(t.tasks??[]),i=new Set;for(let o of r)for(let a of dD(n.find(l=>l.key===o)))i.add(a);return{binding:t,tasks:r,personTasks:i,keys:new Set([...r,...i])}})}s(nb,"optionalActionMembership");function w4(e){let n=new Set;for(let t of lD(e))for(let r of dD(t))n.add(r);return n}s(w4,"personRowTemplateKeys");function cD(e){let n=new Set(w4(e));for(let{keys:t}of nb(e))for(let r of t)n.add(r);return n}s(cD,"referencedTaskTemplateKeys");var Ir={shape:"[taskInput/shape]",notInRound:"[taskInput/notInRound]",notRecord:"[taskInput/notRecord]",prefillNotDeclared:"[taskInput/prefillNotDeclared]",prefillType:"[taskInput/prefillType]",feedbackTasks:"[appointment/feedbackTasks]",feedbackOptional:"[appointment/feedbackOptional]",recordAssignment:"[taskResult/recordAssignment]"},tb=60;function Na(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${n} ${t.de}`,en:`${n} ${t.en}`},severity:"error"}}s(Na,"error");function os(e){return Array.isArray(e.tasks)?e.tasks:[]}s(os,"tasksOf");function uD(e){return(Array.isArray(e.optionalActions)?e.optionalActions:[]).filter(t=>t.action==="spawnTasks")}s(uD,"spawnBindingsOf");function xd(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}s(xd,"stringList");function oi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(oi,"record");function ib(e){let n=oi(e?.result);return n?.kind==="appointment"?oi(n.participants):null}s(ib,"participantsOf");function rb(e){return xd(oi(ib(e)?.feedback)?.tasks)}s(rb,"feedbackTasksOf");function fD(e,n){return nb(e).find(t=>t.keys.has(n))}s(fD,"roundOf");function k4(e,n,t){let r=s(u=>({code:Ir.notInRound,reason:u}),"notInRound"),i=fD(e,n);if(i===void 0)return r({de:`Aufgabe "${n}" geh\xF6rt zu keiner optionalen Aktion \u2014 Vorgaben liest nur eine Aufgabe einer Runde.`,en:`Task "${n}" belongs to no optional action \u2014 only a task of a round reads inputs.`});if(t.scope!=="task"||t.path!==void 0)return r({de:`${ue(t)} ist kein Wert einer Aufgabe ($task.<aufgabe>.<schl\xFCssel>).`,en:`${ue(t)} is no value of a task ($task.<task>.<key>).`});let{binding:o}=i,a=t.owner;if(a===n)return r({de:`Aufgabe "${n}" liest ihren eigenen Wert.`,en:`Task "${n}" reads its own value.`});let l=os(e).find(u=>u.key===a),d=oi(l?.blocks),c=i.tasks.has(a)&&d?.templateKey===n&&(d.node===void 0||d.node===e.id);return a!==o.input&&!c?r({de:`"${a}" ist weder die Eingabe der Aktion "${o.key}" noch eine ihrer Aufgaben, die "${n}" per 'blocks' zur\xFCckh\xE4lt \u2014 der Wert st\xFCnde nicht fest, wenn die Aufgabe \xF6ffnet.`,en:`"${a}" is neither the input of the action "${o.key}" nor one of its tasks that holds "${n}" through 'blocks' \u2014 the value would not be settled when the task opens.`}):oi(l?.result)?.kind!=="record"?{code:Ir.notRecord,reason:{de:`"${a}" hat kein Ergebnis vom Typ 'record' \u2014 Vorgaben sind Felder einer Eingabe.`,en:`"${a}" has no result of kind 'record' \u2014 inputs are fields of an input task.`}}:null}s(k4,"taskInputRefusal");function b4(e,n){if(n.scope!=="task")return;let t=os(e).find(i=>i.key===n.owner),r=oi(t?.result);if(r?.kind==="record")return(Array.isArray(r.fields)?r.fields:[]).map(oi).find(i=>i?.writes===n.key)??void 0}s(b4,"writerField");function v4(e,n,t){let r=String(n.key);if(n.inputs===void 0)return[];if(!Array.isArray(n.inputs))return[Na(`${t}.inputs`,Ir.shape,{de:"'inputs' ist eine Liste von Adressen.",en:"'inputs' is a list of addresses."})];let i=[],o=new Set;for(let[a,l]of n.inputs.entries()){if(!ke(l))continue;let d=ue(l);if(o.has(d)){i.push(Na(`${t}.inputs.${a}`,Ir.shape,{de:`${d} steht zweimal in 'inputs'.`,en:`${d} is listed twice in 'inputs'.`}));continue}o.add(d);let c=k4(e,r,l);c!==null&&i.push(Na(`${t}.inputs.${a}`,c.code,c.reason))}return i}s(v4,"inputIssues");function x4(e,n,t,r){let i=t;if(VP(r))return rb(i).length===1?null:{code:Ir.prefillType,reason:{de:"Ein Team belegt nur vor, wenn 'feedback.tasks' genau eine Feedback-Art nennt \u2014 sonst w\xE4re offen, wer welche Art gibt.",en:"A team prefills only when 'feedback.tasks' names exactly one feedback kind \u2014 otherwise who gives which kind would be open."}};let o=Array.isArray(i.inputs)?i.inputs.filter(ke).map(ue):[];if(!ke(r)||!o.includes(ue(r)))return{code:Ir.prefillNotDeclared,reason:{de:"Die Vorbelegung der Teilnehmenden ist keine der Vorgaben ('inputs') der Aufgabe.",en:"The participants' prefill is none of the task's inputs ('inputs')."}};let a=s(c=>({code:Ir.prefillType,reason:c}),"prefillType"),l=rb(i),d=td(e,r);if(d===void 0)return null;if(ft(d)==="staffUser")return l.length===1?null:a({de:"Eine Personenliste belegt nur vor, wenn 'feedback.tasks' genau eine Feedback-Art nennt \u2014 sonst w\xE4re offen, wer welche Art gibt.",en:"A list of persons prefills only when 'feedback.tasks' names exactly one feedback kind \u2014 otherwise who gives which kind would be open."});if(d==="taskAssignment"){let u=xd(b4(n,r)?.tasks).filter(p=>!l.includes(p));return u.length===0?null:a({de:`Die Zuordnung ordnet ${u.map(p=>`"${p}"`).join(", ")} zu, die 'feedback.tasks' nicht nennt.`,en:`The assignment assigns ${u.map(p=>`"${p}"`).join(", ")}, which 'feedback.tasks' does not name.`})}return a({de:`Vorbelegt werden Teilnehmende nur aus Personen ('person') oder einer Zuordnung ('assignment'), nicht aus "${d}".`,en:`Participants are prefilled only from persons ('person') or an assignment ('assignment'), not from "${d}".`})}s(x4,"participantPrefillRefusal");function S4(e,n,t,r){let i=ib(t)?.prefill;if(i===void 0)return[];let o=x4(e,n,t,i);return o===null?[]:[Na(`${r}.result.participants.prefill`,o.code,o.reason)]}s(S4,"prefillIssues");function A4(e,n){return uD(e).some(t=>xd(t.tasks).includes(n))}s(A4,"belongsToOptionalAction");function T4(e,n,t){let r=n.key,i=os(e).find(c=>c.key===t),o=s(c=>({code:Ir.feedbackTasks,reason:c}),"feedbackTasks");if(i===void 0)return[o({de:`"${t}" ist keine Aufgabe dieses Knotens.`,en:`"${t}" is no task of this node.`})];let a=[];i.feedback!==!0&&a.push(o({de:`"${t}" ist keine Feedback-Aufgabe ('feedback: true').`,en:`"${t}" is no feedback task ('feedback: true').`})),uD(e).some(c=>xd(c.tasks).includes(t))&&a.push(o({de:`"${t}" steht in den Aufgaben einer optionalen Aktion \u2014 eine Personenzeile entsteht nur beim Buchen.`,en:`"${t}" is among an optional action's tasks \u2014 a person row exists only through a booking.`}));let l=os(e).find(c=>c.key!==r&&rb(c).includes(t));l!==void 0&&a.push(o({de:`"${t}" wird auch von "${String(l.key)}" angelegt \u2014 jede Feedback-Art geh\xF6rt zu genau einem Termin.`,en:`"${t}" is also created by "${String(l.key)}" \u2014 each feedback kind belongs to exactly one appointment.`}));let d=["when","blocks"].filter(c=>i[c]!==void 0);return d.length>0&&a.push(o({de:`"${t}" tr\xE4gt ${d.map(c=>`'${c}'`).join(", ")} \u2014 eine Personenzeile entsteht nur beim Buchen und h\xE4lt nur ihre Runde.`,en:`"${t}" carries ${d.map(c=>`'${c}'`).join(", ")} \u2014 a person row exists only through a booking and holds only its round.`})),i.optional!==void 0&&a.push({code:Ir.feedbackOptional,reason:{de:`"${t}" ist optional \u2014 eine Personenzeile h\xE4lt ihre Runde und damit die Pause, sie kann nicht \xFCbersprungen werden.`,en:`"${t}" is optional \u2014 a person row holds its round and with it the pause; it cannot be skipped.`}}),a}s(T4,"participantFeedbackRefusals");function R4(e,n,t){let r=ib(n);if(r===null||r.feedback===void 0)return[];let i=String(n.key),o=`${t}.result.participants.feedback`,a=oi(r.feedback),l=a?.tasks,d=[],c=s((p,h,y=Ir.feedbackTasks)=>d.push(Na(p,y,h)),"fail");if(!Array.isArray(l)||l.length===0||l.some(p=>typeof p!="string")||new Set(l).size!==l.length)return c(`${o}.tasks`,{de:"'feedback.tasks' nennt mindestens eine Feedback-Aufgabe, jede einmal.",en:"'feedback.tasks' names at least one feedback task, each once."}),d;let u=a?.dueDaysAfterEnd;(typeof u!="number"||!Number.isInteger(u)||u<0||u>tb)&&c(`${o}.dueDaysAfterEnd`,{de:`'feedback.dueDaysAfterEnd' ist eine ganze Zahl von 0 bis ${tb}.`,en:`'feedback.dueDaysAfterEnd' is a whole number from 0 to ${tb}.`}),A4(e,i)||c(o,{de:`Aufgabe "${i}" legt Personenzeilen an, geh\xF6rt aber zu keiner optionalen Aktion \u2014 Personenzeilen geh\xF6ren zur Runde einer Aktion.`,en:`Task "${i}" creates person rows but belongs to no optional action \u2014 person rows belong to an action's round.`});for(let p of l)for(let h of T4(e,n,p))c(`${o}.tasks`,h.reason,h.code);return d}s(R4,"feedbackIssues");function $4(e,n){let t=fD(e,n)?.personTasks??new Set;return os(e).filter(r=>r.feedback===!0&&typeof r.key=="string"&&t.has(r.key)).map(r=>r.key)}s($4,"assignableFeedbackTasks");function E4(e,n,t){let r=oi(n.result);if(r?.kind!=="record"||!Array.isArray(r.fields))return[];let i=$4(e,String(n.key)),o=new Map(os(e).map(l=>[l.key,l])),a=[];for(let[l,d]of r.fields.entries()){let c=oi(d);if(c?.type!=="assignment")continue;let u=xd(c.tasks).filter(p=>o.get(p)?.feedback===!0&&!i.includes(p));u.length!==0&&a.push(Na(`${t}.result.fields.${l}.tasks`,Ir.recordAssignment,{de:`Feld "${String(c.key)}": ${u.map(p=>`"${p}"`).join(", ")} legt kein Termin derselben optionalen Aktion an ('participants.feedback.tasks') \u2014 die Zuordnung h\xE4tte keine Zeile, die sie erh\xE4lt.`,en:`Field "${String(c.key)}": ${u.map(p=>`"${p}"`).join(", ")} is created by no appointment of the same optional action ('participants.feedback.tasks') \u2014 the assignment would have no row to receive it.`}))}return a}s(E4,"assignmentIssues");function pD(e,n){let t=[];for(let r of os(n)){if(typeof r.key!="string")continue;let i=`nodes.${n.id}.tasks.${r.key}`;t.push(...v4(n,r,i)),t.push(...S4(e,n,r,i)),t.push(...R4(n,r,i)),t.push(...E4(n,r,i))}return t}s(pD,"taskInputIssues");var Pt={notOptionalAction:"[workItems/familyRequestNotOptionalAction]",notTask:"[workItems/familyRequestNotTask]",closedOtherwise:"[workItems/familyRequestClosedOtherwise]",blocks:"[workItems/familyRequestBlocks]",noDeadline:"[workItems/familyRequestNoDeadline]",fields:"[workItems/familyRequestFields]",unknownField:"[workItems/familyRequestUnknownField]",shape:"[workItems/familyRequestShape]",twicePerAction:"[workItems/familyRequestTwicePerAction]",deadlock:"[workItems/familyRequestOnlyWayButAsked]"};function Nt(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${n} ${t.de}`,en:`${n} ${t.en}`},severity:"error"}}s(Nt,"issue");function I4(e,n,t){return e.flatMap(r=>(Array.isArray(r.tasks)?r.tasks:[]).filter(i=>{let o=i.blocks,a=typeof o?.node=="string"?o.node:r.id;return o?.templateKey===t&&a===n}).map(i=>({nodeId:r.id,key:String(i.key)})))}s(I4,"blockersOf");function mD(e){let{graph:n,node:t,task:r}=e,i=r.familyRequest;if(i===void 0)return[];let o=typeof r.key=="string"?r.key:"?",a=`nodes.${t.id}.tasks.${o}`,l={de:`Task "${o}" auf Knoten \u201E${Pe(n,t.id,"de")}\u201C (${t.id})`,en:`Task "${o}" on node "${Pe(n,t.id,"en")}" (${t.id})`},d=[];if(typeof i!="object"||i===null||Array.isArray(i))return[Nt(`${a}.familyRequest`,Pt.shape,{de:`${l.de}: 'familyRequest' muss ein Objekt { fields } oder { from } sein.`,en:`${l.en}: 'familyRequest' must be an object { fields } or { from }.`})];let c=Object.keys(i).filter(b=>b!=="fields"&&b!=="from");c.length>0&&d.push(Nt(`${a}.familyRequest.${c[0]}`,Pt.shape,{de:`${l.de}: 'familyRequest' kennt nur 'fields' oder 'from', nicht ${c.map(b=>`'${b}'`).join(", ")} \u2014 was angefordert wird und der Text an die Familie werden beim Ausl\xF6sen gew\xE4hlt.`,en:`${l.en}: 'familyRequest' only knows 'fields' or 'from', not ${c.map(b=>`'${b}'`).join(", ")} \u2014 what is requested and the text to the family are chosen when the action is triggered.`}));let{fields:u,from:p}=i;u===void 0==(p===void 0)&&d.push(Nt(`${a}.familyRequest`,Pt.shape,{de:`${l.de}: 'familyRequest' nennt genau eines \u2014 'fields' (die anforderbaren Felder) oder 'from' (das Formular, dessen Dateifelder alle zur Wahl stehen).`,en:`${l.en}: 'familyRequest' names exactly one \u2014 'fields' (the fields that can be requested) or 'from' (the form whose file fields are all available).`})),e.onTrigger.has(o)||d.push(Nt(`${a}.familyRequest`,Pt.notOptionalAction,{de:`${l.de} fordert bei der Familie an, geh\xF6rt aber zu keiner optionalen Aktion (spawnTasks) \u2014 nur deren Ausl\xF6sen \xF6ffnet die Anfrage an die Familie.`,en:`${l.en} requests from the family but belongs to no optional action (spawnTasks) \u2014 only triggering one opens the request to the family.`})),r.kind!=="task"&&d.push(Nt(`${a}.kind`,Pt.notTask,{de:`${l.de} fordert bei der Familie an und muss die Art 'task' haben, nicht ${JSON.stringify(r.kind)}.`,en:`${l.en} requests from the family and must have the kind 'task', not ${JSON.stringify(r.kind)}.`}));for(let b of["result","when","locksEvidence","gatesNode"])r[b]!==void 0&&d.push(Nt(`${a}.${b}`,Pt.closedOtherwise,{de:`${l.de} wartet auf die Familie und erledigt sich mit ihrer Antwort \u2014 '${b}' passt nicht dazu.`,en:`${l.en} waits for the family and completes with their answer \u2014 '${b}' does not fit that.`}));r.blocks!==void 0&&d.push(Nt(`${a}.blocks`,Pt.blocks,{de:`${l.de} wartet auf die Familie und darf nichts zur\xFCckhalten ('blocks') \u2014 sie h\xE4lt ihren Knoten schon als Aufgabe einer optionalen Aktion.`,en:`${l.en} waits for the family and must not hold anything back ('blocks') \u2014 as the task of an optional action it already holds its node.`}));for(let b of I4(n.nodes,t.id,o))d.push(Nt(`nodes.${b.nodeId}.tasks.${b.key}.blocks`,Pt.blocks,{de:`Task "${b.key}" auf Knoten "${b.nodeId}" h\xE4lt ${l.de} zur\xFCck \u2014 eine Nachforderung darf nie zur\xFCckgehalten werden: zur\xFCckgehalten h\xE4tte sie keine Frist und k\xF6nnte mit der Antwort der Familie nicht erledigt werden.`,en:`Task "${b.key}" on node "${b.nodeId}" holds back ${l.en} \u2014 a follow-up request must never be held back: held back, it would have no deadline and could not be completed by the family's answer.`}));let h=r.params?.dueInDays;if((typeof h!="number"||!Number.isInteger(h)||h<1)&&d.push(Nt(`${a}.params.dueInDays`,Pt.noDeadline,{de:`${l.de} fordert bei der Familie an und braucht eine Frist in ganzen Tagen ('params.dueInDays' \u2265 1) \u2014 sie ist die Frist der Familie und Anlass der Erinnerung.`,en:`${l.en} requests from the family and needs a deadline in whole days ('params.dueInDays' \u2265 1) \u2014 it is the family's deadline and the reason for the reminder.`})),u===void 0)return d;if(!Array.isArray(u)||u.length===0)return d.push(Nt(`${a}.familyRequest.fields`,Pt.fields,{de:`${l.de}: 'familyRequest.fields' muss mindestens ein Feld eines Formulars nennen \u2014 oder statt dessen 'from' das Formular, dann stehen alle seine Dateifelder zur Wahl.`,en:`${l.en}: 'familyRequest.fields' must name at least one field of a form \u2014 or 'from' the form instead, then all its file fields are available.`})),d;let y=new Set;for(let b of u){if(!ke(b))continue;let k=ue(b);if(y.has(k)){d.push(Nt(`${a}.familyRequest.fields`,Pt.fields,{de:`${l.de}: 'familyRequest.fields' nennt ${Ue(n,b,"de")} mehrfach.`,en:`${l.en}: 'familyRequest.fields' names ${Ue(n,b,"en")} more than once.`}));continue}y.add(k),mn(b)||d.push(Nt(`${a}.familyRequest.fields`,Pt.unknownField,{de:`${l.de}: 'familyRequest.fields' nennt ${Ue(n,b,"de")} \u2014 anfordern l\xE4sst sich nur ein Feld eines Formulars ($node.<formular>.admission.<feld>).`,en:`${l.en}: 'familyRequest.fields' names ${Ue(n,b,"en")} \u2014 only a field of a form ($node.<form>.admission.<field>) can be requested.`}))}return d}s(mD,"familyRequestIssues");function hD(e){let n=new Set((Array.isArray(e.tasks)?e.tasks:[]).flatMap(r=>r.familyRequest!==void 0&&typeof r.key=="string"?[r.key]:[]));return(Array.isArray(e.optionalActions)?e.optionalActions:[]).flatMap((r,i)=>{if(r.action!=="spawnTasks"||!Array.isArray(r.tasks))return[];let o=r.tasks.filter(a=>typeof a=="string"&&n.has(a));return o.length<=1?[]:[Nt(`nodes.${e.id}.optionalActions.${i}.tasks`,Pt.twicePerAction,{de:`Optionale Aktion \u201E${String(r.key)}\u201C auf Knoten "${e.id}" startet ${o.length} Nachforderungen (${o.join(", ")}) \u2014 ein Ausl\xF6sen fragt die Familie nach EINER Sache; h\xF6chstens eine Nachforderung je Aktion.`,en:`Optional action "${String(r.key)}" on node "${e.id}" starts ${o.length} follow-up requests (${o.join(", ")}) \u2014 one trigger asks the family for ONE thing; at most one follow-up request per action.`})]})}s(hD,"familyRequestActionIssues");function gD(e,n){let t=e.nodes,r=new Map;for(let a of t)if(!(a.type!=="completenessCheck"||!Array.isArray(a.requires)))for(let l of a.requires)mn(l)&&r.set(ue(l),l);if(r.size===0)return[];let i=s(a=>{let l=ri(n,a);return l===void 0||l!==null&&l.kind==="entered"&&l.type==="docRef"},"isFileField"),o=s(a=>{let{fields:l,from:d}=a??{};return Array.isArray(l)?l.filter(mn):!ke(d)||d.scope!=="node"?[]:[...r.values()].filter(c=>c.owner===d.owner&&i(c))},"offeredBy");return t.flatMap(a=>{let l=Array.isArray(a.requiresOneOf)?a.requiresOneOf:[],c=(Array.isArray(a.optionalActions)?a.optionalActions:[]).filter(h=>l.includes(h.key)),u=Array.isArray(a.tasks)?a.tasks:[];return c.filter(h=>Array.isArray(h.tasks)&&c.every(y=>y===h||y.when!==void 0)).flatMap(h=>u.flatMap(y=>{if(y.familyRequest===void 0||!h.tasks.includes(y.key))return[];let b=o(y.familyRequest).filter(k=>r.has(ue(k)));return b.length===0?[]:[{...Nt(`nodes.${a.id}.requiresOneOf`,Pt.deadlock,{de:`Auf Knoten \u201E${Pe(e,a.id,"de")}\u201C (${a.id}) ist die Nachforderung \u201E${String(h.key)}\u201C der einzige Weg durch 'requiresOneOf', und eine Vollst\xE4ndigkeitspr\xFCfung fragt dieselben Felder an (${b.map(k=>Ue(e,k,"de")).join(", ")}). Ist deren Anfrage offen, lassen sich diese Felder nicht nachfordern \u2014 die Entscheidung bliebe gesperrt. Eine zweite Aktion in 'requiresOneOf' oder andere Felder l\xF6sen das.`,en:`On node "${Pe(e,a.id,"en")}" (${a.id}) the follow-up request "${String(h.key)}" is the only way through 'requiresOneOf', and a completeness check asks for the same fields (${b.map(k=>Ue(e,k,"en")).join(", ")}). While its request is open, these fields cannot be requested \u2014 the decision would stay locked. A second action in 'requiresOneOf' or other fields solve this.`}),severity:"warning"}]}))})}s(gD,"familyRequestDeadlockWarnings");var ob={key:!0,kind:!0,title:!0,assign:!0,gatesNode:!0,blocks:!0,completableIf:!0,result:!0,when:!0,onConditionReturn:!0,reads:!0,locksEvidence:!0,feedback:!0,description:!0,documents:!0,view:!0,familyRequest:!0,optional:!0,inputs:!0,params:!0},sb={appointment:s((e,n)=>({de:`Aufgabe "${e}" an ${n.de}: \`appointment\` (Terminaufgabe) gibt es nicht mehr \u2014 ein Termin hat keine Leitung, die sie hielte. Was die Teilnehmenden nach dem Termin festhalten, ist je Person eine R\xFCckmeldung (\`result.participants.feedback\` der Terminvereinbarung).`,en:`Task "${e}" on ${n.en}: \`appointment\` (appointment task) no longer exists \u2014 an appointment has no lead to hold it. What the participants record after the appointment is one feedback per person (\`result.participants.feedback\` of the booking task).`}),"appointment")};function O4(e){let n=Qe(e);return new Map((typeof n.workItemTemplates=="function"?n.workItemTemplates(e):[]).map(t=>[t.key,t]))}s(O4,"intrinsicTemplatesOf");function yD(e,n,t){if(t!==void 0&&typeof t!="string")return null;let r=t??n,i=e.nodes.find(l=>l.id===r);if(i===void 0)return null;let o=i,a=Qe(i);return{node:o,composedKeys:new Set((Array.isArray(o.tasks)?o.tasks:[]).map(l=>l.key).filter(l=>typeof l=="string")),intrinsicByKey:O4(i),refuse:s(l=>typeof a.refuseBlocksTarget=="function"?a.refuseBlocksTarget(i,l):null,"refuse")}}s(yD,"resolveBlocksTargetNode");function _4(e){let n=new Map;for(let r of Ut(e.nodes)){let i=n.get(r.source)??[];i.push(r.target),n.set(r.source,i)}let t=new Map;return r=>{let i=t.get(r);if(i!==void 0)return i;let o=new Set,a=[...n.get(r)??[]];for(;a.length>0;){let l=a.shift();o.has(l)||(o.add(l),a.push(...n.get(l)??[]))}return t.set(r,o),o}}s(_4,"reachability");function wD(e){let n=[],t=new Map;for(let o of e.nodes){let a=o;for(let l of Array.isArray(a.tasks)?a.tasks:[]){let d=typeof l.key=="string"?l.key:void 0,c=l.blocks;if(d===void 0||typeof c?.templateKey!="string")continue;let u=typeof c.node=="string"?c.node:o.id;t.set(`${o.id}::${d}`,`${u}::${c.templateKey}`)}}let r=new Map,i=s((o,a)=>{if(r.get(o)==="done")return;if(r.get(o)==="visiting"){let d=[...a.slice(a.indexOf(o)),o],[c,u]=o.split("::");n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${c}.tasks.${u}.blocks`,reason:{de:`[workItems/blocksCycle] Zyklus im 'blocks'-Graphen: ${d.map(p=>`"${p.replace("::"," \xB7 ")}"`).join(" \u2192 ")} \u2014 jedes Mitglied w\xFCrde auf ein anderes warten, keines w\xFCrde je frei.`,en:`[workItems/blocksCycle] Cycle in the 'blocks' graph: ${d.map(p=>`"${p.replace("::"," \xB7 ")}"`).join(" \u2192 ")} \u2014 every member would wait for another, none would ever be released.`},severity:"error"});return}r.set(o,"visiting");let l=t.get(o);l!==void 0&&t.has(l)&&i(l,[...a,o]),r.set(o,"done")},"walk");for(let o of t.keys())i(o,[]);return n}s(wD,"checkBlocksCycles");function C4(e){let{requiresOneOf:n,optionalActions:t}=e;if(!Array.isArray(n)||!Array.isArray(t))return new Set;let r=new Set(n.filter(o=>typeof o=="string")),i=new Set;for(let o of t)if(!(typeof o.key!="string"||!r.has(o.key)||!Array.isArray(o.tasks)))for(let a of o.tasks)typeof a=="string"&&i.add(a);return i}s(C4,"tasksOfRequiresOneOf");function kD(e){if(typeof e!="object"||e===null)return!1;let{de:n,en:t}=e;return typeof n=="string"&&n.trim().length>0&&typeof t=="string"&&t.trim().length>0}s(kD,"isFilledBilingual");var P4=["blocks","gatesNode","locksEvidence","completableIf"];function N4(e,n){let t={de:`Task "${n.key}" (Knoten "${n.nodeId}")`,en:`Task "${n.key}" (node "${n.nodeId}")`},r=[];e.feedback!==!0&&r.push(Nn(`${n.base}.feedback`,{de:`[workItems/feedbackNotTrue] ${t.de}: 'feedback' kennt nur true; erhalten ${JSON.stringify(e.feedback)}.`,en:`[workItems/feedbackNotTrue] ${t.en}: 'feedback' only knows true; got ${JSON.stringify(e.feedback)}.`}));let i=e.result;if(e.kind!=="task"||typeof i?.kind!="string"||!Vw({kind:i.kind,writes:i.writes})){let a=e.kind==="task"&&i?.writes!==void 0,l={de:e.kind!=="task"?`kind ${String(e.kind)}`:`Ergebnis ${String(i?.kind)}${a?" mit writes":""}`,en:e.kind!=="task"?`kind ${String(e.kind)}`:`result ${String(i?.kind)}${a?" with writes":""}`};r.push(Nn(`${n.base}.feedback`,{de:`[workItems/feedbackNeedsProse] ${t.de} ist eine Feedback-Aufgabe und schlie\xDFt daher mit Freitext, einer Empfehlung oder einer Auswahl ohne 'writes' \u2014 ein Wert, den ein sp\xE4terer Schritt liest, k\xE4me von einem wom\xF6glich weitergeleiteten Link; erhalten ${l.de}.`,en:`[workItems/feedbackNeedsProse] ${t.en} is a feedback task, so it closes with free text, a recommendation or a choice without 'writes' \u2014 a value a later step reads would come from a link that may have been forwarded; got ${l.en}.`}))}let o=["blocks","gatesNode","completableIf","locksEvidence","familyRequest"].filter(a=>e[a]!==void 0);return o.length>0&&r.push(Nn(`${n.base}.feedback`,{de:`[workItems/feedbackSteersProcess] ${t.de} ist eine Feedback-Aufgabe; die Antwort kommt von einer Seite ohne weitere Daten und darf deshalb nicht von ${o.join(", ")} abh\xE4ngen.`,en:`[workItems/feedbackSteersProcess] ${t.en} is a feedback task; its answer comes from a page without application data, so it may not depend on ${o.join(", ")}.`})),r}s(N4,"feedbackTaskIssues");function D4(e,n){let t=[],r={de:`Task "${n.key}" (Knoten "${n.nodeId}")`,en:`Task "${n.key}" (node "${n.nodeId}")`},i=e.optional;(!(typeof i=="object"&&i!==null&&Object.keys(i).every(d=>d==="skipLabel"))||!kD(i.skipLabel))&&t.push(Nn(`${n.base}.optional.skipLabel`,{de:`[workItems/optionalSkipLabel] ${r.de} ist optional, braucht daf\xFCr '{ skipLabel: { de, en } }' \u2014 die Worte des Knopfs, mit dem die zust\xE4ndige Person ohne Ergebnis abschlie\xDFt (\u201EKeine Einsch\xE4tzung abgeben"); erhalten ${JSON.stringify(i)}.`,en:`[workItems/optionalSkipLabel] ${r.en} is optional and needs '{ skipLabel: { de, en } }' for that \u2014 the words of the button the responsible person uses to finish without a result ("Give no assessment"); got ${JSON.stringify(i)}.`})),e.kind!=="task"&&t.push(Nn(`${n.base}.optional`,{de:`[workItems/optionalOnApproval] ${r.de} ist eine Freigabe \u2014 optional ist nur eine Aufgabe; eine Freigabe schlie\xDFt mit ihrem Urteil.`,en:`[workItems/optionalOnApproval] ${r.en} is an approval \u2014 only a task can be optional; an approval ends with its verdict.`}));let a=e.result;(a===void 0||typeof a.kind!="string"||!Vw({kind:a.kind,writes:a.writes}))&&t.push(Nn(`${n.base}.optional`,{de:`[workItems/optionalNeedsProseResult] ${r.de} ist optional, schlie\xDFt aber ${a===void 0?"ohne Ergebnis":`mit einem ${String(a.kind)}-Ergebnis${a.writes!==void 0?" mit Wert":""}`} \u2014 optional ist nur eine Aufgabe mit Freitext, Empfehlung oder einer Auswahl ohne 'writes': einen Wert, den ein sp\xE4terer Schritt liest, g\xE4be es dann nie.`,en:`[workItems/optionalNeedsProseResult] ${r.en} is optional but ends ${a===void 0?"without a result":`with a ${String(a.kind)} result${a.writes!==void 0?" with a value":""}`} \u2014 only a task with free text, a recommendation or a choice without 'writes' can be optional: a value a later step reads would then never arrive.`}));let l=P4.filter(d=>e[d]!==void 0);return l.length>0&&t.push(Nn(`${n.base}.${l[0]}`,{de:`[workItems/optionalHolds] ${r.de} ist optional und tr\xE4gt ${l.map(d=>`'${d}'`).join(", ")} \u2014 auf eine optionale Aufgabe wartet nichts: sie h\xE4lt keinen Schritt zur\xFCck. Entweder optional oder zur\xFCckhaltend.`,en:`[workItems/optionalHolds] ${r.en} is optional and carries ${l.map(d=>`'${d}'`).join(", ")} \u2014 nothing waits for an optional task: it holds no step back. Either optional or holding back.`})),n.requiredByRule&&t.push(Nn(`${n.base}.optional`,{de:`[workItems/optionalInRequiresOneOf] ${r.de} ist optional, geh\xF6rt aber zu einer Aktion, die 'requiresOneOf' verlangt \u2014 \u201EKeine Einsch\xE4tzung abgeben" w\xFCrde die Regel erf\xFCllen, ohne dass etwas geschehen ist.`,en:`[workItems/optionalInRequiresOneOf] ${r.en} is optional but belongs to an action that 'requiresOneOf' requires \u2014 "Give no assessment" would satisfy the rule without anything having happened.`})),t}s(D4,"optionalTaskIssues");function Nn(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(Nn,"issue");function bD(e,n){let t=[],r=_4(e),i=new Set(Ca(e).map(o=>o.key));t.push(...gD(e,n));for(let o of e.nodes){let a=o,l=cD(a);t.push(...hD(a));let d=C4(a);t.push(...pD(e,a));let c=new Map((Array.isArray(a.tasks)?a.tasks:[]).filter(u=>typeof u.key=="string").map(u=>[u.key,{feedback:u.feedback===!0}]));for(let u of Array.isArray(a.tasks)?a.tasks:[]){let p=typeof u.key=="string"?u.key:"?",h=`nodes.${o.id}.tasks.${p}`,y=u.kind,b=u.result,k=u.blocks,v=typeof k?.node=="string"&&k.node!==o.id?k.node:void 0;if(typeof k?.templateKey=="string"){let N=typeof k.node=="string"?k.node:o.id,T=e.nodes.find(ae=>ae.id===N),G=(Array.isArray(T?.tasks)?T.tasks:[]).find(ae=>ae.key===k.templateKey)?.blocks;typeof G?.node=="string"&&G.node!==N&&t.push(Nn(`${h}.blocks.templateKey`,{de:`[workItems/blocksCrossNodeTask] Task "${p}" auf Knoten "${o.id}" h\xE4lt "${k.templateKey}" auf Knoten "${N}" zur\xFCck \u2014 das ist selbst eine knoten\xFCbergreifende Aufgabe, die ihren Knoten \xFCberlebt; zur\xFCckgehalten k\xF6nnte sie nach dessen Verlassen weder bearbeitet noch freigegeben werden. Nur Aufgaben, die an ihrem Knoten bleiben, und intrinsische Vorlagen sind Ziele.`,en:`[workItems/blocksCrossNodeTask] Task "${p}" on node "${o.id}" holds back "${k.templateKey}" on node "${N}" \u2014 that is itself a cross-node task that outlives its node; held back, it could be neither worked nor released after the node is left. Only tasks that stay on their node and intrinsic templates are targets.`}))}if(v!==void 0){let N=v;e.nodes.some(T=>T.id===N)&&!r(o.id).has(N)&&t.push(Nn(`${h}.blocks.node`,{de:`[workItems/blocksTargetNotAfter] Task "${p}" auf Knoten "${o.id}" blockiert Knoten "${N}", der von hier aus nicht erreichbar ist \u2014 die Aufgabe entst\xFCnde erst, wenn ihr Ziel schon hinter dem Prozess liegt. Ziel ist derselbe Knoten oder ein sp\xE4terer.`,en:`[workItems/blocksTargetNotAfter] Task "${p}" on node "${o.id}" blocks node "${N}", which cannot be reached from here \u2014 the task would only be created when its target is already behind the process. The target is the same node or a later one.`})),(b===void 0||!sa(b.kind))&&t.push(Nn(`${h}.blocks.node`,{de:`[workItems/crossNodeBlocksNeedsResult] Task "${p}" auf Knoten "${o.id}" blockiert einen anderen Knoten ("${N}"), hat aber kein 'result' \u2014 eine knoten\xFCbergreifende Aufgabe \xFCberlebt ihren Knoten und wird \xFCber ihr Ergebnis abgeschlossen (Freitext, Empfehlung oder Auswahl).`,en:`[workItems/crossNodeBlocksNeedsResult] Task "${p}" on node "${o.id}" blocks another node ("${N}") but has no 'result' \u2014 a cross-node task outlives its node and is completed through its result (free text, recommendation or choice).`})),l.has(p)&&t.push(Nn(`${h}.blocks.node`,{de:`[optionalAction/crossNodeBlocks] Task "${p}" geh\xF6rt zu einer optionalen Aktion (spawnTasks) auf Knoten "${o.id}" und darf keinen anderen Knoten blockieren \u2014 ihre Zeilen sind die Runde der Aktion.`,en:`[optionalAction/crossNodeBlocks] Task "${p}" belongs to an optional action (spawnTasks) on node "${o.id}" and must not block another node \u2014 its rows are the round of the action.`}))}for(let N of KP(String(y),b,{channelKeys:i,nodeTasks:c,...n?.billingItemKeys!==void 0?{billingItemKeys:n.billingItemKeys}:{},...n?.offerProgram!==void 0?{offerProgram:n.offerProgram}:{}}))t.push(Nn(`${h}.${N.field}`,{de:`${N.code} ${N.message.de} (Task "${p}" auf Knoten "${o.id}").`,en:`${N.code} ${N.message.en} (task "${p}" on node "${o.id}").`}));let $=u.when,R=s((N,T,q)=>{!ke(T)||mn(T)||t.push(Nn(N,{de:`[workItems/evidenceNotFormField] ${q} auf Task "${p}" (Knoten "${o.id}") nennt ${Ue(e,T,"de")} \u2014 Bedingung und Belege einer Aufgabe sind Felder eines Formulars ($node.<formular>.admission.<feld>).`,en:`[workItems/evidenceNotFormField] ${q} on task "${p}" (node "${o.id}") names ${Ue(e,T,"en")} \u2014 the condition and evidence of a task are fields of a form ($node.<form>.admission.<field>).`}))},"notFormField");$!==void 0?(R(`${h}.when`,$,"'when'"),u.onConditionReturn!=="respawn"&&u.onConditionReturn!=="stayClosed"&&t.push(Nn(`${h}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] Task "${p}" (Knoten "${o.id}") hat eine Bedingung, aber kein 'onConditionReturn' ('respawn' | 'stayClosed') \u2014 was bei der R\xFCckkehr der Bedingung geschieht, muss entschieden sein.`,en:`[workItems/whenNeedsOnConditionReturn] Task "${p}" (node "${o.id}") has a condition but no 'onConditionReturn' ('respawn' | 'stayClosed') \u2014 what happens when the condition returns must be decided.`}))):u.onConditionReturn!==void 0&&t.push(Nn(`${h}.onConditionReturn`,{de:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' ohne 'when' auf Task "${p}" (Knoten "${o.id}") \u2014 ohne Bedingung kehrt nichts zur\xFCck.`,en:`[workItems/whenNeedsOnConditionReturn] 'onConditionReturn' without 'when' on task "${p}" (node "${o.id}") \u2014 without a condition nothing returns.`}));let I=u.reads;if(I!==void 0)if(!Array.isArray(I))t.push(Nn(`${h}.reads`,{de:`[workItems/readsUnknownField] 'reads' auf Task "${p}" (Knoten "${o.id}") muss eine Liste von Feldadressen sein.`,en:`[workItems/readsUnknownField] 'reads' on task "${p}" (node "${o.id}") must be a list of field addresses.`}));else for(let[N,T]of I.entries())R(`${h}.reads.${N}`,T,"'reads'");let D=u.locksEvidence,F=s((N,T)=>t.push(Nn(`${h}.locksEvidence`,{de:`[workItems/${N}] Task "${p}" (Knoten "${o.id}") ${T.de}`,en:`[workItems/${N}] Task "${p}" (node "${o.id}") ${T.en}`})),"lockIssue");D!==void 0&&D!==!0&&F("locksEvidenceNotTrue",{de:`tr\xE4gt 'locksEvidence' ${JSON.stringify(D)} \u2014 nur 'true' ist erlaubt; ohne Sperre entf\xE4llt das Feld.`,en:`carries 'locksEvidence' ${JSON.stringify(D)} \u2014 only 'true' is allowed; without a lock the field is dropped.`}),D===!0&&(I===void 0&&$===void 0&&F("locksEvidenceWithoutEvidence",{de:"sperrt seine Belege, hat aber weder 'reads' noch 'when' \u2014 es gibt nichts, worauf die Entscheidung beruht.",en:"locks its evidence but has neither 'reads' nor 'when' \u2014 there is nothing the decision rests on."}),(b===void 0||!sa(b.kind))&&F("locksEvidenceNeedsRecordedResult",{de:"sperrt seine Belege, schlie\xDFt aber nicht mit einem erfassten Ergebnis (Freitext, Empfehlung, Auswahl) \u2014 nur eine Entscheidung, die das Team wieder\xF6ffnen kann, darf Belege sperren (ein Termin bleibt gebucht).",en:"locks its evidence but does not end with a recorded result (free text, recommendation, choice) \u2014 only a decision the team can reopen may lock evidence (an appointment stays booked)."}),l.has(p)&&F("locksEvidenceOnOptionalAction",{de:"geh\xF6rt zu einer optionalen Aktion (spawnTasks) \u2014 ihre Zeilen sind die Runde der Aktion, wieder\xF6ffnen l\xE4sst sie sich nicht; Belege sperrt nur eine Knotenaufgabe.",en:"belongs to an optional action (spawnTasks) \u2014 its rows are the round of the action and cannot be reopened; only a node task locks evidence."})),t.push(...mD({graph:e,node:a,task:u,onTrigger:l,specCtx:n}));let C=Object.keys(u).filter(N=>!Object.hasOwn(ob,N)&&!Object.hasOwn(sb,N));C.length>0&&t.push(Nn(`${h}.${C[0]}`,{de:`[workItems/unknownKey] Task "${p}" (Knoten "${o.id}") tr\xE4gt ${C.map(N=>`'${N}'`).join(", ")} \u2014 kein Feld einer Aufgabe. Erlaubt: ${Object.keys(ob).join(", ")}. (Checklisten gibt es nicht mehr: Text als 'description', mehrere Arbeitsschritte sind mehrere Aufgaben.)`,en:`[workItems/unknownKey] Task "${p}" (node "${o.id}") carries ${C.map(N=>`'${N}'`).join(", ")} \u2014 not a field of a task. Allowed: ${Object.keys(ob).join(", ")}. (Checklists no longer exist: text goes in 'description', several work steps are several tasks.)`}));let x=u.description;x!==void 0&&!kD(x)&&t.push(Nn(`${h}.description`,{de:`[workItems/descriptionInvalid] 'description' auf Task "${p}" (Knoten "${o.id}") braucht Text in beiden Sprachen ({ de, en }), erhalten ${JSON.stringify(x)}.`,en:`[workItems/descriptionInvalid] 'description' on task "${p}" (node "${o.id}") needs text in both languages ({ de, en }), got ${JSON.stringify(x)}.`})),u.feedback!==void 0&&t.push(...N4(u,{key:p,nodeId:o.id,base:h})),u.optional!==void 0&&t.push(...D4(u,{key:p,nodeId:o.id,base:h,requiredByRule:d.has(p)}))}}return t}s(bD,"checkNodeTasks");function vD(e){let n=e.indexOf(":"),t=n===-1?"":e.slice(0,n),r=n===-1?"":e.slice(n+1).trim();if(t==="artifact"&&r.length>0)return{kind:t,key:r};let i=wi(r);return t==="field"&&i!==null?{kind:t,address:i}:de("INVALID",{de:`Dokument-Verweis "${e}" ist ung\xFCltig \u2014 erwartet artifact:<Slot-Schl\xFCssel> (auch der Slot eines anderen Knotens) oder field:$node.<Formular>.admission.<Feld>.`,en:`Document reference "${e}" is invalid \u2014 expected artifact:<slot key> (another node's slot too) or field:$node.<form>.admission.<field>.`})}s(vD,"parseTaskDocumentRef");function ab(e){return e.kind==="artifact"?`artifact:${e.key}`:`field:${ue(e.address)}`}s(ab,"taskDocumentId");function Ei(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(Ei,"issue");function xD(e){return Array.isArray(e.tasks)?e.tasks:[]}s(xD,"tasksOf");function Sd(e){let n=new Map;for(let t of e){let{id:r,artifacts:i}=t;for(let o of Array.isArray(i)?i:[])typeof o?.key=="string"&&n.set(o.key,[...n.get(o.key)??[],{nodeId:r,slot:o}])}return n}s(Sd,"artifactSlotDeclarations");function F4(e){return e.flatMap(n=>{let{id:t,artifacts:r}=n;return(Array.isArray(r)?r:[]).filter(i=>!tm(i?.type)).map(i=>({nodeId:String(t),slotKey:String(i?.key),type:JSON.stringify(i?.type??null)}))})}s(F4,"unknownArtifactSlotTypes");function SD(e){let n=[];for(let{nodeId:t,slotKey:r,type:i}of F4(e.nodes))n.push(Ei(`nodes.${t}.artifacts.${r}.type`,{de:`[artifact/unknownType] Knoten "${t}" deklariert den Dokument-Slot \u201E${r}" mit der Art ${i} \u2014 erlaubt sind ${xa.join(", ")}.`,en:`[artifact/unknownType] Node "${t}" declares the document slot "${r}" with the type ${i} \u2014 allowed are ${xa.join(", ")}.`}));for(let[t,r]of Sd(e.nodes))for(let i of r.slice(1))n.push(Ei(`nodes.${i.nodeId}.artifacts`,{de:`[governedDocument/slotKeyTaken] Knoten "${i.nodeId}" deklariert den Dokument-Slot \u201E${t}", den schon "${r[0].nodeId}" deklariert \u2014 jeder Slot-Schl\xFCssel geh\xF6rt genau einem Knoten.`,en:`[governedDocument/slotKeyTaken] Node "${i.nodeId}" declares the document slot "${t}", which "${r[0].nodeId}" already declares \u2014 every slot key belongs to exactly one node.`}));return n}s(SD,"checkArtifactSlotKeys");function L4(e,n,t,r=Sd(e.nodes)){let i=r.get(n)?.[0]?.nodeId;return i===void 0?{reason:"unknown"}:ga(e,i,t)?null:{reason:"notBefore",owner:i}}s(L4,"slotLinkRefusal");function AD(e){if(!Array.isArray(e)||e.length===0)return null;let n=[];for(let t of e){let r=typeof t=="object"&&t!==null?t:{},i=Object.keys(r).sort().join(",");if(r.kind==="artifact"&&i==="key,kind"&&typeof r.key=="string"&&r.key.length>0)n.push({kind:"artifact",key:r.key});else if(r.kind==="field"&&i==="address,kind")n.push({kind:"field",address:r.address});else return null}return n}s(AD,"authoredRefs");function TD(e){let n=[],t=Sd(e.nodes);for(let r of e.nodes)for(let i of xD(r)){if(i.documents===void 0)continue;let o=typeof i.key=="string"?i.key:"?",a=`nodes.${r.id}.tasks.${o}.documents`,l={de:`Task "${o}" (Knoten "${r.id}")`,en:`Task "${o}" (node "${r.id}")`},d=AD(i.documents);if(d===null){n.push(Ei(a,{de:`[workItems/documentsInvalid] 'documents' auf ${l.de} muss eine nicht leere Liste von { kind: 'artifact', key } (Dokument-Slot eines Knotens) oder { kind: 'field', address } (Dateifeld eines Formulars) sein, erhalten ${JSON.stringify(i.documents)} \u2014 ein { kind: 'document', address } schreibt \`plexus-cli offer upgrade\` auf den Slot um.`,en:`[workItems/documentsInvalid] 'documents' on ${l.en} must be a non-empty list of { kind: 'artifact', key } (document slot of a node) or { kind: 'field', address } (file field of a form), got ${JSON.stringify(i.documents)} \u2014 \`plexus-cli offer upgrade\` rewrites a { kind: 'document', address } onto its slot.`}));continue}let c=new Set;for(let u of d){if(u.kind!=="artifact"&&!ke(u.address))continue;let p=u.kind==="artifact"?ab(u):ab({kind:"field",address:u.address});if(c.has(p)&&n.push(Ei(a,{de:`[workItems/documentsDuplicate] ${l.de} verweist zweimal auf ${p}.`,en:`[workItems/documentsDuplicate] ${l.en} refers to ${p} twice.`})),c.add(p),u.kind==="artifact"){let h=L4(e,u.key,r.id,t);h?.reason==="unknown"?n.push(Ei(a,{de:`[workItems/documentsUnknownArtifact] ${l.de} verweist auf das Dokument "${u.key}", aber kein Knoten deklariert einen solchen Slot.`,en:`[workItems/documentsUnknownArtifact] ${l.en} refers to the document "${u.key}", but no node declares such a slot.`})):h?.reason==="notBefore"&&n.push(Ei(a,{de:`[workItems/documentsNotBefore] ${l.de} verweist auf das Dokument "${u.key}" des Knotens "${h.owner}", der nicht auf jedem Weg vor "${r.id}" liegt \u2014 auf einem Weg an ihm vorbei g\xE4be es das Dokument nie.`,en:`[workItems/documentsNotBefore] ${l.en} refers to the document "${u.key}" of node "${h.owner}", which does not lie on every path before "${r.id}" \u2014 on a path around it the document would never exist.`}))}u.kind==="field"&&!mn(u.address)&&n.push(Ei(a,{de:`[workItems/documentsInvalid] ${l.de}: ein Feld-Dokument nennt ein Feld eines Formulars ($node.<formular>.admission.<feld>), nicht ${Ue(e,u.address,"de")}.`,en:`[workItems/documentsInvalid] ${l.en}: a field document names a field of a form ($node.<form>.admission.<field>), not ${Ue(e,u.address,"en")}.`}))}}return n}s(TD,"checkTaskDocuments");function RD(e,n){let t=[];for(let r of e.nodes)for(let i of xD(r)){let o=AD(i.documents);if(o===null)continue;let a=typeof i.key=="string"?i.key:"?",l=`nodes.${r.id}.tasks.${a}.documents`;for(let d of o){if(d.kind!=="field"||!mn(d.address))continue;let c=ri(n,d.address);if(c==null)continue;let u={de:Ue(e,d.address,"de"),en:Ue(e,d.address,"en")},p=wa("taskDocument",ya(c));if(p==="repeated"){t.push(Ei(l,{de:`[workItems/documentsUnknownField] Task "${a}" (Knoten "${r.id}") verweist auf das Feld ${u.de} \u2014 ein Feld in einer Wiederholgruppe ist kein einzelnes Dokument der Anmeldung.`,en:`[workItems/documentsUnknownField] Task "${a}" (node "${r.id}") refers to the field ${u.en} \u2014 a field in a repeated group is not a single document of the application.`}));continue}p==="notDocument"&&t.push(Ei(l,{de:`[workItems/documentsNotDocument] Task "${a}" (Knoten "${r.id}") verweist auf das Feld ${u.de}, das keine Datei enth\xE4lt \u2014 nur Datei-Felder (docRef) sind Dokumente.`,en:`[workItems/documentsNotDocument] Task "${a}" (node "${r.id}") refers to the field ${u.en}, which holds no file \u2014 only file fields (docRef) are documents.`}))}}return t}s(RD,"checkTaskDocumentFields");var db=["form","artifact","field"],Fa=["coverLetter","contract"],ED="form",$D=/^[A-Za-z0-9_.-]+$/;function M4(e){return Fa.includes(e)}s(M4,"isArtifactPart");function Da(e){return de("INVALID",{de:`Ansichts-Adresse "${e}" ist ung\xFCltig \u2014 erwartet form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Fa.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`View address "${e}" is invalid \u2014 expected form:<form node>#<view>, artifact:<slot>[#${Fa.join("|")}] or field:$node.<form>.admission.<field>.`})}s(Da,"invalid");function cb(e){let n=e.indexOf(":");if(n===-1)return Da(e);let t=e.slice(0,n),r=e.slice(n+1);if(t==="field"){let l=wi(r);return l===null?Da(e):{kind:t,address:l}}let i=r.indexOf("#"),o=i===-1?r:r.slice(0,i),a=i===-1?null:r.slice(i+1);return $D.test(o)?t==="form"?a!==null&&$D.test(a)?{kind:t,form:o,view:a}:Da(e):t==="artifact"?a===null?{kind:t,slot:o}:M4(a)?{kind:t,slot:o,part:a}:Da(e):Da(e):Da(e)}s(cb,"parseViewAddress");function ID(e){let n=K4(e);if(n===null)return null;let t=q4(n);return t!==null&&JSON.stringify(lb(t))===JSON.stringify(lb(e))?t:null}s(ID,"viewAddressOf");function q4(e){try{return cb(e)}catch{return null}}s(q4,"tryParseViewAddress");function K4(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e;if(n.kind==="form"&&typeof n.form=="string"&&typeof n.view=="string")return`form:${n.form}#${n.view}`;if(n.kind==="artifact"&&typeof n.slot=="string")return n.part===void 0?`artifact:${n.slot}`:typeof n.part=="string"?`artifact:${n.slot}#${n.part}`:null;if(n.kind==="field"&&n.address!==null&&typeof n.address=="object"){let t=n.address;return typeof t.scope!="string"||typeof t.key!="string"?null:`field:${ue(t)}`}return null}s(K4,"spellingOf");function lb(e){return e===null||typeof e!="object"||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).sort(([n],[t])=>n<t?-1:n>t?1:0).map(([n,t])=>[n,lb(t)]))}s(lb,"canonical");function OD(e){switch(e.kind){case"form":return`form:${e.form}#${e.view}`;case"artifact":return e.part===void 0?`artifact:${e.slot}`:`artifact:${e.slot}#${e.part}`;case"field":return`field:${ue(e.address)}`}}s(OD,"formatViewAddress");var ub=["form","documents"],j4=/^[a-z][a-zA-Z0-9_-]*$/;function V4(e){let n=new Map,t=s(r=>{for(let i of[...r.fields,...(r.groups??[]).flatMap(o=>o.fields)])n.set(i.key,i.type==="docRef"?"document":"other");for(let i of r.repeated??[]){n.set(i.key,"other");for(let o of i.itemTemplate)n.set(`${i.key}[].${o.key}`,o.type==="docRef"?"row":"other")}r.subsections?.forEach(t)},"visit");return e.sections.forEach(t),n}s(V4,"fieldPlaces");function _D(e,n,t){let r=[],i=new Set;return e.forEach((o,a)=>{if(typeof o!="string"||!j4.test(o)){r.push({severity:"error",path:`${t(a)}.key`,code:"view.invalid-key",message:{de:`${n.de}: '${String(o)}' ist kein g\xFCltiger Schl\xFCssel (Kleinbuchstabe am Anfang, dann Buchstaben, Ziffern, - oder _).`,en:`${n.en}: '${String(o)}' is no valid key (a lower-case letter first, then letters, digits, - or _).`}});return}i.has(o)&&r.push({severity:"error",path:`${t(a)}.key`,code:"view.duplicate-key",message:{de:`${n.de}: Der Schl\xFCssel '${o}' kommt doppelt vor.`,en:`${n.en}: the key '${o}' occurs twice.`}}),i.add(o)}),r}s(_D,"keyIssues");function B4(e,n,t){return e==="document"?null:e===void 0?{severity:"error",path:t,code:"view.unknown-field",message:{de:`Ansicht: Das Formular hat kein Feld '${n}'.`,en:`View: the form has no field '${n}'.`}}:e==="row"?{severity:"error",path:t,code:"view.field-in-row",message:{de:`Ansicht: Das Dateifeld '${n}' liegt in einem wiederholten Block und kann nicht einzeln genannt werden.`,en:`View: the file field '${n}' sits in a repeated block and cannot be named on its own.`}}:{severity:"error",path:t,code:"view.not-a-document",message:{de:`Ansicht: Das Feld '${n}' enth\xE4lt keine Datei.`,en:`View: the field '${n}' holds no file.`}}}s(B4,"fieldIssue");function U4(e,n,t){let r=[];ub.includes(e.key)&&r.push({severity:"error",path:`${n}.key`,code:"view.reserved-key",message:{de:`Der Ansichtsschl\xFCssel '${e.key}' ist f\xFCr die Standardansicht reserviert.`,en:`The view key '${e.key}' is reserved for the standard view.`}});let i=e.groups;i.length===0&&r.push({severity:"error",path:`${n}.groups`,code:"view.empty",message:{de:`Ansicht '${e.key}' hat keine Gruppen.`,en:`View '${e.key}' has no groups.`}}),r.push(..._D(i.map(a=>a.key),{de:`Gruppe der Ansicht '${e.key}'`,en:`Group of view '${e.key}'`},a=>`${n}.groups[${a}]`));let o=new Set;return i.forEach((a,l)=>{let d=`${n}.groups[${l}]`,c=a.fields;c.length===0&&r.push({severity:"error",path:`${d}.fields`,code:"view.empty",message:{de:`Gruppe '${a.key}' der Ansicht '${e.key}' hat keine Felder.`,en:`Group '${a.key}' of view '${e.key}' has no fields.`}}),c.forEach((u,p)=>{let h=`${d}.fields[${p}]`,y=B4(t.get(u),u,h);y!==null&&r.push(y),o.has(u)&&r.push({severity:"error",path:h,code:"view.field-twice",message:{de:`Ansicht '${e.key}': Das Feld '${u}' steht mehrfach; eine Datei hat einen Platz.`,en:`View '${e.key}': the field '${u}' is listed more than once; a file has one place.`}}),o.add(u)})}),r}s(U4,"viewIssues");function G4(e){if(!Array.isArray(e))return"views";for(let[n,t]of e.entries()){let r=t?.groups;if(!Array.isArray(r))return`views[${n}].groups`;for(let[i,o]of r.entries()){let a=o?.fields;if(!Array.isArray(a)||a.some(l=>typeof l!="string"))return`views[${n}].groups[${i}].fields`}}return null}s(G4,"malformedAt");function CD(e){let n=e.views;if(n===void 0)return[];let t=G4(n);if(t!==null)return[{severity:"error",path:t,code:"view.malformed",message:{de:`${t} hat nicht die Form einer Ansicht: views ist eine Liste von { key, label, groups }, groups eine Liste von { key, label, fields }, fields eine Liste von Feldschl\xFCsseln.`,en:`${t} is not shaped like a view: views is a list of { key, label, groups }, groups a list of { key, label, fields }, fields a list of field keys.`}}];let r=V4(e);return[..._D(n.map(i=>i.key),{de:"Ansicht",en:"View"},i=>`views[${i}]`),...n.flatMap((i,o)=>U4(i,`views[${o}]`,r))]}s(CD,"formViewIssues");function La(e,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:n,severity:"error"}}s(La,"issue");function PD(e,n,t,r,i){let o=ID(e);if(o===null)return[La(n,{de:`[view/invalid] 'view' auf ${t.de} ist keine Ansichts-Adresse \u2014 erwartet { kind: ${db.join(" | ")}, \u2026 }: form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Fa.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] 'view' on ${t.en} is no view address \u2014 expected { kind: ${db.join(" | ")}, \u2026 }: form:<form node>#<view>, artifact:<slot>[#${Fa.join("|")}] or field:$node.<form>.admission.<field>.`})];let a=OD(o);switch(o.kind){case"artifact":return r.has(o.slot)?[]:[La(n,{de:`[view/unknownSlot] ${t.de} nennt "${a}", aber kein Knoten dieses Graphen hat den Dokument-Slot "${o.slot}".`,en:`[view/unknownSlot] ${t.en} names "${a}", but no node of this graph has the document slot "${o.slot}".`})];case"form":case"field":{let l=o.kind==="form"?o.form:o.address.scope==="node"?o.address.owner:null;if(l===null)return[La(n,{de:`[view/invalid] ${t.de} nennt "${a}" \u2014 ein Dateifeld liegt in einem Formular: field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] ${t.en} names "${a}" \u2014 a file field lives in a form: field:$node.<form>.admission.<field>.`})];let d=i?.formViewKeysByFormNode;if(d===void 0)return[];let c=d.get(l);return c===void 0?[La(n,{de:`[view/unknownForm] ${t.de} nennt "${a}", aber kein Formularknoten hei\xDFt so.`,en:`[view/unknownForm] ${t.en} names "${a}", but no form node has that id.`})]:o.kind==="field"?[]:c.has(o.view)||ub.includes(o.view)?[]:[La(n,{de:`[view/unknownView] ${t.de} nennt "${a}", aber das Formular "${o.form}" hat keine Ansicht "${o.view}".`,en:`[view/unknownView] ${t.en} names "${a}", but the form "${o.form}" has no view "${o.view}".`})]}}}s(PD,"viewIssues");function ND(e,n){let t=[],r=new Set(Sd(e.nodes).keys());for(let i of e.nodes){if(i.view!==void 0){let o={de:`Knoten "${i.id}"`,en:`node "${i.id}"`};i.type!=="decision"?t.push(La(`nodes.${i.id}.view`,{de:`[view/invalid] ${o.de}: 'view' am Knoten gilt nur f\xFCr eine Entscheidung; eine Aufgabe tr\xE4gt ihre eigene.`,en:`[view/invalid] ${o.en}: 'view' on a node applies to a decision only; a task carries its own.`})):t.push(...PD(i.view,`nodes.${i.id}.view`,o,r,n))}for(let o of Array.isArray(i.tasks)?i.tasks:[]){if(o.view===void 0)continue;let a=String(o.key);t.push(...PD(o.view,`nodes.${i.id}.tasks.${a}.view`,{de:`Task "${a}" (Knoten "${i.id}")`,en:`Task "${a}" (node "${i.id}")`},r,n))}}return t}s(ND,"checkTaskViews");var zt="traeger",DD={de:"Tr\xE4ger",en:"Provider"};function Ma(e){let n=e.inputs?.[zt];return n?.kind==="literal"&&typeof n.value=="string"&&n.value.length>0?n.value:null}s(Ma,"traegerKeyOfNode");var xm={name:"input.traeger.name",address:"input.traeger.anschrift"},$ve=Object.values(xm);var FD="governedDocument",ss="prepareDocument",Ad="prepareDocument:revision",Or="releaseApproval",as="documentResponse",wo="coverLetterResponse",Sm="confirmCoverLetter",Am="requestCoverLetterRevision",qa="coverLetterConfirmation",si="responseCheck",Tm="returnSigned";var LD="requestApproval";var MD="issueDocument",qD="correctInPlace",KD="rescindAndReissue",Rm="requestChange";var Ka="releaseArtifact",mt="signingRecovery",$m="resendESignature",ls="switchToPaper";var Td=new Set([ss,Ad]),jD=["pending","producing","producingHeld","deferred","awaitingApproval","awaitingCoverLetter","awaitingResponse","responseReturned","responseInCheck","awaitingSignature","signatureStalled","done"],Em=["upload","resolver","template","none"],ds=1,cs=366,Ii="responseDueInDays";function us(e){let n=e.inputs?.[qa];return n?.kind==="literal"&&n.value===!0}s(us,"coverLetterConfirmationOf");function Rd(e){let n=e.inputs?.[Ii];return n?.kind==="literal"&&$d(n.value)?n.value:void 0}s(Rd,"responseDueInDaysForVocabulary");function $d(e){return typeof e=="number"&&Number.isInteger(e)&&e>=ds&&e<=cs}s($d,"isValidResponseDueInDays");var Im=["generatedAt","responseDueInDays","countersignature"],fs=["release","none"],Om=["confirm","signedUpload","signedUploadChecked","eSignature"];var z4={kind:"confirm",acceptOutcomeId:"accepted",declineOutcomeId:"declined",outcomeSemantics:{accept:"granted",decline:"rejected"},acceptEvent:"userTaskResolved",producesResponseArtifact:!1,declineIsAnswer:!0,acceptStatus:"accepted",checksReturn:!1,issuesBy:"paper",defaultLabels:{accept:{de:"Annehmen",en:"Accept"},decline:{de:"Ablehnen",en:"Decline"}}},VD={kind:"signedUpload",acceptOutcomeId:"signed",declineOutcomeId:"absage",outcomeSemantics:{accept:"other",decline:"rejected"},acceptEvent:"userTaskResolved",producesResponseArtifact:!0,declineIsAnswer:!1,acceptStatus:"signed",checksReturn:!1,issuesBy:"paper",defaultLabels:{accept:{de:"Unterschrieben zur\xFCcksenden",en:"Return signed"},decline:{de:"Ablehnen",en:"Decline"}}},BD={...VD,kind:"signedUploadChecked",acceptEvent:"contractEvent",checksReturn:!0},W4={...BD,kind:"eSignature",issuesBy:"provider"},Oi={confirm:z4,signedUpload:VD,signedUploadChecked:BD,eSignature:W4};function _i(e){let n=e.responseStrategy;if(typeof n=="string"&&n in Oi)return Oi[n];M(`governedDocument node "${e.id}" declares no valid responseStrategy (got ${JSON.stringify(n)}) \u2014 publish validation should have blocked this; corrupt pinned graph`)}s(_i,"responseStrategyOf");function _m(e){if(e.type!==FD||e.production!=="resolver")return!1;let n=e.responseStrategy;return typeof n=="string"&&n in Oi?Oi[n].acceptEvent==="contractEvent":!1}s(_m,"isFamilySignedContractNode");function Va(e){return e.label}s(Va,"governedDocTitle");function fb(e){return e.approval==="release"?LD:MD}s(fb,"submitActionId");function UD(e,n,t){return{key:n,recipient:"internal",title:t,unlocks:[fb(e)],gatesNode:!0,advancesNode:!0}}s(UD,"producerTemplate");function Y4(e){return e.titles?.respond??e.label}s(Y4,"responseTitle");var ja={de:"\u27E8Titel fehlt\u27E9",en:"\u27E8title missing\u27E9"};function Cm(e){let n=_i(e),t=[];if(e.production!=="none"&&t.push(UD(e,ss,e.titles?.prepare??ja),UD(e,Ad,e.titles?.revise??ja)),e.approval==="release"&&t.push({key:Or,recipient:"internal",title:e.titles?.approve??ja,unlocks:[],verdictResolved:!0,gatesNode:!0,advancesNode:!0}),t.push({key:as,recipient:"external",title:Y4(e),unlocks:n.producesResponseArtifact?[n.checksReturn?Tm:n.acceptOutcomeId,n.declineOutcomeId,Rm]:[n.acceptOutcomeId,n.declineOutcomeId],advancesNode:!0,...Rd(e)!==void 0?{dueInDays:Rd(e)}:{}}),us(e)){let r=Va(e);t.push({key:wo,recipient:"external",title:{de:`${r.de}: Angebot best\xE4tigen`,en:`${r.en}: confirm offer`},unlocks:[Sm,Am,n.declineOutcomeId],advancesNode:!0,...Rd(e)!==void 0?{dueInDays:Rd(e)}:{}})}if(n.checksReturn&&t.push({key:si,recipient:"internal",title:e.titles?.check??ja,unlocks:[],verdictResolved:!0,gatesNode:!1,advancesNode:!0}),n.issuesBy==="provider"){let r=Va(e);t.push({key:mt,recipient:"internal",title:{de:`${r.de}: elektronische Unterschrift kl\xE4ren`,en:`${r.en}: resolve the e-signature`},unlocks:[$m,ls],gatesNode:!1,advancesNode:!1})}return t}s(Cm,"governedDocIntrinsicTemplates");function H4(e){e.production==="none"&&M(`governedDocSlot: node "${e.id}" has production 'none' \u2014 it governs no artifact slot`);let n=e.artifacts??[];n.length!==1&&M(`governedDocSlot: node "${e.id}" declares ${n.length} artifact slots \u2014 exactly ONE is required (publish validation [governedDocument/slotContract])`);let t=n[0];return(typeof t.key!="string"||t.key.length===0)&&M(`governedDocSlot: node "${e.id}" declares an artifact slot without a key \u2014 corrupt pinned graph`),t}s(H4,"governedDocSlot");function Pm(e){return H4(e).key}s(Pm,"governedDocSlotKey");var dr="processFooter";var Ed="countersign",pb="countersign",GD="countersigned",mb="countersigning",zD="countersigned";var WD={de:"Vertrag gegenzeichnen",en:"Countersign the contract"},Id=["scan","eSignature"],Nm="service_provider:1",YD=["countersigning","awaitingSignature","signatureStalled","done"],HD={de:"Elektronische Gegenzeichnung kl\xE4ren",en:"Resolve the electronic countersignature"};function JD(e){return{de:`[countersign/traegerSignatoryMissing] Die Schule zeichnet elektronisch gegen, aber f\xFCr ${e} ist keine Unterschriftsperson hinterlegt, die unterschreiben kann (Rechtstr\xE4ger \u2192 signatoryUserKey, aktives Personal der Schule).`,en:`[countersign/traegerSignatoryMissing] The school countersigns electronically, but no signatory who can sign is on file for ${e} (legal entity \u2192 signatoryUserKey, active staff of the school).`}}s(JD,"traegerSignatoryMissingReason");function cr(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${n}`,reason:t,severity:"error"}}s(cr,"issue");function Dm(e,n){return e.nodes.filter(t=>{let r=t.contract;return t.type==="countersign"&&ke(r)&&r.scope==="node"&&r.owner===n})}s(Dm,"countersignersOf");function Od(e){return e.signing==="eSignature"}s(Od,"isElectronic");function J4(e,n){if(n===void 0||n.sendable||!Od(e))return[];let t=e.label?.de??e.id,r=e.label?.en||e.id;return[cr(e,"signing",{de:`[countersign/eSignatureNeedsProvider] \u201E${t}\u201C zeichnet elektronisch gegen, aber die Schule kann nicht senden: ${n.reason.de}`,en:`[countersign/eSignatureNeedsProvider] "${r}" countersigns electronically, but the school cannot send: ${n.reason.en}`})]}s(J4,"countersignProviderIssues");function Q4(e,n,t){if(t.scope!=="node")return[];let r=e.nodes.find(o=>o.id===t.owner);if(r===void 0)return[];let i=[];return _m(r)||i.push("sourceNotCheckedContract"),Dm(e,r.id).some(o=>o.id!==n)&&i.push("twice"),i}s(Q4,"countersignContractRefusals");function QD(e){let n=e.inputs?.dueInDays;return n?.kind==="literal"&&typeof n.value=="number"&&Number.isInteger(n.value)&&n.value>=1?n.value:void 0}s(QD,"validDueInDays");function Z4(e,n,t){let r=e.label?.de??e.id,i=e.label?.en||e.id,o=e.signing;if(o!==void 0&&!Id.includes(o))return[cr(e,"signing",{de:`[countersign/unknownSigning] \u201E${r}\u201C: signing ist scan oder eSignature (gefunden: ${JSON.stringify(o)}).`,en:`[countersign/unknownSigning] "${i}": signing is scan or eSignature (found: ${JSON.stringify(o)}).`})];let a=e.assign?.[mt];if(!Od(e))return a===void 0?[]:[cr(e,"assign",{de:`[countersign/recoveryAssign] \u201E${r}\u201C zeichnet auf Papier gegen \u2014 \`assign.signingRecovery\` h\xE4lt keine Aufgabe und geh\xF6rt entfernt.`,en:`[countersign/recoveryAssign] "${i}" countersigns on paper \u2014 \`assign.signingRecovery\` holds no task and must be removed.`})];let l=[];return a===void 0&&l.push(cr(e,"assign",{de:`[countersign/recoveryAssign] \u201E${r}\u201C zeichnet elektronisch gegen \u2014 wer eine gescheiterte Gegenzeichnung kl\xE4rt, fehlt: \`assign.signingRecovery\` nennt das Team.`,en:`[countersign/recoveryAssign] "${i}" countersigns electronically \u2014 who resolves a failed countersignature is missing: \`assign.signingRecovery\` names the team.`})),l.push(...X4(e,n,t),...e3(e,n,t),...J4(e,t?.signingProvider)),l}s(Z4,"signingIssues");function XD(e,n){let t=e.contract;if(!(!ke(t)||t.scope!=="node"))return n.nodes.find(r=>r.id===t.owner)}s(XD,"contractNodeOf");function X4(e,n,t){let r=XD(e,n),i=r===void 0?null:Ma(r),o=i===null?void 0:t?.traeger?.get(i);return o===void 0||o.hasSignatory?[]:[cr(e,"signing",JD(o.name))]}s(X4,"traegerSignatoryIssues");function e3(e,n,t){let r=XD(e,n);if(r===void 0)return[];let i=t?.resolverDocumentAnchors?.get(r.id);if(i===void 0)return[];let o=e.label?.de??e.id,a=e.label?.en||e.id,l=[];for(let d of i)d.documentAnchors===null?l.push(cr(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage des Generators \u201E${d.pin}\u201C wurde nie auf Unterschriftsanker gelesen \u2014 Vorlage neu hochladen und den Generator neu versiegeln.`,en:`[countersign/eSignatureAnchorMissing] "${a}" countersigns electronically, but the template of generator "${d.pin}" was never read for signature anchors \u2014 upload the template again and seal the generator again.`})):d.documentAnchors.has(Nm)||l.push(cr(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage von \u201E${d.pin}\u201C tr\xE4gt keinen Anker /unterschrift:${Nm}/ \u2014 der Anbieter f\xE4nde f\xFCr die Schule kein Unterschriftsfeld.`,en:`[countersign/eSignatureAnchorMissing] "${a}" countersigns electronically, but the template of "${d.pin}" carries no anchor /unterschrift:${Nm}/ \u2014 the provider would find no signature field for the school.`}));return l}s(e3,"traegerAnchorIssues");var hb=100;async function n3(e,n){let t=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",o=>o.eq("context.applicationId",n.applicationId).eq("context.anchor.nodeId",n.node.id)).take(hb+1);t.length>hb&&M(`countersign node "${n.node.id}" of ${n.applicationId} holds more than ${hb} rows`);let r=t.filter(o=>o.isOpen),i=s(o=>{if(o.context.kind!=="admission")return;let a=o.context.anchor;return"templateKey"in a?a.templateKey:void 0},"templateKeyOf");return r.some(o=>i(o)===mt)?"signatureStalled":r.some(o=>i(o)===Ed)?"countersigning":Od(n.node)?"awaitingSignature":"done"}s(n3,"countersignCurrentState");var ZD={[mb]:{label:ie("Gegenzeichnung","Countersignature"),tone:"teal",phase:{key:"gegenzeichnung",label:ie("Gegenzeichnung","Countersignature"),scope:"node"},external:rn(ie("Vertrag unterschrieben","Contract signed"),"blue",ie("Die Schule zeichnet Ihren Vertrag gegen","The school is countersigning your contract"),ie("Vielen Dank f\xFCr Ihre Unterschrift. Sobald die Schule gegengezeichnet hat, finden Sie Ihr Exemplar hier.","Thank you for signing. As soon as the school has countersigned, you will find your copy here."))}},eF={inputs:s(()=>[{id:"dueInDays",label:{de:"Frist der Aufgabe (Tage)",en:"Task due in (days)"},type:"number",inspector:"literal-only"}],"inputs"),role:"user-action",effect:"side-effect",outcomes:[{id:GD,label:{de:"Gegengezeichnet",en:"Countersigned"}}],progressDefaults:ZD,progressEvents:Hn(ZD),entryProgressEvent:s(()=>mb,"entryProgressEvent"),notificationEvents:s(()=>[{id:zD,label:{de:"Vertrag gegengezeichnet",en:"Contract countersigned"},audience:"external",required:!0,args:[{key:"applicationId",type:"string",required:!0},{key:"documentTitle",type:"localizedText",required:!0}]}],"notificationEvents"),actions:s(e=>[{id:pb,kind:"internal",label:WD,surface:dr,availableIn:["countersigning"]},...Od(e)?[{id:ls,kind:"internal",surface:dr,label:{de:"Auf Papier umstellen",en:"Switch to paper"},availableIn:["signatureStalled"]}]:[]],"actions"),workItemTemplates:s(e=>[{key:Ed,recipient:"internal",title:e.titles?.countersign??ja,unlocks:[pb],advancesNode:!0,...QD(e)!==void 0?{dueInDays:QD(e)}:{}},...Od(e)?[{key:mt,recipient:"internal",title:HD,unlocks:[ls],gatesNode:!1,advancesNode:!1}]:[]],"workItemTemplates"),placelessTasks:{[Ed]:"Worked in its own step: the contract it countersigns is another node's slot, which this node names by address only.",[mt]:"Worked in its own step (\u201EAuf Papier umstellen\u201C): it is about the Tr\xE4ger's Vorgang, which has no view of its own."},states:YD,currentState:n3,validate:s((e,n,t)=>{let r=[],i=e.label?.de??e.id,o=e.label?.en||e.id;e.assign?.[Ed]===void 0&&r.push(cr(e,"assign",{de:`[countersign/assign] \u201E${i}": wer gegenzeichnet, fehlt \u2014 \`assign.countersign\` nennt das Team.`,en:`[countersign/assign] "${o}": who countersigns is missing \u2014 \`assign.countersign\` names the team.`})),Zi(e.titles?.countersign)||r.push(cr(e,"titles",{de:`[countersign/missingTitle] \u201E${i}": der Titel der Aufgabe fehlt \u2014 \`titles.countersign\` auf Deutsch und Englisch.`,en:`[countersign/missingTitle] "${o}": the task title is missing \u2014 \`titles.countersign\` in German and English.`}));let l=e.inputs?.dueInDays;l!==void 0&&l.kind!=="unset"&&!(l.kind==="literal"&&typeof l.value=="number"&&Number.isInteger(l.value)&&l.value>=1)&&r.push(cr(e,"inputs.dueInDays",{de:`[countersign/dueInDays] \u201E${i}": dueInDays ist eine ganze Zahl \u2265 1.`,en:`[countersign/dueInDays] "${o}": dueInDays is a whole number \u2265 1.`})),r.push(...Z4(e,n,t));let d=e.contract;if(!ke(d))return r;let c=Q4(n,e.id,d);if(c.length===0)return r;let u=n.nodes.find(p=>d.scope==="node"&&p.id===d.owner);if(c.includes("sourceNotCheckedContract")&&r.push(cr(e,"contract",{de:`[countersign/sourceNotCheckedContract] \u201E${i}" zeichnet das Dokument von \u201E${u.label?.de??u.id}" (${u.id}) gegen \u2014 gegenzeichnen l\xE4sst sich nur ein erzeugter Vertrag, den die Familie mit verbuchten Unterschriften unterschreibt (governedDocument mit production: resolver und responseStrategy: signedUploadChecked oder eSignature).`,en:`[countersign/sourceNotCheckedContract] "${o}" countersigns the document of "${u.label?.en||u.id}" (${u.id}) \u2014 only a generated contract that the family signs with booked signatures can be countersigned (governedDocument with production: resolver and responseStrategy: signedUploadChecked or eSignature).`})),c.includes("twice")){let p=Dm(n,u.id).filter(h=>h.id!==e.id);r.push(cr(e,"contract",{de:`[countersign/twice] \u201E${i}": \u201E${u.label?.de??u.id}" (${u.id}) wird schon von ${p.map(h=>`"${h.id}"`).join(", ")} gegengezeichnet \u2014 ein Vertrag hat eine Gegenzeichnung.`,en:`[countersign/twice] "${o}": "${u.label?.en||u.id}" (${u.id}) is already countersigned by ${p.map(h=>`"${h.id}"`).join(", ")} \u2014 a contract has one countersignature.`}))}return r},"validate")};function t3(e){return _m(e)?Ma(e):null}s(t3,"traegerSignerOf");var r3=s(e=>e.type==="end"&&ts(e)==="approved","isApprovedEnd");function nF(e){let n=[];for(let t of e.nodes){let r=t3(t);if(r===null)continue;let i=Dm(e,t.id).map(u=>u.id),o=mP(e,t.id,new Set(i),r3);if(o===null)continue;let a=t.label?.de||t.id,l=t.label?.en||t.id,d={de:`Einen Knoten \u201EUnterschrift (intern)\u201C (countersign) mit contract: $node.${t.id}.contract auf jeden Weg zu einem Ende mit Ergebnis approved setzen.`,en:`Place an "Internal signature" node (countersign) with contract: $node.${t.id}.contract on every path to an end with outcome approved.`},c=i.length===0?{de:`[countersign/missingForContract] \u201E${a}\u201C (${t.id}) erzeugt einen Vertrag, den der Tr\xE4ger \u201E${r}\u201C mitunterschreibt, aber keine Gegenzeichnung nennt ihn \u2014 der Vertrag w\xFCrde nie unterschrieben und nie abgerechnet. ${d.de}`,en:`[countersign/missingForContract] "${l}" (${t.id}) generates a contract the legal entity "${r}" co-signs, but no countersignature names it \u2014 the contract would never be signed and never billed. ${d.en}`}:{de:`[countersign/missingForContract] \u201E${a}\u201C (${t.id}): ein Weg erreicht das Ende \u201E${o}\u201C (Ergebnis approved), ohne durch die Gegenzeichnung ${i.map(u=>`\u201E${u}\u201C`).join(", ")} zu laufen \u2014 dort bliebe der Vertrag ohne Unterschrift des Tr\xE4gers \u201E${r}\u201C und w\xFCrde nie abgerechnet. ${d.de}`,en:`[countersign/missingForContract] "${l}" (${t.id}): a path reaches the end "${o}" (outcome approved) without passing the countersignature ${i.map(u=>`"${u}"`).join(", ")} \u2014 there the contract would lack the signature of the legal entity "${r}" and never be billed. ${d.en}`};n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}`,reason:c,severity:"error"})}return n}s(nF,"checkCountersignCoverage");var i3=[{key:"blocks",why:{de:"sie h\xE4lt nichts zur\xFCck, sie ist mit dem Ausl\xF6sen erledigt",en:"it holds nothing back, it is done with the press"}},{key:"when",why:{de:"sie entsteht bei jedem Ausl\xF6sen",en:"it is created on every press"}},{key:"optional",why:{de:"wer ausl\xF6st, beantwortet sie immer",en:"whoever presses always answers it"}},{key:"familyRequest",why:{de:"sie fragt nicht die Familie",en:"it does not ask the family"}},{key:"feedback",why:{de:"sie beantwortet die ausl\xF6sende Person, nicht ein Link",en:"the presser answers it, not a link"}},{key:"completableIf",why:{de:"sie wird beim Ausl\xF6sen erledigt, eine Vorbedingung w\xFCrde jedes Ausl\xF6sen ablehnen",en:"it is completed at the press, a precondition would refuse every press"}},{key:"locksEvidence",why:{de:"eine offene Korrektur w\xFCrde jedes Ausl\xF6sen ablehnen",en:"an open correction would refuse every press"}}];function tF(e){let{nodeId:n,bindingKey:t,binding:r}=e,i=[],o=`nodes.${n}.optionalActions.${t}.input`,a=s((u,p=o)=>{i.push({layer:"GRAPH",kind:"nodeRule",path:p,severity:"error",reason:{de:`[optionalAction/input] Optionale Aktion "${t}" auf Knoten "${n}": ${u.de}`,en:`[optionalAction/input] Optional action "${t}" on node "${n}": ${u.en}`}})},"push");if(r.input===void 0)return r.submitLabel!==void 0&&a({de:"'submitLabel' beschriftet das Absenden des Eingabedialogs \u2014 ohne 'input' \xF6ffnet das Ausl\xF6sen keinen Dialog.",en:"'submitLabel' names the input dialog's submit button \u2014 without 'input' the press opens no dialog."},`nodes.${n}.optionalActions.${t}.submitLabel`),i;let l=r.input;if(typeof l!="string"||l.trim().length===0)return a({de:"'input' muss der Schl\xFCssel einer ihrer Aufgaben sein.",en:"'input' must be the key of one of its tasks."}),i;let d=Array.isArray(r.tasks)?r.tasks:[];if(!d.includes(l))return a({de:`Die Eingabe "${l}" ist keine ihrer Aufgaben ('tasks') \u2014 die Eingabe geh\xF6rt zur Runde der Aktion.`,en:`The input "${l}" is none of its tasks ('tasks') \u2014 the input belongs to the action's round.`}),i;let c=s(u=>{let p=e.templates.find(h=>h.key===u);return p!==void 0&&p.optional===void 0&&p.blocks===void 0},"holdsNode");d.some(u=>u!==l&&c(u))||a({de:`Neben der Eingabe "${l}" hat die Aktion keine Aufgabe, die den Schritt zur\xFCckh\xE4lt (weder 'optional' noch hinter 'blocks') \u2014 die Runde w\xE4re mit dem Ausl\xF6sen schon erledigt.`,en:`Besides the input "${l}" the action has no task that holds the step (neither 'optional' nor behind 'blocks') \u2014 the round would be done with the press.`});for(let u of o3({nodeId:n,binding:r,templates:e.templates,input:l}))a(u);return i}s(tF,"optionalActionInputIssues");function o3(e){let{nodeId:n,binding:t,templates:r,input:i}=e,o=r.find(u=>u.key===i);if(o===void 0)return[];let a=[];o.result?.kind!=="record"&&a.push({de:`Die Eingabe "${i}" braucht ein Ergebnis der Art 'record' \u2014 nur dessen Werte lesen die anderen Aufgaben der Runde.`,en:`The input "${i}" needs a result of kind 'record' \u2014 only its values are read by the round's other tasks.`});let l=o.assign?.group;typeof t.trigger!="string"?a.push({de:"Mit einer Eingabe braucht die Aktion ein 'trigger'-Team \u2014 die Eingabe ist eine Aufgabe dieses Teams.",en:"With an input the action needs a 'trigger' team \u2014 the input is a task of that team."}):l!==void 0&&l!==t.trigger&&a.push({de:`Die Eingabe "${i}" geh\xF6rt dem Team "${String(l)}", ausgel\xF6st wird die Aktion vom Team "${t.trigger}" \u2014 wer ausl\xF6st, beantwortet die Eingabe, also ist es dasselbe Team.`,en:`The input "${i}" belongs to the team "${String(l)}", the action is pressed by the team "${t.trigger}" \u2014 whoever presses answers the input, so it is the same team.`});let d=o.result,c=d?.fields;for(let u of Array.isArray(c)?c:[])u.evidence===!0&&a.push({de:`Das Feld "${String(u.key)}" der Eingabe "${i}" verlangt eine Datei ('evidence') \u2014 das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The field "${String(u.key)}" of the input "${i}" demands a file ('evidence') \u2014 the press carries values only.`}),u.suggest!==void 0&&a.push({de:`Das Feld "${String(u.key)}" der Eingabe "${i}" tr\xE4gt einen Vorschlag ('suggest') \u2014 eine Abweichung verlangt eine Begr\xFCndung, das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The field "${String(u.key)}" of the input "${i}" carries a suggestion ('suggest') \u2014 a departure demands a reason, the press carries values only.`});d?.textRequired===!0&&a.push({de:`Die Eingabe "${i}" verlangt einen Text ('textRequired') \u2014 das Ausl\xF6sen tr\xE4gt nur Werte.`,en:`The input "${i}" demands a text ('textRequired') \u2014 the press carries values only.`});for(let{key:u,why:p}of i3)o[u]!==void 0&&a.push({de:`Die Eingabe "${i}" tr\xE4gt '${u}' \u2014 ${p.de}.`,en:`The input "${i}" carries '${u}' \u2014 ${p.en}.`});for(let u of r){let p=u.blocks;p?.templateKey!==i||p.node!==void 0&&p.node!==n||a.push({de:`"${String(u.key)}" h\xE4lt die Eingabe "${i}" per 'blocks' zur\xFCck \u2014 sie ist beim Anlegen der Runde schon erledigt, es gibt nichts zur\xFCckzuhalten.`,en:`"${String(u.key)}" holds the input "${i}" back through 'blocks' \u2014 it is already done when the round is created, there is nothing to hold back.`})}return a}s(o3,"optionalActionInputRefusals");function s3(e){let n="error",t=new Map;for(let a of Ut(e.nodes)){let l=t.get(a.source)??[];l.push({id:a.id,target:a.target}),t.set(a.source,l)}let r=[],i=new Set,o=hm(e.nodes.map(a=>a.id),a=>(t.get(a)??[]).map(({id:l,target:d})=>({target:d,edge:l})));for(let a of o)i.has(a.edge)||(i.add(a.edge),r.push({layer:"GRAPH",kind:"cycle",path:`edge.${a.edge}`,reason:{de:`Zyklus \xFCber Kante ${a.source} \u2192 ${a.target}`,en:`Cycle through edge ${a.source} \u2192 ${a.target}`},severity:n}));return r}s(s3,"checkAcyclic");function a3(e){let n=[],t=new Set(e.nodes.map(i=>i.id)),r="error";for(let i of e.nodes){let o=i.next;if(o)for(let[a,l]of Object.entries(o))t.has(l.to)||n.push({layer:"GRAPH",kind:"routing",path:`node.${i.id}.next.${a}`,reason:{de:`${i.label.de}: next.${a} verweist auf nicht-existenten Knoten '${l.to}'`,en:`${i.label.en}: next.${a} points to a node that does not exist: '${l.to}'`},severity:"error"});if(i.type!=="end"&&!(!i.outcomes||i.outcomes.length===0))for(let a of i.outcomes)(!o||!(a.id in o))&&n.push({layer:"GRAPH",kind:"routing",path:`node.${i.id}.outcome.${a.id}`,reason:{de:`${i.label.de}: Outcome '${a.label.de}' fehlt im next-Mapping`,en:`${i.label.en}: outcome '${a.label.en}' is missing from the next mapping`},severity:r})}return n}s(a3,"checkNextTargets");function l3(e){let n=[];for(let t of e.nodes){let r=t.next;if(!r)continue;let i=Rk(t),o=new Set(i?i.map(a=>a.id):[Sa]);for(let a of Object.keys(r))o.has(a)||n.push({layer:"GRAPH",kind:"unknownOutcome",path:`node.${t.id}.next.${a}`,reason:{de:`${t.label.de}: next-Schl\xFCssel '${a}' ist kein g\xFCltiges Outcome dieses Knotens (erlaubt: ${[...o].join(", ")}) \u2014 die Kante w\xFCrde im Editor verschwinden`,en:`${t.label.en}: next key '${a}' is not a valid outcome of this node (allowed: ${[...o].join(", ")}) \u2014 the edge would disappear in the editor`},severity:"error"})}return n}s(l3,"checkNextOutcomesKnown");function d3(e){let n=[],t=new Set(Ut(e.nodes).map(o=>o.target)),r=e.nodes.filter(o=>!t.has(o.id));return r.length===0?n.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein Start-Knoten",en:"No start node"},severity:"error"}):r.length>1&&n.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:`Mehrere Start-Knoten (${r.map(o=>o.label.de).join(", ")})`,en:`Multiple start nodes (${r.map(o=>o.label.en).join(", ")})`},severity:"warning"}),e.nodes.filter(o=>o.type==="end").length===0&&n.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein End-Knoten",en:"No end node"},severity:"warning"}),n}s(d3,"checkStartEnd");function c3(e){let n=new Map;for(let r of Ut(e.nodes))n.set(r.source,(n.get(r.source)??0)+1);let t=[];for(let r of e.nodes)r.type!=="end"&&(n.get(r.id)??0)===0&&t.push({layer:"GRAPH",kind:"startEnd",path:`node.${r.id}`,reason:{de:`${r.label.de}: keine ausgehende Kante`,en:`${r.label.en}: no outgoing edge`},severity:"warning"});return t}s(c3,"checkNoOutgoingEdge");function u3(e){return e.nodes.filter(n=>!ww(n.id)).map(n=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.id`,reason:{de:`[graph/nodeIdFormat] Knoten "${n.id}": eine Knoten-ID ist ein Bezeichner ohne Punkt (${Rr.source}), z. B. "reviewEingereicht". Ein Bundle von vor der Umstellung neu exportieren.`,en:`[graph/nodeIdFormat] Node "${n.id}": a node id is an identifier without a dot (${Rr.source}), e.g. "reviewSubmitted". Export a bundle from before the change again.`},severity:"error"}))}s(u3,"checkNodeIdFormat");function f3(e){let n=new Set(e.nodes.map(r=>r.id)),t=[];for(let r of Ut(e.nodes))n.has(r.source)||t.push({layer:"GRAPH",kind:"startEnd",path:`edge.${r.id}`,reason:{de:`Kante ${r.id}: Quelle '${r.source}' nicht gefunden`,en:`Edge ${r.id}: source '${r.source}' not found`},severity:"error"}),n.has(r.target)||t.push({layer:"GRAPH",kind:"startEnd",path:`edge.${r.id}`,reason:{de:`Kante ${r.id}: Ziel '${r.target}' nicht gefunden`,en:`Edge ${r.id}: target '${r.target}' not found`},severity:"error"});return t}s(f3,"checkEdgeEndpoints");function p3(e){let n=[];for(let t of e.nodes)for(let r of t.tasks??[]){let i=r.result;i===null||typeof i!="object"||!(nm in i)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.tasks.${r.key}.result.${nm}`,reason:{de:`[graph/retiredField] Aufgabe "${r.key}": \`primaryHostTeams\` hei\xDFt jetzt \`primaryParticipantTeams\` \u2014 der alte Name wird nicht mehr gelesen, die Teilnehmer-Auswahl zeigt die Teams nicht oben. Bitte umbenennen.`,en:`[graph/retiredField] Task "${r.key}": \`primaryHostTeams\` is now called \`primaryParticipantTeams\` \u2014 the old name is no longer read, so the participant picker does not list the teams first. Please rename it.`},severity:"error"})}return n}s(p3,"checkRenamedFields");var m3=new Set(["countersignature"]);function h3(e){let n=[],t=s((o,a)=>{n.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:{de:`[graph/retiredField] ${a.de}`,en:`[graph/retiredField] ${a.en}`},severity:"error"})},"retired"),r={de:"Preise rechnet der Vertragsgenerator (`prices`), nicht der Workflow \u2014 binde Rang und Reduktion an seine Eing\xE4nge.",en:"Prices are computed by the contract generator (`prices`), not the workflow \u2014 bind rank and reduction to its inputs."},i=e;"pricingRules"in i&&t("pricingRules",r);for(let[o,a]of(Array.isArray(i.processStore)?i.processStore:[]).entries())for(let l of["derive","absentValue"])a!==null&&typeof a=="object"&&l in a&&t(`processStore.${o}.${l}`,r);for(let o of e.nodes)for(let a of o.tasks??[]){let l=a.result;l!==null&&typeof l=="object"&&"prices"in l&&t(`nodes.${o.id}.tasks.${a.key}.result.prices`,r)}for(let o of e.nodes){let a=o,l={de:`Knoten \u201E${Pe(e,o.id,"de")}\u201C (${o.id})`,en:`Node "${Pe(e,o.id,"en")}" (${o.id})`};for(let[c,u]of Object.entries(a.next??{}))u!==null&&typeof u=="object"&&"emits"in u&&t(`nodes.${o.id}.next.${c}.emits`,{de:`${l.de}: \`next.${c}.emits\` gibt es nicht mehr \u2014 ein Ausgang routet nur; ein Knoten liest Daten \xFCber Adressen in seinen eigenen Feldern.`,en:`${l.en}: \`next.${c}.emits\` no longer exists \u2014 an outcome only routes; a node reads data through addresses in its own fields.`});for(let c of Array.isArray(a.outcomes)?a.outcomes:[])c!==null&&typeof c=="object"&&"emits"in c&&t(`nodes.${o.id}.outcomes.${String(c.id)}.emits`,{de:`${l.de}: \`emits\` am Ausgang "${String(c.id)}" gibt es nicht mehr \u2014 ein Knoten liest Daten \xFCber Adressen in seinen eigenen Feldern.`,en:`${l.en}: \`emits\` on the outcome "${String(c.id)}" no longer exists \u2014 a node reads data through addresses in its own fields.`});"targetFormNodeId"in a&&t(`nodes.${o.id}.targetFormNodeId`,{de:`${l.de}: \`targetFormNodeId\` gibt es nicht mehr \u2014 welches Formular freigeschaltet wird, sagt die Adresse, an die der Eingang \`inputs.target\` gebunden ist ($node.<formular>.admission).`,en:`${l.en}: \`targetFormNodeId\` no longer exists \u2014 the address the input \`inputs.target\` is bound to says which form is unlocked ($node.<form>.admission).`}),"wires"in a&&t(`nodes.${o.id}.wires`,{de:`${l.de}: Datenkanten (\`wires\`) gibt es nicht mehr \u2014 jedes Feld, das Daten eines anderen Knotens liest, tr\xE4gt selbst die volle Adresse ($node.\u2026, $task.\u2026, $env.\u2026).`,en:`${l.en}: data edges (\`wires\`) no longer exist \u2014 every field that reads data of another node carries the full address itself ($node.\u2026, $task.\u2026, $env.\u2026).`});for(let[c,u]of Object.entries(a.inputs??{}))u!==null&&typeof u=="object"&&u.kind==="binding"&&"path"in u&&t(`nodes.${o.id}.inputs.${c}.path`,{de:`${l.de}: Der Eingang \u201E${c}\u201C ist \xFCber einen Pfad (\`path\`) gebunden \u2014 eine Bindung tr\xE4gt die volle Adresse (\`address\`) dessen, was sie liest.`,en:`${l.en}: The input "${c}" is bound through a path (\`path\`) \u2014 a binding carries the full address (\`address\`) of what it reads.`});o.type==="governedDocument"&&"resolver"in a&&t(`nodes.${o.id}.resolver`,{de:`${l.de}: \`resolver\` gibt es nicht mehr \u2014 der Generator ist der Eingang \`inputs.contractGenerator\` ({ kind, key }), seine Parameter stempelt die Plattform (\`generatorStamp\`), ein im Cockpit erg\xE4nzter Parameter ist sein Eingang \`{ kind: "cockpit" }\`.`,en:`${l.en}: \`resolver\` no longer exists \u2014 the generator is the input \`inputs.contractGenerator\` ({ kind, key }), the platform stamps its parameters (\`generatorStamp\`), a parameter completed in the cockpit is its input \`{ kind: "cockpit" }\`.`});let d=a.template;if(o.type==="governedDocument"&&d!==null&&typeof d=="object")for(let c of["key","cockpitFields"])c in d&&t(`nodes.${o.id}.template.${c}`,{de:`${l.de}: \`template.${c}\` gibt es nicht mehr \u2014 ${c==="key"?"die Vorlage ist der Eingang `inputs.documentTemplate`":'ein im Cockpit erg\xE4nzter Parameter ist sein Eingang `{ kind: "cockpit" }`'}.`,en:`${l.en}: \`template.${c}\` no longer exists \u2014 ${c==="key"?"the template is the input `inputs.documentTemplate`":'a parameter completed in the cockpit is its input `{ kind: "cockpit" }`'}.`});if(o.type==="setFlag")for(let c of["target","flagKey","value"])c in a&&t(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es am setFlag-Knoten nicht mehr \u2014 Formular, Merkmal und Wert sind die Eing\xE4nge \`inputs.target\` (gebunden an die Adresse $node.<formular>.admission), \`inputs.flagKey\` und \`inputs.value\` (feste Werte).`,en:`${l.en}: \`${c}\` no longer exists on a setFlag node \u2014 form, flag and value are the inputs \`inputs.target\` (bound to the address $node.<form>.admission), \`inputs.flagKey\` and \`inputs.value\` (literals).`});for(let c of Object.keys(nk[o.type]??{}))c in a&&t(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es als Knoteneigenschaft nicht mehr \u2014 es ist der Eingang \`inputs.${c}\` (ein fester Wert im Parameter-Bereich).`,en:`${l.en}: \`${c}\` no longer exists as a node property \u2014 it is the input \`inputs.${c}\` (a fixed value among the parameters).`});for(let c of Array.isArray(a.tasks)?a.tasks:[]){if(c===null||typeof c!="object")continue;let u=String(c.key),p=c.assign;p!==null&&typeof p=="object"&&"userId"in p&&t(`nodes.${o.id}.tasks.${u}.assign.userId`,{de:`Aufgabe "${u}" an ${l.de}: \`assign.userId\` gibt es nicht mehr \u2014 eine Aufgabe nennt ihr Team (\`assign.group\`), nie eine feste Person.`,en:`Task "${u}" on ${l.en}: \`assign.userId\` no longer exists \u2014 a task names its team (\`assign.group\`), never a fixed person.`});for(let[h,y]of Object.entries(sb))h in c&&t(`nodes.${o.id}.tasks.${u}.${h}`,y(u,l))}for(let c of tk[o.type]??[])c in a&&t(`nodes.${o.id}.${c}`,{de:`${l.de}: \`${c}\` gibt es nicht mehr \u2014 dieser Knotentyp liest es nicht.`,en:`${l.en}: \`${c}\` no longer exists \u2014 this node type does not read it.`});for(let[c,u]of Object.entries(_C[o.type]??{}))c in a&&t(`nodes.${o.id}.${c}`,{de:`${l.de}: ${u.de}`,en:`${l.en}: ${u.en}`});a.adoptForm===!0&&t(`nodes.${o.id}.adoptForm`,{de:`${l.de}: \`adoptForm: true\` gibt es nicht mehr \u2014 \`adoptForm\` ist die Adresse des \xFCbernommenen Formulars ($node.<anlegender Formularknoten>.admission).`,en:`${l.en}: \`adoptForm: true\` no longer exists \u2014 \`adoptForm\` is the address of the adopted form ($node.<creating form node>.admission).`});for(let c of Array.isArray(a.tasks)?a.tasks:[]){let u=c?.result?.kind;typeof u=="string"&&m3.has(u)&&t(`nodes.${o.id}.tasks.${String(c.key)}.result`,{de:`Aufgabe "${String(c.key)}" an ${l.de}: das Ergebnis \u201E${u}" gibt es nicht mehr \u2014 die Gegenzeichnung ist der Knotentyp \u201EUnterschrift (intern)" (countersign).`,en:`Task "${String(c.key)}" on ${l.en}: the result "${u}" no longer exists \u2014 the countersignature is the node type "Signature (internal)" (countersign).`})}}return n}s(h3,"checkRetiredDataFields");function ps(e,n){return n?.wiring&&n.layout?{wiring:n.wiring,layout:n.layout}:null}s(ps,"resolveLayoutContext");function g3(e,n){let t=ps(e,n);if(!t)return e.nodes.some(o=>(Qe(o)?.progressEvents?.length??0)>0)?[{layer:"GRAPH",kind:"progressState",path:"graph.progressWiring",reason:{de:`Graph emittiert Progress-Events, aber (Layout, Wiring) konnte nicht aufgel\xF6st werden (Wiring ${n?.wiring?"vorhanden":"fehlt"}, Layout ${n?.layout?"vorhanden":"fehlt"}) \u2014 der Engine wirft beim Spiegeln zur Laufzeit. Der Workflow-Entwurf muss progressLayout und progressWiring tragen.`,en:`The graph emits progress events, but (layout, wiring) could not be resolved (wiring ${n?.wiring?"present":"missing"}, layout ${n?.layout?"present":"missing"}) \u2014 the engine throws at runtime when mirroring. The workflow draft must carry progressLayout and progressWiring.`},severity:"error"}]:[];let r=[];for(let i of e.nodes){let a=Qe(i)?.progressEvents;if(a)for(let l of a){let d=es(t.wiring,{id:i.id,type:i.type},l);if(!d){r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Progress-Event '${l}' ist im Wiring (Layout '${t.layout.id}') keinem (Bus, State) zugeordnet \u2014 der Engine wirft beim Spiegeln`,en:`${i.type} '${i.id}': progress event '${l}' is not mapped to any (bus, state) in the wiring (layout '${t.layout.id}') \u2014 the engine throws when mirroring`},severity:"error"});continue}let c;try{c=Hp(t.layout,d.bus)}catch{r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Event '${l}' verweist auf unbekannten Bus '${d.bus}' im Layout '${t.layout.id}'`,en:`${i.type} '${i.id}': event '${l}' points to unknown bus '${d.bus}' in layout '${t.layout.id}'`},severity:"error"});continue}ud(c,d.state)||r.push({layer:"GRAPH",kind:"progressState",path:`node.${i.id}.progressEvents.${l}`,reason:{de:`${i.type} '${i.id}': Event '${l}' verweist auf State '${d.state}', der nicht im Bus '${d.bus}' deklariert ist`,en:`${i.type} '${i.id}': event '${l}' points to state '${d.state}', which is not declared in bus '${d.bus}'`},severity:"error"})}}return r}s(g3,"checkProgressEventMappings");function y3(e,n){let t=ps(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses){if(!i.boards||i.boards.length===0)continue;let o=new Set(i.unboarded??[]),a=new Set;for(let l of i.boards)for(let d of l.columns)for(let c of d.states)a.add(c),ud(i,c)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.board.${l.id}.column.${d.id}.${c}`,reason:{de:`Board '${l.id}', Spalte '${d.id}' referenziert State '${c}', der nicht im Bus '${i.key}' deklariert ist`,en:`Board '${l.id}', column '${d.id}' references state '${c}', which is not declared in bus '${i.key}'`},severity:"error"});for(let l of i.states)a.has(l.id)||o.has(l.id)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.${l.id}`,reason:{de:`State '${l.id}' (${l.label.de}) erscheint in keiner Board-Spalte und nicht in 'unboarded' \u2014 nicht darstellbar`,en:`State '${l.id}' (${l.label.en}) appears in no board column and not in 'unboarded' \u2014 it cannot be displayed`},severity:"error"})}return r}s(y3,"checkProgressBoardCoverage");function w3(e,n){let t=ps(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses)if(!(!i.boards||i.boards.length===0))for(let o of i.boards)for(let a of Ge){let l=new Map;for(let d of o.columns){if(!Zi(d.label))continue;let c=d.label[a],u=c.trim().toLocaleLowerCase(a),p=l.get(u);if(p===void 0){l.set(u,d.id);continue}r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.board.${o.id}.column.${d.id}.label.${a}`,reason:{de:`Board '${o.id}' hat zwei Spalten mit dem Label '${c}' (${a}) ('${p}' und '${d.id}') \u2014 f\xFCr Lesende nicht unterscheidbar. F\xFChre die Spalten zusammen (states beider in EINE Spalte) oder vergib unterschiedliche Labels.`,en:`Board '${o.id}' has two columns with the label '${c}' (${a}) ('${p}' and '${d.id}') \u2014 readers cannot tell them apart. Merge the columns (put the states of both into ONE column) or give them different labels.`},severity:"error"})}}return r}s(w3,"checkProgressBoardDistinctLabels");function k3(e,n){let t=ps(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses)for(let o of i.states){let a=Jp(i,o.id);o.terminal&&!a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.${o.id}.terminalSemantics`,reason:{de:`Terminal-State '${o.id}' hat keine Terminal-Semantik im Bus '${i.key}' \u2014 der Engine wirft beim Versiegeln`,en:`Terminal state '${o.id}' has no terminal semantics in bus '${i.key}' \u2014 the engine throws when sealing`},severity:"error"}),!o.terminal&&a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.${o.id}.terminalSemantics`,reason:{de:`State '${o.id}' ist nicht terminal, hat aber Terminal-Semantik im Bus '${i.key}' \u2014 Inkonsistenz`,en:`State '${o.id}' is not terminal but has terminal semantics in bus '${i.key}' \u2014 inconsistent`},severity:"error"})}return r}s(k3,"checkProgressTerminalSemantics");function b3(e,n){let t=ps(e,n);if(!t)return[];let r=[];for(let i of t.layout.buses){let o=new Set(i.holdsSeat??[]);for(let a of i.holdsSeat??[])ud(i,a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.holdsSeat.${a}`,reason:{de:`holdsSeat referenziert '${a}', das kein State im Bus '${i.key}' ist`,en:`holdsSeat references '${a}', which is not a state in bus '${i.key}'`},severity:"error"});for(let a of i.commitsSeat??[])ud(i,a)?o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.commitsSeat.${a}`,reason:{de:`commitsSeat '${a}' ist nicht in holdsSeat \u2014 ein fest belegter Platz muss auch belegt sein`,en:`commitsSeat '${a}' is not in holdsSeat \u2014 a firmly committed seat must also be held`},severity:"error"}):r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.commitsSeat.${a}`,reason:{de:`commitsSeat referenziert '${a}', das kein State im Bus '${i.key}' ist`,en:`commitsSeat references '${a}', which is not a state in bus '${i.key}'`},severity:"error"});for(let[a,l]of Object.entries(i.terminalSemantics??{}))l.outcome==="approved"&&(o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${t.layout.id}.bus.${i.key}.holdsSeat`,reason:{de:`Endzustand '${a}' schlie\xDFt den Prozess positiv ab (outcome 'approved'), steht aber nicht in holdsSeat \u2014 damit z\xE4hlt er als Absage und f\xE4llt aus dem Fortschrittsbalken. Nimm '${a}' in holdsSeat (und in commitsSeat, wenn der Platz damit wirklich belegt ist) auf.`,en:`Final state '${a}' ends the process positively (outcome 'approved'), but is not in holdsSeat \u2014 so it counts as a rejection and drops out of the progress bar. Add '${a}' to holdsSeat (and to commitsSeat, if the seat is really taken by it).`},severity:"error"}))}return r}s(b3,"checkProgressSeatStates");var Fm={de:"Abhilfe: nach dem Formularknoten einen review-Knoten einf\xFCgen und dessen 'reviewing' auf diesen Zustand mappen",en:"Remedy: insert a review node after the form node and map its 'reviewing' to this state"};function v3(e,n,t){let r=new Map(e.nodes.map(y=>[y.id,y])),i=new Set(Ut(e.nodes).map(y=>y.target)),o=e.nodes.filter(y=>!i.has(y.id)),a=o.some(y=>y.type==="eventTrigger"),l=s(y=>Object.values(y.next??{}).map(b=>b.to),"routesOf"),d=[],c=s((y,b,k)=>{let v=r.get(y);if(!v||k.has(y)){d.push({at:y,state:null});return}let $=new Set([...k,y]);if(a&&o.includes(v)&&v.type!=="eventTrigger")return;if(v.type==="eventTrigger"&&o.includes(v)){let F=v.next?.[Vt]?.to;F===void 0?d.push({at:y,state:null}):c(F,b,$);return}let R=Qe(v);if(gb[v.type]===!1){if(Qe(v).progressEvents?.length){d.push({at:y,state:null});return}let F=l(v);F.length===0&&d.push({at:y,state:null});for(let C of F)c(C,b,$);return}let I=R.entryProgressEvent?.(v),D=b;if(I!==void 0){let F=es(n,v,I);F?.bus==="process"&&(D=F.state)}if(R.advancesAtEntry?.(v)===!0)for(let F of l(v))c(F,b,$);d.push({at:y,state:D})},"walk");for(let y of o)c(y.id,null,new Set);let u=d.map(y=>`'${y.at}'${y.state===null?"":` \u2192 '${y.state}'`}`),p=d.map(y=>y.state===null?null:t.columns.find(b=>b.states.includes(y.state))?.id??null);if(p.length===0||p.includes(null))return{kind:"none",landings:u};let h=[...new Set(p)];return h.length>1?{kind:"many",columnIds:h,landings:u}:{kind:"one",columnId:h[0]}}s(v3,"startColumnOf");function x3(e,n){let t=ps(e,n);if(!t)return[];if(!t.layout.buses.some(l=>l.key==="process"))return[];let r=vk(t.layout);if(!r)return[];let i=v3(e,t.wiring,r);if(i.kind==="one"){let l=r.columns.find(d=>d.id===i.columnId);return l.defaultCollapsed!==!0&&!vP(l)?[]:[{layer:"GRAPH",kind:"progressState",path:`progressLayout.process.boards.${r.id}.columns.${l.id}`,reason:{de:`[progress/startColumnHidden] Neue Vorg\xE4nge landen in Spalte '${l.id}' (Board '${r.id}'), die ${l.defaultCollapsed===!0?"eingeklappt":"die Warteliste"} ist \u2014 dort w\xE4re das Plus zum Hinzuf\xFCgen nicht zu sehen.`,en:`[progress/startColumnHidden] New applications land in column '${l.id}' (board '${r.id}'), which is ${l.defaultCollapsed===!0?"collapsed":"the waitlist"} \u2014 the add plus would not show there.`},severity:"error"}]}let o=i.landings.join(", "),a=i.kind==="none"?{de:`[progress/startColumnNone] Ein neuer Vorgang landet auf keiner Spalte des Boards '${r.id}' (Start endet bei ${o}) \u2014 ordne den Zustand, mit dem er anh\xE4lt, einer Spalte zu.`,en:`[progress/startColumnNone] A new application lands in no column of board '${r.id}' (the start stops at ${o}) \u2014 put the state it parks with into a column.`}:{de:`[progress/startColumnAmbiguous] Ein neuer Vorgang kann in mehreren Spalten des Boards '${r.id}' landen (${i.columnIds.join(", ")}; Start endet bei ${o}) \u2014 das Plus zum Hinzuf\xFCgen braucht genau eine Startspalte.`,en:`[progress/startColumnAmbiguous] A new application can land in several columns of board '${r.id}' (${i.columnIds.join(", ")}; the start stops at ${o}) \u2014 the add plus needs exactly one start column.`};return[{layer:"GRAPH",kind:"progressState",path:`progressLayout.process.boards.${r.id}`,reason:a,severity:"error"}]}s(x3,"checkProgressStartColumn");function S3(e){return e==="both"?{de:`${Fm.de} \u2014 die Spalte ist auch der Schritt, den die Familie sieht; den Zustand in die Spalte des Nachfolgers zu legen, n\xE4hme ihr diesen Schritt.`,en:`${Fm.en} \u2014 the column is also the step the family sees; moving the state into the successor's column would take that step away from them.`}:{de:`${Fm.de}, oder den Zustand in die Spalte des Nachfolgers legen.`,en:`${Fm.en}, or move the state into the successor's column.`}}s(S3,"passThroughRemedy");function A3(e,n){let t=ps(e,n);if(!t)return[];let{layout:r,wiring:i}=t;if(!r.buses.some(v=>v.key==="process"))return[];let o=vk(r);if(!o)return[];let a=new Map(e.nodes.map(v=>[v.id,v])),l=s(v=>Qe(v).progressEvents??[],"eventsOf"),d=s(v=>Object.values(v.next??{}).map($=>$.to),"routesOf"),c=s((v,$)=>{let R=a.get(v);if(!R||$.has(v))return null;if(l(R).length>0)return[R];if(gb[R.type]!==!1)return null;let I=d(R);if(I.length===0)return null;let D=[];for(let F of I){let C=c(F,new Set([...$,v]));if(!C)return null;D.push(...C)}return D},"firstProgressNodes"),u=s((v,$)=>{let R=[];for(let I of l(v)){let D=es(i,v,I);if(!D||D.bus!==$.bus||D.state===$.state)return null;R.push(D.state)}return[...new Set(R)].join("' / '")},"overwrites"),p=s((v,$)=>{let R=d(v);if(R.length===0)return null;let I=[];for(let D of R){let F=c(D,new Set([v.id]));if(!F)return null;for(let C of F){let x=u(C,$);if(x===null)return null;I.push({de:`'${C.id}' (${C.type}) mit '${x}'`,en:`'${C.id}' (${C.type}) with '${x}'`})}}return[...new Map(I.map(D=>[D.de,D])).values()]},"submitOverwrittenBy"),h=new Map;for(let v of e.nodes)for(let $ of l(v)){let R=es(i,v,$);if(!R||R.bus!=="process")continue;let I=v.type==="form"&&$===up?p(v,R):null,D=I?{de:`'${v.id}'.${$} erreicht ihn, und ${I.map(F=>F.de).join(", ")} \xFCberschreibt ihn in derselben Transaktion`,en:`'${v.id}'.${$} reaches it, and ${I.map(F=>F.en).join(", ")} overwrites it in the same transaction`}:null;h.set(R.state,[...h.get(R.state)??[],D])}let y=Hp(r,"process"),b=new Map;for(let[v,$]of h){if(!$.every(I=>I!==null))continue;let R=[...new Map($.map(I=>[I.de,I])).values()];b.set(v,{de:R.map(I=>I.de).join("; "),en:R.map(I=>I.en).join("; ")})}let k=[];for(let v of o.columns){if(v.states.length===0||!v.states.every(I=>b.has(I)))continue;let $=v.states.map(I=>{let D=y.holdsSeat?.includes(I)===!0,F=b.get(I);return{de:`Zustand '${I}'${D?" (steht in holdsSeat, belegt aber nie einen Platz)":""}: ${F.de}`,en:`State '${I}'${D?" (is in holdsSeat, but never takes a seat)":""}: ${F.en}`}}),R=S3(o.audience);k.push({layer:"GRAPH",kind:"progressState",path:`progressLayout.process.boards.${o.id}.columns.${v.id}`,reason:{de:`[progress/passThroughState] Spalte \u201E${v.label.de}" ('${v.id}', Board '${o.id}') bleibt immer leer \u2014 ${$.map(I=>I.de).join("; ")}. ${R.de}`,en:`[progress/passThroughState] Column "${v.label.en}" ('${v.id}', board '${o.id}') always stays empty \u2014 ${$.map(I=>I.en).join("; ")}. ${R.en}`},severity:"warning"})}return k}s(A3,"checkProgressPassThroughColumns");function T3(e){let n=["workItems","workitems","work_items","taskTemplates"],t=[];for(let r of e.nodes){let i=r;for(let o of n){let a=i[o];a!=null&&t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.${o}`,reason:{de:`[workItems/misnamedTasksKey] Knoten "${r.id}" deklariert "${o}" \u2014 komponierte Aufgaben werden ausschlie\xDFlich unter "tasks" gelesen. So wie es dasteht, w\xFCrde die Aufgabenkette stillschweigend nie entstehen. Benenne den Schl\xFCssel in "tasks" um.`,en:`[workItems/misnamedTasksKey] Node "${r.id}" declares "${o}" \u2014 composed tasks are read only from "tasks". As it stands, the task chain would silently never be created. Rename the key to "tasks".`},severity:"error"})}}return t}s(T3,"checkMisnamedTasksKey");function R3(e){let n=[];for(let t of e.nodes){let r=t,i=Array.isArray(r.tasks)?r.tasks:[],o=new Set;for(let c of i){let u=typeof c.key=="string"?c.key:void 0;u!==void 0&&(o.has(u)&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}`,reason:{de:`[workItems/duplicateTemplateKey] Doppelter Template-Key "${u}" auf Knoten "${r.id}".`,en:`[workItems/duplicateTemplateKey] Duplicate template key "${u}" on node "${r.id}".`},severity:"error"}),o.add(u))}let a=new Set;for(let c of Array.isArray(r.artifacts)?r.artifacts:[])typeof c.key=="string"&&a.add(`${c.key}Uploaded`);let l=Qe(t),d=new Map((typeof l.workItemTemplates=="function"?l.workItemTemplates(t):[]).map(c=>[c.key,c]));for(let c of i){let u=typeof c.key=="string"?c.key:"?",p=typeof c.kind=="string"?c.kind:void 0;if(p===void 0||!gd.has(p)){n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.kind`,reason:{de:`[workItems/invalidKind] Task "${u}" auf Knoten "${r.id}" hat Art ${JSON.stringify(c.kind)}; komponierbar sind: ${[...gd].join(", ")}.`,en:`[workItems/invalidKind] Task "${u}" on node "${r.id}" has kind ${JSON.stringify(c.kind)}; composable kinds are: ${[...gd].join(", ")}.`},severity:"error"});continue}p==="task"&&c.gatesNode!==void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.gatesNode`,reason:{de:`[workItems/gatesNodeOnTask] 'gatesNode' ist nur f\xFCr die Art 'approval' zul\xE4ssig \u2014 eine Task gated ihren Knoten nie direkt. Um eine gatende Freigabe zur\xFCckzuhalten, 'blocks' verwenden (Task "${u}" auf Knoten "${r.id}").`,en:`[workItems/gatesNodeOnTask] 'gatesNode' is only allowed for the kind 'approval' \u2014 a task never gates its node directly. To hold back a gating approval, use 'blocks' (task "${u}" on node "${r.id}").`},severity:"error"});let h=c.blocks,y=h===void 0?void 0:yD(e,r.id,h.node);if(h!==void 0&&y===null)n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.node`,reason:{de:`[workItems/blocksUnknownNode] 'blocks.node' auf Task "${u}" (Knoten "${r.id}") nennt ${JSON.stringify(h.node)} \u2014 diesen Knoten gibt es im Workflow nicht.`,en:`[workItems/blocksUnknownNode] 'blocks.node' on task "${u}" (node "${r.id}") names ${JSON.stringify(h.node)} \u2014 there is no such node in the workflow.`},severity:"error"});else if(h!==void 0&&y!==void 0&&y!==null){let k=y.node.id===r.id,v=y.node.id,$=k?o:y.composedKeys,R=k?d:y.intrinsicByKey,I=y.node.assign??{};p==="approval"&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks`,reason:{de:`[workItems/blocksOnApproval] 'blocks' ist auf der Art 'approval' verboten \u2014 nur Task-Zeilen d\xFCrfen einen Geschwister-Spawn zur\xFCckhalten (Approval "${u}" auf Knoten "${r.id}").`,en:`[workItems/blocksOnApproval] 'blocks' is forbidden on the kind 'approval' \u2014 only task rows may hold back a sibling spawn (approval "${u}" on node "${r.id}").`},severity:"error"});let D=h.templateKey,F=[...new Set([...$,...R.keys()])].filter(x=>!k||x!==u).join(", "),C={de:F||"keine",en:F||"none"};if(typeof D!="string"||k&&D===u||!$.has(D)&&!R.has(D))n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:{de:`[workItems/blocksUnknownTarget] 'blocks' muss ein Template auf dem Zielknoten benennen \u2014 komponiert ODER intrinsisch (nie sich selbst, nie ohne 'templateKey': die zielfreie Form geh\xF6rt der Maschine, nicht dem Autor). Ziel ${JSON.stringify(D)} auf Knoten "${v}"; zul\xE4ssige Ziele: ${C.de}.`,en:`[workItems/blocksUnknownTarget] 'blocks' must name a template on the target node \u2014 composed OR intrinsic (never itself, never without 'templateKey': the target-less form belongs to the engine, not the author). Target ${JSON.stringify(D)} on node "${v}"; allowed targets: ${C.en}.`},severity:"error"});else if(y.refuse(D)!==null)n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:y.refuse(D),severity:"error"});else{let x=R.get(D);h.except!==void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.except`,reason:{de:`[workItems/blocksExceptRetired] 'blocks.except' auf Task "${u}" (Knoten "${r.id}") gibt es nicht mehr: eine blockierende Aufgabe sperrt die ganze Aktionsgruppe ihres Ziels (bei einer Entscheidung Freigeben, Warteliste, Ablehnen und das Nachr\xFCcken). 'except' entfernen.`,en:`[workItems/blocksExceptRetired] 'blocks.except' on task "${u}" (node "${r.id}") no longer exists: a blocking task locks the whole action group of its target (for a decision: approve, waitlist, reject and promote). Remove 'except'.`},severity:"error"}),x!==void 0&&x.recipient!=="external"&&x.verdictResolved!==!0&&I[D]===void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:{de:`[workItems/blocksUnwiredTarget] Task "${u}" auf Knoten "${r.id}" h\xE4lt "${D}" (Knoten "${v}") zur\xFCck, aber der Knoten weist "${D}" keiner Gruppe zu \u2014 ohne 'assign.${D}' entsteht diese Zeile nie: kein Team bekommt die zur\xFCckgehaltene Arbeit, niemand au\xDFer der verantwortlichen Person kann sie tun. Entweder 'assign.${D}' erg\xE4nzen oder das 'blocks' entfernen.`,en:`[workItems/blocksUnwiredTarget] Task "${u}" on node "${r.id}" holds back "${D}" (node "${v}"), but the node assigns "${D}" to no group \u2014 without 'assign.${D}' this row is never created: no team receives the held-back work, and nobody except the responsible person can do it. Either add 'assign.${D}' or remove the 'blocks'.`},severity:"error"})}}{let k=c.completableIf;if(typeof k=="string"&&k.trim().length>0){let v=k.trim().replace(/^!/,"").trim();a.has(v)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.completableIf`,reason:{de:`[workItems/unknownExport] completableIf "${k}" verweist auf unbekannten Node-Export "${v}"; bekannt: ${[...a].join(", ")||"keine"}.`,en:`[workItems/unknownExport] completableIf "${k}" refers to unknown node export "${v}"; known: ${[...a].join(", ")||"none"}.`},severity:"error"})}}let b=c.params;if(b?.commentRequired!==void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.commentRequired`,reason:{de:"[workItems/removedParam] 'params.commentRequired' wurde entfernt \u2014 Kommentar-Pflichten werden am Decision-Node ('commentRequired') autorisiert.",en:"[workItems/removedParam] 'params.commentRequired' was removed \u2014 comment requirements are authored on the decision node ('commentRequired')."},severity:"error"}),p!=="approval"){let k=[];b?.onReject!==void 0&&k.push("params.onReject"),b?.revisionGroup!==void 0&&k.push("params.revisionGroup");for(let v of k)n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.${v}`,reason:{de:`[workItems/approvalOnlyField] '${v}' gilt nur f\xFCr die Art 'approval' (Task "${u}" ist '${p}').`,en:`[workItems/approvalOnlyField] '${v}' only applies to the kind 'approval' (task "${u}" is '${p}').`},severity:"error"});continue}b?.onReject!==void 0&&b.onReject!=="spawnRevision"&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.onReject`,reason:{de:`[workItems/invalidOnReject] Erwartet 'spawnRevision', erhalten ${JSON.stringify(b.onReject)}.`,en:`[workItems/invalidOnReject] Expected 'spawnRevision', got ${JSON.stringify(b.onReject)}.`},severity:"error"}),b?.onReject==="spawnRevision"&&(typeof b.revisionGroup!="string"||b.revisionGroup.length===0)&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.params.revisionGroup`,reason:{de:`[workItems/spawnRevisionNoTarget] Approval "${u}" mit 'params.onReject: spawnRevision' ohne 'params.revisionGroup' \u2014 die \xDCberarbeitung h\xE4tte keine Ziel-Gruppe.`,en:`[workItems/spawnRevisionNoTarget] Approval "${u}" with 'params.onReject: spawnRevision' but no 'params.revisionGroup' \u2014 the revision would have no target group.`},severity:"error"})}}return n.push(...wD(e)),n}s(R3,"checkWorkItemTemplates");var $3=new Set(["complete","approve","reject"]),gb={form:!0,decision:!0,review:!0,waitlist:!0,completenessCheck:!0,collectPayment:!0,eventTrigger:!0,join:!1,roleAssign:!1,setFlag:!1,if:!1,end:!1,countersign:!0,engagePush:!1,governedDocument:!0};function E3(e){let n=[];for(let t of e.nodes){let r=t,i=Qe(t),o=Array.isArray(r.tasks)?r.tasks.length:0,a=i.workItemTemplates?.(t)??[];if(o+a.length>0){let v=gb[r.type];v===void 0?n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks`,reason:{de:`[workItems/unknownParkSemantics] Knotentyp "${r.type}" hat keine bekannte Park-Semantik \u2014 NODE_TYPE_PARKS in validators.ts erg\xE4nzen.`,en:`[workItems/unknownParkSemantics] Node type "${r.type}" has no known parking semantics \u2014 add it to NODE_TYPE_PARKS in validators.ts.`},severity:"error"}):v||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks`,reason:{de:`[workItems/templatesOnNonParkingNode] Knoten "${r.id}" (Typ "${r.type}") parkt nie \u2014 seine Work-Item-Templates w\xFCrden im selben Dispatch gespawnt und storniert (totes Muster).`,en:`[workItems/templatesOnNonParkingNode] Node "${r.id}" (type "${r.type}") never parks \u2014 its work-item templates would be spawned and cancelled in the same dispatch (dead pattern).`},severity:"error"})}let l=i.actions?.(t)??[];if(l.length===0&&a.length===0)continue;let d=new Map(l.map(v=>[v.id,v]));for(let v of l)$3.has(v.id)&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}`,reason:{de:`[capability/reservedActionId] Knotentyp "${r.type}" deklariert die Action "${v.id}" \u2014 reserviert f\xFCr den generischen Complete-/Verdict-Pfad (complete, approve, reject); die Spec muss eine andere Action-Id w\xE4hlen.`,en:`[capability/reservedActionId] Node type "${r.type}" declares the action "${v.id}" \u2014 reserved for the generic complete/verdict path (complete, approve, reject); the spec must choose a different action id.`},severity:"error"});let c=new Set(i.states??[BP]);for(let v of l)if(v.availableIn!==void 0)for(let $ of v.availableIn)c.has($)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}.availableIn`,reason:{de:`[capability/unknownActionState] Action "${v.id}" auf Knotentyp "${r.type}" ist f\xFCr Zustand "${$}" deklariert \u2014 der Typ kennt nur: ${[...c].join(", ")}.`,en:`[capability/unknownActionState] Action "${v.id}" on node type "${r.type}" is declared for state "${$}" \u2014 the type only knows: ${[...c].join(", ")}.`},severity:"error"});let u=Rk(t),p=new Set(u?u.map(v=>v.id):[Sa]);for(let v of l){if(v.external===void 0)continue;let $=jP(v.external.event),R={de:"hat keine Beschriftung (der Empf\xE4nger bekommt einen leeren Button)",en:"has no label (the recipient would get an empty button)"},I=$?v.kind==="advance"?{de:`ist als "advance" deklariert, l\xF6st den Knoten aber nicht auf (Ereignis "${v.external.event}") \u2014 solche Aktionen sind "internal"`,en:`is declared as "advance", but does not resolve the node (event "${v.external.event}") \u2014 such actions are "internal"`}:v.outcome!==void 0?{de:`nennt das Outcome "${v.outcome}", l\xF6st den Knoten aber nicht auf (Ereignis "${v.external.event}") \u2014 ein Outcome w\xFCrde eine zweite, stille Routing-Vokabel behaupten`,en:`names the outcome "${v.outcome}", but does not resolve the node (event "${v.external.event}") \u2014 an outcome would claim a second, silent routing vocabulary`}:v.label===void 0?R:null:v.kind!=="advance"?{de:`ist als "${v.kind}" deklariert (externe Aktionen l\xF6sen den Knoten auf und m\xFCssen "advance" sein)`,en:`is declared as "${v.kind}" (external actions resolve the node and must be "advance")`}:v.outcome===void 0?{de:"nennt kein Outcome",en:"names no outcome"}:p.has(v.outcome)?v.label===void 0?R:null:{de:`verweist auf das unbekannte Outcome "${v.outcome}" (deklariert: ${[...p].join(", ")||"keine"})`,en:`refers to the unknown outcome "${v.outcome}" (declared: ${[...p].join(", ")||"none"})`};I!==null&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}.external`,reason:{de:`[capability/externalActionNeedsOutcome] Externe Aktion "${v.id}" auf Knotentyp "${r.type}" ${I.de}.`,en:`[capability/externalActionNeedsOutcome] External action "${v.id}" on node type "${r.type}" ${I.en}.`},severity:"error"})}for(let v of a){let $=v.unlocks;if($.length===0&&v.verdictResolved!==!0&&v.informational!==!0){n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${v.key}.unlocks`,reason:{de:`[capability/emptyUnlocks] Intrinsisches Template "${v.key}" auf Knoten "${r.id}" schaltet keine Action frei (B5).`,en:`[capability/emptyUnlocks] Intrinsic template "${v.key}" on node "${r.id}" unlocks no action (B5).`},severity:"error"});continue}for(let R of $)d.get(R)===void 0&&n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.workItemTemplates.${v.key}.unlocks`,reason:{de:`[capability/danglingUnlock] Template "${v.key}" auf Knoten "${r.id}" schaltet unbekannte Action "${R}" frei; deklariert: ${[...d.keys()].join(", ")||"keine"}.`,en:`[capability/danglingUnlock] Template "${v.key}" on node "${r.id}" unlocks the unknown action "${R}"; declared: ${[...d.keys()].join(", ")||"none"}.`},severity:"error"})}let h=new Set(a.map(v=>v.key));for(let v of Object.keys(r.assign??{}))h.has(v)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.assign.${v}`,reason:{de:`[capability/unknownAssignKey] assign-Key "${v}" auf Knoten "${r.id}" ist kein intrinsisches Template dieses Knotentyps; bekannt: ${[...h].join(", ")||"keine"}.`,en:`[capability/unknownAssignKey] assign key "${v}" on node "${r.id}" is not an intrinsic template of this node type; known: ${[...h].join(", ")||"none"}.`},severity:"error"});for(let[v,$]of Object.entries(r.assign??{})){if($===void 0)continue;let R=`nodes.${r.id}.assign.${v}`,I={de:`Team der Vorlage "${v}" (Knoten "${r.id}")`,en:`team of the template "${v}" (node "${r.id}")`};n.push(...rP($,R,I));for(let[D,F]of(Array.isArray($)?$:[]).entries()){let C=F?.when;C==null||!ke(C)||mn(C)||n.push({layer:"GRAPH",kind:"nodeRule",path:`${R}.${D}.when`,severity:"error",reason:{de:`[assign/conditionNotFormField] ${I.de}, Zeile ${D+1}: die Bedingung nennt ${Ue(e,C,"de")} \u2014 ein Team wird nach einem Ja/Nein-Feld eines Formulars gew\xE4hlt ($node.<formular>.admission.<feld>).`,en:`[assign/conditionNotFormField] ${I.en}, row ${D+1}: the condition names ${Ue(e,C,"en")} \u2014 a team is chosen by a yes/no field of a form ($node.<form>.admission.<field>).`}})}}let y=l.filter(v=>v.teamAssignable===!0).map(v=>v.id);for(let v of Object.keys(r.actionTeams??{}))y.includes(v)||n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actionTeams.${v}`,reason:{de:`[capability/unknownActionTeam] Knoten "${r.id}" nennt ein Team f\xFCr "${v}", aber diese Aktion l\xE4sst sich hier keinem Team geben; m\xF6glich: ${y.join(", ")||"keine"}.`,en:`[capability/unknownActionTeam] Node "${r.id}" names a team for "${v}", but this action cannot be given to a team here; possible: ${y.join(", ")||"none"}.`},severity:"error"});let b=new Set;for(let v of a)if(v.recipient==="external"||(r.assign??{})[v.key]!==void 0)for(let R of v.unlocks)b.add(R);let k=i.strictActionCoverage===!0;for(let v of l){if(b.has(v.id)||v.superUserOnly===!0)continue;let $=a.find(I=>I.unlocks.includes(v.id)),R=$!==void 0?{de:` Fehlt die Zuweisung assign.${$.key}?`,en:` Is the assignment assign.${$.key} missing?`}:{de:"",en:""};n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.actions.${v.id}`,reason:{de:`[capability/superUserOnly] Action "${v.id}" auf Knoten "${r.id}" ist von keinem verdrahteten Work-Item freigeschaltet \u2014 nur die verantwortliche Person (Super-User) kann sie ausf\xFChren.${R.de}`,en:`[capability/superUserOnly] Action "${v.id}" on node "${r.id}" is unlocked by no wired work item \u2014 only the responsible person (super user) can perform it.${R.en}`},severity:k?"error":"warning"})}}return n}s(E3,"checkNodeCapabilityWiring");function I3(e){let n=new Set(rC()),t=[];for(let r of e.nodes)n.has(r.type)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.type`,reason:{de:`[graph/unknownNodeType] Knoten "${r.id}" hat den unbekannten Typ "${String(r.type)}". Registrierte Typen: ${[...n].join(", ")}.`,en:`[graph/unknownNodeType] Node "${r.id}" has the unknown type "${String(r.type)}". Registered types: ${[...n].join(", ")}.`},severity:"error"});return t}s(I3,"checkKnownNodeTypes");function O3(e,n){let t=[],r=s((a,l)=>{t.push({layer:"GRAPH",kind:"nodeRule",path:a,reason:l,severity:"error"})},"push"),i=p_(e),o=s(a=>typeof a=="object"&&a!==null&&Object.values(a).some(l=>typeof l=="string"&&l.trim().length>0),"hasText");for(let a of e.nodes){let l=a,d=Array.isArray(l.optionalActions)?l.optionalActions:[];if(t.push(...z3(l,d)),d.length===0)continue;let c=Qe(a),u=new Set(c.optionalActionKinds??[]),p=Array.isArray(l.tasks)?l.tasks:[],h=new Map;for(let k of p)typeof k.key=="string"&&h.set(k.key,k);let y=new Set,b=new Map;for(let k of d){let v=k.key,$=typeof v=="string"&&v.trim().length>0?v:void 0,R=$??"?",I=`nodes.${l.id}.optionalActions.${R}`,D=typeof k.action=="string"?k.action:void 0;if(k.when!==void 0){let F=s(C=>r(`${I}.when`,{de:`[optionalAction/when] Optionale Aktion "${R}" auf Knoten "${l.id}": ${C.de}`,en:`[optionalAction/when] Optional action "${R}" on node "${l.id}": ${C.en}`}),"conditionFinding");if(typeof k.when!="string"||k.when.trim()==="")F({de:"Die Bedingung ist leer \u2014 ohne Bedingung das Feld weglassen.",en:"The condition is empty \u2014 without a condition, omit the field."});else for(let C of wm(k.when,i,n))F(C)}if((D===void 0||!u.has(D))&&r(`${I}.action`,{de:`[optionalAction/kindNotDeclared] Optionale Aktion "${R}" auf Knoten "${l.id}" hat die Art ${JSON.stringify(k.action)} \u2014 `+(u.size===0?`Knotentyp "${l.type}" deklariert keine Familien (spec.optionalActionKinds fehlt).`:`Knotentyp "${l.type}" deklariert nur: ${[...u].join(", ")}.`),en:`[optionalAction/kindNotDeclared] Optional action "${R}" on node "${l.id}" has the kind ${JSON.stringify(k.action)} \u2014 `+(u.size===0?`node type "${l.type}" declares no families (spec.optionalActionKinds is missing).`:`node type "${l.type}" only declares: ${[...u].join(", ")}.`)}),$===void 0?r(`${I}.key`,{de:`[optionalAction/missingKey] Optionale Aktion auf Knoten "${l.id}" ohne (oder mit leerem) 'key' \u2014 Trigger-Action und Template-Keys w\xE4ren namenlos ('optionalAction::\u2026').`,en:`[optionalAction/missingKey] Optional action on node "${l.id}" without (or with an empty) 'key' \u2014 the trigger action and template keys would be nameless ('optionalAction::\u2026').`}):(y.has($)&&r(`${I}.key`,{de:`[optionalAction/duplicateKey] Doppelter Aktions-Key "${$}" auf Knoten "${l.id}" \u2014 die projizierten Trigger-Actions w\xFCrden kollidieren.`,en:`[optionalAction/duplicateKey] Duplicate action key "${$}" on node "${l.id}" \u2014 the projected trigger actions would collide.`}),y.add($)),o(k.label)||r(`${I}.label`,{de:`[optionalAction/missingLabel] Optionale Aktion "${R}" auf Knoten "${l.id}" ohne Label \u2014 der Trigger-Button w\xE4re unbeschriftet.`,en:`[optionalAction/missingLabel] Optional action "${R}" on node "${l.id}" without a label \u2014 the trigger button would be unlabeled.`}),D==="skipRule"){t.push(...C3(l,k,I,R,d));continue}if(D==="spawnTasks"){k.except!==void 0&&r(`${I}.except`,{de:`[optionalAction/exceptRetired] Optionale Aktion "${R}" auf Knoten "${l.id}" tr\xE4gt 'except' \u2014 das gibt es nicht mehr: solange die Aufgaben offen sind, ist die ganze Aktionsgruppe des Knotens gesperrt. 'except' entfernen.`,en:`[optionalAction/exceptRetired] Optional action "${R}" on node "${l.id}" carries 'except' \u2014 that no longer exists: while the tasks are open, the node's whole action group is locked. Remove 'except'.`}),t.push(...tF({nodeId:l.id,bindingKey:R,binding:k,templates:p})),t.push(..._3(l.id,k,I,R,h));let F=Array.isArray(k.tasks)?k.tasks:void 0;if(F===void 0||F.length===0)r(`${I}.tasks`,{de:`[optionalAction/tasksEmpty] Optionale Aktion "${R}" auf Knoten "${l.id}" referenziert keine Aufgaben-Templates \u2014 der Trigger w\xFCrde nichts erzeugen.`,en:`[optionalAction/tasksEmpty] Optional action "${R}" on node "${l.id}" references no task templates \u2014 the trigger would create nothing.`});else{let C=new Set,x=new Set(F.filter(N=>typeof N=="string"));for(let N of F){let T=typeof N=="string"?N:void 0;if(T===void 0||T.length===0){r(`${I}.tasks`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${R}" auf Knoten "${l.id}" enth\xE4lt eine leere/ung\xFCltige Template-Referenz.`,en:`[optionalAction/unknownTaskRef] Optional action "${R}" on node "${l.id}" contains an empty or invalid template reference.`});continue}if(C.has(T)){r(`${I}.tasks.${T}`,{de:`[optionalAction/duplicateTaskRef] Template "${T}" ist in der Aktion "${R}" auf Knoten "${l.id}" doppelt referenziert.`,en:`[optionalAction/duplicateTaskRef] Template "${T}" is referenced twice in the action "${R}" on node "${l.id}".`});continue}C.add(T);let q=h.get(T);if(q===void 0){r(`${I}.tasks.${T}`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${R}" auf Knoten "${l.id}" referenziert das Template "${T}", das node.tasks nicht deklariert. Vorhanden: ${[...h.keys()].join(", ")||"keine"}.`,en:`[optionalAction/unknownTaskRef] Optional action "${R}" on node "${l.id}" references the template "${T}", which node.tasks does not declare. Present: ${[...h.keys()].join(", ")||"none"}.`});continue}let G=b.get(T);G!==void 0&&G!==R?r(`${I}.tasks.${T}`,{de:`[optionalAction/taskDoublyBound] Template "${T}" auf Knoten "${l.id}" ist bereits von der Aktion "${G}" referenziert \u2014 ein Template geh\xF6rt zu h\xF6chstens einer optionalen Aktion.`,en:`[optionalAction/taskDoublyBound] Template "${T}" on node "${l.id}" is already referenced by the action "${G}" \u2014 a template belongs to at most one optional action.`}):b.set(T,R);let ae=q.blocks?.templateKey;typeof ae=="string"&&!x.has(ae)&&r(`${I}.tasks.${T}`,{de:`[optionalAction/taskRefBlocks] Template "${T}" auf Knoten "${l.id}" tr\xE4gt 'blocks' auf "${ae}", das nicht zur selben Aktion "${R}" geh\xF6rt \u2014 eine Referenz darf nur eine Referenz DERSELBEN Aktion zur\xFCckhalten (Checklisten-Reihenfolge), nie ein Template au\xDFerhalb.`,en:`[optionalAction/taskRefBlocks] Template "${T}" on node "${l.id}" carries 'blocks' on "${ae}", which does not belong to the same action "${R}" \u2014 a reference may only hold back a reference of the SAME action (checklist order), never a template outside it.`});for(let Z of p){let oe=typeof Z.key=="string"?Z.key:void 0;Z.blocks?.templateKey===T&&(oe!==void 0&&x.has(oe)||r(`${I}.tasks.${T}`,{de:`[optionalAction/taskRefBlocks] Template "${T}" auf Knoten "${l.id}" ist Ziel eines 'blocks' von ${oe!==void 0?`"${oe}"`:"einem Template"} au\xDFerhalb der Aktion "${R}" \u2014 ein Template au\xDFerhalb darf eine Referenz nie zur\xFCckhalten (ihr Spawn geh\xF6rt dem Trigger, nicht onEnter).`,en:`[optionalAction/taskRefBlocks] Template "${T}" on node "${l.id}" is the target of a 'blocks' from ${oe!==void 0?`"${oe}"`:"a template"} outside the action "${R}" \u2014 a template outside may never hold back a reference (its spawn belongs to the trigger, not to onEnter).`}))}}}}}}return t}s(O3,"checkOptionalActions");function _3(e,n,t,r,i){if(n.auto===void 0)return[];let o=s((d,c,u,p)=>({layer:"GRAPH",kind:"nodeRule",path:d,reason:{de:`[optionalAction/${c}] Optionale Aktion "${r}" auf Knoten "${e}": ${u}`,en:`[optionalAction/${c}] Optional action "${r}" on node "${e}": ${p}`},severity:"error"}),"issue");if(typeof n.auto!="boolean")return[o(`${t}.auto`,"autoType","'auto' ist true oder false.","'auto' is true or false.")];if(!n.auto)return[];let a=[];for(let d of["input","submitLabel"])n[d]!==void 0&&a.push(o(`${t}.${d}`,"autoInput",`startet beim Betreten des Schritts, niemand f\xFCllt den Dialog \u2014 '${d}' entfernen.`,`starts when the step is entered, nobody fills in the dialog \u2014 remove '${d}'.`));let l=Array.isArray(n.tasks)?n.tasks:[];for(let d of l)typeof d=="string"&&i.get(d)?.familyRequest!==void 0&&a.push(o(`${t}.tasks.${d}`,"autoFamilyRequest",`startet beim Betreten des Schritts, aber \u201E${d}\u201C fragt die Familie \u2014 was gefragt wird, w\xE4hlt erst ein Klick.`,`starts when the step is entered, but "${d}" asks the family \u2014 what it asks is chosen only by a click.`));return a}s(_3,"autoIssues");function C3(e,n,t,r,i){let o=[],a=s((u,p,h,y)=>{o.push({layer:"GRAPH",kind:"nodeRule",path:u,reason:{de:`[optionalAction/${p}] Optionale Aktion "${r}" auf Knoten "${e.id}": ${h}`,en:`[optionalAction/${p}] Optional action "${r}" on node "${e.id}": ${y}`},severity:"error"})},"push"),l=Array.isArray(e.requiresOneOf)?e.requiresOneOf:[];l.length===0&&a(`${t}.action`,"skipRuleWithoutRule","\xFCberspringt die Entscheidungsregel, aber der Knoten hat keine (`requiresOneOf`).","skips the decision rule, but the node has none (`requiresOneOf`)."),l.includes(n.key)&&a(`nodes.${e.id}.requiresOneOf`,"skipRuleListed","steht selbst in `requiresOneOf` \u2014 die Regel, die sie aufhebt, kann sie nicht erf\xFCllen.","is itself listed in `requiresOneOf` \u2014 it cannot meet the rule it lifts.");let d=e.assign?.decision;(!Array.isArray(d)||d.length===0)&&a(`${t}.action`,"skipRuleNeedsDecisionRow","braucht eine Entscheidungszeile (`assign.decision`), die festh\xE4lt, wer die Regel aufgehoben hat.","needs a decision row (`assign.decision`) that records who lifted the rule."),i.find(u=>u.action==="skipRule")!==n&&a(`${t}.action`,"skipRuleTwice","ist die zweite Aktion dieser Art am Knoten \u2014 eine reicht.","is the second action of this kind on the node \u2014 one is enough.");for(let u of["tasks","input","repeatable","submitLabel","auto"])n[u]!==void 0&&a(`${t}.${u}`,"skipRuleShape",`tr\xE4gt '${u}' \u2014 sie legt keine Aufgaben an.`,`carries '${u}' \u2014 it creates no tasks.`);return o}s(C3,"skipRuleIssues");function P3(e){return typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string"}s(P3,"literalValueType");function N3(e,n){let t=[],r=n?.notificationTemplates;for(let i of e.nodes){let o=i,a=fN(i,Qe(i)),l=o.notifications??{};if(a.length===0&&Object.keys(l).length===0)continue;let d=new Map(a.map(c=>[c.id,c]));for(let c of Object.keys(l))d.has(c)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.notifications.${c}`,reason:{de:`[notification/unknownEvent] Knoten "${o.id}" bindet eine Benachrichtigung an das Ereignis "${c}", das der Knotentyp "${o.type}" nicht kennt. Angeboten werden: ${a.map(u=>u.id).join(", ")||"(keine)"}.`,en:`[notification/unknownEvent] Node "${o.id}" binds a notification to the event "${c}", which the node type "${o.type}" does not know. Offered: ${a.map(u=>u.id).join(", ")||"(none)"}.`},severity:"error"});for(let c of a){let u=l[c.id];if(c.required===!0&&(u===void 0||u.disabled===!0)){t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.notifications.${c.id}`,reason:{de:`[notification/missingBinding] Knoten "${o.id}" muss beim Ereignis "${c.label.de}" (${c.id}) eine Benachrichtigung verschicken \u2014 es ist ${u===void 0?"keine gebunden":"eine gebunden, aber abgeschaltet"}.`,en:`[notification/missingBinding] Node "${o.id}" must send a notification on the event "${c.label.en}" (${c.id}) \u2014 ${u===void 0?"none is bound":"one is bound, but switched off"}.`},severity:"error"});continue}if(u===void 0||u.disabled===!0)continue;let p=`nodes.${o.id}.notifications.${c.id}`;if(c.audience!=="external"){t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/internalAudienceUnsupported] Knoten "${o.id}": das Ereignis "${c.id}" richtet sich an die Schule, und Benachrichtigungen an die Schule k\xF6nnen noch nicht zugestellt werden \u2014 die gebundene Benachrichtigung "${u.templateId}" w\xFCrde den Vorgang beim Versand abbrechen.`,en:`[notification/internalAudienceUnsupported] Node "${o.id}": the event "${c.id}" is addressed to the school, and notifications to the school cannot be delivered yet \u2014 the bound notification "${u.templateId}" would abort the process when it is sent.`},severity:"error"});continue}if(r===void 0)continue;let h=r.get(u.templateId);if(h===void 0){t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/unknownTemplate] Knoten "${o.id}": die Benachrichtigung "${u.templateId}" ist nicht im Katalog. Bekannt sind: ${[...r.keys()].sort().join(", ")||"(keine)"}.`,en:`[notification/unknownTemplate] Node "${o.id}": the notification "${u.templateId}" is not in the catalog. Known: ${[...r.keys()].sort().join(", ")||"(none)"}.`},severity:"error"});continue}h.audience!==void 0&&h.audience!==c.audience&&t.push({layer:"GRAPH",kind:"nodeRule",path:p,reason:{de:`[notification/audienceMismatch] Die Benachrichtigung "${h.id}" ist f\xFCr ${h.audience==="internal"?"die Schule":"die Familie"} geschrieben, das Ereignis "${c.id}" richtet sich aber an die Familie.`,en:`[notification/audienceMismatch] The notification "${h.id}" is written for ${h.audience==="internal"?"the school":"the family"}, but the event "${c.id}" is addressed to the family.`},severity:"warning"});let y=aN(c),b=new Set(h.params.map(k=>k.key));for(let k of Object.keys(u.args??{}))b.has(k)||t.push({layer:"GRAPH",kind:"nodeRule",path:`${p}.args.${k}`,reason:{de:`[notification/unknownArg] Die Benachrichtigung "${h.id}" hat kein Argument "${k}" \u2014 erwartet werden: ${h.params.map(v=>v.key).join(", ")||"(keine)"}.`,en:`[notification/unknownArg] The notification "${h.id}" has no argument "${k}" \u2014 expected: ${h.params.map(v=>v.key).join(", ")||"(none)"}.`},severity:"error"});for(let k of h.params){let v=u.args?.[k.key],$=`${p}.args.${k.key}`;if(v!==void 0&&"literal"in v){let I=P3(v.literal);k.type!==void 0&&!Mk(I,k.type)&&t.push({layer:"GRAPH",kind:"nodeRule",path:$,reason:{de:`[notification/argTypeMismatch] "${k.key}" erwartet ${hd(k.type).de}, festgelegt ist aber ${JSON.stringify(v.literal)} (${I}).`,en:`[notification/argTypeMismatch] "${k.key}" expects ${hd(k.type).en}, but ${JSON.stringify(v.literal)} (${I}) is set.`},severity:"error"});continue}if(v!==void 0){t.push({layer:"GRAPH",kind:"nodeRule",path:$,reason:{de:`[notification/unsupportedArg] "${k.key}" ist an ${JSON.stringify(v)} gebunden \u2014 ein Argument einer Benachrichtigung kann nur ein Festwert ({ literal }) sein oder automatisch aus ${rF(y,"de")} kommen.`,en:`[notification/unsupportedArg] "${k.key}" is bound to ${JSON.stringify(v)} \u2014 a notification argument can only be a fixed value ({ literal }) or come automatically from ${rF(y,"en")}.`},severity:"error"});continue}let R=lN(k,y.get(k.key)??[]);if(!(R.status==="resolved"||R.status==="unused")){if(R.status==="sometimes"){t.push({layer:"GRAPH",kind:"nodeRule",path:$,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${k.key}" immer, ${R.source.source} liefert es aber nur manchmal. In notifications.${c.id}.args.${k.key} einen Festwert benennen \u2014 oder eine Benachrichtigung w\xE4hlen, die ohne "${k.key}" auskommt.`,en:`[notification/unresolvedArg] The notification "${h.id}" always needs "${k.key}", but ${R.source.source} provides it only sometimes. Name a fixed value in notifications.${c.id}.args.${k.key} \u2014 or choose a notification that works without "${k.key}".`},severity:"error"});continue}if(R.status==="ambiguous"){t.push({layer:"GRAPH",kind:"nodeRule",path:$,reason:{de:`[notification/ambiguousArg] "${k.key}" hat mehrere passende Quellen \u2014 ${R.matches.map(I=>I.source).join(", ")}. In notifications.${c.id}.args.${k.key} einen Festwert setzen.`,en:`[notification/ambiguousArg] "${k.key}" has several matching sources \u2014 ${R.matches.map(I=>I.source).join(", ")}. Set a fixed value in notifications.${c.id}.args.${k.key}.`},severity:"error"});continue}t.push({layer:"GRAPH",kind:"nodeRule",path:$,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${k.key}"${k.type!==void 0?` (${hd(k.type).de})`:""}, und der Knoten hat daf\xFCr ${R.rejected.length===0?"keine Quelle":`nur unpassende Quellen: ${R.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`,en:`[notification/unresolvedArg] The notification "${h.id}" needs "${k.key}"${k.type!==void 0?` (${hd(k.type).en})`:""}, and the node has ${R.rejected.length===0?"no source for it":`only unsuitable sources for it: ${R.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`},severity:"error"})}}}}return t}s(N3,"checkNotificationBindings");function D3(e){return VN(e).map(n=>({layer:"GRAPH",kind:"assignment",path:"assignmentRules",reason:n,severity:"error"}))}s(D3,"checkAssignmentRules");function rF(e,n){let t=[...e.keys()].sort();return t.length===0?n==="de"?"(nichts)":"(nothing)":t.join(", ")}s(rF,"describeCandidates");function F3(e,n){return GN(e,n?.teamKeys).map(t=>({layer:"GRAPH",kind:"nodeRule",path:t.path,reason:t.reason,severity:"error"}))}s(F3,"checkChannels");function L3(e){return h_(e).map(n=>({layer:"GRAPH",kind:"nodeRule",path:n.path,reason:n.reason,severity:"error"}))}s(L3,"checkStaffInputs");function M3(e,n){let t=[];for(let r of e.nodes){let i=r.reads;if(i===void 0)continue;let o=`nodes.${r.id}.reads`,a={de:`Knoten \u201E${Pe(e,r.id,"de")}\u201C (${r.id})`,en:`Node "${Pe(e,r.id,"en")}" (${r.id})`},l=s(c=>{t.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:c,severity:"error"})},"issue");if(!QN(r)){l({de:`[readiness/readsNotGated] ${a.de} (${r.type}) deklariert \`reads\`, aber die Bereitschaftspr\xFCfung h\xE4lt nur Entscheidungs-Knoten und Dokument-Knoten mit Produktion \u2014 hier w\xFCrde \`reads\` nichts bewirken.`,en:`[readiness/readsNotGated] ${a.en} (${r.type}) declares \`reads\`, but the readiness check only holds decision nodes and document nodes with production \u2014 here \`reads\` would have no effect.`});continue}if(!Array.isArray(i)){l({de:`[readiness/readsDuplicate] \`reads\` von ${a.de} muss eine Liste von Feldadressen sein, erhalten ${JSON.stringify(i)}.`,en:`[readiness/readsDuplicate] \`reads\` of ${a.en} must be a list of field addresses, got ${JSON.stringify(i)}.`});continue}let d=new Set;for(let c of i){if(!ke(c))continue;let u=ue(c);if(d.has(u)){l({de:`[readiness/readsDuplicate] ${a.de} liest ${Ue(e,c,"de")} mehrfach.`,en:`[readiness/readsDuplicate] ${a.en} reads ${Ue(e,c,"en")} more than once.`});continue}if(d.add(u),!mn(c)){l({de:`[readiness/readsUnknownField] ${a.de} liest ${Ue(e,c,"de")} \u2014 \`reads\` nennt nur Felder eines Formulars ($node.<formular>.admission.<feld>).`,en:`[readiness/readsUnknownField] ${a.en} reads ${Ue(e,c,"en")} \u2014 \`reads\` only names fields of a form ($node.<form>.admission.<field>).`});continue}let p=ri(n,c);p!=null&&wa("nodeReads",ya(p))==="repeated"&&l({de:`[readiness/readsUnknownField] ${a.de} liest ${Ue(e,c,"de")} \u2014 ein Feld in einer Wiederholgruppe ist kein einzelnes Feld der Anmeldung und kann nicht gelesen werden.`,en:`[readiness/readsUnknownField] ${a.en} reads ${Ue(e,c,"en")} \u2014 a field in a repeated group is not a single field of the application and cannot be read.`})}}return t}s(M3,"checkReadinessReads");function q3(e,n){let t=[];for(let r of e.nodes){if(r.type!=="setFlag")continue;let i=hC(r),o=Pp(r);if(i===null||o===null)continue;let a=n?.formFlagKeysByFormNode?.get(i);if(a===void 0||a.has(o))continue;let l=[...a].sort();t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.inputs.${Vn.flagKey}`,reason:{de:`[setFlag/unknownFlag] Knoten \u201E${Pe(e,r.id,"de")}\u201C (${r.id}) setzt \u201E${o}\u201C, aber das Formular von \u201E${Pe(e,i,"de")}\u201C hat kein externes Merkmal dieses Namens`+(l.length>0?` (vorhanden: ${l.join(", ")}).`:" \u2014 es deklariert gar keins."),en:`[setFlag/unknownFlag] Node "${Pe(e,r.id,"en")}" (${r.id}) sets "${o}", but the form of "${Pe(e,i,"en")}" has no external flag of that name`+(l.length>0?` (present: ${l.join(", ")}).`:" \u2014 it declares none at all.")},severity:"error"})}return t}s(q3,"checkSetFlagKeys");function K3(e,n){let t=n?.readinessFormFieldsByFormNode,r=n?.readinessPartyConditionKeysByFormNode;if(t===void 0||r===void 0)return[];let i=[];for(let o of e.nodes){if(o.type!=="governedDocument"||o.production!=="resolver")continue;let a=o.form;if(!ke(a)||!ar(a))continue;let l=t.get(a.owner),d=r.get(a.owner);if(l===void 0||d===void 0||d.size===0)continue;let c=Zk(l,d);if(c.size===0)continue;let u=o.reads,p=(Array.isArray(u)?u:[]).filter(k=>mn(k)&&k.owner===a.owner),h=Zk(l,[...p.map(k=>k.path),...eD(o).filter(k=>k.owner===a.owner).map(k=>k.fieldKey)]),y=[...c].filter(k=>!h.has(k)).sort();if(y.length===0)continue;let b={de:Pe(e,a.owner,"de"),en:Pe(e,a.owner,"en")};i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${o.id}.reads`,reason:{de:`[readiness/readsMissesPartyCondition] Knoten \u201E${Pe(e,o.id,"de")}\u201C (${o.id}) erzeugt ein Dokument, dessen Vertragsparteien von Angaben im Formular \u201E${b.de}\u201C abh\xE4ngen, die er weder liest noch bindet: ${y.join(", ")}. Eine Korrektur darauf h\xE4lt den Knoten nicht an und kann nach der Ausstellung eine Vertragspartei entfernen \u2014 die Felder (oder den berechneten Schl\xFCssel) aus \u201E${b.de}\u201C in \`reads\` erg\xE4nzen.`,en:`[readiness/readsMissesPartyCondition] Node "${Pe(e,o.id,"en")}" (${o.id}) generates a document whose contract parties depend on answers in the form "${b.en}" that it neither reads nor binds: ${y.join(", ")}. A correction to them does not hold the node and can remove a contract party after issuing \u2014 add the fields (or the computed key) from "${b.en}" to \`reads\`.`},severity:"warning"})}return i}s(K3,"checkReadinessPartyConditions");function yb(e){let n=Object.keys(e.inputs??{});if(n.length===0)return[];let t=e.generatorStamp,r=e.production,i=e.templateStamp;if(e.type==="governedDocument"&&(r==="resolver"&&!Array.isArray(t?.inputSchema?.fields)||r==="template"&&!Array.isArray(i?.fields)))return[];let a=new Set(va(e).map(l=>l.id));return n.filter(l=>!a.has(l))}s(yb,"undeclaredInputKeys");function j3(e,n){return e.nodes.flatMap(t=>[...B3(e,t,va(t),n),...V3(e,t,n)])}s(j3,"checkUnknownResources");function V3(e,n,t){let r=[],i=new Set((Qe(n).workItemTemplates?.(n)??[]).map(a=>a.key)),o=new Set((n.tasks??[]).filter(a=>a.familyRequest!==void 0).map(a=>String(a.key)));for(let a of zp(n)){if(a.leaf==="assign{}"&&!i.has(a.owner)||a.leaf==="tasks[].assign.group"&&a.missing&&o.has(a.owner))continue;let l=ma[a.leaf],d=`nodes.${n.id}.${a.path}`,c=s(h=>h==="de"?`Knoten \u201E${Pe(e,n.id,"de")}\u201C (${n.id}), ${l.what.de} \u201E${a.owner}\u201C`:`node "${Pe(e,n.id,"en")}" (${n.id}), ${l.what.en} "${a.owner}"`,"where");if(a.missing){if(!l.required){r.push({layer:"GRAPH",kind:"nodeRule",path:d,severity:"error",reason:{de:`[inputs/emptyReference] ${c("de")}: der Eintrag ist leer oder kein Schl\xFCssel \u2014 ${l.consequence.de}. Team w\xE4hlen oder den Eintrag entfernen.`,en:`[inputs/emptyReference] ${c("en")}: the entry is empty or no key \u2014 ${l.consequence.en}. Choose a team or remove the entry.`}});continue}r.push({layer:"GRAPH",kind:"nodeRule",path:d,severity:"error",reason:{de:`[workItems/needsTeam] ${c("de")}: kein Team gew\xE4hlt \u2014 ${l.consequence.de}. Jede Aufgabe geh\xF6rt der Warteschlange eines Teams.`,en:`[workItems/needsTeam] ${c("en")}: no team chosen \u2014 ${l.consequence.en}. Every task belongs to a team's queue.`}});continue}if(a.key===null)continue;let u=t?.teamKeys;if(u===void 0||u.has(a.key))continue;let p=[...u].sort().join(", ")||"\u2014";r.push({layer:"GRAPH",kind:"nodeRule",path:d,severity:"error",reason:{de:`[inputs/unknownResource] ${c("de")}: \u201E${a.key}\u201C ist kein Team dieses Mandanten \u2014 ${l.consequence.de}. Teams: ${p}.`,en:`[inputs/unknownResource] ${c("en")}: "${a.key}" is no team of this school \u2014 ${l.consequence.en}. Teams: ${p}.`}})}return r}s(V3,"referenceIssues");function B3(e,n,t,r){let i=[];for(let o of t){if(!Np(o.type))continue;let a=ua[o.type].existence;if(a.check!=="generic")continue;let l=r?.[a.catalog];if(l===void 0)continue;let d=n.inputs?.[o.id];if(d?.kind!=="literal"||typeof d.value!="string"||l.has(d.value))continue;let c=ua[o.type].label;i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${o.id}`,reason:{de:`[inputs/unknownResource] Knoten \u201E${Pe(e,n.id,"de")}\u201C (${n.id}) nennt im Eingang \u201E${o.label.de}\u201C ${c.de} \u201E${d.value}\u201C \u2014 diesen Schl\xFCssel kennt dieser Mandant nicht.`,en:`[inputs/unknownResource] Node "${Pe(e,n.id,"en")}" (${n.id}) names the ${c.en.toLowerCase()} "${d.value}" in its input "${o.label.en}", which does not exist in this school.`},severity:"error"})}return i}s(B3,"unknownResourceIssues");function U3(e){let n=[];for(let t of e.nodes)for(let r of yb(t))n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${r}`,reason:{de:`[inputs/undeclared] Knoten \u201E${Pe(e,t.id,"de")}\u201C (${t.id}) hat einen Eingang \u201E${r}\u201C, den sein Typ nicht deklariert \u2014 ein Rest einer fr\xFCheren Einstellung (z. B. eines anderen Generators). Im Parameter-Bereich ist er nicht sichtbar; entfernen.`,en:`[inputs/undeclared] Node "${Pe(e,t.id,"en")}" (${t.id}) has an input "${r}" its type does not declare \u2014 a leftover of an earlier setting (e.g. another generator). It is not visible among the parameters; remove it.`},severity:"error"});return n}s(U3,"checkUndeclaredInputs");function G3(e){let n=[];for(let t of e.nodes){let r=new Set;for(let i of va(t)){if(!r.has(i.id)){r.add(i.id);continue}n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${i.id}`,reason:{de:`[inputs/duplicateSlot] Knoten \u201E${Pe(e,t.id,"de")}\u201C (${t.id}) hat den Eingang \u201E${i.id}\u201C zweimal \u2014 ein Parameter des Generators oder der Vorlage tr\xE4gt den Namen eines Eingangs des Knotentyps. Den Parameter umbenennen.`,en:`[inputs/duplicateSlot] Node "${Pe(e,t.id,"en")}" (${t.id}) has the input "${i.id}" twice \u2014 a parameter of the generator or template carries the name of an input of the node type. Rename the parameter.`},severity:"error"})}}return n}s(G3,"checkDuplicateSlots");function iF(e,n,t){let r=[],i=I3(e);if(i.length>0)return i;r.push(...u3(e)),r.push(...d3(e)),r.push(...f3(e)),r.push(...c3(e)),r.push(...s3(e)),r.push(...a3(e)),r.push(...l3(e)),r.push(...h3(e)),r.push(...p3(e)),r.push(...RP(e,n)),r.push(...g3(e,n)),r.push(...y3(e,n)),r.push(...w3(e,n)),r.push(...iD(e,n?.layout)),r.push(...k3(e,n)),r.push(...b3(e,n)),r.push(...A3(e,n)),r.push(...x3(e,n)),r.push(...yP(e,t)),r.push(...OP(e)),r.push(...DP(e)),r.push(...EP(e)),r.push(...IP(e)),r.push(...U3(e)),r.push(...j3(e,t)),r.push(...G3(e)),r.push(...T3(e)),r.push(...R3(e)),r.push(...bD(e,t)),r.push(...TD(e)),r.push(...SD(e)),r.push(...RD(e,t)),r.push(...ND(e,t)),r.push(...E3(e)),r.push(...N3(e,t)),r.push(...O3(e,t)),r.push(...D3(e)),r.push(...M3(e,t)),r.push(...K3(e,t)),r.push(...q3(e,t)),r.push(...F3(e,t)),r.push(...L3(e)),r.push(...nF(e));for(let o of e.nodes){let a=Qe(o);a.validate&&r.push(...a.validate(o,e,t))}return r}s(iF,"checkGraph");function z3(e,n){let t=e.requiresOneOf;if(t===void 0)return[];let r=`nodes.${e.id}.requiresOneOf`,i=s(d=>({layer:"GRAPH",kind:"nodeRule",path:r,reason:d,severity:"error"}),"issue");if(e.type!=="decision")return[i({de:`[decision/requiresOneOfNotDecision] Knoten "${e.id}" (Typ "${e.type}") tr\xE4gt 'requiresOneOf' \u2014 die Regel gilt nur an Entscheidungsknoten (decision).`,en:`[decision/requiresOneOfNotDecision] Node "${e.id}" (type "${e.type}") carries 'requiresOneOf' \u2014 the rule only applies to decision nodes (decision).`})];if(!Array.isArray(t)||t.length===0||t.some(d=>typeof d!="string"||d.length===0))return[i({de:`[decision/requiresOneOfEmpty] 'requiresOneOf' an Knoten "${e.id}" muss eine nicht-leere Liste von Aktions-Keys sein \u2014 sonst Feld weglassen.`,en:`[decision/requiresOneOfEmpty] 'requiresOneOf' on node "${e.id}" must be a non-empty list of action keys \u2014 otherwise omit the field.`})];let o=n.map(d=>d.key).filter(d=>typeof d=="string"),a=[],l=new Set;for(let d of t){if(l.has(d)){a.push(i({de:`[decision/requiresOneOfDuplicate] 'requiresOneOf' an Knoten "${e.id}" nennt "${d}" doppelt.`,en:`[decision/requiresOneOfDuplicate] 'requiresOneOf' on node "${e.id}" names "${d}" twice.`}));continue}l.add(d),o.includes(d)||a.push(i({de:`[decision/requiresOneOfUnknownAction] 'requiresOneOf' an Knoten "${e.id}" nennt "${d}", aber dieser Knoten hat keine optionale Aktion mit diesem Key \u2014 die Regel w\xE4re nie erf\xFCllbar. `+(o.length===0?"Der Knoten hat keine optionalen Aktionen.":`Optionale Aktionen dieses Knotens: ${o.join(", ")}.`),en:`[decision/requiresOneOfUnknownAction] 'requiresOneOf' on node "${e.id}" names "${d}", but this node has no optional action with that key \u2014 the rule could never be met. `+(o.length===0?"The node has no optional actions.":`Optional actions of this node: ${o.join(", ")}.`)}))}return a}s(z3,"checkRequiresOneOf");function W3(e){return e.nodes.flatMap(n=>yb(n).map(t=>({nodeId:n.id,key:t,binding:n.inputs?.[t]?.kind==="binding"})))}s(W3,"undeclaredInputCells");function oF(e,n){let t=W3(e).filter(o=>n.bindings||!o.binding);if(t.length===0)return{graph:e,dropped:t};let r=new Map;for(let o of t)r.set(o.nodeId,(r.get(o.nodeId)??new Set).add(o.key));let i=e.nodes.map(o=>{let a=r.get(String(o.id));if(a===void 0)return o;let l=Object.fromEntries(Object.entries(o.inputs).filter(([d])=>!a.has(d)));return{...o,inputs:l}});return{graph:{...e,nodes:i},dropped:t}}s(oF,"dropUndeclaredInputs");function wb(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(wb,"isObject");function sF(e){return wb(e)&&e.type==="governedDocument"&&("template"in e||"cockpitFields"in e)}s(sF,"oldShape");function aF(e){return(e?.nodes??[]).some(sF)}s(aF,"needsTemplateStampMove");function Y3(e){let n=e.generatorStamp?.inputSchema?.fields;if(e.production==="resolver")return Array.isArray(n)?n:null;let t=e.templateStamp?.fields;return e.production==="template"&&Array.isArray(t)?t:null}s(Y3,"stampedFields");function H3(e){let n=String(e.id);if("template"in e&&"templateStamp"in e)return{unmoved:{nodeId:n,reason:"templateAndStamp"}};let t={...e},r=[];if("template"in e){let{template:i}=e;if(delete t.template,wb(i))t.templateStamp={fields:Array.isArray(i.fields)?i.fields:[],...i.localeField===void 0?{}:{localeField:i.localeField}};else return{unmoved:{nodeId:n,reason:"templateNotObject"}}}if("cockpitFields"in e){let i=Array.isArray(e.cockpitFields)?e.cockpitFields.filter(l=>typeof l=="string"):[];delete t.cockpitFields;let o=wb(e.inputs)?{...e.inputs}:{},a=Y3(t);if(a===null&&i.length>0)return{unmoved:{nodeId:n,key:i[0],reason:"noStamp"}};for(let l of i){let d=l in o&&o[l]?.kind!=="unset",c=(a??[]).find(u=>u.key===l);if(c===void 0)r.push({nodeId:n,key:l,reason:"unknownKey"});else{if(c.type==="party"||c.type==="personList")continue;c.processSource!==void 0?r.push({nodeId:n,key:l,reason:"processSource"}):d?r.push({nodeId:n,key:l,reason:"cellExists"}):o[l]={kind:"cockpit"}}}t.inputs=o}return{node:t,reports:r}}s(H3,"moveNode");function lF(e){let n=[],t=[],r=[],i=e.nodes.map(o=>{if(!sF(o))return o;let a=H3(o);return"unmoved"in a?(r.push(a.unmoved),o):(n.push(String(o.id)),t.push(...a.reports),a.node)});return n.length===0?{graph:e,moved:n,reports:t,unmoved:r}:{graph:{...e,nodes:i},moved:n,reports:t,unmoved:r}}s(lF,"moveTemplateStampAndCockpit");var dF=fp,J3="applicant.applicationSubmitted";function Lm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Lm,"isObject");function cF(e){return Lm(e)&&e.type==="form"&&typeof e.id=="string"&&!_t(e)}s(cF,"isCreatingFormNode");function Q3(e){return Lm(e.notifications)&&dF in e.notifications}s(Q3,"hasSubmittedBinding");function kb(e){let n={toBind:[],alreadyBound:[],malformed:[]};for(let t of e?.nodes??[])cF(t)&&(t.notifications!==void 0&&!Lm(t.notifications)?n.malformed.push(t.id):Q3(t)?n.alreadyBound.push(t.id):n.toBind.push(t.id));return n}s(kb,"submitReceiptInventory");function uF(e){let{toBind:n}=kb(e);if(n.length===0)return{graph:e,bound:[]};let t=new Set(n),r=e.nodes.map(i=>{if(!cF(i)||!t.has(i.id))return i;let o=Lm(i.notifications)?i.notifications:{};return{...i,notifications:{...o,[dF]:{templateId:J3}}}});return{graph:{...e,nodes:r},bound:n}}s(uF,"bindSubmitReceipt");var ms=["park","advance"],ur="whenNothingOwed",fF={park:{de:"Jemand schaut drauf",en:"Someone looks at it"},advance:{de:"Durchreichen",en:"Pass through"}};function bb(e){let n=e.inputs?.[ur],t=n?.kind==="literal"?n.value:void 0;return vb(t)?t:null}s(bb,"reviewModeOrNull");function vb(e){return ms.includes(e)}s(vb,"isReviewMode");function xb(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(xb,"isObject");function pF(e){return xb(e)&&e.type==="review"&&!(xb(e.inputs)&&ur in e.inputs)}s(pF,"lacksMode");function mF(e){return(e?.nodes??[]).some(pF)}s(mF,"needsReviewMode");function hF(e){let n=[],t=e.nodes.map(r=>{if(!pF(r))return r;n.push(r.id);let i=xb(r.inputs)?r.inputs:{};return{...r,inputs:{...i,[ur]:{kind:"literal",value:"park"}}}});return{graph:{...e,nodes:t},set:n}}s(hF,"setReviewModePark");function Mm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Mm,"isObject");function gF(e){let{notifications:n,bound:t}=lm(e.notifications,{tasks:[]},e);return{next:n,bound:t}}s(gF,"bindingsFor");function yF(e){let n={toBind:[],malformed:[]};for(let t of e?.nodes??[])if(!(!Mm(t)||typeof t.id!="string"||Ta(t).length===0)){if(t.notifications!==void 0&&!Mm(t.notifications)){n.malformed.push(t.id);continue}for(let r of gF(t).bound)n.toBind.push(`${t.id}.${r}`)}return n}s(yF,"appointmentLetterInventory");function wF(e){let n=[],t=!1,r=e.nodes.map(i=>{if(!Mm(i)||typeof i.id!="string"||Ta(i).length===0||i.notifications!==void 0&&!Mm(i.notifications))return i;let{next:o,bound:a}=gF(i);return a.length===0?i:(t=!0,n.push(...a.map(l=>`${i.id}.${l}`)),{...i,notifications:o})});return t?{graph:{...e,nodes:r},bound:n}:{graph:e,bound:[]}}s(wF,"bindAppointmentLetters");function Ba(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ba,"isObject");var kF=["id","label","dataFlow"],bF=["audience","populates","stages","expectedOutcomes"];function vF(e){return Array.isArray(e.assignmentRules)&&e.assignmentRules.some(n=>Ba(n)&&typeof n.slot=="string")}s(vF,"carriesStringSlots");function xF(e){return(e.nodes??[]).some(n=>Ba(n)&&n.type==="form"&&bF.some(t=>t in n))}s(xF,"carriesRetiredFormNodeKey");var Z3=[{key:"generatorPin",editor:!0,holds:q_,what:{de:"Generator als `resolver`",en:"generator as `resolver`"}},{key:"setFlagProperties",editor:!0,holds:bC,what:{de:"Formular und Merkmal eines \u201EFlag setzen\u201C-Knotens als Eigenschaften",en:'form and flag of a "Set flag" node as properties'}},{key:"scalarProperties",editor:!0,holds:RC,what:{de:"Einstellungen eines Knotens als Eigenschaften statt als Eing\xE4nge",en:"a node's settings as properties instead of inputs"}},{key:"nodeConfigProperties",editor:!0,holds:NC,what:{de:"Hinweis einer Zahlung als Eigenschaft oder ein entferntes Muster-Dokument",en:"a payment's note as a property, or a removed sample document"}},{key:"outcomeWithoutSemantic",editor:!0,holds:I_,what:{de:"Entscheidungsausg\xE4nge ohne Bedeutung",en:"decision outcomes without a meaning"}},{key:"startNodeOutcomes",editor:!0,holds:P_,what:{de:"ein Start-Knoten mit eigenen Ausg\xE4ngen",en:"a start node with its own outcomes"}},{key:"templateParameters",editor:!0,holds:aF,what:{de:"Parameter einer Vorlage am Knoten oder Cockpit-Felder als Liste",en:"a template's parameters on the node, or cockpit fields as a list"}},{key:"paymentSettlement",editor:!0,holds:jC,what:{de:"Zahlungsknoten mit \u201EAbrechnung\u201C (`inputs.settlement`) statt \u201EZahlungsweg\u201C (`inputs.mode`)",en:'payment node with "Settlement" (`inputs.settlement`) instead of "Payment mode" (`inputs.mode`)'}},{key:"documentRef",editor:!0,holds:XC,what:{de:"Dokument eines anderen Knotens als `document:$node.<Knoten>.document` statt als Slot `artifact:<Slot>`",en:"another node's document as `document:$node.<node>.document` instead of the slot `artifact:<slot>`"}},{key:"formView",editor:!0,holds:GC,what:{de:"Ansicht einer Aufgabe als `formView` statt als Ansichts-Adresse `view`",en:"a task's view as `formView` instead of the view address `view`"}},{key:"nodeAssignString",editor:!0,holds:QC,what:{de:"Team einer Knoten-Aufgabe als Text (`assign.<Vorlage>`) statt als Regelliste",en:"a node task's team as text (`assign.<template>`) instead of a rule list"}},{key:"reviewWithoutMode",editor:!0,holds:mF,what:{de:"Pr\xFCfknoten ohne \u201EWenn nichts zu pr\xFCfen ist\u201C",en:'review nodes without "When nothing is owed"'}},{key:"taskAssignUser",editor:!1,holds:s(e=>Up(e).length>0,"holds"),what:{de:"eine Aufgabe mit fester Person (`assign.userId`)",en:"a task with a fixed person (`assign.userId`)"}},{key:"retiredGraphKey",editor:!1,holds:s(e=>kF.some(n=>n in e),"holds"),what:{de:"`graph.id` / `graph.label` / `graph.dataFlow`",en:"`graph.id` / `graph.label` / `graph.dataFlow`"}},{key:"assignmentSlotString",editor:!1,holds:vF,what:{de:"Zust\xE4ndigkeitsregeln mit Slot als Text (`responsible` / `team:<Schl\xFCssel>`)",en:"assignment rules with a slot as text (`responsible` / `team:<key>`)"}},{key:"retiredFormNodeKey",editor:!1,holds:xF,what:{de:"Formularknoten mit `audience` / `populates` / `stages` / `expectedOutcomes`",en:"form nodes with `audience` / `populates` / `stages` / `expectedOutcomes`"}}];function SF(e){if(!Ba(e)||!Array.isArray(e.nodes))return[];let n=e;return Z3.filter(t=>t.holds(n)).map(({key:t,what:r,editor:i})=>({key:t,what:r,editor:i}))}s(SF,"legacyGraphShapes");function AF(e,n){let t=n.answers??{},r=[],i=[],o=e,a=kF.filter(T=>T in o);if(a.length>0){let T={...o};for(let q of a)delete T[q],r.push({message:`graph.${q}: deleted (read by nothing)`});o=T}if(xF(o)&&(o={...o,nodes:o.nodes.map(T=>{if(!Ba(T)||T.type!=="form")return T;let q=bF.filter(ae=>ae in T);if(q.length===0)return T;let G={...T};for(let ae of q)delete G[ae];return r.push({nodeId:String(T.id),message:`form node: deleted ${q.map(ae=>`\`${ae}\``).join(", ")} (read by nothing)`}),G})}),vF(o)){let T=o.assignmentRules.map((q,G)=>{if(!Ba(q)||typeof q.slot!="string")return q;let ae=Ap(q.slot);return ae===null?(i.push({code:"assignment/slotUnknown",answer:"edit",message:`assignmentRules[${G}].slot "${q.slot}" is neither \`responsible\` nor \`team:<key>\` \u2014 edit it by hand`}),q):(r.push({message:`assignmentRules[${G}].slot "${q.slot}" \u2192 ${JSON.stringify(ae)}`}),{...q,slot:ae})});o={...o,assignmentRules:T}}let l=K_(o);o=l.graph;for(let T of l.moved)r.push({nodeId:T,message:"generator / template pin moved into its input"});for(let T of l.unmoved)i.push({code:`generatorPin/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`the generator or template pin cannot be moved (${T.reason}) \u2014 edit the node by hand`});let d=vC(o);o=d.graph;for(let T of d.moved)r.push({nodeId:T,message:"setFlag `target` / `flagKey` / `value` moved into its inputs"});for(let T of d.unmoved)i.push({code:`setFlag/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`the setFlag properties cannot be moved (${T.reason}) \u2014 edit the node by hand`});let c=$C(o);o=c.graph;for(let T of c.moved)r.push({nodeId:T,message:"scalar settings moved into inputs"});for(let T of c.unmoved)i.push({code:`scalar/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`\`${T.key}\` cannot be moved into an input (${T.reason}) \u2014 edit the node by hand`});let u=DC(o);o=u.graph;for(let T of u.moved)r.push({nodeId:T,message:"payment note moved into `inputs.reason` / retired sample document deleted"});for(let T of u.unmoved)i.push({code:`nodeConfig/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`\`${T.key}\` cannot be moved into an input (${T.reason}) \u2014 edit the node by hand`});let p=lF(o);o=p.graph;for(let T of p.moved){let q=o.nodes.find(Z=>Ba(Z)&&Z.id===T),G=q?.inputs?.documentTemplate,ae=G?.kind==="literal"&&typeof G.value=="string"?G.value:null;r.push({nodeId:T,message:q!==void 0&&"templateStamp"in q&&ae!==null?`template parameters moved onto \`templateStamp\` / cockpit list into cells \u2014 the record \`${ae}\` must declare the same parameters (tenant catalog \`documentTemplates[].parameters\` / \`templates:setParameters\`) before publish, else [governedDocument/templateWithoutParameters]`:"cockpit list moved into `{ kind: 'cockpit' }` cells"})}for(let T of p.reports)r.push({nodeId:T.nodeId,message:`cockpit field \`${T.key??""}\` deleted (${T.reason}: ${T.reason==="unknownKey"?"the stamp declares no such parameter":T.reason==="processSource"?"the case fills it itself":"the input already holds a cell"})`});for(let T of p.unmoved)i.push({code:`templateStamp/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:T.reason==="noStamp"?"the cockpit list cannot be judged: the node carries no parameter stamp \u2014 run `offer workflow restamp-pins` against the environment, then upgrade again":T.reason==="templateAndStamp"?"the node carries both `template` and `templateStamp` \u2014 delete one by hand":"`template` is no object \u2014 edit the node by hand"});let h=N_(o);o=h.graph;for(let T of h.moved)r.push({nodeId:T,message:"start node: own `outcomes` / `event` / `effect` deleted (the node type declares its outcome)"});for(let T of h.unmoved)i.push({code:`eventTrigger/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`the start node cannot be reduced to its type's outcome (${T.reason}) \u2014 edit the node by hand`});let y=O_(o,t.semantics);o=y.graph;for(let T of y.written){if(T.source==="formerDefault"){r.push({nodeId:T.nodeId,message:`outcome \`${T.outcomeId}\`: semantic "${T.semantic}" (DEFAULT \u2014 the meaning it ran with; the retired id parser knew no other)`,defaulted:{answer:"semantic",answerKey:`${T.nodeId}.${T.outcomeId}`,value:T.semantic}});continue}r.push({nodeId:T.nodeId,message:`outcome \`${T.outcomeId}\`: semantic "${T.semantic}" (${T.source==="answer"?"answered":"the meaning the retired id parser gave this id"})`})}for(let T of y.refused)i.push({code:T.answer===void 0?"outcome/formerMeaningNotAllowed":"outcome/semanticNotAllowed",nodeId:T.nodeId,answer:"semantic",answerKey:`${T.nodeId}.${T.outcomeId}`,candidates:T.allowed,message:T.answer===void 0?`${T.nodeType} outcome \`${T.outcomeId}\` ran as "${Lw(T.outcomeId)??""}", which a ${T.nodeType} outcome may no longer carry \u2014 say which one it is`:`${T.nodeType} outcome \`${T.outcomeId}\`: "${T.answer}" is not a meaning a ${T.nodeType} outcome may carry`});for(let T of y.invalid)i.push({code:"outcome/semanticInvalid",nodeId:T.nodeId,answer:"edit",candidates:Ot,message:`outcome \`${T.outcomeId}\` carries the semantic "${T.value}", which is no meaning \u2014 edit it`});let b=L_(o,n.selection,t.waitlistPolicy);o=b.graph;for(let T of b.moved){let q=T.policy.waitlistOrder;r.push({nodeId:T.nodeId,message:`waitlist policy into inputs: ${X3(T.policy)} (${T.source==="answer"?"answered":T.source==="manifest"?"from manifest `selection`":"DEFAULT \u2014 the manifest stated no `selection.waitlistOrder`; the former code default it ran with"})`,...T.source==="formerDefault"?{defaulted:{answer:"waitlistPolicy",answerKey:T.nodeId,value:q}}:{}})}for(let T of b.refused)i.push({code:`waitlist/${T.reason}`,nodeId:T.nodeId,answer:"waitlistPolicy",answerKey:T.nodeId,candidates:sr,message:"manifest `selection` is malformed \u2014 say the queue order of this waitlist"});let k=VC(o);o=k.graph;for(let T of k.moved)r.push({nodeId:T,message:"payment: `inputs.settlement` \u2192 `inputs.mode` (separate \u2192 manual)"});for(let T of k.refused)i.push({code:`collectPayment/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:T.reason==="bothCells"?"the payment node carries both `inputs.settlement` and `inputs.mode` \u2014 delete `settlement` by hand":"`inputs.settlement` is no literal online | separate \u2014 set `inputs.mode` by hand"});let v=zC(o);o=v.graph;for(let T of v.moved)r.push({nodeId:T.split(".")[0],message:`\`formView\` \u2192 \`view\` (${T})`});for(let T of v.refused){let q=T.taskKey===void 0?"the node":`task "${T.taskKey}"`;i.push({code:`view/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:T.reason==="bothFields"?`${q} carries both \`formView\` and \`view\` \u2014 delete \`formView\` by hand`:`${q}'s \`formView\` is no { form, key } \u2014 set \`view\` by hand`})}let $=ZC(o);o=$.graph;for(let T of $.moved)r.push({nodeId:T.nodeId,message:`\`assign.${T.templateKey}\`: team \u2192 rule list`});for(let T of $.refused)i.push({code:"assign/shape",nodeId:T.nodeId,answer:"edit",message:`\`assign.${T.templateKey}\` is neither a team key nor a rule list \u2014 set it by hand`});let R=eP(o);o=R.graph;for(let T of R.moved)r.push({nodeId:T.split(".")[0],message:`documents: \`document:$node.<node>.document\` \u2192 \`artifact:<slot>\` (${T})`});for(let T of R.refused)i.push({code:`workItems/${T.reason}`,nodeId:T.nodeId,answer:"edit",message:`task "${T.taskKey}" links a document whose node declares no single slot \u2014 name the slot as \`artifact:<slot>\` by hand`});if(LC(o)){let T=MC(o,t.payee);o=T.graph;for(let q of T.set)r.push({nodeId:q.nodeId,message:`online payment: payee "${q.payee}" (answered)`});for(let q of T.refused)i.push({code:"collectPayment/payeeMissing",nodeId:q,answer:"payee",answerKey:q,message:"an online payment names the Tr\xE4ger its money goes to \u2014 say its key (a `legal_entities.configKey` of the tenant)"})}for(let T of kb(o).malformed)i.push({code:"submitReceipt/notificationsMalformed",nodeId:T,answer:"edit",message:"the form node's `notifications` is no record \u2014 edit it by hand"});let I=uF(o);o=I.graph;for(let T of I.bound)r.push({nodeId:T,message:"submit receipt bound to `notifications.submitted` (`applicant.applicationSubmitted`, sent by code before)"});let D=hF(o);o=D.graph;for(let T of D.set)r.push({nodeId:T,message:"review: `whenNothingOwed` = park (every review parked before the input existed)"});for(let T of yF(o).malformed)i.push({code:"appointmentLetters/notificationsMalformed",nodeId:T,answer:"edit",message:"the node's `notifications` is no record \u2014 edit it by hand"});let F=wF(o);o=F.graph;for(let T of F.bound){let q=T.indexOf(".");r.push({nodeId:T.slice(0,q),message:`appointment letter bound to \`notifications.${T.slice(q+1)}\` (the standard letter, sent by code before)`})}let C=Up(o).filter(T=>!T.hasTeam);for(let T of C)i.push({code:"task/userWithoutTeam",nodeId:T.nodeId,answer:"edit",message:`task \`${T.taskKey}\` names a fixed person and no team \u2014 give it a team (\`assign.group\`) by hand`});let x=nP(o);o=x.graph;for(let T of x.dropped.filter(q=>q.hasTeam))r.push({nodeId:T.nodeId,message:`task \`${T.taskKey}\`: \`assign.userId\` deleted (the team holds the row)`});let N=oF(o,{bindings:!0});o=N.graph;for(let T of N.dropped){if(!T.binding){r.push({nodeId:T.nodeId,message:`input \`${T.key}\` deleted (no slot of the node declares it)`});continue}r.push({nodeId:T.nodeId,message:`input \`${T.key}\` deleted (DEFAULT \u2014 a binding no slot declares: no slot handed its value to the node, but the readiness gate waited for it; the node no longer waits for that value)`,defaulted:{answer:"undeclaredBinding",answerKey:`${T.nodeId}.${T.key}`,value:"deleted"}})}return{graph:o,changes:r,refusals:i}}s(AF,"upgradeGraph");function X3(e){return`waitlistOrder=${e.waitlistOrder}`}s(X3,"formatPolicy");function _r(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(_r,"isObject");var TF="admission.generic",RF=Object.keys(vp).filter(e=>e!=="label");function $F(e){return(Array.isArray(e.testScenarios)?e.testScenarios:[]).filter(t=>_r(t)&&"env"in t).map(t=>String(t.id))}s($F,"sampledScenarioIds");function EF(e){return _r(e.smartforms)?Object.entries(e.smartforms):[]}s(EF,"smartformEntries");function e5(e){let n=[];EF(e.index).some(([,i])=>_r(i)&&"outcomeFnRef"in i)&&n.push({de:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml",en:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml"});let t=Object.keys(e.manifest).filter(i=>Object.hasOwn(Xl,i));if(t.length>0){let i=t.map(o=>`\`${o}\``).join(", ");n.push({de:`manifest.json mit ${i}`,en:`manifest.json with ${i}`})}Object.values(e.smartforms??{}).some(i=>RF.some(o=>o in i))&&n.push({de:"Formulardateien mit `id` / `outcomeIds` / `schoolSlug`",en:"form files with `id` / `outcomeIds` / `schoolSlug`"}),Object.values(e.smartforms??{}).some(i=>$F(i).length>0)&&n.push({de:"Testszenarien mit Umgebungs-Sample (`testScenarios[].env`)",en:"test scenarios with an environment sample (`testScenarios[].env`)"});let r=e.workflow;return r!==void 0&&(_r(r.progressWiring)&&"layoutId"in r.progressWiring&&n.push({de:"`progressWiring.layoutId`",en:"`progressWiring.layoutId`"}),n.push(...SF(r.graph).map(i=>i.what))),n}s(e5,"legacyBundleShapes");function Km(e,n){let t=e5(e);t.length!==0&&de("BUNDLE_NEEDS_UPGRADE",{de:`offer: ${n} stammt aus einem \xE4lteren Bundle-Format (${t.map(r=>r.de).join("; ")}). Zuerst \`plexus-cli offer upgrade --dir <Bundle>\` ausf\xFChren (Probelauf, beantwortet die offenen Fragen), dann mit \`--write\` schreiben und erneut pr\xFCfen.`,en:`offer: ${n} is in an older bundle format (${t.map(r=>r.en).join("; ")}). Run \`plexus-cli offer upgrade --dir <bundle>\` first (a dry run that asks what it cannot decide), then write with \`--write\` and validate again.`})}s(Km,"assertBundleCurrent");function qm(e){let n=s(t=>Array.isArray(t)?t.map(n):_r(t)?Object.fromEntries(Object.keys(t).sort().map(r=>[r,n(t[r])])):t,"sort");return JSON.stringify(n(e))}s(qm,"canonical");function IF(e,n={}){let t=[],r=[],i=e.index,o=EF(i);if(o.some(([,u])=>_r(u)&&Object.keys(u).length>0)){let u={};for(let[p,h]of o){if(!_r(h)||Object.keys(h).length===0){u[p]=h;continue}let{outcomeFnRef:y,...b}=h;if(Object.keys(b).length>0||y!==void 0&&y!==TF){r.push({file:"bundle.yaml",code:"index/smartformEntry",answer:"edit",message:`smartforms.${p} carries ${Object.keys(h).map(k=>`\`${k}\``).join(", ")} \u2014 only \`outcomeFnRef: ${TF}\` is known; edit the entry to {} by hand`}),u[p]=h;continue}t.push({file:"bundle.yaml",message:`smartforms.${p}.outcomeFnRef deleted (a form routes by its own declared outcomes)`}),u[p]={}}i={...i,smartforms:u}}let a={},l=e.workflow,d;for(let[u,p]of Object.entries(e.manifest)){if(u==="selection"){d=p,t.push({file:"manifest.json",message:"`selection` deleted (its queue policy goes to the waitlist node's inputs; release strategy and deadline were read by nothing)"});continue}if(u==="progressLayout"){l===void 0?t.push({file:"manifest.json",message:"`progressLayout` deleted (the bundle has no workflow it could belong to)"}):l.progressLayout===void 0?(l={...l,progressLayout:p},t.push({file:"manifest.json",message:"`progressLayout` moved to workflow.json `progressLayout`"})):qm(l.progressLayout)===qm(p)?t.push({file:"manifest.json",message:"`progressLayout` deleted (workflow.json carries the same layout)"}):(r.push({file:"manifest.json",code:"manifest/progressLayoutTwice",answer:"edit",message:"`progressLayout` differs from workflow.json `progressLayout` \u2014 keep one by hand"}),a[u]=p);continue}let h=Object.hasOwn(Xl,u)?Xl[u]:void 0;if(h===void 0){r.push({file:"manifest.json",code:"manifest/unknownKey",answer:"edit",message:`unknown key \`${u}\` \u2014 manifest.json carries no key; decide by hand where it belongs`}),a[u]=p;continue}t.push({file:"manifest.json",message:`\`${u}\` deleted (${h.en})`})}if(l!==void 0){if(_r(l.progressWiring)&&"layoutId"in l.progressWiring){let{layoutId:p,...h}=l.progressWiring;l={...l,progressWiring:h},t.push({file:"workflow.json",message:"`progressWiring.layoutId` deleted (the layout is the workflow's own)"})}let u=l.graph;if(_r(u)&&Array.isArray(u.nodes)){let p=AF(u,{selection:d,answers:n});l={...l,graph:p.graph},t.push(...p.changes.map(h=>({...h,file:"workflow.json"}))),r.push(...p.refusals.map(h=>({...h,file:"workflow.json"})))}else r.push({file:"workflow.json",code:"workflow/graphShape",answer:"edit",message:"`graph` is no object with a node list"})}let c=e.smartforms;if(c!==void 0){let u={};for(let[p,h]of Object.entries(c)){let y={...h},b=`smartforms/${p}.json`;for(let v of RF)if(v in h){if(v==="outcomeIds"){let $=Array.isArray(h.outcomes)?h.outcomes.map(R=>_r(R)?R.id:void 0):[];if(qm([...Array.isArray(h.outcomeIds)?h.outcomeIds:[]].map(String).sort())!==qm($.map(String).sort())){r.push({file:b,code:"smartform/outcomeIdsDiffer",answer:"edit",message:"`outcomeIds` differs from the ids of `outcomes[]` \u2014 reconcile them by hand"});continue}}delete y[v],t.push({file:b,message:`\`${v}\` deleted (${vp[v].en})`})}let k=$F(h);k.length>0&&(y.testScenarios=h.testScenarios.map(v=>{if(!_r(v)||!("env"in v))return v;let{env:$,...R}=v;return R}),t.push({file:b,message:`\`env\` deleted from test scenario(s) ${k.join(", ")} (a scenario fits every grade and school year; scenarios that only differed by stage are now duplicates \u2014 delete them)`})),u[p]=y}c=u}return{bundle:{index:i,manifest:a,...c!==void 0?{smartforms:c}:{},...l!==void 0?{workflow:l}:{}},changes:t,refusals:r}}s(IF,"upgradeOfferBundle");var n5={createManifest:S.workflow.createManifest,publishManifest:S.workflow.publishManifest,publishOfferInternal:S.workflow.publishOfferInternal,publishOfferExternal:S.workflow.publishOfferExternal,getOfferPublishState:S.workflow.getOfferPublishState,upsertCustomField:S.admission.upsertCustomField,upsertDerivedAttributeRule:S.admission.upsertDerivedAttributeRule,createSmartForm:S.forms.createSmartForm,getSmartFormBySlug:S.forms.getSmartFormBySlug,saveSmartFormDraft:S.forms.saveSmartFormDraft,publishSmartForm:S.forms.publishSmartForm,createWorkflow:S.workflow.createWorkflow,getWorkflowGraph:S.workflow.getWorkflowGraph,saveWorkflowDraft:S.workflow.saveWorkflowDraft,publishWorkflow:S.workflow.publishWorkflow},QSe={createManifest:ut.workflow.createManifestInternal,publishManifest:ut.workflow.publishManifestInternal,publishOfferInternal:ut.workflow.publishOfferInternalInternal,publishOfferExternal:ut.workflow.publishOfferExternalInternal,getOfferPublishState:ut.workflow.getOfferPublishStateInternal,upsertCustomField:ut.admission.upsertCustomFieldInternal,upsertDerivedAttributeRule:ut.admission.upsertDerivedAttributeRuleInternal,createSmartForm:ut.forms.createSmartFormInternal,getSmartFormBySlug:ut.forms.getSmartFormBySlugInternal,saveSmartFormDraft:ut.forms.saveSmartFormDraftInternal,publishSmartForm:ut.forms.publishSmartFormInternal,createWorkflow:ut.workflow.createWorkflowInternal,getWorkflowGraph:ut.workflow.getWorkflowGraphInternal,saveWorkflowDraft:ut.workflow.saveWorkflowDraftInternal,publishWorkflow:ut.workflow.publishWorkflowInternal};function Sb(e,n){for(let[t,r]of Object.entries(e.smartforms??{})){(r===null||typeof r!="object"||Array.isArray(r))&&de("INVALID",{de:`offer: ${n}: smartforms.${t} muss eine leere Zuordnung ({}) sein.`,en:`offer: ${n}: smartforms.${t} must be an empty mapping ({}).`});let i=Object.keys(r);if(i.length===0)continue;let o=i.map(l=>`\`${l}\``).join(", "),a=i.includes("outcomeFnRef");de("INVALID",{de:`offer: ${n}: smartforms.${t} enth\xE4lt unbekannte Schl\xFCssel ${o} \u2014 der Eintrag muss leer sein ({}).${a?" `outcomeFnRef` geh\xF6rt nicht mehr zum Bundle-Format: ein Formular entscheidet \xFCber seine eigenen Ergebnisse. Die Zeile l\xF6schen.":""}`,en:`offer: ${n}: smartforms.${t} carries unknown key(s) ${o} \u2014 the entry must be empty ({}).${a?" `outcomeFnRef` is no longer part of the bundle format: a form routes by its own declared outcomes. Delete the line.":""}`})}}s(Sb,"assertSmartformEntries");function OF(e){let n=s(t=>Array.isArray(t)?t.map(n):t&&typeof t=="object"?Object.fromEntries(Object.keys(t).sort().map(r=>[r,n(t[r])])):t,"sort");return JSON.stringify(n(e))}s(OF,"canonicalJson");function _F(e,n){return n==null?!0:OF(e)!==OF(n)}s(_F,"changed");async function CF(e,n,t,r={},i=n5){let{index:o}=n;Km({index:o,manifest:n.manifest,...n.smartforms!==void 0?{smartforms:n.smartforms}:{},...n.workflow!==void 0?{workflow:n.workflow}:{}},`bundle of ${o.slugs.manifest}`),Sb(o,`bundle of ${o.slugs.manifest}`);let a=bp(n.manifest);a.length>0&&de("INVALID",{de:`offer: manifest.json von ${o.slugs.manifest} ist ung\xFCltig:
|
|
11656
11656
|
- ${a.join(`
|
|
11657
11657
|
- `)}`,en:`offer: manifest.json of ${o.slugs.manifest} is invalid:
|
|
11658
11658
|
- ${a.join(`
|
|
@@ -11923,7 +11923,7 @@ ${t.length} unusable ${o}:
|
|
|
11923
11923
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
11924
11924
|
`),i.length>0&&this.context.stdout.write(` ${i.length} without any login account \u2014 plexus-cli platform users provision --tenant <slug> --email <email> --name <name>
|
|
11925
11925
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
11926
|
-
`);return t.length>0?1:0}},q$=class extends vr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=E.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(S.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function uG(e,n){if(e===n)throw new g("Pass exactly one of --on or --off.");return e}s(uG,"requireOnOff");var fG=[x$,S$,A$,T$,R$,$$,E$,I$,O$,_$,zu,C$,P$,N$,D$,F$,L$,M$,q$];function pG(e){return e.de??e.en??Object.values(e)[0]??""}s(pG,"titleDe");function hne(e){return{id:e._id,kind:e.kind,status:e.status,title:pG(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(hne,"row");var gne=["id","kind","status","title","assignee","group","outcome"],V$=class extends P{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=E.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(S.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:ne(this.application,"application")}:{},...this.group?{queueGroupId:ne(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:ne(this.assignee,"user")}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(hne),gne),0}},B$=class extends P{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=E.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(S.workItems.get,{client:t,workItemId:ne(this.workItemId,"work item")});if(r===null)throw new g(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:pG(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},U$=class extends P{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=E.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(S.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:ne(this.application,"application")}:{},...this.group?{queueGroupId:ne(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:ne(this.assignee,"user")}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},G$=class extends P{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=E.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(S.workItems.complete,{client:t,workItemId:ne(this.workItemId,"work item"),...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},z$=class extends P{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=E.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(S.workItems.assign,{client:t,workItemId:ne(this.workItemId,"work item"),...this.user?{userId:ne(this.user,"user")}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},mG=[V$,B$,U$,G$,z$];var yl=[...KO,...mL,...SL,...E0,...C0,...$0,...iM,...uM,...cM,...dG,...fG,...lG,...YB,...eU,...ZF,...eM,...JU,...LO,...g_,...LF,...mM,...pM,...yM,...bM,...Z0,...M0,...mG,...jj,...OV,...zB,..._V,...NU,...jU,...nU,...cU,...pU,...yU,...kU,...UU,...nG,...s_];for(let e of yl){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:XE(e.usage.category,n.join(" "))})}var hG="0.1.313";function W$(){return yl.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=HE[Mo(t)];return{path:t,effect:gi(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(W$,"plexusCommandCatalog");import Ps from"node:path";function yne(e){let n=pn()?.workspaceRoot??process.cwd(),t=Ps.resolve(n,e),r=Ps.relative(n,t);if(Ps.isAbsolute(e)||r===".."||r.startsWith(`..${Ps.sep}`))throw new g("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(yne,"workspacePath");function wne(e){let{absolute:n,relative:t}=yne(e.path??".");if(e.operation==="list"){if(!Te(n))return{files:[]};let r=[],i=s(o=>{for(let a of jr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new g("plexus: workspace symlinks are not supported.");let l=Ps.join(o,a.name);if(a.isDirectory()?i(l):r.push(Ps.relative(n,l)),r.length>200)throw new g("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new g("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=Ce(n);if(r.length>10*1024*1024)throw new g("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new g("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new g("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new g("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new g("plexus: the edited file exceeds 10 MB.");return Je(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new g("plexus: file content is missing or too large.");return Wn(Ps.dirname(n),{recursive:!0}),Je(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Ls(n),{path:t,removed:!0};throw new g("plexus: unknown workspace operation.")}s(wne,"plexusWorkspace");function gG(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new g("plexus: tool input must be an object.");let i=r,o=Hl[t];if(!o||!Object.hasOwn(Hl,t))throw new g("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new g("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new g("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(lw,i.path))throw new g("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:lw[i.path],skillHash:rp}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new g("plexus: invalid workspace input.");return wne(i)},"executePlexusAgentTool")}s(gG,"createPlexusAgentToolExecutor");var kne=["--env","--tenant"];function yG(e){let n=[],t=[];for(let r=0;r<e.length;r++){let i=e[r];if(i==="--"){n.push(...e.slice(r));break}let o=kne.find(l=>i===l||i.startsWith(`${l}=`)),a=e[r+1];o===void 0?n.push(i):i!==o?t.push({name:o,value:i.slice(o.length+1)}):a!==void 0&&!a.startsWith("-")?(t.push({name:o,value:a}),r++):n.push(i)}return{rest:n,given:t}}s(yG,"splitGlobalOptions");function wG(e,n){let t=ky(e)==="offline";if(t&&gi(e)==="read")return n.map(i=>`plexus-cli: ${i.name} ${i.value} has no effect: \`${e}\` runs offline (this CLI's own files, no deployment).
|
|
11926
|
+
`);return t.length>0?1:0}},q$=class extends vr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=E.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(S.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function uG(e,n){if(e===n)throw new g("Pass exactly one of --on or --off.");return e}s(uG,"requireOnOff");var fG=[x$,S$,A$,T$,R$,$$,E$,I$,O$,_$,zu,C$,P$,N$,D$,F$,L$,M$,q$];function pG(e){return e.de??e.en??Object.values(e)[0]??""}s(pG,"titleDe");function hne(e){return{id:e._id,kind:e.kind,status:e.status,title:pG(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(hne,"row");var gne=["id","kind","status","title","assignee","group","outcome"],V$=class extends P{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=E.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(S.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:ne(this.application,"application")}:{},...this.group?{queueGroupId:ne(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:ne(this.assignee,"user")}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(hne),gne),0}},B$=class extends P{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=E.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(S.workItems.get,{client:t,workItemId:ne(this.workItemId,"work item")});if(r===null)throw new g(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:pG(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},U$=class extends P{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=E.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(S.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:ne(this.application,"application")}:{},...this.group?{queueGroupId:ne(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:ne(this.assignee,"user")}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},G$=class extends P{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=E.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(S.workItems.complete,{client:t,workItemId:ne(this.workItemId,"work item"),...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},z$=class extends P{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=E.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(S.workItems.assign,{client:t,workItemId:ne(this.workItemId,"work item"),...this.user?{userId:ne(this.user,"user")}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},mG=[V$,B$,U$,G$,z$];var yl=[...KO,...mL,...SL,...E0,...C0,...$0,...iM,...uM,...cM,...dG,...fG,...lG,...YB,...eU,...ZF,...eM,...JU,...LO,...g_,...LF,...mM,...pM,...yM,...bM,...Z0,...M0,...mG,...jj,...OV,...zB,..._V,...NU,...jU,...nU,...cU,...pU,...yU,...kU,...UU,...nG,...s_];for(let e of yl){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:XE(e.usage.category,n.join(" "))})}var hG="0.1.315";function W$(){return yl.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=HE[Mo(t)];return{path:t,effect:gi(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(W$,"plexusCommandCatalog");import Ps from"node:path";function yne(e){let n=pn()?.workspaceRoot??process.cwd(),t=Ps.resolve(n,e),r=Ps.relative(n,t);if(Ps.isAbsolute(e)||r===".."||r.startsWith(`..${Ps.sep}`))throw new g("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(yne,"workspacePath");function wne(e){let{absolute:n,relative:t}=yne(e.path??".");if(e.operation==="list"){if(!Te(n))return{files:[]};let r=[],i=s(o=>{for(let a of jr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new g("plexus: workspace symlinks are not supported.");let l=Ps.join(o,a.name);if(a.isDirectory()?i(l):r.push(Ps.relative(n,l)),r.length>200)throw new g("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new g("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=Ce(n);if(r.length>10*1024*1024)throw new g("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new g("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new g("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new g("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new g("plexus: the edited file exceeds 10 MB.");return Je(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new g("plexus: file content is missing or too large.");return Wn(Ps.dirname(n),{recursive:!0}),Je(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Ls(n),{path:t,removed:!0};throw new g("plexus: unknown workspace operation.")}s(wne,"plexusWorkspace");function gG(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new g("plexus: tool input must be an object.");let i=r,o=Hl[t];if(!o||!Object.hasOwn(Hl,t))throw new g("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new g("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new g("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(lw,i.path))throw new g("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:lw[i.path],skillHash:rp}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new g("plexus: invalid workspace input.");return wne(i)},"executePlexusAgentTool")}s(gG,"createPlexusAgentToolExecutor");var kne=["--env","--tenant"];function yG(e){let n=[],t=[];for(let r=0;r<e.length;r++){let i=e[r];if(i==="--"){n.push(...e.slice(r));break}let o=kne.find(l=>i===l||i.startsWith(`${l}=`)),a=e[r+1];o===void 0?n.push(i):i!==o?t.push({name:o,value:i.slice(o.length+1)}):a!==void 0&&!a.startsWith("-")?(t.push({name:o,value:a}),r++):n.push(i)}return{rest:n,given:t}}s(yG,"splitGlobalOptions");function wG(e,n){let t=ky(e)==="offline";if(t&&gi(e)==="read")return n.map(i=>`plexus-cli: ${i.name} ${i.value} has no effect: \`${e}\` runs offline (this CLI's own files, no deployment).
|
|
11927
11927
|
`);let r=[...new Set(n.map(i=>i.name))].join(", ");throw new g(t?`\`${e}\` does not take ${r}: it never targets a chosen deployment \u2014 drop the option.`:`\`${e}\` does not take ${r}.`)}s(wG,"globalOptionNotes");var Ug=gG({inspectCommand:bG,executeCommand:vG});function Gg(){let e=new js({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:hG});e.register(Il.HelpCommand),e.register(Il.VersionCommand);for(let r of yl)e.register(r);function n(r,i){try{return{command:e.process(r,i),notes:[]}}catch(o){let{rest:a,given:l}=yG(r);if(l.length===0)throw o;let d;try{d=e.process(a,i)}catch{throw o}if(!yl.some(u=>d instanceof u))return{command:d,notes:[]};let c=d.path.join(" ");if(!W$().some(u=>u.path===c))throw o;return{command:d,notes:wG(c,l)}}}s(n,"resolve");async function t(r,i){let o=i.stderr??process.stderr,a;try{a=n(r,i)}catch(l){return o.write(e.error(l,{colored:!1})),2}for(let l of a.notes)o.write(l);return xne(a.command,o),e.run(a.command,i)}return s(t,"run"),{process(r,i){return n(r,i).command},run:t,async runExit(r,i){process.exitCode=await t(r,i)}}}s(Gg,"createPlexusCli");function xne(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&Pl[t]===r&&cn(n,t,r),t in Pl&&gi(t)==="confirm"&&!Nl(e)&&n.write(`plexus-cli: \`${Pl[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11928
11928
|
`)}s(xne,"noteRetiredPath");function bG(e){let n=Gg().process(bl(e),{executePlexusAgentTool:Ug}),t=n.path.join(" ");if(t.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=W$().find(l=>l.path===t);if(!r){if(t===""||t==="--help"||t==="--version")return{path:t,writes:!1,host:"shared"};throw new Error(`plexus: command ${t} has no host classification.`)}let i=n,o=r.effect==="callKind"?wh(Xa(el),i.fn??"",i.kind):void 0,a=Ef(t,{confirm:Nl(n),callKind:o});return{...r,writes:a}}s(bG,"inspectPlexusCommand");async function vG(e,n){if(n)return eE(n,()=>vG(e));if(!Array.isArray(e.argv)||e.argv.length===0||e.argv.length>128||e.argv.some(l=>typeof l!="string"||l.length>128e3)||(e.stdin?.length??0)>1e6)throw new Error("plexus: invalid command invocation.");let t="",r="",i=Gg();if(pn()){let l=bG(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(bl(e.argv),{executePlexusAgentTool:Ug,stdin:vne.from(e.stdin===void 0?[]:[e.stdin]),stdout:new kG({write(l,d,c){t+=String(l),c()}}),stderr:new kG({write(l,d,c){r+=String(l),c()}})}),stdout:t,stderr:r}}s(vG,"executePlexusCommand");Z$();oE({source:Sne.join(import.meta.dirname,"skill")});Gg().runExit(bl(process.argv.slice(2)),{executePlexusAgentTool:Ug});
|
|
11929
11929
|
//# sourceMappingURL=cli.mjs.map
|