@zh-xx/antu 0.15.0 → 0.16.0

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/bin/antu-mcp.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // Antu 0.15.0
2
+ // Antu 0.16.0
3
3
  // Copyright (C) 2026 Ji Cheng
4
4
  //
5
5
  // Antu is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public
@@ -13,9 +13,9 @@
13
13
  // publish them, or sell them on any terms you like. This licence covers Antu's code in the page, and the notices in
14
14
  // the page must stay with it.
15
15
  //
16
- // Corresponding Source of this version: https://github.com/zh-xx/Antu/tree/v0.15.0
17
- // The licence: https://github.com/zh-xx/Antu/blob/v0.15.0/LICENSE
18
- // Third-party notices: https://github.com/zh-xx/Antu/blob/v0.15.0/skills/antu/THIRD-PARTY-NOTICES.md
16
+ // Corresponding Source of this version: https://github.com/zh-xx/Antu/tree/v0.16.0
17
+ // The licence: https://github.com/zh-xx/Antu/blob/v0.16.0/LICENSE
18
+ // Third-party notices: https://github.com/zh-xx/Antu/blob/v0.16.0/skills/antu/THIRD-PARTY-NOTICES.md
19
19
  //
20
20
  // === The licence of Antu ===
21
21
  //
@@ -1423,7 +1423,7 @@
1423
1423
  // SOFTWARE.
1424
1424
  // ````
1425
1425
  //
1426
- import e from"node:process";import{existsSync as t,mkdirSync as n,mkdtempSync as r,readFileSync as i,readdirSync as a,rmSync as o,statSync as s,writeFileSync as c}from"node:fs";import{tmpdir as l}from"node:os";import{dirname as u,join as d,resolve as f}from"node:path";import{execFileSync as p,spawn as m}from"node:child_process";import{fileURLToPath as h,pathToFileURL as g}from"node:url";var _=Object.create,v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,x=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty,C=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},w=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),T=(e,t)=>{let n={};for(var r in e)v(n,r,{get:e[r],enumerable:!0});return t||v(n,Symbol.toStringTag,{value:`Module`}),n},ee=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=b(t),a=0,o=i.length,s;a<o;a++)s=i[a],!S.call(e,s)&&s!==n&&v(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=y(t,s))||r.enumerable});return e},te=(e,t,n)=>(n=e==null?{}:_(x(e)),ee(t||!e||!e.__esModule||!S.call(e,`default`)?v(n,`default`,{value:e,enumerable:!0}):n,e)),ne=e=>S.call(e,`module.exports`)?e[`module.exports`]:ee(v({},`__esModule`,{value:!0}),e),re={"common.none":`(none)`,"common.close":`Close`,"common.untitled":`Antu`,"fallback.invalidTitle":({n:e})=>`This data cannot be rendered (${e} problem${e===1?``:`s`})`,"fallback.noRendererTitle":({type:e})=>`No renderer registered for type = "${e}"`,"fallback.registered":({list:e})=>`Registered: ${e}`,"fallback.noInlineData":`No inline data found in this file. Something went wrong when it was generated; please regenerate the HTML.`,"fallback.devNoData":`The dev server received no data. Specify one with ?example=0 or ?spec=examples/some-file.json.`,"error.renderTitle":`Rendering failed`,"error.renderHint":`The data itself may be fine (validation passed); this rendering kind threw an error. Send the text below to the developer, or try another rendering kind.`,"info.span":({from:e,to:t})=>`${e} to ${t}`,"info.slots":({n:e})=>`${e} time slot${e===1?``:`s`}`,"info.actors":({n:e})=>`${e} part${e===1?`y`:`ies`}`,"info.sources":({n:e})=>`${e} source${e===1?``:`s`}`,"info.nodes":({n:e})=>`${e} node${e===1?``:`s`}`,"info.stages":({n:e})=>`${e} stage${e===1?``:`s`}`,"dock.actors":`Parties`,"dock.summary":`Summary`,"dock.sources":`Sources`,"dock.orientation":`Which way the levels run: vertical, top to bottom; horizontal, left to right.`,"dock.orientationCamps":`Which way the levels run: vertical, top to bottom; horizontal, left to right. With the camps boxed they stand across that way: side by side when vertical, one under the other when horizontal, so the picture can look the other way round.`,"dock.vertical":`Vertical`,"dock.horizontal":`Horizontal`,"dock.grid":`Grid`,"dock.stagger":`Stagger`,"dock.byParty":`Lane per party`,"dock.staggerHint":`Let cards in different columns overlap by half a row, so the diagram is shorter and its text larger`,"dock.exportImage":`Export image`,"dock.exporting":`Exporting…`,"dock.exportTitle":`Export the whole diagram as a PNG (2× resolution)`,"dock.lang":`Language`,"dock.fold":`Fold`,"dock.display":`Display`,"export.failed":({message:e})=>`Export failed: ${e}`,"dock.langEn":`EN`,"dock.langZh":`中文`,"card.sources":({n:e})=>`${e} source${e===1?``:`s`}`,"card.sourcesUnlisted":`No sources listed`,"card.sourcesList":({n:e,names:t})=>`${e} source${e===1?``:`s`}: ${t}`,"card.duration":({duration:e})=>`Duration ${e}`,"card.approxPrefix":`approx. `,"card.dateUnknown":`date unknown`,"card.unitDay":({n:e})=>`${e} day${e===1?``:`s`}`,"card.unitHour":({n:e})=>`${e} hour${e===1?``:`s`}`,"card.unitMinute":({n:e})=>`${e} min`,"card.unitSecond":({n:e})=>`${e} sec`,"card.ariaLabel":({label:e,date:t})=>t?`${e}, ${t}`:e,"card.dateNote":({note:e})=>`Time note: ${e}`,"card.previewHint":`Click a card to read the full text`,"flow.conditions":`Conditions`,"flow.detail":`Detail`,"flow.mainLine":`Main line`,"flow.states":`States`,"flow.stages":`Stages`,"flow.rules":`Rules`,"flow.linkStraight":`Straight`,"flow.linkCurved":`Curved`,"flow.linkStyle":`Link style`,"rule.tableTitle":`Rules`,"rule.tableNote":`What may happen along the way; not steps of the flow`,"rule.tableNoteContract":`What may happen while the contract runs; not steps of the flow`,"rule.colWhen":`If`,"rule.colThen":`Then`,"rule.colScope":`Stages`,"rule.groupEnd":({end:e})=>`May lead to “${e}”`,"rule.groupRest":`Other rules`,"rule.count":({n:e})=>`${e}`,"rule.anyOf":`Any of:`,"rule.tScopeAll":`Throughout`,"rule.tScopeRange":({from:e,to:t})=>`${e} → ${t}`,"flow.ruleBadge":({n:e})=>e===1?`1 rule`:`${e} rules`,"flow.noteTag":`Note`,"rule.if":`If`,"rule.or":`, or `,"flow.previewHint":`Click a node to read the full text`,"aria.nodeDefault":`Press enter or space to select this node.`,"aria.nodeKeyboardDisabled":`Press enter or space to select this node. Once selected, use the arrow keys to move it.`,"aria.nodeMoved":({x:e,y:t})=>`Node moved. New position: x ${e}, y ${t}`,"aria.edgeDefault":`Press enter or space to select this connection.`,"aria.controls":`Canvas controls`,"aria.zoomIn":`Zoom in`,"aria.zoomOut":`Zoom out`,"aria.fitView":`Fit view`,"aria.interactive":`Toggle interactivity`,"aria.minimap":`Minimap`,"aria.handle":`Connection point`,"sourceType.statute":`Statute`,"sourceType.case":`Case`,"sourceType.contract":`Contract`,"sourceType.evidence":`Evidence`,"sourceType.document":`Document`,"sourceType.web":`Web`,"sourceType.other":`Other`,"graphKind.timeline":`Timeline`,"graphKind.flow":`Flowchart`,"header.theme":`Theme`,"theme.document":`Document`,"theme.modern":`Modern`,"theme.legal":`Legal blue`,"header.kindOpen":({n:e})=>`All ${e} ways of drawing`,"header.kindPrev":`Previous way of drawing`,"header.kindNext":`Next way of drawing`,"header.kindGroup":`Way of drawing`,"header.fold":`Fold the card`,"header.unfold":`Show the card`,"graphKind.chronicle":`Chronicle`,"graphKind.scale":`Time scale`,"scale.segment":({n:e,unit:t,count:n})=>`Segment ${e} · ${t} · ${n} event${n===1?``:`s`}`,"scale.unit.year":`by year`,"scale.unit.month":`by month`,"scale.unit.day":`by day`,"scale.unit.hour":`by hour`,"scale.unit.minute":`by minute`,"scale.other":`Other`,"scale.events":`Events`,"scale.undated":`date unknown · placed by order`,"scale.coarse.day":`that day (time unknown)`,"scale.coarse.month":`that month (day unknown)`,"scale.coarse.year":`that year (month unknown)`,"scale.run":({n:e})=>`${e} events`,"scale.runListed":({n:e})=>`${e} events too close to show one by one:`,"chronicle.gapSeconds":({n:e})=>`+${e} s`,"chronicle.gapMinutes":({n:e})=>`+${e} min`,"chronicle.gapHours":({n:e})=>`+${e} h`,"chronicle.gapHoursMinutes":({h:e,m:t})=>`+${e} h ${t} min`,"chronicle.gapDays":({n:e})=>`${e} day${e===1?``:`s`} later`,"chronicle.gapMonths":({n:e})=>`${e} month${e===1?``:`s`} later`,"chronicle.gapYears":({n:e})=>`${e} year${e===1?``:`s`} later`,"chronicle.gapYearsMonths":({y:e,m:t})=>`${e} yr ${t} mo later`,"chronicle.dateUnknown":`Date unknown`,"graphType.fact":`Fact`,"graphType.relationship":`Relationship`,"graphType.procedure":`Procedure`,"graphType.justification":`Justification`,"err.notObject":({at:e})=>`${e}: must be an object`,"err.notArray":({at:e})=>`${e} must be an array`,"err.required":({at:e,field:t})=>`${e}: missing required field \`${t}\``,"err.mustBeString":({at:e,field:t})=>`${e}: \`${t}\` must be a string`,"err.duplicateId":({at:e,id:t})=>`${e}: duplicate id "${t}"`,"err.missingRef":({at:e,field:t,kind:n,id:r})=>`${e}: ${t} refers to a non-existent ${n} "${r}"`,"err.tooManyGroups":({at:e,max:t,actual:n})=>`${e}: at most ${t} groups (the axis has two sides plus the centre), got ${n}`,"err.slotsEmpty":"`slots` must not be empty","err.slotEventsEmpty":({at:e})=>`${e}.events must not be empty (an empty time slot carries no meaning)`,"err.slotEventEmptyShape":({at:e})=>`${e}: must be an object of the form { events: [ … ] }`,"err.oneEventPerCell":({at:e,a:t,b:n})=>`${e}: two events share the same lane in one time slot ("${t}" and "${n}"); one cell holds one event`,"err.badDate":({at:e,field:t,value:n})=>`${e}: \`${t}\` is not ISO 8601 (e.g. 2017-05-02T09:24:03), got "${n}"`,"err.dateEndNeedsDate":({at:e})=>`${e}: \`dateEnd\` is written but \`date\` is not; a span needs its start`,"err.dateEndBeforeDate":({at:e,end:t,start:n})=>`${e}: \`dateEnd\` (${t}) is earlier than \`date\` (${n}); a span cannot run backwards`,"err.summaryTooLong":({at:e,max:t,actual:n})=>`${e}: \`summary\` is too wide for one line (about ${n} full-width characters, limit ${t}); shorten it or move the text to detail`,"err.groupNeedsOneActor":({at:e,groupId:t,n})=>`${e}: a side group ("${t}") must name exactly one party (currently ${n}); events that involve no particular party belong in the centre group or should omit groupId`,"err.multiActorNeedsAxis":({at:e,n:t,groupId:n})=>`${e}: an event with ${t} parties belongs on the centre axis, but groupId points at a side group ("${n}"); the two contradict each other`,"err.viewsRemoved":"`views` is no longer part of the format (placement rules v1): delete it. A diagram has one placement: with 2 or more parties, write `groupId` on each party (its side); with 1 party, on the events","err.actorNeedsGroup":({at:e,n:t})=>`${e}: the diagram has ${t} parties, so each party says which side it is on: write \`groupId\` with the 1st or the 2nd of \`groups\` (add \`groups\` if there are none)`,"err.actorGroupNotSide":({at:e,groupId:t})=>`${e}: \`groupId\` "${t}" is the 3rd group, the axis; a party belongs to the 1st or the 2nd group (a side)`,"err.actorGroupOneParty":({at:e})=>`${e}: a party carries \`groupId\` only when the diagram has 2 or more parties; with one party the groups split the events, so write \`groupId\` on the events`,"err.eventGroupWithParties":({at:e})=>`${e}: the diagram has 2 or more parties, so the groups belong to the parties and an event is placed by its \`actorIds\`: delete the event's \`groupId\` (one party → that party's side; several or none → the axis)`,"err.specNotObject":`a spec must be a JSON object`,"err.envelopeTypeRequired":"missing required field `type` (the engine uses it to pick a renderer)","err.envelopeTypeString":"`type` must be a string","err.envelopeTypeUnknown":'`type` is "{type}", which is not a diagram type; expected one of {list}',"err.envelopeTypeIsKind":'`type` is "{type}", which is a way of drawing a {owner} diagram, not a type: write `"type": "{owner}"` (the way it is drawn is chosen on the page, not in the JSON)',"err.envelopeTitleString":"`title` must be a string","err.specVersionForm":"`specVersion` must be a whole number from 1 up, got {value}","err.specVersionNewer":'`specVersion` is {value}, newer than this engine knows for "{type}" ({known}): update the engine, or write the file for the older format',"err.slotNotArray":"`slots` must be an array (one slot = one time point)","err.slotShape":({at:e})=>`${e}: must be an object of the form { events: [ … ] }`,"err.eventsNotArray":({at:e})=>`${e}.events must be an array`,"rerr.entitiesEmpty":"`entities` must not be empty (a diagram needs at least two parties)","rerr.relationsEmpty":"`relations` must not be empty (the parties have to be related)","rerr.notArray":({field:e})=>`\`${e}\` must be an array`,"rerr.notObject":({at:e})=>`${e}: must be an object`,"rerr.required":({at:e,field:t})=>`${e}: missing required field \`${t}\``,"rerr.duplicateId":({at:e,id:t,what:n})=>`${e}: id "${t}" duplicates an earlier ${n}`,"rerr.badEntityKind":({at:e,value:t,allowed:n})=>`${e}: kind is "${t}", which is not one of: ${n}`,"rerr.badRelationKind":({at:e,value:t,allowed:n})=>`${e}: kind is "${t}", which is not one of: ${n}`,"rerr.badSourceType":({at:e,value:t,allowed:n})=>`${e}: \`type\` "${t}" is not one of ${n}`,"rerr.mustBeString":({at:e,field:t})=>`${e}: \`${t}\` must be a non-empty string`,"rerr.mustBeBoolean":({at:e,field:t})=>`${e}: \`${t}\` must be true or false`,"rerr.badRef":({at:e,field:t,kind:n,id:r})=>`${e}: \`${t}\` refers to a non-existent ${n} "${r}"`,"rerr.badEnd":({at:e,end:t,id:n})=>`${e}: \`${t}\` refers to a non-existent entity "${n}"`,"rerr.selfRelation":({at:e,id:t})=>`${e}: an entity cannot be related to itself ("${t}" on both ends)`,"rerr.duplicateRelation":({at:e,from:t,to:n,kind:r})=>`${e}: duplicate relation ${t} -> ${n} (${r}, same label); give the second one its own label, or drop it`,"rerr.fieldNotHere":({at:e,field:t,kinds:n})=>`${e}: \`${t}\` only belongs on a relation of kind ${n}`,"rerr.badShare":({at:e,value:t})=>`${e}: \`share\` must be a number from 0 to 100, got ${t}`,"rerr.badSecures":({at:e,id:t})=>`${e}: \`secures\` refers to a non-existent relation "${t}"`,"rerr.securesNotClaim":({at:e,id:t,kind:n,claims:r})=>`${e}: \`secures\` points at relation "${t}", which is a ${n}; a guarantee secures a claim (${r})`,"rerr.badAsOf":({value:e})=>`asOf: "${e}" is not an ISO date (YYYY, YYYY-MM or YYYY-MM-DD)`,"rhint.shareOver100":({id:e,label:t,total:n})=>`entities (${e}): the shares held in "${t}" add up to ${n}%, more than the whole; check the figures or the source`,"rhint.isolated":({id:e,label:t})=>`entities (${e}): "${t}" has no relation to anyone, so it will float beside the diagram; relate it or drop it`,"rhint.noSecures":({id:e})=>`relations (${e}): a guarantee that does not say which claim it secures; add \`secures\` with that relation's id`,"rhint.tooLarge":({n:e,limit:t})=>`${e} entities: past about ${t} the diagram gets hard to read on one screen; consider splitting it by group`,"rhint.tooManyRelations":({n:e,limit:t})=>`${e} relations: past about ${t} the graph can take several seconds to draw (each change of orientation or groups draws it again); consider splitting it by group, or use another way of drawing`,"rhint.equityCycle":({path:e})=>`shareholdings loop back (${e}); allowed, but check it is what the registry says`,"rel.kind.equity":`Equity`,"rel.kind.control":`Control`,"rel.kind.contract":`Contracts`,"rel.kind.debt":`Debts`,"rel.kind.guarantee":`Guarantees`,"rel.kind.kinship":`Family`,"rel.kind.employment":`Employment`,"rel.kind.agency":`Agency`,"rel.kind.other":`Other`,"rel.kindChipTitle":({n:e})=>e===1?`Show or hide this kind (1 relation)`:`Show or hide this kind (${e} relations)`,"rel.labels":`Labels`,"rel.groups":`Groups`,"rel.previewHint":`Click a party to read the full text`,"rel.auto.equity":({share:e})=>e===void 0?`Holds shares`:`Holds ${e}%`,"rel.auto.control":`Controls`,"rel.auto.contract":({amount:e})=>e?`Contract, ${e}`:`Contract`,"rel.auto.debt":({amount:e})=>e?`Claim, ${e}`:`Claim`,"rel.auto.guarantee":`Guarantee`,"rel.auto.kinship":`Family`,"rel.auto.employment":`Employment`,"rel.auto.agency":`Agency`,"rel.auto.other":`Related`,"info.entities":({n:e})=>`${e} part${e===1?`y`:`ies`}`,"info.relations":({n:e})=>`${e} relation${e===1?``:`s`}`,"info.links":({n:e})=>`${e} link${e===1?``:`s`}`,"jerr.nodesEmpty":"`nodes` must not be empty (a justification needs at least a conclusion and what supports it)","jerr.linksEmpty":"`links` must not be empty (the nodes have to support one another)","jerr.notArray":({field:e})=>`\`${e}\` must be an array`,"jerr.notObject":({at:e})=>`${e}: must be an object`,"jerr.required":({at:e,field:t})=>`${e}: missing required field \`${t}\``,"jerr.duplicateId":({at:e,id:t,what:n})=>`${e}: id "${t}" duplicates an earlier ${n}`,"jerr.mustBeString":({at:e,field:t})=>`${e}: \`${t}\` must be a non-empty string`,"jerr.badNodeKind":({at:e,value:t,allowed:n})=>`${e}: kind is "${t}", which is not one of: ${n}`,"jerr.badRef":({at:e,field:t,kind:n,id:r})=>`${e}: \`${t}\` refers to a non-existent ${n} "${r}"`,"jerr.badHolds":({at:e,value:t})=>`${e}: \`holds\` must be "yes" or "no", got "${t}"`,"jerr.holdsNotHere":({at:e,kind:t,kinds:n})=>`${e}: a ${t} does not hold or fail; \`holds\` only belongs on ${n}`,"jerr.badCombine":({at:e,value:t,allowed:n})=>`${e}: \`combine\` is "${t}", which is not one of: ${n}`,"jerr.combineNotHere":({at:e,kind:t,kinds:n})=>`${e}: a ${t} is not supported by other nodes; \`combine\` only belongs on ${n}`,"jerr.dateNotHere":({at:e,kind:t})=>`${e}: \`date\` only belongs on a fact, not on a ${t}`,"jerr.badDate":({at:e,value:t})=>`${e}: \`date\` "${t}" is not an ISO date (YYYY-MM-DD or YYYY-MM-DDTHH:MM)`,"jerr.badEnd":({at:e,end:t,id:n})=>`${e}: \`${t}\` refers to a non-existent node "${n}"`,"jerr.selfLink":({at:e,id:t})=>`${e}: a node cannot support itself ("${t}" on both ends)`,"jerr.badStance":({at:e,value:t,allowed:n})=>`${e}: stance is "${t}", which is not one of: ${n}`,"jerr.basisNotNorm":({at:e,kind:t})=>`${e}: stance "basis" can only start from a norm, not from a ${t}`,"jerr.duplicateLink":({at:e,stance:t})=>`${e}: duplicate link (same from, to and stance "${t}"); drop the second one`,"jerr.cycle":({path:e})=>`links form a cycle (${e}); a reasoning must not lead back to itself`,"jerr.leafHasInput":({at:e,kind:t})=>`${e}: a ${t} is a leaf; nothing may support it (an evidence layer is not part of v0)`,"jerr.noEnd":"no end conclusion: at least one `conclusion` must have no outgoing link (the conclusion the whole reasoning leads to)","jhint.severalEnds":({n:e,ids:t})=>`${e} conclusions end the diagram (${t}); is this one reasoning, or should it be split?`,"jhint.supportsNothing":({id:e,label:t})=>`nodes (${e}): "${t}" supports nothing; link it to what it supports, or drop it`,"jhint.factNoSource":({id:e,label:t})=>`nodes (${e}): the fact "${t}" has no source; where was it found?`,"jhint.normNoSource":({id:e,label:t})=>`nodes (${e}): the norm "${t}" has no source; which provision is it?`,"jhint.unsupported":({id:e,label:t})=>`nodes (${e}): nothing supports "${t}"; add a fact, an element or a norm that does (if it stands only because what argued against it was rejected, this note can be left as it is)`,"jhint.holdsOnRejected":({id:e,label:t})=>`nodes (${e}): "${t}" holds although everything that supports it is rejected; check the \`holds\` values`,"jhint.combineAlone":({id:e,label:t,combine:n})=>`nodes (${e}): "${t}" says \`combine: "${n}"\` but fewer than two links support it; there is nothing to combine`,"jhint.allNeedsAll":({id:e,label:t,other:n})=>`nodes (${e}): "${t}" needs all it rests on, but "${n}" is rejected; check the \`holds\` values`,"jhint.anyOneHolds":({id:e,label:t,other:n})=>`nodes (${e}): "${t}" is rejected although any one it rests on would do, and "${n}" holds; check the \`holds\` values`,"jhint.tooLarge":({n:e,limit:t})=>`${e} nodes: past about ${t} the tree gets hard to read on one screen; consider one diagram per issue`,"graphKind.graph":`Relationship graph`,"graphKind.focus":`Focus view`,"graphKind.matrix":`Relation matrix`,"graphKind.equity":`Equity tree`,"rel.matrix.ungrouped":`No camp`,"rel.equity.noShare":`not stated`,"rel.equity.cross":`cross-holding`,"rel.equity.noEquity":`No equity relations in this data`,"rel.equity.noEquityHint":`This view is built around shareholdings. For this case, switch to the relationship graph.`,"rel.equity.indirect":({n:e})=>`Held through others (${e})`,"rel.equity.notComputable":`cannot be worked out: a share on the way is not stated`,"rel.equity.moreRows":({n:e})=>`${e} more not listed`,"rel.equity.above":({n:e})=>`Above it (${e})`,"rel.company.label":`Company`,"rel.company.all":`All`,"rel.equity.sep":`, `,"rel.equity.colon":`: `,"graphKind.authority":`Control and employment`,"rel.authority.cycle":`cycle`,"rel.authority.none":`No control, employment or agency relations in this data`,"rel.authority.noneHint":`This view is built around who commands whom. For this case, switch to the relationship graph.`,"rel.authority.above":({n:e})=>`Above it (${e})`,"graphKind.related":`Related parties`,"rel.related.title":({name:e})=>`Related parties of ${e} (the centre)`,"rel.related.count":({n:e,m:t})=>`${e} related part${e===1?`y`:`ies`}, ${t} relation${t===1?``:`s`}`,"rel.related.colParty":`Related party`,"rel.related.colKind":`Category`,"rel.related.colText":`Relation`,"rel.related.colSource":`Source`,"rel.related.dirNone":({a:e,b:t})=>`${e} — ${t} (no direction)`,"rel.related.none":({name:e})=>`${e} has no relation in this data`,"rel.related.noneHint":`Pick another party in the box at the bottom, or switch to the relationship graph.`,"rel.related.centre":`Centre`,"graphKind.path":`Relation path`,"rel.path.from":`From`,"rel.path.to":`To`,"rel.path.swap":`Swap the two ends`,"rel.path.noChain":({a:e,b:t})=>`No chain of relations ties ${e} and ${t}`,"rel.path.noChainHint":`Pick two parties that are connected, or switch to the relationship graph.`,"rel.path.steps":({n:e})=>`${e} step${e===1?``:`s`}`,"rel.path.chains":({n:e})=>`Chains drawn (${e})`,"rel.path.more":({n:e,atLeast:t})=>`${t?`At least `:``}${e} more chain${e===1?``:`s`} not drawn; only the shortest are.`,"graphKind.route":`Route map`,"proc.route.labels":`Conditions`,"proc.route.more":({n:e})=>`… and ${e} more`,"rel.focus.open":`Centre the focus view on this party`,"rel.focus.centre":`Centre`,"rel.focus.hint":`Click to put this party in the middle`,"rel.focus.apart":`Not connected to the centre`,"rel.focus.reset":`Default centre`,"rel.focus.resetTitle":`Put the party with the most relations back in the middle`,"graphKind.tree":`Reasoning tree`,"jus.kind.conclusion":`Conclusion`,"jus.kind.norm":`Norm`,"jus.kind.element":`Element`,"jus.kind.fact":`Fact`,"jus.kind.inference":`Inference`,"jus.kind.judgement":`Judgement`,"jus.holds.yes":`✓ upheld`,"jus.holds.no":`✗ rejected`,"jus.copy":`shown again`,"jus.copies":({n:e})=>`The same node is drawn in ${e} issues`,"jus.grounds":`Rests on`,"jus.fold":`Fold this issue up`,"jus.unfold":`Open this issue`,"jus.folded":({n:e})=>`${e} folded`,"jus.foldAll":`Fold issues`,"jus.merge":`Merge repeats`,"jus.mergeTitle":`A fact (or a norm with many elements) used several times in one issue is drawn beside each use; merge draws each once, with longer lines`,"jus.foldAllTitle":`Fold every issue up to its conclusion, or open them all again`,"jus.combine.all":`all of`,"jus.combine.any":`any of`,"jus.combine.allLong":`All of what it rests on is needed`,"jus.combine.anyLong":`Any one of what it rests on is enough`,"jus.supports":`Leads to`,"jus.stance.for":`supports`,"jus.stance.against":`opposes`,"jus.stance.basis":`basis`,"jus.previewHint":`Click a node to read the full text and see what it rests on`,"perr.domainNotInEnum":({value:e,allowed:t})=>`\`domain\` is "${e}", not in the enum (${t})`,"perr.nodesEmpty":"`nodes` must not be empty (a flow needs at least a start and an end)","perr.edgesEmpty":"`edges` must not be empty (the nodes have to be connected)","perr.notObject":({at:e})=>`${e}: must be an object`,"perr.required":({at:e,field:t})=>`${e}: missing required field \`${t}\``,"perr.duplicateNodeId":({at:e,id:t})=>`${e}: id "${t}" duplicates an earlier node`,"perr.badKind":({at:e,value:t,allowed:n})=>`${e}: \`kind\` is "${t}", not in the vocabulary (${n})`,"perr.badOutcome":({at:e,value:t,allowed:n})=>`${e}: \`outcome\` is "${t}", not in the enum (${n})`,"perr.mustBeString":({at:e,field:t})=>`${e}: \`${t}\` must be a string`,"perr.badRef":({at:e,field:t,kind:n,id:r})=>`${e}: ${t} refers to a non-existent ${n} "${r}"`,"perr.badFrom":({at:e,id:t})=>`${e}: \`from\` refers to a non-existent node "${t}"`,"perr.badTo":({at:e,id:t})=>`${e}: \`to\` refers to a non-existent node "${t}"`,"perr.selfLoop":({at:e,id:t})=>`${e}: self-loop (from and to are both "${t}")`,"perr.duplicateEdge":({at:e,from:t,to:n})=>`${e}: duplicate edge ${t} -> ${n} (same condition); branches into one target each need their own condition`,"perr.noEntry":`no node has zero incoming edges (a flow needs a start)`,"perr.unreachable":({id:e})=>`nodes (${e}): unreachable from the start (it would be dropped silently and never appear)`,"perr.orphan":({id:e,label:t})=>`nodes (${e}): "${t}" has no incoming edge and is not a start, so nothing leads to it: it would float beside the flow. If it is a consequence (a breach, a resignation, a right to terminate), write it as a rule in \`rules\`; if it belongs to the flow, add the edge that leads to it`,"note.partyNoEvent":({at:e,id:t,name:n})=>`${e} (${t}): no event names "${n}" in its actorIds, so it is on no card and has no column. Name it in the actorIds of the events it took part in, or leave it out of actors if it did nothing in this diagram`,"note.dateOrder":({at:e,id:t,date:n,beforeAt:r,beforeId:i,beforeDate:a})=>`${e} ("${t}", ${n}) comes after ${r} ("${i}", ${a}) in the slots but its date is wholly earlier. The order of the slots is kept and nothing is reordered; check which of the two dates is wrong, or whether the slots are in the wrong order`,"perr.noEnd":'no node has `kind: "end"` (a flow needs an end)',"perr.deadEnd":({id:e,label:t})=>`nodes (${e}): "${t}" is a dead end: it is neither end nor note but has no outgoing edge. If it is the consequence of a breach, delay or right to terminate, write it as a rule in \`rules\` (it may fire at any time in its stages) instead of a node that has to lead somewhere`,"perr.decisionTooFewOut":({id:e,n:t})=>`nodes (${e}): kind is "decision" but only ${t} outgoing edge(s); a decision needs at least 2`,"perr.decisionNoCondition":({id:e,index:t,to:n})=>`nodes (${e}): kind is "decision" but edge edges[${t}] -> "${n}" has no condition. If it really is a decision, give every outgoing edge a condition (e.g. "yes / no"); if it is a step, change kind to "step" (a step may have several outgoing edges, one of them the main line)`,"perr.tooManyMain":({id:e,n:t})=>`nodes (${e}): ${t} outgoing edges are marked main; a path has exactly one`,"perr.mainBroken":({id:e})=>`the main line breaks at node "${e}": the edges marked main do not reach any end. Either add the missing main edge, or repair the chain`,"norm.mainRemarked":({problem:e,from:t,to:n})=>`the main line was marked again, starting at "${t}" and ending at "${n}", keeping to the edges already marked where it could. It was: ${e}`,"norm.mainSet":({at:e})=>`${e}: marked main`,"norm.mainCleared":({at:e})=>`${e}: no longer marked main`,"perr.rulesNotArray":"`rules` must be an array","perr.duplicateRuleId":({at:e,id:t})=>`${e}: id "${t}" is already used by another rule or node`,"perr.ruleWhen":({at:e})=>`${e}: \`when\` is required: a non-empty string, or an array of them (any one of them triggers the rule)`,"perr.ruleEndNotEnd":({at:e,id:t})=>`${e}: \`endId\` points at "${t}", which is not a node of kind "end"; a rule can only lead to an end`,"phint.stageBackwards":({from:e,fromStage:t,to:n,toStage:r})=>`stage runs backwards: ${e} (${t}) -> ${n} (${r}); back edges are normal, others need a second look`,"phint.decisionOnSpine":({id:e,label:t})=>`decision "${e}" (${t}) is on the main line but no outgoing edge is marked main; the breach path may end up drawn as the main line`,"phint.longLabel":({id:e,n:t})=>`node "${e}" has a label of ${t} characters; a node shows about two lines (20 Chinese characters) and cuts the rest, the popover has it all. Shorten the label and move the detail into \`detail\``,"phint.noteNoDetail":({id:e,label:t})=>`note "${e}" (${t}) has no detail; a note is an explanation, so write it as one full sentence (in detail) that says what it explains`,"phint.multipleEntries":({n:e,ids:t})=>`${e} entries (${t}), they will all sit in the first layer; a contract flow usually has a single entry, so check whether an upstream link is missing`},ie={en:re,zh:{"common.none":`(无)`,"common.close":`关闭`,"common.untitled":`案图`,"fallback.invalidTitle":({n:e})=>`该数据未通过校验(${e} 处问题)`,"fallback.noRendererTitle":({type:e})=>`没有为 type = "${e}" 注册渲染器`,"fallback.registered":({list:e})=>`已注册:${e}`,"fallback.noInlineData":`这份文件里没有内联数据,生成时发生错误,请重新生成这份 HTML。`,"fallback.devNoData":`开发服务器未获取到数据:请用 ?example=0 或 ?spec=examples/某份.json 指定一份。`,"error.renderTitle":`渲染出错`,"error.renderHint":`数据本身可能没问题(校验已经通过),是这个画法在渲染时抛错了。请将下列信息提供给开发者,或改用其他画法。`,"info.span":({from:e,to:t})=>`${e} 至 ${t}`,"info.slots":({n:e})=>`${e} 个时间点`,"info.actors":({n:e})=>`${e} 个主体`,"info.sources":({n:e})=>`${e} 个来源`,"info.nodes":({n:e})=>`${e} 个节点`,"info.stages":({n:e})=>`${e} 个阶段`,"info.entities":({n:e})=>`${e} 个当事方`,"info.relations":({n:e})=>`${e} 条关系`,"info.links":({n:e})=>`${e} 条连线`,"dock.actors":`主体`,"dock.summary":`摘要`,"dock.sources":`来源`,"dock.orientation":`层的走向:竖向是从上往下,横向是从左往右。`,"dock.orientationCamps":`层的走向:竖向是从上往下,横向是从左往右。画了阵营框时,阵营沿垂直于层的方向排开:竖向时左右并排,横向时上下叠放,所以整张图看起来可能和按钮相反。`,"dock.vertical":`竖向`,"dock.horizontal":`横向`,"dock.grid":`格线`,"dock.stagger":`交错`,"dock.byParty":`按主体分泳道`,"dock.staggerHint":`让不同列的卡片上下错开半行,图更短、字更大`,"dock.exportImage":`导出图片`,"dock.exporting":`正在导出…`,"dock.exportTitle":`将整张图导出为 PNG(2 倍分辨率)`,"dock.lang":`语言`,"dock.fold":`收起`,"dock.display":`显示选项`,"export.failed":({message:e})=>`导出失败:${e}`,"dock.langEn":`EN`,"dock.langZh":`中文`,"flow.conditions":`条件`,"flow.detail":`详情`,"flow.mainLine":`主干`,"flow.states":`状态`,"flow.stages":`阶段`,"flow.rules":`条款`,"flow.linkStraight":`折线`,"flow.linkCurved":`曲线`,"flow.linkStyle":`连线样式`,"rule.tableTitle":`条款`,"rule.tableNote":`流程中可能出现的情形,不属于流程步骤`,"rule.tableNoteContract":`合同履行过程中可能出现的情形,不属于流程步骤`,"rule.colWhen":`情形`,"rule.colThen":`后果`,"rule.colScope":`适用阶段`,"rule.groupEnd":({end:e})=>`可导致「${e}」`,"rule.groupRest":`其他条款`,"rule.count":({n:e})=>`${e} 条`,"rule.anyOf":`下列任一:`,"rule.tScopeAll":`全程`,"rule.tScopeRange":({from:e,to:t})=>`${e} 至 ${t}`,"flow.ruleBadge":({n:e})=>`条款 ${e} 条`,"flow.noteTag":`注`,"rule.if":`若`,"rule.or":`,或`,"flow.previewHint":`点击节点查看全文`,"card.sources":({n:e})=>`来源 ${e} 个`,"card.sourcesUnlisted":`未列来源`,"card.sourcesList":({n:e,names:t})=>`来源 ${e} 个:${t}`,"card.duration":({duration:e})=>`持续 ${e}`,"card.approxPrefix":`约 `,"card.dateUnknown":`日期不详`,"card.unitDay":({n:e})=>`${e} 天`,"card.unitHour":({n:e})=>`${e} 小时`,"card.unitMinute":({n:e})=>`${e} 分`,"card.unitSecond":({n:e})=>`${e} 秒`,"card.ariaLabel":({label:e,date:t})=>t?`${e},${t}`:e,"card.dateNote":({note:e})=>`时间说明:${e}`,"card.previewHint":`点击卡片查看全文`,"aria.nodeDefault":`按回车或空格可选中此节点。`,"aria.nodeKeyboardDisabled":`按回车或空格可选中此节点。选中后可用方向键移动。`,"aria.nodeMoved":({x:e,y:t})=>`已移动节点。新位置:x ${e},y ${t}`,"aria.edgeDefault":`按回车或空格可选中此连线。`,"aria.controls":`画布控件`,"aria.zoomIn":`放大`,"aria.zoomOut":`缩小`,"aria.fitView":`适应视图`,"aria.interactive":`切换交互`,"aria.minimap":`缩略图`,"aria.handle":`连接点`,"sourceType.statute":`法条`,"sourceType.case":`判例`,"sourceType.contract":`合同`,"sourceType.evidence":`证据`,"sourceType.document":`文书`,"sourceType.web":`网页`,"sourceType.other":`其他`,"graphKind.timeline":`时间图`,"graphKind.flow":`流程图`,"header.theme":`主题`,"theme.document":`文书黑白`,"theme.modern":`现代简洁`,"theme.legal":`法律蓝`,"header.kindOpen":({n:e})=>`查看全部 ${e} 种画法`,"header.kindPrev":`上一种画法`,"header.kindNext":`下一种画法`,"header.kindGroup":`画法`,"header.fold":`收起标题卡`,"header.unfold":`展开标题卡`,"graphKind.chronicle":`大事记`,"graphKind.scale":`比例时间轴`,"scale.segment":({n:e,unit:t,count:n})=>`第 ${e} 段 · ${t} · ${n} 个事件`,"scale.unit.year":`按年`,"scale.unit.month":`按月`,"scale.unit.day":`按日`,"scale.unit.hour":`按小时`,"scale.unit.minute":`按分钟`,"scale.other":`其他`,"scale.events":`事件`,"scale.undated":`日期不详 · 按顺序放置`,"scale.coarse.day":`当日(时刻不详)`,"scale.coarse.month":`当月(日期不详)`,"scale.coarse.year":`当年(月份不详)`,"scale.run":({n:e})=>`${e} 个事件`,"scale.runListed":({n:e})=>`时间相近的 ${e} 个事件,列示如下:`,"chronicle.gapSeconds":({n:e})=>`+${e} 秒`,"chronicle.gapMinutes":({n:e})=>`+${e} 分钟`,"chronicle.gapHours":({n:e})=>`+${e} 小时`,"chronicle.gapHoursMinutes":({h:e,m:t})=>`+${e} 小时 ${t} 分`,"chronicle.gapDays":({n:e})=>`间隔 ${e} 天`,"chronicle.gapMonths":({n:e})=>`间隔 ${e} 个月`,"chronicle.gapYears":({n:e})=>`间隔 ${e} 年`,"chronicle.gapYearsMonths":({y:e,m:t})=>`间隔 ${e} 年 ${t} 个月`,"chronicle.dateUnknown":`日期不详`,"graphKind.graph":`关系图`,"graphKind.focus":`聚焦图`,"graphKind.matrix":`关系矩阵`,"graphKind.equity":`股权图`,"rel.matrix.ungrouped":`未归阵营`,"rel.equity.noShare":`比例未写明`,"rel.equity.cross":`交叉持股`,"rel.equity.noEquity":`这份数据里没有股权关系`,"rel.equity.noEquityHint":`这个视图围绕持股关系画。这类案件请切换到关系图。`,"rel.equity.indirect":({n:e})=>`间接持有(${e})`,"rel.equity.notComputable":`算不出:途中有一处持股比例没写明`,"rel.equity.moreRows":({n:e})=>`另有 ${e} 项未列出`,"rel.equity.above":({n:e})=>`在它上面的(${e})`,"rel.company.label":`公司`,"rel.company.all":`全部`,"rel.equity.sep":`、`,"rel.equity.colon":`:`,"graphKind.authority":`控制与任职图`,"rel.authority.cycle":`循环`,"rel.authority.none":`这份数据里没有控制、任职或代理关系`,"rel.authority.noneHint":`这个视图围绕谁管着谁画。这类案件请切换到关系图。`,"rel.authority.above":({n:e})=>`在它上面的(${e})`,"graphKind.related":`关联方清单`,"rel.related.title":({name:e})=>`关联方清单:${e}(中心方)`,"rel.related.count":({n:e,m:t})=>`共 ${e} 个关联方,${t} 条关系`,"rel.related.colParty":`关联方`,"rel.related.colKind":`关系类别`,"rel.related.colText":`关系内容`,"rel.related.colSource":`来源`,"rel.related.dirNone":({a:e,b:t})=>`${e} — ${t}(无方向)`,"rel.related.none":({name:e})=>`「${e}」在这份数据里没有任何关系`,"rel.related.noneHint":`在底部的框里换一方,或切换到关系图。`,"rel.related.centre":`中心方`,"graphKind.path":`关系路径图`,"rel.path.from":`起点`,"rel.path.to":`终点`,"rel.path.swap":`起点和终点对调`,"rel.path.noChain":({a:e,b:t})=>`没有任何关系链把「${e}」和「${t}」连起来`,"rel.path.noChainHint":`请选两个有关系相连的当事人,或切换到关系图。`,"rel.path.steps":({n:e})=>`${e} 步`,"rel.path.chains":({n:e})=>`画出的关系链(${e})`,"rel.path.more":({n:e,atLeast:t})=>`另有${t?`至少 `:` `}${e} 条关系链没有画;只画最短的几条。`,"graphKind.route":`路线图`,"proc.route.labels":`条件`,"proc.route.more":({n:e})=>`……还有 ${e} 步`,"rel.focus.open":`以这一方为中心看聚焦图`,"rel.focus.centre":`中心`,"rel.focus.hint":`点击,把这一方放到中间`,"rel.focus.apart":`与中心没有关系相连`,"rel.focus.reset":`默认中心`,"rel.focus.resetTitle":`把关系最多的那一方放回中间`,"graphKind.tree":`说理树`,"jus.kind.conclusion":`结论`,"jus.kind.norm":`规范`,"jus.kind.element":`要件`,"jus.kind.fact":`事实`,"jus.kind.inference":`推断`,"jus.kind.judgement":`评价`,"jus.holds.yes":`✓ 成立`,"jus.holds.no":`✗ 否定`,"jus.copy":`重复`,"jus.copies":({n:e})=>`同一节点出现在 ${e} 个争点中`,"jus.grounds":`依据`,"jus.fold":`收起这个争点`,"jus.unfold":`展开这个争点`,"jus.folded":({n:e})=>`已收起 ${e} 个`,"jus.foldAll":`收起争点`,"jus.merge":`合并重复`,"jus.mergeTitle":`同一争点里被多处用到的事实(或支持多个要件的规范)默认在每处使用点各列一份;合并后只列一份,连线会变长、更易交叉`,"jus.foldAllTitle":`把每个争点收起到只剩它的结论,或者全部展开`,"jus.combine.all":`且`,"jus.combine.any":`或`,"jus.combine.allLong":`它依据的须全部具备`,"jus.combine.anyLong":`它依据的具备任何一个即可`,"jus.supports":`指向`,"jus.stance.for":`支持`,"jus.stance.against":`反对`,"jus.stance.basis":`规范依据`,"jus.previewHint":`点击节点查看全文及其依据`,"graphType.fact":`事实图`,"graphType.relationship":`关系图`,"graphType.procedure":`程序图`,"graphType.justification":`证成图`,"rel.kind.equity":`股权`,"rel.kind.control":`控制`,"rel.kind.contract":`合同`,"rel.kind.debt":`债权债务`,"rel.kind.guarantee":`担保`,"rel.kind.kinship":`亲属`,"rel.kind.employment":`雇佣`,"rel.kind.agency":`代理`,"rel.kind.other":`其他`,"rel.kindChipTitle":({n:e})=>`显示或隐藏这一类(${e} 条关系)`,"rel.labels":`标签`,"rel.groups":`分组`,"rel.previewHint":`点击当事方查看全文`,"rel.auto.equity":({share:e})=>e===void 0?`持有股权`:`持股 ${e}%`,"rel.auto.control":`控制`,"rel.auto.contract":({amount:e})=>e?`合同,${e}`:`合同`,"rel.auto.debt":({amount:e})=>e?`债权,${e}`:`债权`,"rel.auto.guarantee":`担保`,"rel.auto.kinship":`亲属`,"rel.auto.employment":`雇佣`,"rel.auto.agency":`代理`,"rel.auto.other":`关联`,...Object.fromEntries(Object.keys(re).filter(e=>e.startsWith(`err.`)||e.startsWith(`perr.`)||e.startsWith(`phint.`)||e.startsWith(`note.`)||e.startsWith(`rerr.`)||e.startsWith(`rhint.`)||e.startsWith(`jerr.`)||e.startsWith(`jhint.`)||e.startsWith(`norm.`)).map(e=>[e,re[e]]))}};function ae(e){return!e||typeof e!=`string`?`en`:e.toLowerCase().split(`-`)[0]===`zh`?`zh`:`en`}function oe(e,t,n){let r=(ie[ae(e)]??ie.en)[t]??ie.en[t];return r===void 0?t:typeof r==`function`?r(n??{}):n?String(r).replace(/\{(\w+)\}/g,(e,t)=>n[t]??`{${t}}`):r}var se=(e,t)=>oe(`en`,e,t),ce;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(ce||={});var le;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(le||={});var ue=ce.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),de=e=>{switch(typeof e){case`undefined`:return ue.undefined;case`string`:return ue.string;case`number`:return Number.isNaN(e)?ue.nan:ue.number;case`boolean`:return ue.boolean;case`function`:return ue.function;case`bigint`:return ue.bigint;case`symbol`:return ue.symbol;case`object`:return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?ue.promise:typeof Map<`u`&&e instanceof Map?ue.map:typeof Set<`u`&&e instanceof Set?ue.set:typeof Date<`u`&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}},fe=ce.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),pe=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r],a=r===i.path.length-1;n===`_errors`?(a&&e._errors.push(t(i)),r++):(Object.prototype.hasOwnProperty.call(e,n)||(n===`__proto__`?Object.defineProperty(e,n,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):e[n]={_errors:[]}),e=e[n],a&&e._errors.push(t(i)),r++)}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};pe.create=e=>new pe(e);var me=(e,t)=>{let n;switch(e.code){case fe.invalid_type:n=e.received===ue.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case fe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ce.jsonStringifyReplacer)}`;break;case fe.unrecognized_keys:n=`Unrecognized key(s) in object: ${ce.joinValues(e.keys,`, `)}`;break;case fe.invalid_union:n=`Invalid input`;break;case fe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ce.joinValues(e.options)}`;break;case fe.invalid_enum_value:n=`Invalid enum value. Expected ${ce.joinValues(e.options)}, received '${e.received}'`;break;case fe.invalid_arguments:n=`Invalid function arguments`;break;case fe.invalid_return_type:n=`Invalid function return type`;break;case fe.invalid_date:n=`Invalid date`;break;case fe.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:ce.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case fe.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case fe.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case fe.custom:n=`Invalid input`;break;case fe.invalid_intersection_types:n=`Intersection results could not be merged`;break;case fe.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case fe.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,ce.assertNever(e)}return{message:n}},he=me;function ge(){return he}var _e=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function ve(e,t){let n=ge(),r=_e({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===me?void 0:me].filter(e=>!!e)});e.common.issues.push(r)}var ye=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return be;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return be;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},be=Object.freeze({status:`aborted`}),xe=e=>({status:`dirty`,value:e}),Se=e=>({status:`valid`,value:e}),Ce=e=>e.status===`aborted`,we=e=>e.status===`dirty`,Te=e=>e.status===`valid`,Ee=e=>typeof Promise<`u`&&e instanceof Promise,De;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(De||={});var Oe=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ke=(e,t)=>{if(Te(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new pe(e.common.issues);return this._error=t,this._error}}};function Ae(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var je=class{get description(){return this._def.description}_getType(e){return de(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:de(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ye,ctx:{common:e.parent.common,data:e.data,parsedType:de(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ee(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:de(e)};return ke(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:de(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Te(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Te(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:de(e)},r=this._parse({data:e,path:n.path,parent:n});return ke(n,await(Ee(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:fe.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new St({schema:this,typeName:jt.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return Ct.create(this,this._def)}nullable(){return wt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ot.create(this)}promise(){return xt.create(this,this._def)}or(e){return lt.create([this,e],this._def)}and(e){return ft.create(this,e,this._def)}transform(e){return new St({...Ae(this._def),schema:this,typeName:jt.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new Tt({...Ae(this._def),innerType:this,defaultValue:t,typeName:jt.ZodDefault})}brand(){return new Ot({typeName:jt.ZodBranded,type:this,...Ae(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Et({...Ae(this._def),innerType:this,catchValue:t,typeName:jt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return kt.create(this,e)}readonly(){return At.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Me=/^c[^\s-]{8,}$/i,Ne=/^[0-9a-z]+$/,Pe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Fe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ie=/^[a-z0-9_-]{21}$/i,Le=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Re=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ze=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Be=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,Ve,He=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ue=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,We=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,eee=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tee=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nee=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ge=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,ree=RegExp(`^${Ge}$`);function Ke(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function iee(e){return RegExp(`^${Ke(e)}$`)}function aee(e){let t=`${Ge}T${Ke(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function oee(e,t){return!((t!==`v4`&&t||!He.test(e))&&(t!==`v6`&&t||!We.test(e)))}function see(e,t){if(!Le.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function cee(e,t){return!((t!==`v4`&&t||!Ue.test(e))&&(t!==`v6`&&t||!eee.test(e)))}var qe=class e extends je{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ue.string){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.string,received:t.parsedType}),be}let t=new ye,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?ve(n,{code:fe.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&ve(n,{code:fe.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)ze.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`email`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)Ve||=new RegExp(Be,`u`),Ve.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`emoji`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)Fe.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`uuid`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)Ie.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`nanoid`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)Me.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`cuid`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)Ne.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`cuid2`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)Pe.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`ulid`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),ve(n,{validation:`url`,code:fe.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`regex`,code:fe.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?aee(r).test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?ree.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?iee(r).test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?Re.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`duration`,code:fe.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?oee(e.data,r.version)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`ip`,code:fe.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?see(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`jwt`,code:fe.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?cee(e.data,r.version)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`cidr`,code:fe.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?tee.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`base64`,code:fe.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?nee.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`base64url`,code:fe.invalid_string,message:r.message}),t.dirty()):ce.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:fe.invalid_string,...De.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...De.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...De.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...De.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...De.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...De.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...De.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...De.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...De.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...De.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...De.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...De.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...De.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...De.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...De.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...De.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...De.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...De.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...De.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...De.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...De.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...De.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...De.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...De.errToObj(t)})}nonempty(e){return this.min(1,De.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};qe.create=e=>new qe({checks:[],typeName:jt.ZodString,coerce:e?.coerce??!1,...Ae(e)});function Je(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Ye=class e extends je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ue.number){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.number,received:t.parsedType}),be}let t,n=new ye;for(let r of this._def.checks)r.kind===`int`?ce.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Je(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.not_finite,message:r.message}),n.dirty()):ce.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,De.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,De.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,De.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,De.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:De.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:De.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:De.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:De.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:De.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:De.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:De.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:De.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:De.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&ce.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Ye.create=e=>new Ye({checks:[],typeName:jt.ZodNumber,coerce:e?.coerce||!1,...Ae(e)});var Xe=class e extends je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ue.bigint)return this._getInvalidInput(e);let t,n=new ye;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):ce.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.bigint,received:t.parsedType}),be}gte(e,t){return this.setLimit(`min`,e,!0,De.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,De.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,De.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,De.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:De.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:De.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:De.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:De.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:De.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Xe.create=e=>new Xe({checks:[],typeName:jt.ZodBigInt,coerce:e?.coerce??!1,...Ae(e)});var Ze=class extends je{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ue.boolean){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.boolean,received:t.parsedType}),be}return Se(e.data)}};Ze.create=e=>new Ze({typeName:jt.ZodBoolean,coerce:e?.coerce||!1,...Ae(e)});var Qe=class e extends je{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ue.date){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.date,received:t.parsedType}),be}if(Number.isNaN(e.data.getTime()))return ve(this._getOrReturnCtx(e),{code:fe.invalid_date}),be;let t=new ye,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):ce.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:De.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:De.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Qe.create=e=>new Qe({checks:[],coerce:e?.coerce||!1,typeName:jt.ZodDate,...Ae(e)});var $e=class extends je{_parse(e){if(this._getType(e)!==ue.symbol){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.symbol,received:t.parsedType}),be}return Se(e.data)}};$e.create=e=>new $e({typeName:jt.ZodSymbol,...Ae(e)});var et=class extends je{_parse(e){if(this._getType(e)!==ue.undefined){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.undefined,received:t.parsedType}),be}return Se(e.data)}};et.create=e=>new et({typeName:jt.ZodUndefined,...Ae(e)});var tt=class extends je{_parse(e){if(this._getType(e)!==ue.null){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.null,received:t.parsedType}),be}return Se(e.data)}};tt.create=e=>new tt({typeName:jt.ZodNull,...Ae(e)});var nt=class extends je{constructor(){super(...arguments),this._any=!0}_parse(e){return Se(e.data)}};nt.create=e=>new nt({typeName:jt.ZodAny,...Ae(e)});var rt=class extends je{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Se(e.data)}};rt.create=e=>new rt({typeName:jt.ZodUnknown,...Ae(e)});var it=class extends je{_parse(e){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.never,received:t.parsedType}),be}};it.create=e=>new it({typeName:jt.ZodNever,...Ae(e)});var at=class extends je{_parse(e){if(this._getType(e)!==ue.undefined){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.void,received:t.parsedType}),be}return Se(e.data)}};at.create=e=>new at({typeName:jt.ZodVoid,...Ae(e)});var ot=class e extends je{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==ue.array)return ve(t,{code:fe.invalid_type,expected:ue.array,received:t.parsedType}),be;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(ve(t,{code:e?fe.too_big:fe.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(ve(t,{code:fe.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(ve(t,{code:fe.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Oe(t,e,t.path,n)))).then(e=>ye.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new Oe(t,e,t.path,n)));return ye.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:De.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:De.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:De.toString(n)}})}nonempty(e){return this.min(1,e)}};ot.create=(e,t)=>new ot({type:e,minLength:null,maxLength:null,exactLength:null,typeName:jt.ZodArray,...Ae(t)});function st(e){if(e instanceof ct){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Ct.create(st(r))}return new ct({...e._def,shape:()=>t})}return e instanceof ot?new ot({...e._def,type:st(e.element)}):e instanceof Ct?Ct.create(st(e.unwrap())):e instanceof wt?wt.create(st(e.unwrap())):e instanceof pt?pt.create(e.items.map(e=>st(e))):e}var ct=class e extends je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=ce.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ue.object){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.object,received:t.parsedType}),be}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof it&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new Oe(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof it){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(ve(n,{code:fe.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new Oe(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>ye.mergeObjectSync(t,e)):ye.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:De.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:jt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of ce.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of ce.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return st(this)}partial(t){let n={};for(let e of ce.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of ce.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Ct;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return vt(ce.objectKeys(this.shape))}};ct.create=(e,t)=>new ct({shape:()=>e,unknownKeys:`strip`,catchall:it.create(),typeName:jt.ZodObject,...Ae(t)}),ct.strictCreate=(e,t)=>new ct({shape:()=>e,unknownKeys:`strict`,catchall:it.create(),typeName:jt.ZodObject,...Ae(t)}),ct.lazycreate=(e,t)=>new ct({shape:e,unknownKeys:`strip`,catchall:it.create(),typeName:jt.ZodObject,...Ae(t)});var lt=class extends je{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new pe(e.ctx.common.issues));return ve(t,{code:fe.invalid_union,unionErrors:n}),be}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new pe(e));return ve(t,{code:fe.invalid_union,unionErrors:i}),be}}get options(){return this._def.options}};lt.create=(e,t)=>new lt({options:e,typeName:jt.ZodUnion,...Ae(t)});var ut=e=>e instanceof gt?ut(e.schema):e instanceof St?ut(e.innerType()):e instanceof _t?[e.value]:e instanceof yt?e.options:e instanceof bt?ce.objectValues(e.enum):e instanceof Tt?ut(e._def.innerType):e instanceof et?[void 0]:e instanceof tt?[null]:e instanceof Ct?[void 0,...ut(e.unwrap())]:e instanceof wt?[null,...ut(e.unwrap())]:e instanceof Ot||e instanceof At?ut(e.unwrap()):e instanceof Et?ut(e._def.innerType):[],lee=class e extends je{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.object)return ve(t,{code:fe.invalid_type,expected:ue.object,received:t.parsedType}),be;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ve(t,{code:fe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=ut(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:jt.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Ae(r)})}};function dt(e,t){let n=de(e),r=de(t);if(e===t)return{valid:!0,data:e};if(n===ue.object&&r===ue.object){let n=ce.objectKeys(t),r=ce.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=dt(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===ue.array&&r===ue.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=dt(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===ue.date&&r===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ft=class extends je{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Ce(e)||Ce(r))return be;let i=dt(e.value,r.value);return i.valid?((we(e)||we(r))&&t.dirty(),{status:t.value,value:i.data}):(ve(n,{code:fe.invalid_intersection_types}),be)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ft.create=(e,t,n)=>new ft({left:e,right:t,typeName:jt.ZodIntersection,...Ae(n)});var pt=class e extends je{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.array)return ve(n,{code:fe.invalid_type,expected:ue.array,received:n.parsedType}),be;if(n.data.length<this._def.items.length)return ve(n,{code:fe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),be;!this._def.rest&&n.data.length>this._def.items.length&&(ve(n,{code:fe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new Oe(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>ye.mergeArray(t,e)):ye.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};pt.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new pt({items:e,typeName:jt.ZodTuple,rest:null,...Ae(t)})};var uee=class e extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.object)return ve(n,{code:fe.invalid_type,expected:ue.object,received:n.parsedType}),be;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new Oe(n,e,n.path,e)),value:a._parse(new Oe(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?ye.mergeObjectAsync(t,r):ye.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof je?new e({keyType:t,valueType:n,typeName:jt.ZodRecord,...Ae(r)}):new e({keyType:qe.create(),valueType:t,typeName:jt.ZodRecord,...Ae(n)})}},mt=class extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.map)return ve(n,{code:fe.invalid_type,expected:ue.map,received:n.parsedType}),be;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Oe(n,e,n.path,[a,`key`])),value:i._parse(new Oe(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return be;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return be;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};mt.create=(e,t,n)=>new mt({valueType:t,keyType:e,typeName:jt.ZodMap,...Ae(n)});var ht=class e extends je{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.set)return ve(n,{code:fe.invalid_type,expected:ue.set,received:n.parsedType}),be;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(ve(n,{code:fe.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(ve(n,{code:fe.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return be;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new Oe(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:De.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:De.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ht.create=(e,t)=>new ht({valueType:e,minSize:null,maxSize:null,typeName:jt.ZodSet,...Ae(t)});var dee=class e extends je{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.function)return ve(t,{code:fe.invalid_type,expected:ue.function,received:t.parsedType}),be;function n(e,n){return _e({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ge(),me].filter(e=>!!e),issueData:{code:fe.invalid_arguments,argumentsError:n}})}function r(e,n){return _e({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ge(),me].filter(e=>!!e),issueData:{code:fe.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof xt){let e=this;return Se(async function(...t){let o=new pe([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return Se(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new pe([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new pe([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:pt.create(t).rest(rt.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||pt.create([]).rest(rt.create()),returns:n||rt.create(),typeName:jt.ZodFunction,...Ae(r)})}},gt=class extends je{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};gt.create=(e,t)=>new gt({getter:e,typeName:jt.ZodLazy,...Ae(t)});var _t=class extends je{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return ve(t,{received:t.data,code:fe.invalid_literal,expected:this._def.value}),be}return{status:`valid`,value:e.data}}get value(){return this._def.value}};_t.create=(e,t)=>new _t({value:e,typeName:jt.ZodLiteral,...Ae(t)});function vt(e,t){return new yt({values:e,typeName:jt.ZodEnum,...Ae(t)})}var yt=class e extends je{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return ve(t,{expected:ce.joinValues(n),received:t.parsedType,code:fe.invalid_type}),be}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return ve(t,{received:t.data,code:fe.invalid_enum_value,options:n}),be}return Se(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};yt.create=vt;var bt=class extends je{_parse(e){let t=ce.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ue.string&&n.parsedType!==ue.number){let e=ce.objectValues(t);return ve(n,{expected:ce.joinValues(e),received:n.parsedType,code:fe.invalid_type}),be}if(this._cache||=new Set(ce.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=ce.objectValues(t);return ve(n,{received:n.data,code:fe.invalid_enum_value,options:e}),be}return Se(e.data)}get enum(){return this._def.values}};bt.create=(e,t)=>new bt({values:e,typeName:jt.ZodNativeEnum,...Ae(t)});var xt=class extends je{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==ue.promise&&t.common.async===!1?(ve(t,{code:fe.invalid_type,expected:ue.promise,received:t.parsedType}),be):Se((t.parsedType===ue.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};xt.create=(e,t)=>new xt({type:e,typeName:jt.ZodPromise,...Ae(t)});var St=class extends je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===jt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{ve(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return be;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?be:r.status===`dirty`||t.value===`dirty`?xe(r.value):r});{if(t.value===`aborted`)return be;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?be:r.status===`dirty`||t.value===`dirty`?xe(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?be:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?be:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Te(e))return be;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Te(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):be)}ce.assertNever(r)}};St.create=(e,t,n)=>new St({schema:e,typeName:jt.ZodEffects,effect:t,...Ae(n)}),St.createWithPreprocess=(e,t,n)=>new St({schema:t,effect:{type:`preprocess`,transform:e},typeName:jt.ZodEffects,...Ae(n)});var Ct=class extends je{_parse(e){return this._getType(e)===ue.undefined?Se(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ct.create=(e,t)=>new Ct({innerType:e,typeName:jt.ZodOptional,...Ae(t)});var wt=class extends je{_parse(e){return this._getType(e)===ue.null?Se(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};wt.create=(e,t)=>new wt({innerType:e,typeName:jt.ZodNullable,...Ae(t)});var Tt=class extends je{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===ue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Tt.create=(e,t)=>new Tt({innerType:e,typeName:jt.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...Ae(t)});var Et=class extends je{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ee(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new pe(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new pe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Et.create=(e,t)=>new Et({innerType:e,typeName:jt.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...Ae(t)});var Dt=class extends je{_parse(e){if(this._getType(e)!==ue.nan){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.nan,received:t.parsedType}),be}return{status:`valid`,value:e.data}}};Dt.create=e=>new Dt({typeName:jt.ZodNaN,...Ae(e)});var Ot=class extends je{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},kt=class e extends je{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?be:e.status===`dirty`?(t.dirty(),xe(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?be:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:jt.ZodPipeline})}},At=class extends je{_parse(e){let t=this._def.innerType._parse(e),n=e=>(Te(e)&&(e.value=Object.freeze(e.value)),e);return Ee(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};At.create=(e,t)=>new At({innerType:e,typeName:jt.ZodReadonly,...Ae(t)}),ct.lazycreate;var jt;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(jt||={}),qe.create,Ye.create,Dt.create,Xe.create,Ze.create,Qe.create,$e.create,et.create,tt.create,nt.create,rt.create,it.create,at.create,ot.create;var fee=ct.create;ct.strictCreate,lt.create,lee.create,ft.create,pt.create,uee.create,mt.create,ht.create,dee.create,gt.create,_t.create,yt.create,bt.create,xt.create,St.create,Ct.create,wt.create,St.createWithPreprocess,kt.create;function Mt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Nt(e,t=`|`){return e.map(e=>Zt(e)).join(t)}function Pt(e,t){return typeof t==`bigint`?t.toString():t}var pee=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Ft(e){return new pee(e)}function mee(e){return e==null}function It(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function hee(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Lt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Rt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function zt(e){return Rt(e._zod.def)??e._zod.def.shape}function Bt(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Lt(this,t,e),e},enumerable:!0,configurable:!0})}function Vt(e,t,n){t in e?Lt(e,t,n):e[t]=n}function Ht(e,t,n,r){let i=zt(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Bt(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Vt(e,a,r?r(n.value,a):n.value))}}function gee(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Bt(e,n,()=>t[n]):Vt(e,n,r.value))}}function Ut(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function _ee(e){return JSON.stringify(e)}function vee(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Wt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Gt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var yee=Ft(()=>{if(Cn.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Kt(e){if(Gt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Gt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function qt(e){return Kt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var bee=new Set([`string`,`number`,`symbol`]);function Jt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Yt(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Xt(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Zt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function xee(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var See={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Cee={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function wee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Ht(i,e,Qt(e,t)),Yt(e,Ut(n,{shape:i,checks:[]}))}function Qt(e,t){let n=zt(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Tee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Qt(e,t)),a={};return Ht(a,e,Reflect.ownKeys(zt(e)).filter(e=>!i.has(e))),Yt(e,Ut(n,{shape:a,checks:[]}))}function Eee(e,t){if(!Kt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=zt(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Yt(e,Ut(e._zod.def,{shape:$t(e,t)}))}function $t(e,t){let n={};return Ht(n,e,Reflect.ownKeys(zt(e))),gee(n,t),n}function Dee(e,t){if(!Kt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Yt(e,Ut(e._zod.def,{shape:$t(e,t)}))}function Oee(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Ht(n,e,Reflect.ownKeys(zt(e))),Ht(n,t,Reflect.ownKeys(zt(t))),Yt(e,Ut(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function en(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Qt(t,n)):void 0,o={};return Ht(o,t,Reflect.ownKeys(zt(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Yt(t,Ut(t._zod.def,{shape:o,checks:[]}))}function kee(e,t,n){let r=n?new Set(Qt(t,n)):void 0,i={};return Ht(i,t,Reflect.ownKeys(zt(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Yt(t,Ut(t._zod.def,{shape:i}))}function tn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Aee(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function nn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function rn(e){return typeof e==`string`?e:e?.message}function an(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function on(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:rn(e.inst?._zod.def?.error?.(e))??rn(a?.(e))??rn(t?.error?.(e))??rn(n.customError?.(e))??rn(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var jee=/[\uD800-\uDBFF]/;function sn(e){let t=e.length;if(!jee.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function cn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Mee(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function ln(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Nee(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Pee(e,n,r.value)}}function un(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function dn(e,t,n){return un(e,t,n,!1)}function fn(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return un(this,n,r(this))},set(e){un(this,n,e)}})}return t}function Pee(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:un(this,t,n.bind(this))},set(e){un(this,t,e)}})}function Fee(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var pn,mn=!1,Iee={configurable:!0,get(){mn=!0}};function hn(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&pn!==e._zod?pn=void 0:(pn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Iee);let e=mn;mn=!1;try{let r=n(this);return mn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),mn||=e,r}catch(n){throw delete this[t],mn||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function gn(e,t,n,r){let i=Fee(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Lee=`~constantCatch`;function Ree(e){let t=()=>e;return t[Lee]=!0,t}var _n,vn={value:void 0,enumerable:!1},yn=`captureStackTrace`in Error?Error:null;function zee(e){let t=yn;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return yn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function bn(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){vn.value=new a(r);try{Object.defineProperty(n,"_zod",vn)}finally{vn.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Nee(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?zee(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var xn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Sn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(_n=globalThis).__zod_globalConfig??(_n.__zod_globalConfig={});var Cn=globalThis.__zod_globalConfig;function wn(e){return e&&Object.assign(Cn,e),Cn}function Bee(){let e=this._zod;return e.message??=JSON.stringify(e.def,Pt,2),e.message}function Vee(e){this._zod.message=e}var Hee={get:Bee,set:Vee,enumerable:!0,configurable:!0},Tn={value:void 0,enumerable:!1},En=new WeakSet([Object.prototype,Error.prototype]),Dn=(e,t)=>{e.name=`$ZodError`,Tn.value=t,Object.defineProperty(e,"issues",Tn),Tn.value=void 0,Object.defineProperty(e,"message",Hee);let n=Object.getPrototypeOf(e);En.has(n)||(En.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Uee=bn(`$ZodError`,Dn),On=bn(`$ZodError`,Dn,void 0,{Parent:Error});function Wee(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Gee(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Wee(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Kee(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function kn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var An=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new xn;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>on(e,o,wn())));throw Wt(n,a?.callee??t),n}return s.value};return t},qee=An(On),jn=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>on(e,o,wn())));throw Wt(n,a?.callee??t),n}return s.value};return t},Jee=jn(On),Mn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new xn;return a.issues.length?Pn(e,a.issues,i):{success:!0,data:a.value}},Nn=Mn(On);function Pn(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>on(e,n,wn()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Fn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Pn(e,a.issues,i):{success:!0,data:a.value}},In=Fn(On),Yee=Symbol.for(`zod.compile.invalid`),Xee=Symbol.for(`zod.compile.fallback`),Zee=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Yee)return!0;if(r.definite===!0&&n===void 0)return!1}return Qee(e,t,n)});function Qee(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Xee]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new xn;return a.issues.length===0}var $ee=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ete=e=>{let t=An(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,kn(n,a))};return n},tte=e=>{let t=An(e),n=(e,r,i,a)=>t(e,r,i,kn(n,a));return n},nte=e=>{let t=jn(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,kn(n,a))};return n},rte=e=>{let t=jn(e),n=async(e,r,i,a)=>await t(e,r,i,kn(n,a));return n},ite=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Mn(e)(t,n,i)},ate=e=>(t,n,r)=>Mn(e)(t,n,r),ote=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Fn(e)(t,n,i)},ste=e=>async(t,n,r)=>Fn(e)(t,n,r),cte=/^[cC][0-9a-z]{6,}$/,lte=/^[0-9a-z]+$/,ute=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,dte=/^[0-9a-vA-V]{20}$/,fte=/^[A-Za-z0-9]{27}$/,pte=/^[a-zA-Z0-9_-]{21}$/;function mte(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var hte=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,gte=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ln=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,_te=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vte=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function yte(){return new RegExp(vte,`u`)}var bte=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,xte=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ste=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Cte=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wte=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Tte=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ete=/^https?$/,Dte=/^\+[1-9]\d{6,14}$/,Rn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Ote(e){return RegExp(`^${e}$`)}var kte=Ote(Rn);function zn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ate(e){return RegExp(`^${zn(e)}$`)}function jte(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${zn({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${zn({precision:e.precision})}`:n;return RegExp(`^${Rn}T(?:${r})$`)}var Mte=/^[\s\S]{0,}$/,Nte=/^-?\d+$/,Bn=/^-?\d+(?:\.\d+)?$/,Pte=/^(?:true|false)$/i,Fte=/^null$/i,Ite=/^[^A-Z]*$/,Lte=/^[^a-z]*$/,Vn=bn(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Hn=e=>{let t=e.value;return!mee(t)&&t.length!==void 0},Un={number:`number`,bigint:`bigint`,object:`date`},Wn=bn(`$ZodCheckLessThan`,(e,t)=>{Vn.init(e,t);let n=Un[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Un[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Gn=bn(`$ZodCheckGreaterThan`,(e,t)=>{Vn.init(e,t);let n=Un[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Un[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Rte=bn(`$ZodCheckMultipleOf`,(e,t)=>{Vn.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):hee(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),zte=bn(`$ZodCheckNumberFormat`,(e,t)=>{Vn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=See[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Bte=bn(`$ZodCheckMaxLength`,(e,t)=>{var n;Vn.init(e,t),(n=e._zod.def).when??(n.when=Hn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?sn(r):i)<=t.maximum)return;let a=cn(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Vte=bn(`$ZodCheckMinLength`,(e,t)=>{var n;Vn.init(e,t),(n=e._zod.def).when??(n.when=Hn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?sn(r):i)>=t.minimum)return;let a=cn(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Hte=bn(`$ZodCheckLengthEquals`,(e,t)=>{var n;Vn.init(e,t),(n=e._zod.def).when??(n.when=Hn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?sn(r):i;if(a===t.length)return;let o=cn(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Kn=bn(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Vn.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ute=bn(`$ZodCheckRegex`,(e,t)=>{Kn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Wte=bn(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ite,Kn.init(e,t)}),Gte=bn(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Lte,Kn.init(e,t)}),Kte=bn(`$ZodCheckIncludes`,(e,t)=>{Vn.init(e,t);let n=Jt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),qte=bn(`$ZodCheckStartsWith`,(e,t)=>{Vn.init(e,t);let n=RegExp(`^${Jt(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Jte=bn(`$ZodCheckEndsWith`,(e,t)=>{Vn.init(e,t);let n=RegExp(`.*${Jt(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Yte=bn(`$ZodCheckOverwrite`,(e,t)=>{Vn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Xte=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
1426
+ import e from"node:process";import{existsSync as t,mkdirSync as n,mkdtempSync as r,readFileSync as i,readdirSync as a,rmSync as o,statSync as s,writeFileSync as c}from"node:fs";import{tmpdir as l}from"node:os";import{dirname as u,join as d,resolve as f}from"node:path";import{execFileSync as p,spawn as m}from"node:child_process";import{fileURLToPath as h,pathToFileURL as g}from"node:url";var _=Object.create,v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,x=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty,C=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},w=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),T=(e,t)=>{let n={};for(var r in e)v(n,r,{get:e[r],enumerable:!0});return t||v(n,Symbol.toStringTag,{value:`Module`}),n},ee=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=b(t),a=0,o=i.length,s;a<o;a++)s=i[a],!S.call(e,s)&&s!==n&&v(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=y(t,s))||r.enumerable});return e},te=(e,t,n)=>(n=e==null?{}:_(x(e)),ee(t||!e||!e.__esModule||!S.call(e,`default`)?v(n,`default`,{value:e,enumerable:!0}):n,e)),ne=e=>S.call(e,`module.exports`)?e[`module.exports`]:ee(v({},`__esModule`,{value:!0}),e),re={"common.none":`(none)`,"common.close":`Close`,"common.untitled":`Antu`,"fallback.invalidTitle":({n:e})=>`This data cannot be rendered (${e} problem${e===1?``:`s`})`,"fallback.noRendererTitle":({type:e})=>`No renderer registered for type = "${e}"`,"fallback.registered":({list:e})=>`Registered: ${e}`,"fallback.noInlineData":`No inline data found in this file. Something went wrong when it was generated; please regenerate the HTML.`,"fallback.devNoData":`The dev server received no data. Specify one with ?example=0 or ?spec=examples/some-file.json.`,"error.renderTitle":`Rendering failed`,"error.renderHint":`The data itself may be fine (validation passed); this rendering kind threw an error. Send the text below to the developer, or try another rendering kind.`,"info.span":({from:e,to:t})=>`${e} to ${t}`,"info.slots":({n:e})=>`${e} time slot${e===1?``:`s`}`,"info.actors":({n:e})=>`${e} part${e===1?`y`:`ies`}`,"info.sources":({n:e})=>`${e} source${e===1?``:`s`}`,"info.nodes":({n:e})=>`${e} node${e===1?``:`s`}`,"info.stages":({n:e})=>`${e} stage${e===1?``:`s`}`,"dock.actors":`Parties`,"dock.summary":`Summary`,"dock.sources":`Sources`,"dock.orientation":`Which way the levels run: vertical, top to bottom; horizontal, left to right.`,"dock.orientationCamps":`Which way the levels run: vertical, top to bottom; horizontal, left to right. With the camps boxed they stand across that way: side by side when vertical, one under the other when horizontal, so the picture can look the other way round.`,"dock.vertical":`Vertical`,"dock.horizontal":`Horizontal`,"dock.grid":`Grid`,"dock.stagger":`Stagger`,"dock.byParty":`Lane per party`,"dock.staggerHint":`Let cards in different columns overlap by half a row, so the diagram is shorter and its text larger`,"dock.exportImage":`Export image`,"dock.exporting":`Exporting…`,"dock.exportTitle":`Export the whole diagram as a PNG (2× resolution)`,"dock.lang":`Language`,"dock.fold":`Fold`,"dock.display":`Display`,"export.failed":({message:e})=>`Export failed: ${e}`,"dock.langEn":`EN`,"dock.langZh":`中文`,"card.sources":({n:e})=>`${e} source${e===1?``:`s`}`,"card.sourcesUnlisted":`No sources listed`,"card.sourcesList":({n:e,names:t})=>`${e} source${e===1?``:`s`}: ${t}`,"card.duration":({duration:e})=>`Duration ${e}`,"card.approxPrefix":`approx. `,"card.dateUnknown":`date unknown`,"card.unitDay":({n:e})=>`${e} day${e===1?``:`s`}`,"card.unitHour":({n:e})=>`${e} hour${e===1?``:`s`}`,"card.unitMinute":({n:e})=>`${e} min`,"card.unitSecond":({n:e})=>`${e} sec`,"card.ariaLabel":({label:e,date:t})=>t?`${e}, ${t}`:e,"card.dateNote":({note:e})=>`Time note: ${e}`,"card.previewHint":`Click a card to read the full text`,"flow.conditions":`Conditions`,"flow.detail":`Detail`,"flow.mainLine":`Main line`,"flow.states":`States`,"flow.stages":`Stages`,"flow.rules":`Rules`,"flow.linkStraight":`Straight`,"flow.linkCurved":`Curved`,"flow.linkStyle":`Link style`,"rule.tableTitle":`Rules`,"rule.tableNote":`What may happen along the way; not steps of the flow`,"rule.tableNoteContract":`What may happen while the contract runs; not steps of the flow`,"rule.colWhen":`If`,"rule.colThen":`Then`,"rule.colScope":`Stages`,"rule.groupEnd":({end:e})=>`May lead to “${e}”`,"rule.groupRest":`Other rules`,"rule.count":({n:e})=>`${e}`,"rule.anyOf":`Any of:`,"rule.tScopeAll":`Throughout`,"rule.tScopeRange":({from:e,to:t})=>`${e} → ${t}`,"flow.ruleBadge":({n:e})=>e===1?`1 rule`:`${e} rules`,"flow.noteTag":`Note`,"rule.if":`If`,"rule.or":`, or `,"flow.previewHint":`Click a node to read the full text`,"aria.nodeDefault":`Press enter or space to select this node.`,"aria.nodeKeyboardDisabled":`Press enter or space to select this node. Once selected, use the arrow keys to move it.`,"aria.nodeMoved":({x:e,y:t})=>`Node moved. New position: x ${e}, y ${t}`,"aria.edgeDefault":`Press enter or space to select this connection.`,"aria.controls":`Canvas controls`,"aria.zoomIn":`Zoom in`,"aria.zoomOut":`Zoom out`,"aria.fitView":`Fit view`,"aria.interactive":`Toggle interactivity`,"aria.minimap":`Minimap`,"aria.handle":`Connection point`,"sourceType.statute":`Statute`,"sourceType.case":`Case`,"sourceType.contract":`Contract`,"sourceType.evidence":`Evidence`,"sourceType.document":`Document`,"sourceType.web":`Web`,"sourceType.other":`Other`,"graphKind.timeline":`Timeline`,"graphKind.flow":`Flowchart`,"header.theme":`Theme`,"theme.document":`Document`,"theme.modern":`Modern`,"theme.legal":`Legal`,"theme.dark":`Dark`,"header.kindOpen":({n:e})=>`All ${e} ways of drawing`,"header.kindPrev":`Previous way of drawing`,"header.kindNext":`Next way of drawing`,"header.kindGroup":`Way of drawing`,"header.fold":`Fold the card`,"header.unfold":`Show the card`,"graphKind.chronicle":`Chronicle`,"graphKind.scale":`Time scale`,"scale.segment":({n:e,unit:t,count:n})=>`Segment ${e} · ${t} · ${n} event${n===1?``:`s`}`,"scale.unit.year":`by year`,"scale.unit.month":`by month`,"scale.unit.day":`by day`,"scale.unit.hour":`by hour`,"scale.unit.minute":`by minute`,"scale.other":`Other`,"scale.events":`Events`,"scale.undated":`date unknown · placed by order`,"scale.coarse.day":`that day (time unknown)`,"scale.coarse.month":`that month (day unknown)`,"scale.coarse.year":`that year (month unknown)`,"scale.run":({n:e})=>`${e} events`,"scale.runListed":({n:e})=>`${e} events too close to show one by one:`,"chronicle.gapSeconds":({n:e})=>`+${e} s`,"chronicle.gapMinutes":({n:e})=>`+${e} min`,"chronicle.gapHours":({n:e})=>`+${e} h`,"chronicle.gapHoursMinutes":({h:e,m:t})=>`+${e} h ${t} min`,"chronicle.gapDays":({n:e})=>`${e} day${e===1?``:`s`} later`,"chronicle.gapMonths":({n:e})=>`${e} month${e===1?``:`s`} later`,"chronicle.gapYears":({n:e})=>`${e} year${e===1?``:`s`} later`,"chronicle.gapYearsMonths":({y:e,m:t})=>`${e} yr ${t} mo later`,"chronicle.dateUnknown":`Date unknown`,"graphType.fact":`Fact`,"graphType.relationship":`Relationship`,"graphType.procedure":`Procedure`,"graphType.justification":`Justification`,"err.notObject":({at:e})=>`${e}: must be an object`,"err.notArray":({at:e})=>`${e} must be an array`,"err.required":({at:e,field:t})=>`${e}: missing required field \`${t}\``,"err.mustBeString":({at:e,field:t})=>`${e}: \`${t}\` must be a string`,"err.duplicateId":({at:e,id:t})=>`${e}: duplicate id "${t}"`,"err.missingRef":({at:e,field:t,kind:n,id:r})=>`${e}: ${t} refers to a non-existent ${n} "${r}"`,"err.tooManyGroups":({at:e,max:t,actual:n})=>`${e}: at most ${t} groups (the axis has two sides plus the centre), got ${n}`,"err.slotsEmpty":"`slots` must not be empty","err.slotEventsEmpty":({at:e})=>`${e}.events must not be empty (an empty time slot carries no meaning)`,"err.slotEventEmptyShape":({at:e})=>`${e}: must be an object of the form { events: [ … ] }`,"err.oneEventPerCell":({at:e,a:t,b:n})=>`${e}: two events share the same lane in one time slot ("${t}" and "${n}"); one cell holds one event`,"err.badDate":({at:e,field:t,value:n})=>`${e}: \`${t}\` is not ISO 8601 (e.g. 2017-05-02T09:24:03), got "${n}"`,"err.dateEndNeedsDate":({at:e})=>`${e}: \`dateEnd\` is written but \`date\` is not; a span needs its start`,"err.dateEndBeforeDate":({at:e,end:t,start:n})=>`${e}: \`dateEnd\` (${t}) is earlier than \`date\` (${n}); a span cannot run backwards`,"err.summaryTooLong":({at:e,max:t,actual:n})=>`${e}: \`summary\` is too wide for one line (about ${n} full-width characters, limit ${t}); shorten it or move the text to detail`,"err.groupNeedsOneActor":({at:e,groupId:t,n})=>`${e}: a side group ("${t}") must name exactly one party (currently ${n}); events that involve no particular party belong in the centre group or should omit groupId`,"err.multiActorNeedsAxis":({at:e,n:t,groupId:n})=>`${e}: an event with ${t} parties belongs on the centre axis, but groupId points at a side group ("${n}"); the two contradict each other`,"err.viewsRemoved":"`views` is no longer part of the format (placement rules v1): delete it. A diagram has one placement: with 2 or more parties, write `groupId` on each party (its side); with 1 party, on the events","err.actorNeedsGroup":({at:e,n:t})=>`${e}: the diagram has ${t} parties, so each party says which side it is on: write \`groupId\` with the 1st or the 2nd of \`groups\` (add \`groups\` if there are none)`,"err.actorGroupNotSide":({at:e,groupId:t})=>`${e}: \`groupId\` "${t}" is the 3rd group, the axis; a party belongs to the 1st or the 2nd group (a side)`,"err.actorGroupOneParty":({at:e})=>`${e}: a party carries \`groupId\` only when the diagram has 2 or more parties; with one party the groups split the events, so write \`groupId\` on the events`,"err.eventGroupWithParties":({at:e})=>`${e}: the diagram has 2 or more parties, so the groups belong to the parties and an event is placed by its \`actorIds\`: delete the event's \`groupId\` (one party → that party's side; several or none → the axis)`,"err.specNotObject":`a spec must be a JSON object`,"err.envelopeTypeRequired":"missing required field `type` (the engine uses it to pick a renderer)","err.envelopeTypeString":"`type` must be a string","err.envelopeTypeUnknown":'`type` is "{type}", which is not a diagram type; expected one of {list}',"err.envelopeTypeIsKind":'`type` is "{type}", which is a way of drawing a {owner} diagram, not a type: write `"type": "{owner}"` (the way it is drawn is chosen on the page, not in the JSON)',"err.envelopeTitleString":"`title` must be a string","err.specVersionForm":"`specVersion` must be a whole number from 1 up, got {value}","err.specVersionNewer":'`specVersion` is {value}, newer than this engine knows for "{type}" ({known}): update the engine, or write the file for the older format',"err.slotNotArray":"`slots` must be an array (one slot = one time point)","err.slotShape":({at:e})=>`${e}: must be an object of the form { events: [ … ] }`,"err.eventsNotArray":({at:e})=>`${e}.events must be an array`,"rerr.entitiesEmpty":"`entities` must not be empty (a diagram needs at least two parties)","rerr.relationsEmpty":"`relations` must not be empty (the parties have to be related)","rerr.notArray":({field:e})=>`\`${e}\` must be an array`,"rerr.notObject":({at:e})=>`${e}: must be an object`,"rerr.required":({at:e,field:t})=>`${e}: missing required field \`${t}\``,"rerr.duplicateId":({at:e,id:t,what:n})=>`${e}: id "${t}" duplicates an earlier ${n}`,"rerr.badEntityKind":({at:e,value:t,allowed:n})=>`${e}: kind is "${t}", which is not one of: ${n}`,"rerr.badRelationKind":({at:e,value:t,allowed:n})=>`${e}: kind is "${t}", which is not one of: ${n}`,"rerr.badSourceType":({at:e,value:t,allowed:n})=>`${e}: \`type\` "${t}" is not one of ${n}`,"rerr.mustBeString":({at:e,field:t})=>`${e}: \`${t}\` must be a non-empty string`,"rerr.mustBeBoolean":({at:e,field:t})=>`${e}: \`${t}\` must be true or false`,"rerr.badRef":({at:e,field:t,kind:n,id:r})=>`${e}: \`${t}\` refers to a non-existent ${n} "${r}"`,"rerr.badEnd":({at:e,end:t,id:n})=>`${e}: \`${t}\` refers to a non-existent entity "${n}"`,"rerr.selfRelation":({at:e,id:t})=>`${e}: an entity cannot be related to itself ("${t}" on both ends)`,"rerr.duplicateRelation":({at:e,from:t,to:n,kind:r})=>`${e}: duplicate relation ${t} -> ${n} (${r}, same label); give the second one its own label, or drop it`,"rerr.fieldNotHere":({at:e,field:t,kinds:n})=>`${e}: \`${t}\` only belongs on a relation of kind ${n}`,"rerr.badShare":({at:e,value:t})=>`${e}: \`share\` must be a number from 0 to 100, got ${t}`,"rerr.badSecures":({at:e,id:t})=>`${e}: \`secures\` refers to a non-existent relation "${t}"`,"rerr.securesNotClaim":({at:e,id:t,kind:n,claims:r})=>`${e}: \`secures\` points at relation "${t}", which is a ${n}; a guarantee secures a claim (${r})`,"rerr.badAsOf":({value:e})=>`asOf: "${e}" is not an ISO date (YYYY, YYYY-MM or YYYY-MM-DD)`,"rhint.shareOver100":({id:e,label:t,total:n})=>`entities (${e}): the shares held in "${t}" add up to ${n}%, more than the whole; check the figures or the source`,"rhint.isolated":({id:e,label:t})=>`entities (${e}): "${t}" has no relation to anyone, so it will float beside the diagram; relate it or drop it`,"rhint.noSecures":({id:e})=>`relations (${e}): a guarantee that does not say which claim it secures; add \`secures\` with that relation's id`,"rhint.tooLarge":({n:e,limit:t})=>`${e} entities: past about ${t} the diagram gets hard to read on one screen; consider splitting it by group`,"rhint.tooManyRelations":({n:e,limit:t})=>`${e} relations: past about ${t} the graph can take several seconds to draw (each change of orientation or groups draws it again); consider splitting it by group, or use another way of drawing`,"rhint.equityCycle":({path:e})=>`shareholdings loop back (${e}); allowed, but check it is what the registry says`,"rel.kind.equity":`Equity`,"rel.kind.control":`Control`,"rel.kind.contract":`Contracts`,"rel.kind.debt":`Debts`,"rel.kind.guarantee":`Guarantees`,"rel.kind.kinship":`Family`,"rel.kind.employment":`Employment`,"rel.kind.agency":`Agency`,"rel.kind.other":`Other`,"rel.kindChipTitle":({n:e})=>e===1?`Show or hide this kind (1 relation)`:`Show or hide this kind (${e} relations)`,"rel.labels":`Labels`,"rel.groups":`Groups`,"rel.previewHint":`Click a party to read the full text`,"rel.auto.equity":({share:e})=>e===void 0?`Holds shares`:`Holds ${e}%`,"rel.auto.control":`Controls`,"rel.auto.contract":({amount:e})=>e?`Contract, ${e}`:`Contract`,"rel.auto.debt":({amount:e})=>e?`Claim, ${e}`:`Claim`,"rel.auto.guarantee":`Guarantee`,"rel.auto.kinship":`Family`,"rel.auto.employment":`Employment`,"rel.auto.agency":`Agency`,"rel.auto.other":`Related`,"info.entities":({n:e})=>`${e} part${e===1?`y`:`ies`}`,"info.relations":({n:e})=>`${e} relation${e===1?``:`s`}`,"info.links":({n:e})=>`${e} link${e===1?``:`s`}`,"jerr.nodesEmpty":"`nodes` must not be empty (a justification needs at least a conclusion and what supports it)","jerr.linksEmpty":"`links` must not be empty (the nodes have to support one another)","jerr.notArray":({field:e})=>`\`${e}\` must be an array`,"jerr.notObject":({at:e})=>`${e}: must be an object`,"jerr.required":({at:e,field:t})=>`${e}: missing required field \`${t}\``,"jerr.duplicateId":({at:e,id:t,what:n})=>`${e}: id "${t}" duplicates an earlier ${n}`,"jerr.mustBeString":({at:e,field:t})=>`${e}: \`${t}\` must be a non-empty string`,"jerr.badNodeKind":({at:e,value:t,allowed:n})=>`${e}: kind is "${t}", which is not one of: ${n}`,"jerr.badRef":({at:e,field:t,kind:n,id:r})=>`${e}: \`${t}\` refers to a non-existent ${n} "${r}"`,"jerr.badHolds":({at:e,value:t})=>`${e}: \`holds\` must be "yes" or "no", got "${t}"`,"jerr.holdsNotHere":({at:e,kind:t,kinds:n})=>`${e}: a ${t} does not hold or fail; \`holds\` only belongs on ${n}`,"jerr.badCombine":({at:e,value:t,allowed:n})=>`${e}: \`combine\` is "${t}", which is not one of: ${n}`,"jerr.combineNotHere":({at:e,kind:t,kinds:n})=>`${e}: a ${t} is not supported by other nodes; \`combine\` only belongs on ${n}`,"jerr.dateNotHere":({at:e,kind:t})=>`${e}: \`date\` only belongs on a fact, not on a ${t}`,"jerr.badDate":({at:e,value:t})=>`${e}: \`date\` "${t}" is not an ISO date (YYYY-MM-DD or YYYY-MM-DDTHH:MM)`,"jerr.badEnd":({at:e,end:t,id:n})=>`${e}: \`${t}\` refers to a non-existent node "${n}"`,"jerr.selfLink":({at:e,id:t})=>`${e}: a node cannot support itself ("${t}" on both ends)`,"jerr.badStance":({at:e,value:t,allowed:n})=>`${e}: stance is "${t}", which is not one of: ${n}`,"jerr.basisNotNorm":({at:e,kind:t})=>`${e}: stance "basis" can only start from a norm, not from a ${t}`,"jerr.duplicateLink":({at:e,stance:t})=>`${e}: duplicate link (same from, to and stance "${t}"); drop the second one`,"jerr.cycle":({path:e})=>`links form a cycle (${e}); a reasoning must not lead back to itself`,"jerr.leafHasInput":({at:e,kind:t})=>`${e}: a ${t} is a leaf; nothing may support it (an evidence layer is not part of v0)`,"jerr.noEnd":"no end conclusion: at least one `conclusion` must have no outgoing link (the conclusion the whole reasoning leads to)","jhint.severalEnds":({n:e,ids:t})=>`${e} conclusions end the diagram (${t}); is this one reasoning, or should it be split?`,"jhint.supportsNothing":({id:e,label:t})=>`nodes (${e}): "${t}" supports nothing; link it to what it supports, or drop it`,"jhint.factNoSource":({id:e,label:t})=>`nodes (${e}): the fact "${t}" has no source; where was it found?`,"jhint.normNoSource":({id:e,label:t})=>`nodes (${e}): the norm "${t}" has no source; which provision is it?`,"jhint.unsupported":({id:e,label:t})=>`nodes (${e}): nothing supports "${t}"; add a fact, an element or a norm that does (if it stands only because what argued against it was rejected, this note can be left as it is)`,"jhint.holdsOnRejected":({id:e,label:t})=>`nodes (${e}): "${t}" holds although everything that supports it is rejected; check the \`holds\` values`,"jhint.combineAlone":({id:e,label:t,combine:n})=>`nodes (${e}): "${t}" says \`combine: "${n}"\` but fewer than two links support it; there is nothing to combine`,"jhint.allNeedsAll":({id:e,label:t,other:n})=>`nodes (${e}): "${t}" needs all it rests on, but "${n}" is rejected; check the \`holds\` values`,"jhint.anyOneHolds":({id:e,label:t,other:n})=>`nodes (${e}): "${t}" is rejected although any one it rests on would do, and "${n}" holds; check the \`holds\` values`,"jhint.tooLarge":({n:e,limit:t})=>`${e} nodes: past about ${t} the tree gets hard to read on one screen; consider one diagram per issue`,"graphKind.graph":`Relationship graph`,"graphKind.focus":`Focus view`,"graphKind.matrix":`Relation matrix`,"graphKind.equity":`Equity tree`,"rel.matrix.ungrouped":`No camp`,"rel.equity.noShare":`not stated`,"rel.equity.cross":`cross-holding`,"rel.equity.noEquity":`No equity relations in this data`,"rel.equity.noEquityHint":`This view is built around shareholdings. For this case, switch to the relationship graph.`,"rel.equity.indirect":({n:e})=>`Held through others (${e})`,"rel.equity.notComputable":`cannot be worked out: a share on the way is not stated`,"rel.equity.moreRows":({n:e})=>`${e} more not listed`,"rel.equity.above":({n:e})=>`Above it (${e})`,"rel.company.label":`Company`,"rel.company.all":`All`,"rel.equity.sep":`, `,"rel.equity.colon":`: `,"graphKind.authority":`Control and employment`,"rel.authority.cycle":`cycle`,"rel.authority.none":`No control, employment or agency relations in this data`,"rel.authority.noneHint":`This view is built around who commands whom. For this case, switch to the relationship graph.`,"rel.authority.above":({n:e})=>`Above it (${e})`,"graphKind.related":`Related parties`,"rel.related.title":({name:e})=>`Related parties of ${e} (the centre)`,"rel.related.count":({n:e,m:t})=>`${e} related part${e===1?`y`:`ies`}, ${t} relation${t===1?``:`s`}`,"rel.related.colParty":`Related party`,"rel.related.colKind":`Category`,"rel.related.colText":`Relation`,"rel.related.colSource":`Source`,"rel.related.dirNone":({a:e,b:t})=>`${e} — ${t} (no direction)`,"rel.related.none":({name:e})=>`${e} has no relation in this data`,"rel.related.noneHint":`Pick another party in the box at the bottom, or switch to the relationship graph.`,"rel.related.centre":`Centre`,"graphKind.path":`Relation path`,"rel.path.from":`From`,"rel.path.to":`To`,"rel.path.swap":`Swap the two ends`,"rel.path.noChain":({a:e,b:t})=>`No chain of relations ties ${e} and ${t}`,"rel.path.noChainHint":`Pick two parties that are connected, or switch to the relationship graph.`,"rel.path.steps":({n:e})=>`${e} step${e===1?``:`s`}`,"rel.path.chains":({n:e})=>`Chains drawn (${e})`,"rel.path.more":({n:e,atLeast:t})=>`${t?`At least `:``}${e} more chain${e===1?``:`s`} not drawn; only the shortest are.`,"graphKind.route":`Route map`,"proc.route.labels":`Conditions`,"proc.route.more":({n:e})=>`… and ${e} more`,"rel.focus.open":`Centre the focus view on this party`,"rel.focus.centre":`Centre`,"rel.focus.hint":`Click to put this party in the middle`,"rel.focus.apart":`Not connected to the centre`,"rel.focus.reset":`Default centre`,"rel.focus.resetTitle":`Put the party with the most relations back in the middle`,"graphKind.tree":`Reasoning tree`,"jus.kind.conclusion":`Conclusion`,"jus.kind.norm":`Norm`,"jus.kind.element":`Element`,"jus.kind.fact":`Fact`,"jus.kind.inference":`Inference`,"jus.kind.judgement":`Judgement`,"jus.holds.yes":`✓ upheld`,"jus.holds.no":`✗ rejected`,"jus.copy":`shown again`,"jus.copies":({n:e})=>`The same node is drawn in ${e} issues`,"jus.grounds":`Rests on`,"jus.fold":`Fold this issue up`,"jus.unfold":`Open this issue`,"jus.folded":({n:e})=>`${e} folded`,"jus.foldAll":`Fold issues`,"jus.merge":`Merge repeats`,"jus.mergeTitle":`A fact (or a norm with many elements) used several times in one issue is drawn beside each use; merge draws each once, with longer lines`,"jus.foldAllTitle":`Fold every issue up to its conclusion, or open them all again`,"jus.combine.all":`all of`,"jus.combine.any":`any of`,"jus.combine.allLong":`All of what it rests on is needed`,"jus.combine.anyLong":`Any one of what it rests on is enough`,"jus.supports":`Leads to`,"jus.stance.for":`supports`,"jus.stance.against":`opposes`,"jus.stance.basis":`basis`,"jus.previewHint":`Click a node to read the full text and see what it rests on`,"perr.domainNotInEnum":({value:e,allowed:t})=>`\`domain\` is "${e}", not in the enum (${t})`,"perr.nodesEmpty":"`nodes` must not be empty (a flow needs at least a start and an end)","perr.edgesEmpty":"`edges` must not be empty (the nodes have to be connected)","perr.notObject":({at:e})=>`${e}: must be an object`,"perr.required":({at:e,field:t})=>`${e}: missing required field \`${t}\``,"perr.duplicateNodeId":({at:e,id:t})=>`${e}: id "${t}" duplicates an earlier node`,"perr.badKind":({at:e,value:t,allowed:n})=>`${e}: \`kind\` is "${t}", not in the vocabulary (${n})`,"perr.badOutcome":({at:e,value:t,allowed:n})=>`${e}: \`outcome\` is "${t}", not in the enum (${n})`,"perr.mustBeString":({at:e,field:t})=>`${e}: \`${t}\` must be a string`,"perr.badRef":({at:e,field:t,kind:n,id:r})=>`${e}: ${t} refers to a non-existent ${n} "${r}"`,"perr.badFrom":({at:e,id:t})=>`${e}: \`from\` refers to a non-existent node "${t}"`,"perr.badTo":({at:e,id:t})=>`${e}: \`to\` refers to a non-existent node "${t}"`,"perr.selfLoop":({at:e,id:t})=>`${e}: self-loop (from and to are both "${t}")`,"perr.duplicateEdge":({at:e,from:t,to:n})=>`${e}: duplicate edge ${t} -> ${n} (same condition); branches into one target each need their own condition`,"perr.noEntry":`no node has zero incoming edges (a flow needs a start)`,"perr.unreachable":({id:e})=>`nodes (${e}): unreachable from the start (it would be dropped silently and never appear)`,"perr.orphan":({id:e,label:t})=>`nodes (${e}): "${t}" has no incoming edge and is not a start, so nothing leads to it: it would float beside the flow. If it is a consequence (a breach, a resignation, a right to terminate), write it as a rule in \`rules\`; if it belongs to the flow, add the edge that leads to it`,"note.partyNoEvent":({at:e,id:t,name:n})=>`${e} (${t}): no event names "${n}" in its actorIds, so it is on no card and has no column. Name it in the actorIds of the events it took part in, or leave it out of actors if it did nothing in this diagram`,"note.dateOrder":({at:e,id:t,date:n,beforeAt:r,beforeId:i,beforeDate:a})=>`${e} ("${t}", ${n}) comes after ${r} ("${i}", ${a}) in the slots but its date is wholly earlier. The order of the slots is kept and nothing is reordered; check which of the two dates is wrong, or whether the slots are in the wrong order`,"perr.noEnd":'no node has `kind: "end"` (a flow needs an end)',"perr.deadEnd":({id:e,label:t})=>`nodes (${e}): "${t}" is a dead end: it is neither end nor note but has no outgoing edge. If it is the consequence of a breach, delay or right to terminate, write it as a rule in \`rules\` (it may fire at any time in its stages) instead of a node that has to lead somewhere`,"perr.decisionTooFewOut":({id:e,n:t})=>`nodes (${e}): kind is "decision" but only ${t} outgoing edge(s); a decision needs at least 2`,"perr.decisionNoCondition":({id:e,index:t,to:n})=>`nodes (${e}): kind is "decision" but edge edges[${t}] -> "${n}" has no condition. If it really is a decision, give every outgoing edge a condition (e.g. "yes / no"); if it is a step, change kind to "step" (a step may have several outgoing edges, one of them the main line)`,"perr.tooManyMain":({id:e,n:t})=>`nodes (${e}): ${t} outgoing edges are marked main; a path has exactly one`,"perr.mainBroken":({id:e})=>`the main line breaks at node "${e}": the edges marked main do not reach any end. Either add the missing main edge, or repair the chain`,"norm.mainRemarked":({problem:e,from:t,to:n})=>`the main line was marked again, starting at "${t}" and ending at "${n}", keeping to the edges already marked where it could. It was: ${e}`,"norm.mainSet":({at:e})=>`${e}: marked main`,"norm.mainCleared":({at:e})=>`${e}: no longer marked main`,"perr.rulesNotArray":"`rules` must be an array","perr.duplicateRuleId":({at:e,id:t})=>`${e}: id "${t}" is already used by another rule or node`,"perr.ruleWhen":({at:e})=>`${e}: \`when\` is required: a non-empty string, or an array of them (any one of them triggers the rule)`,"perr.ruleEndNotEnd":({at:e,id:t})=>`${e}: \`endId\` points at "${t}", which is not a node of kind "end"; a rule can only lead to an end`,"phint.stageBackwards":({from:e,fromStage:t,to:n,toStage:r})=>`stage runs backwards: ${e} (${t}) -> ${n} (${r}); back edges are normal, others need a second look`,"phint.decisionOnSpine":({id:e,label:t})=>`decision "${e}" (${t}) is on the main line but no outgoing edge is marked main; the breach path may end up drawn as the main line`,"phint.longLabel":({id:e,n:t})=>`node "${e}" has a label of ${t} characters; a node shows about two lines (20 Chinese characters) and cuts the rest, the popover has it all. Shorten the label and move the detail into \`detail\``,"phint.noteNoDetail":({id:e,label:t})=>`note "${e}" (${t}) has no detail; a note is an explanation, so write it as one full sentence (in detail) that says what it explains`,"phint.multipleEntries":({n:e,ids:t})=>`${e} entries (${t}), they will all sit in the first layer; a contract flow usually has a single entry, so check whether an upstream link is missing`},ie={en:re,zh:{"common.none":`(无)`,"common.close":`关闭`,"common.untitled":`案图`,"fallback.invalidTitle":({n:e})=>`该数据未通过校验(${e} 处问题)`,"fallback.noRendererTitle":({type:e})=>`没有为 type = "${e}" 注册渲染器`,"fallback.registered":({list:e})=>`已注册:${e}`,"fallback.noInlineData":`这份文件里没有内联数据,生成时发生错误,请重新生成这份 HTML。`,"fallback.devNoData":`开发服务器未获取到数据:请用 ?example=0 或 ?spec=examples/某份.json 指定一份。`,"error.renderTitle":`渲染出错`,"error.renderHint":`数据本身可能没问题(校验已经通过),是这个画法在渲染时抛错了。请将下列信息提供给开发者,或改用其他画法。`,"info.span":({from:e,to:t})=>`${e} 至 ${t}`,"info.slots":({n:e})=>`${e} 个时间点`,"info.actors":({n:e})=>`${e} 个主体`,"info.sources":({n:e})=>`${e} 个来源`,"info.nodes":({n:e})=>`${e} 个节点`,"info.stages":({n:e})=>`${e} 个阶段`,"info.entities":({n:e})=>`${e} 个当事方`,"info.relations":({n:e})=>`${e} 条关系`,"info.links":({n:e})=>`${e} 条连线`,"dock.actors":`主体`,"dock.summary":`摘要`,"dock.sources":`来源`,"dock.orientation":`层的走向:竖向是从上往下,横向是从左往右。`,"dock.orientationCamps":`层的走向:竖向是从上往下,横向是从左往右。画了阵营框时,阵营沿垂直于层的方向排开:竖向时左右并排,横向时上下叠放,所以整张图看起来可能和按钮相反。`,"dock.vertical":`竖向`,"dock.horizontal":`横向`,"dock.grid":`格线`,"dock.stagger":`交错`,"dock.byParty":`按主体分泳道`,"dock.staggerHint":`让不同列的卡片上下错开半行,图更短、字更大`,"dock.exportImage":`导出图片`,"dock.exporting":`正在导出…`,"dock.exportTitle":`将整张图导出为 PNG(2 倍分辨率)`,"dock.lang":`语言`,"dock.fold":`收起`,"dock.display":`显示选项`,"export.failed":({message:e})=>`导出失败:${e}`,"dock.langEn":`EN`,"dock.langZh":`中文`,"flow.conditions":`条件`,"flow.detail":`详情`,"flow.mainLine":`主干`,"flow.states":`状态`,"flow.stages":`阶段`,"flow.rules":`条款`,"flow.linkStraight":`折线`,"flow.linkCurved":`曲线`,"flow.linkStyle":`连线样式`,"rule.tableTitle":`条款`,"rule.tableNote":`流程中可能出现的情形,不属于流程步骤`,"rule.tableNoteContract":`合同履行过程中可能出现的情形,不属于流程步骤`,"rule.colWhen":`情形`,"rule.colThen":`后果`,"rule.colScope":`适用阶段`,"rule.groupEnd":({end:e})=>`可导致「${e}」`,"rule.groupRest":`其他条款`,"rule.count":({n:e})=>`${e} 条`,"rule.anyOf":`下列任一:`,"rule.tScopeAll":`全程`,"rule.tScopeRange":({from:e,to:t})=>`${e} 至 ${t}`,"flow.ruleBadge":({n:e})=>`条款 ${e} 条`,"flow.noteTag":`注`,"rule.if":`若`,"rule.or":`,或`,"flow.previewHint":`点击节点查看全文`,"card.sources":({n:e})=>`来源 ${e} 个`,"card.sourcesUnlisted":`未列来源`,"card.sourcesList":({n:e,names:t})=>`来源 ${e} 个:${t}`,"card.duration":({duration:e})=>`持续 ${e}`,"card.approxPrefix":`约 `,"card.dateUnknown":`日期不详`,"card.unitDay":({n:e})=>`${e} 天`,"card.unitHour":({n:e})=>`${e} 小时`,"card.unitMinute":({n:e})=>`${e} 分`,"card.unitSecond":({n:e})=>`${e} 秒`,"card.ariaLabel":({label:e,date:t})=>t?`${e},${t}`:e,"card.dateNote":({note:e})=>`时间说明:${e}`,"card.previewHint":`点击卡片查看全文`,"aria.nodeDefault":`按回车或空格可选中此节点。`,"aria.nodeKeyboardDisabled":`按回车或空格可选中此节点。选中后可用方向键移动。`,"aria.nodeMoved":({x:e,y:t})=>`已移动节点。新位置:x ${e},y ${t}`,"aria.edgeDefault":`按回车或空格可选中此连线。`,"aria.controls":`画布控件`,"aria.zoomIn":`放大`,"aria.zoomOut":`缩小`,"aria.fitView":`适应视图`,"aria.interactive":`切换交互`,"aria.minimap":`缩略图`,"aria.handle":`连接点`,"sourceType.statute":`法条`,"sourceType.case":`判例`,"sourceType.contract":`合同`,"sourceType.evidence":`证据`,"sourceType.document":`文书`,"sourceType.web":`网页`,"sourceType.other":`其他`,"graphKind.timeline":`时间图`,"graphKind.flow":`流程图`,"header.theme":`主题`,"theme.document":`文书`,"theme.modern":`现代`,"theme.legal":`法律`,"theme.dark":`深色`,"header.kindOpen":({n:e})=>`查看全部 ${e} 种画法`,"header.kindPrev":`上一种画法`,"header.kindNext":`下一种画法`,"header.kindGroup":`画法`,"header.fold":`收起标题卡`,"header.unfold":`展开标题卡`,"graphKind.chronicle":`大事记`,"graphKind.scale":`比例时间轴`,"scale.segment":({n:e,unit:t,count:n})=>`第 ${e} 段 · ${t} · ${n} 个事件`,"scale.unit.year":`按年`,"scale.unit.month":`按月`,"scale.unit.day":`按日`,"scale.unit.hour":`按小时`,"scale.unit.minute":`按分钟`,"scale.other":`其他`,"scale.events":`事件`,"scale.undated":`日期不详 · 按顺序放置`,"scale.coarse.day":`当日(时刻不详)`,"scale.coarse.month":`当月(日期不详)`,"scale.coarse.year":`当年(月份不详)`,"scale.run":({n:e})=>`${e} 个事件`,"scale.runListed":({n:e})=>`时间相近的 ${e} 个事件,列示如下:`,"chronicle.gapSeconds":({n:e})=>`+${e} 秒`,"chronicle.gapMinutes":({n:e})=>`+${e} 分钟`,"chronicle.gapHours":({n:e})=>`+${e} 小时`,"chronicle.gapHoursMinutes":({h:e,m:t})=>`+${e} 小时 ${t} 分`,"chronicle.gapDays":({n:e})=>`间隔 ${e} 天`,"chronicle.gapMonths":({n:e})=>`间隔 ${e} 个月`,"chronicle.gapYears":({n:e})=>`间隔 ${e} 年`,"chronicle.gapYearsMonths":({y:e,m:t})=>`间隔 ${e} 年 ${t} 个月`,"chronicle.dateUnknown":`日期不详`,"graphKind.graph":`关系图`,"graphKind.focus":`聚焦图`,"graphKind.matrix":`关系矩阵`,"graphKind.equity":`股权图`,"rel.matrix.ungrouped":`未归阵营`,"rel.equity.noShare":`比例未写明`,"rel.equity.cross":`交叉持股`,"rel.equity.noEquity":`这份数据里没有股权关系`,"rel.equity.noEquityHint":`这个视图围绕持股关系画。这类案件请切换到关系图。`,"rel.equity.indirect":({n:e})=>`间接持有(${e})`,"rel.equity.notComputable":`算不出:途中有一处持股比例没写明`,"rel.equity.moreRows":({n:e})=>`另有 ${e} 项未列出`,"rel.equity.above":({n:e})=>`在它上面的(${e})`,"rel.company.label":`公司`,"rel.company.all":`全部`,"rel.equity.sep":`、`,"rel.equity.colon":`:`,"graphKind.authority":`控制与任职图`,"rel.authority.cycle":`循环`,"rel.authority.none":`这份数据里没有控制、任职或代理关系`,"rel.authority.noneHint":`这个视图围绕谁管着谁画。这类案件请切换到关系图。`,"rel.authority.above":({n:e})=>`在它上面的(${e})`,"graphKind.related":`关联方清单`,"rel.related.title":({name:e})=>`关联方清单:${e}(中心方)`,"rel.related.count":({n:e,m:t})=>`共 ${e} 个关联方,${t} 条关系`,"rel.related.colParty":`关联方`,"rel.related.colKind":`关系类别`,"rel.related.colText":`关系内容`,"rel.related.colSource":`来源`,"rel.related.dirNone":({a:e,b:t})=>`${e} — ${t}(无方向)`,"rel.related.none":({name:e})=>`「${e}」在这份数据里没有任何关系`,"rel.related.noneHint":`在底部的框里换一方,或切换到关系图。`,"rel.related.centre":`中心方`,"graphKind.path":`关系路径图`,"rel.path.from":`起点`,"rel.path.to":`终点`,"rel.path.swap":`起点和终点对调`,"rel.path.noChain":({a:e,b:t})=>`没有任何关系链把「${e}」和「${t}」连起来`,"rel.path.noChainHint":`请选两个有关系相连的当事人,或切换到关系图。`,"rel.path.steps":({n:e})=>`${e} 步`,"rel.path.chains":({n:e})=>`画出的关系链(${e})`,"rel.path.more":({n:e,atLeast:t})=>`另有${t?`至少 `:` `}${e} 条关系链没有画;只画最短的几条。`,"graphKind.route":`路线图`,"proc.route.labels":`条件`,"proc.route.more":({n:e})=>`……还有 ${e} 步`,"rel.focus.open":`以这一方为中心看聚焦图`,"rel.focus.centre":`中心`,"rel.focus.hint":`点击,把这一方放到中间`,"rel.focus.apart":`与中心没有关系相连`,"rel.focus.reset":`默认中心`,"rel.focus.resetTitle":`把关系最多的那一方放回中间`,"graphKind.tree":`说理树`,"jus.kind.conclusion":`结论`,"jus.kind.norm":`规范`,"jus.kind.element":`要件`,"jus.kind.fact":`事实`,"jus.kind.inference":`推断`,"jus.kind.judgement":`评价`,"jus.holds.yes":`✓ 成立`,"jus.holds.no":`✗ 否定`,"jus.copy":`重复`,"jus.copies":({n:e})=>`同一节点出现在 ${e} 个争点中`,"jus.grounds":`依据`,"jus.fold":`收起这个争点`,"jus.unfold":`展开这个争点`,"jus.folded":({n:e})=>`已收起 ${e} 个`,"jus.foldAll":`收起争点`,"jus.merge":`合并重复`,"jus.mergeTitle":`同一争点里被多处用到的事实(或支持多个要件的规范)默认在每处使用点各列一份;合并后只列一份,连线会变长、更易交叉`,"jus.foldAllTitle":`把每个争点收起到只剩它的结论,或者全部展开`,"jus.combine.all":`且`,"jus.combine.any":`或`,"jus.combine.allLong":`它依据的须全部具备`,"jus.combine.anyLong":`它依据的具备任何一个即可`,"jus.supports":`指向`,"jus.stance.for":`支持`,"jus.stance.against":`反对`,"jus.stance.basis":`规范依据`,"jus.previewHint":`点击节点查看全文及其依据`,"graphType.fact":`事实图`,"graphType.relationship":`关系图`,"graphType.procedure":`程序图`,"graphType.justification":`证成图`,"rel.kind.equity":`股权`,"rel.kind.control":`控制`,"rel.kind.contract":`合同`,"rel.kind.debt":`债权债务`,"rel.kind.guarantee":`担保`,"rel.kind.kinship":`亲属`,"rel.kind.employment":`雇佣`,"rel.kind.agency":`代理`,"rel.kind.other":`其他`,"rel.kindChipTitle":({n:e})=>`显示或隐藏这一类(${e} 条关系)`,"rel.labels":`标签`,"rel.groups":`分组`,"rel.previewHint":`点击当事方查看全文`,"rel.auto.equity":({share:e})=>e===void 0?`持有股权`:`持股 ${e}%`,"rel.auto.control":`控制`,"rel.auto.contract":({amount:e})=>e?`合同,${e}`:`合同`,"rel.auto.debt":({amount:e})=>e?`债权,${e}`:`债权`,"rel.auto.guarantee":`担保`,"rel.auto.kinship":`亲属`,"rel.auto.employment":`雇佣`,"rel.auto.agency":`代理`,"rel.auto.other":`关联`,...Object.fromEntries(Object.keys(re).filter(e=>e.startsWith(`err.`)||e.startsWith(`perr.`)||e.startsWith(`phint.`)||e.startsWith(`note.`)||e.startsWith(`rerr.`)||e.startsWith(`rhint.`)||e.startsWith(`jerr.`)||e.startsWith(`jhint.`)||e.startsWith(`norm.`)).map(e=>[e,re[e]]))}};function ae(e){return!e||typeof e!=`string`?`en`:e.toLowerCase().split(`-`)[0]===`zh`?`zh`:`en`}function oe(e,t,n){let r=(ie[ae(e)]??ie.en)[t]??ie.en[t];return r===void 0?t:typeof r==`function`?r(n??{}):n?String(r).replace(/\{(\w+)\}/g,(e,t)=>n[t]??`{${t}}`):r}var se=(e,t)=>oe(`en`,e,t),ce;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(ce||={});var le;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(le||={});var ue=ce.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),de=e=>{switch(typeof e){case`undefined`:return ue.undefined;case`string`:return ue.string;case`number`:return Number.isNaN(e)?ue.nan:ue.number;case`boolean`:return ue.boolean;case`function`:return ue.function;case`bigint`:return ue.bigint;case`symbol`:return ue.symbol;case`object`:return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?ue.promise:typeof Map<`u`&&e instanceof Map?ue.map:typeof Set<`u`&&e instanceof Set?ue.set:typeof Date<`u`&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}},fe=ce.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),pe=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r],a=r===i.path.length-1;n===`_errors`?(a&&e._errors.push(t(i)),r++):(Object.prototype.hasOwnProperty.call(e,n)||(n===`__proto__`?Object.defineProperty(e,n,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):e[n]={_errors:[]}),e=e[n],a&&e._errors.push(t(i)),r++)}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};pe.create=e=>new pe(e);var me=(e,t)=>{let n;switch(e.code){case fe.invalid_type:n=e.received===ue.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case fe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ce.jsonStringifyReplacer)}`;break;case fe.unrecognized_keys:n=`Unrecognized key(s) in object: ${ce.joinValues(e.keys,`, `)}`;break;case fe.invalid_union:n=`Invalid input`;break;case fe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ce.joinValues(e.options)}`;break;case fe.invalid_enum_value:n=`Invalid enum value. Expected ${ce.joinValues(e.options)}, received '${e.received}'`;break;case fe.invalid_arguments:n=`Invalid function arguments`;break;case fe.invalid_return_type:n=`Invalid function return type`;break;case fe.invalid_date:n=`Invalid date`;break;case fe.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:ce.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case fe.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case fe.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case fe.custom:n=`Invalid input`;break;case fe.invalid_intersection_types:n=`Intersection results could not be merged`;break;case fe.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case fe.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,ce.assertNever(e)}return{message:n}},he=me;function ge(){return he}var _e=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function ve(e,t){let n=ge(),r=_e({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===me?void 0:me].filter(e=>!!e)});e.common.issues.push(r)}var ye=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return be;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return be;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},be=Object.freeze({status:`aborted`}),xe=e=>({status:`dirty`,value:e}),Se=e=>({status:`valid`,value:e}),Ce=e=>e.status===`aborted`,we=e=>e.status===`dirty`,Te=e=>e.status===`valid`,Ee=e=>typeof Promise<`u`&&e instanceof Promise,De;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(De||={});var Oe=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ke=(e,t)=>{if(Te(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new pe(e.common.issues);return this._error=t,this._error}}};function Ae(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var je=class{get description(){return this._def.description}_getType(e){return de(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:de(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ye,ctx:{common:e.parent.common,data:e.data,parsedType:de(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ee(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:de(e)};return ke(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:de(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Te(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Te(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:de(e)},r=this._parse({data:e,path:n.path,parent:n});return ke(n,await(Ee(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:fe.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new St({schema:this,typeName:jt.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return Ct.create(this,this._def)}nullable(){return wt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ot.create(this)}promise(){return xt.create(this,this._def)}or(e){return lt.create([this,e],this._def)}and(e){return ft.create(this,e,this._def)}transform(e){return new St({...Ae(this._def),schema:this,typeName:jt.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new Tt({...Ae(this._def),innerType:this,defaultValue:t,typeName:jt.ZodDefault})}brand(){return new Ot({typeName:jt.ZodBranded,type:this,...Ae(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Et({...Ae(this._def),innerType:this,catchValue:t,typeName:jt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return kt.create(this,e)}readonly(){return At.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Me=/^c[^\s-]{8,}$/i,Ne=/^[0-9a-z]+$/,Pe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Fe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ie=/^[a-z0-9_-]{21}$/i,Le=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Re=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ze=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Be=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,Ve,He=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ue=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,We=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,eee=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tee=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nee=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ge=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,ree=RegExp(`^${Ge}$`);function Ke(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function iee(e){return RegExp(`^${Ke(e)}$`)}function aee(e){let t=`${Ge}T${Ke(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function oee(e,t){return!((t!==`v4`&&t||!He.test(e))&&(t!==`v6`&&t||!We.test(e)))}function see(e,t){if(!Le.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function cee(e,t){return!((t!==`v4`&&t||!Ue.test(e))&&(t!==`v6`&&t||!eee.test(e)))}var qe=class e extends je{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ue.string){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.string,received:t.parsedType}),be}let t=new ye,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?ve(n,{code:fe.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&ve(n,{code:fe.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)ze.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`email`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)Ve||=new RegExp(Be,`u`),Ve.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`emoji`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)Fe.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`uuid`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)Ie.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`nanoid`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)Me.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`cuid`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)Ne.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`cuid2`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)Pe.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`ulid`,code:fe.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),ve(n,{validation:`url`,code:fe.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`regex`,code:fe.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?aee(r).test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?ree.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?iee(r).test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?Re.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`duration`,code:fe.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?oee(e.data,r.version)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`ip`,code:fe.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?see(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`jwt`,code:fe.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?cee(e.data,r.version)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`cidr`,code:fe.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?tee.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`base64`,code:fe.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?nee.test(e.data)||(n=this._getOrReturnCtx(e,n),ve(n,{validation:`base64url`,code:fe.invalid_string,message:r.message}),t.dirty()):ce.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:fe.invalid_string,...De.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...De.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...De.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...De.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...De.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...De.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...De.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...De.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...De.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...De.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...De.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...De.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...De.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...De.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...De.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...De.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...De.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...De.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...De.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...De.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...De.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...De.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...De.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...De.errToObj(t)})}nonempty(e){return this.min(1,De.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};qe.create=e=>new qe({checks:[],typeName:jt.ZodString,coerce:e?.coerce??!1,...Ae(e)});function Je(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Ye=class e extends je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ue.number){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.number,received:t.parsedType}),be}let t,n=new ye;for(let r of this._def.checks)r.kind===`int`?ce.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Je(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.not_finite,message:r.message}),n.dirty()):ce.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,De.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,De.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,De.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,De.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:De.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:De.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:De.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:De.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:De.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:De.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:De.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:De.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:De.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&ce.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Ye.create=e=>new Ye({checks:[],typeName:jt.ZodNumber,coerce:e?.coerce||!1,...Ae(e)});var Xe=class e extends je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ue.bigint)return this._getInvalidInput(e);let t,n=new ye;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ve(t,{code:fe.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):ce.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.bigint,received:t.parsedType}),be}gte(e,t){return this.setLimit(`min`,e,!0,De.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,De.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,De.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,De.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:De.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:De.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:De.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:De.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:De.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Xe.create=e=>new Xe({checks:[],typeName:jt.ZodBigInt,coerce:e?.coerce??!1,...Ae(e)});var Ze=class extends je{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ue.boolean){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.boolean,received:t.parsedType}),be}return Se(e.data)}};Ze.create=e=>new Ze({typeName:jt.ZodBoolean,coerce:e?.coerce||!1,...Ae(e)});var Qe=class e extends je{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ue.date){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.date,received:t.parsedType}),be}if(Number.isNaN(e.data.getTime()))return ve(this._getOrReturnCtx(e),{code:fe.invalid_date}),be;let t=new ye,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),ve(n,{code:fe.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):ce.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:De.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:De.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Qe.create=e=>new Qe({checks:[],coerce:e?.coerce||!1,typeName:jt.ZodDate,...Ae(e)});var $e=class extends je{_parse(e){if(this._getType(e)!==ue.symbol){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.symbol,received:t.parsedType}),be}return Se(e.data)}};$e.create=e=>new $e({typeName:jt.ZodSymbol,...Ae(e)});var et=class extends je{_parse(e){if(this._getType(e)!==ue.undefined){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.undefined,received:t.parsedType}),be}return Se(e.data)}};et.create=e=>new et({typeName:jt.ZodUndefined,...Ae(e)});var tt=class extends je{_parse(e){if(this._getType(e)!==ue.null){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.null,received:t.parsedType}),be}return Se(e.data)}};tt.create=e=>new tt({typeName:jt.ZodNull,...Ae(e)});var nt=class extends je{constructor(){super(...arguments),this._any=!0}_parse(e){return Se(e.data)}};nt.create=e=>new nt({typeName:jt.ZodAny,...Ae(e)});var rt=class extends je{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Se(e.data)}};rt.create=e=>new rt({typeName:jt.ZodUnknown,...Ae(e)});var it=class extends je{_parse(e){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.never,received:t.parsedType}),be}};it.create=e=>new it({typeName:jt.ZodNever,...Ae(e)});var at=class extends je{_parse(e){if(this._getType(e)!==ue.undefined){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.void,received:t.parsedType}),be}return Se(e.data)}};at.create=e=>new at({typeName:jt.ZodVoid,...Ae(e)});var ot=class e extends je{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==ue.array)return ve(t,{code:fe.invalid_type,expected:ue.array,received:t.parsedType}),be;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(ve(t,{code:e?fe.too_big:fe.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(ve(t,{code:fe.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(ve(t,{code:fe.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Oe(t,e,t.path,n)))).then(e=>ye.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new Oe(t,e,t.path,n)));return ye.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:De.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:De.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:De.toString(n)}})}nonempty(e){return this.min(1,e)}};ot.create=(e,t)=>new ot({type:e,minLength:null,maxLength:null,exactLength:null,typeName:jt.ZodArray,...Ae(t)});function st(e){if(e instanceof ct){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Ct.create(st(r))}return new ct({...e._def,shape:()=>t})}return e instanceof ot?new ot({...e._def,type:st(e.element)}):e instanceof Ct?Ct.create(st(e.unwrap())):e instanceof wt?wt.create(st(e.unwrap())):e instanceof pt?pt.create(e.items.map(e=>st(e))):e}var ct=class e extends je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=ce.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ue.object){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.object,received:t.parsedType}),be}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof it&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new Oe(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof it){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(ve(n,{code:fe.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new Oe(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>ye.mergeObjectSync(t,e)):ye.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:De.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:jt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of ce.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of ce.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return st(this)}partial(t){let n={};for(let e of ce.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of ce.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Ct;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return vt(ce.objectKeys(this.shape))}};ct.create=(e,t)=>new ct({shape:()=>e,unknownKeys:`strip`,catchall:it.create(),typeName:jt.ZodObject,...Ae(t)}),ct.strictCreate=(e,t)=>new ct({shape:()=>e,unknownKeys:`strict`,catchall:it.create(),typeName:jt.ZodObject,...Ae(t)}),ct.lazycreate=(e,t)=>new ct({shape:e,unknownKeys:`strip`,catchall:it.create(),typeName:jt.ZodObject,...Ae(t)});var lt=class extends je{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new pe(e.ctx.common.issues));return ve(t,{code:fe.invalid_union,unionErrors:n}),be}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new pe(e));return ve(t,{code:fe.invalid_union,unionErrors:i}),be}}get options(){return this._def.options}};lt.create=(e,t)=>new lt({options:e,typeName:jt.ZodUnion,...Ae(t)});var ut=e=>e instanceof gt?ut(e.schema):e instanceof St?ut(e.innerType()):e instanceof _t?[e.value]:e instanceof yt?e.options:e instanceof bt?ce.objectValues(e.enum):e instanceof Tt?ut(e._def.innerType):e instanceof et?[void 0]:e instanceof tt?[null]:e instanceof Ct?[void 0,...ut(e.unwrap())]:e instanceof wt?[null,...ut(e.unwrap())]:e instanceof Ot||e instanceof At?ut(e.unwrap()):e instanceof Et?ut(e._def.innerType):[],lee=class e extends je{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.object)return ve(t,{code:fe.invalid_type,expected:ue.object,received:t.parsedType}),be;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ve(t,{code:fe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=ut(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:jt.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Ae(r)})}};function dt(e,t){let n=de(e),r=de(t);if(e===t)return{valid:!0,data:e};if(n===ue.object&&r===ue.object){let n=ce.objectKeys(t),r=ce.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=dt(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===ue.array&&r===ue.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=dt(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===ue.date&&r===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ft=class extends je{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Ce(e)||Ce(r))return be;let i=dt(e.value,r.value);return i.valid?((we(e)||we(r))&&t.dirty(),{status:t.value,value:i.data}):(ve(n,{code:fe.invalid_intersection_types}),be)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ft.create=(e,t,n)=>new ft({left:e,right:t,typeName:jt.ZodIntersection,...Ae(n)});var pt=class e extends je{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.array)return ve(n,{code:fe.invalid_type,expected:ue.array,received:n.parsedType}),be;if(n.data.length<this._def.items.length)return ve(n,{code:fe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),be;!this._def.rest&&n.data.length>this._def.items.length&&(ve(n,{code:fe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new Oe(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>ye.mergeArray(t,e)):ye.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};pt.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new pt({items:e,typeName:jt.ZodTuple,rest:null,...Ae(t)})};var uee=class e extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.object)return ve(n,{code:fe.invalid_type,expected:ue.object,received:n.parsedType}),be;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new Oe(n,e,n.path,e)),value:a._parse(new Oe(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?ye.mergeObjectAsync(t,r):ye.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof je?new e({keyType:t,valueType:n,typeName:jt.ZodRecord,...Ae(r)}):new e({keyType:qe.create(),valueType:t,typeName:jt.ZodRecord,...Ae(n)})}},mt=class extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.map)return ve(n,{code:fe.invalid_type,expected:ue.map,received:n.parsedType}),be;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Oe(n,e,n.path,[a,`key`])),value:i._parse(new Oe(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return be;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return be;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};mt.create=(e,t,n)=>new mt({valueType:t,keyType:e,typeName:jt.ZodMap,...Ae(n)});var ht=class e extends je{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ue.set)return ve(n,{code:fe.invalid_type,expected:ue.set,received:n.parsedType}),be;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(ve(n,{code:fe.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(ve(n,{code:fe.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return be;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new Oe(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:De.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:De.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ht.create=(e,t)=>new ht({valueType:e,minSize:null,maxSize:null,typeName:jt.ZodSet,...Ae(t)});var dee=class e extends je{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.function)return ve(t,{code:fe.invalid_type,expected:ue.function,received:t.parsedType}),be;function n(e,n){return _e({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ge(),me].filter(e=>!!e),issueData:{code:fe.invalid_arguments,argumentsError:n}})}function r(e,n){return _e({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ge(),me].filter(e=>!!e),issueData:{code:fe.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof xt){let e=this;return Se(async function(...t){let o=new pe([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return Se(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new pe([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new pe([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:pt.create(t).rest(rt.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||pt.create([]).rest(rt.create()),returns:n||rt.create(),typeName:jt.ZodFunction,...Ae(r)})}},gt=class extends je{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};gt.create=(e,t)=>new gt({getter:e,typeName:jt.ZodLazy,...Ae(t)});var _t=class extends je{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return ve(t,{received:t.data,code:fe.invalid_literal,expected:this._def.value}),be}return{status:`valid`,value:e.data}}get value(){return this._def.value}};_t.create=(e,t)=>new _t({value:e,typeName:jt.ZodLiteral,...Ae(t)});function vt(e,t){return new yt({values:e,typeName:jt.ZodEnum,...Ae(t)})}var yt=class e extends je{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return ve(t,{expected:ce.joinValues(n),received:t.parsedType,code:fe.invalid_type}),be}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return ve(t,{received:t.data,code:fe.invalid_enum_value,options:n}),be}return Se(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};yt.create=vt;var bt=class extends je{_parse(e){let t=ce.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ue.string&&n.parsedType!==ue.number){let e=ce.objectValues(t);return ve(n,{expected:ce.joinValues(e),received:n.parsedType,code:fe.invalid_type}),be}if(this._cache||=new Set(ce.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=ce.objectValues(t);return ve(n,{received:n.data,code:fe.invalid_enum_value,options:e}),be}return Se(e.data)}get enum(){return this._def.values}};bt.create=(e,t)=>new bt({values:e,typeName:jt.ZodNativeEnum,...Ae(t)});var xt=class extends je{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==ue.promise&&t.common.async===!1?(ve(t,{code:fe.invalid_type,expected:ue.promise,received:t.parsedType}),be):Se((t.parsedType===ue.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};xt.create=(e,t)=>new xt({type:e,typeName:jt.ZodPromise,...Ae(t)});var St=class extends je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===jt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{ve(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return be;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?be:r.status===`dirty`||t.value===`dirty`?xe(r.value):r});{if(t.value===`aborted`)return be;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?be:r.status===`dirty`||t.value===`dirty`?xe(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?be:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?be:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Te(e))return be;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Te(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):be)}ce.assertNever(r)}};St.create=(e,t,n)=>new St({schema:e,typeName:jt.ZodEffects,effect:t,...Ae(n)}),St.createWithPreprocess=(e,t,n)=>new St({schema:t,effect:{type:`preprocess`,transform:e},typeName:jt.ZodEffects,...Ae(n)});var Ct=class extends je{_parse(e){return this._getType(e)===ue.undefined?Se(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ct.create=(e,t)=>new Ct({innerType:e,typeName:jt.ZodOptional,...Ae(t)});var wt=class extends je{_parse(e){return this._getType(e)===ue.null?Se(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};wt.create=(e,t)=>new wt({innerType:e,typeName:jt.ZodNullable,...Ae(t)});var Tt=class extends je{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===ue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Tt.create=(e,t)=>new Tt({innerType:e,typeName:jt.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...Ae(t)});var Et=class extends je{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ee(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new pe(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new pe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Et.create=(e,t)=>new Et({innerType:e,typeName:jt.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...Ae(t)});var Dt=class extends je{_parse(e){if(this._getType(e)!==ue.nan){let t=this._getOrReturnCtx(e);return ve(t,{code:fe.invalid_type,expected:ue.nan,received:t.parsedType}),be}return{status:`valid`,value:e.data}}};Dt.create=e=>new Dt({typeName:jt.ZodNaN,...Ae(e)});var Ot=class extends je{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},kt=class e extends je{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?be:e.status===`dirty`?(t.dirty(),xe(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?be:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:jt.ZodPipeline})}},At=class extends je{_parse(e){let t=this._def.innerType._parse(e),n=e=>(Te(e)&&(e.value=Object.freeze(e.value)),e);return Ee(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};At.create=(e,t)=>new At({innerType:e,typeName:jt.ZodReadonly,...Ae(t)}),ct.lazycreate;var jt;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(jt||={}),qe.create,Ye.create,Dt.create,Xe.create,Ze.create,Qe.create,$e.create,et.create,tt.create,nt.create,rt.create,it.create,at.create,ot.create;var fee=ct.create;ct.strictCreate,lt.create,lee.create,ft.create,pt.create,uee.create,mt.create,ht.create,dee.create,gt.create,_t.create,yt.create,bt.create,xt.create,St.create,Ct.create,wt.create,St.createWithPreprocess,kt.create;function Mt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Nt(e,t=`|`){return e.map(e=>Zt(e)).join(t)}function Pt(e,t){return typeof t==`bigint`?t.toString():t}var pee=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Ft(e){return new pee(e)}function mee(e){return e==null}function It(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function hee(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Lt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Rt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function zt(e){return Rt(e._zod.def)??e._zod.def.shape}function Bt(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Lt(this,t,e),e},enumerable:!0,configurable:!0})}function Vt(e,t,n){t in e?Lt(e,t,n):e[t]=n}function Ht(e,t,n,r){let i=zt(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Bt(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Vt(e,a,r?r(n.value,a):n.value))}}function gee(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Bt(e,n,()=>t[n]):Vt(e,n,r.value))}}function Ut(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function _ee(e){return JSON.stringify(e)}function vee(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Wt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Gt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var yee=Ft(()=>{if(Cn.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Kt(e){if(Gt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Gt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function qt(e){return Kt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var bee=new Set([`string`,`number`,`symbol`]);function Jt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Yt(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Xt(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Zt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function xee(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var See={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Cee={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function wee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Ht(i,e,Qt(e,t)),Yt(e,Ut(n,{shape:i,checks:[]}))}function Qt(e,t){let n=zt(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Tee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Qt(e,t)),a={};return Ht(a,e,Reflect.ownKeys(zt(e)).filter(e=>!i.has(e))),Yt(e,Ut(n,{shape:a,checks:[]}))}function Eee(e,t){if(!Kt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=zt(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Yt(e,Ut(e._zod.def,{shape:$t(e,t)}))}function $t(e,t){let n={};return Ht(n,e,Reflect.ownKeys(zt(e))),gee(n,t),n}function Dee(e,t){if(!Kt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Yt(e,Ut(e._zod.def,{shape:$t(e,t)}))}function Oee(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Ht(n,e,Reflect.ownKeys(zt(e))),Ht(n,t,Reflect.ownKeys(zt(t))),Yt(e,Ut(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function en(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Qt(t,n)):void 0,o={};return Ht(o,t,Reflect.ownKeys(zt(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Yt(t,Ut(t._zod.def,{shape:o,checks:[]}))}function kee(e,t,n){let r=n?new Set(Qt(t,n)):void 0,i={};return Ht(i,t,Reflect.ownKeys(zt(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Yt(t,Ut(t._zod.def,{shape:i}))}function tn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Aee(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function nn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function rn(e){return typeof e==`string`?e:e?.message}function an(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function on(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:rn(e.inst?._zod.def?.error?.(e))??rn(a?.(e))??rn(t?.error?.(e))??rn(n.customError?.(e))??rn(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var jee=/[\uD800-\uDBFF]/;function sn(e){let t=e.length;if(!jee.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function cn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Mee(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function ln(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Nee(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Pee(e,n,r.value)}}function un(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function dn(e,t,n){return un(e,t,n,!1)}function fn(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return un(this,n,r(this))},set(e){un(this,n,e)}})}return t}function Pee(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:un(this,t,n.bind(this))},set(e){un(this,t,e)}})}function Fee(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var pn,mn=!1,Iee={configurable:!0,get(){mn=!0}};function hn(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&pn!==e._zod?pn=void 0:(pn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Iee);let e=mn;mn=!1;try{let r=n(this);return mn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),mn||=e,r}catch(n){throw delete this[t],mn||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function gn(e,t,n,r){let i=Fee(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Lee=`~constantCatch`;function Ree(e){let t=()=>e;return t[Lee]=!0,t}var _n,vn={value:void 0,enumerable:!1},yn=`captureStackTrace`in Error?Error:null;function zee(e){let t=yn;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return yn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function bn(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){vn.value=new a(r);try{Object.defineProperty(n,"_zod",vn)}finally{vn.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Nee(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?zee(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var xn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Sn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(_n=globalThis).__zod_globalConfig??(_n.__zod_globalConfig={});var Cn=globalThis.__zod_globalConfig;function wn(e){return e&&Object.assign(Cn,e),Cn}function Bee(){let e=this._zod;return e.message??=JSON.stringify(e.def,Pt,2),e.message}function Vee(e){this._zod.message=e}var Hee={get:Bee,set:Vee,enumerable:!0,configurable:!0},Tn={value:void 0,enumerable:!1},En=new WeakSet([Object.prototype,Error.prototype]),Dn=(e,t)=>{e.name=`$ZodError`,Tn.value=t,Object.defineProperty(e,"issues",Tn),Tn.value=void 0,Object.defineProperty(e,"message",Hee);let n=Object.getPrototypeOf(e);En.has(n)||(En.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Uee=bn(`$ZodError`,Dn),On=bn(`$ZodError`,Dn,void 0,{Parent:Error});function Wee(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Gee(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Wee(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Kee(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function kn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var An=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new xn;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>on(e,o,wn())));throw Wt(n,a?.callee??t),n}return s.value};return t},qee=An(On),jn=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>on(e,o,wn())));throw Wt(n,a?.callee??t),n}return s.value};return t},Jee=jn(On),Mn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new xn;return a.issues.length?Pn(e,a.issues,i):{success:!0,data:a.value}},Nn=Mn(On);function Pn(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>on(e,n,wn()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Fn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Pn(e,a.issues,i):{success:!0,data:a.value}},In=Fn(On),Yee=Symbol.for(`zod.compile.invalid`),Xee=Symbol.for(`zod.compile.fallback`),Zee=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Yee)return!0;if(r.definite===!0&&n===void 0)return!1}return Qee(e,t,n)});function Qee(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Xee]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new xn;return a.issues.length===0}var $ee=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ete=e=>{let t=An(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,kn(n,a))};return n},tte=e=>{let t=An(e),n=(e,r,i,a)=>t(e,r,i,kn(n,a));return n},nte=e=>{let t=jn(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,kn(n,a))};return n},rte=e=>{let t=jn(e),n=async(e,r,i,a)=>await t(e,r,i,kn(n,a));return n},ite=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Mn(e)(t,n,i)},ate=e=>(t,n,r)=>Mn(e)(t,n,r),ote=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Fn(e)(t,n,i)},ste=e=>async(t,n,r)=>Fn(e)(t,n,r),cte=/^[cC][0-9a-z]{6,}$/,lte=/^[0-9a-z]+$/,ute=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,dte=/^[0-9a-vA-V]{20}$/,fte=/^[A-Za-z0-9]{27}$/,pte=/^[a-zA-Z0-9_-]{21}$/;function mte(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var hte=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,gte=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ln=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,_te=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vte=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function yte(){return new RegExp(vte,`u`)}var bte=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,xte=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ste=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Cte=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wte=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Tte=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ete=/^https?$/,Dte=/^\+[1-9]\d{6,14}$/,Rn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Ote(e){return RegExp(`^${e}$`)}var kte=Ote(Rn);function zn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ate(e){return RegExp(`^${zn(e)}$`)}function jte(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${zn({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${zn({precision:e.precision})}`:n;return RegExp(`^${Rn}T(?:${r})$`)}var Mte=/^[\s\S]{0,}$/,Nte=/^-?\d+$/,Bn=/^-?\d+(?:\.\d+)?$/,Pte=/^(?:true|false)$/i,Fte=/^null$/i,Ite=/^[^A-Z]*$/,Lte=/^[^a-z]*$/,Vn=bn(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Hn=e=>{let t=e.value;return!mee(t)&&t.length!==void 0},Un={number:`number`,bigint:`bigint`,object:`date`},Wn=bn(`$ZodCheckLessThan`,(e,t)=>{Vn.init(e,t);let n=Un[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Un[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Gn=bn(`$ZodCheckGreaterThan`,(e,t)=>{Vn.init(e,t);let n=Un[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Un[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Rte=bn(`$ZodCheckMultipleOf`,(e,t)=>{Vn.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):hee(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),zte=bn(`$ZodCheckNumberFormat`,(e,t)=>{Vn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=See[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Bte=bn(`$ZodCheckMaxLength`,(e,t)=>{var n;Vn.init(e,t),(n=e._zod.def).when??(n.when=Hn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?sn(r):i)<=t.maximum)return;let a=cn(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Vte=bn(`$ZodCheckMinLength`,(e,t)=>{var n;Vn.init(e,t),(n=e._zod.def).when??(n.when=Hn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?sn(r):i)>=t.minimum)return;let a=cn(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Hte=bn(`$ZodCheckLengthEquals`,(e,t)=>{var n;Vn.init(e,t),(n=e._zod.def).when??(n.when=Hn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?sn(r):i;if(a===t.length)return;let o=cn(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Kn=bn(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Vn.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ute=bn(`$ZodCheckRegex`,(e,t)=>{Kn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Wte=bn(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ite,Kn.init(e,t)}),Gte=bn(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Lte,Kn.init(e,t)}),Kte=bn(`$ZodCheckIncludes`,(e,t)=>{Vn.init(e,t);let n=Jt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),qte=bn(`$ZodCheckStartsWith`,(e,t)=>{Vn.init(e,t);let n=RegExp(`^${Jt(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Jte=bn(`$ZodCheckEndsWith`,(e,t)=>{Vn.init(e,t);let n=RegExp(`.*${Jt(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Yte=bn(`$ZodCheckOverwrite`,(e,t)=>{Vn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Xte=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
1427
1427
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
1428
1428
  `)}\n};`)(...Object.values(this.closed))}},Zte={major:4,minor:6,patch:5},qn=bn(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Zte;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=tn(t),a;for(let o of n){if(o._zod.def.when){if(Aee(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new xn;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(an(t.issues,n,e),i||=tn(t,n))});else{if(t.issues.length===n)continue;an(t.issues,n,e),i||=tn(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(tn(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new xn;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new xn;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return dn(this,`~standard`,Yn(this))},set"~standard"(e){un(this,`~standard`,e)}}),Jn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>on(e,t,wn()))}:{value:e.value};async function Qte(e,t){let n={async:!0};return Jn(await e._zod.run({value:t,issues:[]},n),n)}function Yn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Jn(r,n)}catch{}return Qte(e,t)},vendor:`zod`,version:1}}var Xn=bn(`$ZodString`,(e,t)=>{qn.init(e,t),e._zod.pattern=t.pattern??Mte,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Zn=bn(`$ZodStringFormat`,(e,t)=>{Kn.init(e,t),Xn.init(e,t)}),$te=bn(`$ZodGUID`,(e,t)=>{t.pattern??=gte,Zn.init(e,t)}),ene=bn(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ln(e)}else t.pattern??=Ln();Zn.init(e,t)}),Qn=bn(`$ZodEmail`,(e,t)=>{t.pattern??=_te,Zn.init(e,t)});function $n(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function tne(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?$n(e)||2:nne(e,t)}function nne(e,t){if(!t.normalize&&t.protocol?.source===Ete.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var rne=/[\t\n\r]/g;function er(e){return e.replace(rne,``)}function ine(e,t){return t.lastIndex=0,t.test(e.hostname)}function ane(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var one=bn(`$ZodURL`,(e,t)=>{Zn.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=tne(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=er(r);return}t.hostname&&!ine(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!ane(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:er(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),sne=bn(`$ZodEmoji`,(e,t)=>{t.pattern??=yte(),Zn.init(e,t)}),tr=bn(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?pte:mte(t.length),Zn.init(e,t)}),nr=bn(`$ZodCUID`,(e,t)=>{t.pattern??=cte,Zn.init(e,t)}),cne=bn(`$ZodCUID2`,(e,t)=>{t.pattern??=lte,Zn.init(e,t)}),rr=bn(`$ZodULID`,(e,t)=>{t.pattern??=ute,Zn.init(e,t)}),lne=bn(`$ZodXID`,(e,t)=>{t.pattern??=dte,Zn.init(e,t)}),une=bn(`$ZodKSUID`,(e,t)=>{t.pattern??=fte,Zn.init(e,t)}),dne=bn(`$ZodISODateTime`,(e,t)=>{t.pattern??=jte(t),Zn.init(e,t)}),fne=bn(`$ZodISODate`,(e,t)=>{t.pattern??=kte,Zn.init(e,t)}),pne=bn(`$ZodISOTime`,(e,t)=>{t.pattern??=Ate(t),Zn.init(e,t)}),mne=bn(`$ZodISODuration`,(e,t)=>{t.pattern??=hte,Zn.init(e,t)}),ir=bn(`$ZodIPv4`,(e,t)=>{t.pattern??=bte,Zn.init(e,t)}),ar=/^[0-9a-fA-F:.]+$/;function or(e){return ar.test(e)?$n(`http://[${e}]`):!1}var sr=bn(`$ZodIPv6`,(e,t)=>{t.pattern??=xte,Zn.init(e,t),e._zod.check=n=>{or(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),cr=bn(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ste,Zn.init(e,t)});function hne(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:or(n)}var gne=bn(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Cte,Zn.init(e,t),e._zod.check=n=>{hne(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function lr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ur=/^[0-9a-zA-Z+/]*={0,2}$/,_ne=bn(`$ZodBase64`,(e,t)=>{t.pattern??=ur,Zn.init(e,t),e._zod.check=n=>{lr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),dr=/^[A-Za-z0-9_-]*$/;function vne(e){if(!dr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return lr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var yne=bn(`$ZodBase64URL`,(e,t)=>{t.pattern??=dr,Zn.init(e,t),e._zod.check=n=>{vne(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),bne=bn(`$ZodE164`,(e,t)=>{t.pattern??=Dte,Zn.init(e,t)});function xne(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Sne=bn(`$ZodJWT`,(e,t)=>{Zn.init(e,t),e._zod.check=n=>{xne(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),fr=bn(`$ZodNumber`,(e,t)=>{qn.init(e,t),e._zod.pattern=Bn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Cne=bn(`$ZodNumberFormat`,(e,t)=>{zte.init(e,t),fr.init(e,t)}),wne=bn(`$ZodBoolean`,(e,t)=>{qn.init(e,t),e._zod.pattern=Pte,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),pr=bn(`$ZodNull`,(e,t)=>{qn.init(e,t),e._zod.pattern=Fte,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Tne=bn(`$ZodUnknown`,(e,t)=>{qn.init(e,t),e._zod.parse=e=>e}),Ene=bn(`$ZodNever`,(e,t)=>{qn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function mr(e,t,n){e.issues.length&&t.issues.push(...nn(n,e.issues)),t.value[n]=e.value}var Dne=bn(`$ZodArray`,(e,t)=>{qn.init(e,t);let n=Cn.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>mr(t,r,e)));else if(mr(c,r,e),s&&c.issues.length!==0&&tn(c))break}return o.length?Promise.all(o).then(()=>r):r}});function hr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...nn(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var One=[];function kne(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:One,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=xee(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Ane(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(tn(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>hr(e,n,i,t,d,f))):hr(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var gr=bn(`$ZodObject`,(e,t)=>{qn.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Ft(()=>kne(t));hn(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Lt(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Gt,o=t.catchall,s,c=Cn.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(tn(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>hr(n,t,e,r,a,o))):hr(s,t,e,r,a,o)}return o?Ane(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),jne=bn(`$ZodObjectJIT`,(e,t)=>{gr.init(e,t);let n=e._zod.parse,r=Ft(()=>kne(t)),i=Cn.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Xte([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
1429
1429
  let ${e}_ab = false;
@@ -1489,7 +1489,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
1489
1489
  depsCount: ${n},
1490
1490
  deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),Mse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Sc(),n=Cc();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),Nse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ac(),n=Sc(),r=wc(),i=Cc();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1)_(t);else if(o===!1)e.setParams({additionalProperty:t}),e.error(),d||a.break();else if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),Pse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ic(),n=Ac(),r=Cc(),i=Nse();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),Fse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ac(),n=Sc(),r=Cc(),i=Cc();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),Ise=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Cc();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),Lse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:Ac().validateUnion,error:{message:`must match a schema in anyOf`}}})),Rse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Sc(),n=Cc();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),zse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Cc();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),Bse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Sc(),n=Cc(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),Vse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Cc();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),Hse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ese(),n=Ose(),r=Dse(),i=kse(),a=Ase(),o=jse(),s=Mse(),c=Nse(),l=Pse(),u=Fse(),d=Ise(),f=Lse(),p=Rse(),m=zse(),h=Bse(),g=Vse();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),Use=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Sc();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),Wse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[Use().default]})),Gse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),Kse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=mse(),n=Tse(),r=Hse(),i=Wse(),a=Gse();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),qse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),Jse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Sc(),n=qse(),r=zc(),i=Rc(),a=Cc();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),Yse=T({$id:()=>Jc,$schema:()=>qc,default:()=>Xse,definitions:()=>Xc,properties:()=>Qc,title:()=>Yc,type:()=>Zc}),qc,Jc,Yc,Xc,Zc,Qc,Xse,Zse=C((()=>{qc=`http://json-schema.org/draft-07/schema#`,Jc=`http://json-schema.org/draft-07/schema#`,Yc=`Core schema meta-schema`,Xc={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},Zc=[`object`,`boolean`],Qc={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},Xse={$schema:qc,$id:Jc,title:Yc,definitions:Xc,type:Zc,properties:Qc,default:!0}})),$c=w(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=dse(),r=Kse(),i=Jse(),a=(Zse(),ne(Yse).default),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`,c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var l=Ic();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=Sc();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=Lc();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var f=Rc();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})),Qse=w((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:ee,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:y,int32:{type:`number`,validate:S},int64:{type:`number`,validate:C},float:{type:`number`,validate:w},double:{type:`number`,validate:w},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-+(d<0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}var d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}var h=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(e){return h.test(e)&&g.test(e)}var v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(e){return v.lastIndex=0,v.test(e)}var b=-(2**31),x=2**31-1;function S(e){return Number.isInteger(e)&&e<=x&&e>=b}function C(e){return Number.isInteger(e)}function w(){return!0}var T=/[^\\]\\Z/;function ee(e){if(T.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),$se=w((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;var t=$c(),n=Sc(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),ece=w(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=Qse(),r=$se(),i=Sc(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s})),tce=te($c(),1),nce=te(ece(),1);function rce(){let e=new tce.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,nce.default)(e),e}var ice=class{constructor(e){this._ajv=e??rce()}getValidator(e){let t=`$id`in e&&typeof e.$id==`string`?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}},ace=class{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return this.requestStream({method:`sampling/createMessage`,params:e},Ss,t)}elicitInputStream(e,t){let n=this._server.getClientCapabilities(),r=e.mode??`form`;switch(r){case`url`:if(!n?.elicitation?.url)throw Error(`Client does not support url elicitation.`);break;case`form`:if(!n?.elicitation?.form)throw Error(`Client does not support form elicitation.`)}let i=r===`form`&&e.mode===void 0?{...e,mode:`form`}:e;return this.requestStream({method:`elicitation/create`,params:i},ks,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}};function oce(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);if(t===`tools/call`&&!e.tools?.call)throw Error(`${n} does not support task creation for tools/call (required for ${t})`)}function sce(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case`sampling/createMessage`:if(!e.sampling?.createMessage)throw Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case`elicitation/create`:if(!e.elicitation?.create)throw Error(`${n} does not support task creation for elicitation/create (required for ${t})`)}}var cce=class extends nse{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(hs.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new ice,this.setRequestHandler(To,e=>this._oninitialize(e)),this.setNotificationHandler(Eo,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(_s,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=hs.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||={tasks:new ace(this)},this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=yc(this._capabilities,e)}setRequestHandler(e,t){let n=la(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let r=fa(n);if(typeof r!=`string`)throw Error(`Schema method literal must be a string`);return r===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let r=sa(ms,e);if(!r.success){let e=r.error instanceof Error?r.error.message:String(r.error);throw new Ps(vo.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:i}=r.data,a=await Promise.resolve(t(e,n));if(i.task){let e=sa(Mo,a);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new Ps(vo.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let o=sa(ps,a);if(!o.success){let e=o.error instanceof Error?o.error.message:String(o.error);throw new Ps(vo.InvalidParams,`Invalid tools/call result: ${e}`)}return o.data}):super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`completion/complete`:if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){sce(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&oce(this._capabilities.tasks?.requests,e,`Server`)}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:kae.includes(t)?t:$a,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:`ping`},bo)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return e.tools?this.request({method:`sampling/createMessage`,params:e},Cs,t):this.request({method:`sampling/createMessage`,params:e},Ss,t)}async elicitInput(e,t){switch(e.mode??`form`){case`url`:{if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support url elicitation.`);let n=e;return this.request({method:`elicitation/create`,params:n},ks,t)}case`form`:{if(!this._clientCapabilities?.elicitation?.form)throw Error(`Client does not support form elicitation.`);let n=e.mode===`form`?e:{...e,mode:`form`},r=await this.request({method:`elicitation/create`,params:n},ks,t);if(r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new Ps(vo.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof Ps?e:new Ps(vo.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return r}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:`roots/list`,params:e},Ns,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}},el=Symbol.for(`mcp.completable`);function tl(e){return!!e&&typeof e==`object`&&el in e}function lce(e){return e[el]?.complete}var uce;(function(e){e.Completable=`McpCompletable`})(uce||={});var dce=/^[A-Za-z0-9._-]{1,128}$/;function fce(e){let t=[];if(e.length===0)return{isValid:!1,warnings:[`Tool name cannot be empty`]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(` `)&&t.push(`Tool name contains spaces, which may cause parsing issues`),e.includes(`,`)&&t.push(`Tool name contains commas, which may cause parsing issues`),(e.startsWith(`-`)||e.endsWith(`-`))&&t.push(`Tool name starts or ends with a dash, which may cause parsing issues in some contexts`),(e.startsWith(`.`)||e.endsWith(`.`))&&t.push(`Tool name starts or ends with a dot, which may cause parsing issues in some contexts`),!dce.test(e)){let n=e.split(``).filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,n)=>n.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${n.map(e=>`"${e}"`).join(`, `)}`,`Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)`),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function pce(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let e of t)console.warn(` - ${e}`);console.warn(`Tool registration will proceed, but this may cause compatibility issues.`),console.warn(`Consider updating the tool name to conform to the MCP tool naming standard.`),console.warn(`See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.`)}}function nl(e){let t=fce(e);return pce(e,t.warnings),t.isValid}var rl=class{constructor(e){this._mcpServer=e}registerToolTask(e,t,n){let r={taskSupport:`required`,...t.execution};if(r.taskSupport===`forbidden`)throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,r,t._meta,n)}};function mce(e,t){let n=0,r=[e];for(;r.length>0;){let e=r.pop();if(typeof e==`object`&&e){if(Array.isArray(e))for(let i of e){if(++n>t)return n;typeof i==`object`&&i&&r.push(i)}else for(let i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;if(++n>t)return n;let a=e[i];typeof a==`object`&&a&&r.push(a)}}}return n}function hce(e){if(e!==void 0&&e!==1/0){if(typeof e!=`number`||Number.isNaN(e)||e<1)throw RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(e)}`);return e}}var gce=class{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new cce(e,t),this._maxToolInputElements=hce(t?.maxToolInputElements)}get experimental(){return this._experimental||={tasks:new rl(this)},this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||=(this.server.assertCanSetRequestHandler(cl(fs)),this.server.assertCanSetRequestHandler(cl(ms)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(fs,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:(()=>{let e=ua(t.inputSchema);return e?hc(e,{strictUnions:!0,pipeStrategy:`input`}):_ce})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let e=ua(t.outputSchema);e&&(n.outputSchema=hc(e,{strictUnions:!0,pipeStrategy:`output`}))}return n})})),this.server.setRequestHandler(ms,async(e,t)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new Ps(vo.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new Ps(vo.InvalidParams,`Tool ${e.params.name} disabled`);let r=!!e.params.task,i=n.execution?.taskSupport,a=`createTask`in n.handler;if((i===`required`||i===`optional`)&&!a)throw new Ps(vo.InternalError,`Tool ${e.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if(i===`required`&&!r)throw new Ps(vo.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(i===`optional`&&!r&&a)return await this.handleAutomaticTaskPolling(n,e,t);let o=await this.validateToolInput(n,e.params.arguments,e.params.name),s=await this.executeToolHandler(n,o,t);return r||await this.validateToolOutput(n,s,e.params.name),s}catch(e){if(e instanceof Ps&&e.code===vo.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),!0)}createToolError(e){return{content:[{type:`text`,text:e}],isError:!0}}async validateToolInput(e,t,n){if(this._maxToolInputElements!==void 0&&mce(t,this._maxToolInputElements)>this._maxToolInputElements)throw new Ps(vo.InvalidParams,`Invalid arguments for tool ${n}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!e.inputSchema)return;let r=await ca(ua(e.inputSchema)??e.inputSchema,t??{});if(!r.success){let e=da(`error`in r?r.error:`Unknown error`);throw new Ps(vo.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${e}`)}return r.data}async validateToolOutput(e,t,n){if(!e.outputSchema||!(`content`in t)||t.isError)return;if(!t.structuredContent)throw new Ps(vo.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let r=await ca(ua(e.outputSchema),t.structuredContent);if(!r.success){let e=da(`error`in r?r.error:`Unknown error`);throw new Ps(vo.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${e}`)}}async executeToolHandler(e,t,n){let r=e.handler;if(`createTask`in r){if(!n.taskStore)throw Error(`No task store provided.`);let i={...n,taskStore:n.taskStore};if(e.inputSchema){let e=r;return await Promise.resolve(e.createTask(t,i))}{let e=r;return await Promise.resolve(e.createTask(i))}}if(e.inputSchema){let e=r;return await Promise.resolve(e(t,n))}{let e=r;return await Promise.resolve(e(n))}}async handleAutomaticTaskPolling(e,t,n){if(!n.taskStore)throw Error(`No task store provided for task-capable tool.`);let r=await this.validateToolInput(e,t.params.arguments,t.params.name),i=e.handler,a={...n,taskStore:n.taskStore},o=r?await Promise.resolve(i.createTask(r,a)):await Promise.resolve(i.createTask(a)),s=o.task.taskId,c=o.task,l=c.pollInterval??5e3;for(;c.status!==`completed`&&c.status!==`failed`&&c.status!==`cancelled`;){await new Promise(e=>setTimeout(e,l));let e=await n.taskStore.getTask(s);if(!e)throw new Ps(vo.InternalError,`Task ${s} not found during polling`);c=e}return await n.taskStore.getTaskResult(s)}setCompletionRequestHandler(){this._completionHandlerInitialized||=(this.server.assertCanSetRequestHandler(cl(As)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(As,async e=>{switch(e.params.ref.type){case`ref/prompt`:return Ooe(e),this.handlePromptCompletion(e,e.params.ref);case`ref/resource`:return koe(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Ps(vo.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),!0)}async handlePromptCompletion(e,t){let n=this._registeredPrompts[t.name];if(!n)throw new Ps(vo.InvalidParams,`Prompt ${t.name} not found`);if(!n.enabled)throw new Ps(vo.InvalidParams,`Prompt ${t.name} disabled`);if(!n.argsSchema)return ul;let r=la(n.argsSchema)?.[e.params.argument.name];if(!tl(r))return ul;let i=lce(r);return i?ll(await i(e.params.argument.value,e.params.context)):ul}async handleResourceCompletion(e,t){let n=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!n){if(this._registeredResources[t.uri])return ul;throw new Ps(vo.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let r=n.resourceTemplate.completeCallback(e.params.argument.name);return r?ll(await r(e.params.argument.value,e.params.context)):ul}setResourceRequestHandlers(){this._resourceHandlersInitialized||=(this.server.assertCanSetRequestHandler(cl(Yo)),this.server.assertCanSetRequestHandler(cl(Zo)),this.server.assertCanSetRequestHandler(cl(es)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Yo,async(e,t)=>{let n=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),r=[];for(let e of Object.values(this._registeredResourceTemplates)){if(!e.resourceTemplate.listCallback)continue;let n=await e.resourceTemplate.listCallback(t);for(let t of n.resources)r.push({...e.metadata,...t})}return{resources:[...n,...r]}}),this.server.setRequestHandler(Zo,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(es,async(e,t)=>{let n=new URL(e.params.uri),r=this._registeredResources[n.toString()];if(r){if(!r.enabled)throw new Ps(vo.InvalidParams,`Resource ${n} disabled`);return r.readCallback(n,t)}for(let e of Object.values(this._registeredResourceTemplates)){let r=e.resourceTemplate.uriTemplate.match(n.toString());if(r)return e.readCallback(n,r,t)}throw new Ps(vo.InvalidParams,`Resource ${n} not found`)}),!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||=(this.server.assertCanSetRequestHandler(cl(rs)),this.server.assertCanSetRequestHandler(cl(as)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(rs,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?vce(t.argsSchema):void 0}))})),this.server.setRequestHandler(as,async(e,t)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new Ps(vo.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new Ps(vo.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let r=await ca(ua(n.argsSchema),e.params.arguments??{});if(!r.success){let t=da(`error`in r?r.error:`Unknown error`);throw new Ps(vo.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${t}`)}let i=r.data,a=n.callback;return await Promise.resolve(a(i,t))}{let e=n.callback;return await Promise.resolve(e(t))}}),!0)}resource(e,t,...n){let r;typeof n[0]==`object`&&(r=n.shift());let i=n[0];if(typeof t==`string`){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,void 0,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,void 0,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}registerResource(e,t,n,r){if(typeof t==`string`){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,n.title,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,n.title,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(e,t,n,r,i){let a={name:e,title:t,metadata:r,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({uri:null}),update:e=>{e.uri!==void 0&&e.uri!==n&&(delete this._registeredResources[n],e.uri&&(this._registeredResources[e.uri]=a)),e.name!==void 0&&(a.name=e.name),e.title!==void 0&&(a.title=e.title),e.metadata!==void 0&&(a.metadata=e.metadata),e.callback!==void 0&&(a.readCallback=e.callback),e.enabled!==void 0&&(a.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=a,a}_createRegisteredResourceTemplate(e,t,n,r,i){let a={resourceTemplate:n,title:t,metadata:r,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=a)),t.title!==void 0&&(a.title=t.title),t.template!==void 0&&(a.resourceTemplate=t.template),t.metadata!==void 0&&(a.metadata=t.metadata),t.callback!==void 0&&(a.readCallback=t.callback),t.enabled!==void 0&&(a.enabled=t.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=a;let o=n.uriTemplate.variableNames;return Array.isArray(o)&&o.some(e=>!!n.completeCallback(e))&&this.setCompletionRequestHandler(),a}_createRegisteredPrompt(e,t,n,r,i){let a={title:t,description:n,argsSchema:r===void 0?void 0:oa(r),callback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=a)),t.title!==void 0&&(a.title=t.title),t.description!==void 0&&(a.description=t.description),t.argsSchema!==void 0&&(a.argsSchema=oa(t.argsSchema)),t.callback!==void 0&&(a.callback=t.callback),t.enabled!==void 0&&(a.enabled=t.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=a,r&&Object.values(r).some(e=>tl(e instanceof Wa?e._def?.innerType:e))&&this.setCompletionRequestHandler(),a}_createRegisteredTool(e,t,n,r,i,a,o,s,c){nl(e);let l={title:t,description:n,inputSchema:sl(r),outputSchema:sl(i),annotations:a,execution:o,_meta:s,handler:c,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(typeof t.name==`string`&&nl(t.name),delete this._registeredTools[e],t.name&&(this._registeredTools[t.name]=l)),t.title!==void 0&&(l.title=t.title),t.description!==void 0&&(l.description=t.description),t.paramsSchema!==void 0&&(l.inputSchema=oa(t.paramsSchema)),t.outputSchema!==void 0&&(l.outputSchema=oa(t.outputSchema)),t.callback!==void 0&&(l.handler=t.callback),t.annotations!==void 0&&(l.annotations=t.annotations),t._meta!==void 0&&(l._meta=t._meta),t.enabled!==void 0&&(l.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let n,r,i,a;if(typeof t[0]==`string`&&(n=t.shift()),t.length>1){let n=t[0];if(ol(n))r=t.shift(),t.length>1&&typeof t[0]==`object`&&t[0]!==null&&!ol(t[0])&&(a=t.shift());else if(typeof n==`object`&&n){if(Object.values(n).some(e=>typeof e==`object`&&!!e))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);a=t.shift()}}let o=t[0];return this._createRegisteredTool(e,void 0,n,r,i,a,{taskSupport:`forbidden`},void 0,o)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:r,description:i,inputSchema:a,outputSchema:o,annotations:s,_meta:c}=t;return this._createRegisteredTool(e,r,i,a,o,s,{taskSupport:`forbidden`},c,n)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let n;typeof t[0]==`string`&&(n=t.shift());let r;t.length>1&&(r=t.shift());let i=t[0],a=this._createRegisteredPrompt(e,void 0,n,r,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}registerPrompt(e,t,n){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:r,description:i,argsSchema:a}=t,o=this._createRegisteredPrompt(e,r,i,a,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},_ce={type:`object`,properties:{}};function il(e){return typeof e==`object`&&!!e&&`parse`in e&&typeof e.parse==`function`&&`safeParse`in e&&typeof e.safeParse==`function`}function al(e){return`_def`in e||`_zod`in e||il(e)}function ol(e){return typeof e!=`object`||!e||al(e)?!1:Object.keys(e).length===0||Object.values(e).some(il)}function sl(e){if(e){if(ol(e))return oa(e);if(!al(e))throw Error(`inputSchema must be a Zod schema or raw shape, received an unrecognized object`);return e}}function vce(e){let t=la(e);return t?Object.entries(t).map(([e,t])=>({name:e,description:bie(t),required:!xie(t)})):[]}function cl(e){let t=la(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=fa(t);if(typeof n==`string`)return n;throw Error(`Schema method literal must be a string`)}function ll(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var ul={completion:{values:[],hasMore:!1}},yce=class{constructor(e){this._maxBufferSize=e?.maxBufferSize??10485760}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
1491
1491
  `);if(e===-1)return null;let t=this._buffer.toString(`utf8`,0,e).replace(/\r$/,``);return this._buffer=this._buffer.subarray(e+1),bce(t)}clear(){this._buffer=void 0}};function bce(e){return Fae.parse(JSON.parse(e))}function xce(e){return JSON.stringify(e)+`
1492
- `}var Sce=class{constructor(t=e.stdin,n=e.stdout,r){this._stdin=t,this._stdout=n,this._started=!1,this._ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(e){this.onerror?.(e),this.close().catch(()=>{})}},this._onerror=e=>{this.onerror?.(e)},this._readBuffer=new yce({maxBufferSize:r?.maxBufferSize})}async start(){if(this._started)throw Error(`StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.`);this._started=!0,this._stdin.on(`data`,this._ondata),this._stdin.on(`error`,this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off(`data`,this._ondata),this._stdin.off(`error`,this._onerror),this._stdin.listenerCount(`data`)===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let n=xce(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}},dl=`/*ANTU_SPEC*/null`;function fl(e){return String(e).replace(/</g,`\\u003c`)}function Cce(e,t,{preset:n}={}){if(e.split(`/*ANTU_SPEC*/null`).length!==2)throw Error(`the viewer template does not hold exactly one ${dl}`);let r=fl(JSON.stringify(t)),i=n?`;window.__ANTU_PRESET__ = ${fl(JSON.stringify(n))}`:``;return e.replace(dl,()=>r+i)}f(u(h(import.meta.url)),`../..`);var pl=f(u(h(import.meta.url)),`..`);d(pl,`dist-engine/engine.js`),d(pl,`dist-engine/engine.css`);function wce(e){return String(e).replace(/[&<>"]/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`})[e])}function ml(){return`0.15.0`}function Tce(e){return String(e||`antu`).replace(/[\\/:*?"<>|\s]+/g,`-`).slice(0,60)}function Ece(e,{preset:t,force:n=!1,quiet:r=!1}={}){{let n=wce(e?.title||`Antu`);return Cce(i(d(pl,`assets/viewer.html`),`utf8`),e,{preset:t}).replace(/<title>[^<]*<\/title>/,()=>`<title>${n} · Antu</title>`)}}function Dce(e,{outPath:t,preset:r,force:i=!1,quiet:a=!1}={}){let o=Ece(e,{preset:r,force:i,quiet:a}),s=f(t||`${Tce(e?.title)}.html`);return n(u(s),{recursive:!0}),c(s,o),{path:s,bytes:Buffer.byteLength(o)}}var hl=new Map,gl=[`experimental`,`stable`,`deprecated`];function _l(e,t){if(!e)throw Error(`registerKnowledge: type must not be empty`);if(!t?.validate)throw Error(`registerKnowledge: validate is required`);if(!t?.describe)throw Error(`registerKnowledge: describe is required (the agent-facing field table)`);if(!Number.isInteger(t.specVersion)||t.specVersion<1)throw Error(`registerKnowledge: specVersion is required, a whole number (the generation of this type's JSON format, core/specVersion.js)`);Oce(e,t),hl.set(e,t)}function Oce(e,t){let n=Object.keys(t.layouts??{}),r=Object.keys(t.diagrams??{});for(let t of n)if(!r.includes(t))throw Error(`registerKnowledge: ${e}/${t} has a layout but no entry in diagrams (version, status, since)`);for(let t of r)if(!n.includes(t))throw Error(`registerKnowledge: ${e}/${t} is in diagrams but has no layout`);for(let[n,r]of Object.entries(t.diagrams??{})){if(!Number.isInteger(r.version)||r.version<1)throw Error(`registerKnowledge: ${e}/${n}: version must be a whole number >= 1`);if(!gl.includes(r.status))throw Error(`registerKnowledge: ${e}/${n}: status must be one of ${gl.join(`, `)}`);if(!/^\d+\.\d+\.\d+$/.test(r.since??``))throw Error(`registerKnowledge: ${e}/${n}: since must be a release number such as 0.7.0`)}}function kce(e){let t=hl.get(e);return Object.entries(t?.diagrams??{}).map(([t,n])=>({type:e,kind:t,...n}))}function vl(e){return hl.get(e)}function yl(){return[...hl.entries()].map(([e,t])=>({type:e,labelKey:t.label??`graphType.${e}`}))}function Ace(e){return hl.get(e)?.validate}function jce(e,t){let n=hl.get(e)?.layouts;if(n)return t&&n[t]?n[t]:Object.values(n)[0]}function bl(e){return Object.keys(hl.get(e)?.layouts??{})}var xl=e=>({name:`specVersion`,req:`no`,ty:`integer`,note:`which generation of this format the file follows (now ${e}); omit = the current one. Write it: it is how an older file is recognised after a breaking change`});function Mce(e,t){return e.specVersion===void 0?null:!Number.isInteger(e.specVersion)||e.specVersion<1?{key:`err.specVersionForm`,params:{value:JSON.stringify(e.specVersion)}}:Number.isInteger(t)&&e.specVersion>t?{key:`err.specVersionNewer`,params:{value:e.specVersion,known:t,type:e.type}}:null}var Nce=/^(\d{4})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2}))?)?)?)?$/;function Sl(e){let t=Nce.exec(typeof e==`string`?e.trim():``);if(!t)return null;let[n,r,i,a,o,s]=t.slice(1).map(e=>e===void 0?void 0:Number(e)),c=(e,t,n,r,i,a)=>Date.UTC(e,t,n,r,i,a),l,u;return r===void 0?(l=c(n,0,1,0,0,0),u=c(n+1,0,1,0,0,0)):i===void 0?(l=c(n,r-1,1,0,0,0),u=c(n,r,1,0,0,0)):a===void 0?(l=c(n,r-1,i,0,0,0),u=c(n,r-1,i+1,0,0,0)):s===void 0?(l=c(n,r-1,i,a,o,0),u=l+6e4):(l=c(n,r-1,i,a,o,s),u=l+1e3),Number.isNaN(l)?null:{from:l,to:u}}function Pce(e){let t=Sl(e?.date);if(!t)return null;let{from:n,to:r}=t,i=e.dateEnd===void 0?null:Sl(e.dateEnd);if(i&&i.to>n&&(r=Math.max(r,i.to)),e.approx===!0){let e=t.to-t.from;n-=e,r+=e}return{from:n,to:r}}function Fce(e){let t=[],n=null;return(Array.isArray(e?.slots)?e.slots:[]).forEach((e,r)=>{let i=(Array.isArray(e?.events)?e.events:[]).map((e,t)=>({event:e,ei:t,span:Pce(e)})).filter(e=>e.span);if(i.length===0)return;let a={from:Math.min(...i.map(e=>e.span.from)),to:Math.max(...i.map(e=>e.span.to))};if(n&&a.to<=n.span.from){let e=i.find(e=>e.span.to<=n.span.from)??i[0];t.push(se(`note.dateOrder`,{at:`slots[${r}].events[${e.ei}]`,id:e.event.id,date:e.event.date,beforeAt:`slots[${n.si}].events[${n.ei}]`,beforeId:n.event.id,beforeDate:n.event.date}))}let o=i.reduce((e,t)=>t.span.to>e.span.to?t:e);n={span:a,si:r,ei:o.ei,event:o.event}}),t}function Ice(e){let t=Array.isArray(e?.actors)?e.actors:[],n=new Set;for(let t of Array.isArray(e?.slots)?e.slots:[])for(let e of Array.isArray(t?.events)?t.events:[])for(let t of Array.isArray(e?.actorIds)?e.actorIds:[])n.add(t);return t.map((e,t)=>({a:e,i:t})).filter(({a:e})=>e&&typeof e.id==`string`&&!n.has(e.id)).map(({a:e,i:t})=>se(`note.partyNoEvent`,{at:`actors[${t}]`,id:e.id,name:e.name??e.id}))}var Lce=19,Rce=2,zce=18,Cl=6,Bce=16,Vce=11.5,wl=1,Hce=.55;function Tl(e){let t=e.codePointAt(0);return t>=4352&&t<=4447||t>=11904&&t<=42191||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510?wl:Hce}function El(e){let t=0;for(let n of String(e??``))t+=Tl(n);return t}var Dl=(e,t)=>El(e)*t,Uce=262/13;262/Vce;function Ol(e={},t=Rce,n=0){let r=22+Lce*t+Cl+Bce;return e.summary&&(r+=24),e.actors&&n>0&&(r+=zce*n+Cl),r}function kl(e,t,n={}){let r=n.latin??1,i=n.cjk??1;return Al(e,t,e=>{let t=0;for(let n of e)t+=Tl(n)*(Tl(n)===wl?i:r);return t})}function Al(e,t,n){let r=t,i=n,a=String(e??``);if(!a)return 0;let o=a.match(/[^\sᄀ-ᅟ⺀-꓏가-힣豈-﫿︰-﹯＀-⦆¢-₩]+|\s|./gu)||[],s=1,c=0;for(let e of o){let t=i(e);if(/^\s$/.test(e))c>0&&(c+=t);else if(c+t<=r)c+=t;else if(t<=r)s+=+(c>0),c=t;else{c>0&&(s+=1);let e=Math.ceil(t/r);s+=e-1,c=t-(e-1)*r}}return s}var jl={SIDE1:`side1`,AXIS:`axis`,SIDE2:`side2`},Ml=3;function Nl(e){let t=(Array.isArray(e?.actors)?e.actors:[]).filter(e=>Fl(e)&&e.id);if(new Set(t.map(e=>e.id)).size<2)return e=>e?.groupId??null;let n=new Map(t.map(e=>[e.id,e.groupId])),r=(Array.isArray(e?.groups)?e.groups[2]?.id:null)??null;return e=>{let t=Array.isArray(e?.actorIds)?e.actorIds:[];return t.length===1&&n.get(t[0])||r}}var Pl=/^\d{4}(-\d{2}(-\d{2}(T\d{2}(:\d{2}(:\d{2})?)?)?)?)?$/;function Wce(e,t){if(typeof e!=`string`||typeof t!=`string`)return!1;let n=Math.min(e.length,t.length);return e.slice(0,n)<t.slice(0,n)}var Gce=[jl.SIDE1,jl.SIDE2,jl.AXIS];function Fl(e){return e&&typeof e==`object`&&!Array.isArray(e)}function Il(e){let t=[],n=Array.isArray(e?.actors)?e.actors:[],r=Array.isArray(e?.groups)?e.groups:[],i=Array.isArray(e?.sources)?e.sources:[],a=e?.slots,o={errors:t,byActor:!1,sideLabels:{[jl.SIDE1]:``,[jl.SIDE2]:``,[jl.AXIS]:``},columns:[],rows:[],placements:new Map,axisColumnIndex:0,actorById:new Map,groupById:new Map,groupIndexById:new Map,sourceById:new Map,eventCount:0},s=new Map;n.forEach((e,n)=>{Fl(e)?e.id?(s.has(e.id)&&t.push(se(`err.duplicateId`,{at:`actors[${n}]`,id:e.id})),s.set(e.id,e),e.name||t.push(se(`err.required`,{at:`actors[${n}] (${e.id})`,field:`name`}))):t.push(se(`err.required`,{at:`actors[${n}]`,field:`id`})):t.push(se(`err.notObject`,{at:`actors[${n}]`}))}),e?.views!==void 0&&t.push(se(`err.viewsRemoved`));let c=new Map,l=new Map;r.length>Ml&&t.push(se(`err.tooManyGroups`,{at:`groups`,max:Ml,actual:r.length})),r.forEach((e,n)=>{Fl(e)?e.id?(l.has(e.id)&&t.push(se(`err.duplicateId`,{at:`groups[${n}]`,id:e.id})),c.set(e.id,e),l.set(e.id,n),e.label||t.push(se(`err.required`,{at:`groups[${n}] (${e.id})`,field:`label`}))):t.push(se(`err.required`,{at:`groups[${n}]`,field:`id`})):t.push(se(`err.notObject`,{at:`groups[${n}]`}))});let u=s.size>=2,d=new Map;n.forEach((e,n)=>{if(!Fl(e)||!e.id)return;let r=`actors[${n}] (${e.id})`,i=e.groupId!==void 0&&e.groupId!==null&&e.groupId!==``;if(!u){i&&t.push(se(`err.actorGroupOneParty`,{at:r}));return}if(!i){t.push(se(`err.actorNeedsGroup`,{at:r,n:s.size}));return}if(!l.has(e.groupId)){t.push(se(`err.missingRef`,{at:r,field:`groupId`,kind:`group`,id:e.groupId}));return}let a=l.get(e.groupId);a>1?t.push(se(`err.actorGroupNotSide`,{at:r,groupId:e.groupId})):d.set(e.id,a===0?jl.SIDE1:jl.SIDE2)});let f=new Map;if(i.forEach((e,n)=>{Fl(e)?e.id?(f.has(e.id)&&t.push(se(`err.duplicateId`,{at:`sources[${n}]`,id:e.id})),f.set(e.id,e),e.type||t.push(se(`err.required`,{at:`sources[${n}] (${e.id})`,field:`type`})),e.name||t.push(se(`err.required`,{at:`sources[${n}] (${e.id})`,field:`name`}))):t.push(se(`err.required`,{at:`sources[${n}]`,field:`id`})):t.push(se(`err.notObject`,{at:`sources[${n}]`}))}),!Array.isArray(a))return t.push(se(`err.slotNotArray`)),{...o,actorById:s,groupById:c,groupIndexById:l,sourceById:f};a.length===0&&t.push(se(`err.slotsEmpty`));let p=new Set,m={[jl.SIDE1]:new Set,[jl.SIDE2]:new Set},h=[];a.forEach((e,n)=>{let r=`slots[${n}]`;Fl(e)?Array.isArray(e.events)?(e.events.length===0&&t.push(se(`err.slotEventsEmpty`,{at:r})),e.events.forEach((e,i)=>{let a=`${r}.events[${i}]${e?.id?` (${e.id})`:``}`;if(!Fl(e)){t.push(se(`err.notObject`,{at:a}));return}e.id?p.has(e.id)?t.push(se(`err.duplicateId`,{at:a,id:e.id})):p.add(e.id):t.push(se(`err.required`,{at:a,field:`id`})),e.date&&!Pl.test(e.date)&&t.push(se(`err.badDate`,{at:a,field:`date`,value:e.date})),e.label||t.push(se(`err.required`,{at:a,field:`label`})),e.dateEnd!==void 0&&e.dateEnd!==null&&(typeof e.dateEnd!=`string`||!Pl.test(e.dateEnd)?t.push(se(`err.badDate`,{at:a,field:`dateEnd`,value:e.dateEnd})):e.date?Wce(e.dateEnd,e.date)&&t.push(se(`err.dateEndBeforeDate`,{at:a,end:e.dateEnd,start:e.date})):t.push(se(`err.dateEndNeedsDate`,{at:a}))),e.summary!==void 0&&e.summary!==null&&(typeof e.summary==`string`?El(e.summary)>22.782608695652176&&t.push(se(`err.summaryTooLong`,{at:a,max:22,actual:Math.ceil(El(e.summary))})):t.push(se(`err.mustBeString`,{at:a,field:`summary`})));let o=Array.isArray(e.actorIds)?e.actorIds:[];o.forEach(e=>{s.has(e)||t.push(se(`err.missingRef`,{at:a,field:`actorIds`,kind:`actor`,id:e}))});let c=e.groupId!==void 0&&e.groupId!==null&&e.groupId!==``;u&&c?t.push(se(`err.eventGroupWithParties`,{at:a})):c&&!l.has(e.groupId)&&t.push(se(`err.missingRef`,{at:a,field:`groupId`,kind:`group`,id:e.groupId})),(Array.isArray(e.sourceIds)?e.sourceIds:[]).forEach(e=>{f.has(e)||t.push(se(`err.missingRef`,{at:a,field:`sourceIds`,kind:`source`,id:e}))});let g=c?l.get(e.groupId):void 0,_,v=null;if(u)o.length===1&&d.has(o[0])?(_=d.get(o[0]),v=o[0]):_=jl.AXIS;else if(o.length>=2)_=jl.AXIS,(g===0||g===1)&&t.push(se(`err.multiActorNeedsAxis`,{at:a,n:o.length,groupId:e.groupId}));else if(!c)_=jl.AXIS;else if(g===void 0)return;else _=Gce[g]??jl.AXIS;!u&&_!==jl.AXIS&&o.length!==1?t.push(se(`err.groupNeedsOneActor`,{at:a,groupId:e.groupId,n:o.length})):(!u&&_!==jl.AXIS&&o.length===1&&(v=o[0]),v&&s.has(v)&&m[_].add(v),h.push({slotIndex:n,event:e,side:_,actorId:v}))})):t.push(se(`err.eventsNotArray`,{at:r})):t.push(se(`err.slotShape`,{at:r}))});let g=n.map(e=>Fl(e)?e.id:null).filter(Boolean),_=e=>g.filter(t=>m[e].has(t)),v=e=>{let t=_(e),n=u&&g.filter(t=>d.get(t)===e).length>1;return t.length||!u?t.map(t=>({key:`${e}:${t}`,side:e,actorId:t,actorName:s.get(t)?.name,named:n})):[{key:e,side:e,actorId:null}]},y=[];y.push(...v(jl.SIDE1).reverse());let b=y.length;y.push({key:jl.AXIS,side:jl.AXIS}),y.push(...v(jl.SIDE2));let x=new Map(y.map((e,t)=>[e.key,t])),S=a.map((e,t)=>({index:t,cells:new Map})),C=new Map,w=0;return h.forEach(({slotIndex:e,event:n,side:r,actorId:i})=>{let a=r===jl.AXIS?jl.AXIS:`${r}:${i}`,o=x.get(a);if(o===void 0)return;w+=1;let s=S[e];if(s.cells.has(a)){let r=s.cells.get(a);t.push(se(`err.oneEventPerCell`,{at:`slots[${e}]`,a:r.id,b:n.id}))}else s.cells.set(a,n);C.set(n.id,{row:e,col:o,key:a})}),{errors:t,byActor:u,sideLabels:{[jl.SIDE1]:r[0]?.label??``,[jl.SIDE2]:r[1]?.label??``,[jl.AXIS]:r[2]?.label??``},columns:y,rows:S,placements:C,axisColumnIndex:b,actorById:s,groupById:c,groupIndexById:l,sourceById:f,eventCount:w}}function Ll(e){return e===jl.SIDE1?0:e===jl.SIDE2?1:2}function Rl(e){let t=1;for(let n of e.rows)n.cells.forEach(e=>{let n=El(e.label||``);t=Math.max(t,Math.min(2,Math.ceil(n/Uce)))});return t}function Kce(e,t){if(!t.actors)return 0;let n=0;for(let t of e.rows)t.cells.forEach(t=>{let r=(Array.isArray(t.actorIds)?t.actorIds:[]).map(t=>e.actorById.get(t)?.name||t);if(r.length===0)return;let i=r.reduce((e,t)=>e+Dl(t,10)+14,0)+4*(r.length-1);n=Math.max(n,Math.ceil(i/262))});return n}function qce(e,t){let n=new Set;return e.cells.forEach((e,r)=>{let i=t.columns.findIndex(e=>e.key===r);i>=0&&n.add(i)}),n}var zl=.5;function Bl(e,t){if(!t)return e.rows.map((e,t)=>t);let n=e.rows.map(t=>qce(t,e)),r=[];return n.forEach((e,t)=>{let i=t===0?0:r[t-1]+zl;for(let a=0;a<t;a++)[...e].some(e=>n[a].has(e))&&(i=Math.max(i,r[a]+1));r.push(i)}),r}function Jce(e,t,n,r=!1){let i=e.columns.length,a=e.rows.length,o=Rl(e),s=Kce(e,t),c=Ol(t,o,s),l=c+28,u=n?316:l,d=n?l:316,f=new Set;e.rows.forEach(e=>e.cells.forEach((e,t)=>f.add(t)));let p=[],m=0;e.columns.forEach(e=>{let t=f.has(e.key)?d:n?52:104;p.push({start:m,size:t}),m+=t});let h=n?150:0,g=n?0:96,_=n?u:d,v=n?d:u,y=r&&!n,b=Bl(e,y),x=a===0?0:(b[a-1]+1)*u,S=(e,t)=>n?{x:h+b[e]*u,y:p[t].start}:{x:p[t].start,y:g+b[e]*u},C=p[e.axisColumnIndex]??{start:0,size:d};return{isH:n,colCount:i,rowCount:a,labelLines:o,actorLines:s,cardH:c,cellH:l,slotExtent:u,laneExtent:d,lanes:p,originX:h,originY:g,cellBoxW:_,cellBoxH:v,cellAt:S,rowTops:b,timeSpan:x,staggered:y,axisCenter:C.start+C.size/2,contentW:n?h+x+6:m,contentH:n?m:g+x+6}}var Vl={draggable:!1,selectable:!1,connectable:!1,focusable:!1};function Hl(e,t,n){let r=(Array.isArray(e.actorIds)?e.actorIds:[]).map(e=>t.actorById.get(e)?.name||e),i=(Array.isArray(e.sourceIds)?e.sourceIds:[]).map(e=>t.sourceById.get(e)).filter(Boolean);return{event:e,actorNames:r,sources:i,sourceCount:i.length,row:n}}function Yce(e){return{id:`__cells__`,type:`cells`,position:{x:0,y:0},width:1,height:1,style:{pointerEvents:`none`},data:{cols:e.colCount,rows:e.rowCount,cellW:e.cellBoxW,cellH:e.cellBoxH,lanes:e.lanes,originX:e.originX,originY:e.originY,isH:e.isH},...Vl}}function Ul(e,t){let n=t=>e.columns.filter(e=>e.side===t).length,r=t=>e.columns.findIndex(e=>e.side===t),i=[];return e.columns.forEach((a,o)=>{let s=n(a.side),c=a.side!==jl.AXIS&&(s>1||a.named),l=o===r(a.side),u={type:`colHeader`,...Vl},d={isH:t.isH,side:a.side,groupIndex:Ll(a.side)};if(!c){i.push({...u,id:`__head__${a.key}`,position:t.isH?{x:0,y:t.lanes[o].start}:{x:t.lanes[o].start,y:0},data:{...d,width:t.isH?150:t.lanes[o].size,height:t.isH?t.lanes[o].size:null,sideTitle:e.sideLabels[a.side],colTitle:null}});return}if(t.isH){i.push({...u,id:`__head__${a.key}`,position:{x:0,y:t.lanes[o].start},data:{...d,width:150,height:t.lanes[o].size,sideTitle:l?e.sideLabels[a.side]:null,colTitle:a.actorName}});return}if(!l)return;let f=e.columns.slice(o,o+s);i.push({...u,id:`__head__${a.key}`,position:{x:t.lanes[o].start,y:0},data:{...d,width:t.lanes.slice(o,o+s).reduce((e,t)=>e+t.size,0),height:null,sideTitle:e.sideLabels[a.side],colTitle:null,actors:f.map(e=>e.actorName),laneWs:t.lanes.slice(o,o+s).map(e=>e.size)}})}),i}function Xce(e,t){let n=e.rows.map(e=>t.rowTops[e.index]*t.slotExtent+t.slotExtent/2-5);return{id:`__axis__`,type:`axis`,position:t.isH?{x:t.originX,y:t.axisCenter-1}:{x:t.axisCenter-1,y:t.originY},data:{isH:t.isH,length:t.timeSpan,dotSize:10,dotOffsets:n},...Vl}}function Wl(e,t){return{id:`__links__`,type:`links`,position:{x:0,y:0},width:1,height:1,style:{pointerEvents:`none`},data:{segments:e,isH:t},...Vl}}function Gl(e,t,n,r,i,a){let o=i.cellAt(n,t),s=o.x+(i.cellBoxW-288)/2,c=o.y+(i.cellBoxH-i.cardH)/2,l=null;if(i.isH){let e=s+144;if(t<r.axisColumnIndex){let t=c+i.cardH;l={left:e,top:t,height:i.axisCenter-t}}else t>r.axisColumnIndex&&(l={left:e,top:i.axisCenter,height:c-i.axisCenter})}else{let e=c+i.cardH/2;if(t<r.axisColumnIndex){let t=s+288;l={left:t,top:e,width:i.axisCenter-t}}else t>r.axisColumnIndex&&(l={left:i.axisCenter,top:e,width:s-i.axisCenter})}return{node:{id:e.id,type:`card`,position:{x:s,y:c},data:{...Hl(e,r,n),groupIndex:Ll(r.columns[t].side),cardW:288,cardH:i.cardH,labelLines:i.labelLines,fields:a,isH:i.isH}},link:l}}function Kl(e,t={},n,r=`vertical`,{stagger:i=!1}={}){let a=r===`horizontal`,o=Il(e),s=Jce(o,t,a,i),c=[Yce(s),...Ul(o,s)],l=[],u=[];return o.rows.forEach(e=>{e.cells.forEach((n,r)=>{let i=o.columns.findIndex(e=>e.key===r);if(i<0)return;let{node:a,link:c}=Gl(n,i,e.index,o,s,t);l.push(a),c&&u.push(c)})}),u.length&&c.push(Wl(u,a)),c.push(Xce(o,s)),c.push(...l),{errors:o.errors,sideLabels:o.sideLabels,nodes:c,edges:[],grid:o,layout:`grid`,staggered:s.staggered,size:{width:s.contentW,height:s.contentH}}}function ql(e,t,n){let[r,i]=String(e).split(`T`),a=t?oe(n,`card.approxPrefix`):``;if(!i)return a+r;let o=i.split(`:`);return`${a}${r} ${o.slice(0,2).join(`:`)}${o[2]?`:`+o[2]:``}`}function Jl(e,t,n){let r=ql(t,!1,n);return String(e).split(`T`)[0]===String(t).split(`T`)[0]&&String(t).includes(`T`)?r.split(` `).pop():r}function Yl(e,t){if(!e.date)return oe(t,`card.dateUnknown`);let n=ql(e.date,e.approx,t);return e.dateEnd?`${n} - ${Jl(e.date,e.dateEnd,t)}`:n}function Xl(e,t,n=!1){if(!e.date)return[{text:oe(t,`chronicle.dateUnknown`),strong:!1}];let[r,i]=String(e.date).split(`T`),a=[{text:(e.approx?oe(t,`card.approxPrefix`):``)+r,strong:!0}],o=i?ql(e.date,!1,t).split(` `).pop():``;n&&o&&a.shift();let s=!a.length;if(!e.dateEnd)return o&&a.push({text:o,strong:s}),a;let c=Jl(e.date,e.dateEnd,t);return o&&!c.includes(`-`)?a.push({text:`${o} – ${c}`,strong:s}):(o&&a.push({text:o,strong:s}),a.push({text:`– ${c}`,strong:!1})),a}var Zce=12.5,Zl=4,Qce=6,$ce=10,ele=90,tle={latin:1.2,cjk:1.06},nle={latin:1.12,cjk:1.06},rle={sameSlot:10,none:22,short:38,long:70},Ql=864e5,D=/^(\d{4})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2})(?::(\d{2})(?::(\d{2}))?)?)?)?)?$/;function $l(e){let t=typeof e==`string`?D.exec(e):null;if(!t)return null;let[,n,r,i,a,o,s]=t,c=a==null?i==null?r==null?`year`:`month`:`day`:`time`;return{y:+n,mo:r?+r:1,d:i?+i:1,h:a?+a:0,mi:o?+o:0,s:s?+s:0,prec:c}}var ile={year:0,month:1,day:2,time:3},ale=e=>Date.UTC(e.y,e.mo-1,e.d,e.h,e.mi,e.s);function eu(e,t,n=!1){let r=$l(e),i=$l(t);if(!r||!i)return null;let a=ile[r.prec]<=ile[i.prec]?r.prec:i.prec,o=(e,t,r)=>({key:e,vars:t,long:r,approx:!!n});if(a===`year`||a===`month`){let e=a===`year`?(i.y-r.y)*12:(i.y-r.y)*12+(i.mo-r.mo);return e<=0?null:sle(e,o)}if(a===`time`){let e=ale(i)-ale(r);if(e<=0)return null;if(e<Ql){let t=Math.round(e/1e3);if(t<60)return o(`chronicle.gapSeconds`,{n:t},!1);if(t<3600)return o(`chronicle.gapMinutes`,{n:Math.round(t/60)},!1);let n=Math.floor(t/3600),r=Math.round((t-n*3600)/60);return r===60&&(n+=1,r=0),r?o(`chronicle.gapHoursMinutes`,{h:n,m:r},!1):o(`chronicle.gapHours`,{n},!1)}return tu(Math.floor(e/Ql),o)}let s=Math.round((Date.UTC(i.y,i.mo-1,i.d)-Date.UTC(r.y,r.mo-1,r.d))/Ql);return s<=0?null:tu(s,o)}function ole(e){let t=(e,t,n)=>({key:e,vars:t,long:n,approx:!1});if(!(e>0))return null;if(e<Ql){let n=Math.round(e/1e3);return n<60?t(`chronicle.gapSeconds`,{n},!1):n<3600?t(`chronicle.gapMinutes`,{n:Math.round(n/60)},!1):t(`chronicle.gapHours`,{n:Math.round(n/3600)},!1)}return tu(Math.round(e/Ql),t)}function tu(e,t){return e<30?t(`chronicle.gapDays`,{n:e},!1):sle(Math.max(1,Math.round(e/30.44)),t)}function sle(e,t){let n=Math.floor(e/12),r=e%12;return n?r?t(`chronicle.gapYearsMonths`,{y:n,m:r},!0):t(`chronicle.gapYears`,{n},!0):t(`chronicle.gapMonths`,{n:r},!0)}var nu=(e,t)=>e==null?t:t==null||e>t?e:t;function ru(e){let t=Array.isArray(e?.slots)?e.slots:[],n=[],r=null,i=!1,a=!1;return t.forEach((e,t)=>{let o=(Array.isArray(e?.events)?e.events:[]).filter(e=>e&&typeof e==`object`);if(!o.length)return;let s=o.every(e=>typeof e.date==`string`&&e.date),c=s?[...o].sort((e,t)=>e.date<t.date?-1:+(e.date>t.date)):o,l=c.find(e=>e.date)?.date??null,u=c.some(e=>e.date&&e.approx);c.forEach((e,o)=>{let c=o===0,d=null,f=`sameSlot`;c&&(n.length?(d=a&&s?eu(r,l,i||u):null,f=d?d.long?`long`:`short`:`none`):f=`top`);let p=typeof e.date==`string`&&e.date.length>=10?e.date.slice(0,10):null,m=n.at(-1)?.event,h=!!(p&&m&&typeof m.date==`string`&&m.date.slice(0,10)===p&&!e.approx);n.push({event:e,slotIndex:t,first:c,gap:d,spacing:f,sameDay:h})}),a=s,r=null;for(let e of c)r=nu(r,nu(e.date,e.dateEnd));i=c.some(e=>e.approx)}),n}var iu=[`circle`,`square`,`diamond`];function au(e,t){let n=(Array.isArray(e?.groups)?e.groups:[]).findIndex(n=>n?.id===Nl(e)(t));return n<0?`none`:iu[Math.min(n,2)]}function cle(e,t){let n=(Array.isArray(e?.groups)?e.groups:[]).findIndex(n=>n?.id===Nl(e)(t));return n>=0&&n<3?n:2}function ou(e,t,n,r){let i=[];if(n.actors)for(let t of Array.isArray(e.actorIds)?e.actorIds:[])i.push(Dl(r.get(t)?.name||t,10)+14);if(n.sources&&i.push(ele),!i.length)return 0;let a=1,o=0;for(let e of i){let t=o?$ce+e:e;o&&o+t>532?(a+=1,o=e):o+=t}return a}function lle({titleLines:e,summaryLines:t,tagLines:n,whenLineCount:r=3}){let i=20+20*Math.max(1,e);return t&&(i+=Zl+18*t),n&&(i+=Qce+20*n),Math.max(i,10+18*r)}function ule(e,t,n){let r=(e,t,r,i)=>n?Al(e,531,e=>n(e,t)):kl(e,532/r,i);return{title:Math.max(1,r(e.label||``,`title`,14,tle)),summary:t.summary&&e.summary?r(e.summary,`summary`,Zce,nle):0}}function su(e,t={},{measure:n}={}){let r=new Map((e?.actors||[]).filter(Boolean).map(e=>[e.id,e])),i=new Map((e?.sources||[]).filter(Boolean).map(e=>[e.id,e])),a=(Array.isArray(e?.groups)?e.groups.slice(0,3):[]).map((e,t)=>({label:e?.label,groupIndex:t,shape:iu[t]})).filter(e=>e.label),o=ru(e),s=[],c=[],l=[],u=[],d=a.length?34:0,f=null;o.forEach((a,o)=>{let{event:p}=a;if(f!=null){let e=rle[a.spacing]??rle.none;a.gap&&(l.push({y:f+e/2,gap:a.gap}),a.gap.long&&u.push({y0:f,y1:f+e})),d=f+e}let{title:m,summary:h}=ule(p,t,typeof n==`function`?n:null),g=ou(p,e,t,r),_=lle({titleLines:m,summaryLines:h,tagLines:g,whenLineCount:Xl(p,`en`,a.sameDay).length}),v=cle(e,p),y=(Array.isArray(p.actorIds)?p.actorIds:[]).map(e=>r.get(e)?.name||e),b=(Array.isArray(p.sourceIds)?p.sourceIds:[]).map(e=>i.get(e)).filter(Boolean);s.push({id:p.id,type:`entry`,position:{x:0,y:d},width:758,height:_,draggable:!1,connectable:!1,data:{event:p,index:o,groupIndex:v,shape:au(e,p),actorNames:y,sources:b,fields:t,lines:{title:m,summary:h,tags:g},sameDay:a.sameDay,cardH:_}}),c.push({y:d+20,groupIndex:v,shape:au(e,p),hollow:!p.date}),f=d+_});let p=f??0,m=[];return o.length&&m.push({id:`__spine__`,type:`spine`,position:{x:0,y:0},width:1,height:1,draggable:!1,selectable:!1,connectable:!1,focusable:!1,style:{pointerEvents:`none`},data:{x:174,top:c[0].y,bottom:c[c.length-1].y,dots:c,pills:l,breaks:u,dotSize:13}}),a.length&&m.push({id:`__legend__`,type:`legend`,position:{x:198,y:0},width:1,height:1,draggable:!1,selectable:!1,connectable:!1,focusable:!1,data:{groups:a}}),m.push(...s),{errors:[],nodes:m,edges:[],items:o,eventCount:o.length,layout:`chronicle`,size:{width:758,height:p}}}var dle=12,fle=40,cu=12.5,lu={latin:1.2,cjk:1.06},uu=(e,t=1)=>16+17*e+2+15*t,ple=e=>e?.dateEnd&&Dl(Yl(e,`en`),11)*1.05>176?2:1,du=uu(2,2)+10,mle=10,fu=22,pu=12,mu=e=>pu+Math.max(1,e)*du+fu,hu=14,gu=864e5,_u=36e5;function vu(e){let t=$l(e?.date);if(!t)return null;let n=e=>Date.UTC(e.y,e.mo-1,e.d,e.h,e.mi,e.s),r=e=>e.prec===`year`?Date.UTC(e.y+1,0,1):e.prec===`month`?Date.UTC(e.y,e.mo,1):e.prec===`day`?Date.UTC(e.y,e.mo-1,e.d+1):n(e),i=n(t),a=$l(e?.dateEnd);return a&&r(a)>i?{from:i,to:r(a),kind:`bar`,exact:!0}:t.prec===`time`?{from:i,to:i,kind:`dot`,exact:!0}:{from:i,to:r(t),kind:`band`,exact:!1,prec:t.prec}}var hle=e=>{let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2};function yu(e){let t=e.slice(1).map((t,n)=>t-e[n]),n=[],r=(e,n)=>{let r=[];for(let i=e+n;i>=0&&i<t.length&&r.length<3&&!(t[i]>=t[e]);i+=n)r.push(t[i]);return r};return t.forEach((e,t)=>{if(e<1728e5)return;let i=r(t,1);i.length||(i=r(t,-1)),i.length&&e/Math.max(hle(i),6e4)>=20&&n.push({i:t,g:e})}),n.sort((e,t)=>t.g-e.g).slice(0,2).map(e=>e.i).sort((e,t)=>e-t)}function bu(e){return e>730*gu?`year`:e>60*gu?`month`:e>2*gu?`day`:e>3*_u?`hour`:`minute`}function xu(e,t,n,r){let i=new Date(e),a=[],o={year:[1,2,5,10],month:[1,2,3,6],day:[1,2,7,14],hour:[1,2,3,6,12],minute:[1,2,5,10,15,30]}[n];for(let s of o){a.length=0;let o;o=n===`year`?Date.UTC(i.getUTCFullYear(),0,1):n===`month`?Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1):n===`day`?Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()):n===`hour`?Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),i.getUTCHours()):Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),i.getUTCHours(),i.getUTCMinutes());let c=0;for(;o<=t&&c++<2e3;){o>=e&&a.push(o);let t=new Date(o);n===`year`?o=Date.UTC(t.getUTCFullYear()+s,0,1):n===`month`?o=Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+s,1):o+=n===`day`?s*gu:n===`hour`?s*_u:s*6e4}if(a.length<=r)break}return[...a]}function gle(e,t,n){let r=new Date(e),i=e=>String(e).padStart(2,`0`),a=`${i(r.getUTCMonth()+1)}-${i(r.getUTCDate())}`;if(t===`year`)return String(r.getUTCFullYear());if(t===`month`)return`${r.getUTCFullYear()}-${i(r.getUTCMonth()+1)}`;if(t===`day`)return a;let o=`${i(r.getUTCHours())}:${i(r.getUTCMinutes())}`;return n==null||new Date(n).getUTCDate()!==r.getUTCDate()?`${a} ${o}`:o}function _le(e,t){let n=new Map,r=(Array.isArray(e?.actors)?e.actors:[]).filter(e=>e?.id);if(!t||r.length<2)return n;for(let t of Array.isArray(e?.groups)?e.groups.slice(0,2):[]){let e=r.filter(e=>t?.id&&e.groupId===t.id);e.length>=2&&n.set(t.id,e)}return n}function vle(e,{byParty:t=!1}={}){let n=Nl(e),r=_le(e,t);return e=>{let t=n(e),i=Array.isArray(e?.actorIds)?e.actorIds:[];return i.length===1&&r.get(t)?.some(e=>e.id===i[0])?`actor:${i[0]}`:t}}function yle(e,t,{byParty:n=!1}={}){let r=vle(e,{byParty:n}),i=_le(e,n),a=(Array.isArray(e?.groups)?e.groups.slice(0,3):[]).filter(e=>e&&e.id),o=new Set(t.map(r)),s=a.flatMap((e,t)=>{let n=i.get(e.id)?.filter(e=>o.has(`actor:${e.id}`));return n?.length?n.map(n=>({key:`actor:${n.id}`,label:n.name??``,side:e.label??``,groupIndex:t})):[{key:e.id,label:e.label??``,groupIndex:t}]}),c=new Set(s.map(e=>e.key));return t.some(e=>!c.has(r(e)))&&s.push({key:`__other__`,label:null,groupIndex:2,other:!0}),s}function Su(e,{levels:t=3,width:n=196,gap:r=mle}={}){let i=e.map(e=>({ids:[e.id],x:e.x,from:e.x,to:e.x}));for(;;){let e=Cu(i,t,n,r);if(e)return e;let a=-1,o=1/0;for(let e=0;e+1<i.length;e++){let t=i[e+1].x-i[e].x;t<o&&(o=t,a=e)}if(a<0)return Cu(i,t,n,r)??[];let s=i[a],c=i[a+1],l=[...s.ids,...c.ids],u=Math.min(s.from,c.from),d=Math.max(s.to,c.to);i.splice(a,2,{ids:l,x:(u+d)/2,from:u,to:d}),i=i.sort((e,t)=>e.x-t.x)}}function Cu(e,t,n,r){let i=Array(t).fill(-1/0),a=[];for(let t of e){let e=t.x-n/2,o=i.findIndex(t=>t+r<=e);if(o<0)return null;i[o]=t.x+n/2,a.push({...t,level:o})}return a}function ble(e,t={},{measure:n,byParty:r=!1}={}){let i=new Map((e?.actors||[]).filter(Boolean).map(e=>[e.id,e])),a=new Map((e?.sources||[]).filter(Boolean).map(e=>[e.id,e])),o=[];(Array.isArray(e?.slots)?e.slots:[]).forEach((e,t)=>{for(let n of Array.isArray(e?.events)?e.events:[])n&&typeof n==`object`&&o.push({event:n,slotIndex:t})}),o.forEach(e=>e.time=vu(e.event)),o.forEach(e=>{e.time?.exact&&(e.time.t=e.time.from)});let s=e=>({before:o.slice(0,e).reverse().find(e=>e.time?.exact),after:o.slice(e+1).find(e=>e.time?.exact)}),c=o.filter(e=>e.time?.exact).map(e=>e.time.t),l=c.length>1?Math.max(6e4,(Math.max(...c)-Math.min(...c))/20):_u,u=(e,t,n)=>{let{before:r,after:i}=s(e),a;return a=r&&i?(r.time.t+i.time.t)/2:r?r.time.t+l:i?i.time.t-l:t==null?e*_u:(t+n)/2,t==null?a:Math.min(Math.max(a,t),n-1)};o.forEach((e,t)=>{e.time&&!e.time.exact&&(e.time.t=u(t,e.time.from,e.time.to))}),o.forEach((e,t)=>{if(e.time)return;let n=o.slice(0,t).reverse().find(e=>e.time),r=o.slice(t+1).find(e=>e.time),i=n&&r?(n.time.t+r.time.t)/2:n?n.time.t+l:r?r.time.t-l:t*_u;e.time={t:i,from:i,to:i,kind:`dot`,undated:!0}});let d=[...new Set(o.map(e=>e.time.t))].sort((e,t)=>e-t),f=[...new Set(o.filter(e=>!e.time.undated).map(e=>e.time.t))].sort((e,t)=>e-t),p=f.length?f:d,m=yu(p),h=[],g=0;for(let e of m)h.push([p[g],p[e]]),g=e+1;h.push([p[g],p[p.length-1]]),h[0][0]=Math.min(h[0][0],d[0]),h[h.length-1][1]=Math.max(h[h.length-1][1],d[d.length-1]);let _=e=>{let t=h.findIndex(([,t])=>e<=t);return t<0?h.length-1:t},v=h.map(([e,t],n)=>({index:n,from:e,to:t,count:o.filter(e=>_(e.time.t)===n).length,unit:t>e?bu(t-e):`day`})),y=e=>Dl(e,dle)*1.06,b=yle(e,o.map(e=>e.event),{byParty:r}).flatMap(e=>[e.label||``,e.side||``]),x=Math.round(Math.min(196,Math.max(132,...b.map(e=>y(e)+fle)))),S=x;v.forEach((e,t)=>{if(t>0){let n=e.from-v[t-1].to;e.breakBefore={x:S,w:64,gap:ole(n)},S+=64}e.x0=S,e.w=Math.max(170,e.count*116),e.x1=S+e.w,S=e.x1});let C=S,w=e=>{let t=v[_(e)],n=t.w-196;return t.to===t.from?t.x0+t.w/2:t.x0+98+(Math.min(Math.max(e,t.from),t.to)-t.from)/(t.to-t.from)*n},T=(e,t)=>Math.min(Math.max(e,v[t].from),v[t].to),ee=yle(e,o.map(e=>e.event),{byParty:r}),te=vle(e,{byParty:r}),ne=e=>{let t=ee.findIndex(t=>t.key===te(e));return t>=0?t:ee.length-1},re=[],ie=[],ae=e=>re[e],se=e=>re[e]+ie[e],ce=o.map((e,t)=>{let n=_(e.time.t),r=e.time.kind,i=w(r===`dot`?e.time.t:T(e.time.from,n)),a=r===`dot`?i:w(T(e.time.to,n)),o=r===`bar`?i:w(e.time.t),s=v[n],c=r===`band`&&s.to>s.from&&e.time.to-e.time.from>s.to-s.from,l=r===`band`&&(c||a-i<8)?`dot`:r;return l===`dot`?i=a=o:a-i<6&&(a=i+6),{id:e.event.id,order:t,lane:ne(e.event),kind:l,x:o,x0:i,x1:a,undated:!!e.time.undated,coarse:c,prec:e.time.prec,event:e.event}}),le=new Map;for(let e of ce){let t=`${e.lane}:${Math.round(e.x)}`;e.stack=le.get(t)??0,le.set(t,e.stack+1)}let ue=e=>Math.min(2,Math.max(1,n?Al(e,173,e=>n(e,`title`)):kl(e,176/cu,lu))),de=[],fe=[],pe=ee.map((e,t)=>{let n=ce.filter(e=>e.lane===t).sort((e,t)=>e.x-t.x||e.order-t.order),r=e=>Math.min(Math.max(e,x+4+98),C-98);return Su(n.map(e=>({id:e.id,x:r(e.x)})))}),me=0;pe.forEach((e,t)=>{re[t]=me,ie[t]=e.length?mu(Math.max(0,...e.map(e=>e.level))+1):34,me+=ie[t]}),pe.forEach((e,t)=>{let n=e=>{let t=e.ids.map(e=>ce.find(t=>t.id===e).x);return(Math.min(...t)+Math.max(...t))/2};for(let r of e){let e=r.x-98,i=r.ids.map(e=>ce.find(t=>t.id===e)).sort((e,t)=>e.order-t.order),a=i.length>1,o=a?1:ue(i[0].event.label||``),s=a?1:i[0].undated?Dl(oe(`en`,`scale.undated`),11)*1.05>176?2:1:ple(i[0].event),c=uu(o,s),l=se(t)-fu-r.level*du,u={id:a?`__run__${fe.length+1}`:i[0].id,lane:t,level:r.level,x:e,y:l-c,w:196,h:c,titleLines:o,timeLines:s,anchor:n(r),members:i};a&&(u.run=fe.length+1,u.span=[Math.min(...i.map(e=>e.x0)),Math.max(...i.map(e=>e.x1))],fe.push(u)),de.push(u)}});let he=re.length?re[re.length-1]+ie[ie.length-1]:0,ge=he+14,_e=v.flatMap(e=>{let t=Math.max(2,Math.floor(e.w/84)),n=e.to>e.from?xu(e.from,e.to,e.unit,t):[],r=e.unit;return n.length||(n=e.to>e.from?[e.from,e.to]:[e.from],r=e.to>e.from?`minute`:`day`),n.map((e,t)=>({x:w(e),label:gle(e,r,t?n[t-1]:null)}))}),ve=fe.reduce((e,t)=>e+1+t.members.length,0),ye=fe.length?hu+ve*18:0,be=he+56+ye,xe=e=>ee[ne(e)].groupIndex,Se=[{id:`__scale__`,type:`scaleLayer`,position:{x:0,y:0},width:1,height:1,draggable:!1,selectable:!1,connectable:!1,focusable:!1,style:{pointerEvents:`none`},data:{width:C,labelW:x,lanesH:he,axisY:ge,lanes:ee.map((e,t)=>({...e,top:ae(t),lineY:se(t)})),segments:v,ticks:_e,marks:ce.map(e=>({id:e.id,kind:e.kind,x:e.x,x0:e.x0,x1:e.x1,y:se(e.lane)-e.stack*12,undated:e.undated,coarse:e.coarse,prec:e.prec,approx:!!e.event.approx,groupIndex:ee[e.lane].groupIndex})),leaders:de.map(e=>({x:Math.min(Math.max(e.anchor,e.x+8),e.x+e.w-8),y0:e.y+e.h,y1:se(e.lane)-6,run:!!e.run})),brackets:fe.map(e=>({x0:e.span[0],x1:e.span[1],y:se(e.lane)+9,run:e.run}))}}];for(let e of de)Se.push({id:e.id,type:e.run?`scaleRun`:`scaleCard`,position:{x:e.x,y:e.y},width:e.w,height:e.h,draggable:!1,connectable:!1,data:e.run?{run:e.run,events:e.members.map(e=>e.event),groupIndex:ee[e.lane].groupIndex,cardH:e.h}:{event:e.members[0].event,undated:e.members[0].undated,groupIndex:xe(e.members[0].event),titleLines:e.titleLines,timeLines:e.timeLines,cardH:e.h,actorNames:(Array.isArray(e.members[0].event.actorIds)?e.members[0].event.actorIds:[]).map(e=>i.get(e)?.name||e),sources:(Array.isArray(e.members[0].event.sourceIds)?e.members[0].event.sourceIds:[]).map(e=>a.get(e)).filter(Boolean)}});return fe.length&&Se.push({id:`__runs__`,type:`scaleRunList`,position:{x,y:he+56+hu},width:1,height:1,draggable:!1,selectable:!1,connectable:!1,focusable:!1,data:{runs:fe.map(e=>({run:e.run,events:e.members.map(e=>e.event)})),width:C-x,lh:18}}),{errors:[],nodes:Se,edges:[],layout:`scale`,eventCount:o.length,segments:v,gathered:fe.map(e=>({run:e.run,ids:e.members.map(e=>e.id)})),cards:de.map(e=>({id:e.id,lane:e.lane,level:e.level,x:e.x,y:e.y,w:e.w,h:e.h,ids:e.members.map(e=>e.id)})),undated:ce.filter(e=>e.undated).length,labelW:x,size:{width:C,height:be}}}function wu(e,t){if(!e||!t||!e.width||!e.height)return 1;let n=t.width/(e.width*1.12),r=t.height/(e.height*1.12);return Math.min(n,r,1)}function Tu(e,t){return!e||!t||!e.width?1:Math.min(t.width/(e.width*1.12),1)}var Eu={width:1600,height:900},Du=(e,t)=>Math.round(e*Math.min(t,1)*10)/10;function Ou(e,t){let n=`Text on one screen (${e.canvas.width}×${e.canvas.height})`,r=Du(e.font,e.open.fit),i=Du(e.font,e.other.fit),a=e=>e.toFixed(1),o=[];e.open.fit>=1&&e.other.fit>=1?o.push(`${n}: full size (${e.font} px) either way.`):o.push(`${n}: ${a(r)} px as it opens (${e.open.name}), ${a(i)} px ${e.other.name}. Full size is ${e.font} px.`);let s=Math.max(r,i);if(s<9?o.push(`Note: the text is too small to read without zooming in (under 9 px). Consider ${t}; do not drop facts to make it fit.`):s<11&&o.push(`Note: the text is small (under 11 px); the reader can zoom in. ${t[0].toUpperCase()}${t.slice(1)} would make it easier to read.`),e.folded!==void 0&&s<11){let t=e.folded>=1?`full size (${e.font} px)`:`${a(Du(e.font,e.folded))} px`;o.push(`With every issue folded the text is ${t}: the reader can fold issues ("Fold issues" in the bar) instead of your splitting it.`)}return o}var ku={envelope:[{name:`type`,req:`yes`,ty:`string`,note:`always "fact"`},xl(2),{name:`title`,req:`yes`,ty:`string`,note:`diagram title, shown at the top left`}],actors:[{name:`id`,req:`yes`,ty:`string`,note:`unique within the diagram; events reference it via actorIds`},{name:`name`,req:`yes`,ty:`string`,note:`display name, e.g. "Huayuan Trading"`},{name:`role`,req:`no`,ty:`string`,note:`procedural standing, e.g. "plaintiff"`},{name:`groupId`,req:`*`,ty:`string`,note:`the side this party is on: the 1st or the 2nd group. Required with 2 or more parties; not written with one`}],groups:[{name:`id`,req:`yes`,ty:`string`,note:`parties (2 or more) or events (one party) reference it via groupId`},{name:`label`,req:`yes`,ty:`string`,note:`column heading, e.g. "Sun Hao's side" (parties) or "performance as agreed" (one party's acts)`},{name:``,req:``,ty:``,note:`at most 3: the 1st on the left (top) side, the 2nd on the right (bottom) side, the 3rd on the axis`},{name:``,req:``,ty:``,note:`2 or more parties: the groups split the parties. 0 or 1 party: they split the events by kind of act`}],sources:[{name:`id`,req:`yes`,ty:`string`,note:`events reference it via sourceIds`},{name:`type`,req:`yes`,ty:`string`,note:`contract / evidence / judgment / transcript, etc.`},{name:`name`,req:`yes`,ty:`string`,note:`material name, e.g. "corridor surveillance video"`},{name:`loc`,req:`no`,ty:`object`,note:`location, e.g. { file, page } or { file, timestamp }`},{name:`quote`,req:`no`,ty:`string`,note:`verbatim excerpt (several passages joined with ……), shown when the card is opened; a shortened or reworded version goes in detail`}],slots:[{name:`events`,req:`yes`,ty:`array`,note:`events at this time point; must not be empty`},{name:``,req:``,ty:``,note:`array order is chronological order; date is display-only and never reorders`}],events:[{name:`id`,req:`yes`,ty:`string`,note:`unique within the diagram`},{name:`date`,req:`no`,ty:`string`,note:`ISO 8601. Go to seconds when known, otherwise stop at the day. **Leave it out when the material gives no date: never make one up.** The card then says the date is unknown; the order is the order of slots, so nothing moves`},{name:`label`,req:`yes`,ty:`string`,note:`card title; about 20 characters per line, at most two lines`},{name:`dateEnd`,req:`no`,ty:`string`,note:`for a span, the end instant; needs date, and must not be earlier than it`},{name:`approx`,req:`no`,ty:`boolean`,note:`time is not exact (estimated or inferred); the diagram shows "approx."`},{name:`dateNote`,req:`no`,ty:`string`,note:`why the time is not exact, and how it was derived`},{name:`summary`,req:`no`,ty:`string`,note:`the line under the card title; about 22 characters`},{name:`detail`,req:`no`,ty:`string`,note:`full text revealed when the card is opened`},{name:`actorIds`,req:`no`,ty:`string[]`,note:`parties involved. One: that party's side and column. Two or more, or none: the centre axis`},{name:`groupId`,req:`*`,ty:`string`,note:`only when the diagram has 0 or 1 party: which side this event falls on. With 2 or more parties, leave it out`},{name:`sourceIds`,req:`no`,ty:`string[]`,note:`which materials it rests on`}]};function Au(){let e=[`Fields of a fact spec. "yes" means required.`,``];for(let[t,n]of Object.entries(ku)){e.push(`[${t}]`);for(let t of n)t.name?e.push(` ${t.name.padEnd(12)} ${t.req.padEnd(3)} ${t.ty.padEnd(15)} ${t.note}`):e.push(` · ${t.note}`);e.push(``)}return e.push(`"*": required or not depending on the number of parties, as the note says.`),e.push(`Cross-field rules (dangling references, a span running backwards, a party without a`),e.push(`side, two events in the same lane of one time slot) are not listed`),e.push(`above: call antu_validate after writing. It reports each problem with its field path.`),e.join(`
1492
+ `}var Sce=class{constructor(t=e.stdin,n=e.stdout,r){this._stdin=t,this._stdout=n,this._started=!1,this._ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(e){this.onerror?.(e),this.close().catch(()=>{})}},this._onerror=e=>{this.onerror?.(e)},this._readBuffer=new yce({maxBufferSize:r?.maxBufferSize})}async start(){if(this._started)throw Error(`StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.`);this._started=!0,this._stdin.on(`data`,this._ondata),this._stdin.on(`error`,this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off(`data`,this._ondata),this._stdin.off(`error`,this._onerror),this._stdin.listenerCount(`data`)===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let n=xce(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}},dl=`/*ANTU_SPEC*/null`;function fl(e){return String(e).replace(/</g,`\\u003c`)}function Cce(e,t,{preset:n}={}){if(e.split(`/*ANTU_SPEC*/null`).length!==2)throw Error(`the viewer template does not hold exactly one ${dl}`);let r=fl(JSON.stringify(t)),i=n?`;window.__ANTU_PRESET__ = ${fl(JSON.stringify(n))}`:``;return e.replace(dl,()=>r+i)}f(u(h(import.meta.url)),`../..`);var pl=f(u(h(import.meta.url)),`..`);d(pl,`dist-engine/engine.js`),d(pl,`dist-engine/engine.css`);function wce(e){return String(e).replace(/[&<>"]/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`})[e])}function ml(){return`0.16.0`}function Tce(e){return String(e||`antu`).replace(/[\\/:*?"<>|\s]+/g,`-`).slice(0,60)}function Ece(e,{preset:t,force:n=!1,quiet:r=!1}={}){{let n=wce(e?.title||`Antu`);return Cce(i(d(pl,`assets/viewer.html`),`utf8`),e,{preset:t}).replace(/<title>[^<]*<\/title>/,()=>`<title>${n} · Antu</title>`)}}function Dce(e,{outPath:t,preset:r,force:i=!1,quiet:a=!1}={}){let o=Ece(e,{preset:r,force:i,quiet:a}),s=f(t||`${Tce(e?.title)}.html`);return n(u(s),{recursive:!0}),c(s,o),{path:s,bytes:Buffer.byteLength(o)}}var hl=new Map,gl=[`experimental`,`stable`,`deprecated`];function _l(e,t){if(!e)throw Error(`registerKnowledge: type must not be empty`);if(!t?.validate)throw Error(`registerKnowledge: validate is required`);if(!t?.describe)throw Error(`registerKnowledge: describe is required (the agent-facing field table)`);if(!Number.isInteger(t.specVersion)||t.specVersion<1)throw Error(`registerKnowledge: specVersion is required, a whole number (the generation of this type's JSON format, core/specVersion.js)`);Oce(e,t),hl.set(e,t)}function Oce(e,t){let n=Object.keys(t.layouts??{}),r=Object.keys(t.diagrams??{});for(let t of n)if(!r.includes(t))throw Error(`registerKnowledge: ${e}/${t} has a layout but no entry in diagrams (version, status, since)`);for(let t of r)if(!n.includes(t))throw Error(`registerKnowledge: ${e}/${t} is in diagrams but has no layout`);for(let[n,r]of Object.entries(t.diagrams??{})){if(!Number.isInteger(r.version)||r.version<1)throw Error(`registerKnowledge: ${e}/${n}: version must be a whole number >= 1`);if(!gl.includes(r.status))throw Error(`registerKnowledge: ${e}/${n}: status must be one of ${gl.join(`, `)}`);if(!/^\d+\.\d+\.\d+$/.test(r.since??``))throw Error(`registerKnowledge: ${e}/${n}: since must be a release number such as 0.7.0`)}}function kce(e){let t=hl.get(e);return Object.entries(t?.diagrams??{}).map(([t,n])=>({type:e,kind:t,...n}))}function vl(e){return hl.get(e)}function yl(){return[...hl.entries()].map(([e,t])=>({type:e,labelKey:t.label??`graphType.${e}`}))}function Ace(e){return hl.get(e)?.validate}function jce(e,t){let n=hl.get(e)?.layouts;if(n)return t&&n[t]?n[t]:Object.values(n)[0]}function bl(e){return Object.keys(hl.get(e)?.layouts??{})}var xl=e=>({name:`specVersion`,req:`no`,ty:`integer`,note:`which generation of this format the file follows (now ${e}); omit = the current one. Write it: it is how an older file is recognised after a breaking change`});function Mce(e,t){return e.specVersion===void 0?null:!Number.isInteger(e.specVersion)||e.specVersion<1?{key:`err.specVersionForm`,params:{value:JSON.stringify(e.specVersion)}}:Number.isInteger(t)&&e.specVersion>t?{key:`err.specVersionNewer`,params:{value:e.specVersion,known:t,type:e.type}}:null}var Nce=/^(\d{4})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2}))?)?)?)?$/;function Sl(e){let t=Nce.exec(typeof e==`string`?e.trim():``);if(!t)return null;let[n,r,i,a,o,s]=t.slice(1).map(e=>e===void 0?void 0:Number(e)),c=(e,t,n,r,i,a)=>Date.UTC(e,t,n,r,i,a),l,u;return r===void 0?(l=c(n,0,1,0,0,0),u=c(n+1,0,1,0,0,0)):i===void 0?(l=c(n,r-1,1,0,0,0),u=c(n,r,1,0,0,0)):a===void 0?(l=c(n,r-1,i,0,0,0),u=c(n,r-1,i+1,0,0,0)):s===void 0?(l=c(n,r-1,i,a,o,0),u=l+6e4):(l=c(n,r-1,i,a,o,s),u=l+1e3),Number.isNaN(l)?null:{from:l,to:u}}function Pce(e){let t=Sl(e?.date);if(!t)return null;let{from:n,to:r}=t,i=e.dateEnd===void 0?null:Sl(e.dateEnd);if(i&&i.to>n&&(r=Math.max(r,i.to)),e.approx===!0){let e=t.to-t.from;n-=e,r+=e}return{from:n,to:r}}function Fce(e){let t=[],n=null;return(Array.isArray(e?.slots)?e.slots:[]).forEach((e,r)=>{let i=(Array.isArray(e?.events)?e.events:[]).map((e,t)=>({event:e,ei:t,span:Pce(e)})).filter(e=>e.span);if(i.length===0)return;let a={from:Math.min(...i.map(e=>e.span.from)),to:Math.max(...i.map(e=>e.span.to))};if(n&&a.to<=n.span.from){let e=i.find(e=>e.span.to<=n.span.from)??i[0];t.push(se(`note.dateOrder`,{at:`slots[${r}].events[${e.ei}]`,id:e.event.id,date:e.event.date,beforeAt:`slots[${n.si}].events[${n.ei}]`,beforeId:n.event.id,beforeDate:n.event.date}))}let o=i.reduce((e,t)=>t.span.to>e.span.to?t:e);n={span:a,si:r,ei:o.ei,event:o.event}}),t}function Ice(e){let t=Array.isArray(e?.actors)?e.actors:[],n=new Set;for(let t of Array.isArray(e?.slots)?e.slots:[])for(let e of Array.isArray(t?.events)?t.events:[])for(let t of Array.isArray(e?.actorIds)?e.actorIds:[])n.add(t);return t.map((e,t)=>({a:e,i:t})).filter(({a:e})=>e&&typeof e.id==`string`&&!n.has(e.id)).map(({a:e,i:t})=>se(`note.partyNoEvent`,{at:`actors[${t}]`,id:e.id,name:e.name??e.id}))}var Lce=19,Rce=2,zce=18,Cl=6,Bce=16,Vce=11.5,wl=1,Hce=.55;function Tl(e){let t=e.codePointAt(0);return t>=4352&&t<=4447||t>=11904&&t<=42191||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510?wl:Hce}function El(e){let t=0;for(let n of String(e??``))t+=Tl(n);return t}var Dl=(e,t)=>El(e)*t,Uce=262/13;262/Vce;function Ol(e={},t=Rce,n=0){let r=22+Lce*t+Cl+Bce;return e.summary&&(r+=24),e.actors&&n>0&&(r+=zce*n+Cl),r}function kl(e,t,n={}){let r=n.latin??1,i=n.cjk??1;return Al(e,t,e=>{let t=0;for(let n of e)t+=Tl(n)*(Tl(n)===wl?i:r);return t})}function Al(e,t,n){let r=t,i=n,a=String(e??``);if(!a)return 0;let o=a.match(/[^\sᄀ-ᅟ⺀-꓏가-힣豈-﫿︰-﹯＀-⦆¢-₩]+|\s|./gu)||[],s=1,c=0;for(let e of o){let t=i(e);if(/^\s$/.test(e))c>0&&(c+=t);else if(c+t<=r)c+=t;else if(t<=r)s+=+(c>0),c=t;else{c>0&&(s+=1);let e=Math.ceil(t/r);s+=e-1,c=t-(e-1)*r}}return s}var jl={SIDE1:`side1`,AXIS:`axis`,SIDE2:`side2`},Ml=3;function Nl(e){let t=(Array.isArray(e?.actors)?e.actors:[]).filter(e=>Fl(e)&&e.id);if(new Set(t.map(e=>e.id)).size<2)return e=>e?.groupId??null;let n=new Map(t.map(e=>[e.id,e.groupId])),r=(Array.isArray(e?.groups)?e.groups[2]?.id:null)??null;return e=>{let t=Array.isArray(e?.actorIds)?e.actorIds:[];return t.length===1&&n.get(t[0])||r}}var Pl=/^\d{4}(-\d{2}(-\d{2}(T\d{2}(:\d{2}(:\d{2})?)?)?)?)?$/;function Wce(e,t){if(typeof e!=`string`||typeof t!=`string`)return!1;let n=Math.min(e.length,t.length);return e.slice(0,n)<t.slice(0,n)}var Gce=[jl.SIDE1,jl.SIDE2,jl.AXIS];function Fl(e){return e&&typeof e==`object`&&!Array.isArray(e)}function Il(e){let t=[],n=Array.isArray(e?.actors)?e.actors:[],r=Array.isArray(e?.groups)?e.groups:[],i=Array.isArray(e?.sources)?e.sources:[],a=e?.slots,o={errors:t,byActor:!1,sideLabels:{[jl.SIDE1]:``,[jl.SIDE2]:``,[jl.AXIS]:``},columns:[],rows:[],placements:new Map,axisColumnIndex:0,actorById:new Map,groupById:new Map,groupIndexById:new Map,sourceById:new Map,eventCount:0},s=new Map;n.forEach((e,n)=>{Fl(e)?e.id?(s.has(e.id)&&t.push(se(`err.duplicateId`,{at:`actors[${n}]`,id:e.id})),s.set(e.id,e),e.name||t.push(se(`err.required`,{at:`actors[${n}] (${e.id})`,field:`name`}))):t.push(se(`err.required`,{at:`actors[${n}]`,field:`id`})):t.push(se(`err.notObject`,{at:`actors[${n}]`}))}),e?.views!==void 0&&t.push(se(`err.viewsRemoved`));let c=new Map,l=new Map;r.length>Ml&&t.push(se(`err.tooManyGroups`,{at:`groups`,max:Ml,actual:r.length})),r.forEach((e,n)=>{Fl(e)?e.id?(l.has(e.id)&&t.push(se(`err.duplicateId`,{at:`groups[${n}]`,id:e.id})),c.set(e.id,e),l.set(e.id,n),e.label||t.push(se(`err.required`,{at:`groups[${n}] (${e.id})`,field:`label`}))):t.push(se(`err.required`,{at:`groups[${n}]`,field:`id`})):t.push(se(`err.notObject`,{at:`groups[${n}]`}))});let u=s.size>=2,d=new Map;n.forEach((e,n)=>{if(!Fl(e)||!e.id)return;let r=`actors[${n}] (${e.id})`,i=e.groupId!==void 0&&e.groupId!==null&&e.groupId!==``;if(!u){i&&t.push(se(`err.actorGroupOneParty`,{at:r}));return}if(!i){t.push(se(`err.actorNeedsGroup`,{at:r,n:s.size}));return}if(!l.has(e.groupId)){t.push(se(`err.missingRef`,{at:r,field:`groupId`,kind:`group`,id:e.groupId}));return}let a=l.get(e.groupId);a>1?t.push(se(`err.actorGroupNotSide`,{at:r,groupId:e.groupId})):d.set(e.id,a===0?jl.SIDE1:jl.SIDE2)});let f=new Map;if(i.forEach((e,n)=>{Fl(e)?e.id?(f.has(e.id)&&t.push(se(`err.duplicateId`,{at:`sources[${n}]`,id:e.id})),f.set(e.id,e),e.type||t.push(se(`err.required`,{at:`sources[${n}] (${e.id})`,field:`type`})),e.name||t.push(se(`err.required`,{at:`sources[${n}] (${e.id})`,field:`name`}))):t.push(se(`err.required`,{at:`sources[${n}]`,field:`id`})):t.push(se(`err.notObject`,{at:`sources[${n}]`}))}),!Array.isArray(a))return t.push(se(`err.slotNotArray`)),{...o,actorById:s,groupById:c,groupIndexById:l,sourceById:f};a.length===0&&t.push(se(`err.slotsEmpty`));let p=new Set,m={[jl.SIDE1]:new Set,[jl.SIDE2]:new Set},h=[];a.forEach((e,n)=>{let r=`slots[${n}]`;Fl(e)?Array.isArray(e.events)?(e.events.length===0&&t.push(se(`err.slotEventsEmpty`,{at:r})),e.events.forEach((e,i)=>{let a=`${r}.events[${i}]${e?.id?` (${e.id})`:``}`;if(!Fl(e)){t.push(se(`err.notObject`,{at:a}));return}e.id?p.has(e.id)?t.push(se(`err.duplicateId`,{at:a,id:e.id})):p.add(e.id):t.push(se(`err.required`,{at:a,field:`id`})),e.date&&!Pl.test(e.date)&&t.push(se(`err.badDate`,{at:a,field:`date`,value:e.date})),e.label||t.push(se(`err.required`,{at:a,field:`label`})),e.dateEnd!==void 0&&e.dateEnd!==null&&(typeof e.dateEnd!=`string`||!Pl.test(e.dateEnd)?t.push(se(`err.badDate`,{at:a,field:`dateEnd`,value:e.dateEnd})):e.date?Wce(e.dateEnd,e.date)&&t.push(se(`err.dateEndBeforeDate`,{at:a,end:e.dateEnd,start:e.date})):t.push(se(`err.dateEndNeedsDate`,{at:a}))),e.summary!==void 0&&e.summary!==null&&(typeof e.summary==`string`?El(e.summary)>22.782608695652176&&t.push(se(`err.summaryTooLong`,{at:a,max:22,actual:Math.ceil(El(e.summary))})):t.push(se(`err.mustBeString`,{at:a,field:`summary`})));let o=Array.isArray(e.actorIds)?e.actorIds:[];o.forEach(e=>{s.has(e)||t.push(se(`err.missingRef`,{at:a,field:`actorIds`,kind:`actor`,id:e}))});let c=e.groupId!==void 0&&e.groupId!==null&&e.groupId!==``;u&&c?t.push(se(`err.eventGroupWithParties`,{at:a})):c&&!l.has(e.groupId)&&t.push(se(`err.missingRef`,{at:a,field:`groupId`,kind:`group`,id:e.groupId})),(Array.isArray(e.sourceIds)?e.sourceIds:[]).forEach(e=>{f.has(e)||t.push(se(`err.missingRef`,{at:a,field:`sourceIds`,kind:`source`,id:e}))});let g=c?l.get(e.groupId):void 0,_,v=null;if(u)o.length===1&&d.has(o[0])?(_=d.get(o[0]),v=o[0]):_=jl.AXIS;else if(o.length>=2)_=jl.AXIS,(g===0||g===1)&&t.push(se(`err.multiActorNeedsAxis`,{at:a,n:o.length,groupId:e.groupId}));else if(!c)_=jl.AXIS;else if(g===void 0)return;else _=Gce[g]??jl.AXIS;!u&&_!==jl.AXIS&&o.length!==1?t.push(se(`err.groupNeedsOneActor`,{at:a,groupId:e.groupId,n:o.length})):(!u&&_!==jl.AXIS&&o.length===1&&(v=o[0]),v&&s.has(v)&&m[_].add(v),h.push({slotIndex:n,event:e,side:_,actorId:v}))})):t.push(se(`err.eventsNotArray`,{at:r})):t.push(se(`err.slotShape`,{at:r}))});let g=n.map(e=>Fl(e)?e.id:null).filter(Boolean),_=e=>g.filter(t=>m[e].has(t)),v=e=>{let t=_(e),n=u&&g.filter(t=>d.get(t)===e).length>1;return t.length||!u?t.map(t=>({key:`${e}:${t}`,side:e,actorId:t,actorName:s.get(t)?.name,named:n})):[{key:e,side:e,actorId:null}]},y=[];y.push(...v(jl.SIDE1).reverse());let b=y.length;y.push({key:jl.AXIS,side:jl.AXIS}),y.push(...v(jl.SIDE2));let x=new Map(y.map((e,t)=>[e.key,t])),S=a.map((e,t)=>({index:t,cells:new Map})),C=new Map,w=0;return h.forEach(({slotIndex:e,event:n,side:r,actorId:i})=>{let a=r===jl.AXIS?jl.AXIS:`${r}:${i}`,o=x.get(a);if(o===void 0)return;w+=1;let s=S[e];if(s.cells.has(a)){let r=s.cells.get(a);t.push(se(`err.oneEventPerCell`,{at:`slots[${e}]`,a:r.id,b:n.id}))}else s.cells.set(a,n);C.set(n.id,{row:e,col:o,key:a})}),{errors:t,byActor:u,sideLabels:{[jl.SIDE1]:r[0]?.label??``,[jl.SIDE2]:r[1]?.label??``,[jl.AXIS]:r[2]?.label??``},columns:y,rows:S,placements:C,axisColumnIndex:b,actorById:s,groupById:c,groupIndexById:l,sourceById:f,eventCount:w}}function Ll(e){return e===jl.SIDE1?0:e===jl.SIDE2?1:2}function Rl(e){let t=1;for(let n of e.rows)n.cells.forEach(e=>{let n=El(e.label||``);t=Math.max(t,Math.min(2,Math.ceil(n/Uce)))});return t}function Kce(e,t){if(!t.actors)return 0;let n=0;for(let t of e.rows)t.cells.forEach(t=>{let r=(Array.isArray(t.actorIds)?t.actorIds:[]).map(t=>e.actorById.get(t)?.name||t);if(r.length===0)return;let i=r.reduce((e,t)=>e+Dl(t,10)+14,0)+4*(r.length-1);n=Math.max(n,Math.ceil(i/262))});return n}function qce(e,t){let n=new Set;return e.cells.forEach((e,r)=>{let i=t.columns.findIndex(e=>e.key===r);i>=0&&n.add(i)}),n}var zl=.5;function Bl(e,t){if(!t)return e.rows.map((e,t)=>t);let n=e.rows.map(t=>qce(t,e)),r=[];return n.forEach((e,t)=>{let i=t===0?0:r[t-1]+zl;for(let a=0;a<t;a++)[...e].some(e=>n[a].has(e))&&(i=Math.max(i,r[a]+1));r.push(i)}),r}function Jce(e,t,n,r=!1){let i=e.columns.length,a=e.rows.length,o=Rl(e),s=Kce(e,t),c=Ol(t,o,s),l=c+28,u=n?316:l,d=n?l:316,f=new Set;e.rows.forEach(e=>e.cells.forEach((e,t)=>f.add(t)));let p=[],m=0;e.columns.forEach(e=>{let t=f.has(e.key)?d:n?52:104;p.push({start:m,size:t}),m+=t});let h=n?150:0,g=n?0:96,_=n?u:d,v=n?d:u,y=r&&!n,b=Bl(e,y),x=a===0?0:(b[a-1]+1)*u,S=(e,t)=>n?{x:h+b[e]*u,y:p[t].start}:{x:p[t].start,y:g+b[e]*u},C=p[e.axisColumnIndex]??{start:0,size:d};return{isH:n,colCount:i,rowCount:a,labelLines:o,actorLines:s,cardH:c,cellH:l,slotExtent:u,laneExtent:d,lanes:p,originX:h,originY:g,cellBoxW:_,cellBoxH:v,cellAt:S,rowTops:b,timeSpan:x,staggered:y,axisCenter:C.start+C.size/2,contentW:n?h+x+6:m,contentH:n?m:g+x+6}}var Vl={draggable:!1,selectable:!1,connectable:!1,focusable:!1};function Hl(e,t,n){let r=(Array.isArray(e.actorIds)?e.actorIds:[]).map(e=>t.actorById.get(e)?.name||e),i=(Array.isArray(e.sourceIds)?e.sourceIds:[]).map(e=>t.sourceById.get(e)).filter(Boolean);return{event:e,actorNames:r,sources:i,sourceCount:i.length,row:n}}function Yce(e){return{id:`__cells__`,type:`cells`,position:{x:0,y:0},width:1,height:1,style:{pointerEvents:`none`},data:{cols:e.colCount,rows:e.rowCount,cellW:e.cellBoxW,cellH:e.cellBoxH,lanes:e.lanes,originX:e.originX,originY:e.originY,isH:e.isH},...Vl}}function Ul(e,t){let n=t=>e.columns.filter(e=>e.side===t).length,r=t=>e.columns.findIndex(e=>e.side===t),i=[];return e.columns.forEach((a,o)=>{let s=n(a.side),c=a.side!==jl.AXIS&&(s>1||a.named),l=o===r(a.side),u={type:`colHeader`,...Vl},d={isH:t.isH,side:a.side,groupIndex:Ll(a.side)};if(!c){i.push({...u,id:`__head__${a.key}`,position:t.isH?{x:0,y:t.lanes[o].start}:{x:t.lanes[o].start,y:0},data:{...d,width:t.isH?150:t.lanes[o].size,height:t.isH?t.lanes[o].size:null,sideTitle:e.sideLabels[a.side],colTitle:null}});return}if(t.isH){i.push({...u,id:`__head__${a.key}`,position:{x:0,y:t.lanes[o].start},data:{...d,width:150,height:t.lanes[o].size,sideTitle:l?e.sideLabels[a.side]:null,colTitle:a.actorName}});return}if(!l)return;let f=e.columns.slice(o,o+s);i.push({...u,id:`__head__${a.key}`,position:{x:t.lanes[o].start,y:0},data:{...d,width:t.lanes.slice(o,o+s).reduce((e,t)=>e+t.size,0),height:null,sideTitle:e.sideLabels[a.side],colTitle:null,actors:f.map(e=>e.actorName),laneWs:t.lanes.slice(o,o+s).map(e=>e.size)}})}),i}function Xce(e,t){let n=e.rows.map(e=>t.rowTops[e.index]*t.slotExtent+t.slotExtent/2-5);return{id:`__axis__`,type:`axis`,position:t.isH?{x:t.originX,y:t.axisCenter-1}:{x:t.axisCenter-1,y:t.originY},data:{isH:t.isH,length:t.timeSpan,dotSize:10,dotOffsets:n},...Vl}}function Wl(e,t){return{id:`__links__`,type:`links`,position:{x:0,y:0},width:1,height:1,style:{pointerEvents:`none`},data:{segments:e,isH:t},...Vl}}function Gl(e,t,n,r,i,a){let o=i.cellAt(n,t),s=o.x+(i.cellBoxW-288)/2,c=o.y+(i.cellBoxH-i.cardH)/2,l=null;if(i.isH){let e=s+144;if(t<r.axisColumnIndex){let t=c+i.cardH;l={left:e,top:t,height:i.axisCenter-t}}else t>r.axisColumnIndex&&(l={left:e,top:i.axisCenter,height:c-i.axisCenter})}else{let e=c+i.cardH/2;if(t<r.axisColumnIndex){let t=s+288;l={left:t,top:e,width:i.axisCenter-t}}else t>r.axisColumnIndex&&(l={left:i.axisCenter,top:e,width:s-i.axisCenter})}return{node:{id:e.id,type:`card`,position:{x:s,y:c},data:{...Hl(e,r,n),groupIndex:Ll(r.columns[t].side),cardW:288,cardH:i.cardH,labelLines:i.labelLines,fields:a,isH:i.isH}},link:l}}function Kl(e,t={},n,r=`vertical`,{stagger:i=!1}={}){let a=r===`horizontal`,o=Il(e),s=Jce(o,t,a,i),c=[Yce(s),...Ul(o,s)],l=[],u=[];return o.rows.forEach(e=>{e.cells.forEach((n,r)=>{let i=o.columns.findIndex(e=>e.key===r);if(i<0)return;let{node:a,link:c}=Gl(n,i,e.index,o,s,t);l.push(a),c&&u.push(c)})}),u.length&&c.push(Wl(u,a)),c.push(Xce(o,s)),c.push(...l),{errors:o.errors,sideLabels:o.sideLabels,nodes:c,edges:[],grid:o,layout:`grid`,staggered:s.staggered,size:{width:s.contentW,height:s.contentH}}}function ql(e,t,n){let[r,i]=String(e).split(`T`),a=t?oe(n,`card.approxPrefix`):``;if(!i)return a+r;let o=i.split(`:`);return`${a}${r} ${o.slice(0,2).join(`:`)}${o[2]?`:`+o[2]:``}`}function Jl(e,t,n){let r=ql(t,!1,n);return String(e).split(`T`)[0]===String(t).split(`T`)[0]&&String(t).includes(`T`)?r.split(` `).pop():r}function Yl(e,t){if(!e.date)return oe(t,`card.dateUnknown`);let n=ql(e.date,e.approx,t);return e.dateEnd?`${n} - ${Jl(e.date,e.dateEnd,t)}`:n}function Xl(e,t,n=!1){if(!e.date)return[{text:oe(t,`chronicle.dateUnknown`),strong:!1}];let[r,i]=String(e.date).split(`T`),a=[{text:(e.approx?oe(t,`card.approxPrefix`):``)+r,strong:!0}],o=i?ql(e.date,!1,t).split(` `).pop():``;n&&o&&a.shift();let s=!a.length;if(!e.dateEnd)return o&&a.push({text:o,strong:s}),a;let c=Jl(e.date,e.dateEnd,t);return o&&!c.includes(`-`)?a.push({text:`${o} – ${c}`,strong:s}):(o&&a.push({text:o,strong:s}),a.push({text:`– ${c}`,strong:!1})),a}var Zce=12.5,Zl=4,Qce=6,$ce=10,ele=90,tle={latin:1.2,cjk:1.06},nle={latin:1.12,cjk:1.06},rle={sameSlot:10,none:22,short:38,long:70},Ql=864e5,D=/^(\d{4})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2})(?::(\d{2})(?::(\d{2}))?)?)?)?)?$/;function $l(e){let t=typeof e==`string`?D.exec(e):null;if(!t)return null;let[,n,r,i,a,o,s]=t,c=a==null?i==null?r==null?`year`:`month`:`day`:`time`;return{y:+n,mo:r?+r:1,d:i?+i:1,h:a?+a:0,mi:o?+o:0,s:s?+s:0,prec:c}}var ile={year:0,month:1,day:2,time:3},ale=e=>Date.UTC(e.y,e.mo-1,e.d,e.h,e.mi,e.s);function eu(e,t,n=!1){let r=$l(e),i=$l(t);if(!r||!i)return null;let a=ile[r.prec]<=ile[i.prec]?r.prec:i.prec,o=(e,t,r)=>({key:e,vars:t,long:r,approx:!!n});if(a===`year`||a===`month`){let e=a===`year`?(i.y-r.y)*12:(i.y-r.y)*12+(i.mo-r.mo);return e<=0?null:sle(e,o)}if(a===`time`){let e=ale(i)-ale(r);if(e<=0)return null;if(e<Ql){let t=Math.round(e/1e3);if(t<60)return o(`chronicle.gapSeconds`,{n:t},!1);if(t<3600)return o(`chronicle.gapMinutes`,{n:Math.round(t/60)},!1);let n=Math.floor(t/3600),r=Math.round((t-n*3600)/60);return r===60&&(n+=1,r=0),r?o(`chronicle.gapHoursMinutes`,{h:n,m:r},!1):o(`chronicle.gapHours`,{n},!1)}return tu(Math.floor(e/Ql),o)}let s=Math.round((Date.UTC(i.y,i.mo-1,i.d)-Date.UTC(r.y,r.mo-1,r.d))/Ql);return s<=0?null:tu(s,o)}function ole(e){let t=(e,t,n)=>({key:e,vars:t,long:n,approx:!1});if(!(e>0))return null;if(e<Ql){let n=Math.round(e/1e3);return n<60?t(`chronicle.gapSeconds`,{n},!1):n<3600?t(`chronicle.gapMinutes`,{n:Math.round(n/60)},!1):t(`chronicle.gapHours`,{n:Math.round(n/3600)},!1)}return tu(Math.round(e/Ql),t)}function tu(e,t){return e<30?t(`chronicle.gapDays`,{n:e},!1):sle(Math.max(1,Math.round(e/30.44)),t)}function sle(e,t){let n=Math.floor(e/12),r=e%12;return n?r?t(`chronicle.gapYearsMonths`,{y:n,m:r},!0):t(`chronicle.gapYears`,{n},!0):t(`chronicle.gapMonths`,{n:r},!0)}var nu=(e,t)=>e==null?t:t==null||e>t?e:t;function ru(e){let t=Array.isArray(e?.slots)?e.slots:[],n=[],r=null,i=!1,a=!1;return t.forEach((e,t)=>{let o=(Array.isArray(e?.events)?e.events:[]).filter(e=>e&&typeof e==`object`);if(!o.length)return;let s=o.every(e=>typeof e.date==`string`&&e.date),c=s?[...o].sort((e,t)=>e.date<t.date?-1:+(e.date>t.date)):o,l=c.find(e=>e.date)?.date??null,u=c.some(e=>e.date&&e.approx);c.forEach((e,o)=>{let c=o===0,d=null,f=`sameSlot`;c&&(n.length?(d=a&&s?eu(r,l,i||u):null,f=d?d.long?`long`:`short`:`none`):f=`top`);let p=typeof e.date==`string`&&e.date.length>=10?e.date.slice(0,10):null,m=n.at(-1)?.event,h=!!(p&&m&&typeof m.date==`string`&&m.date.slice(0,10)===p&&!e.approx);n.push({event:e,slotIndex:t,first:c,gap:d,spacing:f,sameDay:h})}),a=s,r=null;for(let e of c)r=nu(r,nu(e.date,e.dateEnd));i=c.some(e=>e.approx)}),n}var iu=[`circle`,`square`,`diamond`];function au(e,t){let n=(Array.isArray(e?.groups)?e.groups:[]).findIndex(n=>n?.id===Nl(e)(t));return n<0?`none`:iu[Math.min(n,2)]}function cle(e,t){let n=(Array.isArray(e?.groups)?e.groups:[]).findIndex(n=>n?.id===Nl(e)(t));return n>=0&&n<3?n:2}function ou(e,t,n,r){let i=[];if(n.actors)for(let t of Array.isArray(e.actorIds)?e.actorIds:[])i.push(Dl(r.get(t)?.name||t,10)+14);if(n.sources&&i.push(ele),!i.length)return 0;let a=1,o=0;for(let e of i){let t=o?$ce+e:e;o&&o+t>532?(a+=1,o=e):o+=t}return a}function lle({titleLines:e,summaryLines:t,tagLines:n,whenLineCount:r=3}){let i=20+20*Math.max(1,e);return t&&(i+=Zl+18*t),n&&(i+=Qce+20*n),Math.max(i,10+18*r)}function ule(e,t,n){let r=(e,t,r,i)=>n?Al(e,531,e=>n(e,t)):kl(e,532/r,i);return{title:Math.max(1,r(e.label||``,`title`,14,tle)),summary:t.summary&&e.summary?r(e.summary,`summary`,Zce,nle):0}}function su(e,t={},{measure:n}={}){let r=new Map((e?.actors||[]).filter(Boolean).map(e=>[e.id,e])),i=new Map((e?.sources||[]).filter(Boolean).map(e=>[e.id,e])),a=(Array.isArray(e?.groups)?e.groups.slice(0,3):[]).map((e,t)=>({label:e?.label,groupIndex:t,shape:iu[t]})).filter(e=>e.label),o=ru(e),s=[],c=[],l=[],u=[],d=a.length?34:0,f=null;o.forEach((a,o)=>{let{event:p}=a;if(f!=null){let e=rle[a.spacing]??rle.none;a.gap&&(l.push({y:f+e/2,gap:a.gap}),a.gap.long&&u.push({y0:f,y1:f+e})),d=f+e}let{title:m,summary:h}=ule(p,t,typeof n==`function`?n:null),g=ou(p,e,t,r),_=lle({titleLines:m,summaryLines:h,tagLines:g,whenLineCount:Xl(p,`en`,a.sameDay).length}),v=cle(e,p),y=(Array.isArray(p.actorIds)?p.actorIds:[]).map(e=>r.get(e)?.name||e),b=(Array.isArray(p.sourceIds)?p.sourceIds:[]).map(e=>i.get(e)).filter(Boolean);s.push({id:p.id,type:`entry`,position:{x:0,y:d},width:758,height:_,draggable:!1,connectable:!1,data:{event:p,index:o,groupIndex:v,shape:au(e,p),actorNames:y,sources:b,fields:t,lines:{title:m,summary:h,tags:g},sameDay:a.sameDay,cardH:_}}),c.push({y:d+20,groupIndex:v,shape:au(e,p),hollow:!p.date}),f=d+_});let p=f??0,m=[];return o.length&&m.push({id:`__spine__`,type:`spine`,position:{x:0,y:0},width:1,height:1,draggable:!1,selectable:!1,connectable:!1,focusable:!1,style:{pointerEvents:`none`},data:{x:174,top:c[0].y,bottom:c[c.length-1].y,dots:c,pills:l,breaks:u,dotSize:13}}),a.length&&m.push({id:`__legend__`,type:`legend`,position:{x:198,y:0},width:1,height:1,draggable:!1,selectable:!1,connectable:!1,focusable:!1,data:{groups:a}}),m.push(...s),{errors:[],nodes:m,edges:[],items:o,eventCount:o.length,layout:`chronicle`,size:{width:758,height:p}}}var dle=12,fle=40,cu=12.5,lu={latin:1.2,cjk:1.06},uu=(e,t=1)=>16+17*e+2+15*t,ple=e=>e?.dateEnd&&Dl(Yl(e,`en`),11)*1.05>176?2:1,du=uu(2,2)+10,mle=10,fu=22,pu=12,mu=e=>pu+Math.max(1,e)*du+fu,hu=14,gu=864e5,_u=36e5;function vu(e){let t=$l(e?.date);if(!t)return null;let n=e=>Date.UTC(e.y,e.mo-1,e.d,e.h,e.mi,e.s),r=e=>e.prec===`year`?Date.UTC(e.y+1,0,1):e.prec===`month`?Date.UTC(e.y,e.mo,1):e.prec===`day`?Date.UTC(e.y,e.mo-1,e.d+1):n(e),i=n(t),a=$l(e?.dateEnd);return a&&r(a)>i?{from:i,to:r(a),kind:`bar`,exact:!0}:t.prec===`time`?{from:i,to:i,kind:`dot`,exact:!0}:{from:i,to:r(t),kind:`band`,exact:!1,prec:t.prec}}var hle=e=>{let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2};function yu(e){let t=e.slice(1).map((t,n)=>t-e[n]),n=[],r=(e,n)=>{let r=[];for(let i=e+n;i>=0&&i<t.length&&r.length<3&&!(t[i]>=t[e]);i+=n)r.push(t[i]);return r};return t.forEach((e,t)=>{if(e<1728e5)return;let i=r(t,1);i.length||(i=r(t,-1)),i.length&&e/Math.max(hle(i),6e4)>=20&&n.push({i:t,g:e})}),n.sort((e,t)=>t.g-e.g).slice(0,2).map(e=>e.i).sort((e,t)=>e-t)}function bu(e){return e>730*gu?`year`:e>60*gu?`month`:e>2*gu?`day`:e>3*_u?`hour`:`minute`}function xu(e,t,n,r){let i=new Date(e),a=[],o={year:[1,2,5,10],month:[1,2,3,6],day:[1,2,7,14],hour:[1,2,3,6,12],minute:[1,2,5,10,15,30]}[n];for(let s of o){a.length=0;let o;o=n===`year`?Date.UTC(i.getUTCFullYear(),0,1):n===`month`?Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1):n===`day`?Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()):n===`hour`?Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),i.getUTCHours()):Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),i.getUTCHours(),i.getUTCMinutes());let c=0;for(;o<=t&&c++<2e3;){o>=e&&a.push(o);let t=new Date(o);n===`year`?o=Date.UTC(t.getUTCFullYear()+s,0,1):n===`month`?o=Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+s,1):o+=n===`day`?s*gu:n===`hour`?s*_u:s*6e4}if(a.length<=r)break}return[...a]}function gle(e,t,n){let r=new Date(e),i=e=>String(e).padStart(2,`0`),a=`${i(r.getUTCMonth()+1)}-${i(r.getUTCDate())}`;if(t===`year`)return String(r.getUTCFullYear());if(t===`month`)return`${r.getUTCFullYear()}-${i(r.getUTCMonth()+1)}`;if(t===`day`)return a;let o=`${i(r.getUTCHours())}:${i(r.getUTCMinutes())}`;return n==null||new Date(n).getUTCDate()!==r.getUTCDate()?`${a} ${o}`:o}function _le(e,t){let n=new Map,r=(Array.isArray(e?.actors)?e.actors:[]).filter(e=>e?.id);if(!t||r.length<2)return n;for(let t of Array.isArray(e?.groups)?e.groups.slice(0,2):[]){let e=r.filter(e=>t?.id&&e.groupId===t.id);e.length>=2&&n.set(t.id,e)}return n}function vle(e,{byParty:t=!1}={}){let n=Nl(e),r=_le(e,t);return e=>{let t=n(e),i=Array.isArray(e?.actorIds)?e.actorIds:[];return i.length===1&&r.get(t)?.some(e=>e.id===i[0])?`actor:${i[0]}`:t}}function yle(e,t,{byParty:n=!1}={}){let r=vle(e,{byParty:n}),i=_le(e,n),a=(Array.isArray(e?.groups)?e.groups.slice(0,3):[]).filter(e=>e&&e.id),o=new Set(t.map(r)),s=a.flatMap((e,t)=>{let n=i.get(e.id)?.filter(e=>o.has(`actor:${e.id}`));return n?.length?n.map(n=>({key:`actor:${n.id}`,label:n.name??``,side:e.label??``,groupIndex:t})):[{key:e.id,label:e.label??``,groupIndex:t}]}),c=new Set(s.map(e=>e.key));return t.some(e=>!c.has(r(e)))&&s.push({key:`__other__`,label:null,groupIndex:2,other:!0}),s}function Su(e,{levels:t=3,width:n=196,gap:r=mle}={}){let i=e.map(e=>({ids:[e.id],x:e.x,from:e.x,to:e.x}));for(;;){let e=Cu(i,t,n,r);if(e)return e;let a=-1,o=1/0;for(let e=0;e+1<i.length;e++){let t=i[e+1].x-i[e].x;t<o&&(o=t,a=e)}if(a<0)return Cu(i,t,n,r)??[];let s=i[a],c=i[a+1],l=[...s.ids,...c.ids],u=Math.min(s.from,c.from),d=Math.max(s.to,c.to);i.splice(a,2,{ids:l,x:(u+d)/2,from:u,to:d}),i=i.sort((e,t)=>e.x-t.x)}}function Cu(e,t,n,r){let i=Array(t).fill(-1/0),a=[];for(let t of e){let e=t.x-n/2,o=i.findIndex(t=>t+r<=e);if(o<0)return null;i[o]=t.x+n/2,a.push({...t,level:o})}return a}function ble(e,t={},{measure:n,byParty:r=!1}={}){let i=new Map((e?.actors||[]).filter(Boolean).map(e=>[e.id,e])),a=new Map((e?.sources||[]).filter(Boolean).map(e=>[e.id,e])),o=[];(Array.isArray(e?.slots)?e.slots:[]).forEach((e,t)=>{for(let n of Array.isArray(e?.events)?e.events:[])n&&typeof n==`object`&&o.push({event:n,slotIndex:t})}),o.forEach(e=>e.time=vu(e.event)),o.forEach(e=>{e.time?.exact&&(e.time.t=e.time.from)});let s=e=>({before:o.slice(0,e).reverse().find(e=>e.time?.exact),after:o.slice(e+1).find(e=>e.time?.exact)}),c=o.filter(e=>e.time?.exact).map(e=>e.time.t),l=c.length>1?Math.max(6e4,(Math.max(...c)-Math.min(...c))/20):_u,u=(e,t,n)=>{let{before:r,after:i}=s(e),a;return a=r&&i?(r.time.t+i.time.t)/2:r?r.time.t+l:i?i.time.t-l:t==null?e*_u:(t+n)/2,t==null?a:Math.min(Math.max(a,t),n-1)};o.forEach((e,t)=>{e.time&&!e.time.exact&&(e.time.t=u(t,e.time.from,e.time.to))}),o.forEach((e,t)=>{if(e.time)return;let n=o.slice(0,t).reverse().find(e=>e.time),r=o.slice(t+1).find(e=>e.time),i=n&&r?(n.time.t+r.time.t)/2:n?n.time.t+l:r?r.time.t-l:t*_u;e.time={t:i,from:i,to:i,kind:`dot`,undated:!0}});let d=[...new Set(o.map(e=>e.time.t))].sort((e,t)=>e-t),f=[...new Set(o.filter(e=>!e.time.undated).map(e=>e.time.t))].sort((e,t)=>e-t),p=f.length?f:d,m=yu(p),h=[],g=0;for(let e of m)h.push([p[g],p[e]]),g=e+1;h.push([p[g],p[p.length-1]]),h[0][0]=Math.min(h[0][0],d[0]),h[h.length-1][1]=Math.max(h[h.length-1][1],d[d.length-1]);let _=e=>{let t=h.findIndex(([,t])=>e<=t);return t<0?h.length-1:t},v=h.map(([e,t],n)=>({index:n,from:e,to:t,count:o.filter(e=>_(e.time.t)===n).length,unit:t>e?bu(t-e):`day`})),y=e=>Dl(e,dle)*1.06,b=yle(e,o.map(e=>e.event),{byParty:r}).flatMap(e=>[e.label||``,e.side||``]),x=Math.round(Math.min(196,Math.max(132,...b.map(e=>y(e)+fle)))),S=x;v.forEach((e,t)=>{if(t>0){let n=e.from-v[t-1].to;e.breakBefore={x:S,w:64,gap:ole(n)},S+=64}e.x0=S,e.w=Math.max(170,e.count*116),e.x1=S+e.w,S=e.x1});let C=S,w=e=>{let t=v[_(e)],n=t.w-196;return t.to===t.from?t.x0+t.w/2:t.x0+98+(Math.min(Math.max(e,t.from),t.to)-t.from)/(t.to-t.from)*n},T=(e,t)=>Math.min(Math.max(e,v[t].from),v[t].to),ee=yle(e,o.map(e=>e.event),{byParty:r}),te=vle(e,{byParty:r}),ne=e=>{let t=ee.findIndex(t=>t.key===te(e));return t>=0?t:ee.length-1},re=[],ie=[],ae=e=>re[e],se=e=>re[e]+ie[e],ce=o.map((e,t)=>{let n=_(e.time.t),r=e.time.kind,i=w(r===`dot`?e.time.t:T(e.time.from,n)),a=r===`dot`?i:w(T(e.time.to,n)),o=r===`bar`?i:w(e.time.t),s=v[n],c=r===`band`&&s.to>s.from&&e.time.to-e.time.from>s.to-s.from,l=r===`band`&&(c||a-i<8)?`dot`:r;return l===`dot`?i=a=o:a-i<6&&(a=i+6),{id:e.event.id,order:t,lane:ne(e.event),kind:l,x:o,x0:i,x1:a,undated:!!e.time.undated,coarse:c,prec:e.time.prec,event:e.event}}),le=new Map;for(let e of ce){let t=`${e.lane}:${Math.round(e.x)}`;e.stack=le.get(t)??0,le.set(t,e.stack+1)}let ue=e=>Math.min(2,Math.max(1,n?Al(e,173,e=>n(e,`title`)):kl(e,176/cu,lu))),de=[],fe=[],pe=ee.map((e,t)=>{let n=ce.filter(e=>e.lane===t).sort((e,t)=>e.x-t.x||e.order-t.order),r=e=>Math.min(Math.max(e,x+4+98),C-98);return Su(n.map(e=>({id:e.id,x:r(e.x)})))}),me=0;pe.forEach((e,t)=>{re[t]=me,ie[t]=e.length?mu(Math.max(0,...e.map(e=>e.level))+1):34,me+=ie[t]}),pe.forEach((e,t)=>{let n=e=>{let t=e.ids.map(e=>ce.find(t=>t.id===e).x);return(Math.min(...t)+Math.max(...t))/2};for(let r of e){let e=r.x-98,i=r.ids.map(e=>ce.find(t=>t.id===e)).sort((e,t)=>e.order-t.order),a=i.length>1,o=a?1:ue(i[0].event.label||``),s=a?1:i[0].undated?Dl(oe(`en`,`scale.undated`),11)*1.05>176?2:1:ple(i[0].event),c=uu(o,s),l=se(t)-fu-r.level*du,u={id:a?`__run__${fe.length+1}`:i[0].id,lane:t,level:r.level,x:e,y:l-c,w:196,h:c,titleLines:o,timeLines:s,anchor:n(r),members:i};a&&(u.run=fe.length+1,u.span=[Math.min(...i.map(e=>e.x0)),Math.max(...i.map(e=>e.x1))],fe.push(u)),de.push(u)}});let he=re.length?re[re.length-1]+ie[ie.length-1]:0,ge=he+14,_e=v.flatMap(e=>{let t=Math.max(2,Math.floor(e.w/84)),n=e.to>e.from?xu(e.from,e.to,e.unit,t):[],r=e.unit;return n.length||(n=e.to>e.from?[e.from,e.to]:[e.from],r=e.to>e.from?`minute`:`day`),n.map((e,t)=>({x:w(e),label:gle(e,r,t?n[t-1]:null)}))}),ve=fe.reduce((e,t)=>e+1+t.members.length,0),ye=fe.length?hu+ve*18:0,be=he+56+ye,xe=e=>ee[ne(e)].groupIndex,Se=[{id:`__scale__`,type:`scaleLayer`,position:{x:0,y:0},width:1,height:1,draggable:!1,selectable:!1,connectable:!1,focusable:!1,style:{pointerEvents:`none`},data:{width:C,labelW:x,lanesH:he,axisY:ge,lanes:ee.map((e,t)=>({...e,top:ae(t),lineY:se(t)})),segments:v,ticks:_e,marks:ce.map(e=>({id:e.id,kind:e.kind,x:e.x,x0:e.x0,x1:e.x1,y:se(e.lane)-e.stack*12,undated:e.undated,coarse:e.coarse,prec:e.prec,approx:!!e.event.approx,groupIndex:ee[e.lane].groupIndex})),leaders:de.map(e=>({x:Math.min(Math.max(e.anchor,e.x+8),e.x+e.w-8),y0:e.y+e.h,y1:se(e.lane)-6,run:!!e.run})),brackets:fe.map(e=>({x0:e.span[0],x1:e.span[1],y:se(e.lane)+9,run:e.run}))}}];for(let e of de)Se.push({id:e.id,type:e.run?`scaleRun`:`scaleCard`,position:{x:e.x,y:e.y},width:e.w,height:e.h,draggable:!1,connectable:!1,data:e.run?{run:e.run,events:e.members.map(e=>e.event),groupIndex:ee[e.lane].groupIndex,cardH:e.h}:{event:e.members[0].event,undated:e.members[0].undated,groupIndex:xe(e.members[0].event),titleLines:e.titleLines,timeLines:e.timeLines,cardH:e.h,actorNames:(Array.isArray(e.members[0].event.actorIds)?e.members[0].event.actorIds:[]).map(e=>i.get(e)?.name||e),sources:(Array.isArray(e.members[0].event.sourceIds)?e.members[0].event.sourceIds:[]).map(e=>a.get(e)).filter(Boolean)}});return fe.length&&Se.push({id:`__runs__`,type:`scaleRunList`,position:{x,y:he+56+hu},width:1,height:1,draggable:!1,selectable:!1,connectable:!1,focusable:!1,data:{runs:fe.map(e=>({run:e.run,events:e.members.map(e=>e.event)})),width:C-x,lh:18}}),{errors:[],nodes:Se,edges:[],layout:`scale`,eventCount:o.length,segments:v,gathered:fe.map(e=>({run:e.run,ids:e.members.map(e=>e.id)})),cards:de.map(e=>({id:e.id,lane:e.lane,level:e.level,x:e.x,y:e.y,w:e.w,h:e.h,ids:e.members.map(e=>e.id)})),undated:ce.filter(e=>e.undated).length,labelW:x,size:{width:C,height:be}}}function wu(e,t){if(!e||!t||!e.width||!e.height)return 1;let n=t.width/(e.width*1.12),r=t.height/(e.height*1.12);return Math.min(n,r,1)}function Tu(e,t){return!e||!t||!e.width?1:Math.min(t.width/(e.width*1.12),1)}var Eu={width:1600,height:900},Du=(e,t)=>Math.round(e*Math.min(t,1)*10)/10;function Ou(e,t){let n=`Text on one screen (${e.canvas.width}×${e.canvas.height})`,r=Du(e.font,e.open.fit),i=Du(e.font,e.other.fit),a=e=>e.toFixed(1),o=[];e.open.fit>=1&&e.other.fit>=1?o.push(`${n}: full size (${e.font} px) either way.`):o.push(`${n}: ${a(r)} px as it opens (${e.open.name}), ${a(i)} px ${e.other.name}. Full size is ${e.font} px.`);let s=Math.max(r,i);if(s<9?o.push(`Note: the text is too small to read without zooming in (under 9 px). Consider ${t}; do not drop facts to make it fit.`):s<11&&o.push(`Note: the text is small (under 11 px); the reader can zoom in. ${t[0].toUpperCase()}${t.slice(1)} would make it easier to read.`),e.folded!==void 0&&s<11){let t=e.folded>=1?`full size (${e.font} px)`:`${a(Du(e.font,e.folded))} px`;o.push(`With every issue folded the text is ${t}: the reader can fold issues ("Fold issues" in the bar) instead of your splitting it.`)}return o}var ku={envelope:[{name:`type`,req:`yes`,ty:`string`,note:`always "fact"`},xl(2),{name:`title`,req:`yes`,ty:`string`,note:`diagram title, shown at the top left`}],actors:[{name:`id`,req:`yes`,ty:`string`,note:`unique within the diagram; events reference it via actorIds`},{name:`name`,req:`yes`,ty:`string`,note:`display name, e.g. "Huayuan Trading"`},{name:`role`,req:`no`,ty:`string`,note:`procedural standing, e.g. "plaintiff"`},{name:`groupId`,req:`*`,ty:`string`,note:`the side this party is on: the 1st or the 2nd group. Required with 2 or more parties; not written with one`}],groups:[{name:`id`,req:`yes`,ty:`string`,note:`parties (2 or more) or events (one party) reference it via groupId`},{name:`label`,req:`yes`,ty:`string`,note:`column heading, e.g. "Sun Hao's side" (parties) or "performance as agreed" (one party's acts)`},{name:``,req:``,ty:``,note:`at most 3: the 1st on the left (top) side, the 2nd on the right (bottom) side, the 3rd on the axis`},{name:``,req:``,ty:``,note:`2 or more parties: the groups split the parties. 0 or 1 party: they split the events by kind of act`}],sources:[{name:`id`,req:`yes`,ty:`string`,note:`events reference it via sourceIds`},{name:`type`,req:`yes`,ty:`string`,note:`contract / evidence / judgment / transcript, etc.`},{name:`name`,req:`yes`,ty:`string`,note:`material name, e.g. "corridor surveillance video"`},{name:`loc`,req:`no`,ty:`object`,note:`location, e.g. { file, page } or { file, timestamp }`},{name:`quote`,req:`no`,ty:`string`,note:`verbatim excerpt (several passages joined with ……), shown when the card is opened; a shortened or reworded version goes in detail`}],slots:[{name:`events`,req:`yes`,ty:`array`,note:`events at this time point; must not be empty`},{name:``,req:``,ty:``,note:`array order is chronological order; date is display-only and never reorders`}],events:[{name:`id`,req:`yes`,ty:`string`,note:`unique within the diagram`},{name:`date`,req:`no`,ty:`string`,note:`ISO 8601. Go to seconds when known, otherwise stop at the day. **Leave it out when the material gives no date: never make one up.** The card then says the date is unknown; the order is the order of slots, so nothing moves`},{name:`label`,req:`yes`,ty:`string`,note:`card title; about 20 characters per line, at most two lines`},{name:`dateEnd`,req:`no`,ty:`string`,note:`for a span, the end instant; needs date, and must not be earlier than it`},{name:`approx`,req:`no`,ty:`boolean`,note:`time is not exact (estimated or inferred); the diagram shows "approx."`},{name:`dateNote`,req:`no`,ty:`string`,note:`why the time is not exact, and how it was derived`},{name:`summary`,req:`no`,ty:`string`,note:`the line under the card title; about 22 characters`},{name:`detail`,req:`no`,ty:`string`,note:`full text revealed when the card is opened`},{name:`actorIds`,req:`no`,ty:`string[]`,note:`parties involved. One: that party's side and column. Two or more, or none: the centre axis`},{name:`groupId`,req:`*`,ty:`string`,note:`only when the diagram has 0 or 1 party: which side this event falls on. With 2 or more parties, leave it out`},{name:`sourceIds`,req:`no`,ty:`string[]`,note:`which materials it rests on`}]};function Au(){let e=[`Fields of a fact spec. "yes" means required.`,``];for(let[t,n]of Object.entries(ku)){e.push(`[${t}]`);for(let t of n)t.name?e.push(` ${t.name.padEnd(12)} ${t.req.padEnd(3)} ${t.ty.padEnd(15)} ${t.note}`):e.push(` · ${t.note}`);e.push(``)}return e.push(`"*": required or not depending on the number of parties, as the note says.`),e.push(`Cross-field rules (dangling references, a span running backwards, a party without a`),e.push(`side, two events in the same lane of one time slot) are not listed`),e.push(`above: call antu_validate after writing. It reports each problem with its field path.`),e.join(`
1493
1493
  `)}function ju(e,t,{fields:n,canvas:r}){let i=t(e,n),a=Number(Tu(i.size,r).toFixed(3)),o=Number(wu(i.size,r).toFixed(3)),s=Math.max(1,Math.round(i.size.height*a/r.height*10)/10),c=i.items.filter(e=>e.gap);return{text:{font:14,canvas:r,open:{name:`fitted to width`,fit:a},other:{name:`whole column`,fit:o}},counts:{slots:Array.isArray(e.slots)?e.slots.length:0,events:i.items.length,actors:e.actors?.length??0,sources:e.sources?.length??0},size:i.size,screens:s,gaps:{short:c.filter(e=>!e.gap.long).length,long:c.filter(e=>e.gap.long).length},undated:i.items.filter(e=>!e.event.date).length}}function Mu(e){let t=[];return t.push(`Kind: chronicle (every event in one column, in slot order; orientation does not apply)`),t.push(`Data: ${e.counts.events} events / ${e.counts.slots} time slots / ${e.counts.actors} parties / ${e.counts.sources} sources`),t.push(`Content ${e.size.width}×${e.size.height}; it opens fitted to its width, about ${e.screens} screen(s) tall`),t.push(`Gaps written between time points: ${e.gaps.short} short, ${e.gaps.long} of 30 days or more (marked)`),e.undated&&t.push(`${e.undated} event(s) without a date: shown in slot order with a hollow dot, and no gap on either side`),t.push(...Ou(e.text,`splitting the case into periods, one diagram each`)),t.join(`
1494
1494
  `)}function Nu(e,t,{canvas:n}){let r=t(e,{}),i=Number(wu(r.size,n).toFixed(3));return{text:{font:cu,canvas:n,open:{name:`fitted whole`,fit:i},other:{name:`fitted whole`,fit:i}},counts:{events:r.eventCount,actors:e.actors?.length??0,sources:e.sources?.length??0},size:r.size,segments:r.segments.map(e=>({unit:e.unit,count:e.count})),gathered:r.gathered.map(e=>e.ids.length),undated:r.undated}}function Pu(e){let t=[];return t.push(`Kind: scale (distance on the axis is real time; orientation does not apply)`),t.push(`Data: ${e.counts.events} events / ${e.counts.actors} parties / ${e.counts.sources} sources`),t.push(`Content ${e.size.width}×${e.size.height}`),t.push(e.segments.length>1?`The axis breaks into ${e.segments.length} segments: ${e.segments.map((e,t)=>`${t+1}. by ${e.unit}, ${e.count} event(s)`).join(`; `)}`:`One segment, by ${e.segments[0]?.unit??`day`}`),e.gathered.length&&t.push(`${e.gathered.length} run(s) of events too close to show one by one are gathered (${e.gathered.join(`, `)} events); they are listed in full under the diagram`),e.undated&&t.push(`${e.undated} event(s) without a date: placed between their neighbours in data order, with a hollow dot`),t.push(...Ou(e.text,`splitting the case into periods, one diagram each`)),t.join(`
1495
1495
  `)}var Fu={specVersion:2,label:`graphType.fact`,fields:ku,describe:Au,validate:e=>Il(e).errors,notes:e=>[...Fce(e),...Ice(e)],info:(e,t,n)=>{let r=Array.isArray(e.slots)?e.slots:[],i=r.flatMap(e=>(e?.events||[]).map(e=>e?.date)).filter(e=>typeof e==`string`&&e).sort(),a=t(`info.slots`,{n:n(r.length)});if(i.length>0){let e=i[0].slice(0,10),n=i[i.length-1].slice(0,10);a+=e===n?` · ${e}`:` · ${t(`info.span`,{from:e,to:n})}`}return[a,t(`info.actors`,{n:n(e.actors?.length||0)}),t(`info.sources`,{n:n(e.sources?.length||0)})]},report:(e,t,{orientation:n,fields:r={summary:!0},kind:i,canvas:a})=>{if(i===`chronicle`)return ju(e,t,{fields:r,canvas:a});if(i===`scale`)return Nu(e,t,{canvas:a});let o=t(e,r,void 0,n??`vertical`),s=Il(e),c={side1:0,axis:0,side2:0};s.columns.forEach(e=>{c[e.side]+=1});let l={events:o.eventCount??s.eventCount??0,columns:c,blocked:o.errors.length>0?o.errors[0]:null},u={};for(let n of[`vertical`,`horizontal`]){let i=t(e,r,void 0,n,{stagger:!0});u[n]={size:i.size,fit:Number(wu(i.size,a).toFixed(3))}}let d=t(e,r,void 0,`vertical`,{stagger:!1}),f={size:d.size,fit:Number(wu(d.size,a).toFixed(3))},p=Array.isArray(e.slots)?e.slots.length:0,m=n??(p>=5?`vertical`:`horizontal`),h=m===`vertical`?`horizontal`:`vertical`;return{text:{font:13,canvas:a,open:{name:m,fit:u[m].fit},other:{name:h,fit:u[h].fit}},unstaggered:f,counts:{slots:p,events:(e.slots??[]).reduce((e,t)=>e+(t?.events?.length||0),0),actors:e.actors?.length??0,sources:e.sources?.length??0},byOrientation:u,suggestedOrientation:p>=5?`vertical`:`horizontal`,placement:l}},formatReport:e=>{if(e.kind===`chronicle`)return Mu(e);if(e.kind===`scale`)return Pu(e);let t=[];t.push(`Data: ${e.counts.events} events / ${e.counts.slots} time slots / ${e.counts.actors} parties / ${e.counts.sources} sources`);let n=e.byOrientation.vertical,r=e.byOrientation.horizontal,i=e.unstaggered,a=i&&(i.size.height!==n.size.height||i.size.width!==n.size.width)?` (rows staggered, the page's default; with "Stagger" off ${i.size.width}×${i.size.height}, fit zoom ${i.fit})`:``;t.push(`Vertical: content ${n.size.width}×${n.size.height}, fit zoom ${n.fit}${a}`),t.push(`Horizontal: content ${r.size.width}×${r.size.height}, fit zoom ${r.fit}`),t.push(e.suggestedOrientation===`vertical`?`Suggested orientation: vertical (by the slot-count rule, ${e.counts.slots} slots >= 5)`:`Suggested orientation: horizontal (by the slot-count rule, ${e.counts.slots} slots < 5)`),t.push(...Ou(e.text,`splitting the timeline into periods, one diagram each`));let o=e.placement;return t.push(`Columns: side1 ${o.columns.side1} / axis ${o.columns.axis} / side2 ${o.columns.side2}, ${o.events} events`),o.blocked&&(t.push(`Does not fit: ${o.blocked}`),t.push(`Common cause: two or more events of one time slot fall in the same lane (the grid is one event per cell).`),t.push(`How to fix: split that time slot into two finer time points, or check the parties of the events so they land in different lanes.`)),t.join(`
@@ -1531,7 +1531,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
1531
1531
  `)},summarize:e=>{let t=Array.isArray(e.nodes)?e.nodes.length:0,n=Array.isArray(e.links)?e.links.length:0,r=Array.isArray(e.groups)?e.groups.length:0;return{nodes:t,links:n,groups:r,line:`${t} nodes / ${n} links / ${r} issues`}},validate:e=>ade(e),notes:e=>Qm(e),diagrams:{tree:{version:2,status:`experimental`,since:`0.2.0`}},layouts:{tree:fde}};_l(`fact`,Fu),_l(`procedure`,Lf),_l(`relationship`,Um),_l(`justification`,dh);function fh(e){let t=yl().map(e=>e.type),n=t.find(t=>bl(t).includes(e));return n?se(`err.envelopeTypeIsKind`,{type:e,owner:n}):se(`err.envelopeTypeUnknown`,{type:e,list:t.join(` / `)||`(none registered)`})}function mde(e){let t=[];if(!e||typeof e!=`object`||Array.isArray(e))return[se(`err.specNotObject`)];if(e.type?typeof e.type!=`string`&&t.push(se(`err.envelopeTypeString`)):t.push(se(`err.envelopeTypeRequired`)),e.title!==void 0&&typeof e.title!=`string`&&t.push(se(`err.envelopeTitleString`)),typeof e.type==`string`&&e.type){if(!vl(e.type))return[...t,fh(e.type)];let n=Mce(e,vl(e.type)?.specVersion);n&&t.push(se(n.key,n.params))}return t}function ph(e){let t=mde(e);if(t.length)return t;let n=Ace(e.type);return n?n(e):[]}var hde=Eu;function mh(e){try{return ph(e)}catch(e){return[`the validation layer itself threw: ${e.message}`]}}function gde(e){try{return vl(e?.type)?.notes?.(e)??[]}catch(e){return[`the notes layer itself threw: ${e.message}`]}}function hh(e,{orientation:t,fields:n,kind:r}={}){let i=e?.type,a=bl(i);if(r&&!a.includes(r))return{ok:!1,reason:`"${r}" is not a kind of ${i}: ${a.join(`, `)||`it has none`}`};let o=r??a[0]??null,s=jce(i,o),c=vl(i);return!s||!c?.report?{ok:!1,reason:`no geometry computation for type="${i}" kind="${o}" yet`}:{ok:!0,type:i,kind:o,...c.report(e,s,{orientation:t,fields:n,kind:o,canvas:hde})}}function gh(e,t){if(!t)return``;let n=bl(e?.type);return n.includes(t)?``:`"${t}" is not a kind of ${e?.type}: ${n.join(`, `)||`it has none`}`}function _de(e){return e.ok?vl(e.type).formatReport(e):e.reason}function _h(e){let t=mh(e);if(t.length===0){let t=gde(e),n=`Validation passed.`;return{ok:!0,text:t.length?`${n}\n\n${t.length} note(s), not errors:\n${t.map(e=>` - ${e}`).join(`
1532
1532
  `)}`:n}}let n=t.map((e,t)=>`${t+1}. ${e}`);return{ok:!1,text:`Validation failed, ${t.length} problem(s):\n\n${n.join(`
1533
1533
  `)}`}}function vh(e,{orientation:t,fields:n,kind:r}={}){let i=mh(e);if(i.length>0)return{ok:!1,text:`Validation has not passed yet; fix these before looking at the geometry:\n\n${i.map((e,t)=>`${t+1}. ${e}`).join(`
1534
- `)}`};let a=hh(e,{orientation:t,fields:n,kind:r});return a.ok?{ok:!0,text:_de(a)}:{ok:!1,text:a.reason}}var yh=`Passing validation does not mean it looks good. Look at the picture for what validation cannot see: are the cards or nodes crowded together, is the text too small to read, does a line run through a card, is the whole diagram mostly empty, are headings cut off. If it does not look right, change the JSON and look again.`;function bh(e,{outPath:t,preset:n}={}){return Dce(e,{outPath:t,preset:n,quiet:!0})}var xh=/\.(en|zh-CN)\.json$/i,Sh=e=>/\.zh-CN\.json$/i.test(e);function vde({type:e=`fact`,group:n=`agent`,lang:r=`en`}={}){let o=d(pl,`examples`),c=(e,t)=>{let n=JSON.parse(i(e,`utf8`));return{file:t,path:e,title:n.title,bytes:i(e).length,...vl(n.type)?.summarize?.(n)??{line:``}}},l=(e,n)=>t(e)?a(e).filter(e=>e.endsWith(`.json`)).filter(e=>!xh.test(e)||(r===`zh`?Sh(e):!Sh(e))).sort().map(t=>c(d(e,t),`${n}${t}`)):[];if(n===`raw`){let e=d(o,`raw`);return t(e)?a(e).filter(e=>e.endsWith(`.md`)).sort().map(t=>({file:`examples/raw/${t}`,path:d(e,t),bytes:s(d(e,t)).size})):[]}return n===`real`?l(d(o,String(e)),`examples/${e}/`):l(d(o,`agent`,String(e)),`examples/agent/${e}/`)}function yde(e,{lang:n=`en`}={}){let r=String(e).replace(/^examples\//,``).replace(RegExp(`^${pl.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}/examples/`),``);if(!(/^agent\/[\w-]+\/[\w.-]+\.json$/.test(r)||/^[\w-]+\/[\w.-]+\.json$/.test(r)||/^[\w.\u4e00-\u9fff-]+\.json$/.test(r)||/^raw\/[\w.\u4e00-\u9fff-]+\.md$/.test(r)))return null;let a=d(pl,`examples`,r);if(!t(a)&&n===`en`&&r.endsWith(`.json`)){let e=a.replace(/\.json$/i,`.en.json`);t(e)&&(a=e)}return t(a)?{path:a,text:i(a,`utf8`)}:null}function bde(){let e=d(pl,`spec/agent`);return t(e)?a(e,{withFileTypes:!0}).filter(n=>n.isDirectory()&&t(d(e,n.name,`guide.md`))).map(e=>e.name).sort():[]}function Ch(e=`fact`){let n=d(pl,`spec/agent`,String(e),`guide.md`);return t(n)?i(n,`utf8`):null}function xde(e=`fact`){let t=vl(e);return t?{ok:!0,text:t.describe()}:{ok:!1,reason:Sde(e)}}function Sde(e){return`no reference material for type "${e}" yet. Available: ${yl().map(e=>`${e.type} (${se(e.labelKey)})`).join(`, `)||`(none)`}.`}var wh=[`document`,`modern`,`legal`],Th={equity:{width:Zf.normal},control:{width:Zf.heavy},contract:{width:Zf.normal,dash:Qf.longDash},debt:{width:Zf.strong,dash:Qf.dashDot},guarantee:{width:Zf.normal,dash:Qf.dashed},kinship:{width:3.6,double:!0},employment:{width:Zf.normal,dash:Qf.dotted},agency:{width:Zf.strong,dash:`1 4`,round:!0},other:{width:Zf.hair,dash:`3 3`}},Eh={equity:{width:.85},control:{width:1.9},contract:{width:.85,dash:`5 3`},debt:{width:1.3,dash:`5 2 1.5 2`},guarantee:{width:.85,dash:`4 3`},kinship:{width:3.2,double:!0},employment:{width:.85,dash:Qf.dotted},agency:{width:1.3,dash:`1 4`,round:!0},other:{width:.6,dash:`3 3`}},Dh=(e,t)=>Object.fromEntries(Object.entries(e).map(([e,n])=>[e,{...n,stroke:t}])),Oh={neutral:{width:Zf.normal},positive:{width:Zf.strong},negative:{width:Zf.normal,dash:Qf.dashed}},kh={main:{width:Zf.strong},plain:{width:Zf.normal},back:{width:Zf.normal,dash:Qf.dashed}},Ah={conclusion:{width:Zf.heavy},norm:{width:Zf.normal},element:{width:Zf.normal},fact:{width:Zf.hair},inference:{width:Zf.normal,dash:Qf.dotted},judgement:{width:Zf.strong}},jh={for:{width:Zf.normal},against:{width:Zf.strong,dash:Qf.dashed},basis:{width:Zf.normal,dash:Qf.dotted}},Mh=(e,t)=>Object.fromEntries(Object.entries(e).map(([e,n])=>[e,{...n,...t[e]}]));Qf.dashed,Qf.dotted,Dh(Eh,`#767676`),Mh(Oh,{neutral:{stroke:`#111111`,fill:`#ffffff`},positive:{stroke:`#111111`,fill:`#ffffff`},negative:{stroke:`#111111`,fill:`#ececec`}}),Mh(kh,{main:{stroke:`#111111`},plain:{stroke:`#2b2b2b`},back:{stroke:`#4d4d4d`}}),Mh(Ah,{conclusion:{stroke:`#111111`,fill:`#ffffff`},norm:{stroke:`#111111`,fill:`#ececec`},element:{stroke:`#111111`,fill:`#ffffff`},fact:{stroke:`#111111`,fill:`#ffffff`},inference:{stroke:`#111111`,fill:`#ffffff`},judgement:{stroke:`#111111`,fill:`#ececec`}}),Mh(jh,{for:{stroke:`#2b2b2b`},against:{stroke:`#111111`},basis:{stroke:`#4d4d4d`}}),Qf.dashed,Qf.dotted,Dh(Th,`#475569`),Mh(Oh,{neutral:{stroke:`#64748b`,fill:`#f8fafc`},positive:{stroke:`#334155`,fill:`#f1f5f9`},negative:{stroke:`#64748b`,fill:`#f1f5f9`}}),Mh(kh,{main:{stroke:`#0f172a`},plain:{stroke:`#475569`},back:{stroke:`#64748b`}}),Mh(Ah,{conclusion:{stroke:`#0f172a`,fill:`#f1f5f9`},norm:{stroke:`#475569`,fill:`#e2e8f0`},element:{stroke:`#64748b`,fill:`#f8fafc`},fact:{stroke:`#94a3b8`,fill:`#ffffff`},inference:{stroke:`#64748b`,fill:`#f8fafc`},judgement:{stroke:`#334155`,fill:`#e2e8f0`}}),Mh(jh,{for:{stroke:`#475569`},against:{stroke:`#334155`},basis:{stroke:`#94a3b8`}}),Qf.dashed,Qf.dotted,{...Th.equity},{...Th.control},{...Th.contract},{...Th.debt},{...Th.guarantee},{...Th.kinship},{...Th.employment},{...Th.agency},{...Th.other},Mh(Oh,{neutral:{stroke:`#2f5aa8`,fill:`#eef3fb`},positive:{stroke:`#1f3f7f`,fill:`#e3ecfa`},negative:{stroke:`#9a1b1b`,fill:`#fbecec`}}),Mh(kh,{main:{stroke:`#13233f`},plain:{stroke:`#2d4366`},back:{stroke:`#5b6f8f`}}),Mh(Ah,{conclusion:{stroke:`#1f3f7f`,fill:`#e3ecfa`},norm:{stroke:`#4b3a8c`,fill:`#efecf8`},element:{stroke:`#2f5aa8`,fill:`#eef3fb`},fact:{stroke:`#8aa0c4`,fill:`#f8fafd`},inference:{stroke:`#1d6b6b`,fill:`#e8f4f4`},judgement:{stroke:`#13233f`,fill:`#dbe5f5`}}),Mh(jh,{for:{stroke:`#2d4366`},against:{stroke:`#9a1b1b`},basis:{stroke:`#4b3a8c`}});function Nh(e,t){return{release:e,types:yl().map(e=>e.type).filter(e=>!t||e===t).map(e=>({type:e,specVersion:vl(e).specVersion,diagrams:kce(e).map(({kind:e,version:t,status:n,since:r})=>({kind:e,version:t,status:n,since:r}))}))}}function Ph(e){let t=[`Antu ${e.release}`,``];for(let n of e.types){t.push(`${n.type}: format generation ${n.specVersion}`);let e=Math.max(...n.diagrams.map(e=>e.kind.length));n.diagrams.forEach((n,r)=>t.push(` ${n.kind.padEnd(e)} v${n.version} ${n.status} since ${n.since}${r===0?` (default)`:``}`))}return t.join(`
1534
+ `)}`};let a=hh(e,{orientation:t,fields:n,kind:r});return a.ok?{ok:!0,text:_de(a)}:{ok:!1,text:a.reason}}var yh=`Passing validation does not mean it looks good. Look at the picture for what validation cannot see: are the cards or nodes crowded together, is the text too small to read, does a line run through a card, is the whole diagram mostly empty, are headings cut off. If it does not look right, change the JSON and look again.`;function bh(e,{outPath:t,preset:n}={}){return Dce(e,{outPath:t,preset:n,quiet:!0})}var xh=/\.(en|zh-CN)\.json$/i,Sh=e=>/\.zh-CN\.json$/i.test(e);function vde({type:e=`fact`,group:n=`agent`,lang:r=`en`}={}){let o=d(pl,`examples`),c=(e,t)=>{let n=JSON.parse(i(e,`utf8`));return{file:t,path:e,title:n.title,bytes:i(e).length,...vl(n.type)?.summarize?.(n)??{line:``}}},l=(e,n)=>t(e)?a(e).filter(e=>e.endsWith(`.json`)).filter(e=>!xh.test(e)||(r===`zh`?Sh(e):!Sh(e))).sort().map(t=>c(d(e,t),`${n}${t}`)):[];if(n===`raw`){let e=d(o,`raw`);return t(e)?a(e).filter(e=>e.endsWith(`.md`)).sort().map(t=>({file:`examples/raw/${t}`,path:d(e,t),bytes:s(d(e,t)).size})):[]}return n===`real`?l(d(o,String(e)),`examples/${e}/`):l(d(o,`agent`,String(e)),`examples/agent/${e}/`)}function yde(e,{lang:n=`en`}={}){let r=String(e).replace(/^examples\//,``).replace(RegExp(`^${pl.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}/examples/`),``);if(!(/^agent\/[\w-]+\/[\w.-]+\.json$/.test(r)||/^[\w-]+\/[\w.-]+\.json$/.test(r)||/^[\w.\u4e00-\u9fff-]+\.json$/.test(r)||/^raw\/[\w.\u4e00-\u9fff-]+\.md$/.test(r)))return null;let a=d(pl,`examples`,r);if(!t(a)&&n===`en`&&r.endsWith(`.json`)){let e=a.replace(/\.json$/i,`.en.json`);t(e)&&(a=e)}return t(a)?{path:a,text:i(a,`utf8`)}:null}function bde(){let e=d(pl,`spec/agent`);return t(e)?a(e,{withFileTypes:!0}).filter(n=>n.isDirectory()&&t(d(e,n.name,`guide.md`))).map(e=>e.name).sort():[]}function Ch(e=`fact`){let n=d(pl,`spec/agent`,String(e),`guide.md`);return t(n)?i(n,`utf8`):null}function xde(e=`fact`){let t=vl(e);return t?{ok:!0,text:t.describe()}:{ok:!1,reason:Sde(e)}}function Sde(e){return`no reference material for type "${e}" yet. Available: ${yl().map(e=>`${e.type} (${se(e.labelKey)})`).join(`, `)||`(none)`}.`}var wh=[`document`,`modern`,`legal`,`dark`],Th={equity:{width:Zf.normal},control:{width:Zf.heavy},contract:{width:Zf.normal,dash:Qf.longDash},debt:{width:Zf.strong,dash:Qf.dashDot},guarantee:{width:Zf.normal,dash:Qf.dashed},kinship:{width:3.6,double:!0},employment:{width:Zf.normal,dash:Qf.dotted},agency:{width:Zf.strong,dash:`1 4`,round:!0},other:{width:Zf.hair,dash:`3 3`}},Eh={equity:{width:.85},control:{width:1.9},contract:{width:.85,dash:`5 3`},debt:{width:1.3,dash:`5 2 1.5 2`},guarantee:{width:.85,dash:`4 3`},kinship:{width:3.2,double:!0},employment:{width:.85,dash:Qf.dotted},agency:{width:1.3,dash:`1 4`,round:!0},other:{width:.6,dash:`3 3`}},Dh=(e,t)=>Object.fromEntries(Object.entries(e).map(([e,n])=>[e,{...n,stroke:t}])),Oh={neutral:{width:Zf.normal},positive:{width:Zf.strong},negative:{width:Zf.normal,dash:Qf.dashed}},kh={main:{width:Zf.strong},plain:{width:Zf.normal},back:{width:Zf.normal,dash:Qf.dashed}},Ah={conclusion:{width:Zf.heavy},norm:{width:Zf.normal},element:{width:Zf.normal},fact:{width:Zf.hair},inference:{width:Zf.normal,dash:Qf.dotted},judgement:{width:Zf.strong}},jh={for:{width:Zf.normal},against:{width:Zf.strong,dash:Qf.dashed},basis:{width:Zf.normal,dash:Qf.dotted}},Mh=(e,t)=>Object.fromEntries(Object.entries(e).map(([e,n])=>[e,{...n,...t[e]}]));Qf.dashed,Qf.dotted,Dh(Eh,`#767676`),Mh(Oh,{neutral:{stroke:`#111111`,fill:`#ffffff`},positive:{stroke:`#111111`,fill:`#ffffff`},negative:{stroke:`#111111`,fill:`#ececec`}}),Mh(kh,{main:{stroke:`#111111`},plain:{stroke:`#2b2b2b`},back:{stroke:`#4d4d4d`}}),Mh(Ah,{conclusion:{stroke:`#111111`,fill:`#ffffff`},norm:{stroke:`#111111`,fill:`#ececec`},element:{stroke:`#111111`,fill:`#ffffff`},fact:{stroke:`#111111`,fill:`#ffffff`},inference:{stroke:`#111111`,fill:`#ffffff`},judgement:{stroke:`#111111`,fill:`#ececec`}}),Mh(jh,{for:{stroke:`#2b2b2b`},against:{stroke:`#111111`},basis:{stroke:`#4d4d4d`}}),Qf.dashed,Qf.dotted,Dh(Th,`#475569`),Mh(Oh,{neutral:{stroke:`#64748b`,fill:`#f8fafc`},positive:{stroke:`#334155`,fill:`#f1f5f9`},negative:{stroke:`#64748b`,fill:`#f1f5f9`}}),Mh(kh,{main:{stroke:`#0f172a`},plain:{stroke:`#475569`},back:{stroke:`#64748b`}}),Mh(Ah,{conclusion:{stroke:`#0f172a`,fill:`#f1f5f9`},norm:{stroke:`#475569`,fill:`#e2e8f0`},element:{stroke:`#64748b`,fill:`#f8fafc`},fact:{stroke:`#94a3b8`,fill:`#ffffff`},inference:{stroke:`#64748b`,fill:`#f8fafc`},judgement:{stroke:`#334155`,fill:`#e2e8f0`}}),Mh(jh,{for:{stroke:`#475569`},against:{stroke:`#334155`},basis:{stroke:`#94a3b8`}}),Qf.dashed,Qf.dotted,{...Th.equity},{...Th.control},{...Th.contract},{...Th.debt},{...Th.guarantee},{...Th.kinship},{...Th.employment},{...Th.agency},{...Th.other},Mh(Oh,{neutral:{stroke:`#2f5aa8`,fill:`#eef3fb`},positive:{stroke:`#1f3f7f`,fill:`#e3ecfa`},negative:{stroke:`#9a1b1b`,fill:`#fbecec`}}),Mh(kh,{main:{stroke:`#13233f`},plain:{stroke:`#2d4366`},back:{stroke:`#5b6f8f`}}),Mh(Ah,{conclusion:{stroke:`#1f3f7f`,fill:`#e3ecfa`},norm:{stroke:`#4b3a8c`,fill:`#efecf8`},element:{stroke:`#2f5aa8`,fill:`#eef3fb`},fact:{stroke:`#8aa0c4`,fill:`#f8fafd`},inference:{stroke:`#1d6b6b`,fill:`#e8f4f4`},judgement:{stroke:`#13233f`,fill:`#dbe5f5`}}),Mh(jh,{for:{stroke:`#2d4366`},against:{stroke:`#9a1b1b`},basis:{stroke:`#4b3a8c`}}),Qf.dashed,Qf.dotted,Dh(Th,`#a3b0c4`),Mh(Oh,{neutral:{stroke:`#8b97a9`,fill:`#1a2029`},positive:{stroke:`#d3dbe7`,fill:`#1f2733`},negative:{stroke:`#8b97a9`,fill:`#1f2733`}}),Mh(kh,{main:{stroke:`#e6ebf2`},plain:{stroke:`#b6c0cf`},back:{stroke:`#8b97a9`}}),Mh(Ah,{conclusion:{stroke:`#e6ebf2`,fill:`#1f2733`},norm:{stroke:`#b6c0cf`,fill:`#2a3240`},element:{stroke:`#8b97a9`,fill:`#1a2029`},fact:{stroke:`#6b778a`,fill:`#161b22`},inference:{stroke:`#8b97a9`,fill:`#1a2029`},judgement:{stroke:`#cbd5e1`,fill:`#2a3240`}}),Mh(jh,{for:{stroke:`#b6c0cf`},against:{stroke:`#e6ebf2`},basis:{stroke:`#6b778a`}});function Nh(e,t){return{release:e,types:yl().map(e=>e.type).filter(e=>!t||e===t).map(e=>({type:e,specVersion:vl(e).specVersion,diagrams:kce(e).map(({kind:e,version:t,status:n,since:r})=>({kind:e,version:t,status:n,since:r}))}))}}function Ph(e){let t=[`Antu ${e.release}`,``];for(let n of e.types){t.push(`${n.type}: format generation ${n.specVersion}`);let e=Math.max(...n.diagrams.map(e=>e.kind.length));n.diagrams.forEach((n,r)=>t.push(` ${n.kind.padEnd(e)} v${n.version} ${n.status} since ${n.since}${r===0?` (default)`:``}`))}return t.join(`
1535
1535
  `)}var Fh=[`/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`,`/Applications/Chromium.app/Contents/MacOS/Chromium`,`/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge`,`/usr/bin/google-chrome`,`/usr/bin/chromium`,`/usr/bin/chromium-browser`,`C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe`,`C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe`,`C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe`,`C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe`,...process.env.LOCALAPPDATA?[`${process.env.LOCALAPPDATA}\\Google\\Chrome\\Application\\chrome.exe`]:[]],Ih=[`google-chrome`,`chromium`,`chromium-browser`,`microsoft-edge`,`chrome`];function Lh(e){try{return p(`sh`,[`-c`,`command -v ${e}`],{encoding:`utf8`}).trim()||null}catch{return null}}function Rh(e){try{return s(e).isFile()}catch{return!1}}var zh=`.antu-card, .antu-chr-card, .antu-sc-card, .antu-pn, .antu-rn, .antu-jn, .antu-mx-chip, .antu-ln-layer`;function Bh(){let e=process.env.ANTU_CHROME;if(e&&Rh(e))return e;for(let e of Fh)if(Rh(e))return e;for(let e of Ih){let t=Lh(e);if(t&&Rh(t))return t}return null}var Vh=e=>new Promise(t=>setTimeout(t,e));async function Hh(e,t=15e3,n=null){let r=Date.now()+t;for(;Date.now()<r;){if(n?.())return null;try{let t=(await(await fetch(`http://127.0.0.1:${e}/json/list`)).json()).find(e=>e.type===`page`);if(t?.webSocketDebuggerUrl)return t.webSocketDebuggerUrl}catch{}await Vh(200)}return null}function Cde(e){let t=new WebSocket(e),n=0,r=new Map,i=[];return t.addEventListener(`message`,e=>{let t=JSON.parse(e.data);if(t.method){for(let e of i)e(t);return}let n=r.get(t.id);n&&(r.delete(t.id),t.error?n.reject(Error(t.error.message)):n.resolve(t.result))}),{ready:new Promise((e,n)=>{t.addEventListener(`open`,e,{once:!0}),t.addEventListener(`error`,()=>n(Error(`Cannot connect to the browser debugging port`)),{once:!0})}),send:(e,i={})=>new Promise((a,o)=>{let s=++n;r.set(s,{resolve:a,reject:o}),t.send(JSON.stringify({id:s,method:e,params:i}))}),on:e=>i.push(e),close:()=>t.close()}}var wde=[[`--headless=old`],[`--headless=new`],[]],Tde=3e4;function Ede(e,t=wde.length){return Array.from({length:t},(t,n)=>e+n)}function Dde({flags:e,port:t,profile:n,width:r,height:i}){return[...e,`--disable-gpu`,`--no-sandbox`,`--no-first-run`,`--disable-extensions`,`--allow-file-access-from-files`,`--disable-dev-shm-usage`,`--user-data-dir=${n}`,`--remote-debugging-port=${t}`,`--window-size=${r},${i}`,`about:blank`]}function Ode(e,t=600){let n=``;return e.stderr?.on(`data`,e=>{n+=String(e),n.length>t*4&&(n=n.slice(-t*2))}),()=>n.slice(-t).trim()}async function Uh(e,t){return e.exitCode!==null||e.signalCode!==null||Promise.race([new Promise(t=>e.once(`exit`,()=>t(!0))),Vh(t).then(()=>!1)])}async function Wh(e,t=3e3){e&&e.exitCode===null&&e.signalCode===null&&(kde(e),!await Uh(e,t)&&(kde(e,`SIGKILL`),await Uh(e,1e3)))}function kde(e,t=`SIGTERM`){if(process.platform===`win32`)try{e.kill(t)}catch{}else try{process.kill(-e.pid,t)}catch{try{e.kill(t)}catch{}}}async function Gh(e,t=5){if(!e)return!0;for(let n=0;n<t;n+=1)try{return o(e,{recursive:!0,force:!0}),!0}catch{await Vh(200)}return!1}async function Ade({width:e=1600,height:t=900,port:n,timeoutMs:i}={}){let a=Bh();if(!a)throw Error(`Chrome/Chromium not found. Install one, or skip the checks that need a browser.`);let o=Ede(n??9500+Math.floor(Math.random()*400)),s=wde.map((e,t)=>({flags:e,port:o[t],profile:r(d(l(),`antu-chrome-`))})),u=i??Tde,f=null,p=null,h=null,g=[];for(let n of s){let r=m(a,Dde({...n,width:e,height:t}),{stdio:[`ignore`,`ignore`,`pipe`],detached:process.platform!==`win32`}),i=Ode(r),o=!1;if(r.on(`exit`,()=>{o=!0}),p=await Hh(n.port,u,()=>o),p){f=r,h=n.profile;break}let s=i(),c=o?`Chrome exited on its own${s?`: ${s.split(`
1536
1536
  `).slice(-3).join(` / `)}`:` (left no error message)`}`:`the port did not come up within ${u/1e3}s`;g.push(`${n.flags.join(` `)||`(no headless flag)`} port ${n.port} ${c}`),await Wh(r),p=null}for(let e of s)e.profile!==h&&await Gh(e.profile);if(!p)throw await Wh(f),Error(`Chrome will not start; all ${s.length} headless variants were tried (each with its own port and profile):\n ${g.join(`
1537
1537
  `)}\nChrome path: ${a}`);let _=Cde(p);await _.ready,await _.send(`Page.enable`),await _.send(`Runtime.enable`),await _.send(`Network.enable`),await _.send(`Emulation.setDeviceMetricsOverride`,{width:e,height:t,deviceScaleFactor:1,mobile:!1});let v=[],y=[];_.on(e=>{e.method===`Network.requestWillBeSent`&&v.push(e.params.request.url),e.method===`Runtime.exceptionThrown`&&y.push(e.params.exceptionDetails.exception?.description||e.params.exceptionDetails.text),e.method===`Runtime.consoleAPICalled`&&e.params.type===`error`&&y.push(e.params.args.map(e=>e.value??e.description??``).join(` `))});let b={async open(e,{waitFor:t=`document.querySelectorAll(${JSON.stringify(zh)}).length`,settleMs:n=800}={}){v=[],y=[],await _.send(`Page.navigate`,{url:e});let r=Date.now()+15e3,i=null,a=0;for(;Date.now()<r;){let e=(await _.send(`Runtime.evaluate`,{expression:t,returnByValue:!0})).result?.value;if(e){if(e===i){if(a+=1,a>=2)break}else a=0;i=e}await Vh(200)}return await Vh(n),b},async eval(e,{userGesture:t=!1,awaitPromise:n=!1}={}){let r=await _.send(`Runtime.evaluate`,{expression:e,returnByValue:!0,userGesture:t,awaitPromise:n});if(r.exceptionDetails)throw Error(r.exceptionDetails.exception?.description||r.exceptionDetails.text);return r.result?.value},async screenshotData(){let{data:e}=await _.send(`Page.captureScreenshot`,{format:`png`});return e},async screenshot(e){return c(e,Buffer.from(await b.screenshotData(),`base64`)),e},async setDownloadDir(e){let t={behavior:`allow`,downloadPath:e};try{await _.send(`Browser.setDownloadBehavior`,{...t,eventsEnabled:!0})}catch{await _.send(`Page.setDownloadBehavior`,t)}},async clickAt(e){let t=await b.eval(`(() => {
@@ -1544,7 +1544,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
1544
1544
  if (!el) return null
1545
1545
  const r = el.getBoundingClientRect()
1546
1546
  return JSON.stringify({ x: Math.round(r.left + r.width / 2), y: Math.round(r.top + r.height / 2) })
1547
- })()`);if(!r)throw Error(`Cannot hover element: ${e}`);let{x:i,y:a}=JSON.parse(r);await _.send(`Input.dispatchMouseEvent`,{type:`mouseMoved`,x:i+t,y:a+n})},get requests(){return v.slice()},get errors(){return y.slice()},async close(){_.close(),await Wh(f),await Gh(h)}};return b}async function jde(e,{width:t=1600,height:n=900,settleMs:r=800}={}){let i=Date.now(),a=await Ade({width:t,height:n});try{await a.open(g(e).href,{settleMs:r});let o=await a.eval(`document.querySelectorAll(${JSON.stringify(zh)}).length`);return{data:await a.screenshotData(),mimeType:`image/png`,width:t,height:n,cards:o,ms:Date.now()-i}}finally{await a.close()}}var Kh=new gce({name:`antu`,version:ml()}),qh=Na({}).describe(`the Antu JSON (envelope + content layer; see the spec resources)`),Jh=Va(wh).optional().describe(`the look of the page: document (black and white, for print; the default), modern (rounded, light) or legal (navy). Omit it and the reader chooses in the page; give it and the page is fixed to it`),Yh=xa().optional().describe(`which way of drawing (fact: timeline, chronicle or scale; relationship: graph, focus, matrix, equity, authority, related or path; procedure: flow or route); omit it for the default, the first`),Xh=e=>({content:[{type:`text`,text:e}]}),Zh=e=>({content:[{type:`text`,text:e}],isError:!0});Kh.registerTool(`antu_examples`,{title:`See the examples`,description:`List the examples, or fetch one in full. **With no arguments you get the small ones**(as small as possible, one idea each). A good first pass is: antu_schema for the fields, antu_guide for the mechanism, then fetch 1-minimal.en.json here to see how one is written.
1547
+ })()`);if(!r)throw Error(`Cannot hover element: ${e}`);let{x:i,y:a}=JSON.parse(r);await _.send(`Input.dispatchMouseEvent`,{type:`mouseMoved`,x:i+t,y:a+n})},get requests(){return v.slice()},get errors(){return y.slice()},async close(){_.close(),await Wh(f),await Gh(h)}};return b}async function jde(e,{width:t=1600,height:n=900,settleMs:r=800}={}){let i=Date.now(),a=await Ade({width:t,height:n});try{await a.open(g(e).href,{settleMs:r});let o=await a.eval(`document.querySelectorAll(${JSON.stringify(zh)}).length`);return{data:await a.screenshotData(),mimeType:`image/png`,width:t,height:n,cards:o,ms:Date.now()-i}}finally{await a.close()}}var Kh=new gce({name:`antu`,version:ml()}),qh=Na({}).describe(`the Antu JSON (envelope + content layer; see the spec resources)`),Jh=Va(wh).optional().describe(`the look of the page: document (black and white, for print; the default), modern (rounded, light), legal (navy) or dark (the modern look on a dark ground, for a dark host; the whole page is dark). Omit it and the reader chooses in the page; give it and the page is fixed to it`),Yh=xa().optional().describe(`which way of drawing (fact: timeline, chronicle or scale; relationship: graph, focus, matrix, equity, authority, related or path; procedure: flow or route); omit it for the default, the first`),Xh=e=>({content:[{type:`text`,text:e}]}),Zh=e=>({content:[{type:`text`,text:e}],isError:!0});Kh.registerTool(`antu_examples`,{title:`See the examples`,description:`List the examples, or fetch one in full. **With no arguments you get the small ones**(as small as possible, one idea each). A good first pass is: antu_schema for the fields, antu_guide for the mechanism, then fetch 1-minimal.en.json here to see how one is written.
1548
1548
  Three batches: agent (the default, 1 KB small examples, the ones to write data from), real (real cases, 4-8 KB, for reference), raw (raw judgments, **not examples**: the source material these examples came from, never use it as a template).`,inputSchema:{file:xa().optional().describe(`the one to fetch, e.g. examples/agent/fact/1-minimal.en.json. Omit to list them`),group:Va([`agent`,`real`,`raw`]).optional().describe(`which batch to list: agent (default, small examples) / real (real cases) / raw (source material, not examples)`),type:xa().optional().describe(`which diagram type, fact by default (fact diagram)`)}},async({file:e,group:t=`agent`,type:n=`fact`})=>{if(!yl().some(e=>e.type===n))return Zh(`no examples for type "${n}" yet. Available: ${yl().map(e=>`${e.type} (${se(e.labelKey)})`).join(`, `)||`(none)`}.`);if(e){let t=yde(e);return t?Xh(`# ${e}\n\n\`\`\`json\n${t.text}\n\`\`\``):Zh(`example not found: ${e}. Call antu_examples with no arguments to see the list.`)}let r=vde({type:n,group:t}),i=r.map(e=>`- ${e.file} (${(e.bytes/1024).toFixed(1)} KB)\n ${e.title}\n ${e.line}`);if(r.length===0&&t===`agent`)return Xh(`no small examples for type "${n}" yet. Try group="real".`);let a=t===`real`?`Real cases: ${r.length} (4-8 KB each, for reference, write your data from the default small examples first):`:t===`raw`?`Raw judgments: ${r.length} (**not examples**, never use them as a template; the source material these examples came from):`:`Small examples: ${r.length} (about 1 KB each, start with 1-minimal):`,o=t===`agent`?`
1549
1549
 
1550
1550
  There are also real cases (group="real") and source material (group="raw").`:`