@smartkomm/plexus-cli 0.1.235 → 0.1.237
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs
CHANGED
|
@@ -7686,7 +7686,8 @@ Order matters; each step names why.
|
|
|
7686
7686
|
expired) are left out, live refuses them, and their open Engage task closes with them.
|
|
7687
7687
|
Every opened task \u201EEngage-\xDCbertragung pr\xFCfen" ends with \u201EJetzt live \xFCbertragen" (or with a
|
|
7688
7688
|
fixed answer + \u201EProbelauf wiederholen" when the dry run lists issues). Test applications
|
|
7689
|
-
|
|
7689
|
+
open no task; with target \`sandbox\` a person may still press \u201EJetzt live \xFCbertragen" on
|
|
7690
|
+
their dry run, with target \`production\` they never go live.
|
|
7690
7691
|
|
|
7691
7692
|
## Gotchas
|
|
7692
7693
|
- **Engage has no idempotency key.** Never re-run a push by hand: \u201EErneut \xFCbertragen"
|
|
@@ -11096,7 +11097,7 @@ plexus-cli --env prod jobs list --status running # nothing unexpectedly in
|
|
|
11096
11097
|
## Related
|
|
11097
11098
|
- Command reference: \`plexus-cli jobs list --help\`, \`plexus-cli platform workers reap --help\`,
|
|
11098
11099
|
\`plexus-cli platform imports cleanup-orphaned --help\`.
|
|
11099
|
-
`};var Zf="beb77e29d41a24e9e7d798e82609379951a54db2287712260ff3f84e5dc41964",rw=aO;var iw=class extends xe{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=R.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:Zf,tools:Bl}),0}},ow=class extends xe{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=R.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let n=JSON.parse(await tw(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},lO=[iw,ow];var sw=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],Qce=new Set(sw.map(e=>e.key));var Ye=["de","en"];function Bs(e,n){return Ye.every(t=>e[t]===n[t])}s(Bs,"sameText");function Dn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!Ye.includes(r))?"not-localized":Ye.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Dn,"missingLocales");function Ui(e){let n=Dn(e);return n!=="not-localized"&&n.length===0}s(Ui,"isLocalizedText");function Ul(e,n){let t={};for(let r of Ye){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(Ul,"composeTexts");function Xf(e){return e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}s(Xf,"slugify");var dO="tenant";function cO(e){if(e.length===0||Xf(e)!==e)return"must be lowercase a-z/0-9 words joined by single dashes";if(e===dO)return`"${dO}" is reserved for the tenant-wide scope`}s(cO,"unitSlugError");var I1=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function nr(e,n){return`${e}-${n}`}s(nr,"runStorageKey");function uO(e,n){typeof n!="string"&&ae("CONFLICT",{de:`[run/keyNotServed] Das Deployment liefert f\xFCr ein Schuljahr von \u201E${e}\u201C keinen Schl\xFCssel \u2014 es l\xE4uft ein \xE4lteres Release als die CLI. Nach dem n\xE4chsten Release erneut versuchen.`,en:`[run/keyNotServed] The deployment provides no key for a school year of "${e}" \u2014 it runs an older release than the CLI. Try again after the next release.`});let t=`${e}-`;return(!n.startsWith(t)||n.length===t.length)&&ae("CONFLICT",{de:`[run/foreignKey] Der Schl\xFCssel \u201E${n}\u201C des Schuljahrs liegt nicht unter dem Programm \u201E${e}\u201C (erwartet: \u201E${t}<key>\u201C).`,en:`[run/foreignKey] The key "${n}" of the school year is not under the program "${e}" (expected: "${t}<key>").`}),n.slice(t.length)}s(uO,"bareRunKey");function ep(e){let n=[],t=new Map;return e.forEach((r,i)=>{let o=Dn(r.name),a=o!=="not-localized"&&!o.includes("de")?r.name.de:void 0,l=`program.runs[${i}]${a!==void 0?` ("${a}")`:""}`;o==="not-localized"||o.length===2?n.push({code:"run/nameMissing",index:i,message:{de:`[run/nameMissing] ${l}: jedes Schuljahr braucht einen \`name\` auf Deutsch und Englisch (\`{ de, en }\`)`,en:`[run/nameMissing] ${l}: every run needs a \`name\` in German and English (\`{ de, en }\`)`}}):o.length>0&&n.push({code:"run/nameUntranslated",index:i,message:{de:`[i18n/missingTranslation] ${l}.name fehlt in: ${o.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${l}.name is missing in: ${o.join(", ")} \u2014 every displayed text needs German and English.`}});let d=r.key;if(d==null||d===""){n.push({code:"run/keyMissing",index:i,message:{de:`[run/keyMissing] ${l}: jedes Schuljahr braucht einen stabilen \`key\` \u2014 der Name dient nur der Anzeige`,en:`[run/keyMissing] ${l}: every run needs a stable \`key\` \u2014 the name is display only`}});return}if(typeof d!="string"||!I1.test(d)){n.push({code:"run/keyInvalid",index:i,message:{de:`[run/keyInvalid] ${l}: der Schl\xFCssel ${JSON.stringify(d)} muss ein kleingeschriebener Slug sein (a-z, 0-9, einzelnes \u201E-\u201C)`,en:`[run/keyInvalid] ${l}: key ${JSON.stringify(d)} must be a lowercase slug string (a-z, 0-9, single "-")`}});return}let c=t.get(d);if(c!==void 0){n.push({code:"run/duplicateKey",index:i,message:{de:`[run/duplicateKey] ${l}: der Schl\xFCssel \u201E${d}\u201C wird bereits von program.runs[${c}] verwendet`,en:`[run/duplicateKey] ${l}: key "${d}" is already used by program.runs[${c}]`}});return}t.set(d,i)}),n}s(ep,"runSpecIssues");var O1="-stufe-",_1=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function aw(e){return`${e}${O1}`}s(aw,"stageKeyPrefix");function Us(e,n){return`${aw(e)}${n}`}s(Us,"stageStorageKey");function pO(e,n){let t=aw(e);return n.startsWith(t)&&n.length>t.length}s(pO,"isUnderProgram");function Yr(e,n){let t=aw(e);return pO(e,n)||ae("CONFLICT",{de:`[stage/foreignKey] Der Stufenschl\xFCssel \u201E${n}\u201C liegt nicht unter dem Programm \u201E${e}\u201C (erwartet: \u201E${t}<key>\u201C). F\xFChren Sie die Stufe in bundle.yaml unter einem neuen Schl\xFCssel auf; der n\xE4chste Apply archiviert diese Zeile (hinter der Archivsperre) und legt die Stufe mit dem neuen Schl\xFCssel an.`,en:`[stage/foreignKey] The level key "${n}" is not under the program "${e}" (expected: "${t}<key>"). List the level in bundle.yaml under a new key; the next apply archives this row (behind the archive lock) and creates the level with the new key.`}),n.slice(t.length)}s(Yr,"bareStageKey");function np(e){let n=[],t=new Map;return e.forEach((r,i)=>{let o=Dn(r.name),a=o!=="not-localized"&&!o.includes("de")?r.name.de:void 0,l=`program.stages[${i}]${a!==void 0?` ("${a}")`:""}`;o==="not-localized"||o.length===2?n.push({code:"stage/nameMissing",index:i,message:{de:`[stage/nameMissing] ${l}: jede Klassenstufe braucht einen \`name\` auf Deutsch und Englisch (\`{ de, en }\`)`,en:`[stage/nameMissing] ${l}: every stage needs a \`name\` in German and English (\`{ de, en }\`)`}}):o.length>0&&n.push({code:"stage/nameUntranslated",index:i,message:{de:`[i18n/missingTranslation] ${l}.name fehlt in: ${o.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${l}.name is missing in: ${o.join(", ")} \u2014 every displayed text needs German and English.`}});let d=r.key;if(d==null||d===""){n.push({code:"stage/keyMissing",index:i,message:{de:`[stage/keyMissing] ${l}: jede Klassenstufe braucht einen stabilen \`key\` \u2014 der Name dient nur der Anzeige`,en:`[stage/keyMissing] ${l}: every stage needs a stable \`key\` \u2014 the name is display only`}});return}if(typeof d!="string"||!_1.test(d)){n.push({code:"stage/keyInvalid",index:i,message:{de:`[stage/keyInvalid] ${l}: der Schl\xFCssel ${JSON.stringify(d)} muss ein kleingeschriebener Slug sein (a-z, 0-9, einzelnes \u201E-\u201C)`,en:`[stage/keyInvalid] ${l}: key ${JSON.stringify(d)} must be a lowercase slug string (a-z, 0-9, single "-")`}});return}let c=t.get(d);if(c!==void 0){n.push({code:"stage/duplicateKey",index:i,message:{de:`[stage/duplicateKey] ${l}: der Schl\xFCssel \u201E${d}\u201C wird bereits von program.stages[${c}] verwendet`,en:`[stage/duplicateKey] ${l}: key "${d}" is already used by program.stages[${c}]`}});return}t.set(d,i)}),n}s(np,"stageSpecIssues");function fO(e){return{de:e.de.trim(),en:e.en.trim()}}s(fO,"trimmedText");function P1(e,n){let t=[];return e.de!==n.de&&t.push(`"${e.de}" \u2192 "${n.de}"`),e.en!==n.en&&t.push(`en "${e.en}" \u2192 "${n.en}"`),t.join(", ")}s(P1,"describeNameChange");function tp(e,n,t){if(e===null)return n.length>0&&F("planStageReconcile: stages exist but the offer has no program key"),t.map((a,l)=>({op:"insert",key:a.key,name:fO(a.name),...a.gradeLevel!==void 0?{gradeLevel:a.gradeLevel}:{},sequence:l+1}));let r=new Map(n.map(a=>[a.key,a])),i=new Set,o=[];t.forEach(({name:a,...l},d)=>{let c={...l,name:fO(a)},u=Us(e,c.key);i.add(u);let p=d+1,h=r.get(u);if(h===void 0){o.push({op:"insert",key:c.key,name:c.name,...c.gradeLevel!==void 0?{gradeLevel:c.gradeLevel}:{},sequence:p});return}let y={};Bs(h.name,c.name)||(y.name=[h.name,c.name]);let k=h.gradeLevel??null,w=c.gradeLevel??null;k!==w&&(y.gradeLevel=[k,w]),h.sequence!==p&&(y.sequence=[h.sequence,p]),(Object.keys(y).length>0||h.archived)&&o.push({op:"update",key:c.key,stageId:h.stageId,name:c.name,changes:y,unarchive:h.archived})});for(let a of[...n].sort((l,d)=>l.sequence-d.sequence))a.archived||i.has(a.key)||o.push({op:"archive",key:pO(e,a.key)?Yr(e,a.key):a.key,stageId:a.stageId,name:a.name});return o}s(tp,"planStageReconcile");function rp(e){switch(e.op){case"insert":return`+stage ${e.key} (${e.name.de})`;case"archive":{let n=e.occupancy,t=[...n&&n.activeApplications>0?[`REFUSED: ${n.activeApplications} active application(s) \u2014 [stage/hasActiveApplications]`]:[],...n&&n.openLeads>0?[`${n.openLeads} open lead(s)`]:[]];return`-stage ${e.key} (${e.name.de})${t.length>0?` \u2014 ${t.join("; ")}`:""}`}case"update":{let n=[];if(e.unarchive&&n.push("restored"),e.changes.name&&n.push(P1(e.changes.name[0],e.changes.name[1])),e.changes.gradeLevel){let[t,r]=e.changes.gradeLevel;n.push(`grade ${t??"\u2013"} \u2192 ${r??"\u2013"}`)}return e.changes.sequence&&n.push(`position ${e.changes.sequence[0]} \u2192 ${e.changes.sequence[1]}`),`~stage ${e.key} (${n.join(", ")})`}}}s(rp,"describeStageStep");function ip(e,n){return n.startsWith(e)&&n.length>e.length?n.slice(e.length):void 0}s(ip,"bareUnder");function hO(e,n,t,r){let i=e.flatMap(y=>y.angebote).find(y=>y.offerKey===n);if(i===void 0){let y=e.flatMap(k=>k.angebote.map(w=>w.offerKey));throw new We(`applications start-test: no offer "${n}" (offers: ${y.join(", ")||"none"})`)}if(i.programKey===void 0)throw new We("applications start-test: the deployment does not serve the offer's program key \u2014 it runs an older release than the CLI; try again after the next release");let o=i.programKey;if(o===null)throw new We(`applications start-test: ${n} has no program yet \u2014 no level to start on`);let a=Us(o,""),l=nr(o,""),d=s(y=>ip(a,y)??"(no bundle key)","stageLabel"),c=s(y=>ip(l,y)??"(no bundle key)","runLabel"),u=i.stages.find(y=>y.stageKey===Us(o,r)||y.stageId===r);if(u===void 0){let y=i.stages.map(b=>`${d(b.stageKey)} (${b.stageId})`).join(", "),k=ip(a,r),w=k!==void 0&&i.stages.some(b=>b.stageKey===r)?` \u2014 "${r}" is the stored key; the export names it "${k}"`:"";throw new We(`applications start-test: no level "${r}" in ${n}${w} \u2014 name it by its bundle key or id: ${y}`)}let p=d(u.stageKey),h=u.runs.find(y=>y.runKey===nr(o,t)||y.runId===t);if(h===void 0){let y=u.runs.map(b=>`${c(b.runKey)} (${b.runId})`).join(", "),k=ip(l,t),w=k!==void 0&&u.runs.some(b=>b.runKey===t)?` \u2014 "${t}" is the stored key; the export names it "${k}"`:"";throw new We(`applications start-test: no school year "${t}" for level ${p}${w} \u2014 name it by its bundle key or id: ${y}`)}if(!h.isOpen)throw new We(`applications start-test: school year ${c(h.runKey)} is closed for level ${p}`);return{programRunId:h.runId,programStageId:u.stageId}}s(hO,"resolveStartTarget");function N1(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(N1,"applicantText");function gO(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:N1(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(gO,"applicationRows");var mO=sw.map(e=>e.email);function yO(e,n,t,r){if(t===void 0&&r===void 0)throw new We("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(t!==void 0&&r!==void 0)throw new We("applications start-test: --party or --applicant, not both");if(Xy(e,n)&&(r===void 0||!mO.includes(r.trim().toLowerCase())))throw new We(`applications start-test: on prod only for the test account ${mO.join(", ")} (--applicant) \u2014 never a real family's`)}s(yO,"assertStartApplicant");function wO(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(wO,"processStoreJson");function C1(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.snapshotNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.snapshotNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(C1,"refText");function D1(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?C1(e.ref):JSON.stringify(e.value)}s(D1,"holds");function kO(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:D1(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(kO,"storeRows");function op(e){let n={},t={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new Error(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(t,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);t[o]=a;try{n[o]=JSON.parse(a)}catch{n[o]=a}}return{values:n,raw:t}}s(op,"parseKv");var bO="started",sp="submitted",ap="submitted",vO="load-scenario:";var xO="(Bewerbung)";function SO(e){return{nodeId:xO,actions:e.map(n=>({id:n.id,label:{de:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`,en:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`},...n.disabledReason===void 0?{}:{disabledReason:n.disabledReason}}))}}s(SO,"sharedAsList");function AO(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(AO,"disabledText");function EO(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:AO(r)})))}s(EO,"actionRows");function TO(e,n,t=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===n));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new Error(`test-actions run: no current node offers "${n}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${n}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===n);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${n}" on ${i} is disabled: ${AO(a)}`);if(i!==xO)return i;let l=t[0];if(l===void 0)throw new Error(`test-actions run: "${n}" needs a current node \u2014 the application has none`);return l}s(TO,"nodeOfferingAction");function RO(e,n,t){if(e.startsWith(vO)){if(Object.hasOwn(t,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:n,...t}}return Object.keys(t).length===0?void 0:{...t}}s(RO,"runParams");async function F1(e,n){let t=await e.query(x.workflow.getInstance,{applicationId:n});if(t===null)throw new Error(`test-actions: application ${n} has no workflow instance`);return t.instance.currentNodeIds}s(F1,"currentNodeIds");function L1(e,n){switch(n){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${n} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(L1,"refusalText");async function lp(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${L1(n,r.reason)}`);let i=[];for(let o of t){let a=await e.query(x.workflow.listTestActions,{applicationId:n,nodeId:o});if(a===null)throw new Error(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,SO(r.actions)]}s(lp,"actionsOf");async function $O(e,n,t){return t!==void 0?[t]:await F1(e,n)}s($O,"nodesOf");var lw=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=R.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await lp(n,this.application,await $O(n,this.application,this.node));return this.print(t,EO,["node","action","label","disabled"]),0}},dw=class extends D{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=R.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=RO(this.action,this.autoSubmit,op(this.param??[]).values),t=await this.caller(),r=this.application,i=await $O(t,this.application,this.node),o=TO(await lp(t,r,i),this.action,i);return await t.mutation(x.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...n===void 0?{}:{params:n}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},IO=[lw,dw];var Sr=/^[a-z][A-Za-z0-9]*$/;function cw(e){return typeof e=="string"&&Sr.test(e)}s(cw,"isNodeId");function Gs(e,n){cw(e)||F(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${Sr.source}.`);let t=new Set(n);if(!t.has(e))return e;let r=2;for(;t.has(`${e}${r}`);)r++;return`${e}${r}`}s(Gs,"makeNodeId");var zi="$env";function de(e){if(e.scope==="env")return`${zi}.${e.key}`;let n=`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(de,"formatAddress");var Gi=/^[a-z][a-zA-Z0-9_]*$/,M1=/^[A-Za-z_][A-Za-z0-9_]*$/;function _o(e){return typeof e=="string"&&e.split(".").every(n=>M1.test(n))}s(_o,"isPath");function ci(e){if(!e.startsWith("$"))return null;let n=e.slice(1).split("."),[t,...r]=n;switch(t){case"env":{let i=r.join(".");return r.length>0&&_o(i)?{scope:"env",key:i}:null}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Gi.test(o)||(t==="node"?!Sr.test(i):!Gi.test(i))?null:q1({scope:t,owner:i,key:o},a)}default:return null}}s(ci,"tryParseAddress");function q1(e,n){if(n.length===0)return e;let t=n.join(".");return _o(t)?{...e,path:t}:null}s(q1,"withPath");function we(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!_o(n.path))return!1;switch(n.scope){case"env":return _o(n.key);case"node":return typeof n.owner=="string"&&Sr.test(n.owner)&&typeof n.key=="string"&&Gi.test(n.key);case"task":return typeof n.owner=="string"&&Gi.test(n.owner)&&typeof n.key=="string"&&Gi.test(n.key);default:return!1}}s(we,"isAddress");var ui={offer:{key:"string",title:"string"},unit:{key:"string",name:"string"},stage:{key:"string",name:"string",gradeLevel:"number"},run:{key:"string",name:"string",startDate:"date"},applicant:{language:"enum",channel:"enum"}},zs=Object.keys(ui);function Ws(e){return Object.hasOwn(ui,e)}s(Ws,"isEnvKey");var K1=["self-service","staff"];function OO(e,n){return{kind:"fixed",values:e,labels:n}}s(OO,"fixedSet");var dp={of:"applicant.language",withoutValue:"de"},fi={"offer.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Angebot",en:"Offer"}},"offer.title":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Titel des Angebots",en:"Offer title"},nameLanguage:dp},"unit.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Einheit",en:"Unit"}},"unit.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Einheit",en:"Unit name"},nameLanguage:dp},"stage.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Klassenstufe (Schl\xFCssel)",en:"Grade (key)"},cohortBound:!0},"stage.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Klassenstufe",en:"Grade name"},cohortBound:!0,nameLanguage:dp},"stage.gradeLevel":{valueSet:{kind:"open"},nullable:!0,absent:{de:"Die Stufe hat keine Klassenstufe (Kindergarten).",en:"The stage has no grade level (Kindergarten)."},label:{de:"Klassenstufe",en:"Grade level"},cohortBound:!0},"run.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Schuljahr",en:"School year"},cohortBound:!0},"run.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name des Schuljahrs",en:"School year name"},cohortBound:!0,nameLanguage:dp},"run.startDate":{valueSet:{kind:"open"},nullable:!0,absent:{de:"F\xFCr das Schuljahr ist kein Beginn erfasst.",en:"The school year has no start date."},label:{de:"Beginn des Schuljahrs",en:"School year start"},cohortBound:!0},"applicant.language":{valueSet:OO(Ye,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:OO(K1,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},cp={types:ui,fields:fi},up=zs.flatMap(e=>Object.keys(ui[e]).map(n=>`${e}.${n}`));function tr(e){return Object.hasOwn(fi,e)}s(tr,"isEnvLeaf");function fp(e){return`${zi}.${e}`}s(fp,"envIdentifier");function Po(e){let n=fi[e],[t,r]=e.split("."),i=ui[t][r];i===void 0&&F(`[env] leaf "${e}" has no type`);let o=n.valueSet;return{leaf:e,type:i,label:n.label,nullable:n.nullable,...n.absent===void 0?{}:{absent:n.absent},...n.nameLanguage===void 0?{}:{nameLanguage:n.nameLanguage},...n.cohortBound===void 0?{}:{cohortBound:n.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&F(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(Po,"envLeaf");var _O="staffInput";var j1=["boolean"],Gl=/^[a-z][A-Za-z0-9]*$/;function pp(e){return e.staffInputs??[]}s(pp,"staffInputsOf");function mp(e){return`${_O}.${e}`}s(mp,"staffInputLeaf");function PO(e){return`${zi}.${mp(e)}`}s(PO,"staffInputIdentifier");function V1(e){let n=`${_O}.`;return e.startsWith(n)?e.slice(n.length):null}s(V1,"staffInputKeyOfLeaf");function Ys(e,n){let t=V1(n);return t===null?void 0:pp(e).find(r=>r.key===t)}s(Ys,"declaredStaffInput");function NO(e){return[...pp(e).map(n=>({leaf:mp(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...up.map(n=>{let t=Po(n);return{leaf:n,type:t.type,label:t.label,valueSet:fi[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(NO,"envLeavesFor");function CO(e){return NO(e).filter(n=>!n.cohortBound)}s(CO,"conditionEnvLeaves");function DO(e){return LO(CO(e))}s(DO,"envConditionSchemaFor");function B1(e){return NO(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(B1,"offerConditionEnvLeaves");function FO(e){return LO(B1(e))}s(FO,"offerConditionSchemaFor");function LO(e){let n={},t={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of e){let[l="",d=""]=r.split(".");n[l]={...n[l]??{},[d]:i},t[r]={valueSet:o,nullable:a}}return{types:n,fields:t}}s(LO,"schemaOfLeaves");function MO(e){let n=e.staffInputs;if(n===void 0)return[];if(!Array.isArray(n))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let t=[],r=new Set;return n.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){t.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};Gl.test(l.key)||t.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&t.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),j1.includes(l.type)||t.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=Dn(l.label);c==="not-localized"?t.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&t.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),t}s(MO,"staffInputIssues");var bw={required:!0,description:"Offer slug (its offerKey)"},uw=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=R.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",bw);testOnly=f.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let n=await this.caller(),t=await n.query(x.admission.listForAngebot,{client:this.requireTenant(n),offerKey:this.offer}),r=gO(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},fw=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=R.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",bw);async execute(){let n=await this.caller(),t=await n.query(x.admission.getCountsByListForAngebot,{client:this.requireTenant(n),offerKey:this.offer});return this.print(t,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},pw=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=R.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=this.application,r=await n.query(x.admission.get,{applicationId:t});if(r===null)throw new We(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(x.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},mw=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=R.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(wO(t),()=>kO(t),["address","state","holds","producer","written"]),0}},hw=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=R.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",bw);run=f.String("--run",{required:!0,description:"School year: its bundle key as offer export shows it (program.runs[].key) or id \u2014 never its name"});stage=f.String("--stage",{required:!0,description:"Level: its bundle key as offer export shows it (program.stages[].key) or id \u2014 never its name"});party=f.String("--party",{description:"Applicant party id"});applicant=f.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=f.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=f.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=f.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let n=await this.caller();yO(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=hO(await n.query(x.admission.listAdmissionTree,{client:t}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await n.query(x.applicants.partyByEmail,{client:t,email:this.applicant});if(d===null)throw new We(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await n.mutation(x.admission.staffStartApplicationForParty,{client:t,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:KO(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await n.query(x.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await lp(n,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},gw=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=R.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new We("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new We("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new We("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new We("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new We("applications discard-test: --dry-run and --confirm exclude each other");let n=U1(this.olderThan),t=await this.caller(),r=this.requireTenant(t),i=[],o=null;for(;;){let c=await t.query(x.admission.testTtlPlan,{client:r,olderThanDays:n,cursor:o});if(i.push(...c.rows),c.isDone)break;o=c.continueCursor}let a=i.map(c=>({...c,result:c.verdict!=="expired"?"kept":c.block!==null?"blocked":this.confirm?"pending":"would discard"})),l=i.filter(c=>c.verdict==="expired"&&c.protectedDemo).map(c=>c.applicationId);if(this.confirm&&l.length>0)throw new We(`applications discard-test --all-test: protected demo application(s) in the discard set, nothing discarded: ${l.join(", ")}`);let d=0;if(this.confirm)for(let c of a.filter(u=>u.result==="pending"))try{await t.mutation(x.admission.discardExpiredTest,{applicationId:c.applicationId,olderThanDays:n}),c.result="discarded"}catch(u){d++,c.result=`failed: ${u instanceof Error?u.message:String(u)}`}return this.print({olderThanDays:n,confirm:this.confirm,rows:a},c=>c.rows.map(u=>({id:u.applicationId,lastActivity:new Date(u.lastActivityAt).toISOString().slice(0,10),verdict:u.verdict,block:u.block??"",result:u.result})),["id","lastActivity","verdict","block","result"]),d>0?1:0}};function U1(e){let n=/^(\d+)d$/.exec(e.trim());if(n===null)throw new We(`--older-than "${e}": expected <N>d, e.g. 14d`);return Number(n[1])}s(U1,"parseDays");var yw=class extends D{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=R.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(x.admission.setKeepAsDemo,{applicationId:this.application,keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},ww=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=R.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},kw=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=R.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=KO([this.input]);return await n.mutation(x.admission.correctStaffInput,{applicationId:this.application,key:t,value:r,reason:this.reason}),this.print({application:this.application,key:t,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},qO=[uw,fw,pw,mw,hw,gw,yw,ww,kw];function KO(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!Gl.test(t)||r!=="true"&&r!=="false"||i.length>0)throw new We(`--staff-input "${n}": expected key=true or key=false`);return{key:t,value:r==="true"}})}s(KO,"parseStaffInputs");var Qn="contractGenerator",No="documentTemplate";function zl(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=Object.keys(n);return(n.kind==="generator"||n.kind==="package")&&typeof n.key=="string"&&n.key.length>0&&(n.revision===void 0||typeof n.revision=="number"&&Number.isInteger(n.revision)&&n.revision>0)&&t.every(r=>r==="kind"||r==="key"||r==="revision")}s(zl,"isGeneratorRef");function jO(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(jO,"literalOf");function pi(e){let n=jO(e,Qn);return zl(n)?n:null}s(pi,"generatorRefOfNode");function Ar(e){let n=jO(e,No);return typeof n=="string"&&n.length>0?n:null}s(Ar,"documentTemplateKeyOfNode");function VO(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(VO,"generatorRefLabel");var G1=["formExports","generatorStamp"];function BO(e,n,t){let r=e.inputs?.[Qn];(r?.kind!=="literal"||!zl(r.value))&&F(`applyGeneratorStamp: the node names no generator in inputs.${Qn} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Qn]={kind:"literal",value:{...r.value,revision:n.revision}}),e.generatorStamp={inputSchema:n.inputSchema,parties:n.parties,schemaDigest:n.schemaDigest,...n.parts===void 0?{}:{parts:n.parts},...n.coverLetter===void 0?{}:{coverLetter:n.coverLetter}}}s(BO,"applyGeneratorStamp");var z1=["reads"];function Hs(e){if(e===null||typeof e!="object")return e;let n={...e};return Array.isArray(n.nodes)&&(n.nodes=n.nodes.map(t=>{if(t===null||typeof t!="object")return t;let r={...t};for(let i of G1)delete r[i];for(let i of z1)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),n}s(Hs,"comparableWorkflowGraph");var Wl={id:{de:"die Identit\xE4t ist der Slug des Angebots (bundle.yaml slugs.manifest)",en:"the identity is the offer's slug (bundle.yaml slugs.manifest)"},label:{de:"der Titel steht in bundle.yaml `label`",en:"the title is bundle.yaml `label`"},version:{de:"die Revision z\xE4hlt die Datenbank",en:"the database counts the revision"},applicantMode:{de:"von nichts gelesen",en:"read by nothing"},signatureLevel:{de:"von nichts gelesen",en:"read by nothing"},roleInstances:{de:"die Rollen kommen aus den Formular-Effekten",en:"roles come from the form effects"},leistungen:{de:"von nichts gelesen",en:"read by nothing"},capacity:{de:"die Kapazit\xE4t geh\xF6rt der Kohorte (program.runs[].capacities)",en:"capacity belongs to the cohort (program.runs[].capacities)"},progressLayoutId:{de:"von nichts gelesen",en:"read by nothing"},bewerbungsfenster:{de:"die Kohorte besitzt die \xD6ffnung (isOpen / applicationOpensAt)",en:"the cohort owns opening (isOpen / applicationOpensAt)"},selection:{de:"die Reihenfolge ist der Eingang `waitlistOrder` des Wartelistenknotens (automatisches Nachr\xFCcken gibt es nicht mehr; Freigabe-Strategie und Stichtag las nichts)",en:"the order is the waitlist node's input `waitlistOrder` (automatic promotion is gone; release strategy and deadline were read by nothing)"},progressLayout:{de:"das Fortschrittslayout geh\xF6rt zum Workflow: den Block nach workflow.json `progressLayout` verschieben (ohne Workflow l\xF6schen)",en:"the progress layout belongs to the workflow: move the block to workflow.json `progressLayout` (without a workflow: delete it)"}};function hp(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=Wl[n];return t!==void 0?`manifest: \`${n}\` is no longer part of manifest.json (${t.en}). Delete the line.`:`manifest: unknown key \`${n}\` \u2014 manifest.json carries no key.`})}s(hp,"manifestIssues");function W1(e){let n=[],t=e.buses;if(!Array.isArray(t))return n;let r=t.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return n;for(let i of r.states){if(!i||typeof i!="object")continue;let o=i;if(o.terminal!==!0&&(!o.external||typeof o.external!="object")){let a=typeof o.id=="string"?o.id:"?";n.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return n}s(W1,"validateProgressLayoutExternalCopy");function UO(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let n=e.buses;return!Array.isArray(n)||!n.some(t=>!!t&&typeof t=="object"&&t.key==="process")?["progressLayout: the layout must declare the `process` bus"]:W1(e)}s(UO,"progressLayoutIssues");var GO=new Set(["nodes","assignmentRules","channels","processStore","staffInputs"]);var Y1=new Set(["sections","effects","outcomes","testScenarios","env","views"]),gp={id:{de:"der Schl\xFCssel des Formulars ist sein Slug",en:"the form's key is its slug"},label:{de:"der Name steht in der Formularzeile (createSmartForm.label)",en:"the name is the form row's (createSmartForm.label)"},outcomeIds:{de:"die Ergebnisse sind die ids von outcomes[]",en:"the outcomes are the ids of outcomes[]"},schoolSlug:{de:"von nichts gelesen",en:"read by nothing"}};function zO(e,n){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${n}: die Formulardefinition muss ein Objekt sein.`,en:`${n}: the form definition must be an object.`}];let t=[];for(let i of Object.keys(e)){if(Y1.has(i))continue;let o=gp[i];t.push(o!==void 0?{de:`${n}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${n}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${n}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${n}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||t.push({de:`${n}: \`${i}\` muss eine Liste sein.`,en:`${n}: \`${i}\` must be a list.`});return t}s(zO,"smartFormDefinitionShapeIssues");var $t=["granted","rejected","waitlisted","other"];function Wi(e){return typeof e=="string"&&$t.includes(e)}s(Wi,"isOutcomeSemantic");var rr=["arrival","manual"],WO={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function H1(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(H1,"literal");function vw(e){let n=H1(e,"waitlistOrder");return rr.includes(n)?{waitlistOrder:n}:null}s(vw,"waitlistPolicyOrNull");var wn="responsible",xw="team:";function yp(e){return`${xw}${e}`}s(yp,"teamSlot");function wp(e){return e.startsWith(xw)?e.slice(xw.length):null}s(wp,"teamKeyOfSlot");function YO(e){return e.kind==="responsible"?wn:yp(e.groupKey)}s(YO,"slotIdOf");function kp(e){if(e===wn)return{kind:"responsible"};let n=wp(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(kp,"slotOfId");var Sw="review",Aw="checkField",HO="reviewed",JO="reviewing",bp=["rejected","waitlisted"];function Ew(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ew,"isObject");var J1=new Set(["decision",Sw]),QO={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function Tw(e){return Object.hasOwn(QO,e)?QO[e]:void 0}s(Tw,"legacySemanticOfId");function Q1(e){return e===Sw?$t.filter(n=>!bp.includes(n)):$t}s(Q1,"allowedSemanticsFor");var Z1="other";function ZO(e){return Ew(e)&&J1.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(ZO,"outcomesOf");function XO(e){return(e?.nodes??[]).some(n=>ZO(n).some(t=>Ew(t)&&!("semantic"in t)))}s(XO,"needsOutcomeSemantics");function e_(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=ZO(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=Q1(u),h=!1,y=l.map(k=>{if(!Ew(k))return k;let w=String(k.id);if("semantic"in k)return Wi(k.semantic)||i.push({nodeId:c,outcomeId:w,value:String(k.semantic)}),k;let b=`${c}.${w}`,E=Object.hasOwn(n,b)?n[b]:void 0;if(E!==void 0)return p.includes(E)?(t.push({nodeId:c,outcomeId:w,semantic:E,source:"answer"}),h=!0,{...k,semantic:E}):(r.push({nodeId:c,nodeType:u,outcomeId:w,allowed:p,answer:E}),k);let T=Tw(w),$=T??Z1;return p.includes($)?(t.push({nodeId:c,outcomeId:w,semantic:$,source:T===void 0?"formerDefault":"legacyTable"}),h=!0,{...k,semantic:$}):(r.push({nodeId:c,nodeType:u,outcomeId:w,allowed:p}),k)});return h?{...d,outcomes:y}:a});return t.length===0?{graph:e,written:t,refused:r,invalid:i}:{graph:{...e,nodes:o},written:t,refused:r,invalid:i}}s(e_,"addOutcomeSemantics");var Er="bewerbungOffen";function Co(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Co,"isObject");var Rw=["event","effect"];function n_(e){return Co(e)&&e.type==="eventTrigger"}s(n_,"isTrigger");function t_(e){let n=Co(e.inputs)?e.inputs:{};return"outcomes"in e||Rw.some(t=>t in e||t in n)}s(t_,"oldShape");function r_(e){return(e?.nodes??[]).some(n=>n_(n)&&t_(n))}s(r_,"needsEventTriggerStartMove");function X1(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>Co(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===Er))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(Co(e.next)?e.next:{});if(!(i.length===1&&i[0]===Er))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=Co(e.inputs)?{...e.inputs}:{};for(let l of Rw){let d=o[l];if(Co(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of Rw)delete a[l],delete o[l];return Co(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(X1,"moveNode");function i_(e){let n=[],t=[],r=e.nodes.map(i=>{if(!n_(i)||!t_(i))return i;let o=X1(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(i_,"moveEventTriggerStart");function Yl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Yl,"isObject");var o_={waitlistOrder:"arrival"};function s_(e){return!Yl(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(Yl(e.inputs)?e.inputs:{}))}s(s_,"lacksPolicy");function e2(e){return(e?.nodes??[]).some(s_)}s(e2,"needsWaitlistPolicyMove");function $w(e){return Yl(e)&&rr.includes(e.waitlistOrder)}s($w,"isWaitlistPolicy");function n2(e){if(e===void 0)return{policy:o_,stated:!1};if(!Yl(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!rr.includes(n)?"malformed":{policy:{waitlistOrder:n??o_.waitlistOrder},stated:n!==void 0}}s(n2,"policyOfSelection");function a_(e,n,t={}){let r=[],i=[];if(!e2(e))return{graph:e,moved:r,refused:i};let o=n2(n),a=e.nodes.map(l=>{if(!s_(l))return l;let d=l,c=String(d.id),u=Yl(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(t,c)?t[c]:void 0,h,y;if(p!==void 0)h=p,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;h=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:h.waitlistOrder},r.push({nodeId:c,policy:h,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(a_,"moveWaitlistPolicyToInputs");function Do(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Do,"isObject");var t2=[Qn,No],r2=["inputSchema","parties","schemaDigest","parts"];function l_(e){return Do(e)&&e.type==="governedDocument"&&("resolver"in e||Do(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(l_,"oldShape");function d_(e){return(e?.nodes??[]).some(l_)}s(d_,"needsGeneratorInputMove");function i2(e){let n=Do(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!Do(i))return{unmoved:"resolverNotObject"};if(Qn in n)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((Do(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>Do(d)&&t2.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Qn]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(r2.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(t.generatorStamp=l),r=i.cockpitFields,delete t.resolver}if(Do(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(No in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[No]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}t.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};t.cockpitFields=r}return t.inputs=n,{node:t}}s(i2,"moveNode");function c_(e){let n=[],t=[],r=e.nodes.map(i=>{if(!l_(i))return i;let o=i2(i);return"unmoved"in o?(t.push({nodeId:String(i.id),reason:o.unmoved}),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(c_,"moveGeneratorPinsToInputs");var u_=/^\d{4}-\d{2}-\d{2}$/;function Tr(e,n){return{de:e,en:n}}s(Tr,"issue");function Fo(e){if(typeof e!="object"||e===null)return Tr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:Tr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return Tr(`unbekannte Art ${JSON.stringify(n.kind)}`,`unknown kind ${JSON.stringify(n.kind)}`);let{amount:t,activeFrom:r,activeTo:i}=n;return typeof t!="number"||!Number.isFinite(t)||t<=0?Tr("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((t*100).toFixed(6)))?typeof r!="string"||!u_.test(r)?Tr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!u_.test(i)?Tr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?Tr("das Ende liegt vor dem Beginn","the end is before the start"):n.floorTotal!==void 0&&(typeof n.floorTotal!="number"||!Number.isSafeInteger(n.floorTotal)||n.floorTotal<0)?Tr("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):n.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(n.pricePeriod))?Tr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?Tr("unbekannte Angaben","unknown details"):null:Tr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(Fo,"reductionShapeIssue");function Yi(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.itemKey=="string"&&n.itemKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||Fo(n.reduction)===null&&n.reduction.kind==="amount")}s(Yi,"isPricedItemValue");var Js=["freetext","recommendation","choice","pricedItem","record","reduction"],Qs=[...Js,"appointment"];function p_(e){return typeof e=="string"&&Qs.includes(e)}s(p_,"isTaskResultKind");function Zs(e){return typeof e=="string"&&Js.includes(e)}s(Zs,"isRecordedTaskResultKind");function Xs(e){return Zs(e.kind)}s(Xs,"isRecordedTaskResult");var vp=["number","boolean","enum","text","person","assignment"];function Iw(e){return typeof e=="string"&&vp.includes(e)}s(Iw,"isRecordFieldType");function m_(e){return e==="number"||e==="boolean"||e==="enum"}s(m_,"isSuggestibleFieldType");var Ow=["form","siblingRank"],xp=500;function o2(e){switch(e.type){case"number":case"boolean":case"enum":return e.type;case"text":return"string";case"person":return e.multiple===!0?"staffUserList":"staffUser";case"assignment":return"taskAssignment"}}s(o2,"recordFieldValueType");var mi={freetext:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Freitext",en:"Free text"}},recommendation:{choiceValueType:"enum",valueType:null,textValueType:"string",label:{de:"Empfehlung",en:"Recommendation"}},choice:{choiceValueType:"enum",valueType:"enum",textValueType:"string",label:{de:"Auswahl",en:"Choice"}},pricedItem:{choiceValueType:"enum",valueType:"pricedItem",textValueType:"string",label:{de:"Preisposition",en:"Priced item"}},reduction:{choiceValueType:null,valueType:"reduction",textValueType:"string",label:{de:"Reduktion",en:"Reduction"}},record:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Erfassung",en:"Record"}},appointment:{choiceValueType:null,valueType:null,textValueType:null,label:{de:"Termin",en:"Appointment"}}};function _w(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(_w,"isProseResult");function Sp(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&Iw(n.type)).map(n=>({key:n.writes,valueType:o2(n),field:n})):s2(e)}s(Sp,"draftResultStoreWrites");function s2(e){let n=mi[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(s2,"singleStoreWrite");var f_="team:";function ea(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(f_)){let n=e.slice(f_.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(ea,"parseTaskResultChat");var Ue={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",recordText:"[taskResult/recordText]",recordPerson:"[taskResult/recordPerson]",recordAssignment:"[taskResult/recordAssignment]",reductionPrices:"[taskResult/reductionPrices]"};var a2=new Set(["if","else","in","true","false","null"]),l2=new Set(["==","!=","<=",">=","&&","||"]);function d2(e){return e>="0"&&e<="9"}s(d2,"isDigit");function c2(e){return/[a-zA-Z_$]/.test(e)}s(c2,"isIdentStart");function u2(e){return/[a-zA-Z0-9_.$]/.test(e)}s(u2,"isIdentCont");function f2(e){let n=[],t=0;for(;t<e.length;){let r=e.charAt(t);if(r===" "||r===" "||r===`
|
|
11100
|
+
`};var Zf="da56df9924c1ae01e9130e1886b336464bb308312cbb4a33baa8bdaf018ba52c",rw=aO;var iw=class extends xe{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=R.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:Zf,tools:Bl}),0}},ow=class extends xe{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=R.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new Error("plexus: pipe the tool's JSON input on stdin.");let n=JSON.parse(await tw(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},lO=[iw,ow];var sw=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],Qce=new Set(sw.map(e=>e.key));var Ye=["de","en"];function Bs(e,n){return Ye.every(t=>e[t]===n[t])}s(Bs,"sameText");function Dn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!Ye.includes(r))?"not-localized":Ye.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Dn,"missingLocales");function Ui(e){let n=Dn(e);return n!=="not-localized"&&n.length===0}s(Ui,"isLocalizedText");function Ul(e,n){let t={};for(let r of Ye){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(Ul,"composeTexts");function Xf(e){return e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}s(Xf,"slugify");var dO="tenant";function cO(e){if(e.length===0||Xf(e)!==e)return"must be lowercase a-z/0-9 words joined by single dashes";if(e===dO)return`"${dO}" is reserved for the tenant-wide scope`}s(cO,"unitSlugError");var I1=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function nr(e,n){return`${e}-${n}`}s(nr,"runStorageKey");function uO(e,n){typeof n!="string"&&ae("CONFLICT",{de:`[run/keyNotServed] Das Deployment liefert f\xFCr ein Schuljahr von \u201E${e}\u201C keinen Schl\xFCssel \u2014 es l\xE4uft ein \xE4lteres Release als die CLI. Nach dem n\xE4chsten Release erneut versuchen.`,en:`[run/keyNotServed] The deployment provides no key for a school year of "${e}" \u2014 it runs an older release than the CLI. Try again after the next release.`});let t=`${e}-`;return(!n.startsWith(t)||n.length===t.length)&&ae("CONFLICT",{de:`[run/foreignKey] Der Schl\xFCssel \u201E${n}\u201C des Schuljahrs liegt nicht unter dem Programm \u201E${e}\u201C (erwartet: \u201E${t}<key>\u201C).`,en:`[run/foreignKey] The key "${n}" of the school year is not under the program "${e}" (expected: "${t}<key>").`}),n.slice(t.length)}s(uO,"bareRunKey");function ep(e){let n=[],t=new Map;return e.forEach((r,i)=>{let o=Dn(r.name),a=o!=="not-localized"&&!o.includes("de")?r.name.de:void 0,l=`program.runs[${i}]${a!==void 0?` ("${a}")`:""}`;o==="not-localized"||o.length===2?n.push({code:"run/nameMissing",index:i,message:{de:`[run/nameMissing] ${l}: jedes Schuljahr braucht einen \`name\` auf Deutsch und Englisch (\`{ de, en }\`)`,en:`[run/nameMissing] ${l}: every run needs a \`name\` in German and English (\`{ de, en }\`)`}}):o.length>0&&n.push({code:"run/nameUntranslated",index:i,message:{de:`[i18n/missingTranslation] ${l}.name fehlt in: ${o.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${l}.name is missing in: ${o.join(", ")} \u2014 every displayed text needs German and English.`}});let d=r.key;if(d==null||d===""){n.push({code:"run/keyMissing",index:i,message:{de:`[run/keyMissing] ${l}: jedes Schuljahr braucht einen stabilen \`key\` \u2014 der Name dient nur der Anzeige`,en:`[run/keyMissing] ${l}: every run needs a stable \`key\` \u2014 the name is display only`}});return}if(typeof d!="string"||!I1.test(d)){n.push({code:"run/keyInvalid",index:i,message:{de:`[run/keyInvalid] ${l}: der Schl\xFCssel ${JSON.stringify(d)} muss ein kleingeschriebener Slug sein (a-z, 0-9, einzelnes \u201E-\u201C)`,en:`[run/keyInvalid] ${l}: key ${JSON.stringify(d)} must be a lowercase slug string (a-z, 0-9, single "-")`}});return}let c=t.get(d);if(c!==void 0){n.push({code:"run/duplicateKey",index:i,message:{de:`[run/duplicateKey] ${l}: der Schl\xFCssel \u201E${d}\u201C wird bereits von program.runs[${c}] verwendet`,en:`[run/duplicateKey] ${l}: key "${d}" is already used by program.runs[${c}]`}});return}t.set(d,i)}),n}s(ep,"runSpecIssues");var O1="-stufe-",_1=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function aw(e){return`${e}${O1}`}s(aw,"stageKeyPrefix");function Us(e,n){return`${aw(e)}${n}`}s(Us,"stageStorageKey");function pO(e,n){let t=aw(e);return n.startsWith(t)&&n.length>t.length}s(pO,"isUnderProgram");function Yr(e,n){let t=aw(e);return pO(e,n)||ae("CONFLICT",{de:`[stage/foreignKey] Der Stufenschl\xFCssel \u201E${n}\u201C liegt nicht unter dem Programm \u201E${e}\u201C (erwartet: \u201E${t}<key>\u201C). F\xFChren Sie die Stufe in bundle.yaml unter einem neuen Schl\xFCssel auf; der n\xE4chste Apply archiviert diese Zeile (hinter der Archivsperre) und legt die Stufe mit dem neuen Schl\xFCssel an.`,en:`[stage/foreignKey] The level key "${n}" is not under the program "${e}" (expected: "${t}<key>"). List the level in bundle.yaml under a new key; the next apply archives this row (behind the archive lock) and creates the level with the new key.`}),n.slice(t.length)}s(Yr,"bareStageKey");function np(e){let n=[],t=new Map;return e.forEach((r,i)=>{let o=Dn(r.name),a=o!=="not-localized"&&!o.includes("de")?r.name.de:void 0,l=`program.stages[${i}]${a!==void 0?` ("${a}")`:""}`;o==="not-localized"||o.length===2?n.push({code:"stage/nameMissing",index:i,message:{de:`[stage/nameMissing] ${l}: jede Klassenstufe braucht einen \`name\` auf Deutsch und Englisch (\`{ de, en }\`)`,en:`[stage/nameMissing] ${l}: every stage needs a \`name\` in German and English (\`{ de, en }\`)`}}):o.length>0&&n.push({code:"stage/nameUntranslated",index:i,message:{de:`[i18n/missingTranslation] ${l}.name fehlt in: ${o.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${l}.name is missing in: ${o.join(", ")} \u2014 every displayed text needs German and English.`}});let d=r.key;if(d==null||d===""){n.push({code:"stage/keyMissing",index:i,message:{de:`[stage/keyMissing] ${l}: jede Klassenstufe braucht einen stabilen \`key\` \u2014 der Name dient nur der Anzeige`,en:`[stage/keyMissing] ${l}: every stage needs a stable \`key\` \u2014 the name is display only`}});return}if(typeof d!="string"||!_1.test(d)){n.push({code:"stage/keyInvalid",index:i,message:{de:`[stage/keyInvalid] ${l}: der Schl\xFCssel ${JSON.stringify(d)} muss ein kleingeschriebener Slug sein (a-z, 0-9, einzelnes \u201E-\u201C)`,en:`[stage/keyInvalid] ${l}: key ${JSON.stringify(d)} must be a lowercase slug string (a-z, 0-9, single "-")`}});return}let c=t.get(d);if(c!==void 0){n.push({code:"stage/duplicateKey",index:i,message:{de:`[stage/duplicateKey] ${l}: der Schl\xFCssel \u201E${d}\u201C wird bereits von program.stages[${c}] verwendet`,en:`[stage/duplicateKey] ${l}: key "${d}" is already used by program.stages[${c}]`}});return}t.set(d,i)}),n}s(np,"stageSpecIssues");function fO(e){return{de:e.de.trim(),en:e.en.trim()}}s(fO,"trimmedText");function P1(e,n){let t=[];return e.de!==n.de&&t.push(`"${e.de}" \u2192 "${n.de}"`),e.en!==n.en&&t.push(`en "${e.en}" \u2192 "${n.en}"`),t.join(", ")}s(P1,"describeNameChange");function tp(e,n,t){if(e===null)return n.length>0&&F("planStageReconcile: stages exist but the offer has no program key"),t.map((a,l)=>({op:"insert",key:a.key,name:fO(a.name),...a.gradeLevel!==void 0?{gradeLevel:a.gradeLevel}:{},sequence:l+1}));let r=new Map(n.map(a=>[a.key,a])),i=new Set,o=[];t.forEach(({name:a,...l},d)=>{let c={...l,name:fO(a)},u=Us(e,c.key);i.add(u);let p=d+1,h=r.get(u);if(h===void 0){o.push({op:"insert",key:c.key,name:c.name,...c.gradeLevel!==void 0?{gradeLevel:c.gradeLevel}:{},sequence:p});return}let y={};Bs(h.name,c.name)||(y.name=[h.name,c.name]);let k=h.gradeLevel??null,w=c.gradeLevel??null;k!==w&&(y.gradeLevel=[k,w]),h.sequence!==p&&(y.sequence=[h.sequence,p]),(Object.keys(y).length>0||h.archived)&&o.push({op:"update",key:c.key,stageId:h.stageId,name:c.name,changes:y,unarchive:h.archived})});for(let a of[...n].sort((l,d)=>l.sequence-d.sequence))a.archived||i.has(a.key)||o.push({op:"archive",key:pO(e,a.key)?Yr(e,a.key):a.key,stageId:a.stageId,name:a.name});return o}s(tp,"planStageReconcile");function rp(e){switch(e.op){case"insert":return`+stage ${e.key} (${e.name.de})`;case"archive":{let n=e.occupancy,t=[...n&&n.activeApplications>0?[`REFUSED: ${n.activeApplications} active application(s) \u2014 [stage/hasActiveApplications]`]:[],...n&&n.openLeads>0?[`${n.openLeads} open lead(s)`]:[]];return`-stage ${e.key} (${e.name.de})${t.length>0?` \u2014 ${t.join("; ")}`:""}`}case"update":{let n=[];if(e.unarchive&&n.push("restored"),e.changes.name&&n.push(P1(e.changes.name[0],e.changes.name[1])),e.changes.gradeLevel){let[t,r]=e.changes.gradeLevel;n.push(`grade ${t??"\u2013"} \u2192 ${r??"\u2013"}`)}return e.changes.sequence&&n.push(`position ${e.changes.sequence[0]} \u2192 ${e.changes.sequence[1]}`),`~stage ${e.key} (${n.join(", ")})`}}}s(rp,"describeStageStep");function ip(e,n){return n.startsWith(e)&&n.length>e.length?n.slice(e.length):void 0}s(ip,"bareUnder");function hO(e,n,t,r){let i=e.flatMap(y=>y.angebote).find(y=>y.offerKey===n);if(i===void 0){let y=e.flatMap(k=>k.angebote.map(w=>w.offerKey));throw new We(`applications start-test: no offer "${n}" (offers: ${y.join(", ")||"none"})`)}if(i.programKey===void 0)throw new We("applications start-test: the deployment does not serve the offer's program key \u2014 it runs an older release than the CLI; try again after the next release");let o=i.programKey;if(o===null)throw new We(`applications start-test: ${n} has no program yet \u2014 no level to start on`);let a=Us(o,""),l=nr(o,""),d=s(y=>ip(a,y)??"(no bundle key)","stageLabel"),c=s(y=>ip(l,y)??"(no bundle key)","runLabel"),u=i.stages.find(y=>y.stageKey===Us(o,r)||y.stageId===r);if(u===void 0){let y=i.stages.map(b=>`${d(b.stageKey)} (${b.stageId})`).join(", "),k=ip(a,r),w=k!==void 0&&i.stages.some(b=>b.stageKey===r)?` \u2014 "${r}" is the stored key; the export names it "${k}"`:"";throw new We(`applications start-test: no level "${r}" in ${n}${w} \u2014 name it by its bundle key or id: ${y}`)}let p=d(u.stageKey),h=u.runs.find(y=>y.runKey===nr(o,t)||y.runId===t);if(h===void 0){let y=u.runs.map(b=>`${c(b.runKey)} (${b.runId})`).join(", "),k=ip(l,t),w=k!==void 0&&u.runs.some(b=>b.runKey===t)?` \u2014 "${t}" is the stored key; the export names it "${k}"`:"";throw new We(`applications start-test: no school year "${t}" for level ${p}${w} \u2014 name it by its bundle key or id: ${y}`)}if(!h.isOpen)throw new We(`applications start-test: school year ${c(h.runKey)} is closed for level ${p}`);return{programRunId:h.runId,programStageId:u.stageId}}s(hO,"resolveStartTarget");function N1(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(N1,"applicantText");function gO(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:N1(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(gO,"applicationRows");var mO=sw.map(e=>e.email);function yO(e,n,t,r){if(t===void 0&&r===void 0)throw new We("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(t!==void 0&&r!==void 0)throw new We("applications start-test: --party or --applicant, not both");if(Xy(e,n)&&(r===void 0||!mO.includes(r.trim().toLowerCase())))throw new We(`applications start-test: on prod only for the test account ${mO.join(", ")} (--applicant) \u2014 never a real family's`)}s(yO,"assertStartApplicant");function wO(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(wO,"processStoreJson");function C1(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.snapshotNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.snapshotNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(C1,"refText");function D1(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?C1(e.ref):JSON.stringify(e.value)}s(D1,"holds");function kO(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:D1(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(kO,"storeRows");function op(e){let n={},t={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new Error(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(t,o))throw new Error(`'${o}' is given twice.`);let a=r.slice(i+1);t[o]=a;try{n[o]=JSON.parse(a)}catch{n[o]=a}}return{values:n,raw:t}}s(op,"parseKv");var bO="started",sp="submitted",ap="submitted",vO="load-scenario:";var xO="(Bewerbung)";function SO(e){return{nodeId:xO,actions:e.map(n=>({id:n.id,label:{de:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`,en:`${n.label??n.id}${n.count===void 0?"":` (${n.count})`}`},...n.disabledReason===void 0?{}:{disabledReason:n.disabledReason}}))}}s(SO,"sharedAsList");function AO(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(AO,"disabledText");function EO(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:AO(r)})))}s(EO,"actionRows");function TO(e,n,t=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===n));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new Error(`test-actions run: no current node offers "${n}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new Error(`test-actions run: "${n}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===n);if(a.disabledReason!==void 0)throw new Error(`test-actions run: "${n}" on ${i} is disabled: ${AO(a)}`);if(i!==xO)return i;let l=t[0];if(l===void 0)throw new Error(`test-actions run: "${n}" needs a current node \u2014 the application has none`);return l}s(TO,"nodeOfferingAction");function RO(e,n,t){if(e.startsWith(vO)){if(Object.hasOwn(t,"autoSubmit"))throw new Error(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:n,...t}}return Object.keys(t).length===0?void 0:{...t}}s(RO,"runParams");async function F1(e,n){let t=await e.query(x.workflow.getInstance,{applicationId:n});if(t===null)throw new Error(`test-actions: application ${n} has no workflow instance`);return t.instance.currentNodeIds}s(F1,"currentNodeIds");function L1(e,n){switch(n){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${n} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(L1,"refusalText");async function lp(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${L1(n,r.reason)}`);let i=[];for(let o of t){let a=await e.query(x.workflow.listTestActions,{applicationId:n,nodeId:o});if(a===null)throw new Error(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,SO(r.actions)]}s(lp,"actionsOf");async function $O(e,n,t){return t!==void 0?[t]:await F1(e,n)}s($O,"nodesOf");var lw=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=R.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await lp(n,this.application,await $O(n,this.application,this.node));return this.print(t,EO,["node","action","label","disabled"]),0}},dw=class extends D{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=R.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let n=RO(this.action,this.autoSubmit,op(this.param??[]).values),t=await this.caller(),r=this.application,i=await $O(t,this.application,this.node),o=TO(await lp(t,r,i),this.action,i);return await t.mutation(x.workflow.runTestAction,{applicationId:r,nodeId:o,actionId:this.action,...n===void 0?{}:{params:n}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},IO=[lw,dw];var Sr=/^[a-z][A-Za-z0-9]*$/;function cw(e){return typeof e=="string"&&Sr.test(e)}s(cw,"isNodeId");function Gs(e,n){cw(e)||F(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${Sr.source}.`);let t=new Set(n);if(!t.has(e))return e;let r=2;for(;t.has(`${e}${r}`);)r++;return`${e}${r}`}s(Gs,"makeNodeId");var zi="$env";function de(e){if(e.scope==="env")return`${zi}.${e.key}`;let n=`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(de,"formatAddress");var Gi=/^[a-z][a-zA-Z0-9_]*$/,M1=/^[A-Za-z_][A-Za-z0-9_]*$/;function _o(e){return typeof e=="string"&&e.split(".").every(n=>M1.test(n))}s(_o,"isPath");function ci(e){if(!e.startsWith("$"))return null;let n=e.slice(1).split("."),[t,...r]=n;switch(t){case"env":{let i=r.join(".");return r.length>0&&_o(i)?{scope:"env",key:i}:null}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Gi.test(o)||(t==="node"?!Sr.test(i):!Gi.test(i))?null:q1({scope:t,owner:i,key:o},a)}default:return null}}s(ci,"tryParseAddress");function q1(e,n){if(n.length===0)return e;let t=n.join(".");return _o(t)?{...e,path:t}:null}s(q1,"withPath");function we(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!_o(n.path))return!1;switch(n.scope){case"env":return _o(n.key);case"node":return typeof n.owner=="string"&&Sr.test(n.owner)&&typeof n.key=="string"&&Gi.test(n.key);case"task":return typeof n.owner=="string"&&Gi.test(n.owner)&&typeof n.key=="string"&&Gi.test(n.key);default:return!1}}s(we,"isAddress");var ui={offer:{key:"string",title:"string"},unit:{key:"string",name:"string"},stage:{key:"string",name:"string",gradeLevel:"number"},run:{key:"string",name:"string",startDate:"date"},applicant:{language:"enum",channel:"enum"}},zs=Object.keys(ui);function Ws(e){return Object.hasOwn(ui,e)}s(Ws,"isEnvKey");var K1=["self-service","staff"];function OO(e,n){return{kind:"fixed",values:e,labels:n}}s(OO,"fixedSet");var dp={of:"applicant.language",withoutValue:"de"},fi={"offer.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Angebot",en:"Offer"}},"offer.title":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Titel des Angebots",en:"Offer title"},nameLanguage:dp},"unit.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Einheit",en:"Unit"}},"unit.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Einheit",en:"Unit name"},nameLanguage:dp},"stage.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Klassenstufe (Schl\xFCssel)",en:"Grade (key)"},cohortBound:!0},"stage.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Klassenstufe",en:"Grade name"},cohortBound:!0,nameLanguage:dp},"stage.gradeLevel":{valueSet:{kind:"open"},nullable:!0,absent:{de:"Die Stufe hat keine Klassenstufe (Kindergarten).",en:"The stage has no grade level (Kindergarten)."},label:{de:"Klassenstufe",en:"Grade level"},cohortBound:!0},"run.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Schuljahr",en:"School year"},cohortBound:!0},"run.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name des Schuljahrs",en:"School year name"},cohortBound:!0,nameLanguage:dp},"run.startDate":{valueSet:{kind:"open"},nullable:!0,absent:{de:"F\xFCr das Schuljahr ist kein Beginn erfasst.",en:"The school year has no start date."},label:{de:"Beginn des Schuljahrs",en:"School year start"},cohortBound:!0},"applicant.language":{valueSet:OO(Ye,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:OO(K1,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},cp={types:ui,fields:fi},up=zs.flatMap(e=>Object.keys(ui[e]).map(n=>`${e}.${n}`));function tr(e){return Object.hasOwn(fi,e)}s(tr,"isEnvLeaf");function fp(e){return`${zi}.${e}`}s(fp,"envIdentifier");function Po(e){let n=fi[e],[t,r]=e.split("."),i=ui[t][r];i===void 0&&F(`[env] leaf "${e}" has no type`);let o=n.valueSet;return{leaf:e,type:i,label:n.label,nullable:n.nullable,...n.absent===void 0?{}:{absent:n.absent},...n.nameLanguage===void 0?{}:{nameLanguage:n.nameLanguage},...n.cohortBound===void 0?{}:{cohortBound:n.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&F(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(Po,"envLeaf");var _O="staffInput";var j1=["boolean"],Gl=/^[a-z][A-Za-z0-9]*$/;function pp(e){return e.staffInputs??[]}s(pp,"staffInputsOf");function mp(e){return`${_O}.${e}`}s(mp,"staffInputLeaf");function PO(e){return`${zi}.${mp(e)}`}s(PO,"staffInputIdentifier");function V1(e){let n=`${_O}.`;return e.startsWith(n)?e.slice(n.length):null}s(V1,"staffInputKeyOfLeaf");function Ys(e,n){let t=V1(n);return t===null?void 0:pp(e).find(r=>r.key===t)}s(Ys,"declaredStaffInput");function NO(e){return[...pp(e).map(n=>({leaf:mp(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...up.map(n=>{let t=Po(n);return{leaf:n,type:t.type,label:t.label,valueSet:fi[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(NO,"envLeavesFor");function CO(e){return NO(e).filter(n=>!n.cohortBound)}s(CO,"conditionEnvLeaves");function DO(e){return LO(CO(e))}s(DO,"envConditionSchemaFor");function B1(e){return NO(e).map(n=>n.leaf==="stage.key"?{...n,valueSet:{kind:"open"}}:n)}s(B1,"offerConditionEnvLeaves");function FO(e){return LO(B1(e))}s(FO,"offerConditionSchemaFor");function LO(e){let n={},t={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of e){let[l="",d=""]=r.split(".");n[l]={...n[l]??{},[d]:i},t[r]={valueSet:o,nullable:a}}return{types:n,fields:t}}s(LO,"schemaOfLeaves");function MO(e){let n=e.staffInputs;if(n===void 0)return[];if(!Array.isArray(n))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let t=[],r=new Set;return n.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){t.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};Gl.test(l.key)||t.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&t.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),j1.includes(l.type)||t.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=Dn(l.label);c==="not-localized"?t.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&t.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),t}s(MO,"staffInputIssues");var bw={required:!0,description:"Offer slug (its offerKey)"},uw=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=R.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",bw);testOnly=f.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let n=await this.caller(),t=await n.query(x.admission.listForAngebot,{client:this.requireTenant(n),offerKey:this.offer}),r=gO(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},fw=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=R.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",bw);async execute(){let n=await this.caller(),t=await n.query(x.admission.getCountsByListForAngebot,{client:this.requireTenant(n),offerKey:this.offer});return this.print(t,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},pw=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=R.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let n=await this.caller(),t=this.application,r=await n.query(x.admission.get,{applicationId:t});if(r===null)throw new We(`applications show: no application ${t} (or not visible to you)`);let i=await n.query(x.workflow.getInstance,{applicationId:t});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:t},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},mw=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=R.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(wO(t),()=>kO(t),["address","state","holds","producer","written"]),0}},hw=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=R.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",bw);run=f.String("--run",{required:!0,description:"School year: its bundle key as offer export shows it (program.runs[].key) or id \u2014 never its name"});stage=f.String("--stage",{required:!0,description:"Level: its bundle key as offer export shows it (program.stages[].key) or id \u2014 never its name"});party=f.String("--party",{description:"Applicant party id"});applicant=f.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=f.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=f.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=f.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let n=await this.caller();yO(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=hO(await n.query(x.admission.listAdmissionTree,{client:t}),this.offer,this.run,this.stage),i=this.party;if(this.applicant!==void 0){let d=await n.query(x.applicants.partyByEmail,{client:t,email:this.applicant});if(d===null)throw new We(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await n.mutation(x.admission.staffStartApplicationForParty,{client:t,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:KO(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:this.version}}),a,l;try{let d=await n.query(x.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await lp(n,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw new Error(`applications start-test: started ${o.applicationId}, but reading its state failed: ${d instanceof Error?d.message:String(d)}`,{cause:d})}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},gw=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=R.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new We("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new We("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new We("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new We("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new We("applications discard-test: --dry-run and --confirm exclude each other");let n=U1(this.olderThan),t=await this.caller(),r=this.requireTenant(t),i=[],o=null;for(;;){let c=await t.query(x.admission.testTtlPlan,{client:r,olderThanDays:n,cursor:o});if(i.push(...c.rows),c.isDone)break;o=c.continueCursor}let a=i.map(c=>({...c,result:c.verdict!=="expired"?"kept":c.block!==null?"blocked":this.confirm?"pending":"would discard"})),l=i.filter(c=>c.verdict==="expired"&&c.protectedDemo).map(c=>c.applicationId);if(this.confirm&&l.length>0)throw new We(`applications discard-test --all-test: protected demo application(s) in the discard set, nothing discarded: ${l.join(", ")}`);let d=0;if(this.confirm)for(let c of a.filter(u=>u.result==="pending"))try{await t.mutation(x.admission.discardExpiredTest,{applicationId:c.applicationId,olderThanDays:n}),c.result="discarded"}catch(u){d++,c.result=`failed: ${u instanceof Error?u.message:String(u)}`}return this.print({olderThanDays:n,confirm:this.confirm,rows:a},c=>c.rows.map(u=>({id:u.applicationId,lastActivity:new Date(u.lastActivityAt).toISOString().slice(0,10),verdict:u.verdict,block:u.block??"",result:u.result})),["id","lastActivity","verdict","block","result"]),d>0?1:0}};function U1(e){let n=/^(\d+)d$/.exec(e.trim());if(n===null)throw new We(`--older-than "${e}": expected <N>d, e.g. 14d`);return Number(n[1])}s(U1,"parseDays");var yw=class extends D{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=R.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(x.admission.setKeepAsDemo,{applicationId:this.application,keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},t=>[{key:"application",value:t.application},{key:"keep as demo",value:t.keepAsDemo?"ja":"nein"}]),0}},ww=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=R.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let t=await(await this.caller()).query(x.admission.staffInputsOfApplication,{applicationId:this.application});return this.print(t,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},kw=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=R.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let n=await this.caller(),[{key:t,value:r}]=KO([this.input]);return await n.mutation(x.admission.correctStaffInput,{applicationId:this.application,key:t,value:r,reason:this.reason}),this.print({application:this.application,key:t,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},qO=[uw,fw,pw,mw,hw,gw,yw,ww,kw];function KO(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!Gl.test(t)||r!=="true"&&r!=="false"||i.length>0)throw new We(`--staff-input "${n}": expected key=true or key=false`);return{key:t,value:r==="true"}})}s(KO,"parseStaffInputs");var Qn="contractGenerator",No="documentTemplate";function zl(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=Object.keys(n);return(n.kind==="generator"||n.kind==="package")&&typeof n.key=="string"&&n.key.length>0&&(n.revision===void 0||typeof n.revision=="number"&&Number.isInteger(n.revision)&&n.revision>0)&&t.every(r=>r==="kind"||r==="key"||r==="revision")}s(zl,"isGeneratorRef");function jO(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(jO,"literalOf");function pi(e){let n=jO(e,Qn);return zl(n)?n:null}s(pi,"generatorRefOfNode");function Ar(e){let n=jO(e,No);return typeof n=="string"&&n.length>0?n:null}s(Ar,"documentTemplateKeyOfNode");function VO(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(VO,"generatorRefLabel");var G1=["formExports","generatorStamp"];function BO(e,n,t){let r=e.inputs?.[Qn];(r?.kind!=="literal"||!zl(r.value))&&F(`applyGeneratorStamp: the node names no generator in inputs.${Qn} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Qn]={kind:"literal",value:{...r.value,revision:n.revision}}),e.generatorStamp={inputSchema:n.inputSchema,parties:n.parties,schemaDigest:n.schemaDigest,...n.parts===void 0?{}:{parts:n.parts},...n.coverLetter===void 0?{}:{coverLetter:n.coverLetter}}}s(BO,"applyGeneratorStamp");var z1=["reads"];function Hs(e){if(e===null||typeof e!="object")return e;let n={...e};return Array.isArray(n.nodes)&&(n.nodes=n.nodes.map(t=>{if(t===null||typeof t!="object")return t;let r={...t};for(let i of G1)delete r[i];for(let i of z1)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),n}s(Hs,"comparableWorkflowGraph");var Wl={id:{de:"die Identit\xE4t ist der Slug des Angebots (bundle.yaml slugs.manifest)",en:"the identity is the offer's slug (bundle.yaml slugs.manifest)"},label:{de:"der Titel steht in bundle.yaml `label`",en:"the title is bundle.yaml `label`"},version:{de:"die Revision z\xE4hlt die Datenbank",en:"the database counts the revision"},applicantMode:{de:"von nichts gelesen",en:"read by nothing"},signatureLevel:{de:"von nichts gelesen",en:"read by nothing"},roleInstances:{de:"die Rollen kommen aus den Formular-Effekten",en:"roles come from the form effects"},leistungen:{de:"von nichts gelesen",en:"read by nothing"},capacity:{de:"die Kapazit\xE4t geh\xF6rt der Kohorte (program.runs[].capacities)",en:"capacity belongs to the cohort (program.runs[].capacities)"},progressLayoutId:{de:"von nichts gelesen",en:"read by nothing"},bewerbungsfenster:{de:"die Kohorte besitzt die \xD6ffnung (isOpen / applicationOpensAt)",en:"the cohort owns opening (isOpen / applicationOpensAt)"},selection:{de:"die Reihenfolge ist der Eingang `waitlistOrder` des Wartelistenknotens (automatisches Nachr\xFCcken gibt es nicht mehr; Freigabe-Strategie und Stichtag las nichts)",en:"the order is the waitlist node's input `waitlistOrder` (automatic promotion is gone; release strategy and deadline were read by nothing)"},progressLayout:{de:"das Fortschrittslayout geh\xF6rt zum Workflow: den Block nach workflow.json `progressLayout` verschieben (ohne Workflow l\xF6schen)",en:"the progress layout belongs to the workflow: move the block to workflow.json `progressLayout` (without a workflow: delete it)"}};function hp(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=Wl[n];return t!==void 0?`manifest: \`${n}\` is no longer part of manifest.json (${t.en}). Delete the line.`:`manifest: unknown key \`${n}\` \u2014 manifest.json carries no key.`})}s(hp,"manifestIssues");function W1(e){let n=[],t=e.buses;if(!Array.isArray(t))return n;let r=t.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return n;for(let i of r.states){if(!i||typeof i!="object")continue;let o=i;if(o.terminal!==!0&&(!o.external||typeof o.external!="object")){let a=typeof o.id=="string"?o.id:"?";n.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return n}s(W1,"validateProgressLayoutExternalCopy");function UO(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let n=e.buses;return!Array.isArray(n)||!n.some(t=>!!t&&typeof t=="object"&&t.key==="process")?["progressLayout: the layout must declare the `process` bus"]:W1(e)}s(UO,"progressLayoutIssues");var GO=new Set(["nodes","assignmentRules","channels","processStore","staffInputs"]);var Y1=new Set(["sections","effects","outcomes","testScenarios","env","views"]),gp={id:{de:"der Schl\xFCssel des Formulars ist sein Slug",en:"the form's key is its slug"},label:{de:"der Name steht in der Formularzeile (createSmartForm.label)",en:"the name is the form row's (createSmartForm.label)"},outcomeIds:{de:"die Ergebnisse sind die ids von outcomes[]",en:"the outcomes are the ids of outcomes[]"},schoolSlug:{de:"von nichts gelesen",en:"read by nothing"}};function zO(e,n){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${n}: die Formulardefinition muss ein Objekt sein.`,en:`${n}: the form definition must be an object.`}];let t=[];for(let i of Object.keys(e)){if(Y1.has(i))continue;let o=gp[i];t.push(o!==void 0?{de:`${n}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${n}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${n}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${n}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||t.push({de:`${n}: \`${i}\` muss eine Liste sein.`,en:`${n}: \`${i}\` must be a list.`});return t}s(zO,"smartFormDefinitionShapeIssues");var $t=["granted","rejected","waitlisted","other"];function Wi(e){return typeof e=="string"&&$t.includes(e)}s(Wi,"isOutcomeSemantic");var rr=["arrival","manual"],WO={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function H1(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(H1,"literal");function vw(e){let n=H1(e,"waitlistOrder");return rr.includes(n)?{waitlistOrder:n}:null}s(vw,"waitlistPolicyOrNull");var wn="responsible",xw="team:";function yp(e){return`${xw}${e}`}s(yp,"teamSlot");function wp(e){return e.startsWith(xw)?e.slice(xw.length):null}s(wp,"teamKeyOfSlot");function YO(e){return e.kind==="responsible"?wn:yp(e.groupKey)}s(YO,"slotIdOf");function kp(e){if(e===wn)return{kind:"responsible"};let n=wp(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(kp,"slotOfId");var Sw="review",Aw="checkField",HO="reviewed",JO="reviewing",bp=["rejected","waitlisted"];function Ew(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ew,"isObject");var J1=new Set(["decision",Sw]),QO={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function Tw(e){return Object.hasOwn(QO,e)?QO[e]:void 0}s(Tw,"legacySemanticOfId");function Q1(e){return e===Sw?$t.filter(n=>!bp.includes(n)):$t}s(Q1,"allowedSemanticsFor");var Z1="other";function ZO(e){return Ew(e)&&J1.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(ZO,"outcomesOf");function XO(e){return(e?.nodes??[]).some(n=>ZO(n).some(t=>Ew(t)&&!("semantic"in t)))}s(XO,"needsOutcomeSemantics");function e_(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=ZO(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=Q1(u),h=!1,y=l.map(k=>{if(!Ew(k))return k;let w=String(k.id);if("semantic"in k)return Wi(k.semantic)||i.push({nodeId:c,outcomeId:w,value:String(k.semantic)}),k;let b=`${c}.${w}`,E=Object.hasOwn(n,b)?n[b]:void 0;if(E!==void 0)return p.includes(E)?(t.push({nodeId:c,outcomeId:w,semantic:E,source:"answer"}),h=!0,{...k,semantic:E}):(r.push({nodeId:c,nodeType:u,outcomeId:w,allowed:p,answer:E}),k);let T=Tw(w),$=T??Z1;return p.includes($)?(t.push({nodeId:c,outcomeId:w,semantic:$,source:T===void 0?"formerDefault":"legacyTable"}),h=!0,{...k,semantic:$}):(r.push({nodeId:c,nodeType:u,outcomeId:w,allowed:p}),k)});return h?{...d,outcomes:y}:a});return t.length===0?{graph:e,written:t,refused:r,invalid:i}:{graph:{...e,nodes:o},written:t,refused:r,invalid:i}}s(e_,"addOutcomeSemantics");var Er="bewerbungOffen";function Co(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Co,"isObject");var Rw=["event","effect"];function n_(e){return Co(e)&&e.type==="eventTrigger"}s(n_,"isTrigger");function t_(e){let n=Co(e.inputs)?e.inputs:{};return"outcomes"in e||Rw.some(t=>t in e||t in n)}s(t_,"oldShape");function r_(e){return(e?.nodes??[]).some(n=>n_(n)&&t_(n))}s(r_,"needsEventTriggerStartMove");function X1(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>Co(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===Er))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(Co(e.next)?e.next:{});if(!(i.length===1&&i[0]===Er))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=Co(e.inputs)?{...e.inputs}:{};for(let l of Rw){let d=o[l];if(Co(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of Rw)delete a[l],delete o[l];return Co(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(X1,"moveNode");function i_(e){let n=[],t=[],r=e.nodes.map(i=>{if(!n_(i)||!t_(i))return i;let o=X1(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(i_,"moveEventTriggerStart");function Yl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Yl,"isObject");var o_={waitlistOrder:"arrival"};function s_(e){return!Yl(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(Yl(e.inputs)?e.inputs:{}))}s(s_,"lacksPolicy");function e2(e){return(e?.nodes??[]).some(s_)}s(e2,"needsWaitlistPolicyMove");function $w(e){return Yl(e)&&rr.includes(e.waitlistOrder)}s($w,"isWaitlistPolicy");function n2(e){if(e===void 0)return{policy:o_,stated:!1};if(!Yl(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!rr.includes(n)?"malformed":{policy:{waitlistOrder:n??o_.waitlistOrder},stated:n!==void 0}}s(n2,"policyOfSelection");function a_(e,n,t={}){let r=[],i=[];if(!e2(e))return{graph:e,moved:r,refused:i};let o=n2(n),a=e.nodes.map(l=>{if(!s_(l))return l;let d=l,c=String(d.id),u=Yl(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(t,c)?t[c]:void 0,h,y;if(p!==void 0)h=p,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;h=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:h.waitlistOrder},r.push({nodeId:c,policy:h,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(a_,"moveWaitlistPolicyToInputs");function Do(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Do,"isObject");var t2=[Qn,No],r2=["inputSchema","parties","schemaDigest","parts"];function l_(e){return Do(e)&&e.type==="governedDocument"&&("resolver"in e||Do(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(l_,"oldShape");function d_(e){return(e?.nodes??[]).some(l_)}s(d_,"needsGeneratorInputMove");function i2(e){let n=Do(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!Do(i))return{unmoved:"resolverNotObject"};if(Qn in n)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((Do(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>Do(d)&&t2.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Qn]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(r2.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(t.generatorStamp=l),r=i.cockpitFields,delete t.resolver}if(Do(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(No in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[No]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}t.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};t.cockpitFields=r}return t.inputs=n,{node:t}}s(i2,"moveNode");function c_(e){let n=[],t=[],r=e.nodes.map(i=>{if(!l_(i))return i;let o=i2(i);return"unmoved"in o?(t.push({nodeId:String(i.id),reason:o.unmoved}),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(c_,"moveGeneratorPinsToInputs");var u_=/^\d{4}-\d{2}-\d{2}$/;function Tr(e,n){return{de:e,en:n}}s(Tr,"issue");function Fo(e){if(typeof e!="object"||e===null)return Tr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:Tr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return Tr(`unbekannte Art ${JSON.stringify(n.kind)}`,`unknown kind ${JSON.stringify(n.kind)}`);let{amount:t,activeFrom:r,activeTo:i}=n;return typeof t!="number"||!Number.isFinite(t)||t<=0?Tr("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((t*100).toFixed(6)))?typeof r!="string"||!u_.test(r)?Tr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!u_.test(i)?Tr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?Tr("das Ende liegt vor dem Beginn","the end is before the start"):n.floorTotal!==void 0&&(typeof n.floorTotal!="number"||!Number.isSafeInteger(n.floorTotal)||n.floorTotal<0)?Tr("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):n.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(n.pricePeriod))?Tr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?Tr("unbekannte Angaben","unknown details"):null:Tr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(Fo,"reductionShapeIssue");function Yi(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.itemKey=="string"&&n.itemKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||Fo(n.reduction)===null&&n.reduction.kind==="amount")}s(Yi,"isPricedItemValue");var Js=["freetext","recommendation","choice","pricedItem","record","reduction"],Qs=[...Js,"appointment"];function p_(e){return typeof e=="string"&&Qs.includes(e)}s(p_,"isTaskResultKind");function Zs(e){return typeof e=="string"&&Js.includes(e)}s(Zs,"isRecordedTaskResultKind");function Xs(e){return Zs(e.kind)}s(Xs,"isRecordedTaskResult");var vp=["number","boolean","enum","text","person","assignment"];function Iw(e){return typeof e=="string"&&vp.includes(e)}s(Iw,"isRecordFieldType");function m_(e){return e==="number"||e==="boolean"||e==="enum"}s(m_,"isSuggestibleFieldType");var Ow=["form","siblingRank"],xp=500;function o2(e){switch(e.type){case"number":case"boolean":case"enum":return e.type;case"text":return"string";case"person":return e.multiple===!0?"staffUserList":"staffUser";case"assignment":return"taskAssignment"}}s(o2,"recordFieldValueType");var mi={freetext:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Freitext",en:"Free text"}},recommendation:{choiceValueType:"enum",valueType:null,textValueType:"string",label:{de:"Empfehlung",en:"Recommendation"}},choice:{choiceValueType:"enum",valueType:"enum",textValueType:"string",label:{de:"Auswahl",en:"Choice"}},pricedItem:{choiceValueType:"enum",valueType:"pricedItem",textValueType:"string",label:{de:"Preisposition",en:"Priced item"}},reduction:{choiceValueType:null,valueType:"reduction",textValueType:"string",label:{de:"Reduktion",en:"Reduction"}},record:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Erfassung",en:"Record"}},appointment:{choiceValueType:null,valueType:null,textValueType:null,label:{de:"Termin",en:"Appointment"}}};function _w(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(_w,"isProseResult");function Sp(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&Iw(n.type)).map(n=>({key:n.writes,valueType:o2(n),field:n})):s2(e)}s(Sp,"draftResultStoreWrites");function s2(e){let n=mi[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(s2,"singleStoreWrite");var f_="team:";function ea(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(f_)){let n=e.slice(f_.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(ea,"parseTaskResultChat");var Ue={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",recordText:"[taskResult/recordText]",recordPerson:"[taskResult/recordPerson]",recordAssignment:"[taskResult/recordAssignment]",reductionPrices:"[taskResult/reductionPrices]"};var a2=new Set(["if","else","in","true","false","null"]),l2=new Set(["==","!=","<=",">=","&&","||"]);function d2(e){return e>="0"&&e<="9"}s(d2,"isDigit");function c2(e){return/[a-zA-Z_$]/.test(e)}s(c2,"isIdentStart");function u2(e){return/[a-zA-Z0-9_.$]/.test(e)}s(u2,"isIdentCont");function f2(e){let n=[],t=0;for(;t<e.length;){let r=e.charAt(t);if(r===" "||r===" "||r===`
|
|
11100
11101
|
`||r==="\r"){t++;continue}if(r==="'"){let o=t+1,a="";for(;o<e.length&&e.charAt(o)!=="'";)e.charAt(o)==="\\"&&o+1<e.length?(a+=e.charAt(o+1),o+=2):(a+=e.charAt(o),o++);o>=e.length&&F(`Unterminated string at ${t}`),n.push({t:"str",v:a}),t=o+1;continue}if(d2(r)){let o=t;for(;o<e.length&&/[0-9.]/.test(e.charAt(o));)o++;n.push({t:"num",v:Number(e.slice(t,o))}),t=o;continue}if(c2(r)){let o=t;for(;o<e.length&&u2(e.charAt(o));)o++;let a=e.slice(t,o);a2.has(a)?n.push({t:"kw",v:a}):n.push({t:"ident",v:a}),t=o;continue}let i=e.slice(t,t+2);if(l2.has(i)){n.push({t:"op",v:i}),t+=2;continue}if("<>!".includes(r)){n.push({t:"op",v:r}),t++;continue}if("()[],".includes(r)){n.push({t:"punct",v:r}),t++;continue}F(`Unexpected char '${r}' at ${t}`)}return n}s(f2,"tokenise");var h_=1e4,g_=128;function na(e){e.depth++,e.depth>g_&&F(`Expression nesting too deep (> ${g_})`)}s(na,"enterDepth");function x_(e){return e.pos<e.tokens.length?e.tokens[e.pos]:null}s(x_,"peek");function Zn(e){let n=e.tokens[e.pos];return n||F(`Unexpected end at ${e.pos}`),e.pos++,n}s(Zn,"take");function Xn(e,n,t){let r=x_(e);return!(!r||r.t!==n||t!==void 0&&r.v!==t)}s(Xn,"match");function Lo(e,n,t){return Xn(e,n,t)||F(`Expected ${n}${t?`:${t}`:""} at ${e.pos}`),Zn(e)}s(Lo,"expect");function gi(e){na(e);try{return Xn(e,"kw","if")?p2(e):m2(e)}finally{e.depth--}}s(gi,"parseExpr");function p2(e){Lo(e,"kw","if"),Lo(e,"punct","(");let n=gi(e);Lo(e,"punct",")");let t=gi(e);Lo(e,"kw","else");let r=gi(e);return{kind:"if",cond:n,then:t,else:r}}s(p2,"parseIf");function m2(e){let n=y_(e),t=0;try{for(;Xn(e,"op","||");){Zn(e),na(e),t++;let r=y_(e);n={kind:"binary",op:"||",left:n,right:r}}}finally{e.depth-=t}return n}s(m2,"parseLogicOr");function y_(e){let n=w_(e),t=0;try{for(;Xn(e,"op","&&");){Zn(e),na(e),t++;let r=w_(e);n={kind:"binary",op:"&&",left:n,right:r}}}finally{e.depth-=t}return n}s(y_,"parseLogicAnd");function w_(e){let n=k_(e),t=0;try{for(;Xn(e,"op","==")||Xn(e,"op","!=");){let r=Zn(e).v;na(e),t++;let i=k_(e);n={kind:"binary",op:r,left:n,right:i}}}finally{e.depth-=t}return n}s(w_,"parseEquality");function k_(e){let n=Nw(e),t=0;try{for(;Xn(e,"op","<")||Xn(e,"op","<=")||Xn(e,"op",">")||Xn(e,"op",">=")||Xn(e,"kw","in");){let r=Zn(e),i=r.t==="kw"?"in":r.v;na(e),t++;let o=Nw(e);n={kind:"binary",op:i,left:n,right:o}}}finally{e.depth-=t}return n}s(k_,"parseCompare");function Nw(e){if(Xn(e,"op","!")){Zn(e),na(e);try{return{kind:"unary",op:"!",operand:Nw(e)}}finally{e.depth--}}return h2(e)}s(Nw,"parseUnary");function h2(e){let n=x_(e);if(n||F("Unexpected end"),n.t==="num")return Zn(e),{kind:"num",value:n.v};if(n.t==="str")return Zn(e),{kind:"str",value:n.v};if(n.t==="kw"&&n.v==="true")return Zn(e),{kind:"bool",value:!0};if(n.t==="kw"&&n.v==="false")return Zn(e),{kind:"bool",value:!1};if(n.t==="kw"&&n.v==="null")return Zn(e),{kind:"null"};if(n.t==="punct"&&n.v==="("){Zn(e);let t=gi(e);return Lo(e,"punct",")"),t}if(n.t==="punct"&&n.v==="["){Zn(e);let t=[];if(!Xn(e,"punct","]"))for(t.push(gi(e));Xn(e,"punct",",");)Zn(e),t.push(gi(e));return Lo(e,"punct","]"),{kind:"arr",items:t}}if(n.t==="ident"){let t=n.v;if(Zn(e),Xn(e,"punct","(")){Zn(e);let r=[];if(!Xn(e,"punct",")"))for(r.push(gi(e));Xn(e,"punct",",");)Zn(e),r.push(gi(e));return Lo(e,"punct",")"),{kind:"call",name:t,args:r}}return{kind:"ident",path:t}}F(`Unexpected token at ${e.pos}`)}s(h2,"parsePrimary");function Fn(e){e.length>h_&&F(`Expression too long (${e.length} > ${h_})`);let n={tokens:f2(e),pos:0,depth:0},t=gi(n);return n.pos<n.tokens.length&&F(`Unexpected trailing token at ${n.pos}`),t}s(Fn,"parseExpression");var g2=new Map([["today",()=>new Date().toISOString().slice(0,10)],["years_between",(e,n)=>{if(typeof e!="string"||typeof n!="string")return null;let t=new Date(e),r=new Date(n);if(isNaN(t.getTime())||isNaN(r.getTime()))return null;let i=r.getFullYear()-t.getFullYear(),o=r.getMonth()-t.getMonth();return(o<0||o===0&&r.getDate()<t.getDate())&&i--,i}],["length",e=>typeof e=="string"||Array.isArray(e)?e.length:0]]);function kn(e,n){switch(e.kind){case"num":return e.value;case"str":return e.value;case"bool":return e.value;case"null":return null;case"ident":{let t=Object.hasOwn(n.values,e.path)?n.values[e.path]:void 0;return t===void 0?null:t}case"arr":return e.items.map(t=>kn(t,n));case"unary":{let t=kn(e.operand,n);return!Mo(t)}case"call":{let t=n.functions!==void 0&&Object.hasOwn(n.functions,e.name)?n.functions[e.name]:g2.get(e.name);t||F(`Unknown function '${e.name}'`);let r=e.args.map(i=>kn(i,n));return t(...r)}case"binary":return y2(e.op,e.left,e.right,n);case"if":return Mo(kn(e.cond,n))?kn(e.then,n):kn(e.else,n)}}s(kn,"evaluate");function y2(e,n,t,r){if(e==="&&"){let a=kn(n,r);return Mo(a)?Mo(kn(t,r)):!1}if(e==="||"){let a=kn(n,r);return Mo(a)?!0:Mo(kn(t,r))}let i=kn(n,r),o=kn(t,r);switch(e){case"==":return Pw(i,o);case"!=":return!Pw(i,o);case"<":{let[a,l]=Ap(i,o);return a!==null&&l!==null&&a<l}case"<=":{let[a,l]=Ap(i,o);return a!==null&&l!==null&&a<=l}case">":{let[a,l]=Ap(i,o);return a!==null&&l!==null&&a>l}case">=":{let[a,l]=Ap(i,o);return a!==null&&l!==null&&a>=l}case"in":return Array.isArray(o)?o.some(a=>Pw(a,i)):!1}}s(y2,"evalBinary");function Ap(e,n){return[b_(e),b_(n)]}s(Ap,"orderedOperands");function b_(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"){if(e.trim()==="")return null;let n=Number(e);return Number.isFinite(n)?n:null}return null}s(b_,"numericOperand");function Pw(e,n){return e===n?!0:e==null||n==null?!1:typeof e=="number"&&typeof n=="string"?e===Number(n):typeof e=="string"&&typeof n=="number"?Number(e)===n:!1}s(Pw,"looseEq");function Mo(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(Mo,"truthy");function Ln(e){let n=new Set;return hi(e,n),[...n]}s(Ln,"dependencies");function hi(e,n){switch(e.kind){case"ident":n.add(e.path);return;case"call":e.args.forEach(t=>hi(t,n));return;case"arr":e.items.forEach(t=>hi(t,n));return;case"unary":hi(e.operand,n);return;case"binary":hi(e.left,n),hi(e.right,n);return;case"if":hi(e.cond,n),hi(e.then,n),hi(e.else,n);return;default:return}}s(hi,"walk");var v_=new Map;function yi(e){let n=v_.get(e);return n||(n=Fn(e),v_.set(e,n)),n}s(yi,"parseCached");function w2(e,n){return kn(yi(e),n)}s(w2,"evalExpression");function S_(e,n){return Mo(w2(e,n))}s(S_,"evalBoolean");function A_(e,n){n!==null&&(typeof n=="object"||typeof n=="function")&&Object.hasOwn(n,"exports")&&F(`[workflow/registry] node type "${e}": custom spec.exports is unsupported; use artifact-slot exports.`)}s(A_,"assertNoCustomNodeExports");var Cw=null;function E_(e){for(let[n,t]of Object.entries(e))A_(n,t);Cw=e}s(E_,"setSpecs");function T_(){return Cw||F("[workflow/registry] Specs not initialised. Import convex/model/admission/specs before calling specFor()."),Cw}s(T_,"requireSpecs");function Je(e){let n=T_(),t=n[e.type];return t===void 0&&ae("INVALID",{de:`[workflow/registry] Unbekannter Knotentyp "${String(e.type)}" (Knoten "${String(e.id)}"). Registrierte Typen: ${Object.keys(n).sort().join(", ")}.`,en:`[workflow/registry] Unknown node type "${String(e.type)}" (node "${String(e.id)}"). Registered types: ${Object.keys(n).sort().join(", ")}.`}),t}s(Je,"specFor");function R_(){return Object.keys(T_()).sort()}s(R_,"registeredNodeTypes");var $_=up.filter(e=>fi[e].cohortBound!==!0);function Dw(e){return tr(e)&&fi[e].cohortBound!==!0}s(Dw,"isEnvAddressLeaf");function Fw(e){return Po(e).type}s(Fw,"envType");function Lw(e){return Po(e).label}s(Lw,"envLabel");function Mw(e){if(e.scope==="env"||e.path===void 0)return e;switch(e.scope){case"node":return{scope:"node",owner:e.owner,key:e.key};case"task":return{scope:"task",owner:e.owner,key:e.key}}}s(Mw,"addressBase");function Rr(e){return e.scope==="node"&&e.key===Un&&e.path===void 0}s(Rr,"isInstanceAddress");function un(e){return we(e)&&e.scope==="node"&&e.key===Un&&e.path!==void 0}s(un,"isFormFieldAddress");function I_(e){return un(e)?{owner:e.owner,path:e.path}:null}s(I_,"formFieldOf");function k2(e){return Ln(yi(e)).map(n=>{if(!n.startsWith("$"))return{identifier:n,address:null,reason:"bareIdentifier"};let t=ci(n);return t===null?{identifier:n,address:null,reason:"shape"}:{identifier:n,address:t}})}s(k2,"expressionAddresses");var Un="admission",qw="document",Tp="contract",Rp="contracts",O_="payment",Kw=new Set(["adoptForm","setFlagTarget","form","familyRequestFrom"]);var gt={id:"identity",type:"identity",label:"display",sublabel:"display",library:"display",outcomes:"control",outputLabels:"display",inputs:"input",next:"control",tasks:"config",assign:"reference",actionTeams:"reference",optionalActions:"config",artifacts:"config",notifications:"config"},Rpe={join:{...gt},end:{...gt},eventTrigger:{...gt},form:{...gt,adoptForm:"address",formExports:"stamp"},roleAssign:{...gt},setFlag:{...gt},if:{...gt,condition:"address"},countersign:{...gt,contract:"address",titles:"display",signing:"config"},engagePush:{...gt,engage:"tenantRef",form:"address",contract:"address",payment:"address"},decision:{...gt,commentRequired:"config",decisionAsTask:"config",reads:"address",view:"config",requiresOneOf:"config"},review:{...gt,form:"address",commentRequired:"config",decisionAsTask:"config"},waitlist:{...gt},completenessCheck:{...gt,requires:"address",deadline:"config"},collectPayment:{...gt},governedDocument:{...gt,production:"config",form:"address",generatorStamp:"stamp",templateStamp:"stamp",approval:"config",confirmBeforeIssue:"config",confirmContractTerms:"config",contractTermsQuestionText:"display",responseStrategy:"config",titles:"display",responseLabels:"display",reads:"address"}};function Hr(e){return Array.isArray(e)?e:[]}s(Hr,"listOf");function yt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(yt,"record");function __(e){switch(e.type){case"countersign":return["contract"];case"engagePush":return["form","contract","payment"];case"governedDocument":return e.production==="resolver"?["form"]:[];case"review":return["form"];default:return[]}}s(__,"dataSourceFieldsOf");function P_(e){return e.type==="review"?[]:e.type==="engagePush"?["form"]:__(e)}s(P_,"requiredDataSourceFields");var b2={setFlag:{target:"setFlagTarget"}};function Hl(e,n={}){let t=[],r=e,i=`nodes.${e.id}`,o=s((d,c,u,p={})=>{t.push({kind:d,at:c,nodeId:e.id,value:u,judgedTogether:null,...p})},"field"),a=new Map(n.slotTypes===!1?[]:(Je(e).inputs?.(e)??[]).map(d=>[d.id,d.type])),l=b2[e.type]??{};for(let[d,c]of Object.entries(yt(r.inputs)??{})){let u=yt(c);if(u?.kind!=="binding")continue;let p="address"in u?u.address:u.path,h=l[d];if(h!==void 0){o(h,`${i}.inputs.${d}`,p);continue}let y=a.get(d);o("binding",`${i}.inputs.${d}`,p,y!==void 0?{expectedType:y}:{})}for(let[d,c]of Hr(r.reads).entries())o("nodeReads",`${i}.reads.${d}`,c,{judgedTogether:`${i}.reads`});for(let[d,c]of Hr(r.requires).entries())o("requires",`${i}.requires.${d}`,c,{judgedTogether:`${i}.requires`});e.type==="form"&&r.adoptForm!==void 0&&o("adoptForm",`${i}.adoptForm`,r.adoptForm);for(let d of __(e))r[d]!==void 0&&o(d,`${i}.${d}`,r[d]);e.type==="if"&&r.condition!==void 0&&o("condition",`${i}.condition`,r.condition);for(let[d,c]of Object.entries(yt(r.assign)??{}))for(let[u,p]of Hr(c).entries()){let h=yt(p)?.when;h!=null&&o("teamWhen",v2(e.id,d,u),h,{expectedType:"boolean"})}for(let[d,c]of Hr(r.tasks).entries())t.push(...N_(e.id,c,d));for(let[d,c]of Hr(r.optionalActions).entries()){let u=yt(c);u?.when!==void 0&&o("optionalActionWhen",x2(e.id,typeof u.key=="string"?u.key:String(d)),u.when)}return t}s(Hl,"nodeAddressFields");function v2(e,n,t){return`nodes.${e}.assign.${n}.${t}.when`}s(v2,"teamWhenPath");function x2(e,n){return`nodes.${e}.optionalActions.${n}.when`}s(x2,"optionalActionWhenPath");function N_(e,n,t){let r=yt(n);if(r===null)return[];let i=[],o=typeof r.key=="string"?r.key:String(t),a=`nodes.${e}.tasks.${o}`,l=s((p,h,y,k={})=>{i.push({kind:p,at:h,nodeId:e,taskKey:o,value:y,judgedTogether:null,...k})},"field"),d=`${a}.evidence`;r.when!==void 0&&l("taskWhen",`${a}.when`,r.when,{expectedType:"boolean",judgedTogether:d});for(let[p,h]of Hr(r.reads).entries())l("taskReads",`${a}.reads.${p}`,h,{judgedTogether:d});for(let[p,h]of Hr(r.inputs).entries())l("taskInput",`${a}.inputs.${p}`,h);for(let[p,h]of Hr(r.documents).entries()){let y=yt(h);y===null||y.kind!=="field"||l("taskDocument",`${a}.documents.${p}`,y.address)}let c=yt(r.familyRequest);if(c!==null){for(let[p,h]of Hr(c.fields).entries())l("familyRequestFields",`${a}.familyRequest.fields.${p}`,h,{judgedTogether:`${a}.familyRequest.fields`});c.from!==void 0&&l("familyRequestFrom",`${a}.familyRequest.from`,c.from)}let u=yt(r.result);if(u?.kind==="record")for(let[p,h]of Hr(u.fields).entries()){let y=yt(yt(h)?.suggest);if(y?.kind!=="form")continue;let k=yt(h)?.type;l("suggest",`${a}.result.fields.${p}.suggest`,"address"in y?y.address:y.key,typeof k=="string"?{expectedType:k}:{})}return i}s(N_,"taskAddressFields");function ta(e){return jw(e)?(Vw(e.value)??[]).flatMap(n=>n.address===null?[]:[n.address]):we(e.value)?[e.value]:[]}s(ta,"addressesInField");function jw(e){return e.kind==="condition"||e.kind==="optionalActionWhen"}s(jw,"isExpressionField");function Vw(e){if(typeof e!="string"||e.trim().length===0)return null;try{yi(e)}catch{return null}return k2(e)}s(Vw,"conditionAddresses");function It(e){return e.type==="form"&&e.adoptForm!==void 0&&e.adoptForm!==!1}s(It,"adoptsForm");function C_(e){if(e.type!=="form"||It({type:e.type,adoptForm:e.adoptForm}))return;let n=e.inputs?.smartForm;return n?.kind==="literal"&&typeof n.value=="string"&&n.value!==""?n.value:void 0}s(C_,"createdSmartFormSlug");function S2(e,n){return e.type!=="governedDocument"||e.production!=="resolver"||n!==qw?n:e.generatorStamp?.parts!==void 0?Rp:Tp}s(S2,"addressKeyOfPort");function D_(e){let n=e.result;return n===void 0||!Xs(n)?[]:Sp(n).map(t=>t.key)}s(D_,"storeWritesOf");function Bw(e,n){return(Array.isArray(e.processStore)?e.processStore:[]).find(t=>t.key===n)}s(Bw,"declaredKey");function Jr(e,n){let t=[];if(!It(n))for(let r of Je(n).outputs?.(n)??[])t.push({address:{scope:"node",owner:n.id,key:S2(n,r.name)},type:r.type,...r.label!==void 0?{label:r.label}:{},nodeId:n.id,nodePort:r});for(let r of Array.isArray(n.tasks)?n.tasks:[])for(let i of D_(r)){let o=Bw(e,i);t.push({address:{scope:"task",owner:r.key,key:i},type:o?.type??"unknown",...o!==void 0?{label:o.label}:{},nodeId:n.id})}return t}s(Jr,"producedAddresses");function F_(e,n,t){for(let r of e.nodes)for(let i of Array.isArray(r.tasks)?r.tasks:[])if(i.key===n&&D_(i).includes(t))return{nodeId:r.id,template:i};return null}s(F_,"taskWriter");function wi(e,n,t){return F_(e,n,t)?.nodeId??null}s(wi,"taskOwnerNode");function A2(e){return Hl(e,{slotTypes:!1}).flatMap(n=>ta(n).map(t=>({address:t,field:n})))}s(A2,"writtenAddressesOf");function qo(e,n){let t=[],r=new Set,i=s((a,l,d,c)=>{let u=`${de(a)}|${l}|${d.at}|${c===void 0?"":de(c)}`;r.has(u)||(r.add(u),t.push({address:a,origin:l,field:d,...c!==void 0?{via:c}:{}}))},"push"),o=s((a,l)=>{if(a.scope!=="task")return;let d=F_(e,a.owner,a.key);if(d!==null){for(let c of N_(d.nodeId,d.template))if(!(c.kind!=="taskWhen"&&c.kind!=="taskReads"))for(let u of ta(c))i(u,"evidence",l,a)}},"carried");for(let{address:a,field:l}of A2(n))i(a,"written",l),o(a,l);return t}s(qo,"addressReadsOf");function Jl(e,n){switch(n.scope){case"env":return tr(n.key)?Fw(n.key):Ys(e,n.key)?.type;case"task":return n.path!==void 0||wi(e,n.owner,n.key)===null?void 0:Bw(e,n.key)?.type;case"node":{let t=e.nodes.find(i=>i.id===n.owner);if(t===void 0)return;let r=Jr(e,t).find(i=>i.address.scope==="node"&&i.address.key===n.key);return r===void 0?void 0:n.path===void 0?r.type:r.nodePort?.schema?.find(i=>i.key===n.path)?.type}}}s(Jl,"addressType");function Ep(e,n){let t=yt(e)?.[n];return typeof t=="string"&&t.length>0?t:void 0}s(Ep,"labelText");function _e(e,n,t){let r=e.nodes.find(i=>i.id===n);return Ep(r?.label,t)??n}s(_e,"nodeDisplayName");function Ko(e,n,t){for(let r of e.nodes){let i=(Array.isArray(r.tasks)?r.tasks:[]).find(o=>o.key===n);if(i!==void 0)return Ep(i.title,t)??n}return n}s(Ko,"taskDisplayName");function je(e,n,t){let r=[];switch(n.scope){case"env":r.push(tr(n.key)?Lw(n.key)[t]:Ys(e,n.key)?.label[t]??n.key);break;case"task":r.push(Ko(e,n.owner,t),Ep(Bw(e,n.key)?.label,t)??n.key);break;case"node":{r.push(_e(e,n.owner,t));let i=e.nodes.find(a=>a.id===n.owner),o=i===void 0?void 0:Jr(e,i).find(a=>a.address.scope==="node"&&a.address.key===n.key);r.push(Ep(o?.label,t)??n.key);break}}return n.scope!=="env"&&n.path!==void 0&&r.push(n.path),`${r.join(" \u203A ")} (${de(n)})`}s(je,"displayAddress");var Ql=["beneficiary","signers"];function Zl(e){let n=[];for(let[t,r]of Object.entries(yt(e.inputs)??{})){let i=yt(r);i?.kind==="binding"&&we(i.address)&&n.push({slot:t,address:i.address})}return n}s(Zl,"bindingAddresses");function L_(e,n){return Zl(e).find(t=>t.slot===n)?.address??null}s(L_,"bindingAddressAt");function M_(e,n){let t=s(i=>i.scope==="node"&&i.owner===n||i.scope==="task"&&wi(e,i.owner,i.key)===n,"names");return e.nodes.filter(i=>i.id!==n).flatMap(i=>Hl(i,{slotTypes:!1})).flatMap(i=>ta(i).filter(t).map(o=>({at:i.at,nodeId:i.nodeId,address:o})))}s(M_,"addressesNaming");var Mn={target:"target",flagKey:"flagKey",value:"value"};function E2(e){return L_(e,Mn.target)}s(E2,"setFlagTarget");function q_(e){let n=E2(e);return n!==null&&Rr(n)?n.owner:null}s(q_,"setFlagTargetOwner");function $p(e){let n=e.inputs?.[Mn.flagKey];return n?.kind==="literal"&&typeof n.value=="string"&&n.value.length>0?n.value:null}s($p,"setFlagKey");function K_(e){let n=e.inputs?.[Mn.value];if(n===void 0||n.kind==="unset")return!0;if(n.kind==="literal"&&typeof n.value=="boolean")return n.value;F(`[setFlag/valueType] setFlag node "${String(e.id)}": \`${Mn.value}\` is no yes/no literal \u2014 publish refuses that`)}s(K_,"setFlagValue");function j_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(j_,"isObject");var V_=["target","flagKey","value"];function B_(e){return j_(e)&&e.type==="setFlag"&&V_.some(n=>n in e)}s(B_,"oldShape");function U_(e){return(e?.nodes??[]).some(B_)}s(U_,"needsSetFlagInputMove");function T2(e){let n=j_(e.inputs)?{...e.inputs}:{};if(V_.some(a=>a in e&&Mn[a]in n))return{unmoved:"inputExists"};if("target"in e&&!we(e.target))return{unmoved:"targetNotAddress"};if("flagKey"in e&&typeof e.flagKey!="string")return{unmoved:"flagKeyNotString"};if("value"in e&&typeof e.value!="boolean")return{unmoved:"valueNotBoolean"};let{target:t,flagKey:r,value:i,...o}=e;return t!==void 0&&(n[Mn.target]={kind:"binding",address:t}),typeof r=="string"&&r.length>0&&(n[Mn.flagKey]={kind:"literal",value:r}),i!==void 0&&(n[Mn.value]={kind:"literal",value:i}),{node:{...o,inputs:n}}}s(T2,"moveNode");function G_(e){let n=[],t=[],r=e.nodes.map(i=>{if(!B_(i))return i;let o=T2(i);return"unmoved"in o?(t.push({nodeId:String(i.id),reason:o.unmoved}),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(G_,"moveSetFlagConfigToInputs");function z_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(z_,"isObject");var Uw={countersign:{dueInDays:"number"},decision:{allowSkipInTest:"boolean"},completenessCheck:{guestRole:"string"},governedDocument:{responseDueInDays:"number"}},Gw={review:["allowSkipInTest"]};function W_(e){return Uw[String(e)]??{}}s(W_,"movesOf");function Y_(e){return Gw[String(e)]??[]}s(Y_,"deadOf");function H_(e){return z_(e)&&[...Object.keys(W_(e.type)),...Y_(e.type)].some(n=>n in e)}s(H_,"oldShape");function J_(e){return(e?.nodes??[]).some(H_)}s(J_,"needsScalarInputMove");function R2(e,n){return n==="number"?typeof e=="number"&&Number.isInteger(e)&&e>=1:typeof e===n}s(R2,"wellTyped");function $2(e){let n=z_(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(W_(e.type))){if(!(r in e))continue;let o=e[r];if(r in n)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!(i==="string"&&o==="")&&!R2(o,i))return{unmoved:{nodeId:String(e.id),key:r,reason:"valueWrongType"}};o!==""&&(n[r]={kind:"literal",value:o}),delete t[r]}for(let r of Y_(e.type))delete t[r];return t.inputs=n,{node:t}}s($2,"moveNode");function Q_(e){let n=[],t=[],r=e.nodes.map(i=>{if(!H_(i))return i;let o=$2(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(Q_,"moveScalarConfigToInputs");var ra={team:{label:{de:"Team",en:"Team"},optionSource:"tenantTeams",existence:{check:"generic",catalog:"teamKeys"}},roleKey:{label:{de:"Rolle",en:"Role"},optionSource:"tenantRoles",existence:{check:"node",codes:["roleAssign/unknownRoleKey","completenessCheck/unknownRole"]}},article:{label:{de:"Artikel",en:"Article"},optionSource:"programArticles",existence:{check:"node",codes:["collectPayment/unknownArticle"]}},legalEntity:{label:{de:"Tr\xE4ger",en:"Legal entity"},optionSource:"tenantTraeger",existence:{check:"node",codes:["governedDocument/unknownTraeger","collectPayment/unknownPayee"]}},contractGenerator:{label:{de:"Vertragsgenerator",en:"Contract generator"},optionSource:"tenantGenerators",existence:{check:"publish",by:"admittedGeneratorByKey"}},documentTemplate:{label:{de:"Dokumentvorlage",en:"Document template"},optionSource:"tenantDocumentTemplates",existence:{check:"publish",by:"governedDocument/unknownTemplate"}},smartForm:{label:{de:"Formular",en:"Form"},optionSource:"offerSmartForms",existence:{check:"publish",by:"form/unknownSmartForm"}},unit:{label:{de:"Einrichtung",en:"Unit"},optionSource:"tenantUnits",existence:{check:"generic",catalog:"unitKeys"}},formFlag:{label:{de:"Merkmal im Formular",en:"Flag in the form"},optionSource:"targetFormFlags",existence:{check:"node",codes:["setFlag/unknownFlag"]}}};function Ip(e){return typeof e=="string"&&Object.hasOwn(ra,e)}s(Ip,"isResourceType");var Vpe=Object.keys(ra).filter(e=>ra[e].existence.check==="generic");function Z_(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.groupKey=="string"&&n.groupKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||Fo(n.reduction)===null&&n.reduction.kind==="amount")&&Object.keys(n).every(t=>t==="groupKey"||t==="grantKeys"||t==="reduction")}s(Z_,"isPricedGroupValue");var zw=["street","hausnr","plz","ort","land"];function X_(e){return zw.includes(e)}s(X_,"isAddressPart");var I2=["municipality","municipalityKey","district","districtKey"],Ww=[...zw,...I2],Yw={string:"text",email:"text",tel:"text",number:"number",date:"date",boolean:"boolean",consent:"boolean",enum:"option",address:"composite",docRef:"file",party:"edge",personRef:"edge",personList:"edge",roleKey:"roleKey",pricedItem:"pricedItem",pricedGroup:"pricedGroup",reduction:"reduction",article:"article",legalEntity:"legalEntity",contractGenerator:"contractGenerator",documentTemplate:"documentTemplate",localizedText:"localizedText",staffUser:"staffUser",staffUserList:"staffUser",taskAssignment:"taskAssignment"},ia=Object.keys(Yw);function Hi(e){return typeof e=="string"&&e in Yw}s(Hi,"isValueType");function dt(e){return e===void 0?void 0:Yw[e]}s(dt,"dataTypeOf");function Op(e,n){let t=dt(e),r=dt(n);return t!==void 0&&t===r}s(Op,"valueTypesCompatible");function jo(e){return e===null?"null is not a text in both languages":Xl(e,{type:"localizedText"})}s(jo,"completeLocalizedTextIssue");function Xl(e,n){if(Ip(n.type)&&!Hi(n.type))return typeof e=="string"&&e.length>0?null:`${JSON.stringify(e)} is not a ${n.type} key`;let t=dt(n.type),r=JSON.stringify(e),i=`slot type "${n.type}" takes a binding, not a literal`;if(t===void 0||t==="composite"||t==="file"||t==="edge"||t==="staffUser"||t==="taskAssignment")return i;if(e===null)return null;switch(t){case"text":return typeof e=="string"?null:`${r} is not a text (slot type "${n.type}")`;case"date":return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e)?null:`${r} is not a date YYYY-MM-DD`;case"number":return typeof e=="number"&&Number.isFinite(e)?null:`${r} is not a number`;case"boolean":return typeof e=="boolean"?null:`${r} is not true/false`;case"option":{if(typeof e!="string")return`${r} is not an option value`;let o=(n.enumOptions??[]).map(a=>a.value);return o.length===0||o.includes(e)?null:`${r} is not one of the options ${o.join(", ")}`}case"pricedItem":{let o=e;return typeof o=="object"&&typeof o.itemKey=="string"&&o.itemKey.length>0&&Array.isArray(o.grantKeys)&&o.grantKeys.every(a=>typeof a=="string")?null:`${r} is not a priced item {"itemKey":\u2026,"grantKeys":[\u2026]}`}case"pricedGroup":return Z_(e)?null:`${r} is not a priced group {"groupKey":\u2026,"grantKeys":[\u2026]}`;case"article":return typeof e=="string"&&e.length>0?null:`${r} is not an article key`;case"legalEntity":return typeof e=="string"&&e.length>0?null:`${r} is not a legal entity key`;case"contractGenerator":return zl(e)?null:`${r} is not a contract generator {"kind":"generator"|"package","key":\u2026,"revision"?:n}`;case"documentTemplate":return typeof e=="string"&&e.length>0?null:`${r} is not a document template key`;case"roleKey":return typeof e=="string"&&e.length>0?null:`${r} is not a role key`;case"localizedText":{let o=e,a=s(l=>typeof l=="string"&&l.trim().length>0,"filled");return typeof o=="object"&&Object.keys(o).sort().join(",")==="de,en"&&a(o.de)&&a(o.en)?null:`${r} is not a text in both languages {"de":\u2026,"en":\u2026}`}case"reduction":{let o=Fo(e);return o===null?null:`${r} is not a reduction \u2014 ${o.en}`}}}s(Xl,"literalTypeIssue");function eP(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(eP,"isObject");var O2={collectPayment:{reason:"reason"}},_2={governedDocument:["mockAutoProduce"]},nP={collectPayment:{reason:{de:"`reason` gibt es als Knoteneigenschaft nicht mehr \u2014 der Hinweis f\xFCr die Familie ist der Eingang `inputs.reason` (ein fester Text auf Deutsch und Englisch im Parameter-Bereich).",en:"`reason` no longer exists as a node property \u2014 the note for the family is the input `inputs.reason` (a fixed text in German and English among the parameters)."}},governedDocument:{template:{de:"`template` gibt es am Knoten nicht mehr \u2014 die Parameter geh\xF6ren der Vorlage (ihr Datensatz, `plexus-cli catalog` documentTemplates[].parameters) und werden beim Speichern und Ver\xF6ffentlichen als `templateStamp` \xFCbernommen.",en:"`template` no longer exists on the node \u2014 the parameters belong to the template (its record, `plexus-cli catalog` documentTemplates[].parameters) and are stamped as `templateStamp` on save and publish."},cockpitFields:{de:'`cockpitFields` gibt es nicht mehr \u2014 ein Parameter, der im Cockpit erg\xE4nzt wird, ist sein Eingang `{ kind: "cockpit" }` (im Parameter-Bereich \u201Eim Cockpit erg\xE4nzen").',en:'`cockpitFields` no longer exists \u2014 a parameter completed in the cockpit is its input `{ kind: "cockpit" }` ("complete in the cockpit" among the parameters).'},mockAutoProduce:{de:"`mockAutoProduce` gibt es nicht mehr \u2014 das Muster-Dokument, das ein Upload-Knoten beim Eintritt selbst einstellte, ist entfernt; das Dokument kommt aus einem Upload.",en:"`mockAutoProduce` no longer exists \u2014 the sample document an upload node put on its slot by itself on entry is removed; the document comes from an upload."}}};function Hw(e){return O2[String(e)]??{}}s(Hw,"movesOf");function tP(e){return _2[String(e)]??[]}s(tP,"deadOf");function rP(e){return eP(e)&&[...Object.keys(Hw(e.type)),...tP(e.type)].some(n=>n in e)}s(rP,"oldShape");function iP(e){return(e?.nodes??[]).some(rP)}s(iP,"needsNodeConfigInputMove");function P2(e){return jo(e)===null}s(P2,"isCompleteText");function N2(e){let n=eP(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(Hw(e.type)))if(r in e){if(i in n)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!P2(e[r]))return{unmoved:{nodeId:String(e.id),key:r,reason:"valueNotLocalized"}};n[i]={kind:"literal",value:e[r]},delete t[r]}for(let r of tP(e.type))delete t[r];return Object.keys(Hw(e.type)).some(r=>r in e)&&(t.inputs=n),{node:t}}s(N2,"moveNode");function oP(e){let n=[],t=[],r=e.nodes.map(i=>{if(!rP(i))return i;let o=N2(i);return"unmoved"in o?(t.push(o.unmoved),i):(n.push(String(i.id)),o.node)});return n.length===0?{graph:e,moved:n,unmoved:t}:{graph:{...e,nodes:r},moved:n,unmoved:t}}s(oP,"moveNodeConfigToInputs");var ed="collectPayment",oa=["online","manual"];function _p(e){return oa.includes(e)}s(_p,"isCollectPaymentMode");var Vo="paid",Jw="skipPayment",Qw="confirmPayment",Ji="article",ct="mode",Qi="reason",ir="payee",Zw=["one_time"];function Pp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Pp,"isObject");function sP(e){if(!Pp(e)||e.type!==ed)return!1;let n=Pp(e.inputs)?e.inputs:{},t=n[ct];return!Pp(t)||t.kind!=="literal"||t.value!=="online"?!1:!(ir in n)}s(sP,"isOnlinePaymentWithoutPayee");function aP(e){return(e?.nodes??[]).some(sP)}s(aP,"needsPayee");function lP(e,n={}){let t=[],r=[],i=e.nodes.map(o=>{if(!sP(o))return o;let a=String(o.id),l=Object.hasOwn(n,a)?n[a]:void 0;if(l===void 0||l==="")return r.push(a),o;t.push({nodeId:a,payee:l});let d=Pp(o.inputs)?o.inputs:{};return{...o,inputs:{...d,[ir]:{kind:"literal",value:l}}}});return t.length===0?{graph:e,set:t,refused:r}:{graph:{...e,nodes:i},set:t,refused:r}}s(lP,"setPayeeOnOnlinePayments");var dP="settlement",C2={online:"online",separate:"manual"};function Xw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Xw,"isObject");function cP(e){return Xw(e)&&e.type===ed&&Xw(e.inputs)&&dP in e.inputs}s(cP,"carriesSettlement");function uP(e){return(e?.nodes??[]).some(cP)}s(uP,"needsPaymentModeRename");function fP(e){let n=[],t=[],r=e.nodes.map(i=>{if(!cP(i))return i;let o=String(i.id),{[dP]:a,...l}=i.inputs;if(ct in l)return t.push({nodeId:o,reason:"bothCells"}),i;let d=Xw(a)&&a.kind==="literal"&&typeof a.value=="string"?C2[a.value]:void 0;return d===void 0?(t.push({nodeId:o,reason:"unknownValue"}),i):(n.push(o),{...i,inputs:{...l,[ct]:{...a,value:d}}})});return n.length===0?{graph:e,moved:n,refused:t}:{graph:{...e,nodes:r},moved:n,refused:t}}s(fP,"renameSettlementToMode");var mP="formView";function Np(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Np,"isObject");function ek(e){return Array.isArray(e.tasks)?e.tasks:[]}s(ek,"tasksOf");function nd(e){return Np(e)&&mP in e}s(nd,"carriesFormView");function hP(e){return(e?.nodes??[]).some(n=>nd(n)||Np(n)&&ek(n).some(nd))}s(hP,"needsFormViewMove");function pP(e){let{[mP]:n,...t}=e;return"view"in t?"bothFields":!Np(n)||typeof n.form!="string"||typeof n.key!="string"?"malformed":{...t,view:{kind:"form",form:n.form,view:n.key}}}s(pP,"moved");function gP(e){let n=[],t=[],r=e.nodes.map(i=>{if(!Np(i))return i;let o=String(i.id),a=i;if(nd(a)){let l=pP(a);typeof l=="string"?t.push({nodeId:o,reason:l}):(a=l,n.push(o))}return ek(a).some(nd)&&(a={...a,tasks:ek(a).map(l=>{if(!nd(l))return l;let d=String(l.key),c=pP(l);return typeof c=="string"?(t.push({nodeId:o,taskKey:d,reason:c}),l):(n.push(`${o}.${d}`),c)})}),a});return n.length===0?{graph:e,moved:n,refused:t}:{graph:{...e,nodes:r},moved:n,refused:t}}s(gP,"moveFormViewToView");function Dp(e){if(!Array.isArray(e))return[{code:"shape",index:null,detail:`expected a list of rows, got ${Cp(e)}`}];if(e.length===0)return[{code:"shape",index:null,detail:"expected at least the default row, got an empty list"}];let n=[];for(let i=0;i<e.length;i++){let o=F2(e[i]);o!==null&&n.push({code:"shape",index:i,detail:o})}if(n.length>0)return n;let t=e.flatMap((i,o)=>i.when===null?[o]:[]),r=e.length-1;return(t.length!==1||t[0]!==r)&&n.push({code:"defaultLast",index:t.find(i=>i!==r)??null,detail:D2(t,r)}),n}s(Dp,"teamRulesShapeIssues");function D2(e,n){return e.length===0?"no default row (`when: null`) \u2014 the last row must be the default":e.length>1?`${e.length} default rows (rows ${e.join(", ")}) \u2014 exactly one, the last`:`the default row is row ${e[0]}, not the last (${n})`}s(D2,"defaultLastDetail");function nk(e,n){let t=Dp(e);return t.length>0&&F(`[assign/${t[0].code}] ${n}: ${t.map(r=>r.index===null?r.detail:`row ${r.index}: ${r.detail}`).join("; ")} \u2014 publish refuses such a graph`),e}s(nk,"readTeamRules");function Fp(e){return Dp(e).length===0?e:null}s(Fp,"tryReadTeamRules");function Kt(e){return Lp([],e)}s(Kt,"fixedTeam");function Lp(e,n){return nk([...e.map(({when:t,team:r})=>({when:t,team:r})),{when:null,team:n}],"a constructed team position")}s(Lp,"teamRulesOf");function tk(e,n){return e===void 0?Kt(n):Lp(e.slice(0,-1),n)}s(tk,"withDefaultTeam");function yP(e){let n=e[e.length-1];return n===void 0&&F("[assign/shape] a team position has at least its default row \u2014 read it through readTeamRules"),n.team}s(yP,"defaultTeamOf");function wP(e){let n=new Map,t=[];return e.forEach((r,i)=>{if(r.when===null)return;let o=de(r.when),a=n.get(o);a===void 0?n.set(o,i):t.push({index:i,first:a})}),t}s(wP,"shadowedRows");function F2(e){if(typeof e!="object"||e===null||Array.isArray(e))return`expected { when, team }, got ${Cp(e)}`;let n=e,t=Object.keys(n).filter(r=>r!=="when"&&r!=="team");return t.length>0?`unknown key(s) ${t.map(r=>`"${r}"`).join(", ")} \u2014 a row is { when, team }`:typeof n.team!="string"||n.team.length===0?`"team" must be a team key, got ${Cp(n.team)}`:"when"in n?n.when!==null&&!we(n.when)?`"when" must be an address or null, got ${Cp(n.when)}`:null:'"when" is missing \u2014 the default row says `when: null`'}s(F2,"rowShapeProblem");function Cp(e){if(e===void 0)return"nothing";let n;try{n=JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length>80?`${n.slice(0,77)}...`:n}s(Cp,"describe");function kP(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(kP,"isObject");function bP(e){return kP(e)&&kP(e.assign)?e.assign:null}s(bP,"assignOf");function vP(e){return(e?.nodes??[]).some(n=>Object.values(bP(n)??{}).some(t=>typeof t=="string"))}s(vP,"needsNodeAssignFold");function xP(e){let n=[],t=[],r=e.nodes.map(i=>{let o=bP(i);if(o===null)return i;let a=String(i.id),l=!1,d={};for(let[c,u]of Object.entries(o))typeof u=="string"&&u.length>0?(d[c]=Kt(u),n.push({nodeId:a,templateKey:c}),l=!0):(!Array.isArray(u)&&u!==void 0&&t.push({nodeId:a,templateKey:c}),d[c]=u);return l?{...i,assign:d}:i});return n.length===0?{graph:e,moved:n,refused:t}:{graph:{...e,nodes:r},moved:n,refused:t}}s(xP,"foldNodeAssignToTeamRules");function Qr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Qr,"isObject");function rk(e){return Array.isArray(e.tasks)?e.tasks:[]}s(rk,"tasksOf");function td(e){return Qr(e)&&Array.isArray(e.documents)?e.documents:[]}s(td,"documentsOf");function rd(e){return Qr(e)&&e.kind==="document"}s(rd,"isDocumentRef");function SP(e){return(e?.nodes??[]).some(n=>Qr(n)&&rk(n).some(t=>td(t).some(rd)))}s(SP,"needsDocumentRefMove");function L2(e,n){let t=n.address;if(!Qr(t)||t.scope!=="node"||typeof t.owner!="string"||t.path!==void 0||t.key!=="document"&&t.key!=="contract"&&t.key!=="contracts")return null;let r=e.find(a=>Qr(a)&&a.id===t.owner),i=Qr(r)&&Array.isArray(r.artifacts)?r.artifacts:[];if(i.length!==1)return null;let o=Qr(i[0])?i[0].key:void 0;return typeof o=="string"&&o.length>0?o:null}s(L2,"slotOf");function AP(e){let n=[],t=[],r=e.nodes.map(i=>{if(!Qr(i)||!rk(i).some(a=>td(a).some(rd)))return i;let o=String(i.id);return{...i,tasks:rk(i).map(a=>{if(!Qr(a)||!td(a).some(rd))return a;let l=String(a.key),d=td(a).map(p=>rd(p)?L2(e.nodes,p):void 0);if(d.includes(null))return t.push({nodeId:o,taskKey:l,reason:"noSlot"}),a;let c=new Set,u=td(a).flatMap((p,h)=>{let y=rd(p)?{kind:"artifact",key:d[h]}:p;if(!Qr(y)||y.kind!=="artifact")return[y];let k=String(y.key);return c.has(k)?[]:(c.add(k),[y])});return n.push(`${o}.${l}`),{...a,documents:u}})}});return n.length===0?{graph:e,moved:n,refused:t}:{graph:{...e,nodes:r},moved:n,refused:t}}s(AP,"moveDocumentRefsToArtifact");function Mp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Mp,"isObject");function ik(e){return Mp(e)&&Mp(e.assign)&&"userId"in e.assign}s(ik,"namesUser");function qp(e){return(e?.nodes??[]).flatMap(n=>Mp(n)&&Array.isArray(n.tasks)?n.tasks.filter(ik).map(t=>({nodeId:String(n.id),taskKey:String(t.key),hasTeam:typeof t.assign.group=="string"&&t.assign.group.length>0})):[])}s(qp,"taskUserAssignments");function EP(e){let n=qp(e);if(n.length===0)return{graph:e,dropped:n};let t=e.nodes.map(r=>{if(!Mp(r)||!Array.isArray(r.tasks)||!r.tasks.some(ik))return r;let i=r.tasks.map(o=>{if(!ik(o))return o;let{userId:a,...l}=o.assign,{assign:d,...c}=o;return Object.keys(l).length===0?c:{...c,assign:l}});return{...r,tasks:i}});return{graph:{...e,nodes:t},dropped:n}}s(EP,"dropTaskAssignUserIds");function RP(e,n,t){let r=Dp(e);return r.length>0?r.map(i=>{let o=i.index===null?n:`${n}.${i.index}`;return i.code==="defaultLast"?TP(o,{de:`[assign/defaultLast] ${t.de}: genau eine Sonst-Zeile (\`when: null\`), und sie steht am Ende \u2014 ${i.detail}.`,en:`[assign/defaultLast] ${t.en}: exactly one default row (\`when: null\`), and it is the last \u2014 ${i.detail}.`}):TP(o,{de:`[assign/shape] ${t.de}${i.index===null?"":`, Zeile ${i.index}`}: ${i.detail}.`,en:`[assign/shape] ${t.en}${i.index===null?"":`, row ${i.index}`}: ${i.detail}.`})}):wP(e).map(({index:i,first:o})=>$P(`${n}.${i}.when`,"warning",{de:`[assign/duplicateRow] ${t.de}: Zeile ${i} hat dieselbe Bedingung wie Zeile ${o} und greift nie.`,en:`[assign/duplicateRow] ${t.en}: row ${i} has the same condition as row ${o} and never applies.`}))}s(RP,"teamRulesIssues");function $P(e,n,t){return{layer:"GRAPH",kind:"nodeRule",path:e,reason:t,severity:n}}s($P,"issue");function TP(e,n){return $P(e,"error",n)}s(TP,"error");var sa={"assign{}":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der Knoten-Aufgabe",en:"team of the node task"},consequence:{de:"beim Betreten des Knotens entsteht die Aufgabe f\xFCr niemanden",en:"entering the node creates the task for nobody"}},"actionTeams{}":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Knoten-Aktion ausf\xFChren darf",en:"team that may perform the node action"},consequence:{de:"au\xDFer der zust\xE4ndigen Person darf niemand die Aktion ausf\xFChren",en:"nobody but the responsible person may perform the action"}},"tasks[].assign.group":{kind:"team",codec:"key",involves:!0,required:!0,what:{de:"Team der Aufgabe",en:"team of the task"},consequence:{de:"die Aufgabe kann nicht angelegt werden, und der Prozess bleibt stehen",en:"the task cannot be created and the process stops"}},"tasks[].params.revisionGroup":{kind:"team",codec:"key",involves:!0,required:!1,what:{de:"Team der \xDCberarbeitung",en:"revision team"},consequence:{de:"eine Ablehnung findet niemanden, der \xFCberarbeitet",en:"a rejection finds nobody to revise"}},"tasks[].result.chat":{kind:"team",codec:"chatTarget",involves:!1,required:!1,what:{de:"Chat des Ergebnisses",en:"chat of the result"},consequence:{de:"das Ergebnis l\xE4sst sich nicht im Chat ablegen",en:"the result cannot be posted to the chat"}},"tasks[].result.primaryParticipantTeams":{kind:"team",codec:"key",involves:!1,required:!1,list:!0,what:{de:"Team oben in der Teilnehmer-Auswahl",en:"team listed first in the participant picker"},consequence:{de:"die Teilnehmer-Auswahl kann das Team nicht oben zeigen",en:"the participant picker cannot list the team first"}},"optionalActions[].trigger":{kind:"team",codec:"key",involves:!1,required:!1,what:{de:"Team, das die Aktion ausl\xF6sen darf",en:"team that may trigger the action"},consequence:{de:"niemand au\xDFer der Prozessverantwortung kann die Aktion ausl\xF6sen",en:"nobody but the process owner can trigger the action"}}},ok=s(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null,"record");function Kp(e,n){if(typeof n!="string"||n.length===0)return null;if(e==="key")return n;let t=ea(n);return t?.kind==="team"?t.groupKey:null}s(Kp,"decodeKey");var IP={"assign{}":"assign","actionTeams{}":"actionTeams"},M2=s(e=>e in IP,"isMapLeaf");function q2(e){let n=/^(tasks|optionalActions)\[\](?:\.([a-zA-Z]+))?\.([a-zA-Z]+)$/.exec(e);return n===null&&F(`[resource] unreadable reference leaf "${e}"`),{list:n[1],field:n[2]??null,key:n[3]}}s(q2,"locate");function jp(e){let n=[],t=e;for(let[r,i]of Object.entries(IP))for(let[o,a]of Object.entries(ok(t[i])??{})){if(r==="assign{}"){let l=Fp(a);if(l===null){n.push({path:`${i}.${o}`,leaf:r,owner:o,key:Kp("key",a),missing:typeof a!="string"||a.length===0});continue}l.forEach((d,c)=>{n.push({path:`${i}.${o}.${c}.team`,leaf:r,owner:o,index:c,key:d.team,missing:!1})});continue}n.push({path:`${i}.${o}`,leaf:r,owner:o,key:Kp("key",a),missing:typeof a!="string"||a.length===0})}for(let r of Object.keys(sa)){if(M2(r))continue;let i=sa[r],{list:o,field:a,key:l}=q2(r);for(let d of Array.isArray(t[o])?t[o]:[]){let c=ok(d);if(c===null||typeof c.key!="string")continue;let p=(a===null?c:ok(c[a]))?.[l];if(p===void 0&&!i.required)continue;let h=`${o}.${c.key}${a===null?"":`.${a}`}.${l}`;if(i.list===!0){if(!Array.isArray(p)){n.push({path:h,leaf:r,owner:c.key,key:null,missing:!0});continue}let k=c.key;p.forEach((w,b)=>{n.push({path:`${h}.${b}`,leaf:r,owner:k,index:b,key:Kp(i.codec,w),missing:typeof w!="string"||w.length===0})});continue}let y=typeof p!="string"||p.length===0;n.push({path:`${o}.${c.key}${a===null?"":`.${a}`}.${l}`,leaf:r,owner:c.key,key:Kp(i.codec,p),missing:y})}}return n}s(jp,"nodeResourceReferences");var OP=s(e=>(e??[]).map(n=>`\u201E${n}\u201C`).join(", "),"list"),_P=s(e=>(e??[]).map(n=>`"${n}"`).join(", "),"listEn"),K2={"address/shape":{de:s(e=>({problem:`${e.where}: \u201E${e.address}\u201C ist keine g\xFCltige Adresse.`,remedy:"W\xE4hle die Adresse in der Auswahl neu."}),"de"),en:s(e=>({problem:`${e.where}: "${e.address}" is not a valid address.`,remedy:"Choose the address again from the picker."}),"en")},"address/missing":{de:s(e=>({problem:`${e.where}: Hier fehlt die Adresse, ohne die dieser Schritt nicht arbeiten kann.`,remedy:"W\xE4hle sie in der Auswahl."}),"de"),en:s(e=>({problem:`${e.where}: The address this step cannot work without is missing.`,remedy:"Choose it from the picker."}),"en")},"address/bareIdentifier":{de:s(e=>({problem:`${e.where}: \u201E${e.address}\u201C nennt nur einen Schl\xFCssel, nicht, wer ihn erzeugt.`,remedy:"W\xE4hle in der Auswahl die volle Adresse, z. B. das Feld aus dem Formular, das es erfasst."}),"de"),en:s(e=>({problem:`${e.where}: "${e.address}" names a key only, not who produces it.`,remedy:"Choose the full address from the picker, e.g. the field from the form that collects it."}),"en")},"address/unknownOwner":{de:s(e=>({problem:`${e.where}: ${e.address} nennt einen Knoten oder eine Aufgabe, die es im Ablauf nicht gibt.`,remedy:"W\xE4hle eine Adresse aus der Auswahl."}),"de"),en:s(e=>({problem:`${e.where}: ${e.address} names a node or task the workflow does not have.`,remedy:"Choose an address from the picker."}),"en")},"address/unknownKey":{de:s(e=>({problem:`${e.where}: ${e.producer??"der Erzeuger"} erzeugt ${e.address} nicht.`,remedy:"W\xE4hle einen Wert, den der Erzeuger tats\xE4chlich liefert."}),"de"),en:s(e=>({problem:`${e.where}: ${e.producer??"the producer"} does not produce ${e.address}.`,remedy:"Choose a value the producer actually delivers."}),"en")},"address/envCohortBound":{de:s(e=>({problem:`${e.where}: ${e.address} \xE4ndert sich, wenn Stufe oder Schuljahr gewechselt werden \u2014 ein Dokument, das den Wert druckt, w\xFCrde das nicht bemerken.`,remedy:"Lies den Wert \xFCber ein Formularfeld, das ihn berechnet (z. B. \u201EKlassenstufe\u201C): ein Wechsel friert es neu ein und h\xE4lt ein gedrucktes Dokument an."}),"de"),en:s(e=>({problem:`${e.where}: ${e.address} changes when the application's stage or school year is changed \u2014 a document printing it would not notice.`,remedy:'Read it through a form field that computes it (e.g. "Grade"): a change re-freezes it and holds a printed document.'}),"en")},"address/staffInputConditionOnly":{de:s(e=>({problem:`${e.where}: ${e.address} ist eine interne Angabe beim Anlegen \u2014 sie lenkt eine Weiche (\u201EWenn\u201C-Knoten) oder f\xFCllt einen Parameter eines Knotens.`,remedy:"Lies sie in der Bedingung eines \u201EWenn\u201C-Knotens oder binde einen Parameter des Knotens daran (z. B. im Vertrag); Formulare, Aufgaben und Regeln lesen sie nicht."}),"de"),en:s(e=>({problem:`${e.where}: ${e.address} is a staff input set at the start \u2014 it steers a branch (an "If" node) or fills a node's parameter.`,remedy:'Read it in the condition of an "If" node or bind a node parameter to it (e.g. in the contract); forms, tasks and rules do not read it.'}),"en")},"address/ownerNotWriter":{de:s(e=>({problem:`${e.where}: Die Aufgabe \u201E${e.producer}\u201C schreibt ${e.address} nicht.`,remedy:"W\xE4hle den Wert \xFCber seinen Schl\xFCssel; die schreibende Aufgabe folgt daraus."}),"de"),en:s(e=>({problem:`${e.where}: The task "${e.producer}" does not write ${e.address}.`,remedy:"Choose the value by its key; the writing task follows from it."}),"en")},"address/taskOwnerTaken":{de:s(e=>({problem:`${e.where}: Den Aufgaben-Schl\xFCssel gibt es mehrfach (${OP(e.names)}), und eine dieser Aufgaben schreibt Prozesswerte.`,remedy:"Gib der schreibenden Aufgabe einen Schl\xFCssel, den keine andere Aufgabe tr\xE4gt."}),"de"),en:s(e=>({problem:`${e.where}: The task key is used more than once (${_P(e.names)}), and one of these tasks writes process values.`,remedy:"Give the writing task a key no other task carries."}),"en")},"address/notVisible":{de:s(e=>({problem:e.producerNode!==void 0&&e.producerNode!==e.producer?`${e.where}: ${e.address} \u2014 \u201E${e.producer}\u201C h\xE4ngt an \u201E${e.producerNode}\u201C, das nicht auf jedem Weg vor \u201E${e.reader}\u201C liegt.`:`${e.where}: ${e.address} \u2014 \u201E${e.producer}\u201C liegt nicht auf jedem Weg vor \u201E${e.reader}\u201C.`,remedy:`Lies nur, was auf jedem Weg vor \u201E${e.reader}\u201C entsteht, oder ordne die Schritte so, dass der Erzeuger immer vorher l\xE4uft.`}),"de"),en:s(e=>({problem:e.producerNode!==void 0&&e.producerNode!==e.producer?`${e.where}: ${e.address} \u2014 "${e.producer}" hangs on "${e.producerNode}", which does not lie before "${e.reader}" on every path.`:`${e.where}: ${e.address} \u2014 "${e.producer}" does not lie before "${e.reader}" on every path.`,remedy:`Read only what is produced before "${e.reader}" on every path, or order the steps so the producer always runs first.`}),"en")},"address/pathNotInTarget":{de:s(e=>({problem:`${e.where}: ${e.address} \u2014 ${e.producer??"der Erzeuger"} hat dieses Feld nicht.`,remedy:"W\xE4hle ein Feld, das es dort gibt."}),"de"),en:s(e=>({problem:`${e.where}: ${e.address} \u2014 ${e.producer??"the producer"} has no such field.`,remedy:"Choose a field that exists there."}),"en")},"address/notExported":{de:s(e=>({problem:`${e.where}: ${e.address} \u2014 das Feld gibt es in ${e.producer??"dem Formular"}, es ist aber nicht exportiert.`,remedy:"Setze am Feld im Formular `export: true` (ein berechnetes Feld braucht dazu `exportType`). Ist es schon exportiert, ist der Stempel des Bundles veraltet: `plexus-cli offer workflow restamp-exports` laufen lassen."}),"de"),en:s(e=>({problem:`${e.where}: ${e.address} \u2014 ${e.producer??"the form"} has this field, but it is not exported.`,remedy:"Set `export: true` on the field in the form (a computed field also needs `exportType`). If it is exported already, the bundle's stamp is stale: run `plexus-cli offer workflow restamp-exports`."}),"en")},"address/typeMismatch":{de:s(e=>({problem:`${e.where}: erwartet ${e.expected}, ${e.address} ist ${e.actual}.`,remedy:`W\xE4hle einen Wert vom Typ ${e.expected}.`}),"de"),en:s(e=>({problem:`${e.where}: expects ${e.expected}, ${e.address} is ${e.actual}.`,remedy:`Choose a value of type ${e.expected}.`}),"en")},"address/notFormInstance":{de:s(e=>({problem:`${e.where}: ${e.address} ist kein ganzes Formular.`,remedy:"W\xE4hle das Formular des Knotens, der es anlegt \u2014 ohne Feld, nicht den Knoten, der es \xFCbernimmt."}),"de"),en:s(e=>({problem:`${e.where}: ${e.address} is not a whole form.`,remedy:"Choose the form of the node that creates it \u2014 without a field, not the node that continues it."}),"en")},"address/mixedForms":{de:s(e=>({problem:`${e.where}: Die Liste liest Felder aus mehreren Formularen (${OP(e.names)}), beurteilt wird sie aber an einem Formular.`,remedy:"W\xE4hle alle Felder dieser Liste aus demselben Formular."}),"de"),en:s(e=>({problem:`${e.where}: The list reads fields of several forms (${_P(e.names)}) but is judged on one.`,remedy:"Choose every field of this list from the same form."}),"en")},"workItems/keyFormat":{de:s(e=>({problem:`${e.where}: Der Aufgaben-Schl\xFCssel \u201E${e.address}\u201C hat nicht die Form ^[a-z][a-zA-Z0-9_]*$.`,remedy:"Benenne die Aufgabe in camelCase um, z. B. \u201EgeschwisterRang\u201C."}),"de"),en:s(e=>({problem:`${e.where}: The task key "${e.address}" does not match ^[a-z][a-zA-Z0-9_]*$.`,remedy:'Rename the task in camelCase, e.g. "siblingRank".'}),"en")}};function aa(e,n,t){let{problem:r,remedy:i}=K2[e][t](n);return`[${e}] ${r} ${i}`}s(aa,"addressMessage");var PP={type:"enum",dataType:"option"};function NP(e,n){return e.enumOptionLabels?.[n]??{de:n,en:n}}s(NP,"inlineEnumOptionLabel");var DP={string:"string",boolean:"boolean",consent:"boolean",date:"date",enum:"enum",email:"email",tel:"tel",address:"address"};function Vp(e){return DP[e]!==void 0}s(Vp,"isExportableFieldType");function j2(e){return e.exportType===void 0&&F(`formExports: computed '${e.key}' is exported without an exportType \u2014 the publish validator should have refused this form.`),{key:e.key,type:e.exportType,label:e.label??{de:e.key,en:e.key}}}s(j2,"leafForComputed");function CP(e){let n=DP[e.type];return n===void 0&&F(`formExports: field '${e.key}' has type '${e.type}', which is not exportable \u2014 the publish validator should have refused this form.`),{key:e.key,type:n,label:e.label,...e.enumOptions!==void 0?{enumOptions:e.enumOptions.map(t=>({value:t,label:NP(e,t)}))}:{}}}s(CP,"leafFor");function sk(e){let n=[],t=s(r=>{for(let i of r.fields)i.export===!0&&n.push(CP(i));for(let i of r.groups??[])for(let o of i.fields)o.export===!0&&n.push(CP(o));for(let i of r.computed??[])i.export===!0&&n.push(j2(i));for(let i of r.subsections??[])t(i)},"visit");for(let r of e.sections)t(r);return n}s(sk,"exportedFormLeaves");function or(e){let n=[];for(let t of e){let r=t.next;if(r)for(let[i,o]of Object.entries(r))n.push({id:`${t.id}|${i}`,source:t.id,target:o.to,sourceBranchId:i})}return n}s(or,"derivedEdges");function ak(e){let n=new Map;for(let t of or(e.nodes)){let r=n.get(t.source)??[];r.push(t.target),n.set(t.source,r)}return n}s(ak,"successorsOf");function la(e,n,t){if(n===t)return!0;let r=ak(e),i=new Set([...r.values()].flat()),o=e.nodes.filter(l=>!i.has(l.id)&&l.id!==n).map(l=>l.id),a=new Set(o);for(;o.length>0;){let l=o.shift();if(l===t)return!1;for(let d of r.get(l)??[])d===n||a.has(d)||(a.add(d),o.push(d))}return!0}s(la,"dominates");function FP(e,n,t){if(n===t)return!0;let r=ak(e),i=[n],o=new Set(i);for(;i.length>0;){let a=i.shift();for(let l of r.get(a)??[]){if(l===t)return!0;o.has(l)||(o.add(l),i.push(l))}}return!1}s(FP,"reaches");function LP(e,n,t,r){let i=new Map(e.nodes.map(d=>[d.id,d])),o=ak(e),a=[n],l=new Set(a);for(;a.length>0;){let d=a.shift();for(let c of o.get(d)??[]){if(l.has(c)||t.has(c))continue;l.add(c);let u=i.get(c);if(u!==void 0&&r(u))return c;a.push(c)}}return null}s(LP,"reachedAvoiding");function lk(e,n){let t=[],r=s(i=>({address:i.address,type:i.type,...i.label!==void 0?{label:i.label}:{},nodeId:i.nodeId}),"toVisible");for(let i of e.nodes)if(la(e,i.id,n))for(let o of Jr(e,i))t.push(r(o));for(let i of $_)t.push({address:{scope:"env",key:i},type:Fw(i),label:Lw(i),nodeId:null});for(let i of pp(e))t.push({address:{scope:"env",key:mp(i.key)},type:i.type,label:i.label,nodeId:null});return t}s(lk,"visibleAddressesAt");function Zr(e,n){let t=e?.readinessFormFieldsByFormNode?.get(n.owner);if(t!==void 0)return t.get(n.path)??null}s(Zr,"formFieldEntryOf");var MP={binding:{de:"Eingang",en:"Input"},condition:{de:"Bedingung",en:"Condition"},nodeReads:{de:"Gelesene Felder",en:"Fields read"},requires:{de:"Geforderte Felder",en:"Required fields"},adoptForm:{de:"\xDCbernommenes Formular",en:"Continued form"},setFlagTarget:{de:"Freizuschaltendes Formular",en:"Form to unlock"},form:{de:"Formular",en:"Form"},contract:{de:"Vertrag",en:"Contract"},payment:{de:"Zahlung",en:"Payment"},taskWhen:{de:"Bedingung",en:"Condition"},optionalActionWhen:{de:"Bedingung der optionalen Aktion",en:"Condition of the optional action"},taskReads:{de:"Gelesene Felder der Aufgabe",en:"Fields the task reads"},taskDocument:{de:"Dokumente",en:"Documents"},familyRequestFields:{de:"Nachforderbare Felder",en:"Requestable fields"},familyRequestFrom:{de:"Nachforderung aus",en:"Request from"},suggest:{de:"Vorschlag",en:"Suggestion"},taskInput:{de:"Vorgaben",en:"Inputs"},teamWhen:{de:"Bedingung des Teams",en:"Condition of the team"}},V2=new Set(["nodeReads","requires","taskReads","taskDocument","familyRequestFields"]);function B2(e,n,t){let r=[];n.taskKey!==void 0&&r.push(`${t==="de"?"Aufgabe":"task"} \u201E${Ko(e,n.taskKey,t)}\u201C`);let i=n.kind==="binding"?` \u201E${n.at.split(".").pop()}\u201C`:"";return r.push(`${MP[n.kind][t]}${i}`),r.join(" \u203A ")}s(B2,"addressFieldWhere");function id(e,n,t){let r=B2(e,n,t);return`\u201E${_e(e,n.nodeId,t)}\u201C \u203A ${r}`}s(id,"whereOf");function qP(e,n,t){if(n.scope==="node")return _e(e,n.owner,t);if(n.scope==="task")return Ko(e,n.owner,t)}s(qP,"producerName");function KP(e,n){let t=[],r=new Set,i=s((l,d,c)=>{let u={de:aa(l,c("de"),"de"),en:aa(l,c("en"),"en")},p=`${d}|${u.de}`;r.has(p)||(r.add(p),t.push({layer:"GRAPH",kind:"nodeRule",path:d,reason:u,severity:"error"}))},"report"),o=new Map(e.nodes.map(l=>[l.id,l])),a=[...e.nodes.flatMap(l=>Hl(l))];for(let l of a){let d=s(c=>id(e,l,c),"where");for(let c of U2(e,l,i))z2(e,l,c,i)&&(Y2(e,l,c,n,i),Kw.has(l.kind)&&!Q2(o,c)&&i("address/notFormInstance",l.at,u=>({where:d(u),address:je(e,c,u)})))}return Z2(e,i),X2(e,a,i),rY(e,i),oY(e,i),t}s(KP,"checkAddresses");function U2(e,n,t){let r=s(i=>id(e,n,i),"where");if(jw(n)){let i=Vw(n.value)??[];for(let o of i)o.address===null&&t(o.reason==="bareIdentifier"?"address/bareIdentifier":"address/shape",n.at,a=>({where:r(a),address:o.identifier}));return ta(n)}return typeof n.value=="string"?(t("address/bareIdentifier",n.at,i=>({where:r(i),address:n.value})),[]):we(n.value)?[n.value]:(t("address/shape",n.at,i=>({where:r(i),address:JSON.stringify(n.value)??"undefined"})),[])}s(U2,"checkFieldShape");function jP(e,n,t,r){let i=qP(e,t,r);return{where:id(e,n,r),address:je(e,t,r),...i!==void 0?{producer:i}:{}}}s(jP,"addressParams");function G2(e,n,t){return Dw(n)||t==="optionalActionWhen"&&(Ys(e,n)!==void 0||tr(n))?null:Ys(e,n)!==void 0?t==="condition"||t==="binding"?null:"address/staffInputConditionOnly":tr(n)?"address/envCohortBound":"address/unknownKey"}s(G2,"envAddressRefusal");function z2(e,n,t,r){let i=s(o=>jP(e,n,t,o),"params");switch(t.scope){case"env":{let o=G2(e,t.key,n.kind);return o===null?!0:(r(o,n.at,i),!1)}case"task":return e.nodes.some(a=>(a.tasks??[]).some(l=>l.key===t.owner))?(e.processStore??[]).some(a=>a.key===t.key)?wi(e,t.owner,t.key)===null?(r("address/ownerNotWriter",n.at,i),!1):!0:(r("address/unknownKey",n.at,i),!1):(r("address/unknownOwner",n.at,i),!1);case"node":{let o=e.nodes.find(a=>a.id===t.owner);return o===void 0?(r("address/unknownOwner",n.at,i),!1):Jr(e,o).some(a=>a.address.scope==="node"&&a.address.key===t.key)?!0:(r(Kw.has(n.kind)&&It(o)?"address/notFormInstance":"address/unknownKey",n.at,i),!1)}}}s(z2,"resolves");function W2(e,n){return e===void 0||n===void 0||dt(n)===void 0?!0:dt(e)!==void 0&&Op(e,n)}s(W2,"addressTypeFits");function Y2(e,n,t,r,i){let o=s(l=>jP(e,n,t,l),"params");if(t.scope!=="env"&&t.path!==void 0&&!J2(e,n,t,r)){i(H2(t,r)?"address/notExported":"address/pathNotInTarget",n.at,o);return}if(n.expectedType===void 0)return;let a=Jl(e,t);W2(a,n.expectedType)||i("address/typeMismatch",n.at,l=>({...o(l),expected:n.expectedType,actual:a}))}s(Y2,"checkPathAndType");function H2(e,n){if(e.scope!=="node"||e.key!==Un||e.path===void 0)return!1;let t=Zr(n,{scope:"node",owner:e.owner,key:Un,path:e.path});return t==null?!1:t.kind==="computed"||!t.repeated&&Vp(t.type)}s(H2,"formFieldUnexported");function J2(e,n,t,r){if(t.scope!=="node")return!1;if(Jl(e,t)!==void 0)return!0;if(t.key!==Un)return!1;if(!V2.has(n.kind))return e.nodes.find(o=>o.id===t.owner)?.formExports===void 0;let i=r?.readinessFormFieldsByFormNode?.get(t.owner);return i===void 0||i.has(t.path)}s(J2,"pathExists");function Q2(e,n){if(!Rr(n))return!1;let t=e.get(n.owner);return t!==void 0&&t.type==="form"&&!It(t)}s(Q2,"isCreatingFormInstance");function Z2(e,n){for(let t of e.nodes){let r=new Set(Hl(t).map(i=>i.kind));for(let i of P_(t))r.has(i)||n("address/missing",`nodes.${t.id}.${i}`,o=>({where:`\u201E${_e(e,t.id,o)}\u201C \u203A ${MP[i][o]}`}))}}s(Z2,"checkRequiredFields");function X2(e,n,t){let r=new Map;for(let i of n)if(i.judgedTogether!==null)for(let o of ta(i)){if(o.scope!=="node"||o.key!==Un)continue;let a=r.get(i.judgedTogether)??[];a.push({field:i,owner:o.owner}),r.set(i.judgedTogether,a)}for(let[i,o]of r){let a=[...new Set(o.map(l=>l.owner))];a.length<2||t("address/mixedForms",i,l=>({where:id(e,o[0].field,l),names:a.map(d=>_e(e,d,l))}))}}s(X2,"checkMixedForms");function eY(e,n){return e.type==="engagePush"&&n.kind==="payment"}s(eY,"readSkipsAbsentProducer");function nY(e,n,t){return n!==t&&FP(e,n,t)}s(nY,"precedesOnSomePath");function tY(e,n,t,r){let i=Mw(t.address);return r.has(de(i))||!iY(e,i)?!0:t.origin==="written"&&i.scope==="node"&&eY(n,t.field)&&nY(e,i.owner,n.id)}s(tY,"readPassesVisibility");function rY(e,n){for(let t of e.nodes){let r=qo(e,t);if(r.length===0)continue;let i=new Set(lk(e,t.id).map(o=>de(o.address)));for(let o of r){let a=Mw(o.address);if(tY(e,t,o,i))continue;let l=a.scope==="task"?wi(e,a.owner,a.key):a.scope==="node"?a.owner:null;n("address/notVisible",o.field.at,d=>({where:id(e,o.field,d),address:je(e,o.address,d),producer:qP(e,a,d)??je(e,a,d),...l!==null?{producerNode:_e(e,l,d)}:{},reader:_e(e,t.id,d)}))}}}s(rY,"checkVisibility");function iY(e,n){if(n.scope==="env")return Dw(n.key);let t=de(n);return e.nodes.some(r=>Jr(e,r).some(i=>de(i.address)===t))}s(iY,"producedSomewhere");function oY(e,n){let t=new Map;for(let r of e.nodes){let i=new Set(Jr(e,r).flatMap(o=>o.address.scope==="task"?[o.address.owner]:[]));for(let[o,a]of(r.tasks??[]).entries()){let l=a.key;if(typeof l!="string"||!Gi.test(l)){n("workItems/keyFormat",`nodes.${r.id}.tasks.${o}.key`,c=>({where:`\u201E${_e(e,r.id,c)}\u201C`,address:String(l)}));continue}let d=t.get(l)??[];d.push({nodeId:r.id,writes:i.has(l)}),t.set(l,d)}}for(let[r,i]of t)if(!(i.length<2||!i.some(o=>o.writes)))for(let o of i)n("address/taskOwnerTaken",`nodes.${o.nodeId}.tasks.${r}`,a=>({where:`\u201E${_e(e,o.nodeId,a)}\u201C \u203A ${a==="de"?"Aufgabe":"task"} \u201E${Ko(e,r,a)}\u201C`,names:i.map(l=>_e(e,l.nodeId,a))}))}s(oY,"checkTaskKeys");function Bp(e,n){return e.label[n]??""}s(Bp,"wordingIn");function Zi(e,n){let t=VP(e,n),r=Bp(e.qualifier,n);return t===""||r===""&&Bp(e.qualifier,"de")!==""?"":r===""?t:`${r} \xB7 ${t}`}s(Zi,"fieldLabelIn");function VP(e,n){return Bp(e,n)}s(VP,"fieldOwnLabelIn");function da(e){return{key:e.key,kind:e.kind,type:e.kind==="entered"?e.type:null,repeated:e.kind==="entered"&&e.repeated,reviewRequired:e.kind==="entered"&&e.reviewRequired,name:{de:Zi(e,"de"),en:Zi(e,"en")}}}s(da,"catalogField");function ca(e,n){switch(e){case"nodeReads":return n.repeated?"repeated":null;case"requires":return n.repeated?"repeated":n.kind==="computed"?"computed":n.name.en===""?"untranslated":null;case"taskDocument":return n.repeated?"repeated":n.kind==="entered"&&n.type==="docRef"?null:"notDocument";case"taskReads":case"familyRequestFields":return null}}s(ca,"catalogFieldRefusal");function Up(e,n){let t=e.buses.find(r=>r.key===n);return t||F(`[progress] layout '${e.id}' has no bus '${n}'`),t}s(Up,"progressBus");function od(e,n){return e.states.some(t=>t.id===n)}s(od,"isBusState");function BP(e,n){let t=e.terminalSemantics?.[n];return t||F(`[progress] no terminal semantics for state '${n}' on bus '${e.key}'`),t}s(BP,"terminalSemantics");function Gp(e,n){return!!e.terminalSemantics&&Object.prototype.hasOwnProperty.call(e.terminalSemantics,n)}s(Gp,"hasTerminalSemantics");function sY(e,n){return(e.boards??[]).find(t=>t.audience===n||t.audience==="both")??null}s(sY,"boardForAudience");function UP(e){return sY(Up(e,"process"),"internal")}s(UP,"internalProcessBoard");function ua(e,n,t){let r=null;for(let i of e.mappings)if(i.event===t)if("nodeId"in i.match){if(i.match.nodeId===n.id)return{bus:i.bus,state:i.state}}else i.match.nodeType===n.type&&(r=i);return r?{bus:r.bus,state:r.state}:null}s(ua,"resolveProgressEvent");var fa={approved:"enrolled",rejected:"declined",withdrawn:"declined",expired:"declined"},ki=Object.keys(fa);function Bo(e){return Object.hasOwn(fa,e)}s(Bo,"isEndNodeOutcome");var dk={approved:{de:"Angenommen",en:"Admitted"},rejected:{de:"Abgelehnt",en:"Rejected"},withdrawn:{de:"Zur\xFCckgezogen",en:"Withdrawn"},expired:{de:"Abgelaufen",en:"Expired"}};var Xi=["commit","discard"],phe=m.union(...Xi.map(e=>m.literal(e)));function zp(e){return typeof e=="string"&&Xi.includes(e)}s(zp,"isApplicationDataDecision");function Gn(e){return Object.keys(e)}s(Gn,"progressEventsOf");var te=s((e,n)=>({de:e,en:n}),"lt"),nn=s((e,n,t,r,i=null,o=null)=>({chipLabel:e,tone:n,nextAction:i,affordance:o,title:t,body:r}),"ex"),GP={key:"eingeschrieben",label:te("Eingeschrieben","Enrolled"),scope:"global",defaultCollapsed:!0},Wp={key:"abgesagt",label:te("Abgesagt","Declined"),scope:"global",track:"exit",defaultCollapsed:!0},zP={key:"abgelehnt",label:te("Abgelehnt","Rejected"),scope:"global",track:"exit",defaultCollapsed:!0};var WP={enrolled:{label:te("Eingeschrieben","Enrolled"),tone:"green",terminal:{lifecycleStatus:"completed",outcome:"approved"},phase:GP,external:nn(te("Eingeschrieben","Enrolled"),"green",te("Sie sind eingeschrieben!","You are enrolled!"),te("Ihre Anmeldung ist abgeschlossen und Ihr Platz ist gesichert. Wir freuen uns auf Sie.","Your enrolment is complete and your place is secured. We look forward to welcoming you."))},declined:{label:te("Abgesagt","Declined"),tone:"red",terminal:{lifecycleStatus:"completed",outcome:"rejected"},phase:Wp,external:nn(te("Abgesagt","Declined"),"red",te("Die Bewerbung wurde beendet","The application has ended"),te("Ihre Bewerbung wurde nicht fortgef\xFChrt.","Your application was not continued."))}},YP={role:"effect",effect:"pure",progressDefaults:WP,progressEvents:Gn(WP),inputs:s(()=>[{id:"applicationOutcome",label:{de:"Ergebnis",en:"Outcome"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:ki.map(e=>({value:e,label:dk[e]}))},{id:"dataDecision",label:{de:"Erfasste Daten",en:"Captured data"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:[{value:"commit",label:{de:"\xDCbernehmen",en:"Keep"}},{value:"discard",label:{de:"Verwerfen",en:"Discard"}}]}],"inputs"),notificationEvents:s(()=>[{id:"reached",label:{de:"Verfahren abgeschlossen",en:"Process completed"},audience:"external",args:[{key:"applicationId",type:"string",required:!0},{key:"outcome",type:"string",required:!0}]}],"notificationEvents"),validate:s(e=>[...aY(e),...lY(e),...dY(e)],"validate")},pa=s((e,n,t,r)=>({layer:"GRAPH",kind:"nodeRule",path:`node.${e.id}.inputs.${n}`,reason:{de:t,en:r},severity:"error"}),"nodeIssue");function Uo(e){let n=e.inputs?.applicationOutcome;return n?.kind==="literal"&&n.value!=null?String(n.value):null}s(Uo,"literalOutcome");function aY(e){if(e.type!=="end")return[];let n=e.inputs?.applicationOutcome;if(n===void 0||n.kind==="unset")return[];let t=Uo(e);return t===null?[pa(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: das Ergebnis ist kein fester Wert \u2014 die Engine kann den Abschluss nicht ableiten`,`[end/applicationOutcome] ${e.label.en}: the application outcome is no fixed value \u2014 the engine cannot derive the terminal`)]:Bo(t)?[]:[pa(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: '${t}' ist kein Ausgang eines Endknotens (${ki.join("|")}) \u2014 die Warteliste endet \xFCber das closed-Outcome ihres Wartelistenknotens`,`[end/applicationOutcome] ${e.label.en}: '${t}' is not an outcome of an end node (${ki.join("|")}) \u2014 the waitlist ends through the closed outcome of its waitlist node`)]}s(aY,"checkEndApplicationOutcome");function lY(e){if(e.type!=="end")return[];let n=e.inputs?.dataDecision;return!n||n.kind!=="literal"||n.value==null?[pa(e,"dataDecision",`[end/dataDecision] ${e.label.de}: dataDecision fehlt \u2014 der Endknoten muss festlegen, ob die erfassten Daten \xFCbernommen (commit) oder verworfen (discard) werden`,`[end/dataDecision] ${e.label.en}: dataDecision is missing \u2014 the end node must decide whether the collected data is kept (commit) or discarded (discard)`)]:zp(n.value)?[]:[pa(e,"dataDecision",`[end/dataDecision] ${e.label.de}: dataDecision '${String(n.value)}' ist ung\xFCltig (${Xi.join("|")})`,`[end/dataDecision] ${e.label.en}: dataDecision '${String(n.value)}' is invalid (${Xi.join("|")})`)]}s(lY,"checkEndDataDecision");function dY(e){if(e.type!=="end")return[];let n=Uo(e);if(n===null||!Bo(n)||n==="approved")return[];let t=e.inputs?.dataDecision;if(t?.kind!=="literal"||t.value!=="commit")return[];let r=dk[n];return[{...pa(e,"dataDecision",`[end/commitWithoutApproval] ${e.label.de}: Ende ohne Zusage \xFCbernimmt die erfassten Daten (commit) \u2014 Personen und Beziehungen bleiben nach dem Ergebnis \u201E${r.de}" bestehen. Gewollt? Sonst discard.`,`[end/commitWithoutApproval] ${e.label.en}: end without admission keeps the captured data (commit) \u2014 persons and relationships remain after the outcome "${r.en}". Intended? Otherwise discard.`),severity:"warning"}]}s(dY,"checkEndCommitWithoutApproval");function HP(e,n){if(!n?.layout||!n.wiring)return[];let t=[];for(let r of e.nodes){if(r.type!=="end")continue;let i=Uo(r);if(i===null||!Bo(i))continue;let o=fa[i],a=ua(n.wiring,r,o);if(a===null)continue;let l=n.layout.buses.find(c=>c.key===a.bus);if(l===void 0||!Gp(l,a.state))continue;let d=BP(l,a.state).outcome;d!==i&&t.push(pa(r,"applicationOutcome",`[end/outcomeMismatch] ${r.label.de}: das Ergebnis \u201E${i}" passt nicht zum Endzustand \u201E${a.state}" (Bus ${a.bus}), der \u201E${String(d)}" besiegelt \u2014 Ergebnis oder Verdrahtung angleichen.`,`[end/outcomeMismatch] ${r.label.en}: the outcome "${i}" does not match the final state "${a.state}" (bus ${a.bus}), which seals "${String(d)}" \u2014 align the outcome or the wiring.`))}return t}s(HP,"checkEndOutcomeMatchesTerminal");function ma(e){let n=Je(e);return typeof n.inputs=="function"?n.inputs(e):[]}s(ma,"inputSlots");function cY(e,n){return ma(e).find(t=>t.id===n)}s(cY,"findInputSlot");function uY(e,n){let t=cY(e,n);if(!t)return{source:"missing",spec:{id:n,label:{de:n,en:n},type:"string"},unknownSlot:!0};let r=e.inputs?.[n]??{kind:"unset"};return r.kind==="binding"&&we(r.address)?{source:"binding",spec:t,address:r.address}:r.kind==="literal"?{source:"literal",spec:t,value:r.value}:r.kind==="cockpit"&&t.deferrable===!0?{source:"cockpit",spec:t}:t.defaultValue!==void 0?{source:"default",spec:t,value:t.defaultValue}:t.required?{source:"missing",spec:t}:{source:"optional",spec:t}}s(uY,"resolveInput");function JP(e){return ma(e).filter(n=>uY(e,n.id).source==="missing")}s(JP,"missingRequiredInputs");var fY=["personRef","formRef","documentRef","docRef"];function pY(e){let n=Je(e);return typeof n.inputs!="function"?[]:n.inputs(e).map(t=>({id:t.id,type:t.type}))}s(pY,"listInputs");function QP(e){let n=[];for(let t of e.nodes)for(let r of pY(t))!fY.includes(r.type)||t.inputs?.[r.id]?.kind!=="literal"||n.push({layer:"GRAPH",kind:"modelError",path:`node.${t.id}.param.${r.id}`,reason:{de:`${t.label.de}: Literal f\xFCr referenztypisierten Slot "${r.id}" ist verboten \u2014 der Slot wird an eine Adresse gebunden`,en:`${t.label.en}: A literal for the reference-typed slot "${r.id}" is not allowed \u2014 the slot is bound to an address`},severity:"error"});return n}s(QP,"findParamValueRefSlotErrors");function ZP(e){let n=[];for(let t of e.nodes){let r=Je(t);if(typeof r.inputs=="function")for(let i of r.inputs(t)){let o=t.inputs?.[i.id];if(o?.kind==="cockpit"&&i.deferrable!==!0){n.push({layer:"GRAPH",kind:"modelError",path:`nodes.${t.id}.inputs.${i.id}`,reason:{de:`[inputs/notDeferrable] ${t.label.de}: Parameter \u201E${i.label.de}\u201C l\xE4sst sich nicht im Cockpit erg\xE4nzen \u2014 nur Parameter eines Generators oder einer Vorlage.`,en:`[inputs/notDeferrable] ${t.label.en}: Parameter "${i.label.en}" cannot be completed in the cockpit \u2014 only parameters of a generator or a template can.`},severity:"error"});continue}(i.inspector==="literal-only"&&o?.kind==="binding"||i.inspector==="binding-only"&&o?.kind==="literal")&&n.push({layer:"GRAPH",kind:"modelError",path:`nodes.${t.id}.inputs.${i.id}`,reason:i.inspector==="literal-only"?{de:`[inputs/inspectorKind] ${t.label.de}: Parameter \u201E${i.label.de}\u201C ist ein fester Wert \u2014 eine Bindung an eine Adresse ist hier nicht m\xF6glich.`,en:`[inputs/inspectorKind] ${t.label.en}: Parameter "${i.label.en}" is a fixed value \u2014 it cannot be bound to an address.`}:{de:`[inputs/inspectorKind] ${t.label.de}: Parameter \u201E${i.label.de}\u201C wird an eine Adresse gebunden \u2014 ein fester Wert ist hier nicht m\xF6glich.`,en:`[inputs/inspectorKind] ${t.label.en}: Parameter "${i.label.en}" is bound to an address \u2014 a fixed value is not possible here.`},severity:"error"})}}return n}s(ZP,"findInspectorKindErrors");function XP(e){let n=[];for(let t of e.nodes)for(let r of JP(t))n.push({layer:"GRAPH",kind:"contractGap",path:`node.${t.id}.input.${r.id}`,reason:{de:`${t.label.de}: Pflicht-Slot "${r.label.de}" nicht gesetzt`,en:`${t.label.en}: Required slot "${r.label.en}" is not set`},severity:"error"});return n}s(XP,"findMissingRequiredInputs");function Yp(e){let n=e.processStore;return n===void 0?[]:(Array.isArray(n)||F("graph.processStore must be an array \u2014 the graph validator refuses anything else"),n)}s(Yp,"processStoreKeys");function eN(e){let n=[];for(let t of e.tasks??[]){let r=t.result;if(!(r===void 0||!Xs(r)))for(let i of Sp(r))n.push({key:i.key,nodeId:e.id,taskKey:t.key,template:t,result:r,valueType:i.valueType,...i.field!==void 0?{fieldKey:i.field.key}:{}})}return n}s(eN,"storeWritersOn");function nN(e){let n=new Map;for(let t of e.nodes)for(let r of eN(t)){let i=n.get(r.key)??[];i.push(r),n.set(r.key,i)}return n}s(nN,"processStoreWriters");function mY(e,n,t){for(let r of e.nodes){let i=eN(r).find(o=>o.taskKey===n&&o.key===t);if(i!==void 0)return i}return null}s(mY,"writerAt");function hY(e,n,t){(n.scope!=="task"||n.path!==void 0)&&F(`[process] ${t}: ${de(n)} is no task value`);let r=mY(e,n.owner,n.key);return r===null&&F(`[address/ownerNotWriter] ${t}: task "${n.owner}" writes no "${n.key}" \u2014 publish refuses that`),{key:n.key,nodeId:r.nodeId,taskKey:r.taskKey,...r.fieldKey!==void 0?{fieldKey:r.fieldKey}:{}}}s(hY,"sourceOfAddress");function tN(e,n){(n.scope!=="task"||n.path!==void 0)&&F(`[process] ${de(n)} is no store address`);let t=Yp(e).find(r=>r.key===n.key);return t===void 0&&F(`[address/unknownKey] ${de(n)}: "${n.key}" is not declared in processStore`),{key:t.key,type:t.type,label:t.label,audience:t.audience,source:hY(e,n,de(n))}}s(tN,"processLeafOf");var ck=new Set(["enum","pricedItem","number","boolean","reduction","string","staffUser","staffUserList","taskAssignment"]),wt={invalidKey:"[process/invalidKey]",unknownKey:"[process/unknownKey]",secondWriter:"[process/secondWriter]",noWriter:"[process/noWriter]",writerTypeMismatch:"[process/writerTypeMismatch]",pricedItemWritesNothing:"[process/pricedItemWritesNothing]",internalInDocument:"[process/internalInDocument]",writerMustBlock:"[process/writerMustBlock]",absentWithoutDefault:"[process/absentWithoutDefault]",defaultItemMismatch:"[process/defaultItemMismatch]"};function kt(e,n,t,r){return{layer:"GRAPH",kind:"contractGap",path:e,reason:{de:`${n} ${t}`,en:`${n} ${r}`},severity:"error"}}s(kt,"err");function iN(e){let n=[],t=Yp(e),r=new Map(t.map(l=>[l.key,l])),i=new Set;for(let[l,d]of t.entries()){let c=`processStore[${l}]`;if(typeof d.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(d.key)){n.push(kt(c,wt.invalidKey,`Vorgangs-Schl\xFCssel ${JSON.stringify(d.key)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Process key ${JSON.stringify(d.key)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`));continue}i.has(d.key)&&n.push(kt(c,wt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" ist doppelt deklariert.`,`Process key "${d.key}" is declared twice.`)),i.add(d.key),ck.has(d.type)||n.push(kt(c,wt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" hat den Typ "${d.type}" \u2014 der Vorgang speichert nur Ergebnisse mit Wert: ${[...ck].join(", ")}.`,`Process key "${d.key}" has the type "${d.type}" \u2014 the process only stores results with a value: ${[...ck].join(", ")}.`)),(!d.label?.de?.trim()||!d.label?.en?.trim())&&n.push(kt(c,wt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}" braucht ein Label in beiden Sprachen.`,`Process key "${d.key}" needs a label in both languages.`)),d.audience!=="internal"&&d.audience!=="printable"&&n.push(kt(c,wt.invalidKey,`Vorgangs-Schl\xFCssel "${d.key}": audience muss 'internal' oder 'printable' sein.`,`Process key "${d.key}": audience must be 'internal' or 'printable'.`))}let o=nN(e);for(let l of e.nodes)for(let d of l.tasks??[]){let c=d.result;c?.kind==="pricedItem"&&c.writes===void 0&&n.push(kt(`node.${l.id}.tasks.${d.key}.result.writes`,wt.pricedItemWritesNothing,`Aufgabe "${d.key}" (Knoten "${l.id}") bepreist einen Artikel, schreibt das Ergebnis aber in keinen Vorgangs-Schl\xFCssel ('result.writes') \u2014 niemand k\xF6nnte den Preis lesen.`,`Task "${d.key}" (node "${l.id}") prices an article but writes the result to no process key ('result.writes') \u2014 nobody could read the price.`))}for(let[l,d]of o){let c=r.get(l);for(let u of d){let p=u.fieldKey===void 0?`node.${u.nodeId}.tasks.${u.taskKey}.result.writes`:`node.${u.nodeId}.tasks.${u.taskKey}.result.fields.${u.fieldKey}.writes`;if(c===void 0){n.push(kt(p,wt.unknownKey,`${u.fieldKey===void 0?"":`Feld "${u.fieldKey}" der `}Aufgabe "${u.taskKey}" schreibt "${l}", aber der Workflow deklariert keinen solchen Vorgangs-Schl\xFCssel (graph.processStore).`,`${u.fieldKey===void 0?"Task":`Field "${u.fieldKey}" of task`} "${u.taskKey}" writes "${l}", but the workflow declares no such process key (graph.processStore).`));continue}if(u.valueType!==c.type){let h=u.fieldKey===void 0?`Aufgabe "${u.taskKey}"`:`Feld "${u.fieldKey}" der Aufgabe "${u.taskKey}"`,y=u.fieldKey===void 0?`Task "${u.taskKey}"`:`Field "${u.fieldKey}" of task "${u.taskKey}"`;n.push(kt(p,wt.writerTypeMismatch,`${h} liefert ${u.valueType}, der Vorgangs-Schl\xFCssel "${l}" ist aber als ${c.type} deklariert.`,`${y} delivers ${u.valueType}, but the process key "${l}" is declared as ${c.type}.`))}}if(d.length>1){let u=d.map(p=>`${p.nodeId}/${p.taskKey}${p.fieldKey===void 0?"":`.${p.fieldKey}`}`).join(", ");n.push(kt(`processStore.${l}`,wt.secondWriter,`Vorgangs-Schl\xFCssel "${l}" wird ${d.length}-mal geschrieben (${u}) \u2014 genau ein Schreiber je Schl\xFCssel.`,`Process key "${l}" is written ${d.length} times (${u}) \u2014 exactly one writer per key.`))}}for(let l of t)o.has(l.key)||n.push(kt(`processStore.${l.key}`,wt.noWriter,`Vorgangs-Schl\xFCssel "${l.key}" ist deklariert, aber keine Aufgabe schreibt ihn ('result.writes').`,`Process key "${l.key}" is declared, but no task writes it ('result.writes').`));let a=new Map;for(let l of e.nodes){let d=Je(l),c=typeof d.inputs=="function"?d.inputs(l):[];for(let u of c){let p=l.inputs?.[u.id];if(p?.kind!=="binding")continue;let h=gY(e,p.address);if(h===null)continue;let y=`node.${l.id}.input.${u.id}`,k=de(p.address),w=a.get(h.source.key)??new Set;w.add(l.id),a.set(h.source.key,w),h.audience==="internal"&&n.push(kt(y,wt.internalInDocument,`${l.label.de}: "${u.id}" liest den internen Vorgangs-Schl\xFCssel "${h.key}" \u2014 ein Dokument dieses Knotens geht an die Familie; nur 'printable'-Schl\xFCssel d\xFCrfen hinein.`,`${l.label.en}: "${u.id}" reads the internal process key "${h.key}" \u2014 a document of this node goes to the family; only 'printable' keys may go in.`));let b=yY(o,h.source.key,h.source.taskKey);if(b.template.when!==void 0&&u.required===!0&&u.defaultValue===void 0&&n.push(kt(y,wt.absentWithoutDefault,`${l.label.de}: "${u.id}" ist Pflicht und an ${k} gebunden, aber die schreibende Aufgabe entsteht nur unter einer Bedingung (when: ${rN(b.template.when)}) \u2014 ohne Vorgabewert bliebe das Feld dann f\xFCr immer leer.`,`${l.label.en}: "${u.id}" is required and bound to ${k}, but the writing task only exists under a condition (when: ${rN(b.template.when)}) \u2014 without a default value the field would stay empty forever.`)),b.result.kind==="pricedItem"&&u.defaultValue!==void 0){let E=u.defaultValue;(!Yi(E)||E.itemKey!==b.result.item||E.grantKeys.length>0)&&n.push(kt(y,wt.defaultItemMismatch,`${l.label.de}: der Vorgabewert von "${u.id}" muss der Artikel der schreibenden Aufgabe ohne Erm\xE4\xDFigung sein ({ itemKey: '${b.result.item??"?"}', grantKeys: [] }) \u2014 sonst rechnete die Familie ohne Antrag einen anderen Artikel als mit.`,`${l.label.en}: the default value of "${u.id}" must be the article of the writing task without a reduction ({ itemKey: '${b.result.item??"?"}', grantKeys: [] }) \u2014 otherwise the family would be charged a different article without an application than with one.`))}}}for(let[l,d]of a){let c=o.get(l)[0],u=c.template.blocks,p=u===void 0?void 0:u.node??c.nodeId,h=p!==void 0&&(()=>{let k=e.nodes.find(w=>w.id===p);return k!==void 0&&Je(k).processHoldTemplate?.(k)===u.templateKey})(),y=`node.${c.nodeId}.tasks.${c.taskKey}.blocks`;if(!h){let k=[...d][0],w=e.nodes.find(E=>E.id===k),b=Je(w).processHoldTemplate?.(w)??"?";n.push(kt(y,wt.writerMustBlock,`Die Aufgabe "${c.taskKey}" schreibt "${l}", h\xE4lt aber keinen der lesenden Knoten (${[...d].join(", ")}) zur\xFCck \u2014 sie muss den ersten blockieren, z. B. blocks: { ${k===c.nodeId?"":`node: '${k}', `}templateKey: '${b}' }, sonst arbeitet er, bevor der Wert existiert.`,`The task "${c.taskKey}" writes "${l}" but holds back none of the reading nodes (${[...d].join(", ")}) \u2014 it must block the first one, e.g. blocks: { ${k===c.nodeId?"":`node: '${k}', `}templateKey: '${b}' }, otherwise it works before the value exists.`));continue}for(let k of d)k===p||la(e,p,k)||n.push(kt(y,wt.writerMustBlock,`"${k}" liest "${l}", liegt aber nicht hinter dem zur\xFCckgehaltenen Knoten "${p}" \u2014 auf einem Weg an ihm vorbei l\xE4se er den Wert, bevor er feststeht.`,`"${k}" reads "${l}" but does not lie behind the held-back node "${p}" \u2014 on a path past it, it would read the value before it is settled.`))}return n}s(iN,"processBindingIssues");function gY(e,n){return!we(n)||n.scope!=="task"||n.path!==void 0||!Yp(e).some(t=>t.key===n.key)||wi(e,n.owner,n.key)===null?null:tN(e,n)}s(gY,"draftLeafOf");function yY(e,n,t){let r=e.get(n)?.find(i=>i.taskKey===t);return r===void 0&&F(`[process] the leaf of "${n}" names task "${t}", which does not write it`),r}s(yY,"writerOf");function rN(e){return we(e)?de(e):JSON.stringify(e)}s(rN,"shown");var wY="Europe/Berlin";function sN(){return wY}s(sN,"tenantTimeZone");var oN=new Map;function kY(e){let n=oN.get(e);if(n)return n;let t;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{ae("INVALID",{de:`Unbekannte Zeitzone "${e}".`,en:`Unknown time zone "${e}".`})}return oN.set(e,t),t}s(kY,"formatterFor");function bY(e,n){let t=new Map(kY(e).formatToParts(new Date(n)).map(a=>[a.type,a.value])),r=s(a=>{let l=t.get(a);return l===void 0&&F(`Zeitzone "${e}" liefert kein Feld ${a}.`),Number(l)},"read"),i=r("hour")%24;return Date.UTC(r("year"),r("month")-1,r("day"),i,r("minute"),r("second"))-Math.floor(n/1e3)*1e3}s(bY,"zoneOffsetAt");function uk(e,n){let t=e+bY(n,e);return{wallClock:new Date(t).toISOString().slice(0,19),timeZone:n}}s(uk,"instantToLocalDateTime");function fk(e){let n={};for(let t of Ye)n[t]=e(t);return n}s(fk,"localized");var Go=5,zo=480;function bi(e){return typeof e=="string"&&e.trim().length>0}s(bi,"isNonEmptyString");function lN(e,n,t){return Object.keys(e).filter(r=>!n.includes(r)).map(r=>({field:`result.${r}`,code:Ue.unknownField,message:{de:`Unbekanntes Feld '${r}' im ${t.de}; erlaubt sind: ${n.join(", ")}.`,en:`Unknown field '${r}' in the ${t.en}; allowed: ${n.join(", ")}.`}}))}s(lN,"unknownFieldIssues");var Hp="primaryHostTeams";function xY(e){let n=[],t=e.title;(t===void 0||typeof t!="object"||t===null||!bi(t.de)||!bi(t.en))&&n.push({field:"result.title",code:Ue.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<Go||r>zo)&&n.push({field:"result.durationMinutes",code:Ue.appointmentInvalidDuration,message:{de:`'durationMinutes' muss eine ganze Zahl von ${Go} bis ${zo} sein, erhalten ${JSON.stringify(r)}.`,en:`'durationMinutes' must be a whole number from ${Go} to ${zo}, got ${JSON.stringify(r)}.`}});let{[Hp]:i,...o}=e;return n.push(...lN(o,["kind","title","durationMinutes","primaryParticipantTeams","participants"],{de:"Termin-Ergebnis",en:"appointment result"})),n}s(xY,"appointmentIssues");function aN(e){if(typeof e!="object"||e===null)return!1;let n=e;return bi(n.de)&&bi(n.en)}s(aN,"isBilingual");var pk=["key","type","label","writes","options","min","suggest","evidence","evidenceFrom","multiple","tasks","maxLength"];function SY(e,n){let t=s((o,a)=>({field:o,code:Ue.recordFields,message:a}),"issue");if(!Array.isArray(e)||e.length===0)return[t("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(t(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(t(`${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(t(`${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(Iw(d.type)||r.push(t(`${l}.type`,{de:`Feld ${u}: Typ ${JSON.stringify(d.type)} \u2014 erlaubt: ${vp.join(", ")}.`,en:`Field ${p}: type ${JSON.stringify(d.type)} \u2014 allowed: ${vp.join(", ")}.`})),aN(d.label)||r.push(t(`${l}.label`,{de:`Feld ${u} braucht ein Label in beiden Sprachen ({ de, en }).`,en:`Field ${p} needs a label in both languages ({ de, en }).`})),bi(d.writes)||r.push(t(`${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:[],k=y.map(w=>w.key);(y.length<2||k.some(w=>typeof w!="string"||w.length===0)||new Set(k).size!==k.length||y.some(w=>!aN(w.label)))&&r.push(t(`${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(t(`${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(t(`${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(t(`${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(t(`${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(...AY(d,l,u,p,n)),d.suggest!==void 0){let y=d.suggest,k=typeof y=="object"&&y!==null?y.kind:void 0,w=k==="form"&&"address"in y&&Object.keys(y).length===2&&(!we(y.address)||un(y.address))||k==="siblingRank"&&Object.keys(y).length===1&&d.type==="number";m_(d.type)?w||r.push({field:`${l}.suggest`,code:Ue.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: ${Ow.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: ${Ow.join(", ")}.`}}):r.push({field:`${l}.suggest`,code:Ue.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=>!pk.includes(y));h.length>0&&r.push(t(l,{de:`Feld ${u}: unbekannte Angabe ${h.map(y=>`'${y}'`).join(", ")}; erlaubt: ${pk.join(", ")}.`,en:`Field ${p}: unknown entry ${h.map(y=>`'${y}'`).join(", ")}; allowed: ${pk.join(", ")}.`}))}return r}s(SY,"recordFieldIssues");function AY(e,n,t,r,i){let o=[],a=e.maxLength;if(a!==void 0&&(e.type!=="text"||typeof a!="number"||!Number.isInteger(a)||a<1||a>xp)&&o.push({field:`${n}.maxLength`,code:Ue.recordText,message:{de:`Feld ${t}: 'maxLength' gibt es nur bei Typ 'text', als ganze Zahl von 1 bis ${xp}.`,en:`Field ${r}: 'maxLength' exists only for type 'text', as a whole number from 1 to ${xp}.`}}),e.multiple!==void 0&&(e.type!=="person"||typeof e.multiple!="boolean")&&o.push({field:`${n}.multiple`,code:Ue.recordPerson,message:{de:`Feld ${t}: '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:`${n}.tasks`,code:Ue.recordAssignment,message:{de:`Feld ${t}: '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:`${n}.tasks`,code:Ue.recordAssignment,message:{de:`Feld ${t} (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:`${n}.tasks`,code:Ue.recordAssignment,message:c===void 0?{de:`Feld ${t}: "${d}" ist keine Aufgabe dieses Knotens.`,en:`Field ${r}: "${d}" is no task of this node.`}:{de:`Feld ${t}: "${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(AY,"typedFieldIssues");function EY(e,n,t){let r=[],i=n.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:Ue.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:Ue.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=n.item;if(!bi(o))r.push({field:"result.item",code:Ue.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(t.billingItemKeys!==void 0&&!t.billingItemKeys.has(o))r.push({field:"result.item",code:Ue.pricedItemUnknownItem,message:{de:`'result.item' "${o}" \u2014 kein Artikel dieses Mandanten tr\xE4gt diesen Schl\xFCssel (bekannt: ${[...t.billingItemKeys].join(", ")||"keine"}).`,en:`'result.item' "${o}" \u2014 no article of this school has this key (known: ${[...t.billingItemKeys].join(", ")||"none"}).`}});else if(t.offerProgram===null)r.push({field:"result.item",code:Ue.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(t.offerProgram!==void 0&&!t.offerProgram.billingItemKeys.has(o)){let l=t.offerProgram;r.push({field:"result.item",code:Ue.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=n.label;(typeof a!="object"||a===null||!bi(a.de)||!bi(a.en))&&r.push({field:"result.label",code:Ue.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 n.item!==void 0&&r.push({field:"result.item",code:Ue.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(...SY(n.fields,t)),n.writes!==void 0&&r.push({field:"result.writes",code:Ue.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')."}}),n.label!==void 0&&r.push({field:"result.label",code:Ue.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')."}})):n.fields!==void 0&&r.push({field:"result.fields",code:Ue.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"&&(bi(n.writes)||r.push({field:"result.writes",code:Ue.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."}})),n.writes!==void 0&&(e==="freetext"||e==="recommendation")&&r.push({field:"result.writes",code:Ue.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"&&n.textRequired!==void 0&&r.push({field:"result.textRequired",code:Ue.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."}}),n.chat===void 0)r.push({field:"result.chat",code:Ue.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=n.chat,a=typeof o=="string"?ea(o):null;o==="external"||a===null?r.push({field:"result.chat",code:Ue.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"&&!t.channelKeys.has(a.channelKey)&&r.push({field:"result.chat",code:Ue.chatUnknownChannel,message:{de:`'result.chat' "${a.channelKey}" ist weder 'all' noch 'team:<Gruppe>' noch ein Kanal des Workflows (bekannt: ${[...t.channelKeys].join(", ")||"keine"}).`,en:`'result.chat' "${a.channelKey}" is neither 'all' nor 'team:<group>' nor a channel of the workflow (known: ${[...t.channelKeys].join(", ")||"none"}).`}})}return r.push(...lN(n,["kind","options","textRequired","chat","item","label","writes","fields","prices"],{de:"Aufgaben-Ergebnis",en:"task result"})),r}s(EY,"recordedIssues");function dN(e,n,t={channelKeys:new Set}){if(n===void 0)return[];if(e!=="task")return[{field:"result",code:Ue.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 n!="object"||n===null||Array.isArray(n))return[{field:"result",code:Ue.unknownKind,message:{de:`'result' muss ein Objekt mit 'kind' sein; bekannte Arten: ${Qs.join(", ")}.`,en:`'result' must be an object with 'kind'; known kinds: ${Qs.join(", ")}.`}}];let r=n;return p_(r.kind)?r.kind==="appointment"?xY(r):EY(r.kind,r,t):[{field:"result.kind",code:Ue.unknownKind,message:{de:`Unbekannte Ergebnisart ${JSON.stringify(r.kind)}; bekannte Arten: ${Qs.join(", ")}.`,en:`Unknown result kind ${JSON.stringify(r.kind)}; known kinds: ${Qs.join(", ")}.`}}]}s(dN,"taskResultIssues");function mk(e){let n=Je(e);return e.outcomes&&e.outcomes.length>0?[...e.outcomes]:n.outcomes&&n.outcomes.length>0?[...n.outcomes]:null}s(mk,"nodeOutcomes");var TY=["documentChangeRequested","documentReturned","coverLetterConfirmed","coverLetterRevisionRequested"];function cN(e){return TY.includes(e)}s(cN,"isNonAdvancingExternalEvent");var ha=["offer","contract"];function Jp(e){return typeof e=="string"&&ha.includes(e)}s(Jp,"isArtifactSlotType");var uN="open",ga="done";var fN=[{key:"tenantSlug",type:"string"}];var RY=/^(\d{4})-(\d{2})-(\d{2})$/;function $Y(e){return e>=1900&&e<=2100}s($Y,"isSupportedYear");function IY(e,n,t){let r=new Date(Date.UTC(e,n-1,t));return r.getUTCFullYear()===e&&r.getUTCMonth()===n-1&&r.getUTCDate()===t}s(IY,"isRealDate");function hk(e){if(typeof e!="string")return null;let n=RY.exec(e);if(n===null)return null;let[,t,r,i]=n;return t===void 0||r===void 0||i===void 0||!$Y(Number(t))||!IY(Number(t),Number(r),Number(i))?null:{year:t,month:r,day:i}}s(hk,"isoDateParts");var gk=3;function pN(e){return uk(e,sN()).wallClock.slice(0,10)}s(pN,"localIsoDate");var Qp=["login","security","admission","tasks","deadlines","schoolMessages","staffAssigned","staffTeamQueue","staffFeedback","staffAppointments","staffDeadlines","staffWaitlist","staffUnassigned","familyMessages","mentions"],mN=m.union(...Qp.map(e=>m.literal(e)));var Fge=m.union(m.literal("admission"),m.literal("tasks"),m.literal("staff"),m.literal("chat")),yk=["loginOnly","all"],Lge=m.union(m.literal("loginOnly"),m.literal("all"));function hN(e){return typeof e=="string"&&yk.includes(e)}s(hN,"isMailLevel");function gN(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=30}s(gN,"isUnassignedTaskNoticeDays");function yN(e){return e*864e5}s(yN,"unassignedTaskNoticeMs");var Kge=yN(3),jge=yN(1);var sd="subject";function wN(e){return e.category==="login"}s(wN,"isSignInLetter");var fn={key:"schoolName",label:"Name der Schule"},xN={de:"Zu Ihren Bewerbungen",en:"View your applications"},An={key:"portalLink",label:"Link zum Bewerberportal",required:!0,link:!0,actionLabel:xN},wk={key:An.key,label:An.label,link:!0,actionLabel:xN},SN={key:"authorName",label:"Name der schreibenden Person"},Wo={key:"applicationLink",label:"Link zur Bewerbung",required:!0,link:!0,actionLabel:{de:"Bewerbung \xF6ffnen",en:"Open application"}},ad={key:"anmeldeLink",label:"Anmeldelink",required:!0,link:!0,actionLabel:{de:"Jetzt anmelden",en:"Sign in now"},previewValue:{de:"https://beispiel.plexus.schule/anmelden?token=BEISPIEL",en:"https://beispiel.plexus.schule/anmelden?token=BEISPIEL"}},OY={key:"passwortLink",label:"Link zum neuen Passwort",required:!0,link:!0,actionLabel:{de:"Neues Passwort festlegen",en:"Set a new password"},previewValue:{de:"https://beispiel.plexus.schule/login/reset?token=BEISPIEL",en:"https://beispiel.plexus.schule/login/reset?token=BEISPIEL"}},AN={key:"bestaetigungsLink",label:"Best\xE4tigungslink",required:!0,link:!0,actionLabel:{de:"E-Mail best\xE4tigen",en:"Confirm email address"},previewValue:{de:"https://beispiel.plexus.schule/bestaetigen?token=BEISPIEL",en:"https://beispiel.plexus.schule/bestaetigen?token=BEISPIEL"}},ld={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"15 Minuten",en:"15 minutes"}},EN={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"24 Stunden",en:"24 hours"}},_Y={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"60 Minuten",en:"60 minutes"}};function Re(e){return{key:sd,label:"Betreff",default:e}}s(Re,"subjectSlot");var eo=m.object({de:m.string(),en:m.string()}),On={tenantSlug:m.string(),applicationId:m.id("applications")},PY=m.object({tenantSlug:m.string()}),NY={id:"applicant.welcome",category:"admission",label:"Willkommen",occasion:{de:"Sobald f\xFCr eine Familie ein Zugang angelegt wurde",en:"As soon as an account has been created for a family"},audience:"external",frame:"letter",timeline:"correspondence",paramsValidator:PY,channels:["email"],portalVisible:!0,placeholders:[fn,An],slots:[Re({de:"Willkommen \u2014 Ihre Bewerbung bei uns",en:"Welcome \u2014 your application"}),{key:"intro",label:"Einleitung",multiline:!0,default:{de:`vielen Dank f\xFCr Ihre Registrierung bei {{schoolName}}. \xDCber den folgenden Link k\xF6nnen Sie jederzeit Ihre Bewerbungen einsehen und fortsetzen:
|
|
11101
11102
|
|
|
11102
11103
|
{{portalLink}}`,en:`Thank you for registering with {{schoolName}}. You can view and continue your applications at any time using the link below:
|
|
@@ -11617,6 +11618,6 @@ ${t.length} unusable ${o}:
|
|
|
11617
11618
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
11618
11619
|
`),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>
|
|
11619
11620
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
11620
|
-
`);return t.length>0?1:0}},mR=class extends wr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=R.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function RU(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(RU,"requireOnOff");var $U=[QT,ZT,XT,eR,nR,tR,rR,iR,oR,sR,Ku,aR,lR,dR,cR,uR,fR,pR,mR];function IU(e){return e.de??e.en??Object.values(e)[0]??""}s(IU,"titleDe");function hee(e){return{id:e._id,kind:e.kind,status:e.status,title:IU(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(hee,"row");var gee=["id","kind","status","title","assignee","group","outcome"],yR=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=R.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(hee),gee),0}},wR=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=R.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:IU(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}},kR=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=R.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},bR=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=R.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...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}},vR=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=R.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},OU=[yR,wR,kR,bR,vR];var ju=[...lO,...VF,...QF,...XL,...ZL,...E0,...P0,..._0,...EU,...$U,...AU,...dB,...hB,...TF,...v0,...fU,...sO,...qO,...uF,...D0,...C0,...M0,...q0,...k0,...o0,...OU,...nj,...Uj,...aB,...Gj,...HB,...rU,...gB,...EB,...$B,...PB,...CB,...sU,...yU,...IO];for(let e of ju){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:x$(e.usage.category,n.join(" "))})}var _U="0.1.235";function PU(){return ju.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=w$[To(t)];return{path:t,effect:Ro(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(PU,"plexusCommandCatalog");import Ss from"node:path";function yee(e){let n=cn()?.workspaceRoot??process.cwd(),t=Ss.resolve(n,e),r=Ss.relative(n,t);if(Ss.isAbsolute(e)||r===".."||r.startsWith(`..${Ss.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(yee,"workspacePath");function wee(e){let{absolute:n,relative:t}=yee(e.path??".");if(e.operation==="list"){if(!Ae(n))return{files:[]};let r=[],i=s(o=>{for(let a of Mr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Ss.join(o,a.name);if(a.isDirectory()?i(l):r.push(Ss.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(n);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("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 Error("plexus: the edited file exceeds 10 MB.");return ze(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Bn(Ss.dirname(n),{recursive:!0}),ze(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Rs(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(wee,"plexusWorkspace");function NU(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=Bl[t];if(!o||!Object.hasOwn(Bl,t))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(rw,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:rw[i.path],skillHash:Zf}}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 Error("plexus: invalid workspace input.");return wee(i)},"executePlexusAgentTool")}s(NU,"createPlexusAgentToolExecutor");var Kg=NU({inspectCommand:DU,executeCommand:FU});function jg(){let e=new _s({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_U});e.register(Al.HelpCommand),e.register(Al.VersionCommand);for(let t of ju)e.register(t);async function n(t,r){let i;try{i=e.process(t,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return vee(i,r.stderr??process.stderr),e.run(i,r)}return s(n,"run"),{process(t,r){return e.process(t,r)},run:n,async runExit(t,r){process.exitCode=await n(t,r)}}}s(jg,"createPlexusCli");function vee(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&$l[t]===r&&ln(n,t,r),t in $l&&Ro(t)==="confirm"&&!Il(e)&&n.write(`plexus-cli: \`${$l[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11621
|
+
`);return t.length>0?1:0}},mR=class extends wr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=R.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.String({required:!0});async execute(){let t=await(await this.caller()).mutation(x.platformAdmin.relinkAuthAccount,{email:this.email}),r=t.changed?`Relinked ${this.email} to live auth account ${t.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(t,r),0}};function RU(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(RU,"requireOnOff");var $U=[QT,ZT,XT,eR,nR,tR,rR,iR,oR,sR,Ku,aR,lR,dR,cR,uR,fR,pR,mR];function IU(e){return e.de??e.en??Object.values(e)[0]??""}s(IU,"titleDe");function hee(e){return{id:e._id,kind:e.kind,status:e.status,title:IU(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(hee,"row");var gee=["id","kind","status","title","assignee","group","outcome"],yR=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=R.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.list,{client:t,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(hee),gee),0}},wR=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=R.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.String({required:!0,name:"workItemId"});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.query(x.workItems.get,{client:t,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${t}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:IU(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}},kR=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=R.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.String("--assignee",{description:"Assignee users._id."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.createManual,{client:t,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},bR=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=R.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.String("--outcome",{description:"Outcome id to record."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.complete,{client:t,workItemId:this.workItemId,...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}},vR=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=R.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let n=await this.caller(),t=this.requireTenant(n),r=await n.mutation(x.workItems.assign,{client:t,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},OU=[yR,wR,kR,bR,vR];var ju=[...lO,...VF,...QF,...XL,...ZL,...E0,...P0,..._0,...EU,...$U,...AU,...dB,...hB,...TF,...v0,...fU,...sO,...qO,...uF,...D0,...C0,...M0,...q0,...k0,...o0,...OU,...nj,...Uj,...aB,...Gj,...HB,...rU,...gB,...EB,...$B,...PB,...CB,...sU,...yU,...IO];for(let e of ju){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:x$(e.usage.category,n.join(" "))})}var _U="0.1.237";function PU(){return ju.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=w$[To(t)];return{path:t,effect:Ro(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(PU,"plexusCommandCatalog");import Ss from"node:path";function yee(e){let n=cn()?.workspaceRoot??process.cwd(),t=Ss.resolve(n,e),r=Ss.relative(n,t);if(Ss.isAbsolute(e)||r===".."||r.startsWith(`..${Ss.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(yee,"workspacePath");function wee(e){let{absolute:n,relative:t}=yee(e.path??".");if(e.operation==="list"){if(!Ae(n))return{files:[]};let r=[],i=s(o=>{for(let a of Mr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Ss.join(o,a.name);if(a.isDirectory()?i(l):r.push(Ss.relative(n,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(n),{files:r.sort()}}if(!t)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=he(n);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:t,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:t,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("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 Error("plexus: the edited file exceeds 10 MB.");return ze(n,a,"utf8"),{path:t,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Bn(Ss.dirname(n),{recursive:!0}),ze(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Rs(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(wee,"plexusWorkspace");function NU(e){return s(async function(t,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=Bl[t];if(!o||!Object.hasOwn(Bl,t))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(t==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(t==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(rw,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:rw[i.path],skillHash:Zf}}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 Error("plexus: invalid workspace input.");return wee(i)},"executePlexusAgentTool")}s(NU,"createPlexusAgentToolExecutor");var Kg=NU({inspectCommand:DU,executeCommand:FU});function jg(){let e=new _s({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_U});e.register(Al.HelpCommand),e.register(Al.VersionCommand);for(let t of ju)e.register(t);async function n(t,r){let i;try{i=e.process(t,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return vee(i,r.stderr??process.stderr),e.run(i,r)}return s(n,"run"),{process(t,r){return e.process(t,r)},run:n,async runExit(t,r){process.exitCode=await n(t,r)}}}s(jg,"createPlexusCli");function vee(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&$l[t]===r&&ln(n,t,r),t in $l&&Ro(t)==="confirm"&&!Il(e)&&n.write(`plexus-cli: \`${$l[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
11621
11622
|
`)}s(vee,"noteRetiredPath");function DU(e){let n=jg().process(hl(e),{executePlexusAgentTool:Kg}),t=n.path.join(" ");if(t.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=PU().find(l=>l.path===t);if(!r){if(t===""||t==="--help"||t==="--version")return{path:t,writes:!1,host:"shared"};throw new Error(`plexus: command ${t} has no host classification.`)}let i=n,o=r.effect==="callKind"?mh(Wa(Ya),i.fn??"",i.kind):void 0,a=xf(t,{confirm:Il(n),callKind:o});return{...r,writes:a}}s(DU,"inspectPlexusCommand");async function FU(e,n){if(n)return SR(n,()=>FU(e));if(!Array.isArray(e.argv)||e.argv.length===0||e.argv.length>128||e.argv.some(l=>typeof l!="string"||l.length>128e3)||(e.stdin?.length??0)>1e6)throw new Error("plexus: invalid command invocation.");let t="",r="",i=jg();if(cn()){let l=DU(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(hl(e.argv),{executePlexusAgentTool:Kg,stdin:bee.from(e.stdin===void 0?[]:[e.stdin]),stdout:new CU({write(l,d,c){t+=String(l),c()}}),stderr:new CU({write(l,d,c){r+=String(l),c()}})}),stdout:t,stderr:r}}s(FU,"executePlexusCommand");$R({source:xee.join(import.meta.dirname,"skill")});jg().runExit(hl(process.argv.slice(2)),{executePlexusAgentTool:Kg});
|
|
11622
11623
|
//# sourceMappingURL=cli.mjs.map
|