@smartkomm/plexus-cli 0.1.338 → 0.1.340
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 +2 -2
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -11722,7 +11722,7 @@ The link is valid for 30 days and answers in your name. Please do not forward th
|
|
|
11722
11722
|
|
|
11723
11723
|
{{taskLink}}`,en:`Go straight to the task:
|
|
11724
11724
|
|
|
11725
|
-
{{taskLink}}`}}]};var ib=[JC,eD,tD,nD,rD,iD,sD,oD,aD,PC,CC,DC,FC,BC,UC,GC,LC,zC,MC,qC,KC,jC,VC,fD,pD,mD,ID,OD,_D,yD,CD,DD,FD,wD,kD,bD,xD,SD,QC,ZC,lD,dD,cD,IC,OC,_C,NC];function ob(e){let t=ib.find(n=>n.id===e);return t===void 0&&C(`notifications: unknown letter "${e}"`),t}s(ob,"letterDefFor");function sb(e){return ib.some(t=>t.id===e)}s(sb,"hasLetterDef");function ab(e,t){return t===void 0?!0:Jp(e,t)}s(ab,"letterArgCompatible");function Td(e){return e==="localizedText"?{de:"Text in jeder Sprache (localizedText)",en:"Text in every language (localizedText)"}:{de:`${hn(e)} (${e})`,en:`${hn(e)} (${e})`}}s(Td,"letterArgTypeLabel");function LD(e){let t=new Map,n=s((r,i)=>{let o=t.get(r);o===void 0?t.set(r,[i]):o.push(i)},"add");for(let r of e.args)n(r.key,{source:`Ereignis "${e.id}"`,type:r.type,always:r.required===!0});for(let r of RC)n(r.key,{source:"Kontext des Versands",type:r.type,always:!0});return t}s(LD,"eventArgSources");function MD(e,t){let n=e.type===void 0?[...t]:t.filter(r=>ab(r.type,e.type));if(n.length>1)return{status:"ambiguous",matches:n};if(n.length===1){let r=n[0];return!e.required||r.always?{status:"resolved",source:r}:{status:"sometimes",source:r}}return e.required?{status:"missing",rejected:[...t]}:{status:"unused"}}s(MD,"resolveLetterParam");var lb=["booked","rescheduled","cancelled"],z6={booked:"admission.appointmentBooked",rescheduled:"admission.appointmentRescheduled",cancelled:"admission.appointmentCancelled"},KD=":";function jD(e,t){return`${e}${KD}${t}`}s(jD,"appointmentEventId");function W6(e){let t=e.lastIndexOf(KD);if(t<=0)return null;let n=e.slice(t+1);return lb.includes(n)?{taskKey:e.slice(0,t),kind:n}:null}s(W6,"parseAppointmentEventId");var qD={booked:{de:"Termin vereinbart",en:"Appointment booked"},rescheduled:{de:"Termin verschoben",en:"Appointment moved"},cancelled:{de:"Termin abgesagt",en:"Appointment cancelled"}};function Na(e){return Array.isArray(e.tasks)?e.tasks.filter(t=>typeof t?.key=="string"&&t.result?.kind==="appointment"):[]}s(Na,"appointmentTasksOf");function Y6(e){return lb.map(t=>({id:jD(e.key,t),label:{de:`${qD[t].de} \u2013 \u201E${e.title.de}\u201C`,en:`${qD[t].en} \u2013 \u201C${e.title.en}\u201D`},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"bookingId",type:"string",required:!0}]}))}s(Y6,"appointmentTaskEvents");function VD(e,t){let n=t.notificationEvents?.(e)??[],r=Na(e).flatMap(Y6);return r.length===0?n:[...n,...r]}s(VD,"nodeNotificationEvents");function H6(e){return Object.fromEntries(lb.map(t=>[jD(e,t),{templateId:z6[t]}]))}s(H6,"defaultAppointmentBindings");function J6(e,t){if(e===void 0)return{notifications:e,dropped:[]};let n=[],r={};for(let[i,o]of Object.entries(e))W6(i)?.taskKey===t?n.push(i):r[i]=o;return n.length===0?{notifications:e,dropped:n}:{notifications:Object.keys(r).length===0?void 0:r,dropped:n}}s(J6,"withoutAppointmentBindings");function km(e,t,n){let r=new Set(Na(t).map(d=>d.key)),i=new Set(Na(n).map(d=>d.key)),o=e,a=[];for(let d of r){if(i.has(d))continue;let c=J6(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(H6(d)))o?.[c]===void 0&&(o={...o??{},[c]:u},l.push(c));return{notifications:o,bound:l,dropped:a}}s(km,"syncAppointmentBindings");function Q6(e){return e.kind==="task"&&!("title"in e)}s(Q6,"isLegacyFreeTodoContext");function db(e){let{context:t}=e;if(Q6(t)&&C(`[workItems/legacyFreeTodo] work_item ${e._id} is a free to-do in its former shape \u2014 run migrations:freeTodosToContext`),t.kind==="task")return{...e,context:t,kind:"task",createdVia:"human",partyId:t.partyId};let{anchor:n,task:r,kind:i,title:o,description:a,...l}=t,d=n.scope==="node"?{nodeId:n.nodeId,templateKey:n.templateKey,gatesNode:n.gatesNode,blocks:n.blocks}:n.scope==="application"?{scope:"application",templateKey:n.templateKey}:n.scope==="crossNode"?{scope:"application",nodeId:n.nodeId,templateKey:n.templateKey,blocks:n.blocks}:{};return{...e,context:t,...l,...d,...r??{},kind:i}}s(db,"readWorkItem");async function Pa(e,t){let n;if(t.nodeId!==void 0){let r=t.nodeId;n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",i=>i.eq("context.applicationId",t.applicationId).eq("context.anchor.nodeId",r)).collect()}else if(t.isOpen!==void 0){let r=t.isOpen;n=await e.db.query("work_items").withIndex("by_applicationId_and_isOpen",i=>i.eq("context.applicationId",t.applicationId).eq("isOpen",r)).collect()}else n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",r=>r.eq("context.applicationId",t.applicationId)).collect();return n.filter(r=>t.isOpen===void 0||r.isOpen===t.isOpen).map(db)}s(Pa,"listWorkItemsForApplication");var lbe=m.union(m.literal("approved"),m.literal("rejected")),Rd=new Set(["task","approval"]);function X6(e,t){switch(e){case"task":return t?.gatesNode===!0&&C("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:t?.gatesNode??!0};default:C(`expandComposedTask: unknown composed-task kind ${JSON.stringify(e)} \u2014 authorable: ${[...Rd].join(", ")}`)}}s(X6,"expandComposedTask");for(let e of["task","approval"]){let t=X6(e);t.kind==="approval"!=(t.isApproval===!0)&&C(`composed-task kind "${e}": isApproval must be present iff kind === 'approval'`)}var BD=fo,xo=`${BD}.`,e3=new Set(["text","number","date","boolean","option","edge"]);function cb(e,t){let n=e[t];return n===void 0&&C(`[env/unknownKey] no environment key '${t}'`),typeof n=="string"?null:Object.keys(n)}s(cb,"contextFields");function UD(e,t){return Object.hasOwn(e,t)}s(UD,"isContextKey");function GD(e){let t=[];for(let n of Object.keys(e)){let r=cb(e,n);if(r===null)t.push(n);else for(let i of r)t.push(`${n}.${i}`)}return t}s(GD,"leafPaths");function $d(e,t){let[n="",r,...i]=t.split(".");if(!UD(e,n)||i.length>0)return;let o=e[n];if(typeof o=="string")return r===void 0?o:void 0;if(!(r===void 0||!Object.hasOwn(o,r)))return o[r]}s($d,"leafType");function zD(e){let t=new Set;for(let n of e){let r=Ca(n);r!==null&&t.add(r.split(".")[0])}return[...t]}s(zD,"contextKeysOf");function Ca(e){return e.startsWith(xo)?e.slice(xo.length):null}s(Ca,"contextPathOf");function Ed(e){return e===BD||e.startsWith(xo)}s(Ed,"isContextIdentifier");function bm(e,t){let n=Ca(t)??"",[r=""]=n.split("."),i=Object.keys(e);if(!UD(e,r))return{code:"env/unknownKey",message:{de:`'${t}' nennt keinen Umgebungsschl\xFCssel \u2014 bekannt: ${i.join(", ")}.`,en:`'${t}' names no environment key \u2014 known: ${i.join(", ")}.`}};if($d(e,n)!==void 0)return null;let o=cb(e,r);return{code:"env/unknownKey",message:o===null?{de:`'${t}': der Umgebungsschl\xFCssel '${r}' ist ein einzelner Wert \u2014 lies ihn als '${xo}${r}'.`,en:`'${t}': environment key '${r}' is a single value \u2014 read it as '${xo}${r}'.`}:{de:`'${t}': der Umgebungsschl\xFCssel '${r}' hat die Felder ${o.join(", ")}.`,en:`'${t}': environment key '${r}' has the fields ${o.join(", ")}.`}}}s(bm,"identifierIssue");function vm(e,t,n=Object.keys(e)){let r={};for(let i of n){let o=cb(e,i),a=Object.hasOwn(t,i)?t[i]:void 0;if(a===void 0&&C(`[env/missing] context key '${i}' was not supplied`),o===null){r[`${xo}${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&&C(`[env/missing] context key '${i}' carries no '${l}'`),r[`${xo}${i}.${l}`]=d}}return r}s(vm,"flatten");function t3(e,t){switch(t){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(t3,"valueMatchesDataType");function WD(e,t,n=Object.keys(e.types)){let r=new Set(n);for(let i of GD(e.types)){if(!r.has(i.split(".")[0]))continue;let o=t[`${xo}${i}`];o===void 0&&C(`[env/missing] context path '${i}' was not supplied`);let a=e.fields[i];if(o===null){a.nullable||C(`[env/null] context path '${i}' is not nullable but carries null`);continue}let l=hn($d(e.types,i));t3(o,l)||C(`[env/type] context path '${i}' expects ${l}, got ${JSON.stringify(o)}`),a.valueSet.kind==="fixed"&&!a.valueSet.values.includes(o)&&C(`[env/value] context path '${i}' carries '${String(o)}', outside ${a.valueSet.values.join(" | ")}`)}}s(WD,"assertContextValues");function n3(e){let t=[],n=GD(e.types);for(let r of n){let i=$d(e.types,r),o=hn(i);if(!yo(i)||o===void 0||!e3.has(o)){t.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){t.push(`'${r}' has no field spec (value set + nullability)`);continue}a.valueSet.kind==="fixed"&&(a.valueSet.values.length===0&&t.push(`'${r}' has an empty fixed value set`),o!=="text"&&o!=="option"&&t.push(`'${r}' is ${o}; a fixed value set needs a text or option leaf`))}for(let r of Object.keys(e.fields))n.includes(r)||t.push(`field spec '${r}' names no leaf of the schema`);return t}s(n3,"schemaIssues");function Da(e){let t=n3(e);t.length>0&&C(`[env/schema] ${t.join("; ")}`)}s(Da,"assertSchema");var xm={length:{params:["text"],returns:"number"},years_between:{params:["date","date"],returns:"number"}};function So(e){return JSON.stringify(e)}s(So,"canonical");function La(e){return e.kind==="binary"&&e.op==="&&"?[...La(e.left),...La(e.right)]:[e]}s(La,"conjuncts");function JD(e,t){let n;try{n=qt(e)}catch{return!1}let r=So(qt(t));return La(n).some(i=>So(i)===r)}s(JD,"hasConjunct");function QD(e,t){try{return So(qt(e))===So(qt(t))}catch{return!1}}s(QD,"sameCondition");function ZD(e){let t=[];for(let n of e)t.push(...Kt(Ii(n)));return zD(t)}s(ZD,"contextKeysRead");function XD(e){try{return Kt(qt(e)).some(Ed)}catch{return!1}}s(XD,"readsContext");var r3=/^\d{4}-\d{2}-\d{2}$/,i3=new Set(["==","!=","<","<=",">",">=","in"]),o3=new Set(["<","<=",">",">="]);function Am(e,t,n=[]){Da(t);let r;try{r=qt(e)}catch(a){let l=a.message;return[sn("condition/parse",`Bedingung '${e}' ist nicht lesbar: ${l}`,`condition '${e}' does not parse: ${l}`)]}let i=[];for(let a of Kt(r)){if(!Ed(a)){i.push(sn("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=bm(t.types,a);l!==null&&i.push(sn("condition/unknownIdentifier",l.message.de,l.message.en))}if(i.length>0)return i;let o=di(r,t,i);Id(o)||i.push(sn("condition/notBoolean",`Bedingung '${e}' ist kein Ja/Nein-Ausdruck`,`condition '${e}' is not a yes/no expression`)),d3(r,t,i);for(let{identifier:a,op:l}of pb(r,t))i.push(sn("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(...s3(r,n)),i}s(Am,"conditionIssues");function s3(e,t){let n=La(e).map(So);return t.flatMap(r=>{let i=qt(r),o=a3(i);return o===null||!n.includes(So(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(s3,"guardFormHints");function a3(e){if(e.kind!=="binary"||e.op!=="=="&&e.op!=="!=")return null;let t={...e,left:e.right,right:e.left};return So(t)===So(e)?null:t}s(a3,"mirror");function Id(e){return e.t==="unknown"||e.t==="data"&&e.dt==="boolean"}s(Id,"isBooleanish");function eF(e){let t=Ca(e);return t===null&&C(`[condition/invariant] '${e}' reached a pass that only sees $env identifiers`),t}s(eF,"contextPath");function tF(e,t){let n=Ca(t);return n!==null&&e.fields[n]?.nullable===!0}s(tF,"isNullableLeaf");function l3(e,t){let n=hn($d(e.types,eF(t)));return n===void 0?{t:"unknown"}:{t:"data",dt:n}}s(l3,"identType");function Sm(e,t){return e.t==="unknown"||t.t==="unknown"||e.t==="null"||t.t==="null"?!0:e.t==="array"||t.t==="array"?!1:e.t==="str"&&t.t==="str"?!0:e.t==="str"?YD(e.value,t.dt):t.t==="str"?YD(t.value,e.dt):e.dt===t.dt}s(Sm,"fits");function YD(e,t){return t==="text"||t==="option"||t==="edge"?!0:t==="date"?r3.test(e):!1}s(YD,"strFits");function HD(e){return e.t==="unknown"?"unknown":e.t==="data"&&e.dt==="number"?"number":null}s(HD,"orderedCategory");function di(e,t,n){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 l3(t,e.path);case"arr":for(let r of e.items)di(r,t,n);return{t:"array"};case"unary":{let r=di(e.operand,t,n);return Id(r)||n.push(sn("condition/notBoolean","'!' braucht einen Ja/Nein-Operanden","'!' needs a yes/no operand")),{t:"data",dt:"boolean"}}case"call":{let r=Object.hasOwn(xm,e.name)?xm[e.name]:void 0,i=e.args.map(l=>di(l,t,n));return r===void 0?(n.push(sn("condition/functionNotAllowed",`Funktion '${e.name}' ist nicht erlaubt \u2014 erlaubt: ${Object.keys(xm).join(", ")}`,`function '${e.name}' is not allowed \u2014 allowed: ${Object.keys(xm).join(", ")}`)),{t:"unknown"}):(i.length===r.params.length&&i.every((l,d)=>l.t!=="null"&&Sm(l,{t:"data",dt:r.params[d]}))||n.push(sn("condition/typeMismatch",`'${e.name}' nimmt (${r.params.join(", ")})`,`'${e.name}' takes (${r.params.join(", ")})`)),{t:"data",dt:r.returns})}case"if":{let r=di(e.cond,t,n);Id(r)||n.push(sn("condition/notBoolean","'if' braucht eine Ja/Nein-Bedingung","'if' needs a yes/no condition"));let i=di(e.then,t,n),o=di(e.else,t,n);return Sm(i,o)||n.push(sn("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=di(e.left,t,n),i=di(e.right,t,n);if(e.op==="&&"||e.op==="||")(!Id(r)||!Id(i))&&n.push(sn("condition/notBoolean",`'${e.op}' braucht Ja/Nein-Operanden`,`'${e.op}' needs yes/no operands`));else if(e.op==="in")e.right.kind!=="arr"?n.push(sn("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=>Sm(r,di(o,t,[])))||n.push(sn("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(o3.has(e.op)){let o=HD(r),a=HD(i);(o===null||a===null||o!=="unknown"&&a!=="unknown"&&o!==a)&&n.push(sn("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 Sm(r,i)||n.push(sn("condition/typeMismatch",`'${e.op}' vergleicht Werte verschiedener Typen`,`'${e.op}' compares values of different types`));return{t:"data",dt:"boolean"}}}}s(di,"typeOf");function ub(e){return e.kind==="str"||e.kind==="num"||e.kind==="bool"}s(ub,"isLiteral");function nF(e){let t=[],n=s(r=>{if(r.kind==="binary"&&i3.has(r.op)){if(r.left.kind==="ident"){let i=r.op==="in"&&r.right.kind==="arr"?r.right.items.filter(ub):ub(r.right)?[r.right]:[];i.length>0&&t.push({ident:r.left.path,literals:i})}r.right.kind==="ident"&&ub(r.left)&&t.push({ident:r.right.path,literals:[r.left]})}rF(r,n)},"visit");return n(e),t}s(nF,"comparedLiterals");function d3(e,t,n){for(let{ident:r,literals:i}of nF(e)){let o=c3(r,i,t);o!==null&&n.push(o)}}s(d3,"literalIssues");function fb(e,t){let n;try{n=qt(e)}catch{return[]}let r=[];for(let{ident:i,literals:o}of nF(n)){let a=Ca(i);if(!(a===null||t.fields[a]?.valueSet.kind!=="live"))for(let l of o)l.kind==="str"&&r.push({path:a,value:l.value})}return r}s(fb,"liveLiterals");function c3(e,t,n){let r=n.fields[eF(e)]?.valueSet;if(r?.kind==="unstable")return sn("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=t.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 sn("condition/literalOutsideSet",`'${e}' kennt nur ${o} \u2014 nicht ${i.join(", ")}`,`'${e}' takes only ${o} \u2014 not ${i.join(", ")}`)}s(c3,"valueSetIssue");function rF(e,t){switch(e.kind){case"binary":t(e.left),t(e.right);return;case"unary":t(e.operand);return;case"call":e.args.forEach(t);return;case"arr":e.items.forEach(t);return;case"if":t(e.cond),t(e.then),t(e.else);return;default:return}}s(rF,"forEachChild");function iF(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(iF,"isNullTest");function oF(e){return La(e).flatMap(t=>{let n=sF(t);return n===null?[]:[n]})}s(oF,"guardsOf");function Od(e,t,n){switch(e.kind){case"ident":return tF(t,e.path)&&!n.has(e.path)?e.path:null;case"call":for(let r of e.args){let i=Od(r,t,n);if(i!==null)return i}return null;case"if":return Od(e.then,t,new Set([...n,...oF(e.cond)]))??Od(e.else,t,n);default:return null}}s(Od,"unguardedNullSource");function sF(e){return!iF(e)||e.kind!=="binary"||e.op!=="!="?null:e.left.kind==="ident"?e.left.path:e.right.kind==="ident"?e.right.path:null}s(sF,"guardedIdent");function Fa(e,t,n,r){if(e.kind==="binary"&&e.op==="&&"){let i=new Set(n);for(let o of La(e)){Fa(o,t,i,r);let a=sF(o);a!==null&&i.add(a)}return}if(e.kind==="if"){Fa(e.cond,t,n,r),Fa(e.then,t,new Set([...n,...oF(e.cond)]),r),Fa(e.else,t,n,r);return}if(e.kind==="binary"&&e.op==="!="&&e.left.kind!=="null"&&e.right.kind!=="null"){let i=Od(e.left,t,n)??Od(e.right,t,n);i!==null&&r(i,"!=")}if(e.kind==="unary"&&!iF(e.operand)){let i=Kt(e.operand).filter(o=>tF(t,o)&&!n.has(o));i.length>0&&r(i[0],"!")}rF(e,i=>Fa(i,t,n,r))}s(Fa,"nullableReads");function pb(e,t){Da(t);let n=[];return Fa(e,t,new Set,(r,i)=>{n.some(o=>o.identifier===r)||n.push({identifier:r,op:i})}),n}s(pb,"unguardedNullableReads");function sn(e,t,n){return{severity:"error",code:e,message:{de:`[${e}] ${t}`,en:`[${e}] ${n}`}}}s(sn,"error");function _d(e){let t=Array.isArray(e.nodes)?e.nodes:[],n=new Set;for(let r of t)for(let i of am(r))i.key!==null&&xa[i.leaf].involves&&n.add(i.key);return n}s(_d,"declaredGroupKeys");var Ma=Op;var u3="unit.key",f3="offer.key";function aF(e,t){return e===u3?t.unitKeys:e===f3?t.offerKeys:null}s(aF,"liveKeyUniverse");function Tm(e){return[vt,...[..._d(e)].sort((t,n)=>t.localeCompare(n)).map(Lp)]}s(Tm,"requiredSlots");var Ao=`${Np("applicant.channel")} == 'staff'`;var hb=["strict","leastLoaded"];var mb=2;function lF(e){return e.some(t=>t.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<mb?{de:`braucht mindestens ${mb} Personen`,en:`needs at least ${mb} people`}:null}s(lF,"rotationPoolProblem");function p3(e,t){let n=t===null?-1:e.indexOf(t);return[...e.slice(n+1),...e.slice(0,n+1)]}s(p3,"strictOrder");function dF(e){let t=p3(e.pool,e.previous).filter(i=>e.eligible.has(i));if(t.length===0)return null;if(e.mode==="strict")return t[0];let n=e.openCounts;n===void 0&&C("[assignment/rotation] leastLoaded needs the open counts");let r=s(i=>{let o=n.get(i);return o===void 0&&C(`[assignment/rotation] no open count for '${i}'`),o},"load");return t.reduce((i,o)=>r(o)<r(i)?o:i)}s(dF,"pickFromPool");function uF(e){return e.map(t=>({slot:fN(t.slot),rules:[...t.rules]}))}s(uF,"rulesOfStored");function fF(e){return e.map(t=>({slot:m3(t.slot),rules:[...t.rules]}))}s(fF,"storedOfRules");function m3(e){let t=qp(e);return t===null&&C(`[assignment/unknownSlot] '${e}' is no slot \u2014 'responsible' or 'team:<teamKey>'`),t}s(m3,"slotOf");function pF(e,t){let n=e?.assignmentRules;n===void 0&&C(`[assignment/noRules] ${t}: the workflow has no assignment rule`);let r=yF(n);return r.length>0&&C(`${r.join("; ")} (${t})`),uF(n)}s(pF,"rulesOfGraph");function h3(e){return e===vt?{slot:e,rules:[{when:Ao,assign:{kind:"creator"}},{when:null,assign:{kind:"unassigned"}}]}:{slot:e,rules:[{when:null,assign:{kind:"queue"}}]}}s(h3,"defaultSlotRules");function mF(e,t){let n=new Set(e.map(o=>o.slot)),r=t.filter(o=>!n.has(o)).map(h3);return[...r.filter(o=>o.slot===vt),...e,...r.filter(o=>o.slot!==vt)]}s(mF,"withRequiredSlots");function Vt(e,t){return t===void 0?`slot '${e}'`:`slot '${e}' row #${t+1}`}s(Vt,"where");function Yn(e,t){return t===void 0?`Liste '${e}'`:`Liste '${e}', Zeile #${t+1}`}s(Yn,"whereDe");function Dn(e,t,n={},r="error"){return{severity:r,code:e,message:{de:`[${e}] ${t.de}`,en:`[${e}] ${t.en}`},...n}}s(Dn,"issue");function cF(e){if(e===vt)return!0;let t=Mp(e);return t!==null&&t.length>0}s(cF,"isKnownSlot");function g3(e,t){Da(Ma);let n=[],r=new Set;e.forEach((o,a)=>{let{slot:l}=o;cF(l)||n.push(Dn("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)&&n.push(Dn("assignment/duplicateSlot",{de:`${Yn(l)} steht zweimal da`,en:`${Vt(l)} is listed twice`},{slot:l})),r.add(l),l===vt&&a!==0&&n.push(Dn("assignment/responsibleFirst",{de:`'${vt}' muss die erste Liste sein \u2014 Team-Zeilen \xFCbernehmen sie`,en:`'${vt}' must be the first slot \u2014 team rows copy it`},{slot:l})),n.push(...y3(o))});for(let o of t)r.has(o)||n.push(Dn("assignment/slotMissing",{de:`${Yn(o)} hat keine Regeln \u2014 der Workflow braucht sie`,en:`${Vt(o)} has no rule list \u2014 the workflow needs it`},{slot:o}));let i=new Set(t);for(let{slot:o}of e)o!==vt&&!i.has(o)&&cF(o)&&n.push(Dn("assignment/unusedSlot",{de:`${Yn(o)} wird hier nicht gebraucht \u2014 erlaubt, und nicht ausgewertet`,en:`${Vt(o)} is not needed here \u2014 allowed, and not evaluated`},{slot:o},"info"));return n}s(g3,"validateRules");function y3({slot:e,rules:t}){let n=[];return(t.length===0||t[t.length-1].when!==null)&&n.push(Dn("assignment/defaultRowMissing",{de:`${Yn(e)} muss mit einer Zeile ohne Bedingung enden (\u201Esonst\u201C)`,en:`${Vt(e)} must end with a row without condition ("otherwise")`},{slot:e})),t.forEach((r,i)=>{let o={slot:e,row:i},{when:a,assign:l}=r;if(a===null&&i<t.length-1&&n.push(Dn("assignment/ruleAfterDefault",{de:`${Yn(e,i)} hat keine Bedingung, aber es folgen Zeilen \u2014 sie treffen nie zu`,en:`${Vt(e,i)} has no condition, but rows follow it \u2014 they can never match`},o)),a!==null){let d=Am(a,Ma,[Ao]);for(let c of d)n.push({...c,message:{de:`${c.message.de} (${Yn(e,i)})`,en:`${c.message.en} (${Vt(e,i)})`},...o});if(d.every(c=>c.severity!=="error")){XD(a)||n.push(Dn("assignment/shadowedRule",{de:`${Yn(e,i)} liest nichts aus dem Vorgang \u2014 sie gilt immer oder nie`,en:`${Vt(e,i)} reads nothing of the application \u2014 it holds for every application or for none`},o));let c=t.slice(0,i).findIndex(u=>u.when!==null&&QD(u.when,a));c!==-1&&n.push(Dn("assignment/shadowedRule",{de:`${Yn(e,i)} wiederholt die Bedingung von Zeile #${c+1} \u2014 sie trifft nie zu`,en:`${Vt(e,i)} repeats the condition of row #${c+1} \u2014 it can never match`},o))}}if(e===vt&&l.kind==="slot"&&n.push(Dn("assignment/slotForwardRef",{de:`${Yn(e,i)} \xFCbernimmt '${l.slot}' \u2014 das darf nur eine Team-Liste nach '${vt}'`,en:`${Vt(e,i)} copies '${l.slot}' \u2014 only a team slot after '${vt}' may`},o)),e===vt&&l.kind==="queue"&&n.push(Dn("assignment/queueOnProcessSlot",{de:`${Yn(e,i)} weist die Queue zu \u2014 die Prozesszust\xE4ndigkeit ist immer eine Person`,en:`${Vt(e,i)} assigns the queue \u2014 the responsible slot is always a person`},o)),l.kind==="unassigned"&&n.push(Dn("assignment/targetMissing",{de:`${Yn(e,i)} nennt noch niemanden \u2014 Person w\xE4hlen`,en:`${Vt(e,i)} names no one yet \u2014 choose a person`},o)),l.kind==="rotation"){let d=lF(l.configKeys);d!==null&&n.push(Dn("assignment/rotationPool",{de:`${Yn(e,i)}: die Reihum-Liste ${d.de}`,en:`${Vt(e,i)} rotates over a pool that ${d.en}`},o))}l.kind==="creator"&&(a===null||!JD(a,Ao))&&n.push(Dn("assignment/unguardedTarget",{de:`${Yn(e,i)} weist die anlegende Person zu \u2014 die gibt es nur, wenn die Bedingung der Zeile '${Ao}' ist (oder enth\xE4lt)`,en:`${Vt(e,i)} assigns the creator, which exists only when the row's condition is (or has the conjunct) '${Ao}'`},o))}),n}s(y3,"rowIssues");function hF(e,t){for(let r of t)e.some(i=>i.slot===r)||C(`[assignment/slotMissing] ${Vt(r)} has no rule list`);let n=new Set(t);return e.filter(r=>n.has(r.slot))}s(hF,"selectSlots");function w3(e,t){return ZD(hF(e,t).flatMap(n=>n.rules.flatMap(r=>r.when===null?[]:[r.when])))}s(w3,"contextKeysOfRules");function gF(e,t,n,r){Da(Ma);let i=hF(e,n),o=w3(e,n),a=vm(Ma.types,t,o);WD(Ma,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 Kt(Ii(h.when)))Object.hasOwn(a,b)||C(`[condition/unknownIdentifier] ${Vt(d,y)} reads '${b}', which the context does not carry`);return KN(h.when,{values:a})});u===-1&&C(`[assignment/defaultRowMissing] ${Vt(d)}: no row matched and there is no default row`);let p=c[u].assign;l.push({slot:d,ruleIndex:u,assign:p,value:k3(d,u,p,l,r)})}return l}s(gF,"evaluateRules");function k3(e,t,n,r,i){switch(n.kind){case"person":return{kind:"value",value:i.person(n.configKey)};case"creator":return{kind:"value",value:i.creator()};case"rotation":return{kind:"value",value:i.rotation(n,{slot:e,row:t})};case"unassigned":return C(`[assignment/targetMissing] ${Vt(e,t)} names no one`);case"queue":return e===vt&&C(`[assignment/queueOnProcessSlot] ${Vt(e,t)} assigns the queue`),{kind:"queue"};case"slot":{let o=e===vt?void 0:r.find(a=>a.slot===n.slot);return o===void 0&&C(`[assignment/slotForwardRef] ${Vt(e,t)} copies '${n.slot}', which is not decided before it`),o.value}}}s(k3,"resolveTarget");var gb={person:["kind","configKey"],creator:["kind"],slot:["kind","slot"],queue:["kind"],rotation:["kind","configKeys","mode"],unassigned:["kind"]};function b3(e){if(typeof e!="object"||e===null)return!1;let{kind:t,groupKey:n,...r}=e;return Object.keys(r).length>0?!1:t==="responsible"?n===void 0:t==="team"&&typeof n=="string"&&n.length>0}s(b3,"isStoredSlot");function yF(e){let t=[],n=s((r,i)=>t.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 n(o,"must be { slot, rules }");let{slot:a,rules:l,...d}=r;if(Object.keys(d).length>0&&n(o,`unknown field(s) ${Object.keys(d).join(", ")}`),b3(a)||n(o,"slot must be { kind: 'responsible' } or { kind: 'team', groupKey: '<team key>' }"),!Array.isArray(l))return n(o,"rules must be a list");l.forEach((c,u)=>{let p=`${o}.rules[${u}]`;if(typeof c!="object"||c===null)return n(p,"must be { when, assign }");let{when:h,assign:y,...b}=c;Object.keys(b).length>0&&n(p,`unknown field(s) ${Object.keys(b).join(", ")}`),h!==null&&typeof h!="string"&&n(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(gb,k))return n(p,`assign must be one of ${Object.keys(gb).map(I=>`{kind:'${I}'}`).join(", ")}`);let v=gb[k],A=Object.keys(y);(A.some(I=>!v.includes(I))||v.some(I=>!A.includes(I)))&&n(p,`a '${k}' target has exactly the field(s) ${v.join(", ")}`);let T=y;if(k==="person"&&(typeof T.configKey!="string"||T.configKey.length===0)&&n(p,"a 'person' target needs a non-empty configKey"),k==="rotation"){let I=T.configKeys;(!Array.isArray(I)||I.some(D=>typeof D!="string"))&&n(p,"a 'rotation' target needs configKeys, a list of person keys"),hb.includes(T.mode)||n(p,`a 'rotation' target's mode is one of ${hb.map(D=>`'${D}'`).join(", ")}`)}k==="slot"&&T.slot!==vt&&n(p,`a 'slot' target copies '${vt}' and nothing else`)})}),t):(n("slots","must be a list of { slot, rules }"),t)}s(yF,"ruleShapeIssues");function wF(e){let t=e??{},n=[];if(t.teamOwnerBindings!==void 0&&n.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"}),t.assignmentRules===void 0)return n.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"}),n;let r=yF(t.assignmentRules);if(r.length>0)return[...n,...r.map(o=>({de:o,en:o}))];let i=Tm({nodes:Array.isArray(t.nodes)?t.nodes:[]});for(let o of g3(uF(t.assignmentRules),i))o.severity==="error"&&n.push(o.message);return n}s(wF,"workflowAssignmentIssues");var yb="team:",v3=/^[a-z0-9][a-z0-9-]*$/;function x3(e){if(!e.startsWith(yb))return null;let t=e.slice(yb.length);return t.length>0?t:null}s(x3,"teamKeyOfMember");function Rm(e){return`${yb}${e}`}s(Rm,"teamMember");function qa(e){let t=e.channels;return t===void 0?[]:(Array.isArray(t)||C("graph.channels must be an array"),t)}s(qa,"readAuthoredChannels");function kF(e){return[..._d(e)].sort()}s(kF,"derivedChannelTeamKeys");function bF(e,t){let n=e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"channel";if(!t.has(n))return n;for(let r=2;;r++){let i=`${n}-${r}`;if(!t.has(i))return i}}s(bF,"mintChannelKey");function vF(e,t){let n=e.channels;if(n===void 0)return[];if(!Array.isArray(n))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=_d(e),o=new Set,a=new Map;return n.forEach((l,d)=>{let c=`channels[${d}]`,u=l;if(u===null||typeof u!="object"||typeof u.key!="string"||Lt(u.label)==="not-localized"||!Array.isArray(u.members)||!u.members.every(A=>typeof A=="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}"`};v3.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=Lt(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 A of u.members){let T=x3(A);if(T===null){r.push({path:`${c}.members`,reason:{de:`[channels/invalidMember] ${p.de}: "${A}" ist kein "team:<schl\xFCssel>".`,en:`[channels/invalidMember] ${p.en}: "${A}" is not a "team:<key>".`}});continue}if(y.includes(T)){r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMember] ${p.de}: Team "${T}" ist doppelt genannt.`,en:`[channels/duplicateMember] ${p.en}: team "${T}" is named twice.`}});continue}t!==void 0&&!t.has(T)&&r.push({path:`${c}.members`,reason:{de:`[channels/unknownTeam] ${p.de}: Team "${T}" gibt es in diesem Mandanten nicht (oder es ist die Bewerbergruppe).`,en:`[channels/unknownTeam] ${p.en}: team "${T}" does not exist at this school (or it is the applicant group).`}}),y.push(T)}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(vF,"channelIssues");var tve=Object.freeze({});function xF(e,t){return Object.freeze(vm(po,e,t))}s(xF,"formContextEntries");function SF(e){return e.env??[]}s(SF,"declaredContextKeys");function kb(e){return Ed(e)}s(kb,"isContextIdentifier");function S3(e,t,n){let r=bm(po,e);if(r!==null)return{severity:"error",path:n,code:"env/unknownKey",message:r.message};let[,i=""]=e.split(".");return t.has(i)?null:{severity:"error",path:n,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(S3,"contextIdentifierIssue");var wb=Np("stage.key");function A3(e){let t=[],n=s(i=>i.kind==="ident"&&i.path===wb,"isStageKey"),r=s(i=>{switch(i.kind){case"binary":if((i.op==="=="||i.op==="!=")&&(n(i.left)&&i.right.kind==="str"&&t.push(i.right.value),n(i.right)&&i.left.kind==="str"&&t.push(i.left.value)),i.op==="in"&&n(i.left)&&i.right.kind==="arr")for(let o of i.right.items)o.kind==="str"&&t.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),t}s(A3,"stageKeyLiterals");function $m(e,t,n){return t===void 0?[]:A3(e).filter(r=>!t.has(r)).map(r=>T3(r,t,n))}s($m,"stageKeyAstIssues");function T3(e,t,n){let r=[...t].sort();return{severity:"error",path:n,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.")+` \`${wb}\` 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.")+` \`${wb}\` is the bundle key (\`program.stages[].key\`), never the stored \`<program>-stufe-<key>\`.`}}}s(T3,"unknownStageKeyIssue");function AF(e,t,n){let r=[];for(let i of Kt(e)){if(!kb(i))continue;let o=S3(i,t,n);o!==null&&r.push(o)}if(r.length>0)return r;for(let{identifier:i,op:o}of pb(e,Op))r.push({severity:"error",path:n,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(AF,"contextAstIssues");function TF(e,t){let n=[...R3(e)];for(let r of e.env??[]){if(!mo(r)){n.push({severity:"error",path:"env",code:"env/unknownKey",message:{de:`Der deklarierte Umgebungsschl\xFCssel '${r}' geh\xF6rt nicht zum Vokabular (${da.join(", ")}).`,en:`Declared environment key '${r}' is not in the vocabulary (${da.join(", ")}).`}});continue}t!==void 0&&!t.has(r)&&n.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 n}s(TF,"formContextIssues");function R3(e){let t=[];Object.hasOwn(e,"context")&&t.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 n=e.testScenarios;for(let r of Array.isArray(n)?n:[]){if(r===null||typeof r!="object")continue;let i=String(r.id);Object.hasOwn(r,"context")&&t.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")&&t.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 t}s(R3,"retiredContextFields");function Em(e,t,n){let r=Am(e,t).filter(o=>o.severity==="error").map(o=>o.message);if(r.length>0)return r;let i=[];if(n?.liveEnvKeys!==void 0)for(let o of fb(e,t)){let a=aF(o.path,n.liveEnvKeys);a===null&&C(`[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 $m(qt(e),n?.stageKeys,""))i.push({de:`[${o.code}] ${o.message.de}`,en:`[${o.code}] ${o.message.en}`});return i}s(Em,"envConditionFindings");function Im(e){return e.kind==="entered"&&!e.repeated&&e.reviewRequired}s(Im,"isReviewField");function Ka(e){let t=[],n=[];function r(k,v){try{return qt(k)}catch(A){t.push({path:v,src:k,reason:A instanceof Error?A.message:String(A)});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((A,T)=>i(A,`${v}.fields[${T}]`))}}s(o,"compileGroup");function a(k,v){return{...k,itemTemplate:k.itemTemplate.map((A,T)=>i(A,`${v}.itemTemplate[${T}]`)),effects:k.effects?.map((A,T)=>d(A,`${v}.effects[${T}]`)),itemVisibleIf:k.itemVisibleIf?r(k.itemVisibleIf,`${v}.itemVisibleIf`):void 0}}s(a,"compileRepeated");function l(k,v){let A=[];return k.fields.forEach((T,I)=>{if(T.externalFlag){n.push({key:T.key,label:T.label,defaultValue:T.defaultValue?r(T.defaultValue,`${v}.fields[${I}].defaultValue`):void 0});return}A.push(i(T,`${v}.fields[${I}]`))}),{...k,visibleIf:k.visibleIf?r(k.visibleIf,`${v}.visibleIf`):void 0,fields:A,groups:k.groups?.map((T,I)=>o(T,`${v}.groups[${I}]`)),computed:k.computed?.map((T,I)=>{let D=r(T.expression,`${v}.computed[${I}].expression`);return{key:T.key,expression:D??{kind:"null"}}}),subsections:k.subsections?.map((T,I)=>l(T,`${v}.subsections[${I}]`)),repeated:k.repeated?.map((T,I)=>a(T,`${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 A=r(k.when,`${v}.when`);return A?{...k,when:A}: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],A=c(v,`outcomes[${k}]`);A&&h.push(A)}return{compiled:{...e,sections:u,effects:p,outcomes:h,flags:n},errors:t}}s(Ka,"compileForm");var $3=new Set(["decision","review","governedDocument"]);function $F(e){return $3.has(e.type)&&!(e.type==="governedDocument"&&e.production==="none")}s($F,"isReadinessGatedNode");function E3(e){let t=new Map,n=O3(e),r=s((i,o)=>{let a=bb(o),l=[...i.fields,...(i.groups??[]).flatMap(d=>d.fields)];for(let d of l)d.externalFlag!==!0&&t.set(d.key,{kind:"entered",key:d.key,label:d.label,qualifier:I3(d.bucket,n,a),section:a,type:d.type,enumSource:RF(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}`;t.set(u,{kind:"entered",key:u,label:c.label,qualifier:bb(d),section:a,type:c.type,enumSource:RF(c),repeated:!0,reviewRequired:!1})}for(let d of i.computed??[]){let c=Kt(qt(d.expression));t.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 t}s(E3,"formFieldCatalog");function RF(e){return e.type==="enum"?e:null}s(RF,"enumSourceOf");function I3(e,t,n){return e===void 0?n:t.get(e)??n}s(I3,"fieldQualifier");function O3(e){let t=new Map,n=s((r,i)=>{i===void 0||t.has(r)||t.set(r,bb(i))},"add");for(let r of IF(e))r.kind==="person"?n(r.bucket,r.display):r.kind==="organization"&&n(r.id.replace(/^o\./,""),r.display);return t}s(O3,"bucketWordings");function EF(e){return e.flatMap(t=>[t,...EF(t.subsections??[])])}s(EF,"allSections");function IF(e){return[...e.effects,...EF(e.sections).flatMap(t=>(t.repeated??[]).flatMap(n=>n.effects??[]))]}s(IF,"allEffects");function bb(e){return{label:e.label}}s(bb,"wordingOf");function OF(e){return md(e).flatMap(({slot:t,address:n})=>{let r=zN(n);return r===null||pd.includes(r.path)?[]:[{slotId:t,owner:r.owner,fieldKey:r.path}]})}s(OF,"admissionBindingLeaves");function _3(e,t){let n=e.get(t);if(n===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(n),r}s(_3,"expandKey");function N3(e){let t=new Set;for(let n of IF(e))if(!(n.kind!=="person"||n.contractParty===void 0)&&n.when!==void 0)for(let r of Kt(qt(n.when)))t.add(r);return[...t]}s(N3,"contractPartyConditionKeys");function P3(e){return Ka(e).compiled.flags.map(t=>({key:t.key,name:t.label}))}s(P3,"formExternalFlags");function _F(e){return{readinessFormFieldsByFormNode:new Map([...e].map(([t,n])=>[t,E3(n)])),readinessPartyConditionKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set(N3(n))])),formFlagKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set(P3(n).map(r=>r.key))])),formViewKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set((n.views??[]).map(r=>r.key))]))}}s(_F,"readinessUniverse");function vb(e,t){let n=new Set;for(let r of t)for(let i of _3(e,r)??[])i.kind==="entered"&&n.add(i.fieldKey);return n}s(vb,"enteredFieldsBehind");var C3=new Set(["label","sublabel","title","description","body","chipLabel","nextAction","confirmLabel","placeholder","helpText","subject","heading","hint","notice","reason"]);function D3(e){return C3.has(e)?!0:NF(e)?!1:/(Label|Title|Body|Description|Text|Hint|Heading|Placeholder)$/.test(e)}s(D3,"isTextKey");function NF(e){return/^localized[A-Z]/.test(e)}s(NF,"isLegacyTwinKey");var F3=new Set(["titles","responseLabels","outputLabels","enumOptionLabels"]),L3=new Set(["inputs","resolver","library"]);function _m(e,t){let n=[];return xb(e,t,n),n}s(_m,"findUnlocalizedTexts");function xb(e,t,n){if(Array.isArray(e)){e.forEach((i,o)=>xb(i,`${t}[${q3(i,o)}]`,n));return}if(e===null||typeof e!="object")return;let r=e;for(let[i,o]of Object.entries(r)){let a=`${t}.${i}`;if(!L3.has(i)){if(NF(i)){n.push({path:a,missing:"legacy-twin"});continue}if(D3(i)){M3(o,a,n);continue}if(F3.has(i)&&o!==null&&typeof o=="object"){for(let[l,d]of Object.entries(o))d!==void 0&&PF(d,`${a}.${l}`,n);continue}xb(o,a,n)}}}s(xb,"walk");function M3(e,t,n){e!=null&&PF(e,t,n)}s(M3,"checkText");function PF(e,t,n){let r=Lt(e);(r==="not-localized"||r.length>0)&&n.push({path:t,missing:r})}s(PF,"report");function q3(e,t){if(e!==null&&typeof e=="object"){let n=e;if(typeof n.id=="string")return n.id;if(typeof n.key=="string")return n.key}return String(t)}s(q3,"keyOf");function Om(e,t){return e==="not-localized"?t==="de"?"ist kein zweisprachiger Text ({ de, en })":"is not a bilingual text ({ de, en })":e==="legacy-twin"?t==="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"':t==="de"?`fehlt in: ${e.join(", ")}`:`is missing in: ${e.join(", ")}`}s(Om,"describe");function Sb({path:e,missing:t}){return t==="legacy-twin"?{de:`[i18n/legacyTwin] ${e} ${Om(t,"de")}.`,en:`[i18n/legacyTwin] ${e} ${Om(t,"en")}.`}:{de:`[i18n/missingTranslation] ${e} ${Om(t,"de")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch; die Sprache folgt dem Konto des Lesenden.`,en:`[i18n/missingTranslation] ${e} ${Om(t,"en")} \u2014 every displayed text needs German and English; the language follows the reader's account.`}}s(Sb,"unlocalizedTextReason");var K3={engagePush:["engage"]};function j3(e){let t=K3[e.type];return t===void 0?e:Object.fromEntries(Object.entries(e).filter(([n])=>!t.includes(n)))}s(j3,"withoutMachineData");function CF(e,t){return[..._m(e.nodes.map(j3),"nodes"),...t===void 0?[]:_m(t,`layout.${t.id}`)].map(r=>({layer:"GRAPH",kind:"i18n",path:r.path,reason:Sb(r),severity:"error"}))}s(CF,"checkLocalizedTexts");var ps=5,ms=480;function Li(e){return typeof e=="string"&&e.trim().length>0}s(Li,"isNonEmptyString");function FF(e,t,n){return Object.keys(e).filter(r=>!t.includes(r)).map(r=>({field:`result.${r}`,code:Ye.unknownField,message:{de:`Unbekanntes Feld '${r}' im ${n.de}; erlaubt sind: ${t.join(", ")}.`,en:`Unknown field '${r}' in the ${n.en}; allowed: ${t.join(", ")}.`}}))}s(FF,"unknownFieldIssues");var Nm="primaryHostTeams";function V3(e){let t=[],n=e.title;(n===void 0||typeof n!="object"||n===null||!Li(n.de)||!Li(n.en))&&t.push({field:"result.title",code:Ye.appointmentMissingTitle,message:{de:"Ein Termin-Ergebnis braucht einen neutralen Titel in beiden Sprachen ({ de, en }) \u2014 er steht in der Mail und in der Kalenderdatei der Familie, deshalb nie ein Familienname.",en:"An appointment result needs a neutral title in both languages ({ de, en }) \u2014 it appears in the email and in the family's calendar file, so never a family name."}});let r=e.durationMinutes;(typeof r!="number"||!Number.isInteger(r)||r<ps||r>ms)&&t.push({field:"result.durationMinutes",code:Ye.appointmentInvalidDuration,message:{de:`'durationMinutes' muss eine ganze Zahl von ${ps} bis ${ms} sein, erhalten ${JSON.stringify(r)}.`,en:`'durationMinutes' must be a whole number from ${ps} to ${ms}, got ${JSON.stringify(r)}.`}});let{[Nm]:i,...o}=e;return t.push(...FF(o,["kind","title","durationMinutes","primaryParticipantTeams","participants"],{de:"Termin-Ergebnis",en:"appointment result"})),t}s(V3,"appointmentIssues");function DF(e){if(typeof e!="object"||e===null)return!1;let t=e;return Li(t.de)&&Li(t.en)}s(DF,"isBilingual");var Ab=["key","type","label","writes","options","min","suggest","evidence","evidenceFrom","multiple","tasks","maxLength"];function B3(e,t){let n=s((o,a)=>({field:o,code:Ye.recordFields,message:a}),"issue");if(!Array.isArray(e)||e.length===0)return[n("result.fields",{de:"Eine Erfassung braucht mindestens ein Feld ('result.fields').",en:"A record needs at least one field ('result.fields')."})];let r=[],i=new Set;for(let[o,a]of e.entries()){let l=`result.fields[${o}]`;if(typeof a!="object"||a===null||Array.isArray(a)){r.push(n(l,{de:"Ein Feld der Erfassung muss ein Objekt sein.",en:"A field of the record must be an object."}));continue}let d=a,c=d.key;typeof c!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(c)?r.push(n(`${l}.key`,{de:`Feld-Schl\xFCssel ${JSON.stringify(c)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,en:`Field key ${JSON.stringify(c)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`})):i.has(c)?r.push(n(`${l}.key`,{de:`Feld-Schl\xFCssel "${c}" ist doppelt.`,en:`Field key "${c}" is duplicated.`})):i.add(c);let u=typeof c=="string"?`"${c}"`:`Nr. ${o+1}`,p=typeof c=="string"?`"${c}"`:`no. ${o+1}`;if(fk(d.type)||r.push(n(`${l}.type`,{de:`Feld ${u}: Typ ${JSON.stringify(d.type)} \u2014 erlaubt: ${jp.join(", ")}.`,en:`Field ${p}: type ${JSON.stringify(d.type)} \u2014 allowed: ${jp.join(", ")}.`})),DF(d.label)||r.push(n(`${l}.label`,{de:`Feld ${u} braucht ein Label in beiden Sprachen ({ de, en }).`,en:`Field ${p} needs a label in both languages ({ de, en }).`})),Li(d.writes)||r.push(n(`${l}.writes`,{de:`Feld ${u} schreibt in keinen Vorgangs-Schl\xFCssel ('writes') \u2014 ein Wert, den niemand lesen kann, geh\xF6rt nicht in eine Erfassung.`,en:`Field ${p} writes to no process key ('writes') \u2014 a value nobody can read does not belong in a record.`})),d.type==="enum"){let y=Array.isArray(d.options)?d.options:[],b=y.map(k=>k.key);(y.length<2||b.some(k=>typeof k!="string"||k.length===0)||new Set(b).size!==b.length||y.some(k=>!DF(k.label)))&&r.push(n(`${l}.options`,{de:`Feld ${u} (Auswahl) braucht mindestens 2 Optionen mit eindeutigen Schl\xFCsseln und Labels in beiden Sprachen.`,en:`Field ${p} (choice) needs at least 2 options with unique keys and labels in both languages.`}))}else d.options!==void 0&&r.push(n(`${l}.options`,{de:`Feld ${u}: 'options' gibt es nur bei Typ 'enum'.`,en:`Field ${p}: 'options' exists only for type 'enum'.`}));if(d.min!==void 0&&(d.type!=="number"||typeof d.min!="number"||!Number.isInteger(d.min))&&r.push(n(`${l}.min`,{de:`Feld ${u}: 'min' gibt es nur bei Typ 'number', als ganze Zahl.`,en:`Field ${p}: 'min' exists only for type 'number', as a whole number.`})),d.evidence!==void 0&&typeof d.evidence!="boolean"&&r.push(n(`${l}.evidence`,{de:`Feld ${u}: 'evidence' ist true oder false.`,en:`Field ${p}: 'evidence' is true or false.`})),d.evidenceFrom!==void 0){let y=typeof d.min=="number"?d.min:0;(d.type!=="number"||d.evidence!==!0||typeof d.evidenceFrom!="number"||!Number.isInteger(d.evidenceFrom)||d.evidenceFrom<=y)&&r.push(n(`${l}.evidenceFrom`,{de:`Feld ${u}: 'evidenceFrom' gibt es nur bei Typ 'number' mit 'evidence', als ganze Zahl \xFCber dem Minimum (${y}) \u2014 sonst g\xE4lte der Nachweis immer.`,en:`Field ${p}: 'evidenceFrom' exists only for type 'number' with 'evidence', as a whole number above the minimum (${y}) \u2014 otherwise the proof would always apply.`}))}if(r.push(...U3(d,l,u,p,t)),d.suggest!==void 0){let y=d.suggest,b=typeof y=="object"&&y!==null?y.kind:void 0,k=b==="form"&&"address"in y&&Object.keys(y).length===2&&(!ke(y.address)||gt(y.address))||b==="siblingRank"&&Object.keys(y).length===1&&d.type==="number";_N(d.type)?k||r.push({field:`${l}.suggest`,code:Ye.recordSuggest,message:{de:`Feld ${u}: Vorschlag ${JSON.stringify(d.suggest)} \u2014 erlaubt: { kind: 'form', address: '$node.<formular>.admission.<export>' } oder { kind: 'siblingRank' } (nur bei Typ 'number'); bekannte Arten: ${pk.join(", ")}.`,en:`Field ${p}: suggestion ${JSON.stringify(d.suggest)} \u2014 allowed: { kind: 'form', address: '$node.<form>.admission.<export>' } or { kind: 'siblingRank' } (only for type 'number'); known kinds: ${pk.join(", ")}.`}}):r.push({field:`${l}.suggest`,code:Ye.recordSuggest,message:{de:`Feld ${u}: einen Vorschlag gibt es nur bei Typ number, boolean oder enum.`,en:`Field ${p}: a suggestion exists only for type number, boolean or enum.`}})}let h=Object.keys(d).filter(y=>!Ab.includes(y));h.length>0&&r.push(n(l,{de:`Feld ${u}: unbekannte Angabe ${h.map(y=>`'${y}'`).join(", ")}; erlaubt: ${Ab.join(", ")}.`,en:`Field ${p}: unknown entry ${h.map(y=>`'${y}'`).join(", ")}; allowed: ${Ab.join(", ")}.`}))}return r}s(B3,"recordFieldIssues");function U3(e,t,n,r,i){let o=[],a=e.maxLength;if(a!==void 0&&(e.type!=="text"||typeof a!="number"||!Number.isInteger(a)||a<1||a>Vp)&&o.push({field:`${t}.maxLength`,code:Ye.recordText,message:{de:`Feld ${n}: 'maxLength' gibt es nur bei Typ 'text', als ganze Zahl von 1 bis ${Vp}.`,en:`Field ${r}: 'maxLength' exists only for type 'text', as a whole number from 1 to ${Vp}.`}}),e.multiple!==void 0&&(e.type!=="person"||typeof e.multiple!="boolean")&&o.push({field:`${t}.multiple`,code:Ye.recordPerson,message:{de:`Feld ${n}: 'multiple' gibt es nur bei Typ 'person', als true oder false.`,en:`Field ${r}: 'multiple' exists only for type 'person', as true or false.`}}),e.type!=="assignment")return e.tasks!==void 0&&o.push({field:`${t}.tasks`,code:Ye.recordAssignment,message:{de:`Feld ${n}: 'tasks' gibt es nur bei Typ 'assignment'.`,en:`Field ${r}: 'tasks' exists only for type 'assignment'.`}}),o;let l=e.tasks;if(!Array.isArray(l)||l.length===0||l.some(d=>typeof d!="string"||d.length===0)||new Set(l).size!==l.length)return o.push({field:`${t}.tasks`,code:Ye.recordAssignment,message:{de:`Feld ${n} (Zuordnung) braucht in 'tasks' mindestens eine Aufgabe, jede einmal.`,en:`Field ${r} (assignment) needs at least one task in 'tasks', each once.`}}),o;if(i.nodeTasks===void 0)return o;for(let d of l){let c=i.nodeTasks.get(d);c?.feedback!==!0&&o.push({field:`${t}.tasks`,code:Ye.recordAssignment,message:c===void 0?{de:`Feld ${n}: "${d}" ist keine Aufgabe dieses Knotens.`,en:`Field ${r}: "${d}" is no task of this node.`}:{de:`Feld ${n}: "${d}" ist keine Feedback-Aufgabe ('feedback: true') \u2014 zugeordnet wird nur, wer eine R\xFCckmeldung gibt.`,en:`Field ${r}: "${d}" is no feedback task ('feedback: true') \u2014 only a person who gives feedback is assigned.`}})}return o}s(U3,"typedFieldIssues");function G3(e,t,n){let r=[],i=t.options;if(e==="choice"){let o=Array.isArray(i)?i:[],a=o.map(l=>l.key);(o.length<2||a.some(l=>typeof l!="string"||l.length===0)||new Set(a).size!==a.length)&&r.push({field:"result.options",code:Ye.choiceOptions,message:{de:`Ein Auswahl-Ergebnis braucht mindestens 2 Optionen mit eindeutigen Schl\xFCsseln, erhalten ${JSON.stringify(a)}.`,en:`A choice result needs at least 2 options with unique keys, got ${JSON.stringify(a)}.`}})}else i!==void 0&&r.push({field:"result.options",code:Ye.choiceOptions,message:{de:`'result.options' gibt es nur bei 'choice' \u2014 ${e==="recommendation"?"eine Empfehlung hat die festen Tendenzen Positiv/Neutral/Negativ":"ein Freitext hat keine Auswahl"}.`,en:`'result.options' exists only for 'choice' \u2014 ${e==="recommendation"?"a recommendation has the fixed leanings Positive/Neutral/Negative":"a free text has no choice"}.`}});if(e==="pricedItem"){let o=t.item;if(!Li(o))r.push({field:"result.item",code:Ye.pricedItemMissingItem,message:{de:"Ein Preispositions-Ergebnis nennt den Artikel, den es bepreist \u2014 'result.item' (der Schl\xFCssel des Artikels, z. B. 'tuition') fehlt.",en:"A priced-item result names the article it prices \u2014 'result.item' (the article's key, e.g. 'tuition') is missing."}});else if(n.billingItemKeys!==void 0&&!n.billingItemKeys.has(o))r.push({field:"result.item",code:Ye.pricedItemUnknownItem,message:{de:`'result.item' "${o}" \u2014 kein Artikel dieses Mandanten tr\xE4gt diesen Schl\xFCssel (bekannt: ${[...n.billingItemKeys].join(", ")||"keine"}).`,en:`'result.item' "${o}" \u2014 no article of this school has this key (known: ${[...n.billingItemKeys].join(", ")||"none"}).`}});else if(n.offerProgram===null)r.push({field:"result.item",code:Ye.pricedItemOfferWithoutProgram,message:{de:`'result.item' "${o}" \u2014 das Angebot ist keinem Programm zugeordnet, also geh\xF6rt kein Artikel zu ihm; dem Angebot ein Programm geben.`,en:`'result.item' "${o}" \u2014 the offer is not assigned to a program, so no article belongs to it; give the offer a program.`}});else if(n.offerProgram!==void 0&&!n.offerProgram.billingItemKeys.has(o)){let l=n.offerProgram;r.push({field:"result.item",code:Ye.pricedItemNotInProgram,message:{de:`'result.item' "${o}" \u2014 der Artikel ist dem Programm \u201E${l.nameDe}\u201C des Angebots nicht zugeordnet (zugeordnet: ${[...l.billingItemKeys].join(", ")||"keine"}); unter Finanzen \u2192 Artikel zuordnen, direkt oder \xFCber ein Paket.`,en:`'result.item' "${o}" \u2014 the article is not assigned to the offer's program "${l.nameDe}" (assigned: ${[...l.billingItemKeys].join(", ")||"none"}); assign it under Finance \u2192 articles, directly or through a package.`}})}let a=t.label;(typeof a!="object"||a===null||!Li(a.de)||!Li(a.en))&&r.push({field:"result.label",code:Ye.labelMissing,message:{de:"Ein Preispositions-Ergebnis braucht einen Namen f\xFCr seinen Wert in beiden Sprachen ('result.label', z. B. { de: 'Schulgeld mit Erm\xE4\xDFigung', en: 'Tuition after reduction' }) \u2014 so hei\xDFt er im Workflow und in der Verdrahtung.",en:"A priced-item result needs a name for its value in both languages ('result.label', e.g. { de: 'Schulgeld mit Erm\xE4\xDFigung', en: 'Tuition after reduction' }) \u2014 that is what it is called in the workflow and in the wiring."}})}else t.item!==void 0&&r.push({field:"result.item",code:Ye.itemOnNonPricedItem,message:{de:`'result.item' gibt es nur bei 'pricedItem' \u2014 ein ${e}-Ergebnis bepreist keinen Artikel.`,en:`'result.item' exists only for 'pricedItem' \u2014 a ${e} result prices no article.`}});if(e==="record"?(r.push(...B3(t.fields,n)),t.writes!==void 0&&r.push({field:"result.writes",code:Ye.writesOnProse,message:{de:"Eine Erfassung schreibt je Feld ('fields[].writes'), nie als Ganzes ('result.writes').",en:"A record writes per field ('fields[].writes'), never as a whole ('result.writes')."}}),t.label!==void 0&&r.push({field:"result.label",code:Ye.unknownField,message:{de:"Eine Erfassung benennt ihre Werte je Feld ('fields[].label'), nicht als Ganzes ('result.label').",en:"A record names its values per field ('fields[].label'), not as a whole ('result.label')."}})):t.fields!==void 0&&r.push({field:"result.fields",code:Ye.fieldsOnNonRecord,message:{de:`'result.fields' gibt es nur bei 'record' \u2014 ein ${e}-Ergebnis hat keine Felder.`,en:`'result.fields' exists only for 'record' \u2014 a ${e} result has no fields.`}}),e==="reduction"&&(Li(t.writes)||r.push({field:"result.writes",code:Ye.reductionPrices,message:{de:"Eine Reduktion schreibt ihren Betrag in einen Vorgangs-Schl\xFCssel vom Typ reduction ('result.writes') \u2014 sonst l\xE4se ihn kein Preis.",en:"A reduction writes its amount to a process key of type reduction ('result.writes') \u2014 otherwise no price would read it."}})),t.writes!==void 0&&(e==="freetext"||e==="recommendation")&&r.push({field:"result.writes",code:Ye.writesOnProse,message:{de:`'result.writes' gibt es nur bei Ergebnissen mit Wert (Auswahl, Preisposition) \u2014 ein ${e}-Ergebnis bleibt im Chat und schreibt nichts in den Vorgang.`,en:`'result.writes' exists only for results with a value (choice, priced item) \u2014 a ${e} result stays in the chat and writes nothing to the process.`}}),e==="freetext"&&t.textRequired!==void 0&&r.push({field:"result.textRequired",code:Ye.textRequiredOnFreetext,message:{de:"'textRequired' auf einem Freitext-Ergebnis \u2014 der Text eines Freitexts ist immer Pflicht; die Angabe entfernen.",en:"'textRequired' on a free-text result \u2014 the text of a free text is always required; remove the entry."}}),t.chat===void 0)r.push({field:"result.chat",code:Ye.chatMissing,message:{de:"Ein Aufgaben-Ergebnis steht nur im Chat \u2014 'result.chat' fehlt: 'all', 'team:<Gruppe>' oder einen Kanal des Workflows angeben.",en:"A task result appears only in the chat \u2014 'result.chat' is missing: give 'all', 'team:<group>' or a channel of the workflow."}});else{let o=t.chat,a=typeof o=="string"?ga(o):null;o==="external"||a===null?r.push({field:"result.chat",code:Ye.chatExternal,message:{de:`'result.chat' ${JSON.stringify(o)} \u2014 ein Aufgaben-Ergebnis bleibt intern: erlaubt sind 'all', 'team:<Gruppe>' oder ein Kanal des Workflows, nie 'external'.`,en:`'result.chat' ${JSON.stringify(o)} \u2014 a task result stays internal: 'all', 'team:<group>' or a channel of the workflow are allowed, never 'external'.`}}):a.kind==="channel"&&!n.channelKeys.has(a.channelKey)&&r.push({field:"result.chat",code:Ye.chatUnknownChannel,message:{de:`'result.chat' "${a.channelKey}" ist weder 'all' noch 'team:<Gruppe>' noch ein Kanal des Workflows (bekannt: ${[...n.channelKeys].join(", ")||"keine"}).`,en:`'result.chat' "${a.channelKey}" is neither 'all' nor 'team:<group>' nor a channel of the workflow (known: ${[...n.channelKeys].join(", ")||"none"}).`}})}return r.push(...FF(t,["kind","options","textRequired","chat","item","label","writes","fields","prices"],{de:"Aufgaben-Ergebnis",en:"task result"})),r}s(G3,"recordedIssues");function LF(e,t,n={channelKeys:new Set}){if(t===void 0)return[];if(e!=="task")return[{field:"result",code:Ye.onApproval,message:{de:`'result' gilt nur f\xFCr die Art 'task' \u2014 eine '${e}' wird durch ihr Votum abgeschlossen, nicht durch ein Ergebnis.`,en:`'result' applies only to the kind 'task' \u2014 an '${e}' is completed by its vote, not by a result.`}}];if(typeof t!="object"||t===null||Array.isArray(t))return[{field:"result",code:Ye.unknownKind,message:{de:`'result' muss ein Objekt mit 'kind' sein; bekannte Arten: ${pa.join(", ")}.`,en:`'result' must be an object with 'kind'; known kinds: ${pa.join(", ")}.`}}];let r=t;return ON(r.kind)?r.kind==="appointment"?V3(r):G3(r.kind,r,n):[{field:"result.kind",code:Ye.unknownKind,message:{de:`Unbekannte Ergebnisart ${JSON.stringify(r.kind)}; bekannte Arten: ${pa.join(", ")}.`,en:`Unknown result kind ${JSON.stringify(r.kind)}; known kinds: ${pa.join(", ")}.`}}]}s(LF,"taskResultIssues");var z3="optionalAction:";function MF(e){return`${z3}${e}:trigger`}s(MF,"optionalActionTriggerActionId");var W3="processDecide";function qF(e){let t=e.optionalActions;return t==null?[]:(Array.isArray(t)||C(`[optionalAction/corrupt-section] node's 'optionalActions' is ${typeof t}, not an array \u2014 corrupt pinned graph (publish stores the section as authored)`),t)}s(qF,"optionalActionBindings");function KF(e){return qF(e).map(t=>({id:MF(t.key),kind:"internal",label:t.label,surface:W3,placement:"overflow",superUserOnly:!0}))}s(KF,"optionalActionTriggers");function jF(e){let t=e.tasks;return Array.isArray(t)?t:[]}s(jF,"authoredTemplates");function VF(e){let t=e?.result;return t?.kind!=="appointment"?[]:t.participants?.feedback?.tasks??[]}s(VF,"personTasksOf");function Tb(e){let t=jF(e);return qF(e).map(n=>{let r=new Set(n.tasks??[]),i=new Set;for(let o of r)for(let a of VF(t.find(l=>l.key===o)))i.add(a);return{binding:n,tasks:r,personTasks:i,keys:new Set([...r,...i])}})}s(Tb,"optionalActionMembership");function Y3(e){let t=new Set;for(let n of jF(e))for(let r of VF(n))t.add(r);return t}s(Y3,"personRowTemplateKeys");function BF(e){let t=new Set(Y3(e));for(let{keys:n}of Tb(e))for(let r of n)t.add(r);return t}s(BF,"referencedTaskTemplateKeys");var Cr={shape:"[taskInput/shape]",notInRound:"[taskInput/notInRound]",notRecord:"[taskInput/notRecord]",prefillNotDeclared:"[taskInput/prefillNotDeclared]",prefillType:"[taskInput/prefillType]",feedbackTasks:"[appointment/feedbackTasks]",feedbackOptional:"[appointment/feedbackOptional]",recordAssignment:"[taskResult/recordAssignment]"},Rb=60;function ja(e,t,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${t} ${n.de}`,en:`${t} ${n.en}`},severity:"error"}}s(ja,"error");function hs(e){return Array.isArray(e.tasks)?e.tasks:[]}s(hs,"tasksOf");function UF(e){return(Array.isArray(e.optionalActions)?e.optionalActions:[]).filter(n=>n.action==="spawnTasks")}s(UF,"spawnBindingsOf");function Nd(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}s(Nd,"stringList");function ci(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(ci,"record");function Eb(e){let t=ci(e?.result);return t?.kind==="appointment"?ci(t.participants):null}s(Eb,"participantsOf");function $b(e){return Nd(ci(Eb(e)?.feedback)?.tasks)}s($b,"feedbackTasksOf");function GF(e,t){return Tb(e).find(n=>n.keys.has(t))}s(GF,"roundOf");function H3(e,t,n){let r=s(u=>({code:Cr.notInRound,reason:u}),"notInRound"),i=GF(e,t);if(i===void 0)return r({de:`Aufgabe "${t}" geh\xF6rt zu keiner optionalen Aktion \u2014 Vorgaben liest nur eine Aufgabe einer Runde.`,en:`Task "${t}" belongs to no optional action \u2014 only a task of a round reads inputs.`});if(n.scope!=="task"||n.path!==void 0)return r({de:`${ce(n)} ist kein Wert einer Aufgabe ($task.<aufgabe>.<schl\xFCssel>).`,en:`${ce(n)} is no value of a task ($task.<task>.<key>).`});let{binding:o}=i,a=n.owner;if(a===t)return r({de:`Aufgabe "${t}" liest ihren eigenen Wert.`,en:`Task "${t}" reads its own value.`});let l=hs(e).find(u=>u.key===a),d=ci(l?.blocks),c=i.tasks.has(a)&&d?.templateKey===t&&(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 "${t}" 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 "${t}" through 'blocks' \u2014 the value would not be settled when the task opens.`}):ci(l?.result)?.kind!=="record"?{code:Cr.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(H3,"taskInputRefusal");function J3(e,t){if(t.scope!=="task")return;let n=hs(e).find(i=>i.key===t.owner),r=ci(n?.result);if(r?.kind==="record")return(Array.isArray(r.fields)?r.fields:[]).map(ci).find(i=>i?.writes===t.key)??void 0}s(J3,"writerField");function Q3(e,t,n){let r=String(t.key);if(t.inputs===void 0)return[];if(!Array.isArray(t.inputs))return[ja(`${n}.inputs`,Cr.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 t.inputs.entries()){if(!ke(l))continue;let d=ce(l);if(o.has(d)){i.push(ja(`${n}.inputs.${a}`,Cr.shape,{de:`${d} steht zweimal in 'inputs'.`,en:`${d} is listed twice in 'inputs'.`}));continue}o.add(d);let c=H3(e,r,l);c!==null&&i.push(ja(`${n}.inputs.${a}`,c.code,c.reason))}return i}s(Q3,"inputIssues");function Z3(e,t,n,r){let i=n;if(AC(r))return $b(i).length===1?null:{code:Cr.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(ce):[];if(!ke(r)||!o.includes(ce(r)))return{code:Cr.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:Cr.prefillType,reason:c}),"prefillType"),l=$b(i),d=fd(e,r);if(d===void 0)return null;if(hn(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=Nd(J3(t,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(Z3,"participantPrefillRefusal");function X3(e,t,n,r){let i=Eb(n)?.prefill;if(i===void 0)return[];let o=Z3(e,t,n,i);return o===null?[]:[ja(`${r}.result.participants.prefill`,o.code,o.reason)]}s(X3,"prefillIssues");function e4(e,t){return UF(e).some(n=>Nd(n.tasks).includes(t))}s(e4,"belongsToOptionalAction");function t4(e,t,n){let r=t.key,i=hs(e).find(c=>c.key===n),o=s(c=>({code:Cr.feedbackTasks,reason:c}),"feedbackTasks");if(i===void 0)return[o({de:`"${n}" ist keine Aufgabe dieses Knotens.`,en:`"${n}" is no task of this node.`})];let a=[];i.feedback!==!0&&a.push(o({de:`"${n}" ist keine Feedback-Aufgabe ('feedback: true').`,en:`"${n}" is no feedback task ('feedback: true').`})),UF(e).some(c=>Nd(c.tasks).includes(n))&&a.push(o({de:`"${n}" steht in den Aufgaben einer optionalen Aktion \u2014 eine Personenzeile entsteht nur beim Buchen.`,en:`"${n}" is among an optional action's tasks \u2014 a person row exists only through a booking.`}));let l=hs(e).find(c=>c.key!==r&&$b(c).includes(n));l!==void 0&&a.push(o({de:`"${n}" wird auch von "${String(l.key)}" angelegt \u2014 jede Feedback-Art geh\xF6rt zu genau einem Termin.`,en:`"${n}" 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:`"${n}" tr\xE4gt ${d.map(c=>`'${c}'`).join(", ")} \u2014 eine Personenzeile entsteht nur beim Buchen und h\xE4lt nur ihre Runde.`,en:`"${n}" 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:Cr.feedbackOptional,reason:{de:`"${n}" ist optional \u2014 eine Personenzeile h\xE4lt ihre Runde und damit die Pause, sie kann nicht \xFCbersprungen werden.`,en:`"${n}" is optional \u2014 a person row holds its round and with it the pause; it cannot be skipped.`}}),a}s(t4,"participantFeedbackRefusals");function n4(e,t,n){let r=Eb(t);if(r===null||r.feedback===void 0)return[];let i=String(t.key),o=`${n}.result.participants.feedback`,a=ci(r.feedback),l=a?.tasks,d=[],c=s((p,h,y=Cr.feedbackTasks)=>d.push(ja(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>Rb)&&c(`${o}.dueDaysAfterEnd`,{de:`'feedback.dueDaysAfterEnd' ist eine ganze Zahl von 0 bis ${Rb}.`,en:`'feedback.dueDaysAfterEnd' is a whole number from 0 to ${Rb}.`}),e4(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,t,p))c(`${o}.tasks`,h.reason,h.code);return d}s(n4,"feedbackIssues");function r4(e,t){let n=GF(e,t)?.personTasks??new Set;return hs(e).filter(r=>r.feedback===!0&&typeof r.key=="string"&&n.has(r.key)).map(r=>r.key)}s(r4,"assignableFeedbackTasks");function i4(e,t,n){let r=ci(t.result);if(r?.kind!=="record"||!Array.isArray(r.fields))return[];let i=r4(e,String(t.key)),o=new Map(hs(e).map(l=>[l.key,l])),a=[];for(let[l,d]of r.fields.entries()){let c=ci(d);if(c?.type!=="assignment")continue;let u=Nd(c.tasks).filter(p=>o.get(p)?.feedback===!0&&!i.includes(p));u.length!==0&&a.push(ja(`${n}.result.fields.${l}.tasks`,Cr.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(i4,"assignmentIssues");function zF(e,t){let n=[];for(let r of hs(t)){if(typeof r.key!="string")continue;let i=`nodes.${t.id}.tasks.${r.key}`;n.push(...Q3(t,r,i)),n.push(...X3(e,t,r,i)),n.push(...n4(t,r,i)),n.push(...i4(t,r,i))}return n}s(zF,"taskInputIssues");function ui(e){return e.nodes.map(t=>t)}s(ui,"rawNodesOf");var Fn={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 Ln(e,t,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${t} ${n.de}`,en:`${t} ${n.en}`},severity:"error"}}s(Ln,"issue");function o4(e,t,n){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===n&&a===t}).map(i=>({nodeId:r.id,key:String(i.key)})))}s(o4,"blockersOf");function WF(e){let{graph:t,node:n,task:r}=e,i=r.familyRequest;if(i===void 0)return[];let o=typeof r.key=="string"?r.key:"?",a=`nodes.${n.id}.tasks.${o}`,l={de:`Task "${o}" auf Knoten \u201E${Pe(t,n.id,"de")}\u201C (${n.id})`,en:`Task "${o}" on node "${Pe(t,n.id,"en")}" (${n.id})`},d=[];if(typeof i!="object"||i===null||Array.isArray(i))return[Ln(`${a}.familyRequest`,Fn.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(Ln(`${a}.familyRequest.${c[0]}`,Fn.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(Ln(`${a}.familyRequest`,Fn.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(Ln(`${a}.familyRequest`,Fn.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(Ln(`${a}.kind`,Fn.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(Ln(`${a}.${b}`,Fn.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(Ln(`${a}.blocks`,Fn.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 o4(ui(t),n.id,o))d.push(Ln(`nodes.${b.nodeId}.tasks.${b.key}.blocks`,Fn.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(Ln(`${a}.params.dueInDays`,Fn.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(Ln(`${a}.familyRequest.fields`,Fn.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=ce(b);if(y.has(k)){d.push(Ln(`${a}.familyRequest.fields`,Fn.fields,{de:`${l.de}: 'familyRequest.fields' nennt ${Ue(t,b,"de")} mehrfach.`,en:`${l.en}: 'familyRequest.fields' names ${Ue(t,b,"en")} more than once.`}));continue}y.add(k),gt(b)||d.push(Ln(`${a}.familyRequest.fields`,Fn.unknownField,{de:`${l.de}: 'familyRequest.fields' nennt ${Ue(t,b,"de")} \u2014 anfordern l\xE4sst sich nur ein Feld eines Formulars ($node.<formular>.admission.<feld>).`,en:`${l.en}: 'familyRequest.fields' names ${Ue(t,b,"en")} \u2014 only a field of a form ($node.<form>.admission.<field>) can be requested.`}))}return d}s(WF,"familyRequestIssues");function YF(e){let t=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"&&t.has(a));return o.length<=1?[]:[Ln(`nodes.${e.id}.optionalActions.${i}.tasks`,Fn.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(YF,"familyRequestActionIssues");function HF(e,t){let n=ui(e),r=new Map;for(let a of n)if(!(a.type!=="completenessCheck"||!Array.isArray(a.requires)))for(let l of a.requires)gt(l)&&r.set(ce(l),l);if(r.size===0)return[];let i=s(a=>{let l=li(t,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(gt):!ke(d)||d.scope!=="node"?[]:[...r.values()].filter(c=>c.owner===d.owner&&i(c))},"offeredBy");return n.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(ce(k)));return b.length===0?[]:[{...Ln(`nodes.${a.id}.requiresOneOf`,Fn.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(HF,"familyRequestDeadlockWarnings");var Ib={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},Ob={appointment:s((e,t)=>({de:`Aufgabe "${e}" an ${t.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 ${t.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 s4(e){let t=Ze(e);return new Map((typeof t.workItemTemplates=="function"?t.workItemTemplates(e):[]).map(n=>[n.key,n]))}s(s4,"intrinsicTemplatesOf");function QF(e,t,n){if(n!==void 0&&typeof n!="string")return null;let r=n??t,i=e.nodes.find(l=>l.id===r);if(i===void 0)return null;let o=i,a=Ze(i);return{node:o,composedKeys:new Set((Array.isArray(o.tasks)?o.tasks:[]).map(l=>l.key).filter(l=>typeof l=="string")),intrinsicByKey:s4(i),refuse:s(l=>typeof a.refuseBlocksTarget=="function"?a.refuseBlocksTarget(i,l):null,"refuse")}}s(QF,"resolveBlocksTargetNode");function a4(e){let t=new Map;for(let r of Cn(e.nodes)){let i=t.get(r.source)??[];i.push(r.target),t.set(r.source,i)}let n=new Map;return r=>{let i=n.get(r);if(i!==void 0)return i;let o=new Set,a=[...t.get(r)??[]];for(;a.length>0;){let l=a.shift();o.has(l)||(o.add(l),a.push(...t.get(l)??[]))}return n.set(r,o),o}}s(a4,"reachability");function ZF(e){let t=[],n=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;n.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("::");t.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=n.get(o);l!==void 0&&n.has(l)&&i(l,[...a,o]),r.set(o,"done")},"walk");for(let o of n.keys())i(o,[]);return t}s(ZF,"checkBlocksCycles");function l4(e){let{requiresOneOf:t,optionalActions:n}=e;if(!Array.isArray(t)||!Array.isArray(n))return new Set;let r=new Set(t.filter(o=>typeof o=="string")),i=new Set;for(let o of n)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(l4,"tasksOfRequiresOneOf");function XF(e){if(typeof e!="object"||e===null)return!1;let{de:t,en:n}=e;return typeof t=="string"&&t.trim().length>0&&typeof n=="string"&&n.trim().length>0}s(XF,"isFilledBilingual");var d4=["blocks","gatesNode","locksEvidence","completableIf"];function c4(e,t){let n={de:`Task "${t.key}" (Knoten "${t.nodeId}")`,en:`Task "${t.key}" (node "${t.nodeId}")`},r=[];e.feedback!==!0&&r.push(Pt(`${t.base}.feedback`,{de:`[workItems/feedbackNotTrue] ${n.de}: 'feedback' kennt nur true; erhalten ${JSON.stringify(e.feedback)}.`,en:`[workItems/feedbackNotTrue] ${n.en}: 'feedback' only knows true; got ${JSON.stringify(e.feedback)}.`}));let i=e.result;if(e.kind!=="task"||typeof i?.kind!="string"||!mk({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(Pt(`${t.base}.feedback`,{de:`[workItems/feedbackNeedsProse] ${n.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] ${n.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(Pt(`${t.base}.feedback`,{de:`[workItems/feedbackSteersProcess] ${n.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] ${n.en} is a feedback task; its answer comes from a page without application data, so it may not depend on ${o.join(", ")}.`})),r}s(c4,"feedbackTaskIssues");function u4(e,t){let n=[],r={de:`Task "${t.key}" (Knoten "${t.nodeId}")`,en:`Task "${t.key}" (node "${t.nodeId}")`},i=e.optional;(!(typeof i=="object"&&i!==null&&Object.keys(i).every(d=>d==="skipLabel"))||!XF(i.skipLabel))&&n.push(Pt(`${t.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"&&n.push(Pt(`${t.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"||!mk({kind:a.kind,writes:a.writes}))&&n.push(Pt(`${t.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=d4.filter(d=>e[d]!==void 0);return l.length>0&&n.push(Pt(`${t.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.`})),t.requiredByRule&&n.push(Pt(`${t.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.`})),n}s(u4,"optionalTaskIssues");function Pt(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(Pt,"issue");function eL(e,t){let n=[],r=a4(e),i=new Set(qa(e).map(o=>o.key));n.push(...HF(e,t));for(let o of e.nodes){let a=o,l=BF(o);n.push(...YF(o));let d=l4(a);n.push(...zF(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 F=typeof k.node=="string"?k.node:o.id,$=ui(e).find(ae=>ae.id===F),G=(Array.isArray($?.tasks)?$.tasks:[]).find(ae=>ae.key===k.templateKey)?.blocks;typeof G?.node=="string"&&G.node!==F&&n.push(Pt(`${h}.blocks.templateKey`,{de:`[workItems/blocksCrossNodeTask] Task "${p}" auf Knoten "${o.id}" h\xE4lt "${k.templateKey}" auf Knoten "${F}" 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 "${F}" \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 F=v;e.nodes.some($=>$.id===F)&&!r(o.id).has(F)&&n.push(Pt(`${h}.blocks.node`,{de:`[workItems/blocksTargetNotAfter] Task "${p}" auf Knoten "${o.id}" blockiert Knoten "${F}", 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 "${F}", 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||!ma(b.kind))&&n.push(Pt(`${h}.blocks.node`,{de:`[workItems/crossNodeBlocksNeedsResult] Task "${p}" auf Knoten "${o.id}" blockiert einen anderen Knoten ("${F}"), 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 ("${F}") 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)&&n.push(Pt(`${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 F of LF(String(y),b,{channelKeys:i,nodeTasks:c,...t?.billingItemKeys!==void 0?{billingItemKeys:t.billingItemKeys}:{},...t?.offerProgram!==void 0?{offerProgram:t.offerProgram}:{}}))n.push(Pt(`${h}.${F.field}`,{de:`${F.code} ${F.message.de} (Task "${p}" auf Knoten "${o.id}").`,en:`${F.code} ${F.message.en} (task "${p}" on node "${o.id}").`}));let A=u.when,T=s((F,$,q)=>{!ke($)||gt($)||n.push(Pt(F,{de:`[workItems/evidenceNotFormField] ${q} auf Task "${p}" (Knoten "${o.id}") nennt ${Ue(e,$,"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,$,"en")} \u2014 the condition and evidence of a task are fields of a form ($node.<form>.admission.<field>).`}))},"notFormField");A!==void 0?(T(`${h}.when`,A,"'when'"),u.onConditionReturn!=="respawn"&&u.onConditionReturn!=="stayClosed"&&n.push(Pt(`${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&&n.push(Pt(`${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))n.push(Pt(`${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[F,$]of I.entries())T(`${h}.reads.${F}`,$,"'reads'");let D=u.locksEvidence,L=s((F,$)=>n.push(Pt(`${h}.locksEvidence`,{de:`[workItems/${F}] Task "${p}" (Knoten "${o.id}") ${$.de}`,en:`[workItems/${F}] Task "${p}" (node "${o.id}") ${$.en}`})),"lockIssue");D!==void 0&&D!==!0&&L("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&&A===void 0&&L("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||!ma(b.kind))&&L("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)&&L("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."})),n.push(...WF({graph:e,node:a,task:u,onTrigger:l,specCtx:t}));let N=Object.keys(u).filter(F=>!Object.hasOwn(Ib,F)&&!Object.hasOwn(Ob,F));N.length>0&&n.push(Pt(`${h}.${N[0]}`,{de:`[workItems/unknownKey] Task "${p}" (Knoten "${o.id}") tr\xE4gt ${N.map(F=>`'${F}'`).join(", ")} \u2014 kein Feld einer Aufgabe. Erlaubt: ${Object.keys(Ib).join(", ")}. (Checklisten gibt es nicht mehr: Text als 'description', mehrere Arbeitsschritte sind mehrere Aufgaben.)`,en:`[workItems/unknownKey] Task "${p}" (node "${o.id}") carries ${N.map(F=>`'${F}'`).join(", ")} \u2014 not a field of a task. Allowed: ${Object.keys(Ib).join(", ")}. (Checklists no longer exist: text goes in 'description', several work steps are several tasks.)`}));let x=u.description;x!==void 0&&!XF(x)&&n.push(Pt(`${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&&n.push(...c4(u,{key:p,nodeId:o.id,base:h})),u.optional!==void 0&&n.push(...u4(u,{key:p,nodeId:o.id,base:h,requiredByRule:d.has(p)}))}}return n}s(eL,"checkNodeTasks");function tL(e){let t=e.indexOf(":"),n=t===-1?"":e.slice(0,t),r=t===-1?"":e.slice(t+1).trim();if(n==="artifact"&&r.length>0)return{kind:n,key:r};let i=Si(r);return n==="field"&&i!==null?{kind:n,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(tL,"parseTaskDocumentRef");function _b(e){return e.kind==="artifact"?`artifact:${e.key}`:`field:${ce(e.address)}`}s(_b,"taskDocumentId");function Mi(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(Mi,"issue");function nL(e){return Array.isArray(e.tasks)?e.tasks:[]}s(nL,"tasksOf");function Pd(e){let t=new Map;for(let n of e){let{id:r,artifacts:i}=n;for(let o of Array.isArray(i)?i:[])typeof o?.key=="string"&&t.set(o.key,[...t.get(o.key)??[],{nodeId:r,slot:o}])}return t}s(Pd,"artifactSlotDeclarations");function f4(e){return e.flatMap(t=>{let{id:n,artifacts:r}=t;return(Array.isArray(r)?r:[]).filter(i=>!gm(i?.type)).map(i=>({nodeId:String(n),slotKey:String(i?.key),type:JSON.stringify(i?.type??null)}))})}s(f4,"unknownArtifactSlotTypes");function rL(e){let t=[];for(let{nodeId:n,slotKey:r,type:i}of f4(e.nodes))t.push(Mi(`nodes.${n}.artifacts.${r}.type`,{de:`[artifact/unknownType] Knoten "${n}" deklariert den Dokument-Slot \u201E${r}" mit der Art ${i} \u2014 erlaubt sind ${Oa.join(", ")}.`,en:`[artifact/unknownType] Node "${n}" declares the document slot "${r}" with the type ${i} \u2014 allowed are ${Oa.join(", ")}.`}));for(let[n,r]of Pd(e.nodes))for(let i of r.slice(1))t.push(Mi(`nodes.${i.nodeId}.artifacts`,{de:`[governedDocument/slotKeyTaken] Knoten "${i.nodeId}" deklariert den Dokument-Slot \u201E${n}", 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 "${n}", which "${r[0].nodeId}" already declares \u2014 every slot key belongs to exactly one node.`}));return t}s(rL,"checkArtifactSlotKeys");function p4(e,t,n,r=Pd(e.nodes)){let i=r.get(t)?.[0]?.nodeId;return i===void 0?{reason:"unknown"}:Aa(e,i,n)?null:{reason:"notBefore",owner:i}}s(p4,"slotLinkRefusal");function iL(e){if(!Array.isArray(e)||e.length===0)return null;let t=[];for(let n of e){let r=typeof n=="object"&&n!==null?n:{},i=Object.keys(r).sort().join(",");if(r.kind==="artifact"&&i==="key,kind"&&typeof r.key=="string"&&r.key.length>0)t.push({kind:"artifact",key:r.key});else if(r.kind==="field"&&i==="address,kind")t.push({kind:"field",address:r.address});else return null}return t}s(iL,"authoredRefs");function oL(e){let t=[],n=Pd(e.nodes);for(let r of ui(e))for(let i of nL(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=iL(i.documents);if(d===null){t.push(Mi(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"?_b(u):_b({kind:"field",address:u.address});if(c.has(p)&&t.push(Mi(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=p4(e,u.key,r.id,n);h?.reason==="unknown"?t.push(Mi(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"&&t.push(Mi(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"&&!gt(u.address)&&t.push(Mi(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 t}s(oL,"checkTaskDocuments");function sL(e,t){let n=[];for(let r of ui(e))for(let i of nL(r)){let o=iL(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"||!gt(d.address))continue;let c=li(t,d.address);if(c==null)continue;let u={de:Ue(e,d.address,"de"),en:Ue(e,d.address,"en")},p=Ra("taskDocument",Ta(c));if(p==="repeated"){n.push(Mi(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"&&n.push(Mi(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 n}s(sL,"checkTaskDocumentFields");var Pb=["form","artifact","field"],Ba=["coverLetter","contract"],lL="form",aL=/^[A-Za-z0-9_.-]+$/;function m4(e){return Ba.includes(e)}s(m4,"isArtifactPart");function Va(e){return de("INVALID",{de:`Ansichts-Adresse "${e}" ist ung\xFCltig \u2014 erwartet form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Ba.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`View address "${e}" is invalid \u2014 expected form:<form node>#<view>, artifact:<slot>[#${Ba.join("|")}] or field:$node.<form>.admission.<field>.`})}s(Va,"invalid");function Cb(e){let t=e.indexOf(":");if(t===-1)return Va(e);let n=e.slice(0,t),r=e.slice(t+1);if(n==="field"){let l=Si(r);return l===null?Va(e):{kind:n,address:l}}let i=r.indexOf("#"),o=i===-1?r:r.slice(0,i),a=i===-1?null:r.slice(i+1);return aL.test(o)?n==="form"?a!==null&&aL.test(a)?{kind:n,form:o,view:a}:Va(e):n==="artifact"?a===null?{kind:n,slot:o}:m4(a)?{kind:n,slot:o,part:a}:Va(e):Va(e):Va(e)}s(Cb,"parseViewAddress");function dL(e){let t=g4(e);if(t===null)return null;let n=h4(t);return n!==null&&JSON.stringify(Nb(n))===JSON.stringify(Nb(e))?n:null}s(dL,"viewAddressOf");function h4(e){try{return Cb(e)}catch{return null}}s(h4,"tryParseViewAddress");function g4(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e;if(t.kind==="form"&&typeof t.form=="string"&&typeof t.view=="string")return`form:${t.form}#${t.view}`;if(t.kind==="artifact"&&typeof t.slot=="string")return t.part===void 0?`artifact:${t.slot}`:typeof t.part=="string"?`artifact:${t.slot}#${t.part}`:null;if(t.kind==="field"&&t.address!==null&&typeof t.address=="object"){let n=t.address;return typeof n.scope!="string"||typeof n.key!="string"?null:`field:${ce(n)}`}return null}s(g4,"spellingOf");function Nb(e){return e===null||typeof e!="object"||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).sort(([t],[n])=>t<n?-1:t>n?1:0).map(([t,n])=>[t,Nb(n)]))}s(Nb,"canonical");function cL(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:${ce(e.address)}`}}s(cL,"formatViewAddress");var Db=["form","documents"],y4=/^[a-z][a-zA-Z0-9_-]*$/;function w4(e){let t=new Map,n=s(r=>{for(let i of[...r.fields,...(r.groups??[]).flatMap(o=>o.fields)])t.set(i.key,i.type==="docRef"?"document":"other");for(let i of r.repeated??[]){t.set(i.key,"other");for(let o of i.itemTemplate)t.set(`${i.key}[].${o.key}`,o.type==="docRef"?"row":"other")}r.subsections?.forEach(n)},"visit");return e.sections.forEach(n),t}s(w4,"fieldPlaces");function uL(e,t,n){let r=[],i=new Set;return e.forEach((o,a)=>{if(typeof o!="string"||!y4.test(o)){r.push({severity:"error",path:`${n(a)}.key`,code:"view.invalid-key",message:{de:`${t.de}: '${String(o)}' ist kein g\xFCltiger Schl\xFCssel (Kleinbuchstabe am Anfang, dann Buchstaben, Ziffern, - oder _).`,en:`${t.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:`${n(a)}.key`,code:"view.duplicate-key",message:{de:`${t.de}: Der Schl\xFCssel '${o}' kommt doppelt vor.`,en:`${t.en}: the key '${o}' occurs twice.`}}),i.add(o)}),r}s(uL,"keyIssues");function k4(e,t,n){return e==="document"?null:e===void 0?{severity:"error",path:n,code:"view.unknown-field",message:{de:`Ansicht: Das Formular hat kein Feld '${t}'.`,en:`View: the form has no field '${t}'.`}}:e==="row"?{severity:"error",path:n,code:"view.field-in-row",message:{de:`Ansicht: Das Dateifeld '${t}' liegt in einem wiederholten Block und kann nicht einzeln genannt werden.`,en:`View: the file field '${t}' sits in a repeated block and cannot be named on its own.`}}:{severity:"error",path:n,code:"view.not-a-document",message:{de:`Ansicht: Das Feld '${t}' enth\xE4lt keine Datei.`,en:`View: the field '${t}' holds no file.`}}}s(k4,"fieldIssue");function b4(e,t,n){let r=[];Db.includes(e.key)&&r.push({severity:"error",path:`${t}.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:`${t}.groups`,code:"view.empty",message:{de:`Ansicht '${e.key}' hat keine Gruppen.`,en:`View '${e.key}' has no groups.`}}),r.push(...uL(i.map(a=>a.key),{de:`Gruppe der Ansicht '${e.key}'`,en:`Group of view '${e.key}'`},a=>`${t}.groups[${a}]`));let o=new Set;return i.forEach((a,l)=>{let d=`${t}.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=k4(n.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(b4,"viewIssues");function v4(e){if(!Array.isArray(e))return"views";for(let[t,n]of e.entries()){let r=n?.groups;if(!Array.isArray(r))return`views[${t}].groups`;for(let[i,o]of r.entries()){let a=o?.fields;if(!Array.isArray(a)||a.some(l=>typeof l!="string"))return`views[${t}].groups[${i}].fields`}}return null}s(v4,"malformedAt");function fL(e){let t=e.views;if(t===void 0)return[];let n=v4(t);if(n!==null)return[{severity:"error",path:n,code:"view.malformed",message:{de:`${n} 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:`${n} 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=w4(e);return[...uL(t.map(i=>i.key),{de:"Ansicht",en:"View"},i=>`views[${i}]`),...t.flatMap((i,o)=>b4(i,`views[${o}]`,r))]}s(fL,"formViewIssues");function Ua(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(Ua,"issue");function pL(e,t,n,r,i){let o=dL(e);if(o===null)return[Ua(t,{de:`[view/invalid] 'view' auf ${n.de} ist keine Ansichts-Adresse \u2014 erwartet { kind: ${Pb.join(" | ")}, \u2026 }: form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Ba.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] 'view' on ${n.en} is no view address \u2014 expected { kind: ${Pb.join(" | ")}, \u2026 }: form:<form node>#<view>, artifact:<slot>[#${Ba.join("|")}] or field:$node.<form>.admission.<field>.`})];let a=cL(o);switch(o.kind){case"artifact":return r.has(o.slot)?[]:[Ua(t,{de:`[view/unknownSlot] ${n.de} nennt "${a}", aber kein Knoten dieses Graphen hat den Dokument-Slot "${o.slot}".`,en:`[view/unknownSlot] ${n.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[Ua(t,{de:`[view/invalid] ${n.de} nennt "${a}" \u2014 ein Dateifeld liegt in einem Formular: field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] ${n.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?[Ua(t,{de:`[view/unknownForm] ${n.de} nennt "${a}", aber kein Formularknoten hei\xDFt so.`,en:`[view/unknownForm] ${n.en} names "${a}", but no form node has that id.`})]:o.kind==="field"?[]:c.has(o.view)||Db.includes(o.view)?[]:[Ua(t,{de:`[view/unknownView] ${n.de} nennt "${a}", aber das Formular "${o.form}" hat keine Ansicht "${o.view}".`,en:`[view/unknownView] ${n.en} names "${a}", but the form "${o.form}" has no view "${o.view}".`})]}}}s(pL,"viewIssues");function mL(e,t){let n=[],r=new Set(Pd(e.nodes).keys());for(let i of ui(e)){if(i.view!==void 0){let o={de:`Knoten "${i.id}"`,en:`node "${i.id}"`};i.type!=="decision"?n.push(Ua(`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.`})):n.push(...pL(i.view,`nodes.${i.id}.view`,o,r,t))}for(let o of Array.isArray(i.tasks)?i.tasks:[]){if(o.view===void 0)continue;let a=String(o.key);n.push(...pL(o.view,`nodes.${i.id}.tasks.${a}.view`,{de:`Task "${a}" (Knoten "${i.id}")`,en:`Task "${a}" (node "${i.id}")`},r,t))}}return n}s(mL,"checkTaskViews");var Hn="traeger",hL={de:"Tr\xE4ger",en:"Provider"};function Ga(e){let t=e.inputs?.[Hn];return t?.kind==="literal"&&typeof t.value=="string"&&t.value.length>0?t.value:null}s(Ga,"traegerKeyOfNode");var Pm={name:"input.traeger.name",address:"input.traeger.anschrift"},Qxe=Object.values(Pm);var gL="governedDocument",gs="prepareDocument",Cd="prepareDocument:revision",Dr="releaseApproval",ys="documentResponse",To="coverLetterResponse",Cm="confirmCoverLetter",Dm="requestCoverLetterRevision",za="coverLetterConfirmation",fi="responseCheck",Fm="returnSigned";var yL="requestApproval";var wL="issueDocument",kL="correctInPlace",bL="rescindAndReissue",Lm="requestChange";var Wa="releaseArtifact",gn="signingRecovery",Mm="resendESignature",ws="switchToPaper";var Dd=new Set([gs,Cd]),vL=["pending","producing","producingHeld","deferred","awaitingApproval","awaitingCoverLetter","awaitingResponse","responseReturned","responseInCheck","awaitingSignature","signatureStalled","done"],qm=["upload","resolver","template","none"],ks=1,bs=366,qi="responseDueInDays";function vs(e){let t=e.inputs?.[za];return t?.kind==="literal"&&t.value===!0}s(vs,"coverLetterConfirmationOf");function Fd(e){let t=e.inputs?.[qi];return t?.kind==="literal"&&Ld(t.value)?t.value:void 0}s(Fd,"responseDueInDaysForVocabulary");function Ld(e){return typeof e=="number"&&Number.isInteger(e)&&e>=ks&&e<=bs}s(Ld,"isValidResponseDueInDays");var Km=["generatedAt","responseDueInDays","countersignature"],xs=["release","none"],jm=["confirm","signedUpload","signedUploadChecked","eSignature"];var x4={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"}}},xL={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"}}},SL={...xL,kind:"signedUploadChecked",acceptEvent:"contractEvent",checksReturn:!0},S4={...SL,kind:"eSignature",issuesBy:"provider"},Ki={confirm:x4,signedUpload:xL,signedUploadChecked:SL,eSignature:S4};function ji(e){let t=e.responseStrategy;if(typeof t=="string"&&t in Ki)return Ki[t];C(`governedDocument node "${e.id}" declares no valid responseStrategy (got ${JSON.stringify(t)}) \u2014 publish validation should have blocked this; corrupt pinned graph`)}s(ji,"responseStrategyOf");function Vm(e){if(e.type!==gL||e.production!=="resolver")return!1;let t=e.responseStrategy;return typeof t=="string"&&t in Ki?Ki[t].acceptEvent==="contractEvent":!1}s(Vm,"isFamilySignedContractNode");function Ha(e){return e.label}s(Ha,"governedDocTitle");function Fb(e){return e.approval==="release"?yL:wL}s(Fb,"submitActionId");function AL(e,t,n){return{key:t,recipient:"internal",title:n,unlocks:[Fb(e)],gatesNode:!0,advancesNode:!0}}s(AL,"producerTemplate");function A4(e){return e.titles?.respond??e.label}s(A4,"responseTitle");var Ya={de:"\u27E8Titel fehlt\u27E9",en:"\u27E8title missing\u27E9"};function Bm(e){let t=ji(e),n=[];if(e.production!=="none"&&n.push(AL(e,gs,e.titles?.prepare??Ya),AL(e,Cd,e.titles?.revise??Ya)),e.approval==="release"&&n.push({key:Dr,recipient:"internal",title:e.titles?.approve??Ya,unlocks:[],verdictResolved:!0,gatesNode:!0,advancesNode:!0}),n.push({key:ys,recipient:"external",title:A4(e),unlocks:t.producesResponseArtifact?[t.checksReturn?Fm:t.acceptOutcomeId,t.declineOutcomeId,Lm]:[t.acceptOutcomeId,t.declineOutcomeId],advancesNode:!0,...Fd(e)!==void 0?{dueInDays:Fd(e)}:{}}),vs(e)){let r=Ha(e);n.push({key:To,recipient:"external",title:{de:`${r.de}: Angebot best\xE4tigen`,en:`${r.en}: confirm offer`},unlocks:[Cm,Dm,t.declineOutcomeId],advancesNode:!0,...Fd(e)!==void 0?{dueInDays:Fd(e)}:{}})}if(t.checksReturn&&n.push({key:fi,recipient:"internal",title:e.titles?.check??Ya,unlocks:[],verdictResolved:!0,gatesNode:!1,advancesNode:!0}),t.issuesBy==="provider"){let r=Ha(e);n.push({key:gn,recipient:"internal",title:{de:`${r.de}: elektronische Unterschrift kl\xE4ren`,en:`${r.en}: resolve the e-signature`},unlocks:[Mm,ws],gatesNode:!1,advancesNode:!1})}return n}s(Bm,"governedDocIntrinsicTemplates");function T4(e){e.production==="none"&&C(`governedDocSlot: node "${e.id}" has production 'none' \u2014 it governs no artifact slot`);let t=e.artifacts??[];t.length!==1&&C(`governedDocSlot: node "${e.id}" declares ${t.length} artifact slots \u2014 exactly ONE is required (publish validation [governedDocument/slotContract])`);let n=t[0];return(typeof n.key!="string"||n.key.length===0)&&C(`governedDocSlot: node "${e.id}" declares an artifact slot without a key \u2014 corrupt pinned graph`),n}s(T4,"governedDocSlot");function Um(e){return T4(e).key}s(Um,"governedDocSlotKey");var yr="processFooter";var Md="countersign",Lb="countersign",TL="countersigned",Mb="countersigning",RL="countersigned";var $L={de:"Vertrag gegenzeichnen",en:"Countersign the contract"},qd=["scan","eSignature"],Gm="service_provider:1",EL=["countersigning","awaitingSignature","signatureStalled","done"],IL={de:"Elektronische Gegenzeichnung kl\xE4ren",en:"Resolve the electronic countersignature"};function OL(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(OL,"traegerSignatoryMissingReason");function wr(e,t,n){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${t}`,reason:n,severity:"error"}}s(wr,"issue");function zm(e,t){return e.nodes.filter(n=>{let r=n.contract;return n.type==="countersign"&&ke(r)&&r.scope==="node"&&r.owner===t})}s(zm,"countersignersOf");function Kd(e){return e.signing==="eSignature"}s(Kd,"isElectronic");function R4(e,t){if(t===void 0||t.sendable||!Kd(e))return[];let n=e.label?.de??e.id,r=e.label?.en||e.id;return[wr(e,"signing",{de:`[countersign/eSignatureNeedsProvider] \u201E${n}\u201C zeichnet elektronisch gegen, aber die Schule kann nicht senden: ${t.reason.de}`,en:`[countersign/eSignatureNeedsProvider] "${r}" countersigns electronically, but the school cannot send: ${t.reason.en}`})]}s(R4,"countersignProviderIssues");function $4(e,t,n){if(n.scope!=="node")return[];let r=e.nodes.find(o=>o.id===n.owner);if(r===void 0)return[];let i=[];return Vm(r)||i.push("sourceNotCheckedContract"),zm(e,r.id).some(o=>o.id!==t)&&i.push("twice"),i}s($4,"countersignContractRefusals");function _L(e){let t=e.inputs?.dueInDays;return t?.kind==="literal"&&typeof t.value=="number"&&Number.isInteger(t.value)&&t.value>=1?t.value:void 0}s(_L,"validDueInDays");function E4(e,t,n){let r=e.label?.de??e.id,i=e.label?.en||e.id,o=e.signing;if(o!==void 0&&!qd.includes(o))return[wr(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?.[gn];if(!Kd(e))return a===void 0?[]:[wr(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(wr(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(...I4(e,t,n),...O4(e,t,n),...R4(e,n?.signingProvider)),l}s(E4,"signingIssues");function PL(e,t){let n=e.contract;if(!(!ke(n)||n.scope!=="node"))return t.nodes.find(r=>r.id===n.owner)}s(PL,"contractNodeOf");function I4(e,t,n){let r=PL(e,t),i=r===void 0?null:Ga(r),o=i===null?void 0:n?.traeger?.get(i);return o===void 0||o.hasSignatory?[]:[wr(e,"signing",OL(o.name))]}s(I4,"traegerSignatoryIssues");function O4(e,t,n){let r=PL(e,t);if(r===void 0)return[];let i=n?.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(wr(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(Gm)||l.push(wr(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage von \u201E${d.pin}\u201C tr\xE4gt keinen Anker /unterschrift:${Gm}/ \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:${Gm}/ \u2014 the provider would find no signature field for the school.`}));return l}s(O4,"traegerAnchorIssues");var qb=100;async function _4(e,t){let n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",o=>o.eq("context.applicationId",t.applicationId).eq("context.anchor.nodeId",t.node.id)).take(qb+1);n.length>qb&&C(`countersign node "${t.node.id}" of ${t.applicationId} holds more than ${qb} rows`);let r=n.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)===gn)?"signatureStalled":r.some(o=>i(o)===Md)?"countersigning":Kd(t.node)?"awaitingSignature":"done"}s(_4,"countersignCurrentState");var NL={[Mb]:{label:ie("Gegenzeichnung","Countersignature"),tone:"teal",phase:{key:"gegenzeichnung",label:ie("Gegenzeichnung","Countersignature"),scope:"node"},external:at(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."))}},CL={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:TL,label:{de:"Gegengezeichnet",en:"Countersigned"}}],progressDefaults:NL,progressEvents:Ht(NL),entryProgressEvent:s(()=>Mb,"entryProgressEvent"),notificationEvents:s(()=>[{id:RL,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:Lb,kind:"internal",label:$L,surface:yr,availableIn:["countersigning"]},...Kd(e)?[{id:ws,kind:"internal",surface:yr,label:{de:"Auf Papier umstellen",en:"Switch to paper"},availableIn:["signatureStalled"]}]:[]],"actions"),workItemTemplates:s(e=>[{key:Md,recipient:"internal",title:e.titles?.countersign??Ya,unlocks:[Lb],advancesNode:!0,..._L(e)!==void 0?{dueInDays:_L(e)}:{}},...Kd(e)?[{key:gn,recipient:"internal",title:IL,unlocks:[ws],gatesNode:!1,advancesNode:!1}]:[]],"workItemTemplates"),placelessTasks:{[Md]:"Worked in its own step: the contract it countersigns is another node's slot, which this node names by address only.",[gn]:"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:EL,currentState:_4,validate:s((e,t,n)=>{let r=[],i=e.label?.de??e.id,o=e.label?.en||e.id;e.assign?.[Md]===void 0&&r.push(wr(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.`})),co(e.titles?.countersign)||r.push(wr(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(wr(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(...E4(e,t,n));let d=e.contract;if(!ke(d))return r;let c=$4(t,e.id,d);if(c.length===0)return r;let u=t.nodes.find(p=>d.scope==="node"&&p.id===d.owner);if(c.includes("sourceNotCheckedContract")&&r.push(wr(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=zm(t,u.id).filter(h=>h.id!==e.id);r.push(wr(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 N4(e){return Vm(e)?Ga(e):null}s(N4,"traegerSignerOf");var P4=s(e=>e.type==="end"&&ds(e)==="approved","isApprovedEnd");function DL(e){let t=[];for(let n of e.nodes){let r=N4(n);if(r===null)continue;let i=zm(e,n.id).map(u=>u.id),o=tC(e,n.id,new Set(i),P4);if(o===null)continue;let a=n.label?.de||n.id,l=n.label?.en||n.id,d={de:`Einen Knoten \u201EUnterschrift (intern)\u201C (countersign) mit contract: $node.${n.id}.contract auf jeden Weg zu einem Ende mit Ergebnis approved setzen.`,en:`Place an "Internal signature" node (countersign) with contract: $node.${n.id}.contract on every path to an end with outcome approved.`},c=i.length===0?{de:`[countersign/missingForContract] \u201E${a}\u201C (${n.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}" (${n.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 (${n.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}" (${n.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}`};t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}`,reason:c,severity:"error"})}return t}s(DL,"checkCountersignCoverage");var C4=[{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 FL(e){let{nodeId:t,bindingKey:n,binding:r}=e,i=[],o=`nodes.${t}.optionalActions.${n}.input`,a=s((u,p=o)=>{i.push({layer:"GRAPH",kind:"nodeRule",path:p,severity:"error",reason:{de:`[optionalAction/input] Optionale Aktion "${n}" auf Knoten "${t}": ${u.de}`,en:`[optionalAction/input] Optional action "${n}" on node "${t}": ${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.${t}.optionalActions.${n}.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 D4({nodeId:t,binding:r,templates:e.templates,input:l}))a(u);return i}s(FL,"optionalActionInputIssues");function D4(e){let{nodeId:t,binding:n,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 n.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!==n.trigger&&a.push({de:`Die Eingabe "${i}" geh\xF6rt dem Team "${String(l)}", ausgel\xF6st wird die Aktion vom Team "${n.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 "${n.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 C4)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!==t||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(D4,"optionalActionInputRefusals");function Wm(e,t){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:t(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:t(p),idx:0}))}}return l}s(Wm,"detectBackEdges");function Kb(e){let t="error",n=new Map;for(let a of Cn(e.nodes)){let l=n.get(a.source)??[];l.push({id:a.id,target:a.target}),n.set(a.source,l)}let r=[],i=new Set,o=Wm(e.nodes.map(a=>a.id),a=>(n.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:t}));return r}s(Kb,"checkAcyclic");function jb(e){let t=[],n=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))n.has(l.to)||t.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))&&t.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 t}s(jb,"checkNextTargets");function Vb(e){let t=[];for(let n of e.nodes){let r=n.next;if(!r)continue;let i=hm(n),o=new Set(i?i.map(a=>a.id):[vo]);for(let a of Object.keys(r))o.has(a)||t.push({layer:"GRAPH",kind:"unknownOutcome",path:`node.${n.id}.next.${a}`,reason:{de:`${n.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:`${n.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 t}s(Vb,"checkNextOutcomesKnown");function Bb(e){let t=[],n=new Set(Cn(e.nodes).map(o=>o.target)),r=e.nodes.filter(o=>!n.has(o.id));return r.length===0?t.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein Start-Knoten",en:"No start node"},severity:"error"}):r.length>1&&t.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&&t.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein End-Knoten",en:"No end node"},severity:"warning"}),t}s(Bb,"checkStartEnd");function Ub(e){let t=new Map;for(let r of Cn(e.nodes))t.set(r.source,(t.get(r.source)??0)+1);let n=[];for(let r of e.nodes)r.type!=="end"&&(t.get(r.id)??0)===0&&n.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 n}s(Ub,"checkNoOutgoingEdge");function Gb(e){return e.nodes.filter(t=>!Uw(t.id)).map(t=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.id`,reason:{de:`[graph/nodeIdFormat] Knoten "${t.id}": eine Knoten-ID ist ein Bezeichner ohne Punkt (${_r.source}), z. B. "reviewEingereicht". Ein Bundle von vor der Umstellung neu exportieren.`,en:`[graph/nodeIdFormat] Node "${t.id}": a node id is an identifier without a dot (${_r.source}), e.g. "reviewSubmitted". Export a bundle from before the change again.`},severity:"error"}))}s(Gb,"checkNodeIdFormat");function zb(e){let t=new Set(e.nodes.map(r=>r.id)),n=[];for(let r of Cn(e.nodes))t.has(r.source)||n.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"}),t.has(r.target)||n.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 n}s(zb,"checkEdgeEndpoints");function LL(e){let t=[];for(let n of e.nodes)for(let r of n.tasks??[]){let i=r.result;i===null||typeof i!="object"||!(Nm in i)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.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 t}s(LL,"checkRenamedFields");var F4=new Set(["countersignature"]);function ML(e){let t=[],n=s((o,a)=>{t.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&&n("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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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($k[o.type]??{}))c in a&&n(`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&&n(`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(Ob))h in c&&n(`nodes.${o.id}.tasks.${u}.${h}`,y(u,l))}for(let c of Ek[o.type]??[])c in a&&n(`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(wP[o.type]??{}))c in a&&n(`nodes.${o.id}.${c}`,{de:`${l.de}: ${u.de}`,en:`${l.en}: ${u.en}`});a.adoptForm===!0&&n(`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"&&F4.has(u)&&n(`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 t}s(ML,"checkRetiredDataFields");function Wb(e){let t=new Set(UN()),n=[];for(let r of e.nodes)t.has(r.type)||n.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: ${[...t].join(", ")}.`,en:`[graph/unknownNodeType] Node "${r.id}" has the unknown type "${String(r.type)}". Registered types: ${[...t].join(", ")}.`},severity:"error"});return n}s(Wb,"checkKnownNodeTypes");function Ss(e,t){return t?.wiring&&t.layout?{wiring:t.wiring,layout:t.layout}:null}s(Ss,"resolveLayoutContext");function L4(e,t){let n=Ss(e,t);if(!n)return e.nodes.some(o=>(Ze(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 ${t?.wiring?"vorhanden":"fehlt"}, Layout ${t?.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 ${t?.wiring?"present":"missing"}, layout ${t?.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=Ze(i)?.progressEvents;if(a)for(let l of a){let d=ls(n.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 '${n.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 '${n.layout.id}') \u2014 the engine throws when mirroring`},severity:"error"});continue}let c;try{c=cm(n.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 '${n.layout.id}'`,en:`${i.type} '${i.id}': event '${l}' points to unknown bus '${d.bus}' in layout '${n.layout.id}'`},severity:"error"});continue}vd(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(L4,"checkProgressEventMappings");function M4(e,t){let n=Ss(e,t);if(!n)return[];let r=[];for(let i of n.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),vd(i,c)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.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.${n.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(M4,"checkProgressBoardCoverage");function q4(e,t){let n=Ss(e,t);if(!n)return[];let r=[];for(let i of n.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(!co(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.${n.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(q4,"checkProgressBoardDistinctLabels");function K4(e,t){let n=Ss(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses)for(let o of i.states){let a=um(i,o.id);o.terminal&&!a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.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.${n.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 j4(e,t){let n=Ss(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses){let o=new Set(i.holdsSeat??[]);for(let a of i.holdsSeat??[])vd(i,a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.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??[])vd(i,a)?o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.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.${n.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.${n.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(j4,"checkProgressSeatStates");var Ym={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,t,n){let r=new Map(e.nodes.map(y=>[y.id,y])),i=new Set(Cn(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 A=new Set([...k,y]);if(a&&o.includes(v)&&v.type!=="eventTrigger")return;if(v.type==="eventTrigger"&&o.includes(v)){let L=v.next?.[Gn]?.to;L===void 0?d.push({at:y,state:null}):c(L,b,A);return}let T=Ze(v);if(Yb[v.type]===!1){if(Ze(v).progressEvents?.length){d.push({at:y,state:null});return}let L=l(v);L.length===0&&d.push({at:y,state:null});for(let N of L)c(N,b,A);return}let I=T.entryProgressEvent?.(v),D=b;if(I!==void 0){let L=ls(t,v,I);L?.bus==="process"&&(D=L.state)}if(T.advancesAtEntry?.(v)===!0)for(let L of l(v))c(L,b,A);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:n.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 B4(e,t){let n=Ss(e,t);if(!n)return[];if(!n.layout.buses.some(l=>l.key==="process"))return[];let r=Wk(n.layout);if(!r)return[];let i=V4(e,n.wiring,r);if(i.kind==="one"){let l=r.columns.find(d=>d.id===i.columnId);return l.defaultCollapsed!==!0&&!lC(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(B4,"checkProgressStartColumn");function U4(e){return e==="both"?{de:`${Ym.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:`${Ym.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:`${Ym.de}, oder den Zustand in die Spalte des Nachfolgers legen.`,en:`${Ym.en}, or move the state into the successor's column.`}}s(U4,"passThroughRemedy");function G4(e,t){let n=Ss(e,t);if(!n)return[];let{layout:r,wiring:i}=n;if(!r.buses.some(v=>v.key==="process"))return[];let o=Wk(r);if(!o)return[];let a=new Map(e.nodes.map(v=>[v.id,v])),l=s(v=>Ze(v).progressEvents??[],"eventsOf"),d=s(v=>Object.values(v.next??{}).map(A=>A.to),"routesOf"),c=s((v,A)=>{let T=a.get(v);if(!T||A.has(v))return null;if(l(T).length>0)return[T];if(Yb[T.type]!==!1)return null;let I=d(T);if(I.length===0)return null;let D=[];for(let L of I){let N=c(L,new Set([...A,v]));if(!N)return null;D.push(...N)}return D},"firstProgressNodes"),u=s((v,A)=>{let T=[];for(let I of l(v)){let D=ls(i,v,I);if(!D||D.bus!==A.bus||D.state===A.state)return null;T.push(D.state)}return[...new Set(T)].join("' / '")},"overwrites"),p=s((v,A)=>{let T=d(v);if(T.length===0)return null;let I=[];for(let D of T){let L=c(D,new Set([v.id]));if(!L)return null;for(let N of L){let x=u(N,A);if(x===null)return null;I.push({de:`'${N.id}' (${N.type}) mit '${x}'`,en:`'${N.id}' (${N.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 A of l(v)){let T=ls(i,v,A);if(!T||T.bus!=="process")continue;let I=v.type==="form"&&A===Rp?p(v,T):null,D=I?{de:`'${v.id}'.${A} erreicht ihn, und ${I.map(L=>L.de).join(", ")} \xFCberschreibt ihn in derselben Transaktion`,en:`'${v.id}'.${A} reaches it, and ${I.map(L=>L.en).join(", ")} overwrites it in the same transaction`}:null;h.set(T.state,[...h.get(T.state)??[],D])}let y=cm(r,"process"),b=new Map;for(let[v,A]of h){if(!A.every(I=>I!==null))continue;let T=[...new Map(A.map(I=>[I.de,I])).values()];b.set(v,{de:T.map(I=>I.de).join("; "),en:T.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 A=v.states.map(I=>{let D=y.holdsSeat?.includes(I)===!0,L=b.get(I);return{de:`Zustand '${I}'${D?" (steht in holdsSeat, belegt aber nie einen Platz)":""}: ${L.de}`,en:`State '${I}'${D?" (is in holdsSeat, but never takes a seat)":""}: ${L.en}`}}),T=U4(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 ${A.map(I=>I.de).join("; ")}. ${T.de}`,en:`[progress/passThroughState] Column "${v.label.en}" ('${v.id}', board '${o.id}') always stays empty \u2014 ${A.map(I=>I.en).join("; ")}. ${T.en}`},severity:"warning"})}return k}s(G4,"checkProgressPassThroughColumns");function z4(e){let t=["workItems","workitems","work_items","taskTemplates"],n=[];for(let r of e.nodes){let i=r;for(let o of t){let a=i[o];a!=null&&n.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 n}s(z4,"checkMisnamedTasksKey");function W4(e){let t=[];for(let n of e.nodes){let r=n,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)&&t.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=Ze(n),d=new Map((typeof l.workItemTemplates=="function"?l.workItemTemplates(n):[]).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||!Rd.has(p)){t.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: ${[...Rd].join(", ")}.`,en:`[workItems/invalidKind] Task "${u}" on node "${r.id}" has kind ${JSON.stringify(c.kind)}; composable kinds are: ${[...Rd].join(", ")}.`},severity:"error"});continue}p==="task"&&c.gatesNode!==void 0&&t.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:QF(e,r.id,h.node);if(h!==void 0&&y===null)t.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,A=k?o:y.composedKeys,T=k?d:y.intrinsicByKey,I=y.node.assign??{};p==="approval"&&t.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,L=[...new Set([...A,...T.keys()])].filter(x=>!k||x!==u).join(", "),N={de:L||"keine",en:L||"none"};if(typeof D!="string"||k&&D===u||!A.has(D)&&!T.has(D))t.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: ${N.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: ${N.en}.`},severity:"error"});else if(y.refuse(D)!==null)t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:y.refuse(D),severity:"error"});else{let x=T.get(D);h.except!==void 0&&t.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&&t.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)||t.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&&t.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)t.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"&&t.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)&&t.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 t.push(...ZF(e)),t}s(W4,"checkWorkItemTemplates");var Y4=new Set(["complete","approve","reject"]),Yb={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 H4(e){let t=[];for(let n of e.nodes){let r=n,i=Ze(n),o=Array.isArray(r.tasks)?r.tasks.length:0,a=i.workItemTemplates?.(n)??[];if(o+a.length>0){let v=Yb[r.type];v===void 0?t.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||t.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?.(n)??[];if(l.length===0&&a.length===0)continue;let d=new Map(l.map(v=>[v.id,v]));for(let v of l)Y4.has(v.id)&&t.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??[TC]);for(let v of l)if(v.availableIn!==void 0)for(let A of v.availableIn)c.has(A)||t.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 "${A}" deklariert \u2014 der Typ kennt nur: ${[...c].join(", ")}.`,en:`[capability/unknownActionState] Action "${v.id}" on node type "${r.type}" is declared for state "${A}" \u2014 the type only knows: ${[...c].join(", ")}.`},severity:"error"});let u=hm(n),p=new Set(u?u.map(v=>v.id):[vo]);for(let v of l){if(v.external===void 0)continue;let A=SC(v.external.event),T={de:"hat keine Beschriftung (der Empf\xE4nger bekommt einen leeren Button)",en:"has no label (the recipient would get an empty button)"},I=A?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?T: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?T: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&&t.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 A=v.unlocks;if(A.length===0&&v.verdictResolved!==!0&&v.informational!==!0){t.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 T of A)d.get(T)===void 0&&t.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 "${T}" frei; deklariert: ${[...d.keys()].join(", ")||"keine"}.`,en:`[capability/danglingUnlock] Template "${v.key}" on node "${r.id}" unlocks the unknown action "${T}"; 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)||t.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,A]of Object.entries(r.assign??{})){if(A===void 0)continue;let T=`nodes.${r.id}.assign.${v}`,I={de:`Team der Vorlage "${v}" (Knoten "${r.id}")`,en:`team of the template "${v}" (node "${r.id}")`};t.push(...UP(A,T,I));for(let[D,L]of(Array.isArray(A)?A:[]).entries()){let N=L?.when;N==null||!ke(N)||gt(N)||t.push({layer:"GRAPH",kind:"nodeRule",path:`${T}.${D}.when`,severity:"error",reason:{de:`[assign/conditionNotFormField] ${I.de}, Zeile ${D+1}: die Bedingung nennt ${Ue(e,N,"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,N,"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)||t.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 T of v.unlocks)b.add(T);let k=i.strictActionCoverage===!0;for(let v of l){if(b.has(v.id)||v.superUserOnly===!0)continue;let A=a.find(I=>I.unlocks.includes(v.id)),T=A!==void 0?{de:` Fehlt die Zuweisung assign.${A.key}?`,en:` Is the assignment assign.${A.key} missing?`}:{de:"",en:""};t.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.${T.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.${T.en}`},severity:k?"error":"warning"})}}return t}s(H4,"checkNodeCapabilityWiring");function J4(e,t){let n=[],r=s((a,l)=>{n.push({layer:"GRAPH",kind:"nodeRule",path:a,reason:l,severity:"error"})},"push"),i=eN(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(n.push(...f5(l,d)),d.length===0)continue;let c=Ze(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,A=typeof v=="string"&&v.trim().length>0?v:void 0,T=A??"?",I=`nodes.${l.id}.optionalActions.${T}`,D=typeof k.action=="string"?k.action:void 0;if(k.when!==void 0){let L=s(N=>r(`${I}.when`,{de:`[optionalAction/when] Optionale Aktion "${T}" auf Knoten "${l.id}": ${N.de}`,en:`[optionalAction/when] Optional action "${T}" on node "${l.id}": ${N.en}`}),"conditionFinding");if(typeof k.when!="string"||k.when.trim()==="")L({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 N of Em(k.when,i,t))L(N)}if((D===void 0||!u.has(D))&&r(`${I}.action`,{de:`[optionalAction/kindNotDeclared] Optionale Aktion "${T}" 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 "${T}" 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(", ")}.`)}),A===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(A)&&r(`${I}.key`,{de:`[optionalAction/duplicateKey] Doppelter Aktions-Key "${A}" auf Knoten "${l.id}" \u2014 die projizierten Trigger-Actions w\xFCrden kollidieren.`,en:`[optionalAction/duplicateKey] Duplicate action key "${A}" on node "${l.id}" \u2014 the projected trigger actions would collide.`}),y.add(A)),o(k.label)||r(`${I}.label`,{de:`[optionalAction/missingLabel] Optionale Aktion "${T}" auf Knoten "${l.id}" ohne Label \u2014 der Trigger-Button w\xE4re unbeschriftet.`,en:`[optionalAction/missingLabel] Optional action "${T}" on node "${l.id}" without a label \u2014 the trigger button would be unlabeled.`}),D==="skipRule"){n.push(...Z4(l,k,I,T,d));continue}if(D==="spawnTasks"){k.except!==void 0&&r(`${I}.except`,{de:`[optionalAction/exceptRetired] Optionale Aktion "${T}" 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 "${T}" 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'.`}),n.push(...FL({nodeId:l.id,bindingKey:T,binding:k,templates:p})),n.push(...Q4(l.id,k,I,T,h));let L=Array.isArray(k.tasks)?k.tasks:void 0;if(L===void 0||L.length===0)r(`${I}.tasks`,{de:`[optionalAction/tasksEmpty] Optionale Aktion "${T}" auf Knoten "${l.id}" referenziert keine Aufgaben-Templates \u2014 der Trigger w\xFCrde nichts erzeugen.`,en:`[optionalAction/tasksEmpty] Optional action "${T}" on node "${l.id}" references no task templates \u2014 the trigger would create nothing.`});else{let N=new Set,x=new Set(L.filter(F=>typeof F=="string"));for(let F of L){let $=typeof F=="string"?F:void 0;if($===void 0||$.length===0){r(`${I}.tasks`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${T}" auf Knoten "${l.id}" enth\xE4lt eine leere/ung\xFCltige Template-Referenz.`,en:`[optionalAction/unknownTaskRef] Optional action "${T}" on node "${l.id}" contains an empty or invalid template reference.`});continue}if(N.has($)){r(`${I}.tasks.${$}`,{de:`[optionalAction/duplicateTaskRef] Template "${$}" ist in der Aktion "${T}" auf Knoten "${l.id}" doppelt referenziert.`,en:`[optionalAction/duplicateTaskRef] Template "${$}" is referenced twice in the action "${T}" on node "${l.id}".`});continue}N.add($);let q=h.get($);if(q===void 0){r(`${I}.tasks.${$}`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${T}" auf Knoten "${l.id}" referenziert das Template "${$}", das node.tasks nicht deklariert. Vorhanden: ${[...h.keys()].join(", ")||"keine"}.`,en:`[optionalAction/unknownTaskRef] Optional action "${T}" on node "${l.id}" references the template "${$}", which node.tasks does not declare. Present: ${[...h.keys()].join(", ")||"none"}.`});continue}let G=b.get($);G!==void 0&&G!==T?r(`${I}.tasks.${$}`,{de:`[optionalAction/taskDoublyBound] Template "${$}" 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 "${$}" on node "${l.id}" is already referenced by the action "${G}" \u2014 a template belongs to at most one optional action.`}):b.set($,T);let ae=q.blocks?.templateKey;typeof ae=="string"&&!x.has(ae)&&r(`${I}.tasks.${$}`,{de:`[optionalAction/taskRefBlocks] Template "${$}" auf Knoten "${l.id}" tr\xE4gt 'blocks' auf "${ae}", das nicht zur selben Aktion "${T}" geh\xF6rt \u2014 eine Referenz darf nur eine Referenz DERSELBEN Aktion zur\xFCckhalten (Checklisten-Reihenfolge), nie ein Template au\xDFerhalb.`,en:`[optionalAction/taskRefBlocks] Template "${$}" on node "${l.id}" carries 'blocks' on "${ae}", which does not belong to the same action "${T}" \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===$&&(oe!==void 0&&x.has(oe)||r(`${I}.tasks.${$}`,{de:`[optionalAction/taskRefBlocks] Template "${$}" auf Knoten "${l.id}" ist Ziel eines 'blocks' von ${oe!==void 0?`"${oe}"`:"einem Template"} au\xDFerhalb der Aktion "${T}" \u2014 ein Template au\xDFerhalb darf eine Referenz nie zur\xFCckhalten (ihr Spawn geh\xF6rt dem Trigger, nicht onEnter).`,en:`[optionalAction/taskRefBlocks] Template "${$}" on node "${l.id}" is the target of a 'blocks' from ${oe!==void 0?`"${oe}"`:"a template"} outside the action "${T}" \u2014 a template outside may never hold back a reference (its spawn belongs to the trigger, not to onEnter).`}))}}}}}}return n}s(J4,"checkOptionalActions");function Q4(e,t,n,r,i){if(t.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 t.auto!="boolean")return[o(`${n}.auto`,"autoType","'auto' ist true oder false.","'auto' is true or false.")];if(!t.auto)return[];let a=[];for(let d of["input","submitLabel"])t[d]!==void 0&&a.push(o(`${n}.${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(t.tasks)?t.tasks:[];for(let d of l)typeof d=="string"&&i.get(d)?.familyRequest!==void 0&&a.push(o(`${n}.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(Q4,"autoIssues");function Z4(e,t,n,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(`${n}.action`,"skipRuleWithoutRule","\xFCberspringt die Entscheidungsregel, aber der Knoten hat keine (`requiresOneOf`).","skips the decision rule, but the node has none (`requiresOneOf`)."),l.includes(t.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(`${n}.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")!==t&&a(`${n}.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"])t[u]!==void 0&&a(`${n}.${u}`,"skipRuleShape",`tr\xE4gt '${u}' \u2014 sie legt keine Aufgaben an.`,`carries '${u}' \u2014 it creates no tasks.`);return o}s(Z4,"skipRuleIssues");function X4(e){return typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string"}s(X4,"literalValueType");function e5(e,t){let n=[],r=t?.notificationTemplates;for(let i of e.nodes){let o=i,a=VD(i,Ze(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)||n.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)){n.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"){n.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){n.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&&n.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=LD(c),b=new Set(h.params.map(k=>k.key));for(let k of Object.keys(u.args??{}))b.has(k)||n.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],A=`${p}.args.${k.key}`;if(v!==void 0&&"literal"in v){let I=X4(v.literal);k.type!==void 0&&!ab(I,k.type)&&n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/argTypeMismatch] "${k.key}" erwartet ${Td(k.type).de}, festgelegt ist aber ${JSON.stringify(v.literal)} (${I}).`,en:`[notification/argTypeMismatch] "${k.key}" expects ${Td(k.type).en}, but ${JSON.stringify(v.literal)} (${I}) is set.`},severity:"error"});continue}if(v!==void 0){n.push({layer:"GRAPH",kind:"nodeRule",path:A,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 ${qL(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 ${qL(y,"en")}.`},severity:"error"});continue}let T=MD(k,y.get(k.key)??[]);if(!(T.status==="resolved"||T.status==="unused")){if(T.status==="sometimes"){n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${k.key}" immer, ${T.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 ${T.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(T.status==="ambiguous"){n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/ambiguousArg] "${k.key}" hat mehrere passende Quellen \u2014 ${T.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 ${T.matches.map(I=>I.source).join(", ")}. Set a fixed value in notifications.${c.id}.args.${k.key}.`},severity:"error"});continue}n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${k.key}"${k.type!==void 0?` (${Td(k.type).de})`:""}, und der Knoten hat daf\xFCr ${T.rejected.length===0?"keine Quelle":`nur unpassende Quellen: ${T.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`,en:`[notification/unresolvedArg] The notification "${h.id}" needs "${k.key}"${k.type!==void 0?` (${Td(k.type).en})`:""}, and the node has ${T.rejected.length===0?"no source for it":`only unsuitable sources for it: ${T.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`},severity:"error"})}}}}return n}s(e5,"checkNotificationBindings");function t5(e){return wF(e).map(t=>({layer:"GRAPH",kind:"assignment",path:"assignmentRules",reason:t,severity:"error"}))}s(t5,"checkAssignmentRules");function qL(e,t){let n=[...e.keys()].sort();return n.length===0?t==="de"?"(nichts)":"(nothing)":n.join(", ")}s(qL,"describeCandidates");function n5(e,t){return vF(e,t?.teamKeys).map(n=>({layer:"GRAPH",kind:"nodeRule",path:n.path,reason:n.reason,severity:"error"}))}s(n5,"checkChannels");function r5(e){return nN(e).map(t=>({layer:"GRAPH",kind:"nodeRule",path:t.path,reason:t.reason,severity:"error"}))}s(r5,"checkStaffInputs");function i5(e,t){let n=[];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=>{n.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:c,severity:"error"})},"issue");if(!$F(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=ce(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),!gt(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=li(t,c);p!=null&&Ra("nodeReads",Ta(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 n}s(i5,"checkReadinessReads");function o5(e,t){let n=[];for(let r of e.nodes){if(r.type!=="setFlag")continue;let i=nP(r),o=Yp(r);if(i===null||o===null)continue;let a=t?.formFlagKeysByFormNode?.get(i);if(a===void 0||a.has(o))continue;let l=[...a].sort();n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.inputs.${jt.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 n}s(o5,"checkSetFlagKeys");function s5(e,t){let n=t?.readinessFormFieldsByFormNode,r=t?.readinessPartyConditionKeysByFormNode;if(n===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)||!fr(a))continue;let l=n.get(a.owner),d=r.get(a.owner);if(l===void 0||d===void 0||d.size===0)continue;let c=vb(l,d);if(c.size===0)continue;let u=o.reads,p=(Array.isArray(u)?u:[]).filter(k=>gt(k)&&k.owner===a.owner),h=vb(l,[...p.map(k=>k.path),...OF(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(s5,"checkReadinessPartyConditions");function Hb(e){let t=Object.keys(e.inputs??{});if(t.length===0)return[];let n=e.generatorStamp,r=e.production,i=e.templateStamp;if(e.type==="governedDocument"&&(r==="resolver"&&!Array.isArray(n?.inputSchema?.fields)||r==="template"&&!Array.isArray(i?.fields)))return[];let a=new Set(Ia(e).map(l=>l.id));return t.filter(l=>!a.has(l))}s(Hb,"undeclaredInputKeys");function a5(e,t){return e.nodes.flatMap(n=>[...d5(e,n,Ia(n),t),...l5(e,n,t)])}s(a5,"checkUnknownResources");function l5(e,t,n){let r=[],i=new Set((Ze(t).workItemTemplates?.(t)??[]).map(a=>a.key)),o=new Set((t.tasks??[]).filter(a=>a.familyRequest!==void 0).map(a=>String(a.key)));for(let a of am(t)){if(a.leaf==="assign{}"&&!i.has(a.owner)||a.leaf==="tasks[].assign.group"&&a.missing&&o.has(a.owner))continue;let l=xa[a.leaf],d=`nodes.${t.id}.${a.path}`,c=s(h=>h==="de"?`Knoten \u201E${Pe(e,t.id,"de")}\u201C (${t.id}), ${l.what.de} \u201E${a.owner}\u201C`:`node "${Pe(e,t.id,"en")}" (${t.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=n?.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(l5,"referenceIssues");function d5(e,t,n,r){let i=[];for(let o of n){if(!Hp(o.type))continue;let a=ka[o.type].existence;if(a.check!=="generic")continue;let l=r?.[a.catalog];if(l===void 0)continue;let d=t.inputs?.[o.id];if(d?.kind!=="literal"||typeof d.value!="string"||l.has(d.value))continue;let c=ka[o.type].label;i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${o.id}`,reason:{de:`[inputs/unknownResource] Knoten \u201E${Pe(e,t.id,"de")}\u201C (${t.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,t.id,"en")}" (${t.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(d5,"unknownResourceIssues");function c5(e){let t=[];for(let n of e.nodes)for(let r of Hb(n))t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${r}`,reason:{de:`[inputs/undeclared] Knoten \u201E${Pe(e,n.id,"de")}\u201C (${n.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,n.id,"en")}" (${n.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 t}s(c5,"checkUndeclaredInputs");function u5(e){let t=[];for(let n of e.nodes){let r=new Set;for(let i of Ia(n)){if(!r.has(i.id)){r.add(i.id);continue}t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${i.id}`,reason:{de:`[inputs/duplicateSlot] Knoten \u201E${Pe(e,n.id,"de")}\u201C (${n.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,n.id,"en")}" (${n.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 t}s(u5,"checkDuplicateSlots");function KL(e,t,n){let r=[],i=Wb(e);if(i.length>0)return i;r.push(...Gb(e)),r.push(...Bb(e)),r.push(...zb(e)),r.push(...Ub(e)),r.push(...Kb(e)),r.push(...jb(e)),r.push(...Vb(e)),r.push(...ML(e)),r.push(...LL(e)),r.push(...pC(e,t)),r.push(...L4(e,t)),r.push(...M4(e,t)),r.push(...q4(e,t)),r.push(...CF(e,t?.layout)),r.push(...K4(e,t)),r.push(...j4(e,t)),r.push(...G4(e,t)),r.push(...B4(e,t)),r.push(...iC(e,n)),r.push(...yC(e)),r.push(...xC(e)),r.push(...hC(e)),r.push(...gC(e)),r.push(...c5(e)),r.push(...a5(e,n)),r.push(...u5(e)),r.push(...z4(e)),r.push(...W4(e)),r.push(...eL(e,n)),r.push(...oL(e)),r.push(...rL(e)),r.push(...sL(e,n)),r.push(...mL(e,n)),r.push(...H4(e)),r.push(...e5(e,n)),r.push(...J4(e,n)),r.push(...t5(e)),r.push(...i5(e,n)),r.push(...s5(e,n)),r.push(...o5(e,n)),r.push(...n5(e,n)),r.push(...r5(e)),r.push(...DL(e));for(let o of e.nodes){let a=Ze(o);a.validate&&r.push(...a.validate(o,e,n))}return r}s(KL,"checkGraph");function f5(e,t){let n=e.requiresOneOf;if(n===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(n)||n.length===0||n.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=t.map(d=>d.key).filter(d=>typeof d=="string"),a=[],l=new Set;for(let d of n){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(f5,"checkRequiresOneOf");function p5(e){return e.nodes.flatMap(t=>Hb(t).map(n=>({nodeId:t.id,key:n,binding:t.inputs?.[n]?.kind==="binding"})))}s(p5,"undeclaredInputCells");function jL(e,t){let n=p5(e).filter(o=>t.bindings||!o.binding);if(n.length===0)return{graph:e,dropped:n};let r=new Map;for(let o of n)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:n}}s(jL,"dropUndeclaredInputs");function Jb(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Jb,"isObject");function VL(e){return Jb(e)&&e.type==="governedDocument"&&("template"in e||"cockpitFields"in e)}s(VL,"oldShape");function BL(e){return(e?.nodes??[]).some(VL)}s(BL,"needsTemplateStampMove");function m5(e){let t=e.generatorStamp?.inputSchema?.fields;if(e.production==="resolver")return Array.isArray(t)?t:null;let n=e.templateStamp?.fields;return e.production==="template"&&Array.isArray(n)?n:null}s(m5,"stampedFields");function h5(e){let t=String(e.id);if("template"in e&&"templateStamp"in e)return{unmoved:{nodeId:t,reason:"templateAndStamp"}};let n={...e},r=[];if("template"in e){let{template:i}=e;if(delete n.template,Jb(i))n.templateStamp={fields:Array.isArray(i.fields)?i.fields:[],...i.localeField===void 0?{}:{localeField:i.localeField}};else return{unmoved:{nodeId:t,reason:"templateNotObject"}}}if("cockpitFields"in e){let i=Array.isArray(e.cockpitFields)?e.cockpitFields.filter(l=>typeof l=="string"):[];delete n.cockpitFields;let o=Jb(e.inputs)?{...e.inputs}:{},a=m5(n);if(a===null&&i.length>0)return{unmoved:{nodeId:t,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:t,key:l,reason:"unknownKey"});else{if(c.type==="party"||c.type==="personList")continue;c.processSource!==void 0?r.push({nodeId:t,key:l,reason:"processSource"}):d?r.push({nodeId:t,key:l,reason:"cellExists"}):o[l]={kind:"cockpit"}}}n.inputs=o}return{node:n,reports:r}}s(h5,"moveNode");function UL(e){let t=[],n=[],r=[],i=e.nodes.map(o=>{if(!VL(o))return o;let a=h5(o);return"unmoved"in a?(r.push(a.unmoved),o):(t.push(String(o.id)),n.push(...a.reports),a.node)});return t.length===0?{graph:e,moved:t,reports:n,unmoved:r}:{graph:{...e,nodes:i},moved:t,reports:n,unmoved:r}}s(UL,"moveTemplateStampAndCockpit");var GL=$p,g5="applicant.applicationSubmitted";function Hm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Hm,"isObject");function zL(e){return Hm(e)&&e.type==="form"&&typeof e.id=="string"&&!Pn(e)}s(zL,"isCreatingFormNode");function y5(e){return Hm(e.notifications)&&GL in e.notifications}s(y5,"hasSubmittedBinding");function Qb(e){let t={toBind:[],alreadyBound:[],malformed:[]};for(let n of e?.nodes??[])zL(n)&&(n.notifications!==void 0&&!Hm(n.notifications)?t.malformed.push(n.id):y5(n)?t.alreadyBound.push(n.id):t.toBind.push(n.id));return t}s(Qb,"submitReceiptInventory");function WL(e){let{toBind:t}=Qb(e);if(t.length===0)return{graph:e,bound:[]};let n=new Set(t),r=e.nodes.map(i=>{if(!zL(i)||!n.has(i.id))return i;let o=Hm(i.notifications)?i.notifications:{};return{...i,notifications:{...o,[GL]:{templateId:g5}}}});return{graph:{...e,nodes:r},bound:t}}s(WL,"bindSubmitReceipt");var As=["park","advance"],Jn="whenNothingOwed",YL={park:{de:"Jemand schaut drauf",en:"Someone looks at it"},advance:{de:"Durchreichen",en:"Pass through"}};function Zb(e){let t=e.inputs?.[Jn],n=t?.kind==="literal"?t.value:void 0;return Xb(n)?n:null}s(Zb,"reviewModeOrNull");function Xb(e){return As.includes(e)}s(Xb,"isReviewMode");function ev(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ev,"isObject");function HL(e){return ev(e)&&e.type==="review"&&!(ev(e.inputs)&&Jn in e.inputs)}s(HL,"lacksMode");function JL(e){return(e?.nodes??[]).some(HL)}s(JL,"needsReviewMode");function QL(e){let t=[],n=e.nodes.map(r=>{if(!HL(r))return r;t.push(r.id);let i=ev(r.inputs)?r.inputs:{};return{...r,inputs:{...i,[Jn]:{kind:"literal",value:"park"}}}});return{graph:{...e,nodes:n},set:t}}s(QL,"setReviewModePark");function Jm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Jm,"isObject");function ZL(e){let{notifications:t,bound:n}=km(e.notifications,{tasks:[]},e);return{next:t,bound:n}}s(ZL,"bindingsFor");function XL(e){let t={toBind:[],malformed:[]};for(let n of e?.nodes??[])if(!(!Jm(n)||typeof n.id!="string"||Na(n).length===0)){if(n.notifications!==void 0&&!Jm(n.notifications)){t.malformed.push(n.id);continue}for(let r of ZL(n).bound)t.toBind.push(`${n.id}.${r}`)}return t}s(XL,"appointmentLetterInventory");function e0(e){let t=[],n=!1,r=e.nodes.map(i=>{if(!Jm(i)||typeof i.id!="string"||Na(i).length===0||i.notifications!==void 0&&!Jm(i.notifications))return i;let{next:o,bound:a}=ZL(i);return a.length===0?i:(n=!0,t.push(...a.map(l=>`${i.id}.${l}`)),{...i,notifications:o})});return n?{graph:{...e,nodes:r},bound:t}:{graph:e,bound:[]}}s(e0,"bindAppointmentLetters");function Ja(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ja,"isObject");var t0=["id","label","dataFlow"],n0=["audience","populates","stages","expectedOutcomes"];function r0(e){return Array.isArray(e.assignmentRules)&&e.assignmentRules.some(t=>Ja(t)&&typeof t.slot=="string")}s(r0,"carriesStringSlots");function i0(e){return(e.nodes??[]).some(t=>Ja(t)&&t.type==="form"&&n0.some(n=>n in t))}s(i0,"carriesRetiredFormNodeKey");var w5=[{key:"generatorPin",editor:!0,holds:RN,what:{de:"Generator als `resolver`",en:"generator as `resolver`"}},{key:"setFlagProperties",editor:!0,holds:aP,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:pP,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:vP,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:gN,what:{de:"Entscheidungsausg\xE4nge ohne Bedeutung",en:"decision outcomes without a meaning"}},{key:"startNodeOutcomes",editor:!0,holds:bN,what:{de:"ein Start-Knoten mit eigenen Ausg\xE4ngen",en:"a start node with its own outcomes"}},{key:"templateParameters",editor:!0,holds:BL,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:EP,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:KP,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:NP,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:MP,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:JL,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=>om(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=>t0.some(t=>t in e),"holds"),what:{de:"`graph.id` / `graph.label` / `graph.dataFlow`",en:"`graph.id` / `graph.label` / `graph.dataFlow`"}},{key:"assignmentSlotString",editor:!1,holds:r0,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:i0,what:{de:"Formularknoten mit `audience` / `populates` / `stages` / `expectedOutcomes`",en:"form nodes with `audience` / `populates` / `stages` / `expectedOutcomes`"}}];function o0(e){if(!Ja(e)||!Array.isArray(e.nodes))return[];let t=e;return w5.filter(n=>n.holds(t)).map(({key:n,what:r,editor:i})=>({key:n,what:r,editor:i}))}s(o0,"legacyGraphShapes");function s0(e,t){let n=t.answers??{},r=[],i=[],o=e,a=t0.filter($=>$ in o);if(a.length>0){let $={...o};for(let q of a)delete $[q],r.push({message:`graph.${q}: deleted (read by nothing)`});o=$}if(i0(o)&&(o={...o,nodes:o.nodes.map($=>{if(!Ja($)||$.type!=="form")return $;let q=n0.filter(ae=>ae in $);if(q.length===0)return $;let G={...$};for(let ae of q)delete G[ae];return r.push({nodeId:String($.id),message:`form node: deleted ${q.map(ae=>`\`${ae}\``).join(", ")} (read by nothing)`}),G})}),r0(o)){let $=o.assignmentRules.map((q,G)=>{if(!Ja(q)||typeof q.slot!="string")return q;let ae=qp(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:$}}let l=$N(o);o=l.graph;for(let $ of l.moved)r.push({nodeId:$,message:"generator / template pin moved into its input"});for(let $ of l.unmoved)i.push({code:`generatorPin/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the generator or template pin cannot be moved (${$.reason}) \u2014 edit the node by hand`});let d=lP(o);o=d.graph;for(let $ of d.moved)r.push({nodeId:$,message:"setFlag `target` / `flagKey` / `value` moved into its inputs"});for(let $ of d.unmoved)i.push({code:`setFlag/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the setFlag properties cannot be moved (${$.reason}) \u2014 edit the node by hand`});let c=mP(o);o=c.graph;for(let $ of c.moved)r.push({nodeId:$,message:"scalar settings moved into inputs"});for(let $ of c.unmoved)i.push({code:`scalar/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`\`${$.key}\` cannot be moved into an input (${$.reason}) \u2014 edit the node by hand`});let u=xP(o);o=u.graph;for(let $ of u.moved)r.push({nodeId:$,message:"payment note moved into `inputs.reason` / retired sample document deleted"});for(let $ of u.unmoved)i.push({code:`nodeConfig/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`\`${$.key}\` cannot be moved into an input (${$.reason}) \u2014 edit the node by hand`});let p=UL(o);o=p.graph;for(let $ of p.moved){let q=o.nodes.find(Z=>Ja(Z)&&Z.id===$),G=q?.inputs?.documentTemplate,ae=G?.kind==="literal"&&typeof G.value=="string"?G.value:null;r.push({nodeId:$,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 $ of p.reports)r.push({nodeId:$.nodeId,message:`cockpit field \`${$.key??""}\` deleted (${$.reason}: ${$.reason==="unknownKey"?"the stamp declares no such parameter":$.reason==="processSource"?"the case fills it itself":"the input already holds a cell"})`});for(let $ of p.unmoved)i.push({code:`templateStamp/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:$.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":$.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=vN(o);o=h.graph;for(let $ of h.moved)r.push({nodeId:$,message:"start node: own `outcomes` / `event` / `effect` deleted (the node type declares its outcome)"});for(let $ of h.unmoved)i.push({code:`eventTrigger/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the start node cannot be reduced to its type's outcome (${$.reason}) \u2014 edit the node by hand`});let y=yN(o,n.semantics);o=y.graph;for(let $ of y.written){if($.source==="formerDefault"){r.push({nodeId:$.nodeId,message:`outcome \`${$.outcomeId}\`: semantic "${$.semantic}" (DEFAULT \u2014 the meaning it ran with; the retired id parser knew no other)`,defaulted:{answer:"semantic",answerKey:`${$.nodeId}.${$.outcomeId}`,value:$.semantic}});continue}r.push({nodeId:$.nodeId,message:`outcome \`${$.outcomeId}\`: semantic "${$.semantic}" (${$.source==="answer"?"answered":"the meaning the retired id parser gave this id"})`})}for(let $ of y.refused)i.push({code:$.answer===void 0?"outcome/formerMeaningNotAllowed":"outcome/semanticNotAllowed",nodeId:$.nodeId,answer:"semantic",answerKey:`${$.nodeId}.${$.outcomeId}`,candidates:$.allowed,message:$.answer===void 0?`${$.nodeType} outcome \`${$.outcomeId}\` ran as "${dk($.outcomeId)??""}", which a ${$.nodeType} outcome may no longer carry \u2014 say which one it is`:`${$.nodeType} outcome \`${$.outcomeId}\`: "${$.answer}" is not a meaning a ${$.nodeType} outcome may carry`});for(let $ of y.invalid)i.push({code:"outcome/semanticInvalid",nodeId:$.nodeId,answer:"edit",candidates:Nn,message:`outcome \`${$.outcomeId}\` carries the semantic "${$.value}", which is no meaning \u2014 edit it`});let b=AN(o,t.selection,n.waitlistPolicy);o=b.graph;for(let $ of b.moved){let q=$.policy.waitlistOrder;r.push({nodeId:$.nodeId,message:`waitlist policy into inputs: ${k5($.policy)} (${$.source==="answer"?"answered":$.source==="manifest"?"from manifest `selection`":"DEFAULT \u2014 the manifest stated no `selection.waitlistOrder`; the former code default it ran with"})`,...$.source==="formerDefault"?{defaulted:{answer:"waitlistPolicy",answerKey:$.nodeId,value:q}}:{}})}for(let $ of b.refused)i.push({code:`waitlist/${$.reason}`,nodeId:$.nodeId,answer:"waitlistPolicy",answerKey:$.nodeId,candidates:ur,message:"manifest `selection` is malformed \u2014 say the queue order of this waitlist"});let k=IP(o);o=k.graph;for(let $ of k.moved)r.push({nodeId:$,message:"payment: `inputs.settlement` \u2192 `inputs.mode` (separate \u2192 manual)"});for(let $ of k.refused)i.push({code:`collectPayment/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:$.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=PP(o);o=v.graph;for(let $ of v.moved)r.push({nodeId:$.split(".")[0],message:`\`formView\` \u2192 \`view\` (${$})`});for(let $ of v.refused){let q=$.taskKey===void 0?"the node":`task "${$.taskKey}"`;i.push({code:`view/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:$.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 A=qP(o);o=A.graph;for(let $ of A.moved)r.push({nodeId:$.nodeId,message:`\`assign.${$.templateKey}\`: team \u2192 rule list`});for(let $ of A.refused)i.push({code:"assign/shape",nodeId:$.nodeId,answer:"edit",message:`\`assign.${$.templateKey}\` is neither a team key nor a rule list \u2014 set it by hand`});let T=jP(o);o=T.graph;for(let $ of T.moved)r.push({nodeId:$.split(".")[0],message:`documents: \`document:$node.<node>.document\` \u2192 \`artifact:<slot>\` (${$})`});for(let $ of T.refused)i.push({code:`workItems/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`task "${$.taskKey}" links a document whose node declares no single slot \u2014 name the slot as \`artifact:<slot>\` by hand`});if(AP(o)){let $=TP(o,n.payee);o=$.graph;for(let q of $.set)r.push({nodeId:q.nodeId,message:`online payment: payee "${q.payee}" (answered)`});for(let q of $.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 $ of Qb(o).malformed)i.push({code:"submitReceipt/notificationsMalformed",nodeId:$,answer:"edit",message:"the form node's `notifications` is no record \u2014 edit it by hand"});let I=WL(o);o=I.graph;for(let $ of I.bound)r.push({nodeId:$,message:"submit receipt bound to `notifications.submitted` (`applicant.applicationSubmitted`, sent by code before)"});let D=QL(o);o=D.graph;for(let $ of D.set)r.push({nodeId:$,message:"review: `whenNothingOwed` = park (every review parked before the input existed)"});for(let $ of XL(o).malformed)i.push({code:"appointmentLetters/notificationsMalformed",nodeId:$,answer:"edit",message:"the node's `notifications` is no record \u2014 edit it by hand"});let L=e0(o);o=L.graph;for(let $ of L.bound){let q=$.indexOf(".");r.push({nodeId:$.slice(0,q),message:`appointment letter bound to \`notifications.${$.slice(q+1)}\` (the standard letter, sent by code before)`})}let N=om(o).filter($=>!$.hasTeam);for(let $ of N)i.push({code:"task/userWithoutTeam",nodeId:$.nodeId,answer:"edit",message:`task \`${$.taskKey}\` names a fixed person and no team \u2014 give it a team (\`assign.group\`) by hand`});let x=VP(o);o=x.graph;for(let $ of x.dropped.filter(q=>q.hasTeam))r.push({nodeId:$.nodeId,message:`task \`${$.taskKey}\`: \`assign.userId\` deleted (the team holds the row)`});let F=jL(o,{bindings:!0});o=F.graph;for(let $ of F.dropped){if(!$.binding){r.push({nodeId:$.nodeId,message:`input \`${$.key}\` deleted (no slot of the node declares it)`});continue}r.push({nodeId:$.nodeId,message:`input \`${$.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:`${$.nodeId}.${$.key}`,value:"deleted"}})}return{graph:o,changes:r,refusals:i}}s(s0,"upgradeGraph");function k5(e){return`waitlistOrder=${e.waitlistOrder}`}s(k5,"formatPolicy");function Fr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Fr,"isObject");var a0="admission.generic",l0=Object.keys(Fp).filter(e=>e!=="label");function d0(e){return(Array.isArray(e.testScenarios)?e.testScenarios:[]).filter(n=>Fr(n)&&"env"in n).map(n=>String(n.id))}s(d0,"sampledScenarioIds");function c0(e){return Fr(e.smartforms)?Object.entries(e.smartforms):[]}s(c0,"smartformEntries");function b5(e){let t=[];c0(e.index).some(([,i])=>Fr(i)&&"outcomeFnRef"in i)&&t.push({de:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml",en:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml"});let n=Object.keys(e.manifest).filter(i=>Object.hasOwn(dd,i));if(n.length>0){let i=n.map(o=>`\`${o}\``).join(", ");t.push({de:`manifest.json mit ${i}`,en:`manifest.json with ${i}`})}Object.values(e.smartforms??{}).some(i=>l0.some(o=>o in i))&&t.push({de:"Formulardateien mit `id` / `outcomeIds` / `schoolSlug`",en:"form files with `id` / `outcomeIds` / `schoolSlug`"}),Object.values(e.smartforms??{}).some(i=>d0(i).length>0)&&t.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&&(Fr(r.progressWiring)&&"layoutId"in r.progressWiring&&t.push({de:"`progressWiring.layoutId`",en:"`progressWiring.layoutId`"}),t.push(...o0(r.graph).map(i=>i.what))),t}s(b5,"legacyBundleShapes");function Zm(e,t){let n=b5(e);n.length!==0&&de("BUNDLE_NEEDS_UPGRADE",{de:`offer: ${t} stammt aus einem \xE4lteren Bundle-Format (${n.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: ${t} is in an older bundle format (${n.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(Zm,"assertBundleCurrent");function Qm(e){let t=s(n=>Array.isArray(n)?n.map(t):Fr(n)?Object.fromEntries(Object.keys(n).sort().map(r=>[r,t(n[r])])):n,"sort");return JSON.stringify(t(e))}s(Qm,"canonical");function u0(e,t={}){let n=[],r=[],i=e.index,o=c0(i);if(o.some(([,u])=>Fr(u)&&Object.keys(u).length>0)){let u={};for(let[p,h]of o){if(!Fr(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!==a0){r.push({file:"bundle.yaml",code:"index/smartformEntry",answer:"edit",message:`smartforms.${p} carries ${Object.keys(h).map(k=>`\`${k}\``).join(", ")} \u2014 only \`outcomeFnRef: ${a0}\` is known; edit the entry to {} by hand`}),u[p]=h;continue}n.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,n.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?n.push({file:"manifest.json",message:"`progressLayout` deleted (the bundle has no workflow it could belong to)"}):l.progressLayout===void 0?(l={...l,progressLayout:p},n.push({file:"manifest.json",message:"`progressLayout` moved to workflow.json `progressLayout`"})):Qm(l.progressLayout)===Qm(p)?n.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(dd,u)?dd[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}n.push({file:"manifest.json",message:`\`${u}\` deleted (${h.en})`})}if(l!==void 0){if(Fr(l.progressWiring)&&"layoutId"in l.progressWiring){let{layoutId:p,...h}=l.progressWiring;l={...l,progressWiring:h},n.push({file:"workflow.json",message:"`progressWiring.layoutId` deleted (the layout is the workflow's own)"})}let u=l.graph;if(Fr(u)&&Array.isArray(u.nodes)){let p=s0(u,{selection:d,answers:t});l={...l,graph:p.graph},n.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 l0)if(v in h){if(v==="outcomeIds"){let A=Array.isArray(h.outcomes)?h.outcomes.map(T=>Fr(T)?T.id:void 0):[];if(Qm([...Array.isArray(h.outcomeIds)?h.outcomeIds:[]].map(String).sort())!==Qm(A.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],n.push({file:b,message:`\`${v}\` deleted (${Fp[v].en})`})}let k=d0(h);k.length>0&&(y.testScenarios=h.testScenarios.map(v=>{if(!Fr(v)||!("env"in v))return v;let{env:A,...T}=v;return T}),n.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:n,refusals:r}}s(u0,"upgradeOfferBundle");var v5={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},LTe={createManifest:mn.workflow.createManifestInternal,publishManifest:mn.workflow.publishManifestInternal,publishOfferInternal:mn.workflow.publishOfferInternalInternal,publishOfferExternal:mn.workflow.publishOfferExternalInternal,getOfferPublishState:mn.workflow.getOfferPublishStateInternal,upsertCustomField:mn.admission.upsertCustomFieldInternal,upsertDerivedAttributeRule:mn.admission.upsertDerivedAttributeRuleInternal,createSmartForm:mn.forms.createSmartFormInternal,getSmartFormBySlug:mn.forms.getSmartFormBySlugInternal,saveSmartFormDraft:mn.forms.saveSmartFormDraftInternal,publishSmartForm:mn.forms.publishSmartFormInternal,createWorkflow:mn.workflow.createWorkflowInternal,getWorkflowGraph:mn.workflow.getWorkflowGraphInternal,saveWorkflowDraft:mn.workflow.saveWorkflowDraftInternal,publishWorkflow:mn.workflow.publishWorkflowInternal};function tv(e,t){for(let[n,r]of Object.entries(e.smartforms??{})){(r===null||typeof r!="object"||Array.isArray(r))&&de("INVALID",{de:`offer: ${t}: smartforms.${n} muss eine leere Zuordnung ({}) sein.`,en:`offer: ${t}: smartforms.${n} 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: ${t}: smartforms.${n} 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: ${t}: smartforms.${n} 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(tv,"assertSmartformEntries");function f0(e){let t=s(n=>Array.isArray(n)?n.map(t):n&&typeof n=="object"?Object.fromEntries(Object.keys(n).sort().map(r=>[r,t(n[r])])):n,"sort");return JSON.stringify(t(e))}s(f0,"canonicalJson");function p0(e,t){return t==null?!0:f0(e)!==f0(t)}s(p0,"changed");async function m0(e,t,n,r={},i=v5){let{index:o}=t;Zm({index:o,manifest:t.manifest,...t.smartforms!==void 0?{smartforms:t.smartforms}:{},...t.workflow!==void 0?{workflow:t.workflow}:{}},`bundle of ${o.slugs.manifest}`),tv(o,`bundle of ${o.slugs.manifest}`);let a=Dp(t.manifest);a.length>0&&de("INVALID",{de:`offer: manifest.json von ${o.slugs.manifest} ist ung\xFCltig:
|
|
11725
|
+
{{taskLink}}`}}]};var ib=[JC,eD,tD,nD,rD,iD,sD,oD,aD,PC,CC,DC,FC,BC,UC,GC,LC,zC,MC,qC,KC,jC,VC,fD,pD,mD,ID,OD,_D,yD,CD,DD,FD,wD,kD,bD,xD,SD,QC,ZC,lD,dD,cD,IC,OC,_C,NC];function ob(e){let t=ib.find(n=>n.id===e);return t===void 0&&C(`notifications: unknown letter "${e}"`),t}s(ob,"letterDefFor");function sb(e){return ib.some(t=>t.id===e)}s(sb,"hasLetterDef");function ab(e,t){return t===void 0?!0:Jp(e,t)}s(ab,"letterArgCompatible");function Td(e){return e==="localizedText"?{de:"Text in jeder Sprache (localizedText)",en:"Text in every language (localizedText)"}:{de:`${hn(e)} (${e})`,en:`${hn(e)} (${e})`}}s(Td,"letterArgTypeLabel");function LD(e){let t=new Map,n=s((r,i)=>{let o=t.get(r);o===void 0?t.set(r,[i]):o.push(i)},"add");for(let r of e.args)n(r.key,{source:`Ereignis "${e.id}"`,type:r.type,always:r.required===!0});for(let r of RC)n(r.key,{source:"Kontext des Versands",type:r.type,always:!0});return t}s(LD,"eventArgSources");function MD(e,t){let n=e.type===void 0?[...t]:t.filter(r=>ab(r.type,e.type));if(n.length>1)return{status:"ambiguous",matches:n};if(n.length===1){let r=n[0];return!e.required||r.always?{status:"resolved",source:r}:{status:"sometimes",source:r}}return e.required?{status:"missing",rejected:[...t]}:{status:"unused"}}s(MD,"resolveLetterParam");var lb=["booked","rescheduled","cancelled"],z6={booked:"admission.appointmentBooked",rescheduled:"admission.appointmentRescheduled",cancelled:"admission.appointmentCancelled"},KD=":";function jD(e,t){return`${e}${KD}${t}`}s(jD,"appointmentEventId");function W6(e){let t=e.lastIndexOf(KD);if(t<=0)return null;let n=e.slice(t+1);return lb.includes(n)?{taskKey:e.slice(0,t),kind:n}:null}s(W6,"parseAppointmentEventId");var qD={booked:{de:"Termin vereinbart",en:"Appointment booked"},rescheduled:{de:"Termin verschoben",en:"Appointment moved"},cancelled:{de:"Termin abgesagt",en:"Appointment cancelled"}};function Na(e){return Array.isArray(e.tasks)?e.tasks.filter(t=>typeof t?.key=="string"&&t.result?.kind==="appointment"):[]}s(Na,"appointmentTasksOf");function Y6(e){return lb.map(t=>({id:jD(e.key,t),label:{de:`${qD[t].de} \u2013 \u201E${e.title.de}\u201C`,en:`${qD[t].en} \u2013 \u201C${e.title.en}\u201D`},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"bookingId",type:"string",required:!0}]}))}s(Y6,"appointmentTaskEvents");function VD(e,t){let n=t.notificationEvents?.(e)??[],r=Na(e).flatMap(Y6);return r.length===0?n:[...n,...r]}s(VD,"nodeNotificationEvents");function H6(e){return Object.fromEntries(lb.map(t=>[jD(e,t),{templateId:z6[t]}]))}s(H6,"defaultAppointmentBindings");function J6(e,t){if(e===void 0)return{notifications:e,dropped:[]};let n=[],r={};for(let[i,o]of Object.entries(e))W6(i)?.taskKey===t?n.push(i):r[i]=o;return n.length===0?{notifications:e,dropped:n}:{notifications:Object.keys(r).length===0?void 0:r,dropped:n}}s(J6,"withoutAppointmentBindings");function km(e,t,n){let r=new Set(Na(t).map(d=>d.key)),i=new Set(Na(n).map(d=>d.key)),o=e,a=[];for(let d of r){if(i.has(d))continue;let c=J6(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(H6(d)))o?.[c]===void 0&&(o={...o??{},[c]:u},l.push(c));return{notifications:o,bound:l,dropped:a}}s(km,"syncAppointmentBindings");function Q6(e){return e.kind==="task"&&!("title"in e)}s(Q6,"isLegacyFreeTodoContext");function db(e){let{context:t}=e;if(Q6(t)&&C(`[workItems/legacyFreeTodo] work_item ${e._id} is a free to-do in its former shape \u2014 run migrations:freeTodosToContext`),t.kind==="task")return{...e,context:t,kind:"task",createdVia:"human",partyId:t.partyId};let{anchor:n,task:r,kind:i,title:o,description:a,...l}=t,d=n.scope==="node"?{nodeId:n.nodeId,templateKey:n.templateKey,gatesNode:n.gatesNode,blocks:n.blocks}:n.scope==="application"?{scope:"application",templateKey:n.templateKey}:n.scope==="crossNode"?{scope:"application",nodeId:n.nodeId,templateKey:n.templateKey,blocks:n.blocks}:{};return{...e,context:t,...l,...d,...r??{},kind:i}}s(db,"readWorkItem");async function Pa(e,t){let n;if(t.nodeId!==void 0){let r=t.nodeId;n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",i=>i.eq("context.applicationId",t.applicationId).eq("context.anchor.nodeId",r)).collect()}else if(t.isOpen!==void 0){let r=t.isOpen;n=await e.db.query("work_items").withIndex("by_applicationId_and_isOpen",i=>i.eq("context.applicationId",t.applicationId).eq("isOpen",r)).collect()}else n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",r=>r.eq("context.applicationId",t.applicationId)).collect();return n.filter(r=>t.isOpen===void 0||r.isOpen===t.isOpen).map(db)}s(Pa,"listWorkItemsForApplication");var lbe=m.union(m.literal("approved"),m.literal("rejected")),Rd=new Set(["task","approval"]);function X6(e,t){switch(e){case"task":return t?.gatesNode===!0&&C("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:t?.gatesNode??!0};default:C(`expandComposedTask: unknown composed-task kind ${JSON.stringify(e)} \u2014 authorable: ${[...Rd].join(", ")}`)}}s(X6,"expandComposedTask");for(let e of["task","approval"]){let t=X6(e);t.kind==="approval"!=(t.isApproval===!0)&&C(`composed-task kind "${e}": isApproval must be present iff kind === 'approval'`)}var BD=fo,xo=`${BD}.`,e4=new Set(["text","number","date","boolean","option","edge"]);function cb(e,t){let n=e[t];return n===void 0&&C(`[env/unknownKey] no environment key '${t}'`),typeof n=="string"?null:Object.keys(n)}s(cb,"contextFields");function UD(e,t){return Object.hasOwn(e,t)}s(UD,"isContextKey");function GD(e){let t=[];for(let n of Object.keys(e)){let r=cb(e,n);if(r===null)t.push(n);else for(let i of r)t.push(`${n}.${i}`)}return t}s(GD,"leafPaths");function $d(e,t){let[n="",r,...i]=t.split(".");if(!UD(e,n)||i.length>0)return;let o=e[n];if(typeof o=="string")return r===void 0?o:void 0;if(!(r===void 0||!Object.hasOwn(o,r)))return o[r]}s($d,"leafType");function zD(e){let t=new Set;for(let n of e){let r=Ca(n);r!==null&&t.add(r.split(".")[0])}return[...t]}s(zD,"contextKeysOf");function Ca(e){return e.startsWith(xo)?e.slice(xo.length):null}s(Ca,"contextPathOf");function Ed(e){return e===BD||e.startsWith(xo)}s(Ed,"isContextIdentifier");function bm(e,t){let n=Ca(t)??"",[r=""]=n.split("."),i=Object.keys(e);if(!UD(e,r))return{code:"env/unknownKey",message:{de:`'${t}' nennt keinen Umgebungsschl\xFCssel \u2014 bekannt: ${i.join(", ")}.`,en:`'${t}' names no environment key \u2014 known: ${i.join(", ")}.`}};if($d(e,n)!==void 0)return null;let o=cb(e,r);return{code:"env/unknownKey",message:o===null?{de:`'${t}': der Umgebungsschl\xFCssel '${r}' ist ein einzelner Wert \u2014 lies ihn als '${xo}${r}'.`,en:`'${t}': environment key '${r}' is a single value \u2014 read it as '${xo}${r}'.`}:{de:`'${t}': der Umgebungsschl\xFCssel '${r}' hat die Felder ${o.join(", ")}.`,en:`'${t}': environment key '${r}' has the fields ${o.join(", ")}.`}}}s(bm,"identifierIssue");function vm(e,t,n=Object.keys(e)){let r={};for(let i of n){let o=cb(e,i),a=Object.hasOwn(t,i)?t[i]:void 0;if(a===void 0&&C(`[env/missing] context key '${i}' was not supplied`),o===null){r[`${xo}${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&&C(`[env/missing] context key '${i}' carries no '${l}'`),r[`${xo}${i}.${l}`]=d}}return r}s(vm,"flatten");function t4(e,t){switch(t){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(t4,"valueMatchesDataType");function WD(e,t,n=Object.keys(e.types)){let r=new Set(n);for(let i of GD(e.types)){if(!r.has(i.split(".")[0]))continue;let o=t[`${xo}${i}`];o===void 0&&C(`[env/missing] context path '${i}' was not supplied`);let a=e.fields[i];if(o===null){a.nullable||C(`[env/null] context path '${i}' is not nullable but carries null`);continue}let l=hn($d(e.types,i));t4(o,l)||C(`[env/type] context path '${i}' expects ${l}, got ${JSON.stringify(o)}`),a.valueSet.kind==="fixed"&&!a.valueSet.values.includes(o)&&C(`[env/value] context path '${i}' carries '${String(o)}', outside ${a.valueSet.values.join(" | ")}`)}}s(WD,"assertContextValues");function n4(e){let t=[],n=GD(e.types);for(let r of n){let i=$d(e.types,r),o=hn(i);if(!yo(i)||o===void 0||!e4.has(o)){t.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){t.push(`'${r}' has no field spec (value set + nullability)`);continue}a.valueSet.kind==="fixed"&&(a.valueSet.values.length===0&&t.push(`'${r}' has an empty fixed value set`),o!=="text"&&o!=="option"&&t.push(`'${r}' is ${o}; a fixed value set needs a text or option leaf`))}for(let r of Object.keys(e.fields))n.includes(r)||t.push(`field spec '${r}' names no leaf of the schema`);return t}s(n4,"schemaIssues");function Da(e){let t=n4(e);t.length>0&&C(`[env/schema] ${t.join("; ")}`)}s(Da,"assertSchema");var xm={length:{params:["text"],returns:"number"},years_between:{params:["date","date"],returns:"number"}};function So(e){return JSON.stringify(e)}s(So,"canonical");function La(e){return e.kind==="binary"&&e.op==="&&"?[...La(e.left),...La(e.right)]:[e]}s(La,"conjuncts");function JD(e,t){let n;try{n=qt(e)}catch{return!1}let r=So(qt(t));return La(n).some(i=>So(i)===r)}s(JD,"hasConjunct");function QD(e,t){try{return So(qt(e))===So(qt(t))}catch{return!1}}s(QD,"sameCondition");function ZD(e){let t=[];for(let n of e)t.push(...Kt(Ii(n)));return zD(t)}s(ZD,"contextKeysRead");function XD(e){try{return Kt(qt(e)).some(Ed)}catch{return!1}}s(XD,"readsContext");var r4=/^\d{4}-\d{2}-\d{2}$/,i4=new Set(["==","!=","<","<=",">",">=","in"]),o4=new Set(["<","<=",">",">="]);function Am(e,t,n=[]){Da(t);let r;try{r=qt(e)}catch(a){let l=a.message;return[sn("condition/parse",`Bedingung '${e}' ist nicht lesbar: ${l}`,`condition '${e}' does not parse: ${l}`)]}let i=[];for(let a of Kt(r)){if(!Ed(a)){i.push(sn("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=bm(t.types,a);l!==null&&i.push(sn("condition/unknownIdentifier",l.message.de,l.message.en))}if(i.length>0)return i;let o=di(r,t,i);Id(o)||i.push(sn("condition/notBoolean",`Bedingung '${e}' ist kein Ja/Nein-Ausdruck`,`condition '${e}' is not a yes/no expression`)),d4(r,t,i);for(let{identifier:a,op:l}of pb(r,t))i.push(sn("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(...s4(r,n)),i}s(Am,"conditionIssues");function s4(e,t){let n=La(e).map(So);return t.flatMap(r=>{let i=qt(r),o=a4(i);return o===null||!n.includes(So(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(s4,"guardFormHints");function a4(e){if(e.kind!=="binary"||e.op!=="=="&&e.op!=="!=")return null;let t={...e,left:e.right,right:e.left};return So(t)===So(e)?null:t}s(a4,"mirror");function Id(e){return e.t==="unknown"||e.t==="data"&&e.dt==="boolean"}s(Id,"isBooleanish");function eF(e){let t=Ca(e);return t===null&&C(`[condition/invariant] '${e}' reached a pass that only sees $env identifiers`),t}s(eF,"contextPath");function tF(e,t){let n=Ca(t);return n!==null&&e.fields[n]?.nullable===!0}s(tF,"isNullableLeaf");function l4(e,t){let n=hn($d(e.types,eF(t)));return n===void 0?{t:"unknown"}:{t:"data",dt:n}}s(l4,"identType");function Sm(e,t){return e.t==="unknown"||t.t==="unknown"||e.t==="null"||t.t==="null"?!0:e.t==="array"||t.t==="array"?!1:e.t==="str"&&t.t==="str"?!0:e.t==="str"?YD(e.value,t.dt):t.t==="str"?YD(t.value,e.dt):e.dt===t.dt}s(Sm,"fits");function YD(e,t){return t==="text"||t==="option"||t==="edge"?!0:t==="date"?r4.test(e):!1}s(YD,"strFits");function HD(e){return e.t==="unknown"?"unknown":e.t==="data"&&e.dt==="number"?"number":null}s(HD,"orderedCategory");function di(e,t,n){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 l4(t,e.path);case"arr":for(let r of e.items)di(r,t,n);return{t:"array"};case"unary":{let r=di(e.operand,t,n);return Id(r)||n.push(sn("condition/notBoolean","'!' braucht einen Ja/Nein-Operanden","'!' needs a yes/no operand")),{t:"data",dt:"boolean"}}case"call":{let r=Object.hasOwn(xm,e.name)?xm[e.name]:void 0,i=e.args.map(l=>di(l,t,n));return r===void 0?(n.push(sn("condition/functionNotAllowed",`Funktion '${e.name}' ist nicht erlaubt \u2014 erlaubt: ${Object.keys(xm).join(", ")}`,`function '${e.name}' is not allowed \u2014 allowed: ${Object.keys(xm).join(", ")}`)),{t:"unknown"}):(i.length===r.params.length&&i.every((l,d)=>l.t!=="null"&&Sm(l,{t:"data",dt:r.params[d]}))||n.push(sn("condition/typeMismatch",`'${e.name}' nimmt (${r.params.join(", ")})`,`'${e.name}' takes (${r.params.join(", ")})`)),{t:"data",dt:r.returns})}case"if":{let r=di(e.cond,t,n);Id(r)||n.push(sn("condition/notBoolean","'if' braucht eine Ja/Nein-Bedingung","'if' needs a yes/no condition"));let i=di(e.then,t,n),o=di(e.else,t,n);return Sm(i,o)||n.push(sn("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=di(e.left,t,n),i=di(e.right,t,n);if(e.op==="&&"||e.op==="||")(!Id(r)||!Id(i))&&n.push(sn("condition/notBoolean",`'${e.op}' braucht Ja/Nein-Operanden`,`'${e.op}' needs yes/no operands`));else if(e.op==="in")e.right.kind!=="arr"?n.push(sn("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=>Sm(r,di(o,t,[])))||n.push(sn("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(o4.has(e.op)){let o=HD(r),a=HD(i);(o===null||a===null||o!=="unknown"&&a!=="unknown"&&o!==a)&&n.push(sn("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 Sm(r,i)||n.push(sn("condition/typeMismatch",`'${e.op}' vergleicht Werte verschiedener Typen`,`'${e.op}' compares values of different types`));return{t:"data",dt:"boolean"}}}}s(di,"typeOf");function ub(e){return e.kind==="str"||e.kind==="num"||e.kind==="bool"}s(ub,"isLiteral");function nF(e){let t=[],n=s(r=>{if(r.kind==="binary"&&i4.has(r.op)){if(r.left.kind==="ident"){let i=r.op==="in"&&r.right.kind==="arr"?r.right.items.filter(ub):ub(r.right)?[r.right]:[];i.length>0&&t.push({ident:r.left.path,literals:i})}r.right.kind==="ident"&&ub(r.left)&&t.push({ident:r.right.path,literals:[r.left]})}rF(r,n)},"visit");return n(e),t}s(nF,"comparedLiterals");function d4(e,t,n){for(let{ident:r,literals:i}of nF(e)){let o=c4(r,i,t);o!==null&&n.push(o)}}s(d4,"literalIssues");function fb(e,t){let n;try{n=qt(e)}catch{return[]}let r=[];for(let{ident:i,literals:o}of nF(n)){let a=Ca(i);if(!(a===null||t.fields[a]?.valueSet.kind!=="live"))for(let l of o)l.kind==="str"&&r.push({path:a,value:l.value})}return r}s(fb,"liveLiterals");function c4(e,t,n){let r=n.fields[eF(e)]?.valueSet;if(r?.kind==="unstable")return sn("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=t.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 sn("condition/literalOutsideSet",`'${e}' kennt nur ${o} \u2014 nicht ${i.join(", ")}`,`'${e}' takes only ${o} \u2014 not ${i.join(", ")}`)}s(c4,"valueSetIssue");function rF(e,t){switch(e.kind){case"binary":t(e.left),t(e.right);return;case"unary":t(e.operand);return;case"call":e.args.forEach(t);return;case"arr":e.items.forEach(t);return;case"if":t(e.cond),t(e.then),t(e.else);return;default:return}}s(rF,"forEachChild");function iF(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(iF,"isNullTest");function oF(e){return La(e).flatMap(t=>{let n=sF(t);return n===null?[]:[n]})}s(oF,"guardsOf");function Od(e,t,n){switch(e.kind){case"ident":return tF(t,e.path)&&!n.has(e.path)?e.path:null;case"call":for(let r of e.args){let i=Od(r,t,n);if(i!==null)return i}return null;case"if":return Od(e.then,t,new Set([...n,...oF(e.cond)]))??Od(e.else,t,n);default:return null}}s(Od,"unguardedNullSource");function sF(e){return!iF(e)||e.kind!=="binary"||e.op!=="!="?null:e.left.kind==="ident"?e.left.path:e.right.kind==="ident"?e.right.path:null}s(sF,"guardedIdent");function Fa(e,t,n,r){if(e.kind==="binary"&&e.op==="&&"){let i=new Set(n);for(let o of La(e)){Fa(o,t,i,r);let a=sF(o);a!==null&&i.add(a)}return}if(e.kind==="if"){Fa(e.cond,t,n,r),Fa(e.then,t,new Set([...n,...oF(e.cond)]),r),Fa(e.else,t,n,r);return}if(e.kind==="binary"&&e.op==="!="&&e.left.kind!=="null"&&e.right.kind!=="null"){let i=Od(e.left,t,n)??Od(e.right,t,n);i!==null&&r(i,"!=")}if(e.kind==="unary"&&!iF(e.operand)){let i=Kt(e.operand).filter(o=>tF(t,o)&&!n.has(o));i.length>0&&r(i[0],"!")}rF(e,i=>Fa(i,t,n,r))}s(Fa,"nullableReads");function pb(e,t){Da(t);let n=[];return Fa(e,t,new Set,(r,i)=>{n.some(o=>o.identifier===r)||n.push({identifier:r,op:i})}),n}s(pb,"unguardedNullableReads");function sn(e,t,n){return{severity:"error",code:e,message:{de:`[${e}] ${t}`,en:`[${e}] ${n}`}}}s(sn,"error");function _d(e){let t=Array.isArray(e.nodes)?e.nodes:[],n=new Set;for(let r of t)for(let i of am(r))i.key!==null&&xa[i.leaf].involves&&n.add(i.key);return n}s(_d,"declaredGroupKeys");var Ma=Op;var u4="unit.key",f4="offer.key";function aF(e,t){return e===u4?t.unitKeys:e===f4?t.offerKeys:null}s(aF,"liveKeyUniverse");function Tm(e){return[vt,...[..._d(e)].sort((t,n)=>t.localeCompare(n)).map(Lp)]}s(Tm,"requiredSlots");var Ao=`${Np("applicant.channel")} == 'staff'`;var hb=["strict","leastLoaded"];var mb=2;function lF(e){return e.some(t=>t.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<mb?{de:`braucht mindestens ${mb} Personen`,en:`needs at least ${mb} people`}:null}s(lF,"rotationPoolProblem");function p4(e,t){let n=t===null?-1:e.indexOf(t);return[...e.slice(n+1),...e.slice(0,n+1)]}s(p4,"strictOrder");function dF(e){let t=p4(e.pool,e.previous).filter(i=>e.eligible.has(i));if(t.length===0)return null;if(e.mode==="strict")return t[0];let n=e.openCounts;n===void 0&&C("[assignment/rotation] leastLoaded needs the open counts");let r=s(i=>{let o=n.get(i);return o===void 0&&C(`[assignment/rotation] no open count for '${i}'`),o},"load");return t.reduce((i,o)=>r(o)<r(i)?o:i)}s(dF,"pickFromPool");function uF(e){return e.map(t=>({slot:fN(t.slot),rules:[...t.rules]}))}s(uF,"rulesOfStored");function fF(e){return e.map(t=>({slot:m4(t.slot),rules:[...t.rules]}))}s(fF,"storedOfRules");function m4(e){let t=qp(e);return t===null&&C(`[assignment/unknownSlot] '${e}' is no slot \u2014 'responsible' or 'team:<teamKey>'`),t}s(m4,"slotOf");function pF(e,t){let n=e?.assignmentRules;n===void 0&&C(`[assignment/noRules] ${t}: the workflow has no assignment rule`);let r=yF(n);return r.length>0&&C(`${r.join("; ")} (${t})`),uF(n)}s(pF,"rulesOfGraph");function h4(e){return e===vt?{slot:e,rules:[{when:Ao,assign:{kind:"creator"}},{when:null,assign:{kind:"unassigned"}}]}:{slot:e,rules:[{when:null,assign:{kind:"queue"}}]}}s(h4,"defaultSlotRules");function mF(e,t){let n=new Set(e.map(o=>o.slot)),r=t.filter(o=>!n.has(o)).map(h4);return[...r.filter(o=>o.slot===vt),...e,...r.filter(o=>o.slot!==vt)]}s(mF,"withRequiredSlots");function Vt(e,t){return t===void 0?`slot '${e}'`:`slot '${e}' row #${t+1}`}s(Vt,"where");function Yn(e,t){return t===void 0?`Liste '${e}'`:`Liste '${e}', Zeile #${t+1}`}s(Yn,"whereDe");function Dn(e,t,n={},r="error"){return{severity:r,code:e,message:{de:`[${e}] ${t.de}`,en:`[${e}] ${t.en}`},...n}}s(Dn,"issue");function cF(e){if(e===vt)return!0;let t=Mp(e);return t!==null&&t.length>0}s(cF,"isKnownSlot");function g4(e,t){Da(Ma);let n=[],r=new Set;e.forEach((o,a)=>{let{slot:l}=o;cF(l)||n.push(Dn("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)&&n.push(Dn("assignment/duplicateSlot",{de:`${Yn(l)} steht zweimal da`,en:`${Vt(l)} is listed twice`},{slot:l})),r.add(l),l===vt&&a!==0&&n.push(Dn("assignment/responsibleFirst",{de:`'${vt}' muss die erste Liste sein \u2014 Team-Zeilen \xFCbernehmen sie`,en:`'${vt}' must be the first slot \u2014 team rows copy it`},{slot:l})),n.push(...y4(o))});for(let o of t)r.has(o)||n.push(Dn("assignment/slotMissing",{de:`${Yn(o)} hat keine Regeln \u2014 der Workflow braucht sie`,en:`${Vt(o)} has no rule list \u2014 the workflow needs it`},{slot:o}));let i=new Set(t);for(let{slot:o}of e)o!==vt&&!i.has(o)&&cF(o)&&n.push(Dn("assignment/unusedSlot",{de:`${Yn(o)} wird hier nicht gebraucht \u2014 erlaubt, und nicht ausgewertet`,en:`${Vt(o)} is not needed here \u2014 allowed, and not evaluated`},{slot:o},"info"));return n}s(g4,"validateRules");function y4({slot:e,rules:t}){let n=[];return(t.length===0||t[t.length-1].when!==null)&&n.push(Dn("assignment/defaultRowMissing",{de:`${Yn(e)} muss mit einer Zeile ohne Bedingung enden (\u201Esonst\u201C)`,en:`${Vt(e)} must end with a row without condition ("otherwise")`},{slot:e})),t.forEach((r,i)=>{let o={slot:e,row:i},{when:a,assign:l}=r;if(a===null&&i<t.length-1&&n.push(Dn("assignment/ruleAfterDefault",{de:`${Yn(e,i)} hat keine Bedingung, aber es folgen Zeilen \u2014 sie treffen nie zu`,en:`${Vt(e,i)} has no condition, but rows follow it \u2014 they can never match`},o)),a!==null){let d=Am(a,Ma,[Ao]);for(let c of d)n.push({...c,message:{de:`${c.message.de} (${Yn(e,i)})`,en:`${c.message.en} (${Vt(e,i)})`},...o});if(d.every(c=>c.severity!=="error")){XD(a)||n.push(Dn("assignment/shadowedRule",{de:`${Yn(e,i)} liest nichts aus dem Vorgang \u2014 sie gilt immer oder nie`,en:`${Vt(e,i)} reads nothing of the application \u2014 it holds for every application or for none`},o));let c=t.slice(0,i).findIndex(u=>u.when!==null&&QD(u.when,a));c!==-1&&n.push(Dn("assignment/shadowedRule",{de:`${Yn(e,i)} wiederholt die Bedingung von Zeile #${c+1} \u2014 sie trifft nie zu`,en:`${Vt(e,i)} repeats the condition of row #${c+1} \u2014 it can never match`},o))}}if(e===vt&&l.kind==="slot"&&n.push(Dn("assignment/slotForwardRef",{de:`${Yn(e,i)} \xFCbernimmt '${l.slot}' \u2014 das darf nur eine Team-Liste nach '${vt}'`,en:`${Vt(e,i)} copies '${l.slot}' \u2014 only a team slot after '${vt}' may`},o)),e===vt&&l.kind==="queue"&&n.push(Dn("assignment/queueOnProcessSlot",{de:`${Yn(e,i)} weist die Queue zu \u2014 die Prozesszust\xE4ndigkeit ist immer eine Person`,en:`${Vt(e,i)} assigns the queue \u2014 the responsible slot is always a person`},o)),l.kind==="unassigned"&&n.push(Dn("assignment/targetMissing",{de:`${Yn(e,i)} nennt noch niemanden \u2014 Person w\xE4hlen`,en:`${Vt(e,i)} names no one yet \u2014 choose a person`},o)),l.kind==="rotation"){let d=lF(l.configKeys);d!==null&&n.push(Dn("assignment/rotationPool",{de:`${Yn(e,i)}: die Reihum-Liste ${d.de}`,en:`${Vt(e,i)} rotates over a pool that ${d.en}`},o))}l.kind==="creator"&&(a===null||!JD(a,Ao))&&n.push(Dn("assignment/unguardedTarget",{de:`${Yn(e,i)} weist die anlegende Person zu \u2014 die gibt es nur, wenn die Bedingung der Zeile '${Ao}' ist (oder enth\xE4lt)`,en:`${Vt(e,i)} assigns the creator, which exists only when the row's condition is (or has the conjunct) '${Ao}'`},o))}),n}s(y4,"rowIssues");function hF(e,t){for(let r of t)e.some(i=>i.slot===r)||C(`[assignment/slotMissing] ${Vt(r)} has no rule list`);let n=new Set(t);return e.filter(r=>n.has(r.slot))}s(hF,"selectSlots");function w4(e,t){return ZD(hF(e,t).flatMap(n=>n.rules.flatMap(r=>r.when===null?[]:[r.when])))}s(w4,"contextKeysOfRules");function gF(e,t,n,r){Da(Ma);let i=hF(e,n),o=w4(e,n),a=vm(Ma.types,t,o);WD(Ma,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 Kt(Ii(h.when)))Object.hasOwn(a,b)||C(`[condition/unknownIdentifier] ${Vt(d,y)} reads '${b}', which the context does not carry`);return KN(h.when,{values:a})});u===-1&&C(`[assignment/defaultRowMissing] ${Vt(d)}: no row matched and there is no default row`);let p=c[u].assign;l.push({slot:d,ruleIndex:u,assign:p,value:k4(d,u,p,l,r)})}return l}s(gF,"evaluateRules");function k4(e,t,n,r,i){switch(n.kind){case"person":return{kind:"value",value:i.person(n.configKey)};case"creator":return{kind:"value",value:i.creator()};case"rotation":return{kind:"value",value:i.rotation(n,{slot:e,row:t})};case"unassigned":return C(`[assignment/targetMissing] ${Vt(e,t)} names no one`);case"queue":return e===vt&&C(`[assignment/queueOnProcessSlot] ${Vt(e,t)} assigns the queue`),{kind:"queue"};case"slot":{let o=e===vt?void 0:r.find(a=>a.slot===n.slot);return o===void 0&&C(`[assignment/slotForwardRef] ${Vt(e,t)} copies '${n.slot}', which is not decided before it`),o.value}}}s(k4,"resolveTarget");var gb={person:["kind","configKey"],creator:["kind"],slot:["kind","slot"],queue:["kind"],rotation:["kind","configKeys","mode"],unassigned:["kind"]};function b4(e){if(typeof e!="object"||e===null)return!1;let{kind:t,groupKey:n,...r}=e;return Object.keys(r).length>0?!1:t==="responsible"?n===void 0:t==="team"&&typeof n=="string"&&n.length>0}s(b4,"isStoredSlot");function yF(e){let t=[],n=s((r,i)=>t.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 n(o,"must be { slot, rules }");let{slot:a,rules:l,...d}=r;if(Object.keys(d).length>0&&n(o,`unknown field(s) ${Object.keys(d).join(", ")}`),b4(a)||n(o,"slot must be { kind: 'responsible' } or { kind: 'team', groupKey: '<team key>' }"),!Array.isArray(l))return n(o,"rules must be a list");l.forEach((c,u)=>{let p=`${o}.rules[${u}]`;if(typeof c!="object"||c===null)return n(p,"must be { when, assign }");let{when:h,assign:y,...b}=c;Object.keys(b).length>0&&n(p,`unknown field(s) ${Object.keys(b).join(", ")}`),h!==null&&typeof h!="string"&&n(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(gb,k))return n(p,`assign must be one of ${Object.keys(gb).map(I=>`{kind:'${I}'}`).join(", ")}`);let v=gb[k],A=Object.keys(y);(A.some(I=>!v.includes(I))||v.some(I=>!A.includes(I)))&&n(p,`a '${k}' target has exactly the field(s) ${v.join(", ")}`);let T=y;if(k==="person"&&(typeof T.configKey!="string"||T.configKey.length===0)&&n(p,"a 'person' target needs a non-empty configKey"),k==="rotation"){let I=T.configKeys;(!Array.isArray(I)||I.some(D=>typeof D!="string"))&&n(p,"a 'rotation' target needs configKeys, a list of person keys"),hb.includes(T.mode)||n(p,`a 'rotation' target's mode is one of ${hb.map(D=>`'${D}'`).join(", ")}`)}k==="slot"&&T.slot!==vt&&n(p,`a 'slot' target copies '${vt}' and nothing else`)})}),t):(n("slots","must be a list of { slot, rules }"),t)}s(yF,"ruleShapeIssues");function wF(e){let t=e??{},n=[];if(t.teamOwnerBindings!==void 0&&n.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"}),t.assignmentRules===void 0)return n.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"}),n;let r=yF(t.assignmentRules);if(r.length>0)return[...n,...r.map(o=>({de:o,en:o}))];let i=Tm({nodes:Array.isArray(t.nodes)?t.nodes:[]});for(let o of g4(uF(t.assignmentRules),i))o.severity==="error"&&n.push(o.message);return n}s(wF,"workflowAssignmentIssues");var yb="team:",v4=/^[a-z0-9][a-z0-9-]*$/;function x4(e){if(!e.startsWith(yb))return null;let t=e.slice(yb.length);return t.length>0?t:null}s(x4,"teamKeyOfMember");function Rm(e){return`${yb}${e}`}s(Rm,"teamMember");function qa(e){let t=e.channels;return t===void 0?[]:(Array.isArray(t)||C("graph.channels must be an array"),t)}s(qa,"readAuthoredChannels");function kF(e){return[..._d(e)].sort()}s(kF,"derivedChannelTeamKeys");function bF(e,t){let n=e.toLowerCase().replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"channel";if(!t.has(n))return n;for(let r=2;;r++){let i=`${n}-${r}`;if(!t.has(i))return i}}s(bF,"mintChannelKey");function vF(e,t){let n=e.channels;if(n===void 0)return[];if(!Array.isArray(n))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=_d(e),o=new Set,a=new Map;return n.forEach((l,d)=>{let c=`channels[${d}]`,u=l;if(u===null||typeof u!="object"||typeof u.key!="string"||Lt(u.label)==="not-localized"||!Array.isArray(u.members)||!u.members.every(A=>typeof A=="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}"`};v4.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=Lt(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 A of u.members){let T=x4(A);if(T===null){r.push({path:`${c}.members`,reason:{de:`[channels/invalidMember] ${p.de}: "${A}" ist kein "team:<schl\xFCssel>".`,en:`[channels/invalidMember] ${p.en}: "${A}" is not a "team:<key>".`}});continue}if(y.includes(T)){r.push({path:`${c}.members`,reason:{de:`[channels/duplicateMember] ${p.de}: Team "${T}" ist doppelt genannt.`,en:`[channels/duplicateMember] ${p.en}: team "${T}" is named twice.`}});continue}t!==void 0&&!t.has(T)&&r.push({path:`${c}.members`,reason:{de:`[channels/unknownTeam] ${p.de}: Team "${T}" gibt es in diesem Mandanten nicht (oder es ist die Bewerbergruppe).`,en:`[channels/unknownTeam] ${p.en}: team "${T}" does not exist at this school (or it is the applicant group).`}}),y.push(T)}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(vF,"channelIssues");var tve=Object.freeze({});function xF(e,t){return Object.freeze(vm(po,e,t))}s(xF,"formContextEntries");function SF(e){return e.env??[]}s(SF,"declaredContextKeys");function kb(e){return Ed(e)}s(kb,"isContextIdentifier");function S4(e,t,n){let r=bm(po,e);if(r!==null)return{severity:"error",path:n,code:"env/unknownKey",message:r.message};let[,i=""]=e.split(".");return t.has(i)?null:{severity:"error",path:n,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(S4,"contextIdentifierIssue");var wb=Np("stage.key");function A4(e){let t=[],n=s(i=>i.kind==="ident"&&i.path===wb,"isStageKey"),r=s(i=>{switch(i.kind){case"binary":if((i.op==="=="||i.op==="!=")&&(n(i.left)&&i.right.kind==="str"&&t.push(i.right.value),n(i.right)&&i.left.kind==="str"&&t.push(i.left.value)),i.op==="in"&&n(i.left)&&i.right.kind==="arr")for(let o of i.right.items)o.kind==="str"&&t.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),t}s(A4,"stageKeyLiterals");function $m(e,t,n){return t===void 0?[]:A4(e).filter(r=>!t.has(r)).map(r=>T4(r,t,n))}s($m,"stageKeyAstIssues");function T4(e,t,n){let r=[...t].sort();return{severity:"error",path:n,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.")+` \`${wb}\` 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.")+` \`${wb}\` is the bundle key (\`program.stages[].key\`), never the stored \`<program>-stufe-<key>\`.`}}}s(T4,"unknownStageKeyIssue");function AF(e,t,n){let r=[];for(let i of Kt(e)){if(!kb(i))continue;let o=S4(i,t,n);o!==null&&r.push(o)}if(r.length>0)return r;for(let{identifier:i,op:o}of pb(e,Op))r.push({severity:"error",path:n,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(AF,"contextAstIssues");function TF(e,t){let n=[...R4(e)];for(let r of e.env??[]){if(!mo(r)){n.push({severity:"error",path:"env",code:"env/unknownKey",message:{de:`Der deklarierte Umgebungsschl\xFCssel '${r}' geh\xF6rt nicht zum Vokabular (${da.join(", ")}).`,en:`Declared environment key '${r}' is not in the vocabulary (${da.join(", ")}).`}});continue}t!==void 0&&!t.has(r)&&n.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 n}s(TF,"formContextIssues");function R4(e){let t=[];Object.hasOwn(e,"context")&&t.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 n=e.testScenarios;for(let r of Array.isArray(n)?n:[]){if(r===null||typeof r!="object")continue;let i=String(r.id);Object.hasOwn(r,"context")&&t.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")&&t.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 t}s(R4,"retiredContextFields");function Em(e,t,n){let r=Am(e,t).filter(o=>o.severity==="error").map(o=>o.message);if(r.length>0)return r;let i=[];if(n?.liveEnvKeys!==void 0)for(let o of fb(e,t)){let a=aF(o.path,n.liveEnvKeys);a===null&&C(`[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 $m(qt(e),n?.stageKeys,""))i.push({de:`[${o.code}] ${o.message.de}`,en:`[${o.code}] ${o.message.en}`});return i}s(Em,"envConditionFindings");function Im(e){return e.kind==="entered"&&!e.repeated&&e.reviewRequired}s(Im,"isReviewField");function Ka(e){let t=[],n=[];function r(k,v){try{return qt(k)}catch(A){t.push({path:v,src:k,reason:A instanceof Error?A.message:String(A)});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((A,T)=>i(A,`${v}.fields[${T}]`))}}s(o,"compileGroup");function a(k,v){return{...k,itemTemplate:k.itemTemplate.map((A,T)=>i(A,`${v}.itemTemplate[${T}]`)),effects:k.effects?.map((A,T)=>d(A,`${v}.effects[${T}]`)),itemVisibleIf:k.itemVisibleIf?r(k.itemVisibleIf,`${v}.itemVisibleIf`):void 0}}s(a,"compileRepeated");function l(k,v){let A=[];return k.fields.forEach((T,I)=>{if(T.externalFlag){n.push({key:T.key,label:T.label,defaultValue:T.defaultValue?r(T.defaultValue,`${v}.fields[${I}].defaultValue`):void 0});return}A.push(i(T,`${v}.fields[${I}]`))}),{...k,visibleIf:k.visibleIf?r(k.visibleIf,`${v}.visibleIf`):void 0,fields:A,groups:k.groups?.map((T,I)=>o(T,`${v}.groups[${I}]`)),computed:k.computed?.map((T,I)=>{let D=r(T.expression,`${v}.computed[${I}].expression`);return{key:T.key,expression:D??{kind:"null"}}}),subsections:k.subsections?.map((T,I)=>l(T,`${v}.subsections[${I}]`)),repeated:k.repeated?.map((T,I)=>a(T,`${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 A=r(k.when,`${v}.when`);return A?{...k,when:A}: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],A=c(v,`outcomes[${k}]`);A&&h.push(A)}return{compiled:{...e,sections:u,effects:p,outcomes:h,flags:n},errors:t}}s(Ka,"compileForm");var $4=new Set(["decision","review","governedDocument"]);function $F(e){return $4.has(e.type)&&!(e.type==="governedDocument"&&e.production==="none")}s($F,"isReadinessGatedNode");function E4(e){let t=new Map,n=O4(e),r=s((i,o)=>{let a=bb(o),l=[...i.fields,...(i.groups??[]).flatMap(d=>d.fields)];for(let d of l)d.externalFlag!==!0&&t.set(d.key,{kind:"entered",key:d.key,label:d.label,qualifier:I4(d.bucket,n,a),section:a,type:d.type,enumSource:RF(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}`;t.set(u,{kind:"entered",key:u,label:c.label,qualifier:bb(d),section:a,type:c.type,enumSource:RF(c),repeated:!0,reviewRequired:!1})}for(let d of i.computed??[]){let c=Kt(qt(d.expression));t.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 t}s(E4,"formFieldCatalog");function RF(e){return e.type==="enum"?e:null}s(RF,"enumSourceOf");function I4(e,t,n){return e===void 0?n:t.get(e)??n}s(I4,"fieldQualifier");function O4(e){let t=new Map,n=s((r,i)=>{i===void 0||t.has(r)||t.set(r,bb(i))},"add");for(let r of IF(e))r.kind==="person"?n(r.bucket,r.display):r.kind==="organization"&&n(r.id.replace(/^o\./,""),r.display);return t}s(O4,"bucketWordings");function EF(e){return e.flatMap(t=>[t,...EF(t.subsections??[])])}s(EF,"allSections");function IF(e){return[...e.effects,...EF(e.sections).flatMap(t=>(t.repeated??[]).flatMap(n=>n.effects??[]))]}s(IF,"allEffects");function bb(e){return{label:e.label}}s(bb,"wordingOf");function OF(e){return md(e).flatMap(({slot:t,address:n})=>{let r=zN(n);return r===null||pd.includes(r.path)?[]:[{slotId:t,owner:r.owner,fieldKey:r.path}]})}s(OF,"admissionBindingLeaves");function _4(e,t){let n=e.get(t);if(n===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(n),r}s(_4,"expandKey");function N4(e){let t=new Set;for(let n of IF(e))if(!(n.kind!=="person"||n.contractParty===void 0)&&n.when!==void 0)for(let r of Kt(qt(n.when)))t.add(r);return[...t]}s(N4,"contractPartyConditionKeys");function P4(e){return Ka(e).compiled.flags.map(t=>({key:t.key,name:t.label}))}s(P4,"formExternalFlags");function _F(e){return{readinessFormFieldsByFormNode:new Map([...e].map(([t,n])=>[t,E4(n)])),readinessPartyConditionKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set(N4(n))])),formFlagKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set(P4(n).map(r=>r.key))])),formViewKeysByFormNode:new Map([...e].map(([t,n])=>[t,new Set((n.views??[]).map(r=>r.key))]))}}s(_F,"readinessUniverse");function vb(e,t){let n=new Set;for(let r of t)for(let i of _4(e,r)??[])i.kind==="entered"&&n.add(i.fieldKey);return n}s(vb,"enteredFieldsBehind");var C4=new Set(["label","sublabel","title","description","body","chipLabel","nextAction","confirmLabel","placeholder","helpText","subject","heading","hint","notice","reason"]);function D4(e){return C4.has(e)?!0:NF(e)?!1:/(Label|Title|Body|Description|Text|Hint|Heading|Placeholder)$/.test(e)}s(D4,"isTextKey");function NF(e){return/^localized[A-Z]/.test(e)}s(NF,"isLegacyTwinKey");var F4=new Set(["titles","responseLabels","outputLabels","enumOptionLabels"]),L4=new Set(["inputs","resolver","library"]);function _m(e,t){let n=[];return xb(e,t,n),n}s(_m,"findUnlocalizedTexts");function xb(e,t,n){if(Array.isArray(e)){e.forEach((i,o)=>xb(i,`${t}[${q4(i,o)}]`,n));return}if(e===null||typeof e!="object")return;let r=e;for(let[i,o]of Object.entries(r)){let a=`${t}.${i}`;if(!L4.has(i)){if(NF(i)){n.push({path:a,missing:"legacy-twin"});continue}if(D4(i)){M4(o,a,n);continue}if(F4.has(i)&&o!==null&&typeof o=="object"){for(let[l,d]of Object.entries(o))d!==void 0&&PF(d,`${a}.${l}`,n);continue}xb(o,a,n)}}}s(xb,"walk");function M4(e,t,n){e!=null&&PF(e,t,n)}s(M4,"checkText");function PF(e,t,n){let r=Lt(e);(r==="not-localized"||r.length>0)&&n.push({path:t,missing:r})}s(PF,"report");function q4(e,t){if(e!==null&&typeof e=="object"){let n=e;if(typeof n.id=="string")return n.id;if(typeof n.key=="string")return n.key}return String(t)}s(q4,"keyOf");function Om(e,t){return e==="not-localized"?t==="de"?"ist kein zweisprachiger Text ({ de, en })":"is not a bilingual text ({ de, en })":e==="legacy-twin"?t==="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"':t==="de"?`fehlt in: ${e.join(", ")}`:`is missing in: ${e.join(", ")}`}s(Om,"describe");function Sb({path:e,missing:t}){return t==="legacy-twin"?{de:`[i18n/legacyTwin] ${e} ${Om(t,"de")}.`,en:`[i18n/legacyTwin] ${e} ${Om(t,"en")}.`}:{de:`[i18n/missingTranslation] ${e} ${Om(t,"de")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch; die Sprache folgt dem Konto des Lesenden.`,en:`[i18n/missingTranslation] ${e} ${Om(t,"en")} \u2014 every displayed text needs German and English; the language follows the reader's account.`}}s(Sb,"unlocalizedTextReason");var K4={engagePush:["engage"]};function j4(e){let t=K4[e.type];return t===void 0?e:Object.fromEntries(Object.entries(e).filter(([n])=>!t.includes(n)))}s(j4,"withoutMachineData");function CF(e,t){return[..._m(e.nodes.map(j4),"nodes"),...t===void 0?[]:_m(t,`layout.${t.id}`)].map(r=>({layer:"GRAPH",kind:"i18n",path:r.path,reason:Sb(r),severity:"error"}))}s(CF,"checkLocalizedTexts");var ps=5,ms=480;function Li(e){return typeof e=="string"&&e.trim().length>0}s(Li,"isNonEmptyString");function FF(e,t,n){return Object.keys(e).filter(r=>!t.includes(r)).map(r=>({field:`result.${r}`,code:Ye.unknownField,message:{de:`Unbekanntes Feld '${r}' im ${n.de}; erlaubt sind: ${t.join(", ")}.`,en:`Unknown field '${r}' in the ${n.en}; allowed: ${t.join(", ")}.`}}))}s(FF,"unknownFieldIssues");var Nm="primaryHostTeams";function V4(e){let t=[],n=e.title;(n===void 0||typeof n!="object"||n===null||!Li(n.de)||!Li(n.en))&&t.push({field:"result.title",code:Ye.appointmentMissingTitle,message:{de:"Ein Termin-Ergebnis braucht einen neutralen Titel in beiden Sprachen ({ de, en }) \u2014 er steht in der Mail und in der Kalenderdatei der Familie, deshalb nie ein Familienname.",en:"An appointment result needs a neutral title in both languages ({ de, en }) \u2014 it appears in the email and in the family's calendar file, so never a family name."}});let r=e.durationMinutes;(typeof r!="number"||!Number.isInteger(r)||r<ps||r>ms)&&t.push({field:"result.durationMinutes",code:Ye.appointmentInvalidDuration,message:{de:`'durationMinutes' muss eine ganze Zahl von ${ps} bis ${ms} sein, erhalten ${JSON.stringify(r)}.`,en:`'durationMinutes' must be a whole number from ${ps} to ${ms}, got ${JSON.stringify(r)}.`}});let{[Nm]:i,...o}=e;return t.push(...FF(o,["kind","title","durationMinutes","primaryParticipantTeams","participants"],{de:"Termin-Ergebnis",en:"appointment result"})),t}s(V4,"appointmentIssues");function DF(e){if(typeof e!="object"||e===null)return!1;let t=e;return Li(t.de)&&Li(t.en)}s(DF,"isBilingual");var Ab=["key","type","label","writes","options","min","suggest","evidence","evidenceFrom","multiple","tasks","maxLength"];function B4(e,t){let n=s((o,a)=>({field:o,code:Ye.recordFields,message:a}),"issue");if(!Array.isArray(e)||e.length===0)return[n("result.fields",{de:"Eine Erfassung braucht mindestens ein Feld ('result.fields').",en:"A record needs at least one field ('result.fields')."})];let r=[],i=new Set;for(let[o,a]of e.entries()){let l=`result.fields[${o}]`;if(typeof a!="object"||a===null||Array.isArray(a)){r.push(n(l,{de:"Ein Feld der Erfassung muss ein Objekt sein.",en:"A field of the record must be an object."}));continue}let d=a,c=d.key;typeof c!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(c)?r.push(n(`${l}.key`,{de:`Feld-Schl\xFCssel ${JSON.stringify(c)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,en:`Field key ${JSON.stringify(c)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`})):i.has(c)?r.push(n(`${l}.key`,{de:`Feld-Schl\xFCssel "${c}" ist doppelt.`,en:`Field key "${c}" is duplicated.`})):i.add(c);let u=typeof c=="string"?`"${c}"`:`Nr. ${o+1}`,p=typeof c=="string"?`"${c}"`:`no. ${o+1}`;if(fk(d.type)||r.push(n(`${l}.type`,{de:`Feld ${u}: Typ ${JSON.stringify(d.type)} \u2014 erlaubt: ${jp.join(", ")}.`,en:`Field ${p}: type ${JSON.stringify(d.type)} \u2014 allowed: ${jp.join(", ")}.`})),DF(d.label)||r.push(n(`${l}.label`,{de:`Feld ${u} braucht ein Label in beiden Sprachen ({ de, en }).`,en:`Field ${p} needs a label in both languages ({ de, en }).`})),Li(d.writes)||r.push(n(`${l}.writes`,{de:`Feld ${u} schreibt in keinen Vorgangs-Schl\xFCssel ('writes') \u2014 ein Wert, den niemand lesen kann, geh\xF6rt nicht in eine Erfassung.`,en:`Field ${p} writes to no process key ('writes') \u2014 a value nobody can read does not belong in a record.`})),d.type==="enum"){let y=Array.isArray(d.options)?d.options:[],b=y.map(k=>k.key);(y.length<2||b.some(k=>typeof k!="string"||k.length===0)||new Set(b).size!==b.length||y.some(k=>!DF(k.label)))&&r.push(n(`${l}.options`,{de:`Feld ${u} (Auswahl) braucht mindestens 2 Optionen mit eindeutigen Schl\xFCsseln und Labels in beiden Sprachen.`,en:`Field ${p} (choice) needs at least 2 options with unique keys and labels in both languages.`}))}else d.options!==void 0&&r.push(n(`${l}.options`,{de:`Feld ${u}: 'options' gibt es nur bei Typ 'enum'.`,en:`Field ${p}: 'options' exists only for type 'enum'.`}));if(d.min!==void 0&&(d.type!=="number"||typeof d.min!="number"||!Number.isInteger(d.min))&&r.push(n(`${l}.min`,{de:`Feld ${u}: 'min' gibt es nur bei Typ 'number', als ganze Zahl.`,en:`Field ${p}: 'min' exists only for type 'number', as a whole number.`})),d.evidence!==void 0&&typeof d.evidence!="boolean"&&r.push(n(`${l}.evidence`,{de:`Feld ${u}: 'evidence' ist true oder false.`,en:`Field ${p}: 'evidence' is true or false.`})),d.evidenceFrom!==void 0){let y=typeof d.min=="number"?d.min:0;(d.type!=="number"||d.evidence!==!0||typeof d.evidenceFrom!="number"||!Number.isInteger(d.evidenceFrom)||d.evidenceFrom<=y)&&r.push(n(`${l}.evidenceFrom`,{de:`Feld ${u}: 'evidenceFrom' gibt es nur bei Typ 'number' mit 'evidence', als ganze Zahl \xFCber dem Minimum (${y}) \u2014 sonst g\xE4lte der Nachweis immer.`,en:`Field ${p}: 'evidenceFrom' exists only for type 'number' with 'evidence', as a whole number above the minimum (${y}) \u2014 otherwise the proof would always apply.`}))}if(r.push(...U4(d,l,u,p,t)),d.suggest!==void 0){let y=d.suggest,b=typeof y=="object"&&y!==null?y.kind:void 0,k=b==="form"&&"address"in y&&Object.keys(y).length===2&&(!ke(y.address)||gt(y.address))||b==="siblingRank"&&Object.keys(y).length===1&&d.type==="number";_N(d.type)?k||r.push({field:`${l}.suggest`,code:Ye.recordSuggest,message:{de:`Feld ${u}: Vorschlag ${JSON.stringify(d.suggest)} \u2014 erlaubt: { kind: 'form', address: '$node.<formular>.admission.<export>' } oder { kind: 'siblingRank' } (nur bei Typ 'number'); bekannte Arten: ${pk.join(", ")}.`,en:`Field ${p}: suggestion ${JSON.stringify(d.suggest)} \u2014 allowed: { kind: 'form', address: '$node.<form>.admission.<export>' } or { kind: 'siblingRank' } (only for type 'number'); known kinds: ${pk.join(", ")}.`}}):r.push({field:`${l}.suggest`,code:Ye.recordSuggest,message:{de:`Feld ${u}: einen Vorschlag gibt es nur bei Typ number, boolean oder enum.`,en:`Field ${p}: a suggestion exists only for type number, boolean or enum.`}})}let h=Object.keys(d).filter(y=>!Ab.includes(y));h.length>0&&r.push(n(l,{de:`Feld ${u}: unbekannte Angabe ${h.map(y=>`'${y}'`).join(", ")}; erlaubt: ${Ab.join(", ")}.`,en:`Field ${p}: unknown entry ${h.map(y=>`'${y}'`).join(", ")}; allowed: ${Ab.join(", ")}.`}))}return r}s(B4,"recordFieldIssues");function U4(e,t,n,r,i){let o=[],a=e.maxLength;if(a!==void 0&&(e.type!=="text"||typeof a!="number"||!Number.isInteger(a)||a<1||a>Vp)&&o.push({field:`${t}.maxLength`,code:Ye.recordText,message:{de:`Feld ${n}: 'maxLength' gibt es nur bei Typ 'text', als ganze Zahl von 1 bis ${Vp}.`,en:`Field ${r}: 'maxLength' exists only for type 'text', as a whole number from 1 to ${Vp}.`}}),e.multiple!==void 0&&(e.type!=="person"||typeof e.multiple!="boolean")&&o.push({field:`${t}.multiple`,code:Ye.recordPerson,message:{de:`Feld ${n}: 'multiple' gibt es nur bei Typ 'person', als true oder false.`,en:`Field ${r}: 'multiple' exists only for type 'person', as true or false.`}}),e.type!=="assignment")return e.tasks!==void 0&&o.push({field:`${t}.tasks`,code:Ye.recordAssignment,message:{de:`Feld ${n}: 'tasks' gibt es nur bei Typ 'assignment'.`,en:`Field ${r}: 'tasks' exists only for type 'assignment'.`}}),o;let l=e.tasks;if(!Array.isArray(l)||l.length===0||l.some(d=>typeof d!="string"||d.length===0)||new Set(l).size!==l.length)return o.push({field:`${t}.tasks`,code:Ye.recordAssignment,message:{de:`Feld ${n} (Zuordnung) braucht in 'tasks' mindestens eine Aufgabe, jede einmal.`,en:`Field ${r} (assignment) needs at least one task in 'tasks', each once.`}}),o;if(i.nodeTasks===void 0)return o;for(let d of l){let c=i.nodeTasks.get(d);c?.feedback!==!0&&o.push({field:`${t}.tasks`,code:Ye.recordAssignment,message:c===void 0?{de:`Feld ${n}: "${d}" ist keine Aufgabe dieses Knotens.`,en:`Field ${r}: "${d}" is no task of this node.`}:{de:`Feld ${n}: "${d}" ist keine Feedback-Aufgabe ('feedback: true') \u2014 zugeordnet wird nur, wer eine R\xFCckmeldung gibt.`,en:`Field ${r}: "${d}" is no feedback task ('feedback: true') \u2014 only a person who gives feedback is assigned.`}})}return o}s(U4,"typedFieldIssues");function G4(e,t,n){let r=[],i=t.options;if(e==="choice"){let o=Array.isArray(i)?i:[],a=o.map(l=>l.key);(o.length<2||a.some(l=>typeof l!="string"||l.length===0)||new Set(a).size!==a.length)&&r.push({field:"result.options",code:Ye.choiceOptions,message:{de:`Ein Auswahl-Ergebnis braucht mindestens 2 Optionen mit eindeutigen Schl\xFCsseln, erhalten ${JSON.stringify(a)}.`,en:`A choice result needs at least 2 options with unique keys, got ${JSON.stringify(a)}.`}})}else i!==void 0&&r.push({field:"result.options",code:Ye.choiceOptions,message:{de:`'result.options' gibt es nur bei 'choice' \u2014 ${e==="recommendation"?"eine Empfehlung hat die festen Tendenzen Positiv/Neutral/Negativ":"ein Freitext hat keine Auswahl"}.`,en:`'result.options' exists only for 'choice' \u2014 ${e==="recommendation"?"a recommendation has the fixed leanings Positive/Neutral/Negative":"a free text has no choice"}.`}});if(e==="pricedItem"){let o=t.item;if(!Li(o))r.push({field:"result.item",code:Ye.pricedItemMissingItem,message:{de:"Ein Preispositions-Ergebnis nennt den Artikel, den es bepreist \u2014 'result.item' (der Schl\xFCssel des Artikels, z. B. 'tuition') fehlt.",en:"A priced-item result names the article it prices \u2014 'result.item' (the article's key, e.g. 'tuition') is missing."}});else if(n.billingItemKeys!==void 0&&!n.billingItemKeys.has(o))r.push({field:"result.item",code:Ye.pricedItemUnknownItem,message:{de:`'result.item' "${o}" \u2014 kein Artikel dieses Mandanten tr\xE4gt diesen Schl\xFCssel (bekannt: ${[...n.billingItemKeys].join(", ")||"keine"}).`,en:`'result.item' "${o}" \u2014 no article of this school has this key (known: ${[...n.billingItemKeys].join(", ")||"none"}).`}});else if(n.offerProgram===null)r.push({field:"result.item",code:Ye.pricedItemOfferWithoutProgram,message:{de:`'result.item' "${o}" \u2014 das Angebot ist keinem Programm zugeordnet, also geh\xF6rt kein Artikel zu ihm; dem Angebot ein Programm geben.`,en:`'result.item' "${o}" \u2014 the offer is not assigned to a program, so no article belongs to it; give the offer a program.`}});else if(n.offerProgram!==void 0&&!n.offerProgram.billingItemKeys.has(o)){let l=n.offerProgram;r.push({field:"result.item",code:Ye.pricedItemNotInProgram,message:{de:`'result.item' "${o}" \u2014 der Artikel ist dem Programm \u201E${l.nameDe}\u201C des Angebots nicht zugeordnet (zugeordnet: ${[...l.billingItemKeys].join(", ")||"keine"}); unter Finanzen \u2192 Artikel zuordnen, direkt oder \xFCber ein Paket.`,en:`'result.item' "${o}" \u2014 the article is not assigned to the offer's program "${l.nameDe}" (assigned: ${[...l.billingItemKeys].join(", ")||"none"}); assign it under Finance \u2192 articles, directly or through a package.`}})}let a=t.label;(typeof a!="object"||a===null||!Li(a.de)||!Li(a.en))&&r.push({field:"result.label",code:Ye.labelMissing,message:{de:"Ein Preispositions-Ergebnis braucht einen Namen f\xFCr seinen Wert in beiden Sprachen ('result.label', z. B. { de: 'Schulgeld mit Erm\xE4\xDFigung', en: 'Tuition after reduction' }) \u2014 so hei\xDFt er im Workflow und in der Verdrahtung.",en:"A priced-item result needs a name for its value in both languages ('result.label', e.g. { de: 'Schulgeld mit Erm\xE4\xDFigung', en: 'Tuition after reduction' }) \u2014 that is what it is called in the workflow and in the wiring."}})}else t.item!==void 0&&r.push({field:"result.item",code:Ye.itemOnNonPricedItem,message:{de:`'result.item' gibt es nur bei 'pricedItem' \u2014 ein ${e}-Ergebnis bepreist keinen Artikel.`,en:`'result.item' exists only for 'pricedItem' \u2014 a ${e} result prices no article.`}});if(e==="record"?(r.push(...B4(t.fields,n)),t.writes!==void 0&&r.push({field:"result.writes",code:Ye.writesOnProse,message:{de:"Eine Erfassung schreibt je Feld ('fields[].writes'), nie als Ganzes ('result.writes').",en:"A record writes per field ('fields[].writes'), never as a whole ('result.writes')."}}),t.label!==void 0&&r.push({field:"result.label",code:Ye.unknownField,message:{de:"Eine Erfassung benennt ihre Werte je Feld ('fields[].label'), nicht als Ganzes ('result.label').",en:"A record names its values per field ('fields[].label'), not as a whole ('result.label')."}})):t.fields!==void 0&&r.push({field:"result.fields",code:Ye.fieldsOnNonRecord,message:{de:`'result.fields' gibt es nur bei 'record' \u2014 ein ${e}-Ergebnis hat keine Felder.`,en:`'result.fields' exists only for 'record' \u2014 a ${e} result has no fields.`}}),e==="reduction"&&(Li(t.writes)||r.push({field:"result.writes",code:Ye.reductionPrices,message:{de:"Eine Reduktion schreibt ihren Betrag in einen Vorgangs-Schl\xFCssel vom Typ reduction ('result.writes') \u2014 sonst l\xE4se ihn kein Preis.",en:"A reduction writes its amount to a process key of type reduction ('result.writes') \u2014 otherwise no price would read it."}})),t.writes!==void 0&&(e==="freetext"||e==="recommendation")&&r.push({field:"result.writes",code:Ye.writesOnProse,message:{de:`'result.writes' gibt es nur bei Ergebnissen mit Wert (Auswahl, Preisposition) \u2014 ein ${e}-Ergebnis bleibt im Chat und schreibt nichts in den Vorgang.`,en:`'result.writes' exists only for results with a value (choice, priced item) \u2014 a ${e} result stays in the chat and writes nothing to the process.`}}),e==="freetext"&&t.textRequired!==void 0&&r.push({field:"result.textRequired",code:Ye.textRequiredOnFreetext,message:{de:"'textRequired' auf einem Freitext-Ergebnis \u2014 der Text eines Freitexts ist immer Pflicht; die Angabe entfernen.",en:"'textRequired' on a free-text result \u2014 the text of a free text is always required; remove the entry."}}),t.chat===void 0)r.push({field:"result.chat",code:Ye.chatMissing,message:{de:"Ein Aufgaben-Ergebnis steht nur im Chat \u2014 'result.chat' fehlt: 'all', 'team:<Gruppe>' oder einen Kanal des Workflows angeben.",en:"A task result appears only in the chat \u2014 'result.chat' is missing: give 'all', 'team:<group>' or a channel of the workflow."}});else{let o=t.chat,a=typeof o=="string"?ga(o):null;o==="external"||a===null?r.push({field:"result.chat",code:Ye.chatExternal,message:{de:`'result.chat' ${JSON.stringify(o)} \u2014 ein Aufgaben-Ergebnis bleibt intern: erlaubt sind 'all', 'team:<Gruppe>' oder ein Kanal des Workflows, nie 'external'.`,en:`'result.chat' ${JSON.stringify(o)} \u2014 a task result stays internal: 'all', 'team:<group>' or a channel of the workflow are allowed, never 'external'.`}}):a.kind==="channel"&&!n.channelKeys.has(a.channelKey)&&r.push({field:"result.chat",code:Ye.chatUnknownChannel,message:{de:`'result.chat' "${a.channelKey}" ist weder 'all' noch 'team:<Gruppe>' noch ein Kanal des Workflows (bekannt: ${[...n.channelKeys].join(", ")||"keine"}).`,en:`'result.chat' "${a.channelKey}" is neither 'all' nor 'team:<group>' nor a channel of the workflow (known: ${[...n.channelKeys].join(", ")||"none"}).`}})}return r.push(...FF(t,["kind","options","textRequired","chat","item","label","writes","fields","prices"],{de:"Aufgaben-Ergebnis",en:"task result"})),r}s(G4,"recordedIssues");function LF(e,t,n={channelKeys:new Set}){if(t===void 0)return[];if(e!=="task")return[{field:"result",code:Ye.onApproval,message:{de:`'result' gilt nur f\xFCr die Art 'task' \u2014 eine '${e}' wird durch ihr Votum abgeschlossen, nicht durch ein Ergebnis.`,en:`'result' applies only to the kind 'task' \u2014 an '${e}' is completed by its vote, not by a result.`}}];if(typeof t!="object"||t===null||Array.isArray(t))return[{field:"result",code:Ye.unknownKind,message:{de:`'result' muss ein Objekt mit 'kind' sein; bekannte Arten: ${pa.join(", ")}.`,en:`'result' must be an object with 'kind'; known kinds: ${pa.join(", ")}.`}}];let r=t;return ON(r.kind)?r.kind==="appointment"?V4(r):G4(r.kind,r,n):[{field:"result.kind",code:Ye.unknownKind,message:{de:`Unbekannte Ergebnisart ${JSON.stringify(r.kind)}; bekannte Arten: ${pa.join(", ")}.`,en:`Unknown result kind ${JSON.stringify(r.kind)}; known kinds: ${pa.join(", ")}.`}}]}s(LF,"taskResultIssues");var z4="optionalAction:";function MF(e){return`${z4}${e}:trigger`}s(MF,"optionalActionTriggerActionId");var W4="processDecide";function qF(e){let t=e.optionalActions;return t==null?[]:(Array.isArray(t)||C(`[optionalAction/corrupt-section] node's 'optionalActions' is ${typeof t}, not an array \u2014 corrupt pinned graph (publish stores the section as authored)`),t)}s(qF,"optionalActionBindings");function KF(e){return qF(e).map(t=>({id:MF(t.key),kind:"internal",label:t.label,surface:W4,placement:"overflow",superUserOnly:!0}))}s(KF,"optionalActionTriggers");function jF(e){let t=e.tasks;return Array.isArray(t)?t:[]}s(jF,"authoredTemplates");function VF(e){let t=e?.result;return t?.kind!=="appointment"?[]:t.participants?.feedback?.tasks??[]}s(VF,"personTasksOf");function Tb(e){let t=jF(e);return qF(e).map(n=>{let r=new Set(n.tasks??[]),i=new Set;for(let o of r)for(let a of VF(t.find(l=>l.key===o)))i.add(a);return{binding:n,tasks:r,personTasks:i,keys:new Set([...r,...i])}})}s(Tb,"optionalActionMembership");function Y4(e){let t=new Set;for(let n of jF(e))for(let r of VF(n))t.add(r);return t}s(Y4,"personRowTemplateKeys");function BF(e){let t=new Set(Y4(e));for(let{keys:n}of Tb(e))for(let r of n)t.add(r);return t}s(BF,"referencedTaskTemplateKeys");var Cr={shape:"[taskInput/shape]",notInRound:"[taskInput/notInRound]",notRecord:"[taskInput/notRecord]",prefillNotDeclared:"[taskInput/prefillNotDeclared]",prefillType:"[taskInput/prefillType]",feedbackTasks:"[appointment/feedbackTasks]",feedbackOptional:"[appointment/feedbackOptional]",recordAssignment:"[taskResult/recordAssignment]"},Rb=60;function ja(e,t,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${t} ${n.de}`,en:`${t} ${n.en}`},severity:"error"}}s(ja,"error");function hs(e){return Array.isArray(e.tasks)?e.tasks:[]}s(hs,"tasksOf");function UF(e){return(Array.isArray(e.optionalActions)?e.optionalActions:[]).filter(n=>n.action==="spawnTasks")}s(UF,"spawnBindingsOf");function Nd(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}s(Nd,"stringList");function ci(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(ci,"record");function Eb(e){let t=ci(e?.result);return t?.kind==="appointment"?ci(t.participants):null}s(Eb,"participantsOf");function $b(e){return Nd(ci(Eb(e)?.feedback)?.tasks)}s($b,"feedbackTasksOf");function GF(e,t){return Tb(e).find(n=>n.keys.has(t))}s(GF,"roundOf");function H4(e,t,n){let r=s(u=>({code:Cr.notInRound,reason:u}),"notInRound"),i=GF(e,t);if(i===void 0)return r({de:`Aufgabe "${t}" geh\xF6rt zu keiner optionalen Aktion \u2014 Vorgaben liest nur eine Aufgabe einer Runde.`,en:`Task "${t}" belongs to no optional action \u2014 only a task of a round reads inputs.`});if(n.scope!=="task"||n.path!==void 0)return r({de:`${ce(n)} ist kein Wert einer Aufgabe ($task.<aufgabe>.<schl\xFCssel>).`,en:`${ce(n)} is no value of a task ($task.<task>.<key>).`});let{binding:o}=i,a=n.owner;if(a===t)return r({de:`Aufgabe "${t}" liest ihren eigenen Wert.`,en:`Task "${t}" reads its own value.`});let l=hs(e).find(u=>u.key===a),d=ci(l?.blocks),c=i.tasks.has(a)&&d?.templateKey===t&&(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 "${t}" 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 "${t}" through 'blocks' \u2014 the value would not be settled when the task opens.`}):ci(l?.result)?.kind!=="record"?{code:Cr.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(H4,"taskInputRefusal");function J4(e,t){if(t.scope!=="task")return;let n=hs(e).find(i=>i.key===t.owner),r=ci(n?.result);if(r?.kind==="record")return(Array.isArray(r.fields)?r.fields:[]).map(ci).find(i=>i?.writes===t.key)??void 0}s(J4,"writerField");function Q4(e,t,n){let r=String(t.key);if(t.inputs===void 0)return[];if(!Array.isArray(t.inputs))return[ja(`${n}.inputs`,Cr.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 t.inputs.entries()){if(!ke(l))continue;let d=ce(l);if(o.has(d)){i.push(ja(`${n}.inputs.${a}`,Cr.shape,{de:`${d} steht zweimal in 'inputs'.`,en:`${d} is listed twice in 'inputs'.`}));continue}o.add(d);let c=H4(e,r,l);c!==null&&i.push(ja(`${n}.inputs.${a}`,c.code,c.reason))}return i}s(Q4,"inputIssues");function Z4(e,t,n,r){let i=n;if(AC(r))return $b(i).length===1?null:{code:Cr.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(ce):[];if(!ke(r)||!o.includes(ce(r)))return{code:Cr.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:Cr.prefillType,reason:c}),"prefillType"),l=$b(i),d=fd(e,r);if(d===void 0)return null;if(hn(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=Nd(J4(t,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(Z4,"participantPrefillRefusal");function X4(e,t,n,r){let i=Eb(n)?.prefill;if(i===void 0)return[];let o=Z4(e,t,n,i);return o===null?[]:[ja(`${r}.result.participants.prefill`,o.code,o.reason)]}s(X4,"prefillIssues");function e3(e,t){return UF(e).some(n=>Nd(n.tasks).includes(t))}s(e3,"belongsToOptionalAction");function t3(e,t,n){let r=t.key,i=hs(e).find(c=>c.key===n),o=s(c=>({code:Cr.feedbackTasks,reason:c}),"feedbackTasks");if(i===void 0)return[o({de:`"${n}" ist keine Aufgabe dieses Knotens.`,en:`"${n}" is no task of this node.`})];let a=[];i.feedback!==!0&&a.push(o({de:`"${n}" ist keine Feedback-Aufgabe ('feedback: true').`,en:`"${n}" is no feedback task ('feedback: true').`})),UF(e).some(c=>Nd(c.tasks).includes(n))&&a.push(o({de:`"${n}" steht in den Aufgaben einer optionalen Aktion \u2014 eine Personenzeile entsteht nur beim Buchen.`,en:`"${n}" is among an optional action's tasks \u2014 a person row exists only through a booking.`}));let l=hs(e).find(c=>c.key!==r&&$b(c).includes(n));l!==void 0&&a.push(o({de:`"${n}" wird auch von "${String(l.key)}" angelegt \u2014 jede Feedback-Art geh\xF6rt zu genau einem Termin.`,en:`"${n}" 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:`"${n}" tr\xE4gt ${d.map(c=>`'${c}'`).join(", ")} \u2014 eine Personenzeile entsteht nur beim Buchen und h\xE4lt nur ihre Runde.`,en:`"${n}" 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:Cr.feedbackOptional,reason:{de:`"${n}" ist optional \u2014 eine Personenzeile h\xE4lt ihre Runde und damit die Pause, sie kann nicht \xFCbersprungen werden.`,en:`"${n}" is optional \u2014 a person row holds its round and with it the pause; it cannot be skipped.`}}),a}s(t3,"participantFeedbackRefusals");function n3(e,t,n){let r=Eb(t);if(r===null||r.feedback===void 0)return[];let i=String(t.key),o=`${n}.result.participants.feedback`,a=ci(r.feedback),l=a?.tasks,d=[],c=s((p,h,y=Cr.feedbackTasks)=>d.push(ja(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>Rb)&&c(`${o}.dueDaysAfterEnd`,{de:`'feedback.dueDaysAfterEnd' ist eine ganze Zahl von 0 bis ${Rb}.`,en:`'feedback.dueDaysAfterEnd' is a whole number from 0 to ${Rb}.`}),e3(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,t,p))c(`${o}.tasks`,h.reason,h.code);return d}s(n3,"feedbackIssues");function r3(e,t){let n=GF(e,t)?.personTasks??new Set;return hs(e).filter(r=>r.feedback===!0&&typeof r.key=="string"&&n.has(r.key)).map(r=>r.key)}s(r3,"assignableFeedbackTasks");function i3(e,t,n){let r=ci(t.result);if(r?.kind!=="record"||!Array.isArray(r.fields))return[];let i=r3(e,String(t.key)),o=new Map(hs(e).map(l=>[l.key,l])),a=[];for(let[l,d]of r.fields.entries()){let c=ci(d);if(c?.type!=="assignment")continue;let u=Nd(c.tasks).filter(p=>o.get(p)?.feedback===!0&&!i.includes(p));u.length!==0&&a.push(ja(`${n}.result.fields.${l}.tasks`,Cr.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(i3,"assignmentIssues");function zF(e,t){let n=[];for(let r of hs(t)){if(typeof r.key!="string")continue;let i=`nodes.${t.id}.tasks.${r.key}`;n.push(...Q4(t,r,i)),n.push(...X4(e,t,r,i)),n.push(...n3(t,r,i)),n.push(...i3(t,r,i))}return n}s(zF,"taskInputIssues");function ui(e){return e.nodes.map(t=>t)}s(ui,"rawNodesOf");var Fn={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 Ln(e,t,n){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:{de:`${t} ${n.de}`,en:`${t} ${n.en}`},severity:"error"}}s(Ln,"issue");function o3(e,t,n){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===n&&a===t}).map(i=>({nodeId:r.id,key:String(i.key)})))}s(o3,"blockersOf");function WF(e){let{graph:t,node:n,task:r}=e,i=r.familyRequest;if(i===void 0)return[];let o=typeof r.key=="string"?r.key:"?",a=`nodes.${n.id}.tasks.${o}`,l={de:`Task "${o}" auf Knoten \u201E${Pe(t,n.id,"de")}\u201C (${n.id})`,en:`Task "${o}" on node "${Pe(t,n.id,"en")}" (${n.id})`},d=[];if(typeof i!="object"||i===null||Array.isArray(i))return[Ln(`${a}.familyRequest`,Fn.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(Ln(`${a}.familyRequest.${c[0]}`,Fn.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(Ln(`${a}.familyRequest`,Fn.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(Ln(`${a}.familyRequest`,Fn.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(Ln(`${a}.kind`,Fn.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(Ln(`${a}.${b}`,Fn.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(Ln(`${a}.blocks`,Fn.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 o3(ui(t),n.id,o))d.push(Ln(`nodes.${b.nodeId}.tasks.${b.key}.blocks`,Fn.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(Ln(`${a}.params.dueInDays`,Fn.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(Ln(`${a}.familyRequest.fields`,Fn.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=ce(b);if(y.has(k)){d.push(Ln(`${a}.familyRequest.fields`,Fn.fields,{de:`${l.de}: 'familyRequest.fields' nennt ${Ue(t,b,"de")} mehrfach.`,en:`${l.en}: 'familyRequest.fields' names ${Ue(t,b,"en")} more than once.`}));continue}y.add(k),gt(b)||d.push(Ln(`${a}.familyRequest.fields`,Fn.unknownField,{de:`${l.de}: 'familyRequest.fields' nennt ${Ue(t,b,"de")} \u2014 anfordern l\xE4sst sich nur ein Feld eines Formulars ($node.<formular>.admission.<feld>).`,en:`${l.en}: 'familyRequest.fields' names ${Ue(t,b,"en")} \u2014 only a field of a form ($node.<form>.admission.<field>) can be requested.`}))}return d}s(WF,"familyRequestIssues");function YF(e){let t=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"&&t.has(a));return o.length<=1?[]:[Ln(`nodes.${e.id}.optionalActions.${i}.tasks`,Fn.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(YF,"familyRequestActionIssues");function HF(e,t){let n=ui(e),r=new Map;for(let a of n)if(!(a.type!=="completenessCheck"||!Array.isArray(a.requires)))for(let l of a.requires)gt(l)&&r.set(ce(l),l);if(r.size===0)return[];let i=s(a=>{let l=li(t,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(gt):!ke(d)||d.scope!=="node"?[]:[...r.values()].filter(c=>c.owner===d.owner&&i(c))},"offeredBy");return n.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(ce(k)));return b.length===0?[]:[{...Ln(`nodes.${a.id}.requiresOneOf`,Fn.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(HF,"familyRequestDeadlockWarnings");var Ib={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},Ob={appointment:s((e,t)=>({de:`Aufgabe "${e}" an ${t.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 ${t.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 s3(e){let t=Ze(e);return new Map((typeof t.workItemTemplates=="function"?t.workItemTemplates(e):[]).map(n=>[n.key,n]))}s(s3,"intrinsicTemplatesOf");function QF(e,t,n){if(n!==void 0&&typeof n!="string")return null;let r=n??t,i=e.nodes.find(l=>l.id===r);if(i===void 0)return null;let o=i,a=Ze(i);return{node:o,composedKeys:new Set((Array.isArray(o.tasks)?o.tasks:[]).map(l=>l.key).filter(l=>typeof l=="string")),intrinsicByKey:s3(i),refuse:s(l=>typeof a.refuseBlocksTarget=="function"?a.refuseBlocksTarget(i,l):null,"refuse")}}s(QF,"resolveBlocksTargetNode");function a3(e){let t=new Map;for(let r of Cn(e.nodes)){let i=t.get(r.source)??[];i.push(r.target),t.set(r.source,i)}let n=new Map;return r=>{let i=n.get(r);if(i!==void 0)return i;let o=new Set,a=[...t.get(r)??[]];for(;a.length>0;){let l=a.shift();o.has(l)||(o.add(l),a.push(...t.get(l)??[]))}return n.set(r,o),o}}s(a3,"reachability");function ZF(e){let t=[],n=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;n.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("::");t.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=n.get(o);l!==void 0&&n.has(l)&&i(l,[...a,o]),r.set(o,"done")},"walk");for(let o of n.keys())i(o,[]);return t}s(ZF,"checkBlocksCycles");function l3(e){let{requiresOneOf:t,optionalActions:n}=e;if(!Array.isArray(t)||!Array.isArray(n))return new Set;let r=new Set(t.filter(o=>typeof o=="string")),i=new Set;for(let o of n)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(l3,"tasksOfRequiresOneOf");function XF(e){if(typeof e!="object"||e===null)return!1;let{de:t,en:n}=e;return typeof t=="string"&&t.trim().length>0&&typeof n=="string"&&n.trim().length>0}s(XF,"isFilledBilingual");var d3=["blocks","gatesNode","locksEvidence","completableIf"];function c3(e,t){let n={de:`Task "${t.key}" (Knoten "${t.nodeId}")`,en:`Task "${t.key}" (node "${t.nodeId}")`},r=[];e.feedback!==!0&&r.push(Pt(`${t.base}.feedback`,{de:`[workItems/feedbackNotTrue] ${n.de}: 'feedback' kennt nur true; erhalten ${JSON.stringify(e.feedback)}.`,en:`[workItems/feedbackNotTrue] ${n.en}: 'feedback' only knows true; got ${JSON.stringify(e.feedback)}.`}));let i=e.result;if(e.kind!=="task"||typeof i?.kind!="string"||!mk({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(Pt(`${t.base}.feedback`,{de:`[workItems/feedbackNeedsProse] ${n.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] ${n.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(Pt(`${t.base}.feedback`,{de:`[workItems/feedbackSteersProcess] ${n.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] ${n.en} is a feedback task; its answer comes from a page without application data, so it may not depend on ${o.join(", ")}.`})),r}s(c3,"feedbackTaskIssues");function u3(e,t){let n=[],r={de:`Task "${t.key}" (Knoten "${t.nodeId}")`,en:`Task "${t.key}" (node "${t.nodeId}")`},i=e.optional;(!(typeof i=="object"&&i!==null&&Object.keys(i).every(d=>d==="skipLabel"))||!XF(i.skipLabel))&&n.push(Pt(`${t.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"&&n.push(Pt(`${t.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"||!mk({kind:a.kind,writes:a.writes}))&&n.push(Pt(`${t.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=d3.filter(d=>e[d]!==void 0);return l.length>0&&n.push(Pt(`${t.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.`})),t.requiredByRule&&n.push(Pt(`${t.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.`})),n}s(u3,"optionalTaskIssues");function Pt(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(Pt,"issue");function eL(e,t){let n=[],r=a3(e),i=new Set(qa(e).map(o=>o.key));n.push(...HF(e,t));for(let o of e.nodes){let a=o,l=BF(o);n.push(...YF(o));let d=l3(a);n.push(...zF(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 F=typeof k.node=="string"?k.node:o.id,$=ui(e).find(ae=>ae.id===F),G=(Array.isArray($?.tasks)?$.tasks:[]).find(ae=>ae.key===k.templateKey)?.blocks;typeof G?.node=="string"&&G.node!==F&&n.push(Pt(`${h}.blocks.templateKey`,{de:`[workItems/blocksCrossNodeTask] Task "${p}" auf Knoten "${o.id}" h\xE4lt "${k.templateKey}" auf Knoten "${F}" 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 "${F}" \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 F=v;e.nodes.some($=>$.id===F)&&!r(o.id).has(F)&&n.push(Pt(`${h}.blocks.node`,{de:`[workItems/blocksTargetNotAfter] Task "${p}" auf Knoten "${o.id}" blockiert Knoten "${F}", 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 "${F}", 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||!ma(b.kind))&&n.push(Pt(`${h}.blocks.node`,{de:`[workItems/crossNodeBlocksNeedsResult] Task "${p}" auf Knoten "${o.id}" blockiert einen anderen Knoten ("${F}"), 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 ("${F}") 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)&&n.push(Pt(`${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 F of LF(String(y),b,{channelKeys:i,nodeTasks:c,...t?.billingItemKeys!==void 0?{billingItemKeys:t.billingItemKeys}:{},...t?.offerProgram!==void 0?{offerProgram:t.offerProgram}:{}}))n.push(Pt(`${h}.${F.field}`,{de:`${F.code} ${F.message.de} (Task "${p}" auf Knoten "${o.id}").`,en:`${F.code} ${F.message.en} (task "${p}" on node "${o.id}").`}));let A=u.when,T=s((F,$,q)=>{!ke($)||gt($)||n.push(Pt(F,{de:`[workItems/evidenceNotFormField] ${q} auf Task "${p}" (Knoten "${o.id}") nennt ${Ue(e,$,"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,$,"en")} \u2014 the condition and evidence of a task are fields of a form ($node.<form>.admission.<field>).`}))},"notFormField");A!==void 0?(T(`${h}.when`,A,"'when'"),u.onConditionReturn!=="respawn"&&u.onConditionReturn!=="stayClosed"&&n.push(Pt(`${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&&n.push(Pt(`${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))n.push(Pt(`${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[F,$]of I.entries())T(`${h}.reads.${F}`,$,"'reads'");let D=u.locksEvidence,L=s((F,$)=>n.push(Pt(`${h}.locksEvidence`,{de:`[workItems/${F}] Task "${p}" (Knoten "${o.id}") ${$.de}`,en:`[workItems/${F}] Task "${p}" (node "${o.id}") ${$.en}`})),"lockIssue");D!==void 0&&D!==!0&&L("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&&A===void 0&&L("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||!ma(b.kind))&&L("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)&&L("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."})),n.push(...WF({graph:e,node:a,task:u,onTrigger:l,specCtx:t}));let N=Object.keys(u).filter(F=>!Object.hasOwn(Ib,F)&&!Object.hasOwn(Ob,F));N.length>0&&n.push(Pt(`${h}.${N[0]}`,{de:`[workItems/unknownKey] Task "${p}" (Knoten "${o.id}") tr\xE4gt ${N.map(F=>`'${F}'`).join(", ")} \u2014 kein Feld einer Aufgabe. Erlaubt: ${Object.keys(Ib).join(", ")}. (Checklisten gibt es nicht mehr: Text als 'description', mehrere Arbeitsschritte sind mehrere Aufgaben.)`,en:`[workItems/unknownKey] Task "${p}" (node "${o.id}") carries ${N.map(F=>`'${F}'`).join(", ")} \u2014 not a field of a task. Allowed: ${Object.keys(Ib).join(", ")}. (Checklists no longer exist: text goes in 'description', several work steps are several tasks.)`}));let x=u.description;x!==void 0&&!XF(x)&&n.push(Pt(`${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&&n.push(...c3(u,{key:p,nodeId:o.id,base:h})),u.optional!==void 0&&n.push(...u3(u,{key:p,nodeId:o.id,base:h,requiredByRule:d.has(p)}))}}return n}s(eL,"checkNodeTasks");function tL(e){let t=e.indexOf(":"),n=t===-1?"":e.slice(0,t),r=t===-1?"":e.slice(t+1).trim();if(n==="artifact"&&r.length>0)return{kind:n,key:r};let i=Si(r);return n==="field"&&i!==null?{kind:n,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(tL,"parseTaskDocumentRef");function _b(e){return e.kind==="artifact"?`artifact:${e.key}`:`field:${ce(e.address)}`}s(_b,"taskDocumentId");function Mi(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(Mi,"issue");function nL(e){return Array.isArray(e.tasks)?e.tasks:[]}s(nL,"tasksOf");function Pd(e){let t=new Map;for(let n of e){let{id:r,artifacts:i}=n;for(let o of Array.isArray(i)?i:[])typeof o?.key=="string"&&t.set(o.key,[...t.get(o.key)??[],{nodeId:r,slot:o}])}return t}s(Pd,"artifactSlotDeclarations");function f3(e){return e.flatMap(t=>{let{id:n,artifacts:r}=t;return(Array.isArray(r)?r:[]).filter(i=>!gm(i?.type)).map(i=>({nodeId:String(n),slotKey:String(i?.key),type:JSON.stringify(i?.type??null)}))})}s(f3,"unknownArtifactSlotTypes");function rL(e){let t=[];for(let{nodeId:n,slotKey:r,type:i}of f3(e.nodes))t.push(Mi(`nodes.${n}.artifacts.${r}.type`,{de:`[artifact/unknownType] Knoten "${n}" deklariert den Dokument-Slot \u201E${r}" mit der Art ${i} \u2014 erlaubt sind ${Oa.join(", ")}.`,en:`[artifact/unknownType] Node "${n}" declares the document slot "${r}" with the type ${i} \u2014 allowed are ${Oa.join(", ")}.`}));for(let[n,r]of Pd(e.nodes))for(let i of r.slice(1))t.push(Mi(`nodes.${i.nodeId}.artifacts`,{de:`[governedDocument/slotKeyTaken] Knoten "${i.nodeId}" deklariert den Dokument-Slot \u201E${n}", 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 "${n}", which "${r[0].nodeId}" already declares \u2014 every slot key belongs to exactly one node.`}));return t}s(rL,"checkArtifactSlotKeys");function p3(e,t,n,r=Pd(e.nodes)){let i=r.get(t)?.[0]?.nodeId;return i===void 0?{reason:"unknown"}:Aa(e,i,n)?null:{reason:"notBefore",owner:i}}s(p3,"slotLinkRefusal");function iL(e){if(!Array.isArray(e)||e.length===0)return null;let t=[];for(let n of e){let r=typeof n=="object"&&n!==null?n:{},i=Object.keys(r).sort().join(",");if(r.kind==="artifact"&&i==="key,kind"&&typeof r.key=="string"&&r.key.length>0)t.push({kind:"artifact",key:r.key});else if(r.kind==="field"&&i==="address,kind")t.push({kind:"field",address:r.address});else return null}return t}s(iL,"authoredRefs");function oL(e){let t=[],n=Pd(e.nodes);for(let r of ui(e))for(let i of nL(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=iL(i.documents);if(d===null){t.push(Mi(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"?_b(u):_b({kind:"field",address:u.address});if(c.has(p)&&t.push(Mi(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=p3(e,u.key,r.id,n);h?.reason==="unknown"?t.push(Mi(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"&&t.push(Mi(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"&&!gt(u.address)&&t.push(Mi(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 t}s(oL,"checkTaskDocuments");function sL(e,t){let n=[];for(let r of ui(e))for(let i of nL(r)){let o=iL(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"||!gt(d.address))continue;let c=li(t,d.address);if(c==null)continue;let u={de:Ue(e,d.address,"de"),en:Ue(e,d.address,"en")},p=Ra("taskDocument",Ta(c));if(p==="repeated"){n.push(Mi(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"&&n.push(Mi(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 n}s(sL,"checkTaskDocumentFields");var Pb=["form","artifact","field"],Ba=["coverLetter","contract"],lL="form",aL=/^[A-Za-z0-9_.-]+$/;function m3(e){return Ba.includes(e)}s(m3,"isArtifactPart");function Va(e){return de("INVALID",{de:`Ansichts-Adresse "${e}" ist ung\xFCltig \u2014 erwartet form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Ba.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`View address "${e}" is invalid \u2014 expected form:<form node>#<view>, artifact:<slot>[#${Ba.join("|")}] or field:$node.<form>.admission.<field>.`})}s(Va,"invalid");function Cb(e){let t=e.indexOf(":");if(t===-1)return Va(e);let n=e.slice(0,t),r=e.slice(t+1);if(n==="field"){let l=Si(r);return l===null?Va(e):{kind:n,address:l}}let i=r.indexOf("#"),o=i===-1?r:r.slice(0,i),a=i===-1?null:r.slice(i+1);return aL.test(o)?n==="form"?a!==null&&aL.test(a)?{kind:n,form:o,view:a}:Va(e):n==="artifact"?a===null?{kind:n,slot:o}:m3(a)?{kind:n,slot:o,part:a}:Va(e):Va(e):Va(e)}s(Cb,"parseViewAddress");function dL(e){let t=g3(e);if(t===null)return null;let n=h3(t);return n!==null&&JSON.stringify(Nb(n))===JSON.stringify(Nb(e))?n:null}s(dL,"viewAddressOf");function h3(e){try{return Cb(e)}catch{return null}}s(h3,"tryParseViewAddress");function g3(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e;if(t.kind==="form"&&typeof t.form=="string"&&typeof t.view=="string")return`form:${t.form}#${t.view}`;if(t.kind==="artifact"&&typeof t.slot=="string")return t.part===void 0?`artifact:${t.slot}`:typeof t.part=="string"?`artifact:${t.slot}#${t.part}`:null;if(t.kind==="field"&&t.address!==null&&typeof t.address=="object"){let n=t.address;return typeof n.scope!="string"||typeof n.key!="string"?null:`field:${ce(n)}`}return null}s(g3,"spellingOf");function Nb(e){return e===null||typeof e!="object"||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).sort(([t],[n])=>t<n?-1:t>n?1:0).map(([t,n])=>[t,Nb(n)]))}s(Nb,"canonical");function cL(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:${ce(e.address)}`}}s(cL,"formatViewAddress");var Db=["form","documents"],y3=/^[a-z][a-zA-Z0-9_-]*$/;function w3(e){let t=new Map,n=s(r=>{for(let i of[...r.fields,...(r.groups??[]).flatMap(o=>o.fields)])t.set(i.key,i.type==="docRef"?"document":"other");for(let i of r.repeated??[]){t.set(i.key,"other");for(let o of i.itemTemplate)t.set(`${i.key}[].${o.key}`,o.type==="docRef"?"row":"other")}r.subsections?.forEach(n)},"visit");return e.sections.forEach(n),t}s(w3,"fieldPlaces");function uL(e,t,n){let r=[],i=new Set;return e.forEach((o,a)=>{if(typeof o!="string"||!y3.test(o)){r.push({severity:"error",path:`${n(a)}.key`,code:"view.invalid-key",message:{de:`${t.de}: '${String(o)}' ist kein g\xFCltiger Schl\xFCssel (Kleinbuchstabe am Anfang, dann Buchstaben, Ziffern, - oder _).`,en:`${t.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:`${n(a)}.key`,code:"view.duplicate-key",message:{de:`${t.de}: Der Schl\xFCssel '${o}' kommt doppelt vor.`,en:`${t.en}: the key '${o}' occurs twice.`}}),i.add(o)}),r}s(uL,"keyIssues");function k3(e,t,n){return e==="document"?null:e===void 0?{severity:"error",path:n,code:"view.unknown-field",message:{de:`Ansicht: Das Formular hat kein Feld '${t}'.`,en:`View: the form has no field '${t}'.`}}:e==="row"?{severity:"error",path:n,code:"view.field-in-row",message:{de:`Ansicht: Das Dateifeld '${t}' liegt in einem wiederholten Block und kann nicht einzeln genannt werden.`,en:`View: the file field '${t}' sits in a repeated block and cannot be named on its own.`}}:{severity:"error",path:n,code:"view.not-a-document",message:{de:`Ansicht: Das Feld '${t}' enth\xE4lt keine Datei.`,en:`View: the field '${t}' holds no file.`}}}s(k3,"fieldIssue");function b3(e,t,n){let r=[];Db.includes(e.key)&&r.push({severity:"error",path:`${t}.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:`${t}.groups`,code:"view.empty",message:{de:`Ansicht '${e.key}' hat keine Gruppen.`,en:`View '${e.key}' has no groups.`}}),r.push(...uL(i.map(a=>a.key),{de:`Gruppe der Ansicht '${e.key}'`,en:`Group of view '${e.key}'`},a=>`${t}.groups[${a}]`));let o=new Set;return i.forEach((a,l)=>{let d=`${t}.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=k3(n.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(b3,"viewIssues");function v3(e){if(!Array.isArray(e))return"views";for(let[t,n]of e.entries()){let r=n?.groups;if(!Array.isArray(r))return`views[${t}].groups`;for(let[i,o]of r.entries()){let a=o?.fields;if(!Array.isArray(a)||a.some(l=>typeof l!="string"))return`views[${t}].groups[${i}].fields`}}return null}s(v3,"malformedAt");function fL(e){let t=e.views;if(t===void 0)return[];let n=v3(t);if(n!==null)return[{severity:"error",path:n,code:"view.malformed",message:{de:`${n} 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:`${n} 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=w3(e);return[...uL(t.map(i=>i.key),{de:"Ansicht",en:"View"},i=>`views[${i}]`),...t.flatMap((i,o)=>b3(i,`views[${o}]`,r))]}s(fL,"formViewIssues");function Ua(e,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:"error"}}s(Ua,"issue");function pL(e,t,n,r,i){let o=dL(e);if(o===null)return[Ua(t,{de:`[view/invalid] 'view' auf ${n.de} ist keine Ansichts-Adresse \u2014 erwartet { kind: ${Pb.join(" | ")}, \u2026 }: form:<Formularknoten>#<Ansicht>, artifact:<Slot>[#${Ba.join("|")}] oder field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] 'view' on ${n.en} is no view address \u2014 expected { kind: ${Pb.join(" | ")}, \u2026 }: form:<form node>#<view>, artifact:<slot>[#${Ba.join("|")}] or field:$node.<form>.admission.<field>.`})];let a=cL(o);switch(o.kind){case"artifact":return r.has(o.slot)?[]:[Ua(t,{de:`[view/unknownSlot] ${n.de} nennt "${a}", aber kein Knoten dieses Graphen hat den Dokument-Slot "${o.slot}".`,en:`[view/unknownSlot] ${n.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[Ua(t,{de:`[view/invalid] ${n.de} nennt "${a}" \u2014 ein Dateifeld liegt in einem Formular: field:$node.<Formular>.admission.<Feld>.`,en:`[view/invalid] ${n.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?[Ua(t,{de:`[view/unknownForm] ${n.de} nennt "${a}", aber kein Formularknoten hei\xDFt so.`,en:`[view/unknownForm] ${n.en} names "${a}", but no form node has that id.`})]:o.kind==="field"?[]:c.has(o.view)||Db.includes(o.view)?[]:[Ua(t,{de:`[view/unknownView] ${n.de} nennt "${a}", aber das Formular "${o.form}" hat keine Ansicht "${o.view}".`,en:`[view/unknownView] ${n.en} names "${a}", but the form "${o.form}" has no view "${o.view}".`})]}}}s(pL,"viewIssues");function mL(e,t){let n=[],r=new Set(Pd(e.nodes).keys());for(let i of ui(e)){if(i.view!==void 0){let o={de:`Knoten "${i.id}"`,en:`node "${i.id}"`};i.type!=="decision"?n.push(Ua(`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.`})):n.push(...pL(i.view,`nodes.${i.id}.view`,o,r,t))}for(let o of Array.isArray(i.tasks)?i.tasks:[]){if(o.view===void 0)continue;let a=String(o.key);n.push(...pL(o.view,`nodes.${i.id}.tasks.${a}.view`,{de:`Task "${a}" (Knoten "${i.id}")`,en:`Task "${a}" (node "${i.id}")`},r,t))}}return n}s(mL,"checkTaskViews");var Hn="traeger",hL={de:"Tr\xE4ger",en:"Provider"};function Ga(e){let t=e.inputs?.[Hn];return t?.kind==="literal"&&typeof t.value=="string"&&t.value.length>0?t.value:null}s(Ga,"traegerKeyOfNode");var Pm={name:"input.traeger.name",address:"input.traeger.anschrift"},Qxe=Object.values(Pm);var gL="governedDocument",gs="prepareDocument",Cd="prepareDocument:revision",Dr="releaseApproval",ys="documentResponse",To="coverLetterResponse",Cm="confirmCoverLetter",Dm="requestCoverLetterRevision",za="coverLetterConfirmation",fi="responseCheck",Fm="returnSigned";var yL="requestApproval";var wL="issueDocument",kL="correctInPlace",bL="rescindAndReissue",Lm="requestChange";var Wa="releaseArtifact",gn="signingRecovery",Mm="resendESignature",ws="switchToPaper";var Dd=new Set([gs,Cd]),vL=["pending","producing","producingHeld","deferred","awaitingApproval","awaitingCoverLetter","awaitingResponse","responseReturned","responseInCheck","awaitingSignature","signatureStalled","done"],qm=["upload","resolver","template","none"],ks=1,bs=366,qi="responseDueInDays";function vs(e){let t=e.inputs?.[za];return t?.kind==="literal"&&t.value===!0}s(vs,"coverLetterConfirmationOf");function Fd(e){let t=e.inputs?.[qi];return t?.kind==="literal"&&Ld(t.value)?t.value:void 0}s(Fd,"responseDueInDaysForVocabulary");function Ld(e){return typeof e=="number"&&Number.isInteger(e)&&e>=ks&&e<=bs}s(Ld,"isValidResponseDueInDays");var Km=["generatedAt","responseDueInDays","countersignature"],xs=["release","none"],jm=["confirm","signedUpload","signedUploadChecked","eSignature"];var x3={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"}}},xL={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"}}},SL={...xL,kind:"signedUploadChecked",acceptEvent:"contractEvent",checksReturn:!0},S3={...SL,kind:"eSignature",issuesBy:"provider"},Ki={confirm:x3,signedUpload:xL,signedUploadChecked:SL,eSignature:S3};function ji(e){let t=e.responseStrategy;if(typeof t=="string"&&t in Ki)return Ki[t];C(`governedDocument node "${e.id}" declares no valid responseStrategy (got ${JSON.stringify(t)}) \u2014 publish validation should have blocked this; corrupt pinned graph`)}s(ji,"responseStrategyOf");function Vm(e){if(e.type!==gL||e.production!=="resolver")return!1;let t=e.responseStrategy;return typeof t=="string"&&t in Ki?Ki[t].acceptEvent==="contractEvent":!1}s(Vm,"isFamilySignedContractNode");function Ha(e){return e.label}s(Ha,"governedDocTitle");function Fb(e){return e.approval==="release"?yL:wL}s(Fb,"submitActionId");function AL(e,t,n){return{key:t,recipient:"internal",title:n,unlocks:[Fb(e)],gatesNode:!0,advancesNode:!0}}s(AL,"producerTemplate");function A3(e){return e.titles?.respond??e.label}s(A3,"responseTitle");var Ya={de:"\u27E8Titel fehlt\u27E9",en:"\u27E8title missing\u27E9"};function Bm(e){let t=ji(e),n=[];if(e.production!=="none"&&n.push(AL(e,gs,e.titles?.prepare??Ya),AL(e,Cd,e.titles?.revise??Ya)),e.approval==="release"&&n.push({key:Dr,recipient:"internal",title:e.titles?.approve??Ya,unlocks:[],verdictResolved:!0,gatesNode:!0,advancesNode:!0}),n.push({key:ys,recipient:"external",title:A3(e),unlocks:t.producesResponseArtifact?[t.checksReturn?Fm:t.acceptOutcomeId,t.declineOutcomeId,Lm]:[t.acceptOutcomeId,t.declineOutcomeId],advancesNode:!0,...Fd(e)!==void 0?{dueInDays:Fd(e)}:{}}),vs(e)){let r=Ha(e);n.push({key:To,recipient:"external",title:{de:`${r.de}: Angebot best\xE4tigen`,en:`${r.en}: confirm offer`},unlocks:[Cm,Dm,t.declineOutcomeId],advancesNode:!0,...Fd(e)!==void 0?{dueInDays:Fd(e)}:{}})}if(t.checksReturn&&n.push({key:fi,recipient:"internal",title:e.titles?.check??Ya,unlocks:[],verdictResolved:!0,gatesNode:!1,advancesNode:!0}),t.issuesBy==="provider"){let r=Ha(e);n.push({key:gn,recipient:"internal",title:{de:`${r.de}: elektronische Unterschrift kl\xE4ren`,en:`${r.en}: resolve the e-signature`},unlocks:[Mm,ws],gatesNode:!1,advancesNode:!1})}return n}s(Bm,"governedDocIntrinsicTemplates");function T3(e){e.production==="none"&&C(`governedDocSlot: node "${e.id}" has production 'none' \u2014 it governs no artifact slot`);let t=e.artifacts??[];t.length!==1&&C(`governedDocSlot: node "${e.id}" declares ${t.length} artifact slots \u2014 exactly ONE is required (publish validation [governedDocument/slotContract])`);let n=t[0];return(typeof n.key!="string"||n.key.length===0)&&C(`governedDocSlot: node "${e.id}" declares an artifact slot without a key \u2014 corrupt pinned graph`),n}s(T3,"governedDocSlot");function Um(e){return T3(e).key}s(Um,"governedDocSlotKey");var yr="processFooter";var Md="countersign",Lb="countersign",TL="countersigned",Mb="countersigning",RL="countersigned";var $L={de:"Vertrag gegenzeichnen",en:"Countersign the contract"},qd=["scan","eSignature"],Gm="service_provider:1",EL=["countersigning","awaitingSignature","signatureStalled","done"],IL={de:"Elektronische Gegenzeichnung kl\xE4ren",en:"Resolve the electronic countersignature"};function OL(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(OL,"traegerSignatoryMissingReason");function wr(e,t,n){return{layer:"GRAPH",kind:"nodeRule",path:`nodes.${e.id}.${t}`,reason:n,severity:"error"}}s(wr,"issue");function zm(e,t){return e.nodes.filter(n=>{let r=n.contract;return n.type==="countersign"&&ke(r)&&r.scope==="node"&&r.owner===t})}s(zm,"countersignersOf");function Kd(e){return e.signing==="eSignature"}s(Kd,"isElectronic");function R3(e,t){if(t===void 0||t.sendable||!Kd(e))return[];let n=e.label?.de??e.id,r=e.label?.en||e.id;return[wr(e,"signing",{de:`[countersign/eSignatureNeedsProvider] \u201E${n}\u201C zeichnet elektronisch gegen, aber die Schule kann nicht senden: ${t.reason.de}`,en:`[countersign/eSignatureNeedsProvider] "${r}" countersigns electronically, but the school cannot send: ${t.reason.en}`})]}s(R3,"countersignProviderIssues");function $3(e,t,n){if(n.scope!=="node")return[];let r=e.nodes.find(o=>o.id===n.owner);if(r===void 0)return[];let i=[];return Vm(r)||i.push("sourceNotCheckedContract"),zm(e,r.id).some(o=>o.id!==t)&&i.push("twice"),i}s($3,"countersignContractRefusals");function _L(e){let t=e.inputs?.dueInDays;return t?.kind==="literal"&&typeof t.value=="number"&&Number.isInteger(t.value)&&t.value>=1?t.value:void 0}s(_L,"validDueInDays");function E3(e,t,n){let r=e.label?.de??e.id,i=e.label?.en||e.id,o=e.signing;if(o!==void 0&&!qd.includes(o))return[wr(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?.[gn];if(!Kd(e))return a===void 0?[]:[wr(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(wr(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(...I3(e,t,n),...O3(e,t,n),...R3(e,n?.signingProvider)),l}s(E3,"signingIssues");function PL(e,t){let n=e.contract;if(!(!ke(n)||n.scope!=="node"))return t.nodes.find(r=>r.id===n.owner)}s(PL,"contractNodeOf");function I3(e,t,n){let r=PL(e,t),i=r===void 0?null:Ga(r),o=i===null?void 0:n?.traeger?.get(i);return o===void 0||o.hasSignatory?[]:[wr(e,"signing",OL(o.name))]}s(I3,"traegerSignatoryIssues");function O3(e,t,n){let r=PL(e,t);if(r===void 0)return[];let i=n?.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(wr(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(Gm)||l.push(wr(e,"signing",{de:`[countersign/eSignatureAnchorMissing] \u201E${o}\u201C zeichnet elektronisch gegen, aber die Vorlage von \u201E${d.pin}\u201C tr\xE4gt keinen Anker /unterschrift:${Gm}/ \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:${Gm}/ \u2014 the provider would find no signature field for the school.`}));return l}s(O3,"traegerAnchorIssues");var qb=100;async function _3(e,t){let n=await e.db.query("work_items").withIndex("by_applicationId_and_nodeId",o=>o.eq("context.applicationId",t.applicationId).eq("context.anchor.nodeId",t.node.id)).take(qb+1);n.length>qb&&C(`countersign node "${t.node.id}" of ${t.applicationId} holds more than ${qb} rows`);let r=n.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)===gn)?"signatureStalled":r.some(o=>i(o)===Md)?"countersigning":Kd(t.node)?"awaitingSignature":"done"}s(_3,"countersignCurrentState");var NL={[Mb]:{label:ie("Gegenzeichnung","Countersignature"),tone:"teal",phase:{key:"gegenzeichnung",label:ie("Gegenzeichnung","Countersignature"),scope:"node"},external:at(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."))}},CL={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:TL,label:{de:"Gegengezeichnet",en:"Countersigned"}}],progressDefaults:NL,progressEvents:Ht(NL),entryProgressEvent:s(()=>Mb,"entryProgressEvent"),notificationEvents:s(()=>[{id:RL,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:Lb,kind:"internal",label:$L,surface:yr,availableIn:["countersigning"]},...Kd(e)?[{id:ws,kind:"internal",surface:yr,label:{de:"Auf Papier umstellen",en:"Switch to paper"},availableIn:["signatureStalled"]}]:[]],"actions"),workItemTemplates:s(e=>[{key:Md,recipient:"internal",title:e.titles?.countersign??Ya,unlocks:[Lb],advancesNode:!0,..._L(e)!==void 0?{dueInDays:_L(e)}:{}},...Kd(e)?[{key:gn,recipient:"internal",title:IL,unlocks:[ws],gatesNode:!1,advancesNode:!1}]:[]],"workItemTemplates"),placelessTasks:{[Md]:"Worked in its own step: the contract it countersigns is another node's slot, which this node names by address only.",[gn]:"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:EL,currentState:_3,validate:s((e,t,n)=>{let r=[],i=e.label?.de??e.id,o=e.label?.en||e.id;e.assign?.[Md]===void 0&&r.push(wr(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.`})),co(e.titles?.countersign)||r.push(wr(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(wr(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(...E3(e,t,n));let d=e.contract;if(!ke(d))return r;let c=$3(t,e.id,d);if(c.length===0)return r;let u=t.nodes.find(p=>d.scope==="node"&&p.id===d.owner);if(c.includes("sourceNotCheckedContract")&&r.push(wr(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=zm(t,u.id).filter(h=>h.id!==e.id);r.push(wr(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 N3(e){return Vm(e)?Ga(e):null}s(N3,"traegerSignerOf");var P3=s(e=>e.type==="end"&&ds(e)==="approved","isApprovedEnd");function DL(e){let t=[];for(let n of e.nodes){let r=N3(n);if(r===null)continue;let i=zm(e,n.id).map(u=>u.id),o=tC(e,n.id,new Set(i),P3);if(o===null)continue;let a=n.label?.de||n.id,l=n.label?.en||n.id,d={de:`Einen Knoten \u201EUnterschrift (intern)\u201C (countersign) mit contract: $node.${n.id}.contract auf jeden Weg zu einem Ende mit Ergebnis approved setzen.`,en:`Place an "Internal signature" node (countersign) with contract: $node.${n.id}.contract on every path to an end with outcome approved.`},c=i.length===0?{de:`[countersign/missingForContract] \u201E${a}\u201C (${n.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}" (${n.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 (${n.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}" (${n.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}`};t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}`,reason:c,severity:"error"})}return t}s(DL,"checkCountersignCoverage");var C3=[{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 FL(e){let{nodeId:t,bindingKey:n,binding:r}=e,i=[],o=`nodes.${t}.optionalActions.${n}.input`,a=s((u,p=o)=>{i.push({layer:"GRAPH",kind:"nodeRule",path:p,severity:"error",reason:{de:`[optionalAction/input] Optionale Aktion "${n}" auf Knoten "${t}": ${u.de}`,en:`[optionalAction/input] Optional action "${n}" on node "${t}": ${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.${t}.optionalActions.${n}.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 D3({nodeId:t,binding:r,templates:e.templates,input:l}))a(u);return i}s(FL,"optionalActionInputIssues");function D3(e){let{nodeId:t,binding:n,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 n.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!==n.trigger&&a.push({de:`Die Eingabe "${i}" geh\xF6rt dem Team "${String(l)}", ausgel\xF6st wird die Aktion vom Team "${n.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 "${n.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 C3)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!==t||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(D3,"optionalActionInputRefusals");function Wm(e,t){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:t(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:t(p),idx:0}))}}return l}s(Wm,"detectBackEdges");function Kb(e){let t="error",n=new Map;for(let a of Cn(e.nodes)){let l=n.get(a.source)??[];l.push({id:a.id,target:a.target}),n.set(a.source,l)}let r=[],i=new Set,o=Wm(e.nodes.map(a=>a.id),a=>(n.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:t}));return r}s(Kb,"checkAcyclic");function jb(e){let t=[],n=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))n.has(l.to)||t.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))&&t.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 t}s(jb,"checkNextTargets");function Vb(e){let t=[];for(let n of e.nodes){let r=n.next;if(!r)continue;let i=hm(n),o=new Set(i?i.map(a=>a.id):[vo]);for(let a of Object.keys(r))o.has(a)||t.push({layer:"GRAPH",kind:"unknownOutcome",path:`node.${n.id}.next.${a}`,reason:{de:`${n.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:`${n.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 t}s(Vb,"checkNextOutcomesKnown");function Bb(e){let t=[],n=new Set(Cn(e.nodes).map(o=>o.target)),r=e.nodes.filter(o=>!n.has(o.id));return r.length===0?t.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein Start-Knoten",en:"No start node"},severity:"error"}):r.length>1&&t.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&&t.push({layer:"GRAPH",kind:"startEnd",path:"graph",reason:{de:"Kein End-Knoten",en:"No end node"},severity:"warning"}),t}s(Bb,"checkStartEnd");function Ub(e){let t=new Map;for(let r of Cn(e.nodes))t.set(r.source,(t.get(r.source)??0)+1);let n=[];for(let r of e.nodes)r.type!=="end"&&(t.get(r.id)??0)===0&&n.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 n}s(Ub,"checkNoOutgoingEdge");function Gb(e){return e.nodes.filter(t=>!Uw(t.id)).map(t=>({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.id`,reason:{de:`[graph/nodeIdFormat] Knoten "${t.id}": eine Knoten-ID ist ein Bezeichner ohne Punkt (${_r.source}), z. B. "reviewEingereicht". Ein Bundle von vor der Umstellung neu exportieren.`,en:`[graph/nodeIdFormat] Node "${t.id}": a node id is an identifier without a dot (${_r.source}), e.g. "reviewSubmitted". Export a bundle from before the change again.`},severity:"error"}))}s(Gb,"checkNodeIdFormat");function zb(e){let t=new Set(e.nodes.map(r=>r.id)),n=[];for(let r of Cn(e.nodes))t.has(r.source)||n.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"}),t.has(r.target)||n.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 n}s(zb,"checkEdgeEndpoints");function LL(e){let t=[];for(let n of e.nodes)for(let r of n.tasks??[]){let i=r.result;i===null||typeof i!="object"||!(Nm in i)||t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.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 t}s(LL,"checkRenamedFields");var F3=new Set(["countersignature"]);function ML(e){let t=[],n=s((o,a)=>{t.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&&n("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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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&&n(`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($k[o.type]??{}))c in a&&n(`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&&n(`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(Ob))h in c&&n(`nodes.${o.id}.tasks.${u}.${h}`,y(u,l))}for(let c of Ek[o.type]??[])c in a&&n(`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(wP[o.type]??{}))c in a&&n(`nodes.${o.id}.${c}`,{de:`${l.de}: ${u.de}`,en:`${l.en}: ${u.en}`});a.adoptForm===!0&&n(`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"&&F3.has(u)&&n(`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 t}s(ML,"checkRetiredDataFields");function Wb(e){let t=new Set(UN()),n=[];for(let r of e.nodes)t.has(r.type)||n.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: ${[...t].join(", ")}.`,en:`[graph/unknownNodeType] Node "${r.id}" has the unknown type "${String(r.type)}". Registered types: ${[...t].join(", ")}.`},severity:"error"});return n}s(Wb,"checkKnownNodeTypes");function Ss(e,t){return t?.wiring&&t.layout?{wiring:t.wiring,layout:t.layout}:null}s(Ss,"resolveLayoutContext");function L3(e,t){let n=Ss(e,t);if(!n)return e.nodes.some(o=>(Ze(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 ${t?.wiring?"vorhanden":"fehlt"}, Layout ${t?.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 ${t?.wiring?"present":"missing"}, layout ${t?.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=Ze(i)?.progressEvents;if(a)for(let l of a){let d=ls(n.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 '${n.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 '${n.layout.id}') \u2014 the engine throws when mirroring`},severity:"error"});continue}let c;try{c=cm(n.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 '${n.layout.id}'`,en:`${i.type} '${i.id}': event '${l}' points to unknown bus '${d.bus}' in layout '${n.layout.id}'`},severity:"error"});continue}vd(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(L3,"checkProgressEventMappings");function M3(e,t){let n=Ss(e,t);if(!n)return[];let r=[];for(let i of n.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),vd(i,c)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.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.${n.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(M3,"checkProgressBoardCoverage");function q3(e,t){let n=Ss(e,t);if(!n)return[];let r=[];for(let i of n.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(!co(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.${n.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(q3,"checkProgressBoardDistinctLabels");function K3(e,t){let n=Ss(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses)for(let o of i.states){let a=um(i,o.id);o.terminal&&!a&&r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.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.${n.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 j3(e,t){let n=Ss(e,t);if(!n)return[];let r=[];for(let i of n.layout.buses){let o=new Set(i.holdsSeat??[]);for(let a of i.holdsSeat??[])vd(i,a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.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??[])vd(i,a)?o.has(a)||r.push({layer:"GRAPH",kind:"progressState",path:`layout.${n.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.${n.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.${n.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(j3,"checkProgressSeatStates");var Ym={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,t,n){let r=new Map(e.nodes.map(y=>[y.id,y])),i=new Set(Cn(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 A=new Set([...k,y]);if(a&&o.includes(v)&&v.type!=="eventTrigger")return;if(v.type==="eventTrigger"&&o.includes(v)){let L=v.next?.[Gn]?.to;L===void 0?d.push({at:y,state:null}):c(L,b,A);return}let T=Ze(v);if(Yb[v.type]===!1){if(Ze(v).progressEvents?.length){d.push({at:y,state:null});return}let L=l(v);L.length===0&&d.push({at:y,state:null});for(let N of L)c(N,b,A);return}let I=T.entryProgressEvent?.(v),D=b;if(I!==void 0){let L=ls(t,v,I);L?.bus==="process"&&(D=L.state)}if(T.advancesAtEntry?.(v)===!0)for(let L of l(v))c(L,b,A);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:n.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 B3(e,t){let n=Ss(e,t);if(!n)return[];if(!n.layout.buses.some(l=>l.key==="process"))return[];let r=Wk(n.layout);if(!r)return[];let i=V3(e,n.wiring,r);if(i.kind==="one"){let l=r.columns.find(d=>d.id===i.columnId);return l.defaultCollapsed!==!0&&!lC(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(B3,"checkProgressStartColumn");function U3(e){return e==="both"?{de:`${Ym.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:`${Ym.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:`${Ym.de}, oder den Zustand in die Spalte des Nachfolgers legen.`,en:`${Ym.en}, or move the state into the successor's column.`}}s(U3,"passThroughRemedy");function G3(e,t){let n=Ss(e,t);if(!n)return[];let{layout:r,wiring:i}=n;if(!r.buses.some(v=>v.key==="process"))return[];let o=Wk(r);if(!o)return[];let a=new Map(e.nodes.map(v=>[v.id,v])),l=s(v=>Ze(v).progressEvents??[],"eventsOf"),d=s(v=>Object.values(v.next??{}).map(A=>A.to),"routesOf"),c=s((v,A)=>{let T=a.get(v);if(!T||A.has(v))return null;if(l(T).length>0)return[T];if(Yb[T.type]!==!1)return null;let I=d(T);if(I.length===0)return null;let D=[];for(let L of I){let N=c(L,new Set([...A,v]));if(!N)return null;D.push(...N)}return D},"firstProgressNodes"),u=s((v,A)=>{let T=[];for(let I of l(v)){let D=ls(i,v,I);if(!D||D.bus!==A.bus||D.state===A.state)return null;T.push(D.state)}return[...new Set(T)].join("' / '")},"overwrites"),p=s((v,A)=>{let T=d(v);if(T.length===0)return null;let I=[];for(let D of T){let L=c(D,new Set([v.id]));if(!L)return null;for(let N of L){let x=u(N,A);if(x===null)return null;I.push({de:`'${N.id}' (${N.type}) mit '${x}'`,en:`'${N.id}' (${N.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 A of l(v)){let T=ls(i,v,A);if(!T||T.bus!=="process")continue;let I=v.type==="form"&&A===Rp?p(v,T):null,D=I?{de:`'${v.id}'.${A} erreicht ihn, und ${I.map(L=>L.de).join(", ")} \xFCberschreibt ihn in derselben Transaktion`,en:`'${v.id}'.${A} reaches it, and ${I.map(L=>L.en).join(", ")} overwrites it in the same transaction`}:null;h.set(T.state,[...h.get(T.state)??[],D])}let y=cm(r,"process"),b=new Map;for(let[v,A]of h){if(!A.every(I=>I!==null))continue;let T=[...new Map(A.map(I=>[I.de,I])).values()];b.set(v,{de:T.map(I=>I.de).join("; "),en:T.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 A=v.states.map(I=>{let D=y.holdsSeat?.includes(I)===!0,L=b.get(I);return{de:`Zustand '${I}'${D?" (steht in holdsSeat, belegt aber nie einen Platz)":""}: ${L.de}`,en:`State '${I}'${D?" (is in holdsSeat, but never takes a seat)":""}: ${L.en}`}}),T=U3(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 ${A.map(I=>I.de).join("; ")}. ${T.de}`,en:`[progress/passThroughState] Column "${v.label.en}" ('${v.id}', board '${o.id}') always stays empty \u2014 ${A.map(I=>I.en).join("; ")}. ${T.en}`},severity:"warning"})}return k}s(G3,"checkProgressPassThroughColumns");function z3(e){let t=["workItems","workitems","work_items","taskTemplates"],n=[];for(let r of e.nodes){let i=r;for(let o of t){let a=i[o];a!=null&&n.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 n}s(z3,"checkMisnamedTasksKey");function W3(e){let t=[];for(let n of e.nodes){let r=n,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)&&t.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=Ze(n),d=new Map((typeof l.workItemTemplates=="function"?l.workItemTemplates(n):[]).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||!Rd.has(p)){t.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: ${[...Rd].join(", ")}.`,en:`[workItems/invalidKind] Task "${u}" on node "${r.id}" has kind ${JSON.stringify(c.kind)}; composable kinds are: ${[...Rd].join(", ")}.`},severity:"error"});continue}p==="task"&&c.gatesNode!==void 0&&t.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:QF(e,r.id,h.node);if(h!==void 0&&y===null)t.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,A=k?o:y.composedKeys,T=k?d:y.intrinsicByKey,I=y.node.assign??{};p==="approval"&&t.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,L=[...new Set([...A,...T.keys()])].filter(x=>!k||x!==u).join(", "),N={de:L||"keine",en:L||"none"};if(typeof D!="string"||k&&D===u||!A.has(D)&&!T.has(D))t.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: ${N.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: ${N.en}.`},severity:"error"});else if(y.refuse(D)!==null)t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.tasks.${u}.blocks.templateKey`,reason:y.refuse(D),severity:"error"});else{let x=T.get(D);h.except!==void 0&&t.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&&t.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)||t.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&&t.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)t.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"&&t.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)&&t.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 t.push(...ZF(e)),t}s(W3,"checkWorkItemTemplates");var Y3=new Set(["complete","approve","reject"]),Yb={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 H3(e){let t=[];for(let n of e.nodes){let r=n,i=Ze(n),o=Array.isArray(r.tasks)?r.tasks.length:0,a=i.workItemTemplates?.(n)??[];if(o+a.length>0){let v=Yb[r.type];v===void 0?t.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||t.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?.(n)??[];if(l.length===0&&a.length===0)continue;let d=new Map(l.map(v=>[v.id,v]));for(let v of l)Y3.has(v.id)&&t.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??[TC]);for(let v of l)if(v.availableIn!==void 0)for(let A of v.availableIn)c.has(A)||t.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 "${A}" deklariert \u2014 der Typ kennt nur: ${[...c].join(", ")}.`,en:`[capability/unknownActionState] Action "${v.id}" on node type "${r.type}" is declared for state "${A}" \u2014 the type only knows: ${[...c].join(", ")}.`},severity:"error"});let u=hm(n),p=new Set(u?u.map(v=>v.id):[vo]);for(let v of l){if(v.external===void 0)continue;let A=SC(v.external.event),T={de:"hat keine Beschriftung (der Empf\xE4nger bekommt einen leeren Button)",en:"has no label (the recipient would get an empty button)"},I=A?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?T: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?T: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&&t.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 A=v.unlocks;if(A.length===0&&v.verdictResolved!==!0&&v.informational!==!0){t.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 T of A)d.get(T)===void 0&&t.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 "${T}" frei; deklariert: ${[...d.keys()].join(", ")||"keine"}.`,en:`[capability/danglingUnlock] Template "${v.key}" on node "${r.id}" unlocks the unknown action "${T}"; 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)||t.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,A]of Object.entries(r.assign??{})){if(A===void 0)continue;let T=`nodes.${r.id}.assign.${v}`,I={de:`Team der Vorlage "${v}" (Knoten "${r.id}")`,en:`team of the template "${v}" (node "${r.id}")`};t.push(...UP(A,T,I));for(let[D,L]of(Array.isArray(A)?A:[]).entries()){let N=L?.when;N==null||!ke(N)||gt(N)||t.push({layer:"GRAPH",kind:"nodeRule",path:`${T}.${D}.when`,severity:"error",reason:{de:`[assign/conditionNotFormField] ${I.de}, Zeile ${D+1}: die Bedingung nennt ${Ue(e,N,"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,N,"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)||t.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 T of v.unlocks)b.add(T);let k=i.strictActionCoverage===!0;for(let v of l){if(b.has(v.id)||v.superUserOnly===!0)continue;let A=a.find(I=>I.unlocks.includes(v.id)),T=A!==void 0?{de:` Fehlt die Zuweisung assign.${A.key}?`,en:` Is the assignment assign.${A.key} missing?`}:{de:"",en:""};t.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.${T.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.${T.en}`},severity:k?"error":"warning"})}}return t}s(H3,"checkNodeCapabilityWiring");function J3(e,t){let n=[],r=s((a,l)=>{n.push({layer:"GRAPH",kind:"nodeRule",path:a,reason:l,severity:"error"})},"push"),i=eN(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(n.push(...f5(l,d)),d.length===0)continue;let c=Ze(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,A=typeof v=="string"&&v.trim().length>0?v:void 0,T=A??"?",I=`nodes.${l.id}.optionalActions.${T}`,D=typeof k.action=="string"?k.action:void 0;if(k.when!==void 0){let L=s(N=>r(`${I}.when`,{de:`[optionalAction/when] Optionale Aktion "${T}" auf Knoten "${l.id}": ${N.de}`,en:`[optionalAction/when] Optional action "${T}" on node "${l.id}": ${N.en}`}),"conditionFinding");if(typeof k.when!="string"||k.when.trim()==="")L({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 N of Em(k.when,i,t))L(N)}if((D===void 0||!u.has(D))&&r(`${I}.action`,{de:`[optionalAction/kindNotDeclared] Optionale Aktion "${T}" 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 "${T}" 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(", ")}.`)}),A===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(A)&&r(`${I}.key`,{de:`[optionalAction/duplicateKey] Doppelter Aktions-Key "${A}" auf Knoten "${l.id}" \u2014 die projizierten Trigger-Actions w\xFCrden kollidieren.`,en:`[optionalAction/duplicateKey] Duplicate action key "${A}" on node "${l.id}" \u2014 the projected trigger actions would collide.`}),y.add(A)),o(k.label)||r(`${I}.label`,{de:`[optionalAction/missingLabel] Optionale Aktion "${T}" auf Knoten "${l.id}" ohne Label \u2014 der Trigger-Button w\xE4re unbeschriftet.`,en:`[optionalAction/missingLabel] Optional action "${T}" on node "${l.id}" without a label \u2014 the trigger button would be unlabeled.`}),D==="skipRule"){n.push(...Z3(l,k,I,T,d));continue}if(D==="spawnTasks"){k.except!==void 0&&r(`${I}.except`,{de:`[optionalAction/exceptRetired] Optionale Aktion "${T}" 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 "${T}" 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'.`}),n.push(...FL({nodeId:l.id,bindingKey:T,binding:k,templates:p})),n.push(...Q3(l.id,k,I,T,h));let L=Array.isArray(k.tasks)?k.tasks:void 0;if(L===void 0||L.length===0)r(`${I}.tasks`,{de:`[optionalAction/tasksEmpty] Optionale Aktion "${T}" auf Knoten "${l.id}" referenziert keine Aufgaben-Templates \u2014 der Trigger w\xFCrde nichts erzeugen.`,en:`[optionalAction/tasksEmpty] Optional action "${T}" on node "${l.id}" references no task templates \u2014 the trigger would create nothing.`});else{let N=new Set,x=new Set(L.filter(F=>typeof F=="string"));for(let F of L){let $=typeof F=="string"?F:void 0;if($===void 0||$.length===0){r(`${I}.tasks`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${T}" auf Knoten "${l.id}" enth\xE4lt eine leere/ung\xFCltige Template-Referenz.`,en:`[optionalAction/unknownTaskRef] Optional action "${T}" on node "${l.id}" contains an empty or invalid template reference.`});continue}if(N.has($)){r(`${I}.tasks.${$}`,{de:`[optionalAction/duplicateTaskRef] Template "${$}" ist in der Aktion "${T}" auf Knoten "${l.id}" doppelt referenziert.`,en:`[optionalAction/duplicateTaskRef] Template "${$}" is referenced twice in the action "${T}" on node "${l.id}".`});continue}N.add($);let q=h.get($);if(q===void 0){r(`${I}.tasks.${$}`,{de:`[optionalAction/unknownTaskRef] Optionale Aktion "${T}" auf Knoten "${l.id}" referenziert das Template "${$}", das node.tasks nicht deklariert. Vorhanden: ${[...h.keys()].join(", ")||"keine"}.`,en:`[optionalAction/unknownTaskRef] Optional action "${T}" on node "${l.id}" references the template "${$}", which node.tasks does not declare. Present: ${[...h.keys()].join(", ")||"none"}.`});continue}let G=b.get($);G!==void 0&&G!==T?r(`${I}.tasks.${$}`,{de:`[optionalAction/taskDoublyBound] Template "${$}" 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 "${$}" on node "${l.id}" is already referenced by the action "${G}" \u2014 a template belongs to at most one optional action.`}):b.set($,T);let ae=q.blocks?.templateKey;typeof ae=="string"&&!x.has(ae)&&r(`${I}.tasks.${$}`,{de:`[optionalAction/taskRefBlocks] Template "${$}" auf Knoten "${l.id}" tr\xE4gt 'blocks' auf "${ae}", das nicht zur selben Aktion "${T}" geh\xF6rt \u2014 eine Referenz darf nur eine Referenz DERSELBEN Aktion zur\xFCckhalten (Checklisten-Reihenfolge), nie ein Template au\xDFerhalb.`,en:`[optionalAction/taskRefBlocks] Template "${$}" on node "${l.id}" carries 'blocks' on "${ae}", which does not belong to the same action "${T}" \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===$&&(oe!==void 0&&x.has(oe)||r(`${I}.tasks.${$}`,{de:`[optionalAction/taskRefBlocks] Template "${$}" auf Knoten "${l.id}" ist Ziel eines 'blocks' von ${oe!==void 0?`"${oe}"`:"einem Template"} au\xDFerhalb der Aktion "${T}" \u2014 ein Template au\xDFerhalb darf eine Referenz nie zur\xFCckhalten (ihr Spawn geh\xF6rt dem Trigger, nicht onEnter).`,en:`[optionalAction/taskRefBlocks] Template "${$}" on node "${l.id}" is the target of a 'blocks' from ${oe!==void 0?`"${oe}"`:"a template"} outside the action "${T}" \u2014 a template outside may never hold back a reference (its spawn belongs to the trigger, not to onEnter).`}))}}}}}}return n}s(J3,"checkOptionalActions");function Q3(e,t,n,r,i){if(t.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 t.auto!="boolean")return[o(`${n}.auto`,"autoType","'auto' ist true oder false.","'auto' is true or false.")];if(!t.auto)return[];let a=[];for(let d of["input","submitLabel"])t[d]!==void 0&&a.push(o(`${n}.${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(t.tasks)?t.tasks:[];for(let d of l)typeof d=="string"&&i.get(d)?.familyRequest!==void 0&&a.push(o(`${n}.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(Q3,"autoIssues");function Z3(e,t,n,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(`${n}.action`,"skipRuleWithoutRule","\xFCberspringt die Entscheidungsregel, aber der Knoten hat keine (`requiresOneOf`).","skips the decision rule, but the node has none (`requiresOneOf`)."),l.includes(t.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(`${n}.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")!==t&&a(`${n}.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"])t[u]!==void 0&&a(`${n}.${u}`,"skipRuleShape",`tr\xE4gt '${u}' \u2014 sie legt keine Aufgaben an.`,`carries '${u}' \u2014 it creates no tasks.`);return o}s(Z3,"skipRuleIssues");function X3(e){return typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string"}s(X3,"literalValueType");function e5(e,t){let n=[],r=t?.notificationTemplates;for(let i of e.nodes){let o=i,a=VD(i,Ze(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)||n.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)){n.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"){n.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){n.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&&n.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=LD(c),b=new Set(h.params.map(k=>k.key));for(let k of Object.keys(u.args??{}))b.has(k)||n.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],A=`${p}.args.${k.key}`;if(v!==void 0&&"literal"in v){let I=X3(v.literal);k.type!==void 0&&!ab(I,k.type)&&n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/argTypeMismatch] "${k.key}" erwartet ${Td(k.type).de}, festgelegt ist aber ${JSON.stringify(v.literal)} (${I}).`,en:`[notification/argTypeMismatch] "${k.key}" expects ${Td(k.type).en}, but ${JSON.stringify(v.literal)} (${I}) is set.`},severity:"error"});continue}if(v!==void 0){n.push({layer:"GRAPH",kind:"nodeRule",path:A,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 ${qL(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 ${qL(y,"en")}.`},severity:"error"});continue}let T=MD(k,y.get(k.key)??[]);if(!(T.status==="resolved"||T.status==="unused")){if(T.status==="sometimes"){n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${k.key}" immer, ${T.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 ${T.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(T.status==="ambiguous"){n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/ambiguousArg] "${k.key}" hat mehrere passende Quellen \u2014 ${T.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 ${T.matches.map(I=>I.source).join(", ")}. Set a fixed value in notifications.${c.id}.args.${k.key}.`},severity:"error"});continue}n.push({layer:"GRAPH",kind:"nodeRule",path:A,reason:{de:`[notification/unresolvedArg] Die Benachrichtigung "${h.id}" braucht "${k.key}"${k.type!==void 0?` (${Td(k.type).de})`:""}, und der Knoten hat daf\xFCr ${T.rejected.length===0?"keine Quelle":`nur unpassende Quellen: ${T.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`,en:`[notification/unresolvedArg] The notification "${h.id}" needs "${k.key}"${k.type!==void 0?` (${Td(k.type).en})`:""}, and the node has ${T.rejected.length===0?"no source for it":`only unsuitable sources for it: ${T.rejected.map(I=>`${I.source} (${I.type})`).join(", ")}`}.`},severity:"error"})}}}}return n}s(e5,"checkNotificationBindings");function t5(e){return wF(e).map(t=>({layer:"GRAPH",kind:"assignment",path:"assignmentRules",reason:t,severity:"error"}))}s(t5,"checkAssignmentRules");function qL(e,t){let n=[...e.keys()].sort();return n.length===0?t==="de"?"(nichts)":"(nothing)":n.join(", ")}s(qL,"describeCandidates");function n5(e,t){return vF(e,t?.teamKeys).map(n=>({layer:"GRAPH",kind:"nodeRule",path:n.path,reason:n.reason,severity:"error"}))}s(n5,"checkChannels");function r5(e){return nN(e).map(t=>({layer:"GRAPH",kind:"nodeRule",path:t.path,reason:t.reason,severity:"error"}))}s(r5,"checkStaffInputs");function i5(e,t){let n=[];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=>{n.push({layer:"GRAPH",kind:"nodeRule",path:o,reason:c,severity:"error"})},"issue");if(!$F(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=ce(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),!gt(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=li(t,c);p!=null&&Ra("nodeReads",Ta(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 n}s(i5,"checkReadinessReads");function o5(e,t){let n=[];for(let r of e.nodes){if(r.type!=="setFlag")continue;let i=nP(r),o=Yp(r);if(i===null||o===null)continue;let a=t?.formFlagKeysByFormNode?.get(i);if(a===void 0||a.has(o))continue;let l=[...a].sort();n.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${r.id}.inputs.${jt.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 n}s(o5,"checkSetFlagKeys");function s5(e,t){let n=t?.readinessFormFieldsByFormNode,r=t?.readinessPartyConditionKeysByFormNode;if(n===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)||!fr(a))continue;let l=n.get(a.owner),d=r.get(a.owner);if(l===void 0||d===void 0||d.size===0)continue;let c=vb(l,d);if(c.size===0)continue;let u=o.reads,p=(Array.isArray(u)?u:[]).filter(k=>gt(k)&&k.owner===a.owner),h=vb(l,[...p.map(k=>k.path),...OF(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(s5,"checkReadinessPartyConditions");function Hb(e){let t=Object.keys(e.inputs??{});if(t.length===0)return[];let n=e.generatorStamp,r=e.production,i=e.templateStamp;if(e.type==="governedDocument"&&(r==="resolver"&&!Array.isArray(n?.inputSchema?.fields)||r==="template"&&!Array.isArray(i?.fields)))return[];let a=new Set(Ia(e).map(l=>l.id));return t.filter(l=>!a.has(l))}s(Hb,"undeclaredInputKeys");function a5(e,t){return e.nodes.flatMap(n=>[...d5(e,n,Ia(n),t),...l5(e,n,t)])}s(a5,"checkUnknownResources");function l5(e,t,n){let r=[],i=new Set((Ze(t).workItemTemplates?.(t)??[]).map(a=>a.key)),o=new Set((t.tasks??[]).filter(a=>a.familyRequest!==void 0).map(a=>String(a.key)));for(let a of am(t)){if(a.leaf==="assign{}"&&!i.has(a.owner)||a.leaf==="tasks[].assign.group"&&a.missing&&o.has(a.owner))continue;let l=xa[a.leaf],d=`nodes.${t.id}.${a.path}`,c=s(h=>h==="de"?`Knoten \u201E${Pe(e,t.id,"de")}\u201C (${t.id}), ${l.what.de} \u201E${a.owner}\u201C`:`node "${Pe(e,t.id,"en")}" (${t.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=n?.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(l5,"referenceIssues");function d5(e,t,n,r){let i=[];for(let o of n){if(!Hp(o.type))continue;let a=ka[o.type].existence;if(a.check!=="generic")continue;let l=r?.[a.catalog];if(l===void 0)continue;let d=t.inputs?.[o.id];if(d?.kind!=="literal"||typeof d.value!="string"||l.has(d.value))continue;let c=ka[o.type].label;i.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${t.id}.inputs.${o.id}`,reason:{de:`[inputs/unknownResource] Knoten \u201E${Pe(e,t.id,"de")}\u201C (${t.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,t.id,"en")}" (${t.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(d5,"unknownResourceIssues");function c5(e){let t=[];for(let n of e.nodes)for(let r of Hb(n))t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${r}`,reason:{de:`[inputs/undeclared] Knoten \u201E${Pe(e,n.id,"de")}\u201C (${n.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,n.id,"en")}" (${n.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 t}s(c5,"checkUndeclaredInputs");function u5(e){let t=[];for(let n of e.nodes){let r=new Set;for(let i of Ia(n)){if(!r.has(i.id)){r.add(i.id);continue}t.push({layer:"GRAPH",kind:"nodeRule",path:`nodes.${n.id}.inputs.${i.id}`,reason:{de:`[inputs/duplicateSlot] Knoten \u201E${Pe(e,n.id,"de")}\u201C (${n.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,n.id,"en")}" (${n.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 t}s(u5,"checkDuplicateSlots");function KL(e,t,n){let r=[],i=Wb(e);if(i.length>0)return i;r.push(...Gb(e)),r.push(...Bb(e)),r.push(...zb(e)),r.push(...Ub(e)),r.push(...Kb(e)),r.push(...jb(e)),r.push(...Vb(e)),r.push(...ML(e)),r.push(...LL(e)),r.push(...pC(e,t)),r.push(...L3(e,t)),r.push(...M3(e,t)),r.push(...q3(e,t)),r.push(...CF(e,t?.layout)),r.push(...K3(e,t)),r.push(...j3(e,t)),r.push(...G3(e,t)),r.push(...B3(e,t)),r.push(...iC(e,n)),r.push(...yC(e)),r.push(...xC(e)),r.push(...hC(e)),r.push(...gC(e)),r.push(...c5(e)),r.push(...a5(e,n)),r.push(...u5(e)),r.push(...z3(e)),r.push(...W3(e)),r.push(...eL(e,n)),r.push(...oL(e)),r.push(...rL(e)),r.push(...sL(e,n)),r.push(...mL(e,n)),r.push(...H3(e)),r.push(...e5(e,n)),r.push(...J3(e,n)),r.push(...t5(e)),r.push(...i5(e,n)),r.push(...s5(e,n)),r.push(...o5(e,n)),r.push(...n5(e,n)),r.push(...r5(e)),r.push(...DL(e));for(let o of e.nodes){let a=Ze(o);a.validate&&r.push(...a.validate(o,e,n))}return r}s(KL,"checkGraph");function f5(e,t){let n=e.requiresOneOf;if(n===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(n)||n.length===0||n.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=t.map(d=>d.key).filter(d=>typeof d=="string"),a=[],l=new Set;for(let d of n){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(f5,"checkRequiresOneOf");function p5(e){return e.nodes.flatMap(t=>Hb(t).map(n=>({nodeId:t.id,key:n,binding:t.inputs?.[n]?.kind==="binding"})))}s(p5,"undeclaredInputCells");function jL(e,t){let n=p5(e).filter(o=>t.bindings||!o.binding);if(n.length===0)return{graph:e,dropped:n};let r=new Map;for(let o of n)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:n}}s(jL,"dropUndeclaredInputs");function Jb(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Jb,"isObject");function VL(e){return Jb(e)&&e.type==="governedDocument"&&("template"in e||"cockpitFields"in e)}s(VL,"oldShape");function BL(e){return(e?.nodes??[]).some(VL)}s(BL,"needsTemplateStampMove");function m5(e){let t=e.generatorStamp?.inputSchema?.fields;if(e.production==="resolver")return Array.isArray(t)?t:null;let n=e.templateStamp?.fields;return e.production==="template"&&Array.isArray(n)?n:null}s(m5,"stampedFields");function h5(e){let t=String(e.id);if("template"in e&&"templateStamp"in e)return{unmoved:{nodeId:t,reason:"templateAndStamp"}};let n={...e},r=[];if("template"in e){let{template:i}=e;if(delete n.template,Jb(i))n.templateStamp={fields:Array.isArray(i.fields)?i.fields:[],...i.localeField===void 0?{}:{localeField:i.localeField}};else return{unmoved:{nodeId:t,reason:"templateNotObject"}}}if("cockpitFields"in e){let i=Array.isArray(e.cockpitFields)?e.cockpitFields.filter(l=>typeof l=="string"):[];delete n.cockpitFields;let o=Jb(e.inputs)?{...e.inputs}:{},a=m5(n);if(a===null&&i.length>0)return{unmoved:{nodeId:t,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:t,key:l,reason:"unknownKey"});else{if(c.type==="party"||c.type==="personList")continue;c.processSource!==void 0?r.push({nodeId:t,key:l,reason:"processSource"}):d?r.push({nodeId:t,key:l,reason:"cellExists"}):o[l]={kind:"cockpit"}}}n.inputs=o}return{node:n,reports:r}}s(h5,"moveNode");function UL(e){let t=[],n=[],r=[],i=e.nodes.map(o=>{if(!VL(o))return o;let a=h5(o);return"unmoved"in a?(r.push(a.unmoved),o):(t.push(String(o.id)),n.push(...a.reports),a.node)});return t.length===0?{graph:e,moved:t,reports:n,unmoved:r}:{graph:{...e,nodes:i},moved:t,reports:n,unmoved:r}}s(UL,"moveTemplateStampAndCockpit");var GL=$p,g5="applicant.applicationSubmitted";function Hm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Hm,"isObject");function zL(e){return Hm(e)&&e.type==="form"&&typeof e.id=="string"&&!Pn(e)}s(zL,"isCreatingFormNode");function y5(e){return Hm(e.notifications)&&GL in e.notifications}s(y5,"hasSubmittedBinding");function Qb(e){let t={toBind:[],alreadyBound:[],malformed:[]};for(let n of e?.nodes??[])zL(n)&&(n.notifications!==void 0&&!Hm(n.notifications)?t.malformed.push(n.id):y5(n)?t.alreadyBound.push(n.id):t.toBind.push(n.id));return t}s(Qb,"submitReceiptInventory");function WL(e){let{toBind:t}=Qb(e);if(t.length===0)return{graph:e,bound:[]};let n=new Set(t),r=e.nodes.map(i=>{if(!zL(i)||!n.has(i.id))return i;let o=Hm(i.notifications)?i.notifications:{};return{...i,notifications:{...o,[GL]:{templateId:g5}}}});return{graph:{...e,nodes:r},bound:t}}s(WL,"bindSubmitReceipt");var As=["park","advance"],Jn="whenNothingOwed",YL={park:{de:"Jemand schaut drauf",en:"Someone looks at it"},advance:{de:"Durchreichen",en:"Pass through"}};function Zb(e){let t=e.inputs?.[Jn],n=t?.kind==="literal"?t.value:void 0;return Xb(n)?n:null}s(Zb,"reviewModeOrNull");function Xb(e){return As.includes(e)}s(Xb,"isReviewMode");function ev(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(ev,"isObject");function HL(e){return ev(e)&&e.type==="review"&&!(ev(e.inputs)&&Jn in e.inputs)}s(HL,"lacksMode");function JL(e){return(e?.nodes??[]).some(HL)}s(JL,"needsReviewMode");function QL(e){let t=[],n=e.nodes.map(r=>{if(!HL(r))return r;t.push(r.id);let i=ev(r.inputs)?r.inputs:{};return{...r,inputs:{...i,[Jn]:{kind:"literal",value:"park"}}}});return{graph:{...e,nodes:n},set:t}}s(QL,"setReviewModePark");function Jm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Jm,"isObject");function ZL(e){let{notifications:t,bound:n}=km(e.notifications,{tasks:[]},e);return{next:t,bound:n}}s(ZL,"bindingsFor");function XL(e){let t={toBind:[],malformed:[]};for(let n of e?.nodes??[])if(!(!Jm(n)||typeof n.id!="string"||Na(n).length===0)){if(n.notifications!==void 0&&!Jm(n.notifications)){t.malformed.push(n.id);continue}for(let r of ZL(n).bound)t.toBind.push(`${n.id}.${r}`)}return t}s(XL,"appointmentLetterInventory");function e0(e){let t=[],n=!1,r=e.nodes.map(i=>{if(!Jm(i)||typeof i.id!="string"||Na(i).length===0||i.notifications!==void 0&&!Jm(i.notifications))return i;let{next:o,bound:a}=ZL(i);return a.length===0?i:(n=!0,t.push(...a.map(l=>`${i.id}.${l}`)),{...i,notifications:o})});return n?{graph:{...e,nodes:r},bound:t}:{graph:e,bound:[]}}s(e0,"bindAppointmentLetters");function Ja(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ja,"isObject");var t0=["id","label","dataFlow"],n0=["audience","populates","stages","expectedOutcomes"];function r0(e){return Array.isArray(e.assignmentRules)&&e.assignmentRules.some(t=>Ja(t)&&typeof t.slot=="string")}s(r0,"carriesStringSlots");function i0(e){return(e.nodes??[]).some(t=>Ja(t)&&t.type==="form"&&n0.some(n=>n in t))}s(i0,"carriesRetiredFormNodeKey");var w5=[{key:"generatorPin",editor:!0,holds:RN,what:{de:"Generator als `resolver`",en:"generator as `resolver`"}},{key:"setFlagProperties",editor:!0,holds:aP,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:pP,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:vP,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:gN,what:{de:"Entscheidungsausg\xE4nge ohne Bedeutung",en:"decision outcomes without a meaning"}},{key:"startNodeOutcomes",editor:!0,holds:bN,what:{de:"ein Start-Knoten mit eigenen Ausg\xE4ngen",en:"a start node with its own outcomes"}},{key:"templateParameters",editor:!0,holds:BL,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:EP,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:KP,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:NP,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:MP,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:JL,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=>om(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=>t0.some(t=>t in e),"holds"),what:{de:"`graph.id` / `graph.label` / `graph.dataFlow`",en:"`graph.id` / `graph.label` / `graph.dataFlow`"}},{key:"assignmentSlotString",editor:!1,holds:r0,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:i0,what:{de:"Formularknoten mit `audience` / `populates` / `stages` / `expectedOutcomes`",en:"form nodes with `audience` / `populates` / `stages` / `expectedOutcomes`"}}];function o0(e){if(!Ja(e)||!Array.isArray(e.nodes))return[];let t=e;return w5.filter(n=>n.holds(t)).map(({key:n,what:r,editor:i})=>({key:n,what:r,editor:i}))}s(o0,"legacyGraphShapes");function s0(e,t){let n=t.answers??{},r=[],i=[],o=e,a=t0.filter($=>$ in o);if(a.length>0){let $={...o};for(let q of a)delete $[q],r.push({message:`graph.${q}: deleted (read by nothing)`});o=$}if(i0(o)&&(o={...o,nodes:o.nodes.map($=>{if(!Ja($)||$.type!=="form")return $;let q=n0.filter(ae=>ae in $);if(q.length===0)return $;let G={...$};for(let ae of q)delete G[ae];return r.push({nodeId:String($.id),message:`form node: deleted ${q.map(ae=>`\`${ae}\``).join(", ")} (read by nothing)`}),G})}),r0(o)){let $=o.assignmentRules.map((q,G)=>{if(!Ja(q)||typeof q.slot!="string")return q;let ae=qp(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:$}}let l=$N(o);o=l.graph;for(let $ of l.moved)r.push({nodeId:$,message:"generator / template pin moved into its input"});for(let $ of l.unmoved)i.push({code:`generatorPin/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the generator or template pin cannot be moved (${$.reason}) \u2014 edit the node by hand`});let d=lP(o);o=d.graph;for(let $ of d.moved)r.push({nodeId:$,message:"setFlag `target` / `flagKey` / `value` moved into its inputs"});for(let $ of d.unmoved)i.push({code:`setFlag/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the setFlag properties cannot be moved (${$.reason}) \u2014 edit the node by hand`});let c=mP(o);o=c.graph;for(let $ of c.moved)r.push({nodeId:$,message:"scalar settings moved into inputs"});for(let $ of c.unmoved)i.push({code:`scalar/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`\`${$.key}\` cannot be moved into an input (${$.reason}) \u2014 edit the node by hand`});let u=xP(o);o=u.graph;for(let $ of u.moved)r.push({nodeId:$,message:"payment note moved into `inputs.reason` / retired sample document deleted"});for(let $ of u.unmoved)i.push({code:`nodeConfig/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`\`${$.key}\` cannot be moved into an input (${$.reason}) \u2014 edit the node by hand`});let p=UL(o);o=p.graph;for(let $ of p.moved){let q=o.nodes.find(Z=>Ja(Z)&&Z.id===$),G=q?.inputs?.documentTemplate,ae=G?.kind==="literal"&&typeof G.value=="string"?G.value:null;r.push({nodeId:$,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 $ of p.reports)r.push({nodeId:$.nodeId,message:`cockpit field \`${$.key??""}\` deleted (${$.reason}: ${$.reason==="unknownKey"?"the stamp declares no such parameter":$.reason==="processSource"?"the case fills it itself":"the input already holds a cell"})`});for(let $ of p.unmoved)i.push({code:`templateStamp/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:$.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":$.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=vN(o);o=h.graph;for(let $ of h.moved)r.push({nodeId:$,message:"start node: own `outcomes` / `event` / `effect` deleted (the node type declares its outcome)"});for(let $ of h.unmoved)i.push({code:`eventTrigger/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`the start node cannot be reduced to its type's outcome (${$.reason}) \u2014 edit the node by hand`});let y=yN(o,n.semantics);o=y.graph;for(let $ of y.written){if($.source==="formerDefault"){r.push({nodeId:$.nodeId,message:`outcome \`${$.outcomeId}\`: semantic "${$.semantic}" (DEFAULT \u2014 the meaning it ran with; the retired id parser knew no other)`,defaulted:{answer:"semantic",answerKey:`${$.nodeId}.${$.outcomeId}`,value:$.semantic}});continue}r.push({nodeId:$.nodeId,message:`outcome \`${$.outcomeId}\`: semantic "${$.semantic}" (${$.source==="answer"?"answered":"the meaning the retired id parser gave this id"})`})}for(let $ of y.refused)i.push({code:$.answer===void 0?"outcome/formerMeaningNotAllowed":"outcome/semanticNotAllowed",nodeId:$.nodeId,answer:"semantic",answerKey:`${$.nodeId}.${$.outcomeId}`,candidates:$.allowed,message:$.answer===void 0?`${$.nodeType} outcome \`${$.outcomeId}\` ran as "${dk($.outcomeId)??""}", which a ${$.nodeType} outcome may no longer carry \u2014 say which one it is`:`${$.nodeType} outcome \`${$.outcomeId}\`: "${$.answer}" is not a meaning a ${$.nodeType} outcome may carry`});for(let $ of y.invalid)i.push({code:"outcome/semanticInvalid",nodeId:$.nodeId,answer:"edit",candidates:Nn,message:`outcome \`${$.outcomeId}\` carries the semantic "${$.value}", which is no meaning \u2014 edit it`});let b=AN(o,t.selection,n.waitlistPolicy);o=b.graph;for(let $ of b.moved){let q=$.policy.waitlistOrder;r.push({nodeId:$.nodeId,message:`waitlist policy into inputs: ${k5($.policy)} (${$.source==="answer"?"answered":$.source==="manifest"?"from manifest `selection`":"DEFAULT \u2014 the manifest stated no `selection.waitlistOrder`; the former code default it ran with"})`,...$.source==="formerDefault"?{defaulted:{answer:"waitlistPolicy",answerKey:$.nodeId,value:q}}:{}})}for(let $ of b.refused)i.push({code:`waitlist/${$.reason}`,nodeId:$.nodeId,answer:"waitlistPolicy",answerKey:$.nodeId,candidates:ur,message:"manifest `selection` is malformed \u2014 say the queue order of this waitlist"});let k=IP(o);o=k.graph;for(let $ of k.moved)r.push({nodeId:$,message:"payment: `inputs.settlement` \u2192 `inputs.mode` (separate \u2192 manual)"});for(let $ of k.refused)i.push({code:`collectPayment/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:$.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=PP(o);o=v.graph;for(let $ of v.moved)r.push({nodeId:$.split(".")[0],message:`\`formView\` \u2192 \`view\` (${$})`});for(let $ of v.refused){let q=$.taskKey===void 0?"the node":`task "${$.taskKey}"`;i.push({code:`view/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:$.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 A=qP(o);o=A.graph;for(let $ of A.moved)r.push({nodeId:$.nodeId,message:`\`assign.${$.templateKey}\`: team \u2192 rule list`});for(let $ of A.refused)i.push({code:"assign/shape",nodeId:$.nodeId,answer:"edit",message:`\`assign.${$.templateKey}\` is neither a team key nor a rule list \u2014 set it by hand`});let T=jP(o);o=T.graph;for(let $ of T.moved)r.push({nodeId:$.split(".")[0],message:`documents: \`document:$node.<node>.document\` \u2192 \`artifact:<slot>\` (${$})`});for(let $ of T.refused)i.push({code:`workItems/${$.reason}`,nodeId:$.nodeId,answer:"edit",message:`task "${$.taskKey}" links a document whose node declares no single slot \u2014 name the slot as \`artifact:<slot>\` by hand`});if(AP(o)){let $=TP(o,n.payee);o=$.graph;for(let q of $.set)r.push({nodeId:q.nodeId,message:`online payment: payee "${q.payee}" (answered)`});for(let q of $.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 $ of Qb(o).malformed)i.push({code:"submitReceipt/notificationsMalformed",nodeId:$,answer:"edit",message:"the form node's `notifications` is no record \u2014 edit it by hand"});let I=WL(o);o=I.graph;for(let $ of I.bound)r.push({nodeId:$,message:"submit receipt bound to `notifications.submitted` (`applicant.applicationSubmitted`, sent by code before)"});let D=QL(o);o=D.graph;for(let $ of D.set)r.push({nodeId:$,message:"review: `whenNothingOwed` = park (every review parked before the input existed)"});for(let $ of XL(o).malformed)i.push({code:"appointmentLetters/notificationsMalformed",nodeId:$,answer:"edit",message:"the node's `notifications` is no record \u2014 edit it by hand"});let L=e0(o);o=L.graph;for(let $ of L.bound){let q=$.indexOf(".");r.push({nodeId:$.slice(0,q),message:`appointment letter bound to \`notifications.${$.slice(q+1)}\` (the standard letter, sent by code before)`})}let N=om(o).filter($=>!$.hasTeam);for(let $ of N)i.push({code:"task/userWithoutTeam",nodeId:$.nodeId,answer:"edit",message:`task \`${$.taskKey}\` names a fixed person and no team \u2014 give it a team (\`assign.group\`) by hand`});let x=VP(o);o=x.graph;for(let $ of x.dropped.filter(q=>q.hasTeam))r.push({nodeId:$.nodeId,message:`task \`${$.taskKey}\`: \`assign.userId\` deleted (the team holds the row)`});let F=jL(o,{bindings:!0});o=F.graph;for(let $ of F.dropped){if(!$.binding){r.push({nodeId:$.nodeId,message:`input \`${$.key}\` deleted (no slot of the node declares it)`});continue}r.push({nodeId:$.nodeId,message:`input \`${$.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:`${$.nodeId}.${$.key}`,value:"deleted"}})}return{graph:o,changes:r,refusals:i}}s(s0,"upgradeGraph");function k5(e){return`waitlistOrder=${e.waitlistOrder}`}s(k5,"formatPolicy");function Fr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Fr,"isObject");var a0="admission.generic",l0=Object.keys(Fp).filter(e=>e!=="label");function d0(e){return(Array.isArray(e.testScenarios)?e.testScenarios:[]).filter(n=>Fr(n)&&"env"in n).map(n=>String(n.id))}s(d0,"sampledScenarioIds");function c0(e){return Fr(e.smartforms)?Object.entries(e.smartforms):[]}s(c0,"smartformEntries");function b5(e){let t=[];c0(e.index).some(([,i])=>Fr(i)&&"outcomeFnRef"in i)&&t.push({de:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml",en:"`smartforms.<slug>.outcomeFnRef` in bundle.yaml"});let n=Object.keys(e.manifest).filter(i=>Object.hasOwn(dd,i));if(n.length>0){let i=n.map(o=>`\`${o}\``).join(", ");t.push({de:`manifest.json mit ${i}`,en:`manifest.json with ${i}`})}Object.values(e.smartforms??{}).some(i=>l0.some(o=>o in i))&&t.push({de:"Formulardateien mit `id` / `outcomeIds` / `schoolSlug`",en:"form files with `id` / `outcomeIds` / `schoolSlug`"}),Object.values(e.smartforms??{}).some(i=>d0(i).length>0)&&t.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&&(Fr(r.progressWiring)&&"layoutId"in r.progressWiring&&t.push({de:"`progressWiring.layoutId`",en:"`progressWiring.layoutId`"}),t.push(...o0(r.graph).map(i=>i.what))),t}s(b5,"legacyBundleShapes");function Zm(e,t){let n=b5(e);n.length!==0&&de("BUNDLE_NEEDS_UPGRADE",{de:`offer: ${t} stammt aus einem \xE4lteren Bundle-Format (${n.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: ${t} is in an older bundle format (${n.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(Zm,"assertBundleCurrent");function Qm(e){let t=s(n=>Array.isArray(n)?n.map(t):Fr(n)?Object.fromEntries(Object.keys(n).sort().map(r=>[r,t(n[r])])):n,"sort");return JSON.stringify(t(e))}s(Qm,"canonical");function u0(e,t={}){let n=[],r=[],i=e.index,o=c0(i);if(o.some(([,u])=>Fr(u)&&Object.keys(u).length>0)){let u={};for(let[p,h]of o){if(!Fr(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!==a0){r.push({file:"bundle.yaml",code:"index/smartformEntry",answer:"edit",message:`smartforms.${p} carries ${Object.keys(h).map(k=>`\`${k}\``).join(", ")} \u2014 only \`outcomeFnRef: ${a0}\` is known; edit the entry to {} by hand`}),u[p]=h;continue}n.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,n.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?n.push({file:"manifest.json",message:"`progressLayout` deleted (the bundle has no workflow it could belong to)"}):l.progressLayout===void 0?(l={...l,progressLayout:p},n.push({file:"manifest.json",message:"`progressLayout` moved to workflow.json `progressLayout`"})):Qm(l.progressLayout)===Qm(p)?n.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(dd,u)?dd[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}n.push({file:"manifest.json",message:`\`${u}\` deleted (${h.en})`})}if(l!==void 0){if(Fr(l.progressWiring)&&"layoutId"in l.progressWiring){let{layoutId:p,...h}=l.progressWiring;l={...l,progressWiring:h},n.push({file:"workflow.json",message:"`progressWiring.layoutId` deleted (the layout is the workflow's own)"})}let u=l.graph;if(Fr(u)&&Array.isArray(u.nodes)){let p=s0(u,{selection:d,answers:t});l={...l,graph:p.graph},n.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 l0)if(v in h){if(v==="outcomeIds"){let A=Array.isArray(h.outcomes)?h.outcomes.map(T=>Fr(T)?T.id:void 0):[];if(Qm([...Array.isArray(h.outcomeIds)?h.outcomeIds:[]].map(String).sort())!==Qm(A.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],n.push({file:b,message:`\`${v}\` deleted (${Fp[v].en})`})}let k=d0(h);k.length>0&&(y.testScenarios=h.testScenarios.map(v=>{if(!Fr(v)||!("env"in v))return v;let{env:A,...T}=v;return T}),n.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:n,refusals:r}}s(u0,"upgradeOfferBundle");var v5={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},LTe={createManifest:mn.workflow.createManifestInternal,publishManifest:mn.workflow.publishManifestInternal,publishOfferInternal:mn.workflow.publishOfferInternalInternal,publishOfferExternal:mn.workflow.publishOfferExternalInternal,getOfferPublishState:mn.workflow.getOfferPublishStateInternal,upsertCustomField:mn.admission.upsertCustomFieldInternal,upsertDerivedAttributeRule:mn.admission.upsertDerivedAttributeRuleInternal,createSmartForm:mn.forms.createSmartFormInternal,getSmartFormBySlug:mn.forms.getSmartFormBySlugInternal,saveSmartFormDraft:mn.forms.saveSmartFormDraftInternal,publishSmartForm:mn.forms.publishSmartFormInternal,createWorkflow:mn.workflow.createWorkflowInternal,getWorkflowGraph:mn.workflow.getWorkflowGraphInternal,saveWorkflowDraft:mn.workflow.saveWorkflowDraftInternal,publishWorkflow:mn.workflow.publishWorkflowInternal};function tv(e,t){for(let[n,r]of Object.entries(e.smartforms??{})){(r===null||typeof r!="object"||Array.isArray(r))&&de("INVALID",{de:`offer: ${t}: smartforms.${n} muss eine leere Zuordnung ({}) sein.`,en:`offer: ${t}: smartforms.${n} 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: ${t}: smartforms.${n} 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: ${t}: smartforms.${n} 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(tv,"assertSmartformEntries");function f0(e){let t=s(n=>Array.isArray(n)?n.map(t):n&&typeof n=="object"?Object.fromEntries(Object.keys(n).sort().map(r=>[r,t(n[r])])):n,"sort");return JSON.stringify(t(e))}s(f0,"canonicalJson");function p0(e,t){return t==null?!0:f0(e)!==f0(t)}s(p0,"changed");async function m0(e,t,n,r={},i=v5){let{index:o}=t;Zm({index:o,manifest:t.manifest,...t.smartforms!==void 0?{smartforms:t.smartforms}:{},...t.workflow!==void 0?{workflow:t.workflow}:{}},`bundle of ${o.slugs.manifest}`),tv(o,`bundle of ${o.slugs.manifest}`);let a=Dp(t.manifest);a.length>0&&de("INVALID",{de:`offer: manifest.json von ${o.slugs.manifest} ist ung\xFCltig:
|
|
11726
11726
|
- ${a.join(`
|
|
11727
11727
|
- `)}`,en:`offer: manifest.json of ${o.slugs.manifest} is invalid:
|
|
11728
11728
|
- ${a.join(`
|
|
@@ -11995,7 +11995,7 @@ ${n.length} unusable ${o}:
|
|
|
11995
11995
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
11996
11996
|
`),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>
|
|
11997
11997
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
11998
|
-
`);return n.length>0?1:0}},TE=class extends Rr{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 n=await(await this.caller()).mutation(S.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function Cz(e,t){if(e===t)throw new g("Pass exactly one of --on or --off.");return e}s(Cz,"requireOnOff");var Dz=[lE,dE,cE,uE,fE,pE,mE,hE,gE,yE,sf,wE,kE,bE,vE,xE,SE,AE,TE];function Fz(e){return e.de??e.en??Object.values(e)[0]??""}s(Fz,"titleDe");function Dte(e){return{id:e._id,kind:e.kind,status:e.status,title:Fz(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(Dte,"row");var Fte=["id","kind","status","title","assignee","group","outcome"],EE=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 t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.list,{client:n,...this.mine?{mine:!0}:{},...this.application?{applicationId:te(this.application,"application")}:{},...this.group?{queueGroupId:te(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:te(this.assignee,"user")}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(Dte),Fte),0}},IE=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 t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.get,{client:n,workItemId:te(this.workItemId,"work item")});if(r===null)throw new g(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:Fz(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}},OE=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 t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.createManual,{client:n,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:te(this.application,"application")}:{},...this.group?{queueGroupId:te(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:te(this.assignee,"user")}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},_E=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 t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.complete,{client:n,workItemId:te(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}},NE=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 t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.assign,{client:n,workItemId:te(this.workItemId,"work item"),...this.user?{userId:te(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}},Lz=[EE,IE,OE,_E,NE];var Tl=[...$_,...J0,...oM,...cq,...mq,...dq,...Kq,...Wq,...zq,...Nz,...Dz,..._z,...fG,...wG,...SG,...C0,...Fq,...kz,...A_,...rN,...k0,...Jq,...Hq,...Xq,...nK,...Cq,...bq,...Lz,...SB,...fU,...cG,...pU,...rz,...cz,...AG,...PG,...FG,...KG,...VG,...pz,...Az,...W_];for(let e of Tl){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:KI(e.usage.category,t.join(" "))})}var Mz="0.1.338";function PE(){return Tl.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=FI[zo(n)];return{path:n,effect:vi(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(PE,"plexusCommandCatalog");import js from"node:path";function Lte(e){let t=mt()?.workspaceRoot??process.cwd(),n=js.resolve(t,e),r=js.relative(t,n);if(js.isAbsolute(e)||r===".."||r.startsWith(`..${js.sep}`))throw new g("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(Lte,"workspacePath");function Mte(e){let{absolute:t,relative:n}=Lte(e.path??".");if(e.operation==="list"){if(!Re(t))return{files:[]};let r=[],i=s(o=>{for(let a of Wr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new g("plexus: workspace symlinks are not supported.");let l=js.join(o,a.name);if(a.isDirectory()?i(l):r.push(js.relative(t,l)),r.length>200)throw new g("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new g("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=Ne(t);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:n,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:n,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 Qe(t,a,"utf8"),{path:n,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 zt(js.dirname(t),{recursive:!0}),Qe(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Gs(t),{path:n,removed:!0};throw new g("plexus: unknown workspace operation.")}s(Mte,"plexusWorkspace");function qz(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new g("plexus: tool input must be an object.");let i=r,o=od[n];if(!o||!Object.hasOwn(od,n))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(n==="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(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(Cw,i.path))throw new g("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:Cw[i.path],skillHash:wp}}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 Mte(i)},"executePlexusAgentTool")}s(qz,"createPlexusAgentToolExecutor");var qte=["--env","--tenant"];function Kz(e){let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i==="--"){t.push(...e.slice(r));break}let o=qte.find(l=>i===l||i.startsWith(`${l}=`)),a=e[r+1];o===void 0?t.push(i):i!==o?n.push({name:o,value:i.slice(o.length+1)}):a!==void 0&&!a.startsWith("-")?(n.push({name:o,value:a}),r++):t.push(i)}return{rest:t,given:n}}s(Kz,"splitGlobalOptions");function jz(e,t){let n=Wy(e)==="offline";if(n&&vi(e)==="read")return t.map(i=>`plexus-cli: ${i.name} ${i.value} has no effect: \`${e}\` runs offline (this CLI's own files, no deployment).
|
|
11998
|
+
`);return n.length>0?1:0}},TE=class extends Rr{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 n=await(await this.caller()).mutation(S.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function Cz(e,t){if(e===t)throw new g("Pass exactly one of --on or --off.");return e}s(Cz,"requireOnOff");var Dz=[lE,dE,cE,uE,fE,pE,mE,hE,gE,yE,sf,wE,kE,bE,vE,xE,SE,AE,TE];function Fz(e){return e.de??e.en??Object.values(e)[0]??""}s(Fz,"titleDe");function Dte(e){return{id:e._id,kind:e.kind,status:e.status,title:Fz(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(Dte,"row");var Fte=["id","kind","status","title","assignee","group","outcome"],EE=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 t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.list,{client:n,...this.mine?{mine:!0}:{},...this.application?{applicationId:te(this.application,"application")}:{},...this.group?{queueGroupId:te(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:te(this.assignee,"user")}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(Dte),Fte),0}},IE=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 t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.get,{client:n,workItemId:te(this.workItemId,"work item")});if(r===null)throw new g(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:Fz(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}},OE=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 t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.createManual,{client:n,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:te(this.application,"application")}:{},...this.group?{queueGroupId:te(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:te(this.assignee,"user")}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},_E=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 t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.complete,{client:n,workItemId:te(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}},NE=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 t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.assign,{client:n,workItemId:te(this.workItemId,"work item"),...this.user?{userId:te(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}},Lz=[EE,IE,OE,_E,NE];var Tl=[...$_,...J0,...oM,...cq,...mq,...dq,...Kq,...Wq,...zq,...Nz,...Dz,..._z,...fG,...wG,...SG,...C0,...Fq,...kz,...A_,...rN,...k0,...Jq,...Hq,...Xq,...nK,...Cq,...bq,...Lz,...SB,...fU,...cG,...pU,...rz,...cz,...AG,...PG,...FG,...KG,...VG,...pz,...Az,...W_];for(let e of Tl){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:KI(e.usage.category,t.join(" "))})}var Mz="0.1.340";function PE(){return Tl.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=FI[zo(n)];return{path:n,effect:vi(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(PE,"plexusCommandCatalog");import js from"node:path";function Lte(e){let t=mt()?.workspaceRoot??process.cwd(),n=js.resolve(t,e),r=js.relative(t,n);if(js.isAbsolute(e)||r===".."||r.startsWith(`..${js.sep}`))throw new g("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(Lte,"workspacePath");function Mte(e){let{absolute:t,relative:n}=Lte(e.path??".");if(e.operation==="list"){if(!Re(t))return{files:[]};let r=[],i=s(o=>{for(let a of Wr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new g("plexus: workspace symlinks are not supported.");let l=js.join(o,a.name);if(a.isDirectory()?i(l):r.push(js.relative(t,l)),r.length>200)throw new g("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new g("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=Ne(t);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:n,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:n,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 Qe(t,a,"utf8"),{path:n,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 zt(js.dirname(t),{recursive:!0}),Qe(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Gs(t),{path:n,removed:!0};throw new g("plexus: unknown workspace operation.")}s(Mte,"plexusWorkspace");function qz(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new g("plexus: tool input must be an object.");let i=r,o=od[n];if(!o||!Object.hasOwn(od,n))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(n==="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(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(Cw,i.path))throw new g("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:Cw[i.path],skillHash:wp}}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 Mte(i)},"executePlexusAgentTool")}s(qz,"createPlexusAgentToolExecutor");var qte=["--env","--tenant"];function Kz(e){let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i==="--"){t.push(...e.slice(r));break}let o=qte.find(l=>i===l||i.startsWith(`${l}=`)),a=e[r+1];o===void 0?t.push(i):i!==o?n.push({name:o,value:i.slice(o.length+1)}):a!==void 0&&!a.startsWith("-")?(n.push({name:o,value:a}),r++):t.push(i)}return{rest:t,given:n}}s(Kz,"splitGlobalOptions");function jz(e,t){let n=Wy(e)==="offline";if(n&&vi(e)==="read")return t.map(i=>`plexus-cli: ${i.name} ${i.value} has no effect: \`${e}\` runs offline (this CLI's own files, no deployment).
|
|
11999
11999
|
`);let r=[...new Set(t.map(i=>i.name))].join(", ");throw new g(n?`\`${e}\` does not take ${r}: it never targets a chosen deployment \u2014 drop the option.`:`\`${e}\` does not take ${r}.`)}s(jz,"globalOptionNotes");var wy=qz({inspectCommand:Bz,executeCommand:Uz});function ky(){let e=new Hs({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:Mz});e.register(Ll.HelpCommand),e.register(Ll.VersionCommand);for(let r of Tl)e.register(r);function t(r,i){try{return{command:e.process(r,i),notes:[]}}catch(o){let{rest:a,given:l}=Kz(r);if(l.length===0)throw o;let d;try{d=e.process(a,i)}catch{throw o}if(!Tl.some(u=>d instanceof u))return{command:d,notes:[]};let c=d.path.join(" ");if(!PE().some(u=>u.path===c))throw o;return{command:d,notes:jz(c,l)}}}s(t,"resolve");async function n(r,i){let o=i.stderr??process.stderr,a;try{a=t(r,i)}catch(l){return o.write(e.error(l,{colored:!1})),2}for(let l of a.notes)o.write(l);return Vte(a.command,o),e.run(a.command,i)}return s(n,"run"),{process(r,i){return t(r,i).command},run:n,async runExit(r,i){process.exitCode=await n(r,i)}}}s(ky,"createPlexusCli");function Vte(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&Bl[n]===r&&ft(t,n,r),n in Bl&&vi(n)==="confirm"&&!Ul(e)&&t.write(`plexus-cli: \`${Bl[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
12000
12000
|
`)}s(Vte,"noteRetiredPath");function Bz(e){let t=ky().process(El(e),{executePlexusAgentTool:wy}),n=t.path.join(" ");if(n.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=PE().find(l=>l.path===n);if(!r){if(n===""||n==="--help"||n==="--version")return{path:n,writes:!1,host:"shared"};throw new Error(`plexus: command ${n} has no host classification.`)}let i=t,o=r.effect==="callKind"?Oh(sl(al),i.fn??"",i.kind):void 0,a=jf(n,{confirm:Ul(t),callKind:o});return{...r,writes:a}}s(Bz,"inspectPlexusCommand");async function Uz(e,t){if(t)return KE(t,()=>Uz(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 n="",r="",i=ky();if(mt()){let l=Bz(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(El(e.argv),{executePlexusAgentTool:wy,stdin:jte.from(e.stdin===void 0?[]:[e.stdin]),stdout:new Vz({write(l,d,c){n+=String(l),c()}}),stderr:new Vz({write(l,d,c){r+=String(l),c()}})}),stdout:n,stderr:r}}s(Uz,"executePlexusCommand");ME();GE({source:Bte.join(import.meta.dirname,"skill")});ky().runExit(El(process.argv.slice(2)),{executePlexusAgentTool:wy});
|
|
12001
12001
|
//# sourceMappingURL=cli.mjs.map
|