@smartkomm/plexus-cli 0.1.103 → 0.1.104

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
@@ -313,7 +313,6 @@ whole is the operator's (ask them; do not try).
313
313
  | [feedback/manage-feedback-tags.md](references/feedback/manage-feedback-tags.md) | Plattform | Maintain the feedback tag catalogue and tag many items at once. |
314
314
  | [feedback/work-a-feedback-item.md](references/feedback/work-a-feedback-item.md) | Plattform | Reply to a feedback item, set its status and deadline, link items, move it to another tenant, sync GitHub state. |
315
315
  | [finance/change-contract-grant.md](references/finance/change-contract-grant.md) | Mandant | Change a running contract's grants or reductions from a month on. |
316
- | [finance/record-submission-date.md](references/finance/record-submission-date.md) | Mandant | Record a missing historic submission date of a SEPA direct debit. |
317
316
  | [leads/list-leads.md](references/leads/list-leads.md) | Mandant | List a tenant's prospects. |
318
317
  | [learning-groups/import-classes-from-csv.md](references/learning-groups/import-classes-from-csv.md) | Mandant | Import a school's classes from a class list (CSV + mapping file) as learning groups of a school year. |
319
318
  | [marketing/demo-video-links.md](references/marketing/demo-video-links.md) | Plattform | Create personalised demo video links per recipient and read who watched what. |
@@ -5694,39 +5693,6 @@ is required. Backdated changes to already booked periods are refused.
5694
5693
  Template edits do not change existing contract grants. Their target lines, rule,
5695
5694
  floor, period and evidence were agreed when applied. Contract snapshots preserve
5696
5695
  signed evidence; booked charges preserve their pricing explanation and accounting.
5697
- `,"references/finance/record-submission-date.md":`# Record a missing historical SEPA submission date
5698
-
5699
- **When to use:** The dashboard reports a legacy debit batch without a recorded
5700
- submission date. Use the original transmission receipt, not the execution date.
5701
-
5702
- ## Prerequisites
5703
-
5704
- - Tenant-wide finance permission and the original bank transmission evidence.
5705
- - Inspect the target environment before writing. Staging/prod changes require
5706
- the operator's explicit approval; this recipe is not authorization.
5707
-
5708
- ## Steps
5709
-
5710
- \`\`\`sh
5711
- plexus-cli --env local --tenant test config show
5712
- plexus-cli --env local --tenant test call paymentBatches:recordSubmissionDate --kind mutation client=test batchId=<batch-id> submittedDate=2026-08-31
5713
- \`\`\`
5714
-
5715
- Use the actual receipt's date and intended tenant/environment. Ordinary new
5716
- submissions already record this date and need no repair.
5717
-
5718
- ## Verify
5719
-
5720
- \`\`\`sh
5721
- plexus-cli --env local --tenant test call financeDashboard:overview client=test
5722
- \`\`\`
5723
-
5724
- The return count and denominator appear in the original submission month.
5725
-
5726
- ## Idempotency / gotchas
5727
-
5728
- An identical date can be replayed. A conflicting date, another tenant's batch,
5729
- a draft batch or a date after execution is refused. Nothing books money.
5730
5696
  `,"references/leads/list-leads.md":`# List a tenant's Interessenten (open leads)
5731
5697
 
5732
5698
  Inspect the CRM funnel's \`interesse\` stage from the CLI \u2014 every OPEN lead
@@ -10527,7 +10493,7 @@ plexus-cli --env prod jobs list --status running # nothing unexpectedly in
10527
10493
  ## Related
10528
10494
  - Command reference: \`plexus-cli jobs list --help\`, \`plexus-cli platform workers reap --help\`,
10529
10495
  \`plexus-cli platform imports cleanup-orphaned --help\`.
10530
- `};var Wu="c2a99afef6979675b1cb1bca32bdc1ff677ee408170422805d8f52c39920f200",_g=uR;var Ng=class extends xe{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=T.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:Wu,tools:il}),0}},Cg=class extends xe{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=T.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=p.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 Pg(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},fR=[Ng,Cg];var Dg=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],yse=new Set(Dg.map(e=>e.key));function mR(e,n,t,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===n);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${n}" (offers: ${l.join(", ")||"none"})`)}let o=i.stages.find(l=>l.stageKey===r||l.stageId===r);if(o===void 0){let l=i.stages.map(d=>`${d.stageKey} (${d.stageId})`);throw new Error(`applications start-test: no level "${r}" in ${n} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===t||l.runId===t);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${t}" for level ${o.stageKey} \u2014 name it by key or id: ${l.join(", ")}`)}if(!a.isOpen)throw new Error(`applications start-test: school year ${a.runKey} is closed for level ${o.stageKey}`);return{programRunId:a.runId,programStageId:o.stageId}}s(mR,"resolveStartTarget");function sG(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(sG,"applicantText");function hR(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:sG(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(hR,"applicationRows");var pR=Dg.map(e=>e.email);function gR(e,n,t,r){if(t===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(t!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(Rg(e,n)&&(r===void 0||!pR.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${pR.join(", ")} (--applicant) \u2014 never a real family's`)}s(gR,"assertStartApplicant");function yR(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(yR,"processStoreJson");function aG(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.revisionNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.revisionNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(aG,"refText");function lG(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?aG(e.ref):JSON.stringify(e.value)}s(lG,"holds");function wR(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:lG(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(wR,"storeRows");function Yu(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(Yu,"parseKv");var kR="started",Hu="submitted",Ju="submitted",bR="load-scenario:";var vR="(Bewerbung)";function xR(e){return{nodeId:vR,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(xR,"sharedAsList");function SR(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(SR,"disabledText");function AR(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:SR(r)})))}s(AR,"actionRows");function ER(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: ${SR(a)}`);if(i!==vR)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(ER,"nodeOfferingAction");function TR(e,n,t){if(e.startsWith(bR)){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(TR,"runParams");async function dG(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(dG,"currentNodeIds");function cG(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(cG,"refusalText");async function Qu(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${cG(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,xR(r.actions)]}s(Qu,"actionsOf");async function $R(e,n,t){return t!==void 0?[t]:await dG(e,n)}s($R,"nodesOf");var Fg=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=T.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=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await Qu(n,this.application,await $R(n,this.application,this.node));return this.print(t,AR,["node","action","label","disabled"]),0}},Lg=class extends D{static{s(this,"TestActionsRunCommand")}application=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=T.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=p.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=p.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=p.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=TR(this.action,this.autoSubmit,Yu(this.param??[]).values),t=await this.caller(),r=this.application,i=await $R(t,this.application,this.node),o=ER(await Qu(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}},RR=[Fg,Lg];var ze=["de","en"];function hs(e,n){return ze.every(t=>e[t]===n[t])}s(hs,"sameText");function Rn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!ze.includes(r))?"not-localized":ze.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Rn,"missingLocales");function Ti(e){let n=Rn(e);return n!=="not-localized"&&n.length===0}s(Ti,"isLocalizedText");function ol(e,n){let t={};for(let r of ze){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(ol,"composeTexts");var fr=/^[a-z][A-Za-z0-9]*$/;function Mg(e){return typeof e=="string"&&fr.test(e)}s(Mg,"isNodeId");function gs(e,n){Mg(e)||F(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${fr.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 $i="$env";function se(e){if(e.scope==="env")return`${$i}.${e.key}`;let n=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(se,"formatAddress");var Nr=/^[a-z][a-zA-Z0-9_]*$/,uG=/^[A-Za-z_][A-Za-z0-9_]*$/;function po(e){return typeof e=="string"&&e.split(".").every(n=>uG.test(n))}s(po,"isPath");function Qr(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&&po(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!Nr.test(i)?null:IR({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Nr.test(o)||(t==="node"?!fr.test(i):!Nr.test(i))?null:IR({scope:t,owner:i,key:o},a)}default:return null}}s(Qr,"tryParseAddress");function IR(e,n){if(n.length===0)return e;let t=n.join(".");return po(t)?{...e,path:t}:null}s(IR,"withPath");function we(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:n.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!po(n.path))return!1;switch(n.scope){case"env":return po(n.key);case"derived":return typeof n.key=="string"&&Nr.test(n.key);case"node":return typeof n.owner=="string"&&fr.test(n.owner)&&typeof n.key=="string"&&Nr.test(n.key);case"task":return typeof n.owner=="string"&&Nr.test(n.owner)&&typeof n.key=="string"&&Nr.test(n.key);default:return!1}}s(we,"isAddress");var Zr={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"}},ys=Object.keys(Zr);function ws(e){return Object.hasOwn(Zr,e)}s(ws,"isEnvKey");var fG=["self-service","staff"];function OR(e,n){return{kind:"fixed",values:e,labels:n}}s(OR,"fixedSet");var Zu={of:"applicant.language",withoutValue:"de"},Xr={"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:Zu},"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:Zu},"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:Zu},"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:Zu},"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:OR(ze,{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:OR(fG,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},Xu={types:Zr,fields:Xr},ef=ys.flatMap(e=>Object.keys(Zr[e]).map(n=>`${e}.${n}`));function pr(e){return Object.hasOwn(Xr,e)}s(pr,"isEnvLeaf");function nf(e){return`${$i}.${e}`}s(nf,"envIdentifier");function mo(e){let n=Xr[e],[t,r]=e.split("."),i=Zr[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(mo,"envLeaf");var PR="staffInput";var pG=["boolean"],sl=/^[a-z][A-Za-z0-9]*$/;function tf(e){return e.staffInputs??[]}s(tf,"staffInputsOf");function rf(e){return`${PR}.${e}`}s(rf,"staffInputLeaf");function _R(e){return`${$i}.${rf(e)}`}s(_R,"staffInputIdentifier");function mG(e){let n=`${PR}.`;return e.startsWith(n)?e.slice(n.length):null}s(mG,"staffInputKeyOfLeaf");function al(e,n){let t=mG(n);return t===null?void 0:tf(e).find(r=>r.key===t)}s(al,"declaredStaffInput");function hG(e){return[...tf(e).map(n=>({leaf:rf(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...ef.map(n=>{let t=mo(n);return{leaf:n,type:t.type,label:t.label,valueSet:Xr[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(hG,"envLeavesFor");function NR(e){return hG(e).filter(n=>!n.cohortBound)}s(NR,"conditionEnvLeaves");function CR(e){let n={},t={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of NR(e)){let[l="",d=""]=r.split(".");n[l]={...n[l]??{},[d]:i},t[r]={valueSet:o,nullable:a}}return{types:n,fields:t}}s(CR,"envConditionSchemaFor");function DR(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}"`};sl.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),pG.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=Rn(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(DR,"staffInputIssues");var Wg={required:!0,description:"Offer slug (its offerKey)"},qg=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=T.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=p.String("--offer",Wg);testOnly=p.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=hR(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},Kg=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=T.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=p.String("--offer",Wg);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}},jg=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=T.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=p.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 Error(`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}},Bg=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=T.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, $derived\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=p.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(yR(t),()=>wR(t),["address","state","holds","producer","written"]),0}},Ug=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=T.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=p.String("--offer",Wg);run=p.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=p.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=p.String("--party",{description:"Applicant party id"});applicant=p.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=p.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=p.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=p.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();gR(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=mR(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 Error(`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:LR(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 Qu(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}},Vg=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=T.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one)"});application=p.String({required:!0});async execute(){return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},t=>[{key:"discarded",value:t.discarded}]),0}},Gg=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=T.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=p.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}},zg=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=T.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=p.String({required:!0});input=p.String("--input",{required:!0,description:"key=true|false"});reason=p.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}]=LR([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}},FR=[qg,Kg,jg,Bg,Ug,Vg,Gg,zg];function LR(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!sl.test(t)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${n}": expected key=true or key=false`);return{key:t,value:r==="true"}})}s(LR,"parseStaffInputs");var Kn="contractGenerator",ho="documentTemplate";function ll(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(ll,"isGeneratorRef");function MR(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(MR,"literalOf");function ei(e){let n=MR(e,Kn);return ll(n)?n:null}s(ei,"generatorRefOfNode");function mr(e){let n=MR(e,ho);return typeof n=="string"&&n.length>0?n:null}s(mr,"documentTemplateKeyOfNode");function qR(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(qR,"generatorRefLabel");var gG=["formExports","generatorStamp"];function KR(e,n,t){let r=e.inputs?.[Kn];(r?.kind!=="literal"||!ll(r.value))&&F(`applyGeneratorStamp: the node names no generator in inputs.${Kn} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Kn]={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}}}s(KR,"applyGeneratorStamp");var yG=["reads"];function ks(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 gG)delete r[i];for(let i of yG)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),n}s(ks,"comparableWorkflowGraph");var dl={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 of(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=dl[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(of,"manifestIssues");function wG(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(wG,"validateProgressLayoutExternalCopy");function jR(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"]:wG(e)}s(jR,"progressLayoutIssues");var BR=new Set(["nodes","assignmentRules","channels","processStore","pricingRules","staffInputs"]);var kG=new Set(["sections","effects","outcomes","testScenarios","env"]),sf={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 UR(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(kG.has(i))continue;let o=sf[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(UR,"smartFormDefinitionShapeIssues");var bt=["granted","rejected","waitlisted","other"];function Ri(e){return typeof e=="string"&&bt.includes(e)}s(Ri,"isOutcomeSemantic");var Yt=["arrival","manual"],VR={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function bG(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(bG,"literal");function Yg(e){let n=bG(e,"waitlistOrder");return Yt.includes(n)?{waitlistOrder:n}:null}s(Yg,"waitlistPolicyOrNull");var gn="responsible",Hg="team:";function af(e){return`${Hg}${e}`}s(af,"teamSlot");function lf(e){return e.startsWith(Hg)?e.slice(Hg.length):null}s(lf,"teamKeyOfSlot");function GR(e){return e.kind==="responsible"?gn:af(e.groupKey)}s(GR,"slotIdOf");function df(e){if(e===gn)return{kind:"responsible"};let n=lf(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(df,"slotOfId");var Jg="review",Qg="checkField",zR="reviewed",WR="reviewing",cf=["rejected","waitlisted"];function Zg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Zg,"isObject");var vG=new Set(["decision",Jg]),YR={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function Xg(e){return Object.hasOwn(YR,e)?YR[e]:void 0}s(Xg,"legacySemanticOfId");function xG(e){return e===Jg?bt.filter(n=>!cf.includes(n)):bt}s(xG,"allowedSemanticsFor");var SG="other";function HR(e){return Zg(e)&&vG.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(HR,"outcomesOf");function JR(e){return(e?.nodes??[]).some(n=>HR(n).some(t=>Zg(t)&&!("semantic"in t)))}s(JR,"needsOutcomeSemantics");function QR(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=HR(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),f=xG(u),m=!1,y=l.map(k=>{if(!Zg(k))return k;let g=String(k.id);if("semantic"in k)return Ri(k.semantic)||i.push({nodeId:c,outcomeId:g,value:String(k.semantic)}),k;let b=`${c}.${g}`,A=Object.hasOwn(n,b)?n[b]:void 0;if(A!==void 0)return f.includes(A)?(t.push({nodeId:c,outcomeId:g,semantic:A,source:"answer"}),m=!0,{...k,semantic:A}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f,answer:A}),k);let $=Xg(g),O=$??SG;return f.includes(O)?(t.push({nodeId:c,outcomeId:g,semantic:O,source:$===void 0?"formerDefault":"legacyTable"}),m=!0,{...k,semantic:O}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f}),k)});return m?{...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(QR,"addOutcomeSemantics");var hr="bewerbungOffen";function go(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(go,"isObject");var ey=["event","effect"];function ZR(e){return go(e)&&e.type==="eventTrigger"}s(ZR,"isTrigger");function XR(e){let n=go(e.inputs)?e.inputs:{};return"outcomes"in e||ey.some(t=>t in e||t in n)}s(XR,"oldShape");function eI(e){return(e?.nodes??[]).some(n=>ZR(n)&&XR(n))}s(eI,"needsEventTriggerStartMove");function AG(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>go(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===hr))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(go(e.next)?e.next:{});if(!(i.length===1&&i[0]===hr))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=go(e.inputs)?{...e.inputs}:{};for(let l of ey){let d=o[l];if(go(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of ey)delete a[l],delete o[l];return go(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(AG,"moveNode");function nI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!ZR(i)||!XR(i))return i;let o=AG(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(nI,"moveEventTriggerStart");function cl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(cl,"isObject");var tI={waitlistOrder:"arrival"};function rI(e){return!cl(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(cl(e.inputs)?e.inputs:{}))}s(rI,"lacksPolicy");function EG(e){return(e?.nodes??[]).some(rI)}s(EG,"needsWaitlistPolicyMove");function ny(e){return cl(e)&&Yt.includes(e.waitlistOrder)}s(ny,"isWaitlistPolicy");function TG(e){if(e===void 0)return{policy:tI,stated:!1};if(!cl(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!Yt.includes(n)?"malformed":{policy:{waitlistOrder:n??tI.waitlistOrder},stated:n!==void 0}}s(TG,"policyOfSelection");function iI(e,n,t={}){let r=[],i=[];if(!EG(e))return{graph:e,moved:r,refused:i};let o=TG(n),a=e.nodes.map(l=>{if(!rI(l))return l;let d=l,c=String(d.id),u=cl(d.inputs)?{...d.inputs}:{},f=Object.hasOwn(t,c)?t[c]:void 0,m,y;if(f!==void 0)m=f,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;m=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:m.waitlistOrder},r.push({nodeId:c,policy:m,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(iI,"moveWaitlistPolicyToInputs");function yo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(yo,"isObject");var $G=[Kn,ho],RG=["inputSchema","parties","schemaDigest","parts"];function oI(e){return yo(e)&&e.type==="governedDocument"&&("resolver"in e||yo(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(oI,"oldShape");function sI(e){return(e?.nodes??[]).some(oI)}s(sI,"needsGeneratorInputMove");function IG(e){let n=yo(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!yo(i))return{unmoved:"resolverNotObject"};if(Kn 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((yo(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>yo(d)&&$G.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Kn]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(RG.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(yo(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(ho in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[ho]={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(IG,"moveNode");function aI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!oI(i))return i;let o=IG(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(aI,"moveGeneratorPinsToInputs");var lI=/^\d{4}-\d{2}-\d{2}$/;function gr(e,n){return{de:e,en:n}}s(gr,"issue");function wo(e){if(typeof e!="object"||e===null)return gr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:gr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return gr(`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?gr("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"||!lI.test(r)?gr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!lI.test(i)?gr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?gr("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)?gr("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))?gr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?gr("unbekannte Angaben","unknown details"):null:gr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(wo,"reductionShapeIssue");function Ii(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.itemKey=="string"&&n.itemKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||wo(n.reduction)===null&&n.reduction.kind==="amount")}s(Ii,"isPricedItemValue");var bs=["freetext","recommendation","choice","pricedItem","record","reduction"],vs=[...bs,"appointment"];function cI(e){return typeof e=="string"&&vs.includes(e)}s(cI,"isTaskResultKind");function Oi(e){return typeof e=="string"&&bs.includes(e)}s(Oi,"isRecordedTaskResultKind");function xs(e){return Oi(e.kind)}s(xs,"isRecordedTaskResult");var uf=["number","boolean","enum"];function ty(e){return typeof e=="string"&&uf.includes(e)}s(ty,"isRecordFieldType");var ry=["form","siblingRank"];var ni={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 uI(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(uI,"isProseResult");function ff(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&ty(n.type)).map(n=>({key:n.writes,valueType:n.type,field:n})):OG(e)}s(ff,"draftResultStoreWrites");function OG(e){let n=ni[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(OG,"singleStoreWrite");var dI="team:";function Ss(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(dI)){let n=e.slice(dI.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(Ss,"parseTaskResultChat");var Ze={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]",reductionPrices:"[taskResult/reductionPrices]",pricesOnNonReduction:"[taskResult/pricesOnNonReduction]"};var PG=new Set(["if","else","in","true","false","null"]),_G=new Set(["==","!=","<=",">=","&&","||"]);function NG(e){return e>="0"&&e<="9"}s(NG,"isDigit");function CG(e){return/[a-zA-Z_$]/.test(e)}s(CG,"isIdentStart");function DG(e){return/[a-zA-Z0-9_.$]/.test(e)}s(DG,"isIdentCont");function FG(e){let n=[],t=0;for(;t<e.length;){let r=e.charAt(t);if(r===" "||r===" "||r===`
10496
+ `};var Wu="bda6982878b49deaaec6ef0f54e7566ab20fd511227adea4fec452b0124d5f65",_g=uR;var Ng=class extends xe{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=T.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:Wu,tools:il}),0}},Cg=class extends xe{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=T.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=p.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 Pg(this.context.stdin)),t=await this.context.executePlexusAgentTool(this.tool,n);return this.print(t),0}},fR=[Ng,Cg];var Dg=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],yse=new Set(Dg.map(e=>e.key));function mR(e,n,t,r){let i=e.flatMap(l=>l.angebote).find(l=>l.offerKey===n);if(i===void 0){let l=e.flatMap(d=>d.angebote.map(c=>c.offerKey));throw new Error(`applications start-test: no offer "${n}" (offers: ${l.join(", ")||"none"})`)}let o=i.stages.find(l=>l.stageKey===r||l.stageId===r);if(o===void 0){let l=i.stages.map(d=>`${d.stageKey} (${d.stageId})`);throw new Error(`applications start-test: no level "${r}" in ${n} \u2014 name it by key or id: ${l.join(", ")}`)}let a=o.runs.find(l=>l.runKey===t||l.runId===t);if(a===void 0){let l=o.runs.map(d=>`${d.runKey} (${d.runId})`);throw new Error(`applications start-test: no school year "${t}" for level ${o.stageKey} \u2014 name it by key or id: ${l.join(", ")}`)}if(!a.isOpen)throw new Error(`applications start-test: school year ${a.runKey} is closed for level ${o.stageKey}`);return{programRunId:a.runId,programStageId:o.stageId}}s(mR,"resolveStartTarget");function sG(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(sG,"applicantText");function hR(e){return e.map(n=>({id:n.application._id,status:n.deletedAt?`${n.application.status} (gel\xF6scht)`:n.application.status,state:n.currentProcessStateId??"",applicant:sG(n.applicantName),test:n.application.testMode===!0?"test":""}))}s(hR,"applicationRows");var pR=Dg.map(e=>e.email);function gR(e,n,t,r){if(t===void 0&&r===void 0)throw new Error("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(t!==void 0&&r!==void 0)throw new Error("applications start-test: --party or --applicant, not both");if(Rg(e,n)&&(r===void 0||!pR.includes(r.trim().toLowerCase())))throw new Error(`applications start-test: on prod only for the test account ${pR.join(", ")} (--applicant) \u2014 never a real family's`)}s(gR,"assertStartApplicant");function yR(e){let n={};for(let{address:t,...r}of e.entries)n[t]=r;return{applicationId:e.applicationId,store:n}}s(yR,"processStoreJson");function aG(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.revisionNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(n=>`${n.partKey}: contract ${n.contractId} \xB7 ${n.revision===null?"keine Fassung":`Fassung ${n.revision.revisionNumber}`} \xB7 ${n.contractStatus}`).join("; ")}}s(aG,"refText");function lG(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?aG(e.ref):JSON.stringify(e.value)}s(lG,"holds");function wR(e){return e.entries.map(n=>({address:n.address,state:n.state,holds:lG(n),producer:n.producer?.label??"",written:n.writtenAt===void 0?"":new Date(n.writtenAt).toISOString()}))}s(wR,"storeRows");function Yu(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(Yu,"parseKv");var kR="started",Hu="submitted",Ju="submitted",bR="load-scenario:";var vR="(Bewerbung)";function xR(e){return{nodeId:vR,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(xR,"sharedAsList");function SR(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(SR,"disabledText");function AR(e){return e.flatMap(({nodeId:n,actions:t})=>t.map(r=>({node:n,action:r.id,label:r.label.de,disabled:SR(r)})))}s(AR,"actionRows");function ER(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: ${SR(a)}`);if(i!==vR)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(ER,"nodeOfferingAction");function TR(e,n,t){if(e.startsWith(bR)){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(TR,"runParams");async function dG(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(dG,"currentNodeIds");function cG(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(cG,"refusalText");async function Qu(e,n,t){let r=await e.query(x.workflow.listSharedTestActions,{applicationId:n});if(!r.permitted)throw new Error(`test-actions: not permitted \u2014 ${cG(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,xR(r.actions)]}s(Qu,"actionsOf");async function $R(e,n,t){return t!==void 0?[t]:await dG(e,n)}s($R,"nodesOf");var Fg=class extends D{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=T.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=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let n=await this.caller(),t=await Qu(n,this.application,await $R(n,this.application,this.node));return this.print(t,AR,["node","action","label","disabled"]),0}},Lg=class extends D{static{s(this,"TestActionsRunCommand")}application=p.String("--application",{required:!0,description:"Application id (a test application)"});node=p.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=T.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=p.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=p.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=p.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=TR(this.action,this.autoSubmit,Yu(this.param??[]).values),t=await this.caller(),r=this.application,i=await $R(t,this.application,this.node),o=ER(await Qu(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}},RR=[Fg,Lg];var ze=["de","en"];function hs(e,n){return ze.every(t=>e[t]===n[t])}s(hs,"sameText");function Rn(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let n=e;return Object.keys(n).some(r=>!ze.includes(r))?"not-localized":ze.filter(r=>{let i=n[r];return typeof i!="string"||i.trim()===""})}s(Rn,"missingLocales");function Ti(e){let n=Rn(e);return n!=="not-localized"&&n.length===0}s(Ti,"isLocalizedText");function ol(e,n){let t={};for(let r of ze){let i=e.map(o=>o[r]);t[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?n(i,r):""}return t}s(ol,"composeTexts");var fr=/^[a-z][A-Za-z0-9]*$/;function Mg(e){return typeof e=="string"&&fr.test(e)}s(Mg,"isNodeId");function gs(e,n){Mg(e)||F(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${fr.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 $i="$env";function se(e){if(e.scope==="env")return`${$i}.${e.key}`;let n=e.scope==="derived"?`$derived.${e.key}`:`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?n:`${n}.${e.path}`}s(se,"formatAddress");var Nr=/^[a-z][a-zA-Z0-9_]*$/,uG=/^[A-Za-z_][A-Za-z0-9_]*$/;function po(e){return typeof e=="string"&&e.split(".").every(n=>uG.test(n))}s(po,"isPath");function Qr(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&&po(i)?{scope:"env",key:i}:null}case"derived":{let[i,...o]=r;return i===void 0||!Nr.test(i)?null:IR({scope:"derived",key:i},o)}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!Nr.test(o)||(t==="node"?!fr.test(i):!Nr.test(i))?null:IR({scope:t,owner:i,key:o},a)}default:return null}}s(Qr,"tryParseAddress");function IR(e,n){if(n.length===0)return e;let t=n.join(".");return po(t)?{...e,path:t}:null}s(IR,"withPath");function we(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=n.scope==="env"?["scope","key"]:n.scope==="derived"?["scope","key","path"]:["scope","owner","key","path"];if(Object.keys(n).some(r=>!t.includes(r))||n.path!==void 0&&!po(n.path))return!1;switch(n.scope){case"env":return po(n.key);case"derived":return typeof n.key=="string"&&Nr.test(n.key);case"node":return typeof n.owner=="string"&&fr.test(n.owner)&&typeof n.key=="string"&&Nr.test(n.key);case"task":return typeof n.owner=="string"&&Nr.test(n.owner)&&typeof n.key=="string"&&Nr.test(n.key);default:return!1}}s(we,"isAddress");var Zr={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"}},ys=Object.keys(Zr);function ws(e){return Object.hasOwn(Zr,e)}s(ws,"isEnvKey");var fG=["self-service","staff"];function OR(e,n){return{kind:"fixed",values:e,labels:n}}s(OR,"fixedSet");var Zu={of:"applicant.language",withoutValue:"de"},Xr={"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:Zu},"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:Zu},"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:Zu},"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:Zu},"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:OR(ze,{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:OR(fG,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},Xu={types:Zr,fields:Xr},ef=ys.flatMap(e=>Object.keys(Zr[e]).map(n=>`${e}.${n}`));function pr(e){return Object.hasOwn(Xr,e)}s(pr,"isEnvLeaf");function nf(e){return`${$i}.${e}`}s(nf,"envIdentifier");function mo(e){let n=Xr[e],[t,r]=e.split("."),i=Zr[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(mo,"envLeaf");var PR="staffInput";var pG=["boolean"],sl=/^[a-z][A-Za-z0-9]*$/;function tf(e){return e.staffInputs??[]}s(tf,"staffInputsOf");function rf(e){return`${PR}.${e}`}s(rf,"staffInputLeaf");function _R(e){return`${$i}.${rf(e)}`}s(_R,"staffInputIdentifier");function mG(e){let n=`${PR}.`;return e.startsWith(n)?e.slice(n.length):null}s(mG,"staffInputKeyOfLeaf");function al(e,n){let t=mG(n);return t===null?void 0:tf(e).find(r=>r.key===t)}s(al,"declaredStaffInput");function hG(e){return[...tf(e).map(n=>({leaf:rf(n.key),type:n.type,label:n.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),...ef.map(n=>{let t=mo(n);return{leaf:n,type:t.type,label:t.label,valueSet:Xr[n].valueSet,nullable:t.nullable,cohortBound:t.cohortBound===!0}})]}s(hG,"envLeavesFor");function NR(e){return hG(e).filter(n=>!n.cohortBound)}s(NR,"conditionEnvLeaves");function CR(e){let n={},t={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of NR(e)){let[l="",d=""]=r.split(".");n[l]={...n[l]??{},[d]:i},t[r]={valueSet:o,nullable:a}}return{types:n,fields:t}}s(CR,"envConditionSchemaFor");function DR(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}"`};sl.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),pG.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=Rn(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(DR,"staffInputIssues");var Wg={required:!0,description:"Offer slug (its offerKey)"},qg=class extends D{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=T.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=p.String("--offer",Wg);testOnly=p.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=hR(t).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},Kg=class extends D{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=T.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=p.String("--offer",Wg);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}},jg=class extends D{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=T.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=p.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 Error(`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}},Bg=class extends D{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=T.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, $derived\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=p.String({required:!0});async execute(){let t=await(await this.caller()).query(x.processStoreView.get,{applicationId:this.application});return this.print(yR(t),()=>wR(t),["address","state","holds","producer","written"]),0}},Ug=class extends D{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=T.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=p.String("--offer",Wg);run=p.String("--run",{required:!0,description:"School year: its key or id (never its name)"});stage=p.String("--stage",{required:!0,description:"Level: its key or id (never its name)"});party=p.String("--party",{description:"Applicant party id"});applicant=p.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=p.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=p.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=p.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();gR(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let t=this.requireTenant(n),r=mR(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 Error(`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:LR(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 Qu(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}},Vg=class extends D{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=T.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one)"});application=p.String({required:!0});async execute(){return await(await this.caller()).mutation(x.admission.discardTest,{applicationId:this.application}),this.print({discarded:this.application},t=>[{key:"discarded",value:t.discarded}]),0}},Gg=class extends D{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=T.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=p.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}},zg=class extends D{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=T.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=p.String({required:!0});input=p.String("--input",{required:!0,description:"key=true|false"});reason=p.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}]=LR([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}},FR=[qg,Kg,jg,Bg,Ug,Vg,Gg,zg];function LR(e){return e.map(n=>{let[t="",r,...i]=n.split("=");if(!sl.test(t)||r!=="true"&&r!=="false"||i.length>0)throw new Error(`--staff-input "${n}": expected key=true or key=false`);return{key:t,value:r==="true"}})}s(LR,"parseStaffInputs");var Kn="contractGenerator",ho="documentTemplate";function ll(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(ll,"isGeneratorRef");function MR(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(MR,"literalOf");function ei(e){let n=MR(e,Kn);return ll(n)?n:null}s(ei,"generatorRefOfNode");function mr(e){let n=MR(e,ho);return typeof n=="string"&&n.length>0?n:null}s(mr,"documentTemplateKeyOfNode");function qR(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(qR,"generatorRefLabel");var gG=["formExports","generatorStamp"];function KR(e,n,t){let r=e.inputs?.[Kn];(r?.kind!=="literal"||!ll(r.value))&&F(`applyGeneratorStamp: the node names no generator in inputs.${Kn} \u2014 a stamp derives from it`),t.freezeRevision&&n.revision!==void 0&&(e.inputs[Kn]={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}}}s(KR,"applyGeneratorStamp");var yG=["reads"];function ks(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 gG)delete r[i];for(let i of yG)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),n}s(ks,"comparableWorkflowGraph");var dl={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 of(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(n=>{let t=dl[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(of,"manifestIssues");function wG(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(wG,"validateProgressLayoutExternalCopy");function jR(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"]:wG(e)}s(jR,"progressLayoutIssues");var BR=new Set(["nodes","assignmentRules","channels","processStore","pricingRules","staffInputs"]);var kG=new Set(["sections","effects","outcomes","testScenarios","env"]),sf={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 UR(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(kG.has(i))continue;let o=sf[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(UR,"smartFormDefinitionShapeIssues");var bt=["granted","rejected","waitlisted","other"];function Ri(e){return typeof e=="string"&&bt.includes(e)}s(Ri,"isOutcomeSemantic");var Yt=["arrival","manual"],VR={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function bG(e,n){let t=e.inputs?.[n];return t?.kind==="literal"?t.value:void 0}s(bG,"literal");function Yg(e){let n=bG(e,"waitlistOrder");return Yt.includes(n)?{waitlistOrder:n}:null}s(Yg,"waitlistPolicyOrNull");var gn="responsible",Hg="team:";function af(e){return`${Hg}${e}`}s(af,"teamSlot");function lf(e){return e.startsWith(Hg)?e.slice(Hg.length):null}s(lf,"teamKeyOfSlot");function GR(e){return e.kind==="responsible"?gn:af(e.groupKey)}s(GR,"slotIdOf");function df(e){if(e===gn)return{kind:"responsible"};let n=lf(e);return n===null||n.length===0?null:{kind:"team",groupKey:n}}s(df,"slotOfId");var Jg="review",Qg="checkField",zR="reviewed",WR="reviewing",cf=["rejected","waitlisted"];function Zg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Zg,"isObject");var vG=new Set(["decision",Jg]),YR={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function Xg(e){return Object.hasOwn(YR,e)?YR[e]:void 0}s(Xg,"legacySemanticOfId");function xG(e){return e===Jg?bt.filter(n=>!cf.includes(n)):bt}s(xG,"allowedSemanticsFor");var SG="other";function HR(e){return Zg(e)&&vG.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(HR,"outcomesOf");function JR(e){return(e?.nodes??[]).some(n=>HR(n).some(t=>Zg(t)&&!("semantic"in t)))}s(JR,"needsOutcomeSemantics");function QR(e,n={}){let t=[],r=[],i=[],o=e.nodes.map(a=>{let l=HR(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),f=xG(u),m=!1,y=l.map(k=>{if(!Zg(k))return k;let g=String(k.id);if("semantic"in k)return Ri(k.semantic)||i.push({nodeId:c,outcomeId:g,value:String(k.semantic)}),k;let b=`${c}.${g}`,A=Object.hasOwn(n,b)?n[b]:void 0;if(A!==void 0)return f.includes(A)?(t.push({nodeId:c,outcomeId:g,semantic:A,source:"answer"}),m=!0,{...k,semantic:A}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f,answer:A}),k);let $=Xg(g),O=$??SG;return f.includes(O)?(t.push({nodeId:c,outcomeId:g,semantic:O,source:$===void 0?"formerDefault":"legacyTable"}),m=!0,{...k,semantic:O}):(r.push({nodeId:c,nodeType:u,outcomeId:g,allowed:f}),k)});return m?{...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(QR,"addOutcomeSemantics");var hr="bewerbungOffen";function go(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(go,"isObject");var ey=["event","effect"];function ZR(e){return go(e)&&e.type==="eventTrigger"}s(ZR,"isTrigger");function XR(e){let n=go(e.inputs)?e.inputs:{};return"outcomes"in e||ey.some(t=>t in e||t in n)}s(XR,"oldShape");function eI(e){return(e?.nodes??[]).some(n=>ZR(n)&&XR(n))}s(eI,"needsEventTriggerStartMove");function AG(e){let n=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>go(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===hr))return{unmoved:{nodeId:n,reason:"outcomesNotStart"}};let i=Object.keys(go(e.next)?e.next:{});if(!(i.length===1&&i[0]===hr))return{unmoved:{nodeId:n,reason:"nextNotStart"}};let o=go(e.inputs)?{...e.inputs}:{};for(let l of ey){let d=o[l];if(go(d)&&d.kind==="binding")return{unmoved:{nodeId:n,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of ey)delete a[l],delete o[l];return go(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(AG,"moveNode");function nI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!ZR(i)||!XR(i))return i;let o=AG(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(nI,"moveEventTriggerStart");function cl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(cl,"isObject");var tI={waitlistOrder:"arrival"};function rI(e){return!cl(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(cl(e.inputs)?e.inputs:{}))}s(rI,"lacksPolicy");function EG(e){return(e?.nodes??[]).some(rI)}s(EG,"needsWaitlistPolicyMove");function ny(e){return cl(e)&&Yt.includes(e.waitlistOrder)}s(ny,"isWaitlistPolicy");function TG(e){if(e===void 0)return{policy:tI,stated:!1};if(!cl(e))return"malformed";let n=e.waitlistOrder;return n!==void 0&&!Yt.includes(n)?"malformed":{policy:{waitlistOrder:n??tI.waitlistOrder},stated:n!==void 0}}s(TG,"policyOfSelection");function iI(e,n,t={}){let r=[],i=[];if(!EG(e))return{graph:e,moved:r,refused:i};let o=TG(n),a=e.nodes.map(l=>{if(!rI(l))return l;let d=l,c=String(d.id),u=cl(d.inputs)?{...d.inputs}:{},f=Object.hasOwn(t,c)?t[c]:void 0,m,y;if(f!==void 0)m=f,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;m=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:m.waitlistOrder},r.push({nodeId:c,policy:m,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(iI,"moveWaitlistPolicyToInputs");function yo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(yo,"isObject");var $G=[Kn,ho],RG=["inputSchema","parties","schemaDigest","parts"];function oI(e){return yo(e)&&e.type==="governedDocument"&&("resolver"in e||yo(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(oI,"oldShape");function sI(e){return(e?.nodes??[]).some(oI)}s(sI,"needsGeneratorInputMove");function IG(e){let n=yo(e.inputs)?{...e.inputs}:{},t={...e},r;if("resolver"in e){let i=e.resolver;if(!yo(i))return{unmoved:"resolverNotObject"};if(Kn 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((yo(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>yo(d)&&$G.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};n[Kn]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(RG.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(yo(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(ho in n)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};n[ho]={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(IG,"moveNode");function aI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!oI(i))return i;let o=IG(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(aI,"moveGeneratorPinsToInputs");var lI=/^\d{4}-\d{2}-\d{2}$/;function gr(e,n){return{de:e,en:n}}s(gr,"issue");function wo(e){if(typeof e!="object"||e===null)return gr("keine Reduktion","not a reduction");let n=e;if(n.kind==="none")return Object.keys(n).length===1?null:gr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(n.kind!=="amount")return gr(`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?gr("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"||!lI.test(r)?gr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!lI.test(i)?gr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?gr("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)?gr("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))?gr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(n).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?gr("unbekannte Angaben","unknown details"):null:gr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(wo,"reductionShapeIssue");function Ii(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.itemKey=="string"&&n.itemKey.length>0&&Array.isArray(n.grantKeys)&&n.grantKeys.every(t=>typeof t=="string"&&t.length>0)&&(n.reduction===void 0||wo(n.reduction)===null&&n.reduction.kind==="amount")}s(Ii,"isPricedItemValue");var bs=["freetext","recommendation","choice","pricedItem","record","reduction"],vs=[...bs,"appointment"];function cI(e){return typeof e=="string"&&vs.includes(e)}s(cI,"isTaskResultKind");function Oi(e){return typeof e=="string"&&bs.includes(e)}s(Oi,"isRecordedTaskResultKind");function xs(e){return Oi(e.kind)}s(xs,"isRecordedTaskResult");var uf=["number","boolean","enum"];function ty(e){return typeof e=="string"&&uf.includes(e)}s(ty,"isRecordFieldType");var ry=["form","siblingRank"];var ni={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 uI(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(uI,"isProseResult");function ff(e){return e.kind==="record"?(e.fields??[]).filter(n=>typeof n.writes=="string"&&n.writes.length>0&&ty(n.type)).map(n=>({key:n.writes,valueType:n.type,field:n})):OG(e)}s(ff,"draftResultStoreWrites");function OG(e){let n=ni[e.kind].valueType;return e.writes===void 0||n===null?[]:[{key:e.writes,valueType:n}]}s(OG,"singleStoreWrite");var dI="team:";function Ss(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(dI)){let n=e.slice(dI.length);return n.length===0?null:{kind:"team",groupKey:n}}return{kind:"channel",channelKey:e}}s(Ss,"parseTaskResultChat");var Ze={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]",reductionPrices:"[taskResult/reductionPrices]",pricesOnNonReduction:"[taskResult/pricesOnNonReduction]"};var PG=new Set(["if","else","in","true","false","null"]),_G=new Set(["==","!=","<=",">=","&&","||"]);function NG(e){return e>="0"&&e<="9"}s(NG,"isDigit");function CG(e){return/[a-zA-Z_$]/.test(e)}s(CG,"isIdentStart");function DG(e){return/[a-zA-Z0-9_.$]/.test(e)}s(DG,"isIdentCont");function FG(e){let n=[],t=0;for(;t<e.length;){let r=e.charAt(t);if(r===" "||r===" "||r===`
10531
10497
  `||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(NG(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(CG(r)){let o=t;for(;o<e.length&&DG(e.charAt(o));)o++;let a=e.slice(t,o);PG.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(_G.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(FG,"tokenise");var fI=1e4,pI=128;function As(e){e.depth++,e.depth>pI&&F(`Expression nesting too deep (> ${pI})`)}s(As,"enterDepth");function kI(e){return e.pos<e.tokens.length?e.tokens[e.pos]:null}s(kI,"peek");function jn(e){let n=e.tokens[e.pos];return n||F(`Unexpected end at ${e.pos}`),e.pos++,n}s(jn,"take");function Bn(e,n,t){let r=kI(e);return!(!r||r.t!==n||t!==void 0&&r.v!==t)}s(Bn,"match");function ko(e,n,t){return Bn(e,n,t)||F(`Expected ${n}${t?`:${t}`:""} at ${e.pos}`),jn(e)}s(ko,"expect");function ri(e){As(e);try{return Bn(e,"kw","if")?LG(e):MG(e)}finally{e.depth--}}s(ri,"parseExpr");function LG(e){ko(e,"kw","if"),ko(e,"punct","(");let n=ri(e);ko(e,"punct",")");let t=ri(e);ko(e,"kw","else");let r=ri(e);return{kind:"if",cond:n,then:t,else:r}}s(LG,"parseIf");function MG(e){let n=mI(e),t=0;try{for(;Bn(e,"op","||");){jn(e),As(e),t++;let r=mI(e);n={kind:"binary",op:"||",left:n,right:r}}}finally{e.depth-=t}return n}s(MG,"parseLogicOr");function mI(e){let n=hI(e),t=0;try{for(;Bn(e,"op","&&");){jn(e),As(e),t++;let r=hI(e);n={kind:"binary",op:"&&",left:n,right:r}}}finally{e.depth-=t}return n}s(mI,"parseLogicAnd");function hI(e){let n=gI(e),t=0;try{for(;Bn(e,"op","==")||Bn(e,"op","!=");){let r=jn(e).v;As(e),t++;let i=gI(e);n={kind:"binary",op:r,left:n,right:i}}}finally{e.depth-=t}return n}s(hI,"parseEquality");function gI(e){let n=oy(e),t=0;try{for(;Bn(e,"op","<")||Bn(e,"op","<=")||Bn(e,"op",">")||Bn(e,"op",">=")||Bn(e,"kw","in");){let r=jn(e),i=r.t==="kw"?"in":r.v;As(e),t++;let o=oy(e);n={kind:"binary",op:i,left:n,right:o}}}finally{e.depth-=t}return n}s(gI,"parseCompare");function oy(e){if(Bn(e,"op","!")){jn(e),As(e);try{return{kind:"unary",op:"!",operand:oy(e)}}finally{e.depth--}}return qG(e)}s(oy,"parseUnary");function qG(e){let n=kI(e);if(n||F("Unexpected end"),n.t==="num")return jn(e),{kind:"num",value:n.v};if(n.t==="str")return jn(e),{kind:"str",value:n.v};if(n.t==="kw"&&n.v==="true")return jn(e),{kind:"bool",value:!0};if(n.t==="kw"&&n.v==="false")return jn(e),{kind:"bool",value:!1};if(n.t==="kw"&&n.v==="null")return jn(e),{kind:"null"};if(n.t==="punct"&&n.v==="("){jn(e);let t=ri(e);return ko(e,"punct",")"),t}if(n.t==="punct"&&n.v==="["){jn(e);let t=[];if(!Bn(e,"punct","]"))for(t.push(ri(e));Bn(e,"punct",",");)jn(e),t.push(ri(e));return ko(e,"punct","]"),{kind:"arr",items:t}}if(n.t==="ident"){let t=n.v;if(jn(e),Bn(e,"punct","(")){jn(e);let r=[];if(!Bn(e,"punct",")"))for(r.push(ri(e));Bn(e,"punct",",");)jn(e),r.push(ri(e));return ko(e,"punct",")"),{kind:"call",name:t,args:r}}return{kind:"ident",path:t}}F(`Unexpected token at ${e.pos}`)}s(qG,"parsePrimary");function Un(e){e.length>fI&&F(`Expression too long (${e.length} > ${fI})`);let n={tokens:FG(e),pos:0,depth:0},t=ri(n);return n.pos<n.tokens.length&&F(`Unexpected trailing token at ${n.pos}`),t}s(Un,"parseExpression");var KG=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 yn(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=>yn(t,n));case"unary":{let t=yn(e.operand,n);return!Pi(t)}case"call":{let t=n.functions!==void 0&&Object.hasOwn(n.functions,e.name)?n.functions[e.name]:KG.get(e.name);t||F(`Unknown function '${e.name}'`);let r=e.args.map(i=>yn(i,n));return t(...r)}case"binary":return jG(e.op,e.left,e.right,n);case"if":return Pi(yn(e.cond,n))?yn(e.then,n):yn(e.else,n)}}s(yn,"evaluate");function jG(e,n,t,r){if(e==="&&"){let a=yn(n,r);return Pi(a)?Pi(yn(t,r)):!1}if(e==="||"){let a=yn(n,r);return Pi(a)?!0:Pi(yn(t,r))}let i=yn(n,r),o=yn(t,r);switch(e){case"==":return iy(i,o);case"!=":return!iy(i,o);case"<":{let[a,l]=pf(i,o);return a!==null&&l!==null&&a<l}case"<=":{let[a,l]=pf(i,o);return a!==null&&l!==null&&a<=l}case">":{let[a,l]=pf(i,o);return a!==null&&l!==null&&a>l}case">=":{let[a,l]=pf(i,o);return a!==null&&l!==null&&a>=l}case"in":return Array.isArray(o)?o.some(a=>iy(a,i)):!1}}s(jG,"evalBinary");function pf(e,n){return[yI(e),yI(n)]}s(pf,"orderedOperands");function yI(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(yI,"numericOperand");function iy(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(iy,"looseEq");function Pi(e){return!(e==null||e===!1||e===0||e===""||Array.isArray(e)&&e.length===0)}s(Pi,"truthy");function bn(e){let n=new Set;return ti(e,n),[...n]}s(bn,"dependencies");function ti(e,n){switch(e.kind){case"ident":n.add(e.path);return;case"call":e.args.forEach(t=>ti(t,n));return;case"arr":e.items.forEach(t=>ti(t,n));return;case"unary":ti(e.operand,n);return;case"binary":ti(e.left,n),ti(e.right,n);return;case"if":ti(e.cond,n),ti(e.then,n),ti(e.else,n);return;default:return}}s(ti,"walk");var wI=new Map;function yr(e){let n=wI.get(e);return n||(n=Un(e),wI.set(e,n)),n}s(yr,"parseCached");function BG(e,n){return yn(yr(e),n)}s(BG,"evalExpression");function bI(e,n){return Pi(BG(e,n))}s(bI,"evalBoolean");function mf(e){let n=e.pricingRules;return n===void 0?[]:(Array.isArray(n)||F("graph.pricingRules must be an array \u2014 the graph validator refuses anything else"),n)}s(mf,"pricingRuleSets");function sy(e){return e.derive!==void 0}s(sy,"isDerivedKey");function UG(e,n){let t=mf(e);return(n.rules??[]).map(r=>{let i=t.find(o=>o.key===r);return i===void 0&&F(`[process] derivation names the unknown rule set "${r}" \u2014 publish refuses that`),i})}s(UG,"ruleSetsOfDerivation");function xI(e){return[...new Set(e.rows.flatMap(n=>bn(yr(n.when))))]}s(xI,"ruleSetDependencies");function SI(e){let n=Qr(e);return n!==null&&se(n)===e?n:null}s(SI,"ruleIdentifierAddress");function ay(e,n){let r=[...new Set(UG(e,n).flatMap(xI))].map(o=>{let a=SI(o);return a===null&&F(`[address/bareIdentifier] rule identifier "${o}" is no address \u2014 publish refuses that`),{address:a,id:o,role:"rule"}}),i=n.reduction;return i===void 0?r:(we(i)||F(`[address/bareIdentifier] derive.reduction ${JSON.stringify(i)} is no address \u2014 publish refuses that`),[...r,{address:i,id:se(i),role:"reduction"}])}s(ay,"derivationSources");function AI(e,n){let t=mf(e);for(let r of n.rules??[]){let i=t.find(o=>o.key===r);if(i===void 0||i.rows.some(o=>ul(o.when)!==null)||xI(i).some(o=>SI(o)===null))return null}return n.reduction!==void 0&&!we(n.reduction)?null:ay(e,n)}s(AI,"draftDerivationSources");function ul(e){if(typeof e!="string"||e.trim().length===0)return"leere Bedingung";try{return yr(e),null}catch(n){return n instanceof Error?n.message:String(n)}}s(ul,"conditionIssue");function vI(e){return e.item!==void 0&&e.group===void 0?{kind:"item",key:e.item}:e.group!==void 0&&e.item===void 0?{kind:"group",key:e.group}:null}s(vI,"rowTarget");function ly(e){if(e.byStage===void 0){let n=vI(e);return n===null?[]:[{...n,stages:null}]}return e.item!==void 0||e.group!==void 0?[]:e.byStage.flatMap(n=>{let t=vI(n);return t===null?[]:[{...t,stages:n.stages}]})}s(ly,"derivationTargets");function EI(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(EI,"assertNoCustomNodeExports");var dy=null;function TI(e){for(let[n,t]of Object.entries(e))EI(n,t);dy=e}s(TI,"setSpecs");function $I(){return dy||F("[workflow/registry] Specs not initialised. Import convex/model/admission/specs before calling specFor()."),dy}s($I,"requireSpecs");function He(e){let n=$I(),t=n[e.type];return t===void 0&&le("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(He,"specFor");function RI(){return Object.keys($I()).sort()}s(RI,"registeredNodeTypes");var II=ef.filter(e=>Xr[e].cohortBound!==!0);function cy(e){return pr(e)&&Xr[e].cohortBound!==!0}s(cy,"isEnvAddressLeaf");function uy(e){return mo(e).type}s(uy,"envType");function fy(e){return mo(e).label}s(fy,"envLabel");function hf(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};case"derived":return{scope:"derived",key:e.key}}}s(hf,"addressBase");function wr(e){return e.scope==="node"&&e.key===it&&e.path===void 0}s(wr,"isInstanceAddress");function dn(e){return we(e)&&e.scope==="node"&&e.key===it&&e.path!==void 0}s(dn,"isFormFieldAddress");function OI(e){return dn(e)?{owner:e.owner,path:e.path}:null}s(OI,"formFieldOf");function py(e){return bn(yr(e)).map(n=>{if(!n.startsWith("$"))return{identifier:n,address:null,reason:"bareIdentifier"};let t=Qr(n);return t===null?{identifier:n,address:null,reason:"shape"}:{identifier:n,address:t}})}s(py,"expressionAddresses");var it="admission",hl="document",Es="contract",Ts="contracts",PI="payment",my=new Set(["adoptForm","setFlagTarget","form","familyRequestFrom"]);var ct={id:"identity",type:"identity",label:"display",sublabel:"display",library:"display",outcomes:"control",outputLabels:"display",inputs:"input",next:"control",tasks:"config",assign:"reference",optionalActions:"config",artifacts:"config",notifications:"config"},_le={join:{...ct},end:{...ct},eventTrigger:{...ct},form:{...ct,adoptForm:"address",formExports:"stamp"},roleAssign:{...ct},setFlag:{...ct},if:{...ct,condition:"address"},countersign:{...ct,contract:"address",titles:"display",signing:"config"},engagePush:{...ct,engage:"tenantRef",form:"address",contract:"address",payment:"address"},decision:{...ct,commentRequired:"config",decisionAsTask:"config",reads:"address",requiresOneOf:"config"},review:{...ct,form:"address",reads:"address",commentRequired:"config",decisionAsTask:"config"},waitlist:{...ct},completenessCheck:{...ct,requires:"address",deadline:"config"},collectPayment:{...ct},governedDocument:{...ct,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 Cr(e){return Array.isArray(e)?e:[]}s(Cr,"listOf");function Vn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}s(Vn,"record");function _I(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(_I,"dataSourceFieldsOf");function NI(e){return e.type==="review"?[]:e.type==="engagePush"?["form"]:_I(e)}s(NI,"requiredDataSourceFields");var VG={setFlag:{target:"setFlagTarget"}};function gl(e,n={}){let t=[],r=e,i=`nodes.${e.id}`,o=s((d,c,u,f={})=>{t.push({kind:d,at:c,nodeId:e.id,value:u,judgedTogether:null,...f})},"field"),a=new Map(n.slotTypes===!1?[]:(He(e).inputs?.(e)??[]).map(d=>[d.id,d.type])),l=VG[e.type]??{};for(let[d,c]of Object.entries(Vn(r.inputs)??{})){let u=Vn(c);if(u?.kind!=="binding")continue;let f="address"in u?u.address:u.path,m=l[d];if(m!==void 0){o(m,`${i}.inputs.${d}`,f);continue}let y=a.get(d);o("binding",`${i}.inputs.${d}`,f,y!==void 0?{expectedType:y}:{})}for(let[d,c]of Cr(r.reads).entries())o("nodeReads",`${i}.reads.${d}`,c,{judgedTogether:`${i}.reads`});for(let[d,c]of Cr(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 _I(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 Cr(r.tasks).entries())t.push(...CI(e.id,c,d));return t}s(gl,"nodeAddressFields");function CI(e,n,t){let r=Vn(n);if(r===null)return[];let i=[],o=typeof r.key=="string"?r.key:String(t),a=`nodes.${e}.tasks.${o}`,l=s((f,m,y,k={})=>{i.push({kind:f,at:m,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[f,m]of Cr(r.reads).entries())l("taskReads",`${a}.reads.${f}`,m,{judgedTogether:d});for(let[f,m]of Cr(r.documents).entries()){let y=Vn(m);y===null||y.kind==="artifact"||l("taskDocument",`${a}.documents.${f}`,"address"in y?y.address:y.key)}let c=Vn(r.familyRequest);if(c!==null){for(let[f,m]of Cr(c.fields).entries())l("familyRequestFields",`${a}.familyRequest.fields.${f}`,m,{judgedTogether:`${a}.familyRequest.fields`});c.from!==void 0&&l("familyRequestFrom",`${a}.familyRequest.from`,c.from)}let u=Vn(r.result);if(u?.kind==="record")for(let[f,m]of Cr(u.fields).entries()){let y=Vn(Vn(m)?.suggest);if(y?.kind!=="form")continue;let k=Vn(m)?.type;l("suggest",`${a}.result.fields.${f}.suggest`,"address"in y?y.address:y.key,typeof k=="string"?{expectedType:k}:{})}return i}s(CI,"taskAddressFields");function gf(e){let n=[];for(let[t,r]of Cr(e.processStore).entries()){let i=Vn(Vn(r)?.derive);if(i?.reduction!==void 0){let o=String(Vn(r)?.key);n.push({kind:"reduction",at:`processStore.${t}.derive.reduction`,nodeId:null,priceKey:o,value:i.reduction,judgedTogether:null})}}for(let[t,r]of Cr(e.pricingRules).entries())for(let[i,o]of Cr(Vn(r)?.rows).entries())n.push({kind:"pricingRule",at:`pricingRules.${t}.rows.${i}.when`,nodeId:null,value:Vn(o)?.when,judgedTogether:null});return n}s(gf,"priceAddressFields");function $s(e){return hy(e)?(yf(e.value)??[]).flatMap(n=>n.address===null?[]:[n.address]):we(e.value)?[e.value]:[]}s($s,"addressesInField");function hy(e){return e.kind==="pricingRule"||e.kind==="condition"}s(hy,"isExpressionField");function yf(e){return ul(e)===null?py(e):null}s(yf,"ruleConditionAddresses");function vt(e){return e.type==="form"&&e.adoptForm!==void 0&&e.adoptForm!==!1}s(vt,"adoptsForm");function DI(e){if(e.type!=="form"||vt({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(DI,"createdSmartFormSlug");function GG(e,n){return e.type!=="governedDocument"||e.production!=="resolver"||n!==hl?n:e.generatorStamp?.parts!==void 0?Ts:Es}s(GG,"addressKeyOfPort");function gy(e){let n=e.result;return n===void 0||!xs(n)?[]:ff(n).map(t=>t.key)}s(gy,"storeWritesOf");function pl(e,n){return(Array.isArray(e.processStore)?e.processStore:[]).find(t=>t.key===n)}s(pl,"declaredKey");function Dr(e,n){let t=[];if(!vt(n))for(let r of He(n).outputs?.(n)??[])t.push({address:{scope:"node",owner:n.id,key:GG(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 gy(r)){let o=pl(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(Dr,"producedAddresses");function FI(e,n,t){for(let r of e.nodes)for(let i of Array.isArray(r.tasks)?r.tasks:[])if(i.key===n&&gy(i).includes(t))return{nodeId:r.id,template:i};return null}s(FI,"taskWriter");function Fr(e,n,t){return FI(e,n,t)?.nodeId??null}s(Fr,"taskOwnerNode");function ml(e,n){let t=pl(e,n)?.derive;if(t===void 0)return null;let r=Array.isArray(e.pricingRules)?e.pricingRules:[],i=[];for(let a of t.rules??[]){let l=r.find(d=>d.key===a);if(l===void 0)return null;for(let d of l.rows){let c=yf(d.when);if(c===null)return null;for(let u of c)u.address!==null&&i.push(u.address)}}let o=t.reduction;return we(o)&&i.push(o),zG(i)}s(ml,"derivedSources");function zG(e){let n=new Set;return e.filter(t=>{let r=se(t);return n.has(r)?!1:(n.add(r),!0)})}s(zG,"dedupe");function WG(e){return gl(e,{slotTypes:!1}).flatMap(n=>$s(n).map(t=>({address:t,field:n})))}s(WG,"writtenAddressesOf");function bo(e,n){let t=[],r=new Set,i=s((l,d,c,u)=>{let f=`${se(l)}|${d}|${c.at}|${u===void 0?"":se(u)}`;r.has(f)||(r.add(f),t.push({address:l,origin:d,field:c,...u!==void 0?{via:u}:{}}))},"push"),o=s((l,d,c=new Set)=>{let u=se(l);if(!c.has(u)){if(c.add(u),l.scope==="task"){let f=FI(e,l.owner,l.key);if(f===null)return;for(let m of CI(f.nodeId,f.template))if(!(m.kind!=="taskWhen"&&m.kind!=="taskReads"))for(let y of $s(m))i(y,"evidence",d,l)}if(l.scope==="derived")for(let f of ml(e,l.key)??[])i(f,"derivedSource",d,l),o(f,d,c)}},"carried");for(let{address:l,field:d}of WG(n))i(l,"written",d),o(l,d);let a=new Set((Array.isArray(n.tasks)?n.tasks:[]).flatMap(l=>gy(l).map(d=>`${l.key}.${d}`)));for(let l of gf(e))if(!(l.kind!=="reduction"||!we(l.value)||l.value.scope!=="task")&&a.has(`${l.value.owner}.${l.value.key}`))for(let d of ml(e,l.priceKey)??[])d.scope==="task"&&a.has(`${d.owner}.${d.key}`)||(i(d,"priceCheck",l,{scope:"derived",key:l.priceKey}),o(d,l));return t}s(bo,"addressReadsOf");function yy(e,n){switch(n.scope){case"env":return pr(n.key)?uy(n.key):al(e,n.key)?.type;case"derived":case"task":{if(n.path!==void 0||n.scope==="task"&&Fr(e,n.owner,n.key)===null)return;let t=pl(e,n.key);return t===void 0||n.scope==="derived"!=(t.derive!==void 0)?void 0:t.type}case"node":{let t=e.nodes.find(i=>i.id===n.owner);if(t===void 0)return;let r=Dr(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(yy,"addressType");function fl(e,n){let t=Vn(e)?.[n];return typeof t=="string"&&t.length>0?t:void 0}s(fl,"labelText");function Oe(e,n,t){let r=e.nodes.find(i=>i.id===n);return fl(r?.label,t)??n}s(Oe,"nodeDisplayName");function vo(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 fl(i.title,t)??n}return n}s(vo,"taskDisplayName");function Ue(e,n,t){let r=[];switch(n.scope){case"env":r.push(pr(n.key)?fy(n.key)[t]:al(e,n.key)?.label[t]??n.key);break;case"derived":r.push(fl(pl(e,n.key)?.label,t)??n.key);break;case"task":r.push(vo(e,n.owner,t),fl(pl(e,n.key)?.label,t)??n.key);break;case"node":{r.push(Oe(e,n.owner,t));let i=e.nodes.find(a=>a.id===n.owner),o=i===void 0?void 0:Dr(e,i).find(a=>a.address.scope==="node"&&a.address.key===n.key);r.push(fl(o?.label,t)??n.key);break}}return n.scope!=="env"&&n.path!==void 0&&r.push(n.path),`${r.join(" \u203A ")} (${se(n)})`}s(Ue,"displayAddress");var yl=["beneficiary","signers"];function LI(e,n){return Array.isArray(e.artifacts)&&e.artifacts.some(t=>t?.key===n)}s(LI,"ownsSlot");function wl(e){let n=[];for(let[t,r]of Object.entries(Vn(e.inputs)??{})){let i=Vn(r);i?.kind==="binding"&&we(i.address)&&n.push({slot:t,address:i.address})}return n}s(wl,"bindingAddresses");function MI(e,n){return wl(e).find(t=>t.slot===n)?.address??null}s(MI,"bindingAddressAt");function qI(e,n){let t=s(i=>i.scope==="node"&&i.owner===n||i.scope==="task"&&Fr(e,i.owner,i.key)===n,"names");return[...e.nodes.filter(i=>i.id!==n).flatMap(i=>gl(i,{slotTypes:!1})),...gf(e)].flatMap(i=>$s(i).filter(t).map(o=>({at:i.at,nodeId:i.nodeId,address:o})))}s(qI,"addressesNaming");var In={target:"target",flagKey:"flagKey",value:"value"};function YG(e){return MI(e,In.target)}s(YG,"setFlagTarget");function KI(e){let n=YG(e);return n!==null&&wr(n)?n.owner:null}s(KI,"setFlagTargetOwner");function wf(e){let n=e.inputs?.[In.flagKey];return n?.kind==="literal"&&typeof n.value=="string"&&n.value.length>0?n.value:null}s(wf,"setFlagKey");function jI(e){let n=e.inputs?.[In.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)}": \`${In.value}\` is no yes/no literal \u2014 publish refuses that`)}s(jI,"setFlagValue");function BI(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(BI,"isObject");var UI=["target","flagKey","value"];function VI(e){return BI(e)&&e.type==="setFlag"&&UI.some(n=>n in e)}s(VI,"oldShape");function GI(e){return(e?.nodes??[]).some(VI)}s(GI,"needsSetFlagInputMove");function HG(e){let n=BI(e.inputs)?{...e.inputs}:{};if(UI.some(a=>a in e&&In[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[In.target]={kind:"binding",address:t}),typeof r=="string"&&r.length>0&&(n[In.flagKey]={kind:"literal",value:r}),i!==void 0&&(n[In.value]={kind:"literal",value:i}),{node:{...o,inputs:n}}}s(HG,"moveNode");function zI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!VI(i))return i;let o=HG(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(zI,"moveSetFlagConfigToInputs");function WI(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(WI,"isObject");var wy={countersign:{dueInDays:"number"},decision:{allowSkipInTest:"boolean"},completenessCheck:{guestRole:"string"},governedDocument:{responseDueInDays:"number"}},ky={review:["allowSkipInTest"]};function YI(e){return wy[String(e)]??{}}s(YI,"movesOf");function HI(e){return ky[String(e)]??[]}s(HI,"deadOf");function JI(e){return WI(e)&&[...Object.keys(YI(e.type)),...HI(e.type)].some(n=>n in e)}s(JI,"oldShape");function QI(e){return(e?.nodes??[]).some(JI)}s(QI,"needsScalarInputMove");function JG(e,n){return n==="number"?typeof e=="number"&&Number.isInteger(e)&&e>=1:typeof e===n}s(JG,"wellTyped");function QG(e){let n=WI(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(YI(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==="")&&!JG(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 HI(e.type))delete t[r];return t.inputs=n,{node:t}}s(QG,"moveNode");function ZI(e){let n=[],t=[],r=e.nodes.map(i=>{if(!JI(i))return i;let o=QG(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(ZI,"moveScalarConfigToInputs");var Rs={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 kf(e){return typeof e=="string"&&Object.hasOwn(Rs,e)}s(kf,"isResourceType");var Wle=Object.keys(Rs).filter(e=>Rs[e].existence.check==="generic");function XI(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||wo(n.reduction)===null&&n.reduction.kind==="amount")&&Object.keys(n).every(t=>t==="groupKey"||t==="grantKeys"||t==="reduction")}s(XI,"isPricedGroupValue");var by=["street","hausnr","plz","ort","land"];function eO(e){return by.includes(e)}s(eO,"isAddressPart");var ZG=["municipality","municipalityKey","district","districtKey"],vy=[...by,...ZG],xy={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"},Is=Object.keys(xy);function _i(e){return typeof e=="string"&&e in xy}s(_i,"isValueType");function xt(e){return e===void 0?void 0:xy[e]}s(xt,"dataTypeOf");function bf(e,n){let t=xt(e),r=xt(n);return t!==void 0&&t===r}s(bf,"valueTypesCompatible");function vf(e){return e===null?"null is not a text in both languages":kl(e,{type:"localizedText"})}s(vf,"completeLocalizedTextIssue");function kl(e,n){if(kf(n.type)&&!_i(n.type))return typeof e=="string"&&e.length>0?null:`${JSON.stringify(e)} is not a ${n.type} key`;let t=xt(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")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 XI(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 ll(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=wo(e);return o===null?null:`${r} is not a reduction \u2014 ${o.en}`}}}s(kl,"literalTypeIssue");function nO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(nO,"isObject");var XG={collectPayment:{reason:"reason"}},ez={governedDocument:["mockAutoProduce"]},tO={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 Sy(e){return XG[String(e)]??{}}s(Sy,"movesOf");function rO(e){return ez[String(e)]??[]}s(rO,"deadOf");function iO(e){return nO(e)&&[...Object.keys(Sy(e.type)),...rO(e.type)].some(n=>n in e)}s(iO,"oldShape");function oO(e){return(e?.nodes??[]).some(iO)}s(oO,"needsNodeConfigInputMove");function nz(e){return vf(e)===null}s(nz,"isCompleteText");function tz(e){let n=nO(e.inputs)?{...e.inputs}:{},t={...e};for(let[r,i]of Object.entries(Sy(e.type)))if(r in e){if(i in n)return{unmoved:{nodeId:String(e.id),key:r,reason:"inputExists"}};if(!nz(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 rO(e.type))delete t[r];return Object.keys(Sy(e.type)).some(r=>r in e)&&(t.inputs=n),{node:t}}s(tz,"moveNode");function sO(e){let n=[],t=[],r=e.nodes.map(i=>{if(!iO(i))return i;let o=tz(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(sO,"moveNodeConfigToInputs");var Ay="collectPayment",Os=["online","separate"];function xf(e){return Os.includes(e)}s(xf,"isCollectPaymentSettlement");var Ps="paid",Ey="skipPayment",Ni="article",Ht="settlement",Ci="reason",Jt="payee",Ty=["one_time"];function Sf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Sf,"isObject");function aO(e){if(!Sf(e)||e.type!==Ay)return!1;let n=Sf(e.inputs)?e.inputs:{},t=n[Ht];return!Sf(t)||t.kind!=="literal"||t.value!=="online"?!1:!(Jt in n)}s(aO,"isOnlinePaymentWithoutPayee");function lO(e){return(e?.nodes??[]).some(aO)}s(lO,"needsPayee");function dO(e,n={}){let t=[],r=[],i=e.nodes.map(o=>{if(!aO(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=Sf(o.inputs)?o.inputs:{};return{...o,inputs:{...d,[Jt]:{kind:"literal",value:l}}}});return t.length===0?{graph:e,set:t,refused:r}:{graph:{...e,nodes:i},set:t,refused:r}}s(dO,"setPayeeOnOnlinePayments");function Af(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Af,"isObject");function $y(e){return Af(e)&&Af(e.assign)&&"userId"in e.assign}s($y,"namesUser");function Ef(e){return(e?.nodes??[]).flatMap(n=>Af(n)&&Array.isArray(n.tasks)?n.tasks.filter($y).map(t=>({nodeId:String(n.id),taskKey:String(t.key),hasTeam:typeof t.assign.group=="string"&&t.assign.group.length>0})):[])}s(Ef,"taskUserAssignments");function cO(e){let n=Ef(e);if(n.length===0)return{graph:e,dropped:n};let t=e.nodes.map(r=>{if(!Af(r)||!Array.isArray(r.tasks)||!r.tasks.some($y))return r;let i=r.tasks.map(o=>{if(!$y(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(cO,"dropTaskAssignUserIds");var _s={"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"}},"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"}},"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"}}},Ry=s(e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null,"record");function uO(e,n){if(typeof n!="string"||n.length===0)return null;if(e==="key")return n;let t=Ss(n);return t?.kind==="team"?t.groupKey:null}s(uO,"decodeKey");function rz(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(rz,"locate");function Tf(e){let n=[],t=e;for(let[r,i]of Object.entries(Ry(t.assign)??{})){let o=uO("key",i);n.push({path:`assign.${r}`,leaf:"assign{}",owner:r,key:o,missing:typeof i!="string"||i.length===0})}for(let r of Object.keys(_s)){if(r==="assign{}")continue;let i=_s[r],{list:o,field:a,key:l}=rz(r);for(let d of Array.isArray(t[o])?t[o]:[]){let c=Ry(d);if(c===null||typeof c.key!="string")continue;let f=(a===null?c:Ry(c[a]))?.[l];if(f===void 0&&!i.required)continue;let m=typeof f!="string"||f.length===0;n.push({path:`${o}.${c.key}${a===null?"":`.${a}`}.${l}`,leaf:r,owner:c.key,key:uO(i.codec,f),missing:m})}}return n}s(Tf,"nodeResourceReferences");var fO=s(e=>(e??[]).map(n=>`\u201E${n}\u201C`).join(", "),"list"),pO=s(e=>(e??[]).map(n=>`"${n}"`).join(", "),"listEn"),iz={"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 (${fO(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 (${pO(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/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 (${fO(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 (${pO(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 Ns(e,n,t){let{problem:r,remedy:i}=iz[e][t](n);return`[${e}] ${r} ${i}`}s(Ns,"addressMessage");function _t(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(_t,"derivedEdges");function $f(e,n,t){if(n===t)return!0;let r=new Map,i=new Set;for(let l of _t(e.nodes)){let d=r.get(l.source)??[];d.push(l.target),r.set(l.source,d),i.add(l.target)}let 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($f,"dominates");function mO(e,n,t){if(n===t)return!0;let r=new Map;for(let a of _t(e.nodes)){let l=r.get(a.source)??[];l.push(a.target),r.set(a.source,l)}let 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(mO,"reaches");function Iy(e,n){let t=[],r=s(a=>({address:a.address,type:a.type,...a.label!==void 0?{label:a.label}:{},nodeId:a.nodeId}),"toVisible");for(let a of e.nodes)if($f(e,a.id,n))for(let l of Dr(e,a))t.push(r(l));for(let a of II)t.push({address:{scope:"env",key:a},type:uy(a),label:fy(a),nodeId:null});for(let a of tf(e))t.push({address:{scope:"env",key:rf(a.key)},type:a.type,label:a.label,nodeId:null});let i=new Set(t.map(a=>se(a.address))),o=(Array.isArray(e.processStore)?e.processStore:[]).filter(a=>a.derive!==void 0);for(let a=!0;a;){a=!1;for(let l of o){let d=se({scope:"derived",key:l.key});if(i.has(d))continue;let c=ml(e,l.key);c===null||!c.every(u=>i.has(se(hf(u))))||(t.push({address:{scope:"derived",key:l.key},type:l.type,label:l.label,nodeId:null}),i.add(d),a=!0)}}return t}s(Iy,"visibleAddressesAt");function ii(e,n){let t=e?.readinessFormFieldsByFormNode?.get(n.owner);if(t!==void 0)return t.get(n.path)??null}s(ii,"formFieldEntryOf");var hO={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"},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"},reduction:{de:"Erm\xE4\xDFigung des Preises",en:"Reduction of the price"},pricingRule:{de:"Preisregel",en:"Pricing rule"}},oz=new Set(["nodeReads","requires","taskReads","taskDocument","familyRequestFields"]);function sz(e,n,t){let r=[];n.taskKey!==void 0&&r.push(`${t==="de"?"Aufgabe":"task"} \u201E${vo(e,n.taskKey,t)}\u201C`);let i=n.kind==="binding"?` \u201E${n.at.split(".").pop()}\u201C`:"";return r.push(`${hO[n.kind][t]}${i}`),r.join(" \u203A ")}s(sz,"addressFieldWhere");function bl(e,n,t){let r=sz(e,n,t);return n.nodeId===null?r:`\u201E${Oe(e,n.nodeId,t)}\u201C \u203A ${r}`}s(bl,"whereOf");function gO(e,n,t){if(n.scope==="node")return Oe(e,n.owner,t);if(n.scope==="task")return vo(e,n.owner,t)}s(gO,"producerName");function yO(e,n){let t=[],r=new Set,i=s((l,d,c)=>{let u={de:Ns(l,c("de"),"de"),en:Ns(l,c("en"),"en")},f=`${d}|${u.de}`;r.has(f)||(r.add(f),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=>gl(l)),...gf(e)];for(let l of a){let d=s(c=>bl(e,l,c),"where");for(let c of az(e,l,i))dz(e,l,c,i)&&(uz(e,l,c,n,i),my.has(l.kind)&&!pz(o,c)&&i("address/notFormInstance",l.at,u=>({where:d(u),address:Ue(e,c,u)})))}return mz(e,i),hz(e,a,i),kz(e,i),vz(e,i),t}s(yO,"checkAddresses");function az(e,n,t){let r=s(i=>bl(e,n,i),"where");if(hy(n)){let i=yf(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 $s(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(az,"checkFieldShape");function wO(e,n,t,r){let i=gO(e,t,r);return{where:bl(e,n,r),address:Ue(e,t,r),...i!==void 0?{producer:i}:{}}}s(wO,"addressParams");function lz(e,n,t){return cy(n)?null:al(e,n)!==void 0?t==="condition"||t==="binding"?null:"address/staffInputConditionOnly":pr(n)?"address/envCohortBound":"address/unknownKey"}s(lz,"envAddressRefusal");function dz(e,n,t,r){let i=s(o=>wO(e,n,t,o),"params");switch(t.scope){case"env":{let o=lz(e,t.key,n.kind);return o===null?!0:(r(o,n.at,i),!1)}case"derived":return(e.processStore??[]).find(a=>a.key===t.key)?.derive!==void 0?!0:(r("address/unknownKey",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&&a.derive===void 0)?Fr(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):Dr(e,o).some(a=>a.address.scope==="node"&&a.address.key===t.key)?!0:(r(my.has(n.kind)&&vt(o)?"address/notFormInstance":"address/unknownKey",n.at,i),!1)}}}s(dz,"resolves");function cz(e,n){return e===void 0||n===void 0||xt(n)===void 0?!0:xt(e)!==void 0&&bf(e,n)}s(cz,"addressTypeFits");function uz(e,n,t,r,i){let o=s(l=>wO(e,n,t,l),"params");if(t.scope!=="env"&&t.path!==void 0&&!fz(e,n,t,r)){i("address/pathNotInTarget",n.at,o);return}if(n.expectedType===void 0)return;let a=yy(e,t);cz(a,n.expectedType)||i("address/typeMismatch",n.at,l=>({...o(l),expected:n.expectedType,actual:a}))}s(uz,"checkPathAndType");function fz(e,n,t,r){if(t.scope!=="node")return!1;if(yy(e,t)!==void 0)return!0;if(t.key!==it)return!1;if(!oz.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(fz,"pathExists");function pz(e,n){if(!wr(n))return!1;let t=e.get(n.owner);return t!==void 0&&t.type==="form"&&!vt(t)}s(pz,"isCreatingFormInstance");function mz(e,n){for(let t of e.nodes){let r=new Set(gl(t).map(i=>i.kind));for(let i of NI(t))r.has(i)||n("address/missing",`nodes.${t.id}.${i}`,o=>({where:`\u201E${Oe(e,t.id,o)}\u201C \u203A ${hO[i][o]}`}))}}s(mz,"checkRequiredFields");function hz(e,n,t){let r=new Map;for(let i of n)if(i.judgedTogether!==null)for(let o of $s(i)){if(o.scope!=="node"||o.key!==it)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:bl(e,o[0].field,l),names:a.map(d=>Oe(e,d,l))}))}}s(hz,"checkMixedForms");function gz(e,n){return e.type==="engagePush"&&n.kind==="payment"}s(gz,"readSkipsAbsentProducer");function yz(e,n,t){return n!==t&&mO(e,n,t)}s(yz,"precedesOnSomePath");function wz(e,n,t,r){let i=hf(t.address);return r.has(se(i))||!bz(e,i)?!0:t.origin==="written"&&i.scope==="node"&&gz(n,t.field)&&yz(e,i.owner,n.id)}s(wz,"readPassesVisibility");function kz(e,n){for(let t of e.nodes){let r=bo(e,t);if(r.length===0)continue;let i=new Set(Iy(e,t.id).map(o=>se(o.address)));for(let o of r){let a=hf(o.address);if(wz(e,t,o,i))continue;let l=a.scope==="task"?Fr(e,a.owner,a.key):a.scope==="node"?a.owner:null;n("address/notVisible",o.field.at,d=>({where:bl(e,o.field,d),address:Ue(e,o.address,d),producer:gO(e,a,d)??Ue(e,a,d),...l!==null?{producerNode:Oe(e,l,d)}:{},reader:Oe(e,t.id,d)}))}}}s(kz,"checkVisibility");function bz(e,n){if(n.scope==="env")return cy(n.key);if(n.scope==="derived")return ml(e,n.key)!==null;let t=se(n);return e.nodes.some(r=>Dr(e,r).some(i=>se(i.address)===t))}s(bz,"producedSomewhere");function vz(e,n){let t=new Map;for(let r of e.nodes){let i=new Set(Dr(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"||!Nr.test(l)){n("workItems/keyFormat",`nodes.${r.id}.tasks.${o}.key`,c=>({where:`\u201E${Oe(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${Oe(e,o.nodeId,a)}\u201C \u203A ${a==="de"?"Aufgabe":"task"} \u201E${vo(e,r,a)}\u201C`,names:i.map(l=>Oe(e,l.nodeId,a))}))}s(vz,"checkTaskKeys");function Rf(e,n){return e.label[n]??""}s(Rf,"wordingIn");function Di(e,n){let t=kO(e,n),r=Rf(e.qualifier,n);return t===""||r===""&&Rf(e.qualifier,"de")!==""?"":r===""?t:`${r} \xB7 ${t}`}s(Di,"fieldLabelIn");function kO(e,n){return Rf(e,n)}s(kO,"fieldOwnLabelIn");function Cs(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:Di(e,"de"),en:Di(e,"en")}}}s(Cs,"catalogField");function Ds(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(Ds,"catalogFieldRefusal");function If(e,n){let t=e.buses.find(r=>r.key===n);return t||F(`[progress] layout '${e.id}' has no bus '${n}'`),t}s(If,"progressBus");function vl(e,n){return e.states.some(t=>t.id===n)}s(vl,"isBusState");function bO(e,n){let t=e.terminalSemantics?.[n];return t||F(`[progress] no terminal semantics for state '${n}' on bus '${e.key}'`),t}s(bO,"terminalSemantics");function Of(e,n){return!!e.terminalSemantics&&Object.prototype.hasOwnProperty.call(e.terminalSemantics,n)}s(Of,"hasTerminalSemantics");function xz(e,n){return(e.boards??[]).find(t=>t.audience===n||t.audience==="both")??null}s(xz,"boardForAudience");function vO(e){return xz(If(e,"process"),"internal")}s(vO,"internalProcessBoard");function Fs(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(Fs,"resolveProgressEvent");var Ls={approved:"enrolled",rejected:"declined",withdrawn:"declined",expired:"declined"},oi=Object.keys(Ls);function xo(e){return Object.hasOwn(Ls,e)}s(xo,"isEndNodeOutcome");var Oy={approved:{de:"Angenommen",en:"Admitted"},rejected:{de:"Abgelehnt",en:"Rejected"},withdrawn:{de:"Zur\xFCckgezogen",en:"Withdrawn"},expired:{de:"Abgelaufen",en:"Expired"}};var Fi=["commit","discard"],Vde=w.union(...Fi.map(e=>w.literal(e)));function Pf(e){return typeof e=="string"&&Fi.includes(e)}s(Pf,"isApplicationDataDecision");function Dn(e){return Object.keys(e)}s(Dn,"progressEventsOf");var te=s((e,n)=>({de:e,en:n}),"lt"),en=s((e,n,t,r,i=null,o=null)=>({chipLabel:e,tone:n,nextAction:i,affordance:o,title:t,body:r}),"ex"),xO={key:"eingeschrieben",label:te("Eingeschrieben","Enrolled"),scope:"global",defaultCollapsed:!0},_f={key:"abgesagt",label:te("Abgesagt","Declined"),scope:"global",track:"exit",defaultCollapsed:!0},SO={key:"abgelehnt",label:te("Abgelehnt","Rejected"),scope:"global",track:"exit",defaultCollapsed:!0};var AO={enrolled:{label:te("Eingeschrieben","Enrolled"),tone:"green",terminal:{lifecycleStatus:"completed",outcome:"approved"},phase:xO,external:en(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:_f,external:en(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."))}},EO={role:"effect",effect:"pure",progressDefaults:AO,progressEvents:Dn(AO),inputs:s(()=>[{id:"applicationOutcome",label:{de:"Ergebnis",en:"Outcome"},type:"enum",required:!0,inspector:"literal-only",optionSource:"declared",enumOptions:oi.map(e=>({value:e,label:Oy[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=>[...Sz(e),...Az(e),...Ez(e)],"validate")},Ms=s((e,n,t,r)=>({layer:"GRAPH",kind:"nodeRule",path:`node.${e.id}.inputs.${n}`,reason:{de:t,en:r},severity:"error"}),"nodeIssue");function xl(e){let n=e.inputs?.applicationOutcome;return n?.kind==="literal"&&n.value!=null?String(n.value):null}s(xl,"literalOutcome");function Sz(e){if(e.type!=="end")return[];let n=e.inputs?.applicationOutcome;if(n===void 0||n.kind==="unset")return[];let t=xl(e);return t===null?[Ms(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`)]:xo(t)?[]:[Ms(e,"applicationOutcome",`[end/applicationOutcome] ${e.label.de}: '${t}' ist kein Ausgang eines Endknotens (${oi.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 (${oi.join("|")}) \u2014 the waitlist ends through the closed outcome of its waitlist node`)]}s(Sz,"checkEndApplicationOutcome");function Az(e){if(e.type!=="end")return[];let n=e.inputs?.dataDecision;return!n||n.kind!=="literal"||n.value==null?[Ms(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)`)]:Pf(n.value)?[]:[Ms(e,"dataDecision",`[end/dataDecision] ${e.label.de}: dataDecision '${String(n.value)}' ist ung\xFCltig (${Fi.join("|")})`,`[end/dataDecision] ${e.label.en}: dataDecision '${String(n.value)}' is invalid (${Fi.join("|")})`)]}s(Az,"checkEndDataDecision");function Ez(e){if(e.type!=="end")return[];let n=xl(e);if(n===null||!xo(n)||n==="approved")return[];let t=e.inputs?.dataDecision;if(t?.kind!=="literal"||t.value!=="commit")return[];let r=Oy[n];return[{...Ms(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(Ez,"checkEndCommitWithoutApproval");function TO(e,n){if(!n?.layout||!n.wiring)return[];let t=[];for(let r of e.nodes){if(r.type!=="end")continue;let i=xl(r);if(i===null||!xo(i))continue;let o=Ls[i],a=Fs(n.wiring,r,o);if(a===null)continue;let l=n.layout.buses.find(c=>c.key===a.bus);if(l===void 0||!Of(l,a.state))continue;let d=bO(l,a.state).outcome;d!==i&&t.push(Ms(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(TO,"checkEndOutcomeMatchesTerminal");function qs(e){let n=He(e);return typeof n.inputs=="function"?n.inputs(e):[]}s(qs,"inputSlots");function Tz(e,n){return qs(e).find(t=>t.id===n)}s(Tz,"findInputSlot");function $z(e,n){let t=Tz(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($z,"resolveInput");function $O(e){return qs(e).filter(n=>$z(e,n.id).source==="missing")}s($O,"missingRequiredInputs");var Rz=["personRef","formRef","documentRef","docRef"];function Iz(e){let n=He(e);return typeof n.inputs!="function"?[]:n.inputs(e).map(t=>({id:t.id,type:t.type}))}s(Iz,"listInputs");function RO(e){let n=[];for(let t of e.nodes)for(let r of Iz(t))!Rz.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(RO,"findParamValueRefSlotErrors");function IO(e){let n=[];for(let t of e.nodes){let r=He(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(IO,"findInspectorKindErrors");function OO(e){let n=[];for(let t of e.nodes)for(let r of $O(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(OO,"findMissingRequiredInputs");function Nf(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(Nf,"processStoreKeys");function _O(e){let n=[];for(let t of e.tasks??[]){let r=t.result;if(!(r===void 0||!xs(r)))for(let i of ff(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(_O,"storeWritersOn");function NO(e){let n=new Map;for(let t of e.nodes)for(let r of _O(t)){let i=n.get(r.key)??[];i.push(r),n.set(r.key,i)}return n}s(NO,"processStoreWriters");function Oz(e,n,t){for(let r of e.nodes){let i=_O(r).find(o=>o.taskKey===n&&o.key===t);if(i!==void 0)return i}return null}s(Oz,"writerAt");function PO(e,n,t){(n.scope!=="task"||n.path!==void 0)&&F(`[process] ${t}: ${se(n)} is no task value`);let r=Oz(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(PO,"sourceOfAddress");function Py(e,n){(n.scope!=="task"&&n.scope!=="derived"||n.path!==void 0)&&F(`[process] ${se(n)} is no store address`);let t=Nf(e).find(o=>o.key===n.key);t===void 0&&F(`[address/unknownKey] ${se(n)}: "${n.key}" is not declared in processStore`);let r={key:t.key,type:t.type,label:t.label,audience:t.audience};if(n.scope==="task")return sy(t)&&F(`[address/unknownKey] ${se(n)}: "${n.key}" is a derived price \u2014 read it as $derived`),{...r,sources:[PO(e,n,se(n))]};sy(t)||F(`[address/unknownKey] ${se(n)}: "${n.key}" is a written value \u2014 read it as $task`);let i=ay(e,t.derive).map(o=>PO(e,o.address,se(n)));return{...r,sources:i,derive:t.derive}}s(Py,"processLeafOf");var _y=new Set(["enum","pricedItem","number","boolean","reduction"]),Ny=new Set(["pricedItem","pricedGroup"]),Cy=new Set(["number","boolean","enum"]),Fe={invalidKey:"[process/invalidKey]",unknownKey:"[process/unknownKey]",secondWriter:"[process/secondWriter]",noWriter:"[process/noWriter]",writerTypeMismatch:"[process/writerTypeMismatch]",pricedItemWritesNothing:"[process/pricedItemWritesNothing]",ruleSet:"[process/ruleSet]",ruleCondition:"[process/ruleCondition]",ruleSource:"[process/ruleSource]",ruleReadsAbsent:"[process/ruleReadsAbsent]",absentValue:"[process/absentValue]",derive:"[process/derive]",derivedHasWriter:"[process/derivedHasWriter]",ruleGrantUnknown:"[process/ruleGrantUnknown]",ruleGrantUnused:"[process/ruleGrantUnused]",derivePriceUnknown:"[process/derivePriceUnknown]",derivePriceNotInProgram:"[process/derivePriceNotInProgram]",derivePriceOfferWithoutProgram:"[process/derivePriceOfferWithoutProgram]",deriveStageUnknown:"[process/deriveStageUnknown]",deriveStageUncovered:"[process/deriveStageUncovered]",reductionPrices:"[process/reductionPrices]",internalInDocument:"[process/internalInDocument]",writerMustBlock:"[process/writerMustBlock]",absentWithoutDefault:"[process/absentWithoutDefault]",defaultItemMismatch:"[process/defaultItemMismatch]"};function Le(e,n,t,r){return{layer:"GRAPH",kind:"contractGap",path:e,reason:{de:`${n} ${t}`,en:`${n} ${r}`},severity:"error"}}s(Le,"err");function CO(e,n={}){let t=[],r=Nf(e),i=new Map(r.map(d=>[d.key,d])),o=new Set;for(let[d,c]of r.entries()){let u=`processStore[${d}]`;if(typeof c.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(c.key)){t.push(Le(u,Fe.invalidKey,`Vorgangs-Schl\xFCssel ${JSON.stringify(c.key)} \u2014 erlaubt sind Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Process key ${JSON.stringify(c.key)} \u2014 letters, digits and _ are allowed, starting with a lowercase letter.`));continue}o.has(c.key)&&t.push(Le(u,Fe.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" ist doppelt deklariert.`,`Process key "${c.key}" is declared twice.`)),o.add(c.key),(c.derive!==void 0?!Ny.has(c.type):!_y.has(c.type))&&t.push(c.derive!==void 0?Le(u,Fe.derive,`Vorgangs-Schl\xFCssel "${c.key}" ist abgeleitet, hat aber den Typ "${c.type}" \u2014 abgeleitet wird nur ein Preis: ${[...Ny].join(", ")}.`,`Process key "${c.key}" is derived but has the type "${c.type}" \u2014 only a price can be derived: ${[...Ny].join(", ")}.`):Le(u,Fe.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" hat den Typ "${c.type}" \u2014 der Vorgang speichert nur Ergebnisse mit Wert: ${[..._y].join(", ")}${c.type==="pricedGroup"?" (ein Paket wird abgeleitet: derive)":""}.`,`Process key "${c.key}" has the type "${c.type}" \u2014 the process only stores results with a value: ${[..._y].join(", ")}${c.type==="pricedGroup"?" (a package is derived: derive)":""}.`)),(!c.label?.de?.trim()||!c.label?.en?.trim())&&t.push(Le(u,Fe.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}" braucht ein Label in beiden Sprachen.`,`Process key "${c.key}" needs a label in both languages.`)),c.audience!=="internal"&&c.audience!=="printable"&&t.push(Le(u,Fe.invalidKey,`Vorgangs-Schl\xFCssel "${c.key}": audience muss 'internal' oder 'printable' sein.`,`Process key "${c.key}": audience must be 'internal' or 'printable'.`))}let a=NO(e);for(let d of e.nodes)for(let c of d.tasks??[]){let u=c.result;u?.kind==="pricedItem"&&u.writes===void 0&&t.push(Le(`node.${d.id}.tasks.${c.key}.result.writes`,Fe.pricedItemWritesNothing,`Aufgabe "${c.key}" (Knoten "${d.id}") bepreist einen Artikel, schreibt das Ergebnis aber in keinen Vorgangs-Schl\xFCssel ('result.writes') \u2014 niemand k\xF6nnte den Preis lesen.`,`Task "${c.key}" (node "${d.id}") prices an article but writes the result to no process key ('result.writes') \u2014 nobody could read the price.`))}for(let[d,c]of a){let u=i.get(d);for(let f of c){let m=f.fieldKey===void 0?`node.${f.nodeId}.tasks.${f.taskKey}.result.writes`:`node.${f.nodeId}.tasks.${f.taskKey}.result.fields.${f.fieldKey}.writes`;if(u===void 0){t.push(Le(m,Fe.unknownKey,`${f.fieldKey===void 0?"":`Feld "${f.fieldKey}" der `}Aufgabe "${f.taskKey}" schreibt "${d}", aber der Workflow deklariert keinen solchen Vorgangs-Schl\xFCssel (graph.processStore).`,`${f.fieldKey===void 0?"Task":`Field "${f.fieldKey}" of task`} "${f.taskKey}" writes "${d}", but the workflow declares no such process key (graph.processStore).`));continue}if(f.valueType!==u.type){let y=f.fieldKey===void 0?`Aufgabe "${f.taskKey}"`:`Feld "${f.fieldKey}" der Aufgabe "${f.taskKey}"`,k=f.fieldKey===void 0?`Task "${f.taskKey}"`:`Field "${f.fieldKey}" of task "${f.taskKey}"`;t.push(Le(m,Fe.writerTypeMismatch,`${y} liefert ${f.valueType}, der Vorgangs-Schl\xFCssel "${d}" ist aber als ${u.type} deklariert.`,`${k} delivers ${f.valueType}, but the process key "${d}" is declared as ${u.type}.`))}}if(c.length>1){let f=c.map(m=>`${m.nodeId}/${m.taskKey}${m.fieldKey===void 0?"":`.${m.fieldKey}`}`).join(", ");t.push(Le(`processStore.${d}`,Fe.secondWriter,`Vorgangs-Schl\xFCssel "${d}" wird ${c.length}-mal geschrieben (${f}) \u2014 genau ein Schreiber je Schl\xFCssel.`,`Process key "${d}" is written ${c.length} times (${f}) \u2014 exactly one writer per key.`))}}for(let d of r){if(d.derive!==void 0){if(a.has(d.key)){let c=a.get(d.key).map(u=>`${u.nodeId}/${u.taskKey}`).join(", ");t.push(Le(`processStore.${d.key}`,Fe.derivedHasWriter,`Vorgangs-Schl\xFCssel "${d.key}" wird abgeleitet (derive) \u2014 keine Aufgabe darf ihn schreiben (${c}).`,`Process key "${d.key}" is derived (derive) \u2014 no task may write it (${c}).`))}continue}a.has(d.key)||t.push(Le(`processStore.${d.key}`,Fe.noWriter,`Vorgangs-Schl\xFCssel "${d.key}" ist deklariert, aber keine Aufgabe schreibt ihn ('result.writes').`,`Process key "${d.key}" is declared, but no task writes it ('result.writes').`))}t.push(...Pz(e,r,a,n));let l=new Map;for(let d of e.nodes){let c=He(d),u=typeof c.inputs=="function"?c.inputs(d):[];for(let f of u){let m=d.inputs?.[f.id];if(m?.kind!=="binding")continue;let y=_z(e,m.address);if(y===null)continue;let k=`node.${d.id}.input.${f.id}`,g=se(m.address);for(let A of y.sources){let $=l.get(A.key)??new Set;$.add(d.id),l.set(A.key,$)}if(y.audience==="internal"&&t.push(Le(k,Fe.internalInDocument,`${d.label.de}: "${f.id}" liest den internen Vorgangs-Schl\xFCssel "${y.key}" \u2014 ein Dokument dieses Knotens geht an die Familie; nur 'printable'-Schl\xFCssel d\xFCrfen hinein.`,`${d.label.en}: "${f.id}" reads the internal process key "${y.key}" \u2014 a document of this node goes to the family; only 'printable' keys may go in.`)),y.derive!==void 0)continue;let b=Nz(a,y.sources[0].key,y.sources[0].taskKey);if(b.template.when!==void 0&&f.required===!0&&f.defaultValue===void 0&&t.push(Le(k,Fe.absentWithoutDefault,`${d.label.de}: "${f.id}" ist Pflicht und an ${g} gebunden, aber die schreibende Aufgabe entsteht nur unter einer Bedingung (when: ${Cf(b.template.when)}) \u2014 ohne Vorgabewert bliebe das Feld dann f\xFCr immer leer.`,`${d.label.en}: "${f.id}" is required and bound to ${g}, but the writing task only exists under a condition (when: ${Cf(b.template.when)}) \u2014 without a default value the field would stay empty forever.`)),b.result.kind==="pricedItem"&&f.defaultValue!==void 0){let A=f.defaultValue;(!Ii(A)||A.itemKey!==b.result.item||A.grantKeys.length>0)&&t.push(Le(k,Fe.defaultItemMismatch,`${d.label.de}: der Vorgabewert von "${f.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.`,`${d.label.en}: the default value of "${f.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[d,c]of l){let u=a.get(d)[0],f=u.template.blocks,m=f===void 0?void 0:f.node??u.nodeId,y=m!==void 0&&c.has(m)&&(()=>{let g=e.nodes.find(b=>b.id===m);return g!==void 0&&He(g).processHoldTemplate?.(g)===f.templateKey})(),k=`node.${u.nodeId}.tasks.${u.taskKey}.blocks`;if(!y){let g=[...c][0],b=e.nodes.find($=>$.id===g),A=He(b).processHoldTemplate?.(b)??"?";t.push(Le(k,Fe.writerMustBlock,`Die Aufgabe "${u.taskKey}" schreibt "${d}", h\xE4lt aber keinen der lesenden Knoten (${[...c].join(", ")}) zur\xFCck \u2014 sie muss den ersten blockieren, z. B. blocks: { ${g===u.nodeId?"":`node: '${g}', `}templateKey: '${A}' }, sonst arbeitet er, bevor der Wert existiert.`,`The task "${u.taskKey}" writes "${d}" but holds back none of the reading nodes (${[...c].join(", ")}) \u2014 it must block the first one, e.g. blocks: { ${g===u.nodeId?"":`node: '${g}', `}templateKey: '${A}' }, otherwise it works before the value exists.`));continue}for(let g of c)g===m||$f(e,m,g)||t.push(Le(k,Fe.writerMustBlock,`"${g}" liest "${d}", liegt aber nicht hinter dem zur\xFCckgehaltenen Knoten "${m}" \u2014 auf einem Weg an ihm vorbei l\xE4se er den Wert, bevor er feststeht.`,`"${g}" reads "${d}" but does not lie behind the held-back node "${m}" \u2014 on a path past it, it would read the value before it is settled.`))}return t}s(CO,"processBindingIssues");function Pz(e,n,t,r){let i=[],o=new Map(n.map(u=>[u.key,u])),a=mf(e),l=new Set;for(let[u,f]of a.entries()){let m=`pricingRules[${u}]`;if((typeof f.key!="string"||!/^[a-z][a-zA-Z0-9_]*$/.test(f.key)||l.has(f.key))&&i.push(Le(m,Fe.ruleSet,`Regelgruppe ${JSON.stringify(f.key)} \u2014 ein eindeutiger Schl\xFCssel aus Buchstaben, Ziffern und _, beginnend mit einem Kleinbuchstaben.`,`Rule group ${JSON.stringify(f.key)} \u2014 a unique key of letters, digits and _, starting with a lowercase letter.`)),l.add(f.key),(!f.label?.de?.trim()||!f.label?.en?.trim())&&i.push(Le(m,Fe.ruleSet,`Regelgruppe "${f.key}" braucht ein Label in beiden Sprachen.`,`Rule group "${f.key}" needs a label in both languages.`)),!Array.isArray(f.rows)||f.rows.length===0){i.push(Le(m,Fe.ruleSet,`Regelgruppe "${f.key}" hat keine Zeilen.`,`Rule group "${f.key}" has no rows.`));continue}for(let[y,k]of f.rows.entries()){let g=`${m}.rows[${y}]`;(!Array.isArray(k.grants)||k.grants.length===0||k.grants.some(A=>typeof A!="string"||A.length===0))&&i.push(Le(g,Fe.ruleSet,`Regelgruppe "${f.key}", Zeile ${y+1}: nennt keine Rabattvorlage \u2014 eine Zeile ohne Rabatt ist die fehlende Zeile.`,`Rule group "${f.key}", row ${y+1}: names no discount template \u2014 a row without a discount is the missing row.`));let b=ul(k.when);if(b!==null){i.push(Le(g,Fe.ruleCondition,`Regelgruppe "${f.key}", Zeile ${y+1}: Bedingung ${JSON.stringify(k.when)} \u2014 ${b}.`,`Rule group "${f.key}", row ${y+1}: condition ${JSON.stringify(k.when)} \u2014 ${b==="leere Bedingung"?"empty condition":b}.`));continue}for(let{identifier:A,address:$}of py(k.when)){if($===null)continue;let O=Cz($,o,t);if(O==="ruleSource")i.push(Le(g,Fe.ruleSource,`Regelgruppe "${f.key}", Zeile ${y+1}: liest ${A} \u2014 eine Bedingung liest nur Werte, die eine Aufgabe schreibt ($task.<aufgabe>.<schl\xFCssel>), vom Typ ${[...Cy].join(", ")}.`,`Rule group "${f.key}", row ${y+1}: reads ${A} \u2014 a condition only reads values that a task writes ($task.<task>.<key>), of type ${[...Cy].join(", ")}.`));else if(O==="ruleReadsAbsent"){let E=t.get($.key).find(I=>I.taskKey===$.owner);i.push(Le(g,Fe.ruleReadsAbsent,`Regelgruppe "${f.key}" liest ${A}, dessen Aufgabe entfallen kann (${E.template.when!==void 0?`when: ${Cf(E.template.when)}`:"sie endet mit ihrem Knoten"}) \u2014 der Schl\xFCssel muss sagen, wof\xFCr er ohne Aufgabe steht ('absentValue'), sonst entschiede die Regel still \xFCber einen fehlenden Wert.`,`Rule group "${f.key}" reads ${A}, whose task can lapse (${E.template.when!==void 0?`when: ${Cf(E.template.when)}`:"it ends with its node"}) \u2014 the key must say what it stands for without a task ('absentValue'), otherwise the rule would silently decide on a missing value.`))}}}}for(let u of n){if(u.absentValue===void 0)continue;let f=`processStore.${u.key}.absentValue`;if(!(u.type==="number"&&typeof u.absentValue=="number"||u.type==="boolean"&&typeof u.absentValue=="boolean"||u.type==="enum"&&typeof u.absentValue=="string"&&u.absentValue.length>0)){i.push(Le(f,Fe.absentValue,`Vorgangs-Schl\xFCssel "${u.key}" (${u.type}): absentValue ${JSON.stringify(u.absentValue)} passt nicht zum Typ.`,`Process key "${u.key}" (${u.type}): absentValue ${JSON.stringify(u.absentValue)} does not fit the type.`));continue}let y=t.get(u.key)?.[0];y!==void 0&&!DO(y)&&i.push(Le(f,Fe.absentValue,`Vorgangs-Schl\xFCssel "${u.key}": seine Aufgabe ist immer geschuldet und \xFCberlebt ihren Knoten \u2014 ein absentValue w\xFCrde nie gelesen.`,`Process key "${u.key}": its task is always owed and outlives its node \u2014 an absentValue would never be read.`))}let d=[];for(let u of n){let f=u.derive;if(f===void 0)continue;let m=`processStore.${u.key}.derive`,y=u.type==="pricedGroup"?"group":"item",k=[f.item,f.group,f.byStage].filter(I=>I!==void 0).length,g=ly(f),b=f.byStage??[];(k!==1||g.length===0||g.length!==Math.max(b.length,1)||g.some(I=>I.kind!==y))&&i.push(Le(m,Fe.derive,`"${u.key}" (${u.type}) leitet ${y==="group"?"ein Paket ab: genau 'group' oder 'byStage' mit je einem 'group'":"einen Artikel ab: genau 'item' oder 'byStage' mit je einem 'item'"}.`,`"${u.key}" (${u.type}) derives ${y==="group"?"a package: exactly 'group' or 'byStage' with one 'group' each":"an article: exactly 'item' or 'byStage' with one 'item' each"}.`));let A=new Set;for(let[I,v]of b.entries()){if(!Array.isArray(v.stages)||v.stages.length===0){i.push(Le(`${m}.byStage[${I}]`,Fe.derive,`"${u.key}": die Zeile ${I+1} nennt keine Stufe.`,`"${u.key}": row ${I+1} names no stage.`));continue}for(let R of v.stages)A.has(R)&&i.push(Le(`${m}.byStage[${I}]`,Fe.derive,`"${u.key}": die Stufe "${R}" steht in mehr als einer Zeile \u2014 welcher Preis gilt, w\xE4re geraten.`,`"${u.key}": the stage "${R}" is in more than one row \u2014 which price applies would be a guess.`)),A.add(R)}let $=new Set;for(let I of f.rules??[]){let v=a.find(R=>R.key===I);if(v===void 0){i.push(Le(m,Fe.derive,`"${u.key}" nennt die Regelgruppe "${I}", die der Workflow nicht deklariert (bekannt: ${a.map(R=>R.key).join(", ")||"keine"}).`,`"${u.key}" names the rule group "${I}", which the workflow does not declare (known: ${a.map(R=>R.key).join(", ")||"none"}).`));continue}for(let R of v.rows??[])for(let K of R.grants??[])$.add(K)}let O=f.reduction;we(O)&&(Dz(O,o)||i.push(Le(m,Fe.derive,`"${u.key}": Reduktion ${se(O)} ist kein von einer Aufgabe geschriebener Wert vom Typ reduction ($task.<aufgabe>.<schl\xFCssel>).`,`"${u.key}": reduction ${se(O)} is not a value of type reduction written by a task ($task.<task>.<key>).`)));for(let I of g)d.push({key:u.key,target:I,grants:$}),(I.kind==="item"?r.billingItemKeys?.has(I.key):r.groupArticleKeys?.has(I.key))===!1?i.push(Le(m,Fe.derivePriceUnknown,`"${u.key}": ${I.kind==="item"?"der Artikel":"das Paket"} "${I.key}" ist nicht im Katalog des Mandanten.`,`"${u.key}": the ${I.kind==="item"?"article":"package"} "${I.key}" is not in the school's catalog.`)):r.offerProgram===null?i.push(Le(m,Fe.derivePriceOfferWithoutProgram,`"${u.key}": das Angebot ist keinem Programm zugeordnet, also geh\xF6rt ${I.kind==="item"?"kein Artikel":"kein Paket"} zu ihm; dem Angebot ein Programm geben.`,`"${u.key}": the offer is not assigned to a program, so no ${I.kind==="item"?"article":"package"} belongs to it; give the offer a program.`)):r.offerProgram!==void 0&&((I.kind==="item"?r.offerProgram.billingItemKeys:r.offerProgram.groupKeys).has(I.key)||i.push(Le(m,Fe.derivePriceNotInProgram,`"${u.key}": ${I.kind==="item"?"der Artikel":"das Paket"} "${I.key}" ist dem Programm \u201E${r.offerProgram.nameDe}\u201C des Angebots nicht zugeordnet${I.kind==="group"?" oder wird nicht angeboten":""} (unter Finanzen \u2192 Artikel zuordnen).`,`"${u.key}": the ${I.kind==="item"?"article":"package"} "${I.key}" is not assigned to the offer's program "${r.offerProgram.nameDe}"${I.kind==="group"?" or is not offered":""} (under Finance \u2192 assign articles).`)));let E=r.offerProgram?.stageKeys;if(f.byStage!==void 0&&E!==void 0){let I=[...A].filter(R=>!E.all.has(R));I.length>0&&i.push(Le(m,Fe.deriveStageUnknown,`"${u.key}": ${I.map(R=>`"${R}"`).join(", ")} ist keine Stufe des Programms \u201E${r.offerProgram.nameDe}\u201C (Stufen: ${[...E.all].join(", ")||"keine"}).`,`"${u.key}": ${I.map(R=>`"${R}"`).join(", ")} ${I.length===1?"is not a stage":"are not stages"} of the program "${r.offerProgram.nameDe}" (stages: ${[...E.all].join(", ")||"none"}).`));let v=[...E.active].filter(R=>!A.has(R));v.length>0&&i.push(Le(m,Fe.deriveStageUncovered,`"${u.key}": f\xFCr ${v.map(R=>`"${R}"`).join(", ")} nennt byStage keinen ${y==="group"?"Paket":"Artikel"} \u2014 diese Stufe h\xE4tte keinen Preis.`,`"${u.key}": for ${v.map(R=>`"${R}"`).join(", ")} byStage names no ${y==="group"?"package":"article"} \u2014 that stage would have no price.`))}}for(let u of t.values())for(let f of u){if(f.result.kind!=="reduction"||f.result.prices===void 0||f.result.writes===void 0)continue;let m=`node.${f.nodeId}.tasks.${f.taskKey}.result.prices`,k=o.get(f.result.prices)?.derive?.reduction;we(k)&&k.scope==="task"&&k.owner===f.taskKey&&k.key===f.result.writes||i.push(Le(m,Fe.reductionPrices,`Aufgabe "${f.taskKey}" senkt "${f.result.prices}" \u2014 das muss ein abgeleiteter Preis sein, dessen derive.reduction $task.${f.taskKey}.${f.result.writes} ist.`,`Task "${f.taskKey}" reduces "${f.result.prices}" \u2014 that must be a derived price whose derive.reduction is $task.${f.taskKey}.${f.result.writes}.`))}let c=r.grantTemplates;if(c!==void 0){let u=new Set(a.flatMap(f=>(f.rows??[]).flatMap(m=>m.grants??[])));for(let f of u){let m=c.get(f);if(m===void 0){i.push(Le("pricingRules",Fe.ruleGrantUnknown,`Eine Regelgruppe vergibt "${f}", aber keine Rabattvorlage des Mandanten tr\xE4gt diesen Schl\xFCssel.`,`A rule group grants "${f}", but no discount template of the school has this key.`));continue}d.some(({target:k,grants:g})=>{if(!g.has(f))return!1;if(k.kind==="item")return m.itemKeys.includes(k.key);let b=r.groupArticleKeys?.get(k.key);return m.itemKeys.some(A=>b?.has(A))})||i.push(Le("pricingRules",Fe.ruleGrantUnused,`Die Rabattvorlage "${f}" (gebunden an Artikel "${m.itemKeys.join(", ")}") wird vergeben, aber kein abgeleiteter Preis, der ihre Regelgruppe liest, enth\xE4lt ihr Ziel \u2014 sie wirkte nirgends.`,`The discount template "${f}" (bound to article "${m.itemKeys.join(", ")}") is granted, but no derived price reading its rule group contains its target \u2014 it would have no effect anywhere.`))}}return i}s(Pz,"derivedPriceIssues");function _z(e,n){if(!we(n)||n.scope!=="task"&&n.scope!=="derived"||n.path!==void 0)return null;let t=Nf(e).find(o=>o.key===n.key);if(t===void 0||n.scope==="derived"!=(t.derive!==void 0))return null;if(n.scope==="task")return Fr(e,n.owner,n.key)===null?null:Py(e,n);let r=AI(e,t.derive),i=s(o=>o.scope==="task"&&o.path===void 0&&Fr(e,o.owner,o.key)!==null,"resolvable");return r!==null&&r.every(o=>i(o.address))?Py(e,n):null}s(_z,"draftLeafOf");function Nz(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(Nz,"writerOf");function Cf(e){return we(e)?se(e):JSON.stringify(e)}s(Cf,"shown");function Cz(e,n,t){let r=e.scope==="task"&&e.path===void 0?n.get(e.key):void 0;if(e.scope==="task"&&e.path===void 0&&r===void 0)return null;if(e.scope!=="task"||r===void 0||r.derive!==void 0||!Cy.has(r.type))return"ruleSource";let i=t.get(r.key)?.find(o=>o.taskKey===e.owner);return i!==void 0&&DO(i)&&r.absentValue===void 0?"ruleReadsAbsent":null}s(Cz,"ruleSourceRefusal");function Dz(e,n){let t=e.scope==="task"&&e.path===void 0?n.get(e.key):void 0;return t!==void 0&&t.type==="reduction"&&t.derive===void 0}s(Dz,"isReductionValue");function DO(e){return e.template.when!==void 0||e.template.blocks?.node===void 0}s(DO,"writerMayBeNotOwed");function Dy(e){let n=He(e);return e.outcomes&&e.outcomes.length>0?[...e.outcomes]:n.outcomes&&n.outcomes.length>0?[...n.outcomes]:null}s(Dy,"nodeOutcomes");var Fz=["documentChangeRequested","documentReturned"];function FO(e){return Fz.includes(e)}s(FO,"isNonAdvancingExternalEvent");var Ks=["offer","contract"];function Df(e){return typeof e=="string"&&Ks.includes(e)}s(Df,"isArtifactSlotType");var LO="open",js="done";function Fy(e){let n={};for(let t of ze)n[t]=e(t);return n}s(Fy,"localized");var MO=[{key:"tenantSlug",type:"string"}];var Lz=/^(\d{4})-(\d{2})-(\d{2})$/;function Mz(e){return e>=1900&&e<=2100}s(Mz,"isSupportedYear");function qz(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(qz,"isRealDate");function Ly(e){if(typeof e!="string")return null;let n=Lz.exec(e);if(n===null)return null;let[,t,r,i]=n;return t===void 0||r===void 0||i===void 0||!Mz(Number(t))||!qz(Number(t),Number(r),Number(i))?null:{year:t,month:r,day:i}}s(Ly,"isoDateParts");var Kz="Europe/Berlin";function KO(){return Kz}s(KO,"tenantTimeZone");var qO=new Map;function jz(e){let n=qO.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{le("INVALID",{de:`Unbekannte Zeitzone "${e}".`,en:`Unknown time zone "${e}".`})}return qO.set(e,t),t}s(jz,"formatterFor");function Bz(e,n){let t=new Map(jz(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(Bz,"zoneOffsetAt");function My(e,n){let t=e+Bz(n,e);return{wallClock:new Date(t).toISOString().slice(0,19),timeZone:n}}s(My,"instantToLocalDateTime");var qy=3;function jO(e){return My(e,KO()).wallClock.slice(0,10)}s(jO,"localIsoDate");var Ff=["login","security","admission","tasks","deadlines","schoolMessages","staffTasks","staffAppointments","staffDeadlines","staffWaitlist","familyMessages","mentions"],BO=w.union(...Ff.map(e=>w.literal(e)));var rue=w.union(w.literal("admission"),w.literal("tasks"),w.literal("staff"),w.literal("chat")),Ky=["loginOnly","all"],iue=w.union(w.literal("loginOnly"),w.literal("all"));function UO(e){return typeof e=="string"&&Ky.includes(e)}s(UO,"isMailLevel");var Sl="subject";function VO(e){return e.category==="login"}s(VO,"isSignInLetter");var cn={key:"schoolName",label:"Name der Schule"},GO={de:"Zu Ihren Bewerbungen",en:"View your applications"},Sn={key:"portalLink",label:"Link zum Bewerberportal",required:!0,link:!0,actionLabel:GO},jy={key:Sn.key,label:Sn.label,link:!0,actionLabel:GO},zO={key:"authorName",label:"Name der schreibenden Person"},Bs={key:"applicationLink",label:"Link zur Bewerbung",required:!0,link:!0,actionLabel:{de:"Bewerbung \xF6ffnen",en:"Open application"}},Al={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"}},Vz={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"}},WO={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"}},El={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"15 Minuten",en:"15 minutes"}},YO={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"24 Stunden",en:"24 hours"}},Gz={key:"gueltigkeit",label:"G\xFCltigkeitsdauer des Links",previewValue:{de:"60 Minuten",en:"60 minutes"}};function Me(e){return{key:Sl,label:"Betreff",default:e}}s(Me,"subjectSlot");var Li=w.object({de:w.string(),en:w.string()}),On={tenantSlug:w.string(),applicationId:w.id("applications")},zz=w.object({tenantSlug:w.string()}),Wz={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:zz,channels:["email"],portalVisible:!0,placeholders:[cn,Sn],slots:[Me({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:
10532
10498
 
10533
10499
  {{portalLink}}`,en:`Thank you for registering with {{schoolName}}. You can view and continue your applications at any time using the link below:
@@ -11017,6 +10983,6 @@ ${t.length} unusable ${o}:
11017
10983
  `),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
11018
10984
  `),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>
11019
10985
  `)}else this.context.stdout.write(`No unusable identities.
11020
- `);return t.length>0?1:0}},EE=class extends lr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=p.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 Rj(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(Rj,"requireOnOff");var Ij=[lE,dE,cE,uE,fE,pE,mE,hE,gE,yE,Zc,wE,kE,bE,vE,xE,SE,AE,EE];function Oj(e){return e.de??e.en??Object.values(e)[0]??""}s(Oj,"titleDe");function w8(e){return{id:e._id,kind:e.kind,status:e.status,title:Oj(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(w8,"row");var k8=["id","kind","status","title","assignee","group","outcome"],RE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=p.Boolean("--mine",!1,{description:"Only items assigned to me."});application=p.String("--application",{description:"Filter by application id."});group=p.String("--group",{description:"Filter by team (permission-group) id."});assignee=p.String("--assignee",{description:"Filter by assignee users._id."});openOnly=p.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(w8),k8),0}},IE=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=p.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:Oj(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},OE=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=p.String("--title",{required:!0,description:"Task title."});description=p.String("--description",{description:"Task description."});application=p.String("--application",{description:"Link to an application id."});group=p.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=p.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}},PE=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=p.String({required:!0,name:"workItemId"});outcome=p.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}},_E=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=p.String({required:!0,name:"workItemId"});user=p.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}},Pj=[RE,IE,OE,PE,_E];var Xc=[...fR,...xN,...NN,...CC,...NC,...sD,...pD,...fD,...Tj,...Ij,...Ej,...yK,...sN,...tD,...mj,...cR,...FR,...G_,...gD,...hD,...kD,...bD,...eD,...KC,...Pj,...hM,...eq,...hK,...nq,...QK,...oj,...wK,...$K,...OK,...CK,...FK,...lj,...wj,...RR];for(let e of Xc){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:NT(e.usage.category,n.join(" "))})}var _j="0.1.103";function Nj(){return Xc.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=IT[so(t)];return{path:t,effect:ao(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(Nj,"plexusCommandCatalog");import Zo from"node:path";function b8(e){let n=ln()?.workspaceRoot??process.cwd(),t=Zo.resolve(n,e),r=Zo.relative(n,t);if(Zo.isAbsolute(e)||r===".."||r.startsWith(`..${Zo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(b8,"workspacePath");function v8(e){let{absolute:n,relative:t}=b8(e.path??".");if(e.operation==="list"){if(!Se(n))return{files:[]};let r=[],i=s(o=>{for(let a of $r(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Zo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Zo.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=ye(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 We(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 Cn(Zo.dirname(n),{recursive:!0}),We(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return ts(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(v8,"plexusWorkspace");function Cj(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=il[t];if(!o||!Object.hasOwn(il,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(_g,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:_g[i.path],skillHash:Wu}}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 v8(i)},"executePlexusAgentTool")}s(Cj,"createPlexusAgentToolExecutor");var yh=Cj({inspectCommand:Fj,executeCommand:Lj});function wh(){let e=new ss({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_j});e.register(ja.HelpCommand),e.register(ja.VersionCommand);for(let t of Xc)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 A8(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(wh,"createPlexusCli");function A8(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&za[t]===r&&an(n,t,r),t in za&&ao(t)==="confirm"&&!Wa(e)&&n.write(`plexus-cli: \`${za[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
10986
+ `);return t.length>0?1:0}},EE=class extends lr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=p.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 Rj(e,n){if(e===n)throw new Error("Pass exactly one of --on or --off.");return e}s(Rj,"requireOnOff");var Ij=[lE,dE,cE,uE,fE,pE,mE,hE,gE,yE,Zc,wE,kE,bE,vE,xE,SE,AE,EE];function Oj(e){return e.de??e.en??Object.values(e)[0]??""}s(Oj,"titleDe");function w8(e){return{id:e._id,kind:e.kind,status:e.status,title:Oj(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(w8,"row");var k8=["id","kind","status","title","assignee","group","outcome"],RE=class extends D{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=p.Boolean("--mine",!1,{description:"Only items assigned to me."});application=p.String("--application",{description:"Filter by application id."});group=p.String("--group",{description:"Filter by team (permission-group) id."});assignee=p.String("--assignee",{description:"Filter by assignee users._id."});openOnly=p.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(w8),k8),0}},IE=class extends D{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=p.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:Oj(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},OE=class extends D{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=p.String("--title",{required:!0,description:"Task title."});description=p.String("--description",{description:"Task description."});application=p.String("--application",{description:"Link to an application id."});group=p.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=p.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}},PE=class extends D{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=p.String({required:!0,name:"workItemId"});outcome=p.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}},_E=class extends D{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=p.String({required:!0,name:"workItemId"});user=p.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}},Pj=[RE,IE,OE,PE,_E];var Xc=[...fR,...xN,...NN,...CC,...NC,...sD,...pD,...fD,...Tj,...Ij,...Ej,...yK,...sN,...tD,...mj,...cR,...FR,...G_,...gD,...hD,...kD,...bD,...eD,...KC,...Pj,...hM,...eq,...hK,...nq,...QK,...oj,...wK,...$K,...OK,...CK,...FK,...lj,...wj,...RR];for(let e of Xc){let n=e.paths?.[0];n===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:NT(e.usage.category,n.join(" "))})}var _j="0.1.104";function Nj(){return Xc.flatMap(e=>(e.paths??[]).map(n=>{let t=n.join(" "),r=IT[so(t)];return{path:t,effect:ao(t),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,n)=>e.path.localeCompare(n.path))}s(Nj,"plexusCommandCatalog");import Zo from"node:path";function b8(e){let n=ln()?.workspaceRoot??process.cwd(),t=Zo.resolve(n,e),r=Zo.relative(n,t);if(Zo.isAbsolute(e)||r===".."||r.startsWith(`..${Zo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:t,relative:r}}s(b8,"workspacePath");function v8(e){let{absolute:n,relative:t}=b8(e.path??".");if(e.operation==="list"){if(!Se(n))return{files:[]};let r=[],i=s(o=>{for(let a of $r(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Zo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Zo.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=ye(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 We(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 Cn(Zo.dirname(n),{recursive:!0}),We(n,e.content,"utf8"),{path:t,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return ts(n),{path:t,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(v8,"plexusWorkspace");function Cj(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=il[t];if(!o||!Object.hasOwn(il,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(_g,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:_g[i.path],skillHash:Wu}}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 v8(i)},"executePlexusAgentTool")}s(Cj,"createPlexusAgentToolExecutor");var yh=Cj({inspectCommand:Fj,executeCommand:Lj});function wh(){let e=new ss({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:_j});e.register(ja.HelpCommand),e.register(ja.VersionCommand);for(let t of Xc)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 A8(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(wh,"createPlexusCli");function A8(e,n){let t=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&t!==r&&za[t]===r&&an(n,t,r),t in za&&ao(t)==="confirm"&&!Wa(e)&&n.write(`plexus-cli: \`${za[t]}\` only prints its plan without --confirm \u2014 nothing was changed.
11021
10987
  `)}s(A8,"noteRetiredPath");function Fj(e){let n=wh().process(_a(e),{executePlexusAgentTool:yh}),t=n.path.join(" ");if(t.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=Nj().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"?Dp(da(ca),i.fn??"",i.kind):void 0,a=Cu(t,{confirm:Wa(n),callKind:o});return{...r,writes:a}}s(Fj,"inspectPlexusCommand");async function Lj(e,n){if(n)return DE(n,()=>Lj(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=wh();if(ln()){let l=Fj(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(_a(e.argv),{executePlexusAgentTool:yh,stdin:S8.from(e.stdin===void 0?[]:[e.stdin]),stdout:new Dj({write(l,d,c){t+=String(l),c()}}),stderr:new Dj({write(l,d,c){r+=String(l),c()}})}),stdout:t,stderr:r}}s(Lj,"executePlexusCommand");KE({source:E8.join(import.meta.dirname,"skill")});wh().runExit(_a(process.argv.slice(2)),{executePlexusAgentTool:yh});
11022
10988
  //# sourceMappingURL=cli.mjs.map
@@ -1 +1 @@
1
- c2a99afef6979675b1cb1bca32bdc1ff677ee408170422805d8f52c39920f200
1
+ bda6982878b49deaaec6ef0f54e7566ab20fd511227adea4fec452b0124d5f65
@@ -185,7 +185,6 @@ whole is the operator's (ask them; do not try).
185
185
  | [feedback/manage-feedback-tags.md](references/feedback/manage-feedback-tags.md) | Plattform | Maintain the feedback tag catalogue and tag many items at once. |
186
186
  | [feedback/work-a-feedback-item.md](references/feedback/work-a-feedback-item.md) | Plattform | Reply to a feedback item, set its status and deadline, link items, move it to another tenant, sync GitHub state. |
187
187
  | [finance/change-contract-grant.md](references/finance/change-contract-grant.md) | Mandant | Change a running contract's grants or reductions from a month on. |
188
- | [finance/record-submission-date.md](references/finance/record-submission-date.md) | Mandant | Record a missing historic submission date of a SEPA direct debit. |
189
188
  | [leads/list-leads.md](references/leads/list-leads.md) | Mandant | List a tenant's prospects. |
190
189
  | [learning-groups/import-classes-from-csv.md](references/learning-groups/import-classes-from-csv.md) | Mandant | Import a school's classes from a class list (CSV + mapping file) as learning groups of a school year. |
191
190
  | [marketing/demo-video-links.md](references/marketing/demo-video-links.md) | Plattform | Create personalised demo video links per recipient and read who watched what. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartkomm/plexus-cli",
3
- "version": "0.1.103",
3
+ "version": "0.1.104",
4
4
  "description": "Unified Plexus admin + admission-offer config CLI (Convex backend).",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -1,33 +0,0 @@
1
- # Record a missing historical SEPA submission date
2
-
3
- **When to use:** The dashboard reports a legacy debit batch without a recorded
4
- submission date. Use the original transmission receipt, not the execution date.
5
-
6
- ## Prerequisites
7
-
8
- - Tenant-wide finance permission and the original bank transmission evidence.
9
- - Inspect the target environment before writing. Staging/prod changes require
10
- the operator's explicit approval; this recipe is not authorization.
11
-
12
- ## Steps
13
-
14
- ```sh
15
- plexus-cli --env local --tenant test config show
16
- plexus-cli --env local --tenant test call paymentBatches:recordSubmissionDate --kind mutation client=test batchId=<batch-id> submittedDate=2026-08-31
17
- ```
18
-
19
- Use the actual receipt's date and intended tenant/environment. Ordinary new
20
- submissions already record this date and need no repair.
21
-
22
- ## Verify
23
-
24
- ```sh
25
- plexus-cli --env local --tenant test call financeDashboard:overview client=test
26
- ```
27
-
28
- The return count and denominator appear in the original submission month.
29
-
30
- ## Idempotency / gotchas
31
-
32
- An identical date can be replayed. A conflicting date, another tenant's batch,
33
- a draft batch or a date after execution is refused. Nothing books money.