graview 0.1.32 → 0.1.34

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.
Files changed (142) hide show
  1. package/dist/preview/{chunk.7GKUVQVF.js → chunk.2UPGH6FT.js} +1 -1
  2. package/dist/preview/{chunk.I6FPNX43.js → chunk.2YCFK5HU.js} +1 -1
  3. package/dist/preview/{chunk.4HZ7QTXZ.js → chunk.2YGQVI6T.js} +1 -1
  4. package/dist/preview/{chunk.3K6YSVHC.js → chunk.34CYK2DF.js} +1 -1
  5. package/dist/preview/{chunk.3TVXGJTU.js → chunk.35KI7XYV.js} +1 -1
  6. package/dist/preview/{chunk.COQKECUH.js → chunk.3C4RJIJU.js} +1 -1
  7. package/dist/preview/{chunk.TAQ764IQ.js → chunk.3H4NVUWV.js} +1 -1
  8. package/dist/preview/{chunk.K5ME5GCG.js → chunk.3MWBWSYF.js} +1 -1
  9. package/dist/preview/{chunk.MAF7C3VM.js → chunk.4K5QCJFH.js} +1 -1
  10. package/dist/preview/{chunk.ULRW47RP.js → chunk.52QAIGCD.js} +1 -1
  11. package/dist/preview/{chunk.D75KC3LL.js → chunk.577PGFUT.js} +1 -1
  12. package/dist/preview/{chunk.EBGAYL32.js → chunk.5EAQDBBE.js} +1 -1
  13. package/dist/preview/{chunk.4MERAWS2.js → chunk.6A62UVAE.js} +1 -1
  14. package/dist/preview/{chunk.7T7NZZTC.js → chunk.6FBQP336.js} +1 -1
  15. package/dist/preview/{chunk.EF3XNU4O.js → chunk.6K2HASOH.js} +1 -1
  16. package/dist/preview/chunk.6P7P2AW7.js +1 -0
  17. package/dist/preview/{chunk.LXBOVRFI.js → chunk.6VRJII5M.js} +1 -1
  18. package/dist/preview/{chunk.VG3O4LWB.js → chunk.6XO4PECH.js} +1 -1
  19. package/dist/preview/{chunk.GYICGZMG.js → chunk.7HPPJVIV.js} +2 -2
  20. package/dist/preview/{chunk.PIP6Z563.js → chunk.7JNDZWD6.js} +1 -1
  21. package/dist/preview/{chunk.6UGEYZAC.js → chunk.7MTX33WD.js} +1 -1
  22. package/dist/preview/{chunk.ASCLIM2P.js → chunk.7VUPKOKC.js} +1 -1
  23. package/dist/preview/{chunk.LLLZEGRK.js → chunk.7WHWD5YJ.js} +1 -1
  24. package/dist/preview/{chunk.NM6MZYFN.js → chunk.7X2ZO5BD.js} +1 -1
  25. package/dist/preview/{chunk.XNJEFUF7.js → chunk.AHCI7ZDO.js} +1 -1
  26. package/dist/preview/{chunk.JFAOHHJJ.js → chunk.APNN6BKF.js} +1 -1
  27. package/dist/preview/{chunk.QGTSHKJL.js → chunk.B2WRXGFI.js} +1 -1
  28. package/dist/preview/{chunk.HLTRQU4Y.js → chunk.B6VI576I.js} +1 -1
  29. package/dist/preview/{chunk.NTF7FVB2.js → chunk.BU2DSZ2L.js} +1 -1
  30. package/dist/preview/{chunk.T5VG5A6V.js → chunk.CNMITOKP.js} +1 -1
  31. package/dist/preview/chunk.CPW465TM.js +1 -0
  32. package/dist/preview/{chunk.47STJVRV.js → chunk.CZRX2FDI.js} +1 -1
  33. package/dist/preview/{chunk.GV2CQVKV.js → chunk.DMNXYMLC.js} +1 -1
  34. package/dist/preview/{chunk.F6ZK7RMB.js → chunk.DNDHDDM6.js} +2 -2
  35. package/dist/preview/{chunk.MWGGV7DE.js → chunk.DUUARGPE.js} +1 -1
  36. package/dist/preview/chunk.E7EQ2VTE.js +1 -0
  37. package/dist/preview/{chunk.UHUGOTUU.js → chunk.ETWVQ3A2.js} +1 -1
  38. package/dist/preview/{chunk.BNV77BQZ.js → chunk.F6WYSDSI.js} +3 -3
  39. package/dist/preview/{chunk.FWTIUYXH.js → chunk.FBY5IUGU.js} +1 -1
  40. package/dist/preview/{chunk.UATVTXZY.js → chunk.FCRFQ7ZW.js} +1 -1
  41. package/dist/preview/chunk.FRS3S7DN.js +1 -0
  42. package/dist/preview/{chunk.UGFJKSHU.js → chunk.FSAHO3LV.js} +1 -1
  43. package/dist/preview/{chunk.JQU5GEU3.js → chunk.FUQVNXLB.js} +1 -1
  44. package/dist/preview/{chunk.JDUJDAGA.js → chunk.G64AREGA.js} +1 -1
  45. package/dist/preview/{chunk.CN3UEF5N.js → chunk.GMOTRAKJ.js} +1 -1
  46. package/dist/preview/chunk.GNSAKLP2.js +1 -0
  47. package/dist/preview/{chunk.RCKTBOY2.js → chunk.HCDKSDIS.js} +1 -1
  48. package/dist/preview/chunk.HH6P4BLT.js +1 -0
  49. package/dist/preview/{chunk.AOSMJKLH.js → chunk.HJ56Q6WB.js} +1 -1
  50. package/dist/preview/chunk.HP3ZEDCD.js +117 -0
  51. package/dist/preview/{chunk.G5NZVPJU.js → chunk.HPD5ZDZH.js} +1 -1
  52. package/dist/preview/chunk.HPEGQN6E.js +1 -0
  53. package/dist/preview/chunk.HUKAVTMX.js +1 -0
  54. package/dist/preview/chunk.HWITWOP3.js +3 -0
  55. package/dist/preview/{chunk.3TY5NFLY.js → chunk.IHFNLKXV.js} +1 -1
  56. package/dist/preview/{chunk.2NIOHEMX.js → chunk.JQDYGI6G.js} +1 -1
  57. package/dist/preview/chunk.JZBBGY4B.js +1 -0
  58. package/dist/preview/chunk.KA3KI4UA.js +1 -0
  59. package/dist/preview/{chunk.OF34OZ4V.js → chunk.KSXB4LDF.js} +1 -1
  60. package/dist/preview/{chunk.HAIG6NVX.js → chunk.LAF6GTBN.js} +1 -1
  61. package/dist/preview/{chunk.UNL2HIF2.js → chunk.LCFDM7XY.js} +1 -1
  62. package/dist/preview/{chunk.E2YEOMPH.js → chunk.LIIC25G6.js} +1 -1
  63. package/dist/preview/chunk.M5HADQPP.js +1 -0
  64. package/dist/preview/chunk.MWJUZG3C.js +6 -0
  65. package/dist/preview/chunk.OMMKD2NU.js +2 -0
  66. package/dist/preview/{chunk.JOOQUWLT.js → chunk.PNVR3CXR.js} +2 -2
  67. package/dist/preview/{chunk.PBSMLINK.js → chunk.PPUAPAWR.js} +1 -1
  68. package/dist/preview/{chunk.SYAEBGDC.js → chunk.PW7YH6JV.js} +1 -1
  69. package/dist/preview/{chunk.OC6IWRQ3.js → chunk.Q7TP4RFE.js} +1 -1
  70. package/dist/preview/{chunk.CIPS2OGR.js → chunk.QPAUQJON.js} +1 -1
  71. package/dist/preview/{chunk.UZGRRDHD.js → chunk.QU356VB2.js} +1 -1
  72. package/dist/preview/chunk.QVKKXMNK.js +1 -0
  73. package/dist/preview/{chunk.3AGY4QVS.js → chunk.QVUL2FSI.js} +1 -1
  74. package/dist/preview/chunk.RH45AW2W.js +1 -0
  75. package/dist/preview/{chunk.6YCBYL2Y.js → chunk.RIW7SQH4.js} +1 -1
  76. package/dist/preview/{chunk.H7EPE74C.js → chunk.RN3EZVV4.js} +1 -1
  77. package/dist/preview/{chunk.3HXN4BOY.js → chunk.RYEAMM73.js} +1 -1
  78. package/dist/preview/{chunk.YIR7PPF3.js → chunk.SIH6RCAI.js} +1 -1
  79. package/dist/preview/{chunk.NRAYZY3X.js → chunk.T2L4NPSB.js} +1 -1
  80. package/dist/preview/{chunk.DHIUSUCL.js → chunk.T3M4FALL.js} +5 -5
  81. package/dist/preview/{chunk.CX3KL2C5.js → chunk.TCSZZAYB.js} +1 -1
  82. package/dist/preview/chunk.TPX6AVJL.js +1 -0
  83. package/dist/preview/{chunk.5UL7YDUD.js → chunk.U5ACEYAN.js} +1 -1
  84. package/dist/preview/{chunk.5T5XGILP.js → chunk.UA5UYINM.js} +1 -1
  85. package/dist/preview/{chunk.GO4XBWJO.js → chunk.UCIQIPBQ.js} +1 -1
  86. package/dist/preview/{chunk.EKPRNDUV.js → chunk.UHQD3NTK.js} +1 -1
  87. package/dist/preview/{chunk.RIJUCHP4.js → chunk.VKH3ZPPQ.js} +1 -1
  88. package/dist/preview/{chunk.UBFNZMUX.js → chunk.VMGWYCXU.js} +1 -1
  89. package/dist/preview/chunk.VOFUIWAX.js +27 -0
  90. package/dist/preview/{chunk.DYSPCGXX.js → chunk.VSOB2QEK.js} +1 -1
  91. package/dist/preview/{chunk.R6K6GF5R.js → chunk.VZHV25JE.js} +1 -1
  92. package/dist/preview/chunk.WAB6ZS2V.js +1 -0
  93. package/dist/preview/chunk.WLBXBNNH.js +1 -0
  94. package/dist/preview/chunk.WPCGHGDA.js +1 -0
  95. package/dist/preview/{chunk.QYZNAUIR.js → chunk.WYEYYCBH.js} +1 -1
  96. package/dist/preview/{chunk.MNP4JI33.js → chunk.X7W27IRI.js} +4 -4
  97. package/dist/preview/{chunk.J25KOSNW.js → chunk.XK4FVT2X.js} +1 -1
  98. package/dist/preview/{chunk.CWHRDBOF.js → chunk.XXMYKBLT.js} +1 -1
  99. package/dist/preview/{chunk.CDP2XL66.js → chunk.XZYJRNRY.js} +1 -1
  100. package/dist/preview/chunk.YCIX53AR.js +1 -0
  101. package/dist/preview/chunk.YEYY273R.js +1 -0
  102. package/dist/preview/{chunk.EJPI3ST6.js → chunk.YJCT3DV2.js} +1 -1
  103. package/dist/preview/chunk.YT2CYCVT.js +1 -0
  104. package/dist/preview/{chunk.B2GLDIAS.js → chunk.Z7ZCR4LN.js} +1 -1
  105. package/dist/preview/{chunk.CAVBSL27.js → chunk.ZE4CTZQ3.js} +1 -1
  106. package/dist/preview/chunk.ZFWV4JAJ.js +1 -0
  107. package/dist/preview/{chunk.5H4VXLZF.js → chunk.ZJX6ZKKM.js} +1 -1
  108. package/dist/preview/chunk.ZPQKAJRI.js +1 -0
  109. package/dist/preview/{chunk.OKRNJXTV.js → chunk.ZSW74NVJ.js} +1 -1
  110. package/dist/preview/chunk.ZTD2CNC3.js +25 -0
  111. package/dist/preview/{chunk.QVVJRSRM.js → chunk.ZTFW7RKP.js} +1 -1
  112. package/dist/preview/index.html +42 -42
  113. package/dist/preview/page.js +2 -2
  114. package/package.json +6 -6
  115. package/dist/preview/chunk.4HRAQNJO.js +0 -27
  116. package/dist/preview/chunk.52W7WYME.js +0 -1
  117. package/dist/preview/chunk.5TVB6BUY.js +0 -1
  118. package/dist/preview/chunk.63GXY2ME.js +0 -1
  119. package/dist/preview/chunk.6QWV5MVH.js +0 -25
  120. package/dist/preview/chunk.AKFKM4SW.js +0 -3
  121. package/dist/preview/chunk.BOO6WVM4.js +0 -117
  122. package/dist/preview/chunk.BQ3JHEHV.js +0 -1
  123. package/dist/preview/chunk.CJJLJ3KW.js +0 -2
  124. package/dist/preview/chunk.DAZ2VSRD.js +0 -1
  125. package/dist/preview/chunk.ERIT3R6N.js +0 -1
  126. package/dist/preview/chunk.EYTBDMTW.js +0 -1
  127. package/dist/preview/chunk.F6EH7HI2.js +0 -1
  128. package/dist/preview/chunk.FSTCX2AI.js +0 -1
  129. package/dist/preview/chunk.H7BST3XO.js +0 -1
  130. package/dist/preview/chunk.IDVAR5HM.js +0 -1
  131. package/dist/preview/chunk.K7PMDSOL.js +0 -1
  132. package/dist/preview/chunk.KSES5U5B.js +0 -1
  133. package/dist/preview/chunk.LR3VDXPI.js +0 -1
  134. package/dist/preview/chunk.N6OX4NEQ.js +0 -1
  135. package/dist/preview/chunk.PHKSMUIA.js +0 -1
  136. package/dist/preview/chunk.SHTJZ6UX.js +0 -1
  137. package/dist/preview/chunk.TCNBCTWO.js +0 -1
  138. package/dist/preview/chunk.WAZ7OGBD.js +0 -1
  139. package/dist/preview/chunk.XANVHJQ4.js +0 -1
  140. package/dist/preview/chunk.XKABS745.js +0 -1
  141. package/dist/preview/chunk.XMC7YDWT.js +0 -1
  142. package/dist/preview/chunk.Y6ZNFQK3.js +0 -6
@@ -1 +1 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{q as Te}from"./chunk.DAZ2VSRD.js";import{a as xe}from"./chunk.XANVHJQ4.js";import{f as V}from"./chunk.CAVBSL27.js";import{c as Oe,d as Re,e as _e}from"./chunk.COQKECUH.js";import{a as P}from"./chunk.G5NZVPJU.js";import{a as ve,b as U,d as Ae}from"./chunk.B2GLDIAS.js";import{a as me}from"./chunk.UGFJKSHU.js";import{Ba as ue,Ca as fe,Fa as pe,La as H,Oa as he,Y as W,a as se,jb as ye,ma as de,mb as ge,nb as be,pa as B,qb as we,ra as ce,sc as ke,ta as le,tb as Se,ua as C,wb as L}from"./chunk.MNP4JI33.js";var $=(t,n,e)=>{(t[n]===void 0||e>t[n])&&(t[n]=e)},J=(t,n,e)=>{(t[n]===void 0||e<t[n])&&(t[n]=e)},G=(t,n)=>{t.format=n,n.includes("int")&&(t.isInt=!0)},Me=(t,n)=>{t.mime=t.mime?t.mime.filter(e=>n.includes(e)):[...n]},Ne=(t,n)=>{t.multipleOf??=[],t.multipleOf.includes(n)||t.multipleOf.push(n)},$e=(t,n)=>(t.patterns??=new Set).add(n),Ke={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function D(t){let n={},{def:e,bag:r}=t._zod,i=t._zod.traits.has("$ZodCheck")?[t,...e.checks??[]]:e.checks??[];for(let o of i){let a=o._zod.def;switch(a.check){case"greater_than":$(n,a.inclusive?"minimum":"exclusiveMinimum",a.value);break;case"less_than":J(n,a.inclusive?"maximum":"exclusiveMaximum",a.value);break;case"multiple_of":Ne(n,a.value);break;case"number_format":{G(n,a.format);let l=Ke[a.format];l&&($(n,"minimum",l[0]),J(n,"maximum",l[1]));break}case"bigint_format":G(n,a.format);break;case"min_length":case"min_size":$(n,"minimum",a.minimum);break;case"max_length":case"max_size":J(n,"maximum",a.maximum);break;case"length_equals":$(n,"minimum",a.length),J(n,"maximum",a.length);break;case"size_equals":$(n,"minimum",a.size),J(n,"maximum",a.size);break;case"string_format":G(n,a.format),a.pattern&&$e(n,a.pattern),(a.format==="base64"||a.format==="base64url")&&(n.contentEncoding=a.format),(a.local||a.precision===-1)&&(n.laxFormat=!0);break;case"mime_type":Me(n,a.mime);break}}r.minimum!==void 0&&$(n,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&$(n,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&J(n,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&J(n,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&Ne(n,r.multipleOf),r.format!==void 0&&(n.format??=r.format,r.format.includes("int")&&(n.isInt=!0)),r.mime&&Me(n,r.mime);for(let o of r.patterns??[])$e(n,o);return n}var Ze={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};function z(t){let n=t._zod.def;return n.type==="pipe"&&n.in._zod.traits.has("$ZodTransform")?z(n.out):n.type==="catch"?z(n.innerType):t._zod.optin}var Ye=new Set(["promise","optional","nonoptional","nullable","readonly","default","prefault","catch"]);function A(t,n=new Set){if(n.has(t))return!1;n.add(t);let e=t._zod.def,r=e.type;return r==="transform"?!0:r==="array"?A(e.element,n):r==="set"?A(e.valueType,n):r==="lazy"?A(e.getter(),n):Ye.has(r)?A(e.innerType,n):r==="intersection"?A(e.left,n)||A(e.right,n):r==="record"||r==="map"?A(e.keyType,n)||A(e.valueType,n):r==="pipe"?t._zod.traits.has("$ZodCodec")||A(e.in,n)||A(e.out,n):r==="object"?Object.values(e.shape).some(i=>A(i,n)):r==="union"?e.options.some(i=>A(i,n)):r==="tuple"?e.items.some(i=>A(i,n))||(e.rest?A(e.rest,n):!1):!1}function Xe(t){let n=Object.values(t).filter(e=>typeof e=="number");return Object.entries(t).filter(([e])=>n.indexOf(+e)===-1).map(([,e])=>e)}function De(t){let n=t.anyOf;if(!Array.isArray(n)||n.length===0||t.type!==void 0)return;let e=[];for(let r of n){if(!r||typeof r!="object")return;De(r);let i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;for(let o of[r.type].flat()){if(typeof o!="string")return;e.includes(o)||e.push(o)}}delete t.anyOf,t.type=e.length===1?e[0]:e}var Ee=new Set(["type","properties","required","additionalProperties"]),Je=t=>{let n=t.additionalProperties;return n&&typeof n=="object"&&Object.keys(n).length?n:null},Pe=(t,n)=>JSON.stringify(t)===JSON.stringify(n);function K(t){for(let i of t){if(typeof i!="object"||i.type!=="object")return null;for(let o in i)if(!Ee.has(o))return null}let n={},e=new Set;for(let i of t){for(let o in i.properties){if(Object.prototype.hasOwnProperty.call(n,o))continue;let a=[];for(let l of t){let s=l.properties?.[o]??Je(l);s&&!a.some(b=>Pe(b,s))&&a.push(s)}n[o]=a.length===1?a[0]:K(a)??{allOf:a}}for(let o of i.required??[])e.add(o)}let r={type:"object",properties:n};if(e.size&&(r.required=[...e]),t.every(i=>i.additionalProperties===!1))r.additionalProperties=!1;else{let i=[];for(let o of t){let a=Je(o);a&&!i.some(l=>Pe(l,a))&&i.push(a)}i.length===1?r.additionalProperties=i[0]:i.length>1&&(r.additionalProperties={allOf:i})}return r}function Qe(t){let n=t.allOf;if(!Array.isArray(n)||n.length<2)return;for(let i of Ee)if(i in t)return;let e=n.filter(i=>Array.isArray(i.oneOf)||Array.isArray(i.anyOf)),r;if(!e.length)r=K(n);else{let i=e[0],o=Array.isArray(i.oneOf)?"oneOf":"anyOf";if(Object.keys(i).length!==1)return;let a=n.filter(s=>s!==i),l=i[o].map(s=>K([...a,s]));if(l.some(s=>!s))return;r={[o]:l}}r&&(delete t.allOf,Object.assign(t,r))}function ze(t){let n=t;for(let u of["anyOf","oneOf"]){let f=n[u];if(!Array.isArray(f))continue;let w=f.map(ze);w.some((y,d)=>y!==f[d])&&(n={...n,[u]:w})}let e=[n.type].flat(),r=!e.includes("string")&&e.some(u=>u==="number"||u==="integer"),i=n.enum??(n.const!==void 0?[n.const]:void 0);if(!r&&!i?.some(u=>typeof u=="number"))return n;let{minimum:o,maximum:a,exclusiveMinimum:l,exclusiveMaximum:s,multipleOf:b,format:p,id:S,...h}=n;return h.enum?h.enum=h.enum.map(u=>typeof u=="number"?String(u):u):typeof h.const=="number"&&(h.const=String(h.const)),r&&(h.type="string",i||(h.pattern=e.includes("number")?"^-?\\d+(?:\\.\\d+)?$":"^-?\\d+$")),h}var q=class{constructor(n,e){this.override=n;this.refs=e}done=new Map;path=[];cyclic=new Map;write(n,e=!1){let r=this.refs.get(n);if(r!==void 0&&!e)return{$ref:r};if(this.path.includes(n))return this.cyclic.has(n)||this.cyclic.set(n,""),{};let i=this.done.get(n);if(i)return i;this.path.push(n);try{let o=this.written(n);return this.done.set(n,o),o}finally{this.path.pop()}}written(n){let e={},r,i=n._zod.toJSONSchema?.();i?Object.assign(e,i):r=this.process(n,e);let o=se.get(n);if(o)for(let l of Object.keys(o))e[l]=o[l];A(n)&&(delete e.examples,delete e.default),"_prefault"in e&&(e.default??=e._prefault,delete e._prefault);let a=e;if(r){let l=this.write(r);a={...e};for(let s of Object.keys(l))s in e||(a[s]=l[s])}return this.override({zodSchema:n,jsonSchema:a}),De(a),n._zod.def.type==="intersection"&&Qe(a),a}process(n,e){let r=n._zod.def;switch(r.type){case"string":{e.type="string";let{minimum:i,maximum:o,format:a,patterns:l,contentEncoding:s,laxFormat:b}=D(n);if(typeof i=="number"&&(e.minLength=i),typeof o=="number"&&(e.maxLength=o),a&&(e.format=Ze[a]??a,(e.format===""||a==="time"||b)&&delete e.format),s&&(e.contentEncoding=s),l&&l.size>0){let p=[...l];p.length===1?e.pattern=p[0].source:e.allOf=p.map(S=>({pattern:S.source}))}return}case"number":{let{minimum:i,maximum:o,multipleOf:a,exclusiveMinimum:l,exclusiveMaximum:s,isInt:b}=D(n);if(e.type=b?"integer":"number",typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY)?e.exclusiveMinimum=l:typeof i=="number"&&(e.minimum=i),typeof s=="number"&&s<=(o??Number.POSITIVE_INFINITY)?e.exclusiveMaximum=s:typeof o=="number"&&(e.maximum=o),a){let[p,...S]=new Set(a.filter(h=>Number.isFinite(h)&&h!==0).map(Math.abs));p!==void 0&&(e.multipleOf=p),S.length&&(e.allOf=[...e.allOf??[],...S.map(h=>({multipleOf:h}))])}return}case"boolean":case"success":e.type="boolean";return;case"null":e.type="null";return;case"never":e.not={};return;case"enum":{let i=Xe(r.entries);i.length===0?e.not={}:(i.every(o=>typeof o=="number")&&(e.type="number"),i.every(o=>typeof o=="string")&&(e.type="string"),e.enum=i);return}case"literal":{let i=r.values.filter(o=>o!==void 0).map(o=>typeof o=="bigint"?Number(o):o);if(r.values.length===0)e.not={};else if(i.length===1)e.type=i[0]===null?"null":typeof i[0],e.const=i[0];else if(i.length>1){for(let o of["number","string","boolean"])i.every(a=>typeof a===o)&&(e.type=o);i.every(o=>o===null)&&(e.type="null"),e.enum=i}return}case"template_literal":e.type="string",e.pattern=n._zod.pattern.source;return;case"file":{e.type="string",e.format="binary",e.contentEncoding="binary";let{minimum:i,maximum:o,mime:a}=D(n);i!==void 0&&(e.minLength=i),o!==void 0&&(e.maxLength=o),a&&(a.length===0?e.not={}:a.length===1?e.contentMediaType=a[0]:e.anyOf=a.map(l=>({contentMediaType:l})));return}case"array":{let{minimum:i,maximum:o}=D(n);typeof i=="number"&&(e.minItems=i),typeof o=="number"&&(e.maxItems=o),e.type="array",e.items=this.write(r.element);return}case"object":{let i=r.shape;e.type="object";let o={};e.properties=o;for(let l in i)Object.defineProperty(o,l,{value:this.write(i[l]),writable:!0,enumerable:!0,configurable:!0});let a=Object.keys(i).filter(l=>z(i[l])===void 0);a.length>0&&(e.required=a),r.catchall?._zod.def.type==="never"?e.additionalProperties=!1:r.catchall&&(e.additionalProperties=this.write(r.catchall));return}case"union":e[r.inclusive===!1?"oneOf":"anyOf"]=r.options.map(i=>this.write(i));return;case"intersection":{let i=l=>"allOf"in l&&Object.keys(l).length===1,o=this.write(r.left),a=this.write(r.right);e.allOf=[...i(o)?o.allOf:[o],...i(a)?a.allOf:[a]];return}case"tuple":{let i=r.items;e.type="array",e.prefixItems=i.map(s=>this.write(s)),r.rest?e.items=this.write(r.rest):e.items=!1;let o=i.length;for(;o>0&&z(i[o-1])!==void 0;)o-=1;o>0&&(e.minItems=o),r.rest||(e.maxItems=i.length);let{minimum:a,maximum:l}=D(n);typeof a=="number"&&(e.minItems=a),typeof l=="number"&&(e.maxItems=l);return}case"record":{let i=r.keyType;e.type="object";let o=D(i).patterns;if(r.mode==="loose"&&o&&o.size>0){let l=this.write(r.valueType),s={};for(let b of o)s[b.source]=l;e.patternProperties=s}else e.propertyNames=ze(this.write(i)),e.additionalProperties=this.write(r.valueType);let a=i._zod.values;if(a&&!r.partial&&z(r.valueType)===void 0){let l=[...a].filter(s=>typeof s=="string"||typeof s=="number");l.length>0&&(e.required=l.map(String))}return}case"nullable":e.anyOf=[this.write(r.innerType),{type:"null"}];return;case"default":case"prefault":{let i=r.defaultValue,o,a=!1,l=JSON.stringify(i,(s,b)=>typeof b=="bigint"?(a=!0,null):b);return!a&&l!==void 0&&(o=JSON.parse(l)),a||(e[r.type==="default"?"default":"_prefault"]=o),r.innerType}case"catch":{try{e.default=r.catchValue(void 0)}catch{}return r.innerType}case"readonly":return e.readOnly=!0,r.innerType;case"pipe":return r.in._zod.traits.has("$ZodTransform")?r.out:r.in;case"lazy":return n._zod.innerType;case"optional":case"nonoptional":case"promise":return r.innerType;default:return}}};function Ie(t,n=()=>{}){let e=t,r=new q(n,new Map),i=r.write(e,!0);if(r.cyclic.size>0){let o=new Map,a=0,l=[];for(let b of r.cyclic.keys())if(b===e)o.set(b,"#");else{let p=`__schema${a++}`;o.set(b,`#/$defs/${p}`),l.push([b,p])}r=new q(n,o),i=r.write(e,!0);let s={};for(let[b,p]of l)s[p]=r.write(b,!0);l.length>0&&(i={...i,$defs:s})}return JSON.parse(JSON.stringify({$schema:"https://json-schema.org/draft/2020-12/schema",...i}))}function je(t){return Ie(t,tn)}var en={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"},nn={phone:"A phone number as it is written, like +1 555 123 4567 or 020 7946 0958 ext. 12.",place:"An address or a place's name, as a person would search a map for it.",duration:"A length of time in whole minutes: 90 is 1 h 30 min."};function tn(t){de(t.zodSchema)&&(t.jsonSchema["x-graview-app-link"]=!0);let n=le(t.zodSchema);if(n&&(t.jsonSchema.type==="string"||t.jsonSchema.type==="array")){t.jsonSchema["x-graview-linked"]={address:n.address,kinds:[...n.kinds],cardinality:n.cardinality};let s=n.kinds.join(" or "),b=`${n.cardinality==="many"?"Records":"A record"}: a ${s} in the app ${n.address}, as "${n.kinds[0]}:<id>" \u2014 an id found there with find_linked. Linking never changes that app.`,p=t.jsonSchema.description;typeof p=="string"&&p.includes(b)||(t.jsonSchema.description=`${typeof p=="string"&&p?`${p.replace(/\.?$/,".")} `:""}${b}`)}if(pe(t.zodSchema)&&(t.jsonSchema["x-graview-repeat"]=!0,!t.jsonSchema.type&&!t.jsonSchema.anyOf&&!t.jsonSchema.oneOf&&Object.assign(t.jsonSchema,rn())),me(t.zodSchema)){t.jsonSchema.contentMediaType="text/markdown";let s=t.jsonSchema.description;typeof s=="string"&&s.endsWith("Written in Markdown.")||(t.jsonSchema.description=`${typeof s=="string"&&s?`${s.replace(/\.?$/,".")} `:""}Written in Markdown.`)}let e=Se(t.zodSchema);if(e){let s=t.jsonSchema;s["x-graview-type"]=e,e==="duration"&&(s["x-graview-unit"]="minutes"),s.description??=nn[e]}let r=we(t.zodSchema,!1);if(r){let s=ve(r);t.jsonSchema["x-graview-format"]=s.format??"unit",s.currency&&(t.jsonSchema["x-graview-currency"]=s.currency),s.unit&&s.format!=="money"&&(t.jsonSchema["x-graview-unit"]=s.unit);let b=t.jsonSchema.description;t.jsonSchema.description=typeof b=="string"&&b.length>0?`${b} ${U(s)}`:U(s)}let i=t.zodSchema._zod?.def;if(!i||i.type!=="string"||typeof i.format!="string"||i.format==="regex")return;let o=t.jsonSchema,a=(i.checks??[]).map(s=>s._zod?.def).filter(s=>s?.format==="regex"&&s.pattern instanceof RegExp).map(s=>s.pattern.source);delete o.pattern;let l=o.allOf;Array.isArray(l)&&l.every(s=>typeof s=="object"&&s!==null&&Object.keys(s).length===1&&"pattern"in s)&&delete o.allOf,o.format=en[i.format]??i.format,a.length===1?o.pattern=a[0]:a.length>1&&(o.allOf=a.map(s=>({pattern:s})))}function Z(t){let n=L(t.input),e=je(t.input),r=e.properties??{};if(ge(t)){let i=t.creates.join(" | ");r.id={type:"string",minLength:1,description:`Optional: the id for the ${i} this makes. Refused if the graph already has it; left out, one is minted from the label.`},e.properties=r}be(t)&&(e.additionalProperties=!1);for(let i of n){let o=r[i.name];if(!o)continue;let a=i.kinds.includes("*")?"any node kind":i.kinds.join(" | ");o.description=[o.description,`Id of a node (${a}).`].filter(Boolean).join(" ")}return{name:t.name,...t.title===void 0?{}:{title:t.title},description:t.description??t.title??t.name,inputSchema:e,nodeRefs:n}}function rn(){let t={type:"string",pattern:"^\\d{4}-\\d{2}-\\d{2}$"},n=(e,r)=>({type:"integer",minimum:e,maximum:r});return{type:"object",description:'How the date beside it repeats; the date is the first occurrence. "on" is weekdays for "week", days of the month (-1 the last) for "month".',properties:{every:{type:"string",enum:[...fe]},interval:n(1,99),on:{type:"array",minItems:1,maxItems:31,items:{anyOf:[{type:"string",enum:[...ue]},n(-1,31)]}},until:t,count:n(1,1e3),except:{type:"array",maxItems:500,items:t},continues:{type:"string",maxLength:200}},required:["every"],additionalProperties:!1}}function He(t){let n=new Set;for(let e=t;e;e=e.onBehalfOf)e.id!==void 0&&n.add(`${e.kind}:${e.id}`);return n}function F(t,n){let e=He(n),r=p=>{if(p.kind==="rule")return!1;let S=He(p);if(S.size===0)return!1;for(let h of S)if(e.has(h))return!1;return!0},i,o=()=>{if(i)return i;i=new Map;for(let p of t.log.live()){if(p.undoes!==void 0)continue;let S=r(p.author)?p.author:void 0;for(let h of p.primitives){h.op==="remove-node"&&i.delete(h.node.id);let u=h.op==="add-node"?h.node.id:h.op==="patch-node"?h.id:void 0;if(u===void 0)continue;let f=h.op==="add-node"?Object.keys(h.node):Object.keys(h.after),w=i.get(u);(h.op==="add-node"||!w)&&i.set(u,w=new Map);for(let y of f)y==="id"||y==="kind"||(S?w.set(y,S):w.delete(y))}}return i},a=t.schema,l=new Map,s=(p,S)=>{let h=`${p}\0${S}`,u=l.get(h);if(u===void 0){let f=a.tryDefinition(p)?.fields?.shape;u=f!==void 0&&S in f&&Ae(f[S]).type==="text",l.set(h,u)}return u},b=p=>t.graph.getNode(p)?.kind;return{prose:s,say:p=>H(p,{graph:t.graph,schema:a}),fieldBy(p,S){let h=b(p);if(!(h===void 0||!s(h,S)))return o().get(p)?.get(S)},recordBy(p){let S=b(p),h=o().get(p);if(S===void 0||!h)return;let u;for(let[f,w]of h)s(S,f)&&(u=w);return u}}}var Y=(t,n,e)=>({untrusted:!0,authoredBy:e.say(n),text:t}),on="the host's ranker";function Le(t,n){return{...t,hits:t.hits.map(e=>{if(e.about!=="node")return e;e.why.by==="meaning"&&e.why.matched!==void 0&&(e={...e,why:{...e.why,matched:{untrusted:!0,authoredBy:on,text:e.why.matched}}});let r=n.recordBy(e.id);if(!r)return e;let i=n.prose(e.kind,e.why.field)?n.fieldBy(e.id,e.why.field):r;return{...e,label:Y(e.label,r,n),...e.apart!==void 0?{apart:Y(e.apart,r,n)}:{},why:i?{...e.why,fragment:Y(e.why.fragment,i,n)}:e.why}})}}var X=(t,n,e)=>({title:t,readOnlyHint:n,destructiveHint:!1,idempotentHint:e,openWorldHint:!1}),an={name:"subscribe",title:"Notify me when something happens",description:`Subscribe the person you act for to be told when something happens in this app \u2014 their host delivers it (an email, a push). on is one of: "act" (an act runs; give act, its declared name, and/or record), "created" (a record of kind is added), "changed" (a record of kind, or the one record, changes), "reaches" (a record of kind, or the one record, comes to satisfy condition, an expression in the app's rule language such as done == true or amount > 100). They are told only of changes someone else made, unless alsoMine is true, and only of records they may see. Returns the subscription and its sentence. Changes nothing in the app.`,inputSchema:{type:"object",properties:{on:{type:"string",enum:["act","created","changed","reaches"],description:"What to be told of."},act:{type:"string",description:"An act's declared name, for on: act."},kind:{type:"string",description:"A kind, for created, changed and reaches."},record:{type:"string",description:"One record, by id or name: for act, changed and reaches."},condition:{type:"string",description:"For reaches: what the record should come to satisfy, in the rule language (done == true)."},alsoMine:{type:"boolean",description:"Also when the person themselves made the change; false when unsaid."}},required:["on"],additionalProperties:!1},mutating:!1,annotations:X("Notify me when something happens",!1,!1)},sn={name:"unsubscribe",title:"Stop notifying me",description:"Take away one of the person's subscriptions, by the id list_subscriptions or subscribe answered. Changes nothing in the app.",inputSchema:{type:"object",properties:{id:{type:"string",description:"The subscription's id."}},required:["id"],additionalProperties:!1},mutating:!1,annotations:X("Stop notifying me",!1,!0)},dn={name:"list_subscriptions",title:"What I am notified of",description:`List what the person you act for is told of in this app: each subscription's id and its sentence ("When someone else adds a task").`,inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:X("What I am notified of",!0,!0)},Q=[an,sn,dn];var j=t=>{let n;return()=>n??=t().catch(e=>{throw n=void 0,e})},cn=j(()=>(__graviewPreload(import.meta.url,["./chunk.SYAEBGDC.js","./chunk.UZGRRDHD.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.IDVAR5HM.js"))),ln=()=>(__graviewPreload(import.meta.url,["./chunk.G5NZVPJU.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.OC6IWRQ3.js")).catch(()=>{}),un=async()=>{(await ln())?.judgeWithLines()},I=j(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.UGFJKSHU.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.EF3XNU4O.js"))),fn=j(()=>(__graviewPreload(import.meta.url,["./chunk.UBFNZMUX.js","./chunk.G4JJXA63.js","./chunk.HAIG6NVX.js","./chunk.UZGRRDHD.js","./chunk.OKRNJXTV.js","./chunk.CAVBSL27.js","./chunk.Q5WEOX3Q.js","./chunk.GV2CQVKV.js","./chunk.4HZ7QTXZ.js","./chunk.G5NZVPJU.js","./chunk.WVUJXDXZ.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.XKABS745.js"))),pn=j(()=>(__graviewPreload(import.meta.url,["./chunk.3AGY4QVS.js","./chunk.SYAEBGDC.js","./chunk.UZGRRDHD.js","./chunk.XANVHJQ4.js","./chunk.UT6642FC.js","./chunk.ULRW47RP.js","./chunk.PBSMLINK.js","./chunk.3TY5NFLY.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.B2GLDIAS.js","./chunk.6YCBYL2Y.js","./chunk.UGFJKSHU.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.52W7WYME.js"))),mn=j(()=>(__graviewPreload(import.meta.url,["./chunk.E2YEOMPH.js","./chunk.D75KC3LL.js","./chunk.FWTIUYXH.js","./chunk.MAF7C3VM.js","./chunk.MNP4JI33.js","./chunk.AJZBJBMO.js"]),import("./chunk.EKPRNDUV.js"))),hn=t=>t.definitions.some(n=>C(n).size>0),qe=t=>({value:B(t),label:t.label,...t.describe?{describe:t.describe}:{},...t.card?{card:t.card}:{},fields:t.fields,...t.app?{app:t.app}:{}});async function yn(t,n,e,r){let i=String(e.relation??""),[o,a]=i.includes(".")?i.split(".",2):[void 0,i],l=t.schema.definitions.flatMap(y=>[...C(y)].map(([d,c])=>({kind:y.kind,name:d,relation:c}))),s=l.filter(y=>y.name===a&&(o===void 0||y.kind===o));if(s.length!==1){let y=l.map(d=>`${d.kind}.${d.name}`).join(", ")||"none";return{ok:!1,error:`${s.length===0?`No relation to another app is called "${i}"`:`"${i}" names a relation of several kinds`}. The relations to other apps are: ${y}.`}}let{kind:b,name:p,relation:S}=s[0];if(!r)return{ok:!1,error:`This seat cannot read ${S.address}: its host reads no other app's records. Nothing was changed.`};let h={kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},u=typeof e.of=="string"?e.of:void 0;if(u!==void 0){let y=t.graph.getNode(u);if(!y||y.kind!==b)return{ok:!1,error:`No ${b} "${u}".`};let d=ce(y[p],S),c=await Promise.all(d.map(m=>Promise.resolve().then(()=>r.resolve(m,h)).catch(()=>null)));return{ok:!0,data:{relation:`${b}.${p}`,app:S.address,records:c.map((m,g)=>m===null?{value:B(d[g]),missing:!0}:"denied"in m?{denied:!0,said:"linked record (no access)"}:qe(m))},reads:[u]}}let f=typeof e.limit=="number"&&e.limit>0?Math.min(e.limit,20):20,w=await Promise.resolve().then(()=>r.find({address:S.address,kinds:S.kinds,query:String(e.query??""),limit:f},h)).catch(()=>[]);return Array.isArray(w)?{ok:!0,data:{relation:`${b}.${p}`,app:S.address,records:w.map(qe),link:`edit-${b} with ${p} set to a record's value`}}:{ok:!0,data:{relation:`${b}.${p}`,app:S.address,denied:!0,said:"linked record (no access)"}}}var R=t=>({title:t,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),Fe={description:'Which records: false (the default) the live ones, true only the archived ones, "all" both. An archived record is set aside, not gone: unarchive-<kind> brings it back.',anyOf:[{type:"boolean"},{type:"string",enum:["all"]}]},ee={type:"number",description:"Where the page starts; 0 when unsaid."},ie=[{name:"search_graph",title:"Find by name",description:"Find things by name: records whose name or readable fields carry the words, and the kinds, places and rules the words name \u2014 each with why it matched. Reach for this before get_graph when you know what something is called. Words match the start of words, case and accents aside; key:value tokens narrow as a list's filter does (done:false, is:any for past records, kind:<kind>). Pass subject (a node id) to get the acts you may run on it as hits too. When few records match exactly, records with a near word follow \u2014 a typo, another form of the word, a meaning \u2014 each with near: true and why.matched, the record's own word that answered.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Words, with optional key:value conditions."},limit:{type:"number",description:"Most hits to return; at most 20."},subject:{type:"string",description:"A node id whose acts to include."},archived:Fe},required:["query"],additionalProperties:!1},mutating:!1,annotations:R("Find by name")},{name:"get_graph",title:"Read the graph",description:"Read the graph, 25 nodes a page: their fields, the edges out of them, and how many more. Start here when you need the shape of the domain rather than one thing in it.",inputSchema:{type:"object",properties:{offset:ee,archived:Fe},additionalProperties:!1},mutating:!1,annotations:R("Read the graph")},{name:"get_node",title:"Read one node",description:"Read one node: its fields, its links (id, kind and label, 20 each way a page), the violations that implicate it, and its computed values: read-only fields worked out from what you can see, which no act sets. Use this to check a thing before you change it.",inputSchema:{type:"object",properties:{id:{type:"string",description:"A node's id, or its name."},offset:ee},required:["id"],additionalProperties:!1},mutating:!1,annotations:R("Read one node")},{name:"get_violations",title:"List the problems",description:"List the invariant violations the graph currently has, 20 a page, with the repairs that would resolve each one. Read this before proposing work: a rule that is already broken is more urgent than anything you could add.",inputSchema:{type:"object",properties:{offset:ee,context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:R("List the problems")},{name:"get_affordances",title:"Ask what can be done",description:"Ask what can legally be done with a selection, ranked. Prefer these over composing a mutation by hand: they are derived from the schema, the invariants and the shape of the graph, so they cannot name an action that does not exist.",inputSchema:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"Node ids."},context:{type:"object"}},required:["selection"],additionalProperties:!1},mutating:!1,annotations:R("Ask what can be done")},{name:"describe_place",title:"Say what a place shows",description:`Say what one place of the app shows you, as a person in your seat would see it: its headings, its figures as drawn, its lists with each record's title and what its card or row says, the headings a list is grouped under, what an empty list says, and any block that could not be worked out. Pass a place's slug ("home", a lens's address like "the-offers", a kind's like "offers") or a record's id, and width 390 for a phone. Use it after a change to check what somebody now sees, instead of guessing.`,inputSchema:{type:"object",properties:{place:{type:"string",description:`"home", a place's slug, or a record's id.`},width:{type:"number",description:"The screen's width in CSS pixels; 390 is a phone, 1440 when unsaid."}},required:["place"],additionalProperties:!1},mutating:!1,annotations:R("Say what a place shows")},{name:"preview_mutation",title:"Try an act without applying it",description:"Try a mutation without applying it: get back the diff it would produce and any invariant it would break. Do this when you are unsure, rather than applying and undoing.",inputSchema:{type:"object",properties:{mutation:{type:"string"},args:{type:"object"}},required:["mutation","args"],additionalProperties:!1},mutating:!1,annotations:R("Try an act without applying it")},{name:"undo_batch",title:"Undo a batch",description:"Undo one batch of operations. Fails, naming the blocking operation, when a later operation read what it wrote.",inputSchema:{type:"object",properties:{batch:{type:"string"},include:{type:"array",items:{type:"string"}}},required:["batch"],additionalProperties:!1},mutating:!0,annotations:{title:"Undo a batch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},{name:"list_suggestions",title:"List what is suggested",description:"List the suggestions waiting for a person: changes the app's own actor proposed and did not make, each with its id, what it would do, who suggested it, what it was based on and how sure (0 to 1). Nothing changes until one is accepted (accept_suggestion) or declined (decline_suggestion); a declined one is never suggested again.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:R("List what is suggested")},{name:"accept_suggestion",title:"Accept a suggestion",description:"Make a waiting suggestion's change, as this seat, carrying what it was based on. Returns the batch (undo_batch takes it back).",inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Accept a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1}},{name:"decline_suggestion",title:"Decline a suggestion",description:"Decline a waiting suggestion: nothing changes, the decline is kept in the log, and the same change is never suggested or made by the app's own actor again.",inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Decline a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}],Be={name:"act_on_several",title:"Do one act to several records",description:`Run one act on several records at once, as one change with one undo. act is the act (its tool name or its declared name), records the records it runs on (ids or names; each goes in the act's subject), args what every call shares ("Set stage to Declined" is args { stage: "declined" }). Each record is judged on its own: one this seat may not change is named with why, and the rest still apply. Returns the batch (undo_batch takes it all back), the records changed, those already so, and those refused.`,inputSchema:{type:"object",properties:{act:{type:"string",description:"The act to run on each record."},records:{type:"array",items:{type:"string"},minItems:1,maxItems:200,description:"Ids or names of the records."},args:{type:"object",description:"Arguments every call shares, besides the record."}},required:["act","records"],additionalProperties:!1},mutating:!0,annotations:{title:"Do one act to several records",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},re={type:"object",description:"A lens, as draft_view returns one.",properties:{title:{type:"string"},lens:{type:"string"},on:{type:"string"},bindings:{type:"object"},options:{type:"object"}},required:["title","lens","on"]},oe={name:"draft_view",title:"Draw a view",description:'Draw a view of the data from words ("a board of tasks by status", "who covers what") as a lens the app could keep; or check a lens you wrote (lens); or change the one on screen (current, with ask: "only this month"). Returns the lens and its add-lens edit, or one sentence saying why not. Writes nothing.',inputSchema:{type:"object",properties:{ask:{type:"string",description:"What to see, in words."},lens:re,current:re},additionalProperties:!1},mutating:!1,annotations:R("Draw a view")},Ce={name:"keep_lens",title:"Keep a view as a lens",description:"Keep a lens draft_view drew as one of the app's places: checked again, then written as the add-lens edit. Returns the remove-lens edit that takes it back.",inputSchema:{...re,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},Ue={name:"find_linked",title:"Find a record in another app",description:`A relation may go to a kind in another app (describe_app lists them under "Linked from other apps"). With relation and words, list the records there this seat may link \u2014 each with the value to link it by ("house:h1"), its name and its describe line. With of (a record id here), read the records that record links, as this seat may see them there. Linking one is the record's edit (edit-<kind>) with the relation set to the value. Another app this seat may not open answers denied, and nothing of it. Writes nothing; never changes the other app.`,inputSchema:{type:"object",properties:{relation:{type:"string",description:"The relation, by name (forHouse) or as <kind>.<relation> (scenario.forHouse)."},query:{type:"string",description:"Words to find by, in the other app's names; empty for the first few."},of:{type:"string",description:"A record here whose linked records to read, instead of finding."},limit:{type:"number",description:"Most records to return; at most 20."}},required:["relation"],additionalProperties:!1},mutating:!1,annotations:R("Find a record in another app")};function gn(t,n){return t===void 0?[]:t==="keep"&&!n?[oe,Ce]:[oe]}var bn="An argument that names a record takes its id or its name.",Ve=[...ie.map(t=>t.name),Be.name,oe.name,Ce.name,Ue.name,...Q.map(t=>t.name)],Ge=64;function _(t){let{line:n,...e}=t;return e}function We(t){return{...t,...t.introduces?{introduces:t.introduces.map(_)}:{},...t.resolves?{resolves:t.resolves.map(_)}:{},...t.violationsAfter?{violationsAfter:t.violationsAfter.map(_)}:{}}}function wn(t){let n=t.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return n.length===0&&(n="act"),/^[A-Za-z_]/.test(n)||(n=`act_${n}`),n.slice(0,Ge)}function Sn(t){let n=new Set(Ve),e=new Map;for(let r of t){let i=wn(r),o=i;for(let a=2;n.has(o);a+=1)o=`${i.slice(0,Ge-`_${a}`.length)}_${a}`;n.add(o),e.set(r,o)}return e}function kn(t,n){if(n.size===0)return t;let e=Object.fromEntries(Object.entries(t.properties??{}).filter(([i])=>!n.has(i))),r=(t.required??[]).filter(i=>!n.has(i));return{...t,properties:e,...t.required?{required:r}:{}}}function vn(t,n,e){let r=Z(t),i=W(t),o=r.nodeRefs.length>0?`${r.description}${/[.!?]$/.test(r.description)?"":"."} ${bn}`:r.description;return{name:n,title:i,description:o,inputSchema:kn(r.inputSchema,e),mutating:!0,annotations:{title:i,readOnlyHint:!1,destructiveHint:t.destructive===!0||(t.severs?.length??0)>0,idempotentHint:t.idempotent===!0,openWorldHint:!1},act:t.name}}function ae(t){if(t===null||typeof t!="object")return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(ae).join(",")}]`;let n=t;return`{${Object.keys(n).filter(e=>n[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${ae(n[e])}`).join(",")}}`}function An(t){return`sha256:${ke(ae(t))}`}function On(t,n,e,r,i,o=!1,a=!1){let l=Sn(t.map(p=>p.name)),s=[...gn(r,e),...o?[Ue]:[],...a?Q:[]];return{definitions:e?[...ie.filter(p=>!p.mutating),...s]:[...ie,Be,...s,...t.filter(p=>n.has(p.name)).map(p=>vn(p,l.get(p.name),i(p)))],names:l}}function st(t,n={}){let e=n.author??{kind:"agent"},r=t.allMutations(),i=new Set(t.permittedMutations(e).map(u=>u.name)),{definitions:o,names:a}=On(r,i,n.readOnly===!0,n.drafts?n.drafts.keep?"keep":"draw":void 0,u=>V(t.schema,t.policy,e,u),hn(t.schema),n.subscriptions!==void 0),l=An(o),s=u=>{if(!Ve.includes(u)){for(let[f,w]of a)if(w===u)return f;return a.has(u)?u:void 0}},b=(u,f)=>{let w=r.find(c=>c.name===u);if(!w)return{args:f,resolved:[]};let y={...f},d=[];for(let c of L(w.input)){let m=y[c.name];if(typeof m!="string"||m.trim()==="")continue;let g=t.resolveRef(c,m,e);if(!g.ok){let k=g.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${c.name}.`:" Nothing was changed.";return{ok:!1,error:`${g.message}${k}`,argument:c.name,candidates:g.candidates}}g.by!=="id"&&(y[c.name]=g.id,d.push({argument:c.name,given:m,id:g.id,label:g.label}))}return{args:y,resolved:d}},p=async(u,f)=>{try{await un();let w=o.find(d=>d.name===u)??o.find(d=>d.act===u);if(!w){let d=s(u);if(d){let c=t.permits({name:d,args:f},e);if(!c.ok)return{ok:!1,error:c.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${u}". Available: ${o.map(c=>c.name).join(", ")}`}}if(w.mutating&&n.readOnly)return{ok:!1,error:`"${u}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(w.act!==void 0){let d=b(w.act,f);if("ok"in d)return d;let c=P(t,e,t.apply({name:w.act,args:d.args},{...n.author?{author:n.author}:{},...ne(n.via)}));return{ok:!0,data:{batch:c.batch,intent:c.intent,introduces:c.introduces.map(_),resolves:c.resolves.map(_),...d.resolved.length>0?{resolved:d.resolved}:{}},diff:c.diff}}let y=t.seenBy(e);switch(w.name){case"search_graph":{let d=typeof n.places=="function"?n.places():n.places,c=typeof f.subject=="string"?f.subject:void 0,m=Te(y,String(f.query??""),{principal:e,rank:n.near,archived:he(f.archived),limit:typeof f.limit=="number"&&f.limit>0?Math.min(f.limit,20):20,...d?{places:d}:{},...c?{subject:c,from:[c]}:{}}),g=m.later?await m.later:m;return{ok:!0,data:(await I()).searchRead(g,Le(g,F(y,e))),reads:g.hits.flatMap(k=>k.about==="node"?[k.id]:[])}}case"get_graph":return{ok:!0,...(await I()).graphRead(y,F(y,e),f)};case"get_node":{let d=String(f.id??""),c=d,m;if(!y.graph.getNode(d)){let k=d.trim()===""?void 0:t.resolveRef({name:"id",kinds:["*"]},d,e);if(k?.ok)c=k.id,m={argument:"id",given:d,id:c,label:k.label};else return k?.reason==="ambiguous"?{ok:!1,error:k.message,argument:"id",candidates:k.candidates}:{ok:!1,error:`No node "${d}".`}}let g=(await I()).nodeRead(y,F(y,e),c,f);return{ok:!0,data:m?{...g.data,resolved:[m]}:g.data,reads:g.reads}}case"describe_place":{let d=n.app??{name:"",schema:t.schema},c=typeof f.width=="number"&&Number.isFinite(f.width)&&f.width>0?f.width:1440,{describePlace:m}=await cn(),g=m(t,e,String(f.place??""),{app:d,width:c});if(!g.ok)return{ok:!1,error:`${g.error} The places are: ${g.places.join(", ")}.`};let k=new Set,x=E=>{for(let M of E)for(let O of M.groups??[])for(let T of O.items)k.add(T.id),x(T.parts)};return x(g.description.parts),{ok:!0,data:g.description,reads:[...k]}}case"find_linked":return yn(y,e,f,n.linked);case"draft_view":case"keep_lens":{let d=n.app??{name:"",schema:t.schema};return(await fn()).runDraftTool(w.name,f,{app:d,principal:e,...n.drafts?{drafts:n.drafts}:{}})}case"get_violations":{let d=y.violations(f.context);return{ok:!0,...(await I()).violationsRead(d,f)}}case"get_affordances":{let d=f.selection??[];return{ok:!0,data:xe(y,d,{...typeof n.derive=="function"?n.derive():n.derive,...n.author?{principal:n.author}:{},...f.context?{context:f.context}:{}}),reads:d.filter(m=>y.graph.has(m))}}case"preview_mutation":{let d=String(f.mutation),c=s(d)??d,m=b(c,f.args??{});if("ok"in m)return m;let g=t.missingFor({name:c,args:m.args},e);if(g)return{ok:!1,error:g.message,reason:"missing"};let k=P(t,e,t.preview({name:c,args:m.args},void 0,{author:e})),x=We(k);return{ok:!0,data:m.resolved.length>0?{...x,resolved:m.resolved}:x}}case"act_on_several":{let d=String(f.act??""),c=s(d)??d,m=r.find(v=>v.name===c);if(!m||!i.has(c)){let v=m?t.permits({name:c,args:{}},e):void 0;return v&&!v.ok?{ok:!1,error:v.refusal.message,reason:"forbidden"}:{ok:!1,error:`There is no act "${d}" this seat may run. Nothing was changed.`,reason:"invalid"}}let g=m.subject;if(!g)return{ok:!1,error:`"${W(m)}" does not act on a record, so it cannot be run on several. Nothing was changed.`,reason:"invalid"};let k=Array.isArray(f.records)?f.records.filter(v=>typeof v=="string"&&v.trim()!==""):[];if(k.length===0)return{ok:!1,error:"Name at least one record. Nothing was changed.",reason:"invalid"};let x=[],E=[];for(let v of k.slice(0,200)){let N=t.resolveRef({name:g.arg,kinds:g.kinds},v,e);if(!N.ok)return{ok:!1,error:`${N.message} Nothing was changed.`,argument:"records",candidates:N.candidates};x.push(N.id),N.by!=="id"&&E.push({argument:"records",given:v,id:N.id,label:N.label})}let M=b(c,{...f.args??{}});if("ok"in M)return M;let O=(await pn()).actOnSeveral(t,{mutation:c,subject:g.arg,args:M.args},x,{author:e,...ne(n.via)}),T=O.result?P(t,e,O.result):void 0;return{ok:!0,data:{...O.batch?{batch:O.batch,intent:O.intent}:{},applied:O.applied,unchanged:O.unchanged,refused:O.refused.map(v=>({record:v.id,label:v.label,error:v.message,reason:v.reason})),...O.allOrNothing?{keptNone:!0}:{},...T?{introduces:T.introduces.map(_),resolves:T.resolves.map(_)}:{},...E.length>0||M.resolved.length>0?{resolved:[...E,...M.resolved]}:{}},...T?{diff:T.diff}:{}}}case"subscribe":case"unsubscribe":case"list_subscriptions":{let d=await(await mn()).runSubscriptionTool(w.name,f,{store:t,principal:n.subscriber??e,app:n.app?.name??"app",subscriptions:n.subscriptions});return d.ok?{ok:!0,data:d.data}:{ok:!1,error:d.error}}case"list_suggestions":{let d=Oe(t,e).map(c=>{let m=H(c.author,{graph:y.graph,schema:t.schema});return{id:c.id,intent:c.intent,by:m,at:c.at,about:c.about,...c.lineage?{basis:{untrusted:!0,authoredBy:m,text:c.lineage.basis},...c.lineage.confidence!==void 0?{confidence:c.lineage.confidence}:{}}:{}}});return{ok:!0,data:{suggestions:d},reads:[...new Set(d.flatMap(c=>c.about))]}}case"accept_suggestion":case"decline_suggestion":{let d=String(f.suggestion??""),c={author:e,...ne(n.via)},m=w.name==="accept_suggestion"?Re(t,d,c):_e(t,d,c),g=P(t,e,m);return{ok:!0,data:{batch:g.batch,intent:g.intent,introduces:g.introduces.map(_),resolves:g.resolves.map(_)},diff:g.diff}}case"undo_batch":{let d=String(f.batch),c=f.include??[],m=y.canUndo([d,...c]);if(!m.ok)return{ok:!1,error:m.message};let g=P(t,e,t.undo([d,...c],{...n.author?{author:n.author}:{}}));return{ok:!0,data:We(g),diff:g.diff}}default:return{ok:!1,error:`Unknown tool "${u}".`}}}catch(w){let{reason:y,wouldNeed:d}=ye(w);return{ok:!1,error:w instanceof Error?w.message:String(w),reason:y,...d?{wouldNeed:d}:{}}}},S=new Set,h=u=>{for(let f of S)f(u)};return{definitions:o,hash:l,...n.author?{author:n.author}:{},onDiff(u){return t.subscribe(u)},onCall(u){return S.add(u),()=>S.delete(u)},async call(u,f){let w=(o.find(m=>m.name===u)??o.find(m=>m.act===u))?.mutating??!1,y={name:u,args:f,mutating:w,at:new Date().toISOString()};h({...y,phase:"running"});let d=m=>(h(m.ok?{...y,phase:"ok",...!w&&m.reads?{reads:m.reads}:{}}:{...y,phase:"failed",error:m.error}),m),c=await p(u,f);return d(c.ok&&!w?{...c,data:(await I()).withinReadChars(u,c.data)}:c)}}}function ne(t){let n=typeof t=="function"?t():t;return n?{via:n}:{}}export{ae as a,st as b};
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{q as Te}from"./chunk.YT2CYCVT.js";import{a as xe}from"./chunk.QVKKXMNK.js";import{f as V}from"./chunk.ZE4CTZQ3.js";import{c as Oe,d as Re,e as _e}from"./chunk.3C4RJIJU.js";import{a as P}from"./chunk.HPD5ZDZH.js";import{a as ve,b as U,d as Ae}from"./chunk.Z7ZCR4LN.js";import{a as me}from"./chunk.FSAHO3LV.js";import{Ba as ue,Ca as fe,Fa as pe,La as H,Oa as he,Y as W,a as se,jb as ye,ma as de,mb as ge,nb as be,pa as B,qb as we,ra as ce,ta as le,tb as Se,tc as ke,ua as C,wb as L}from"./chunk.X7W27IRI.js";var $=(t,n,e)=>{(t[n]===void 0||e>t[n])&&(t[n]=e)},J=(t,n,e)=>{(t[n]===void 0||e<t[n])&&(t[n]=e)},G=(t,n)=>{t.format=n,n.includes("int")&&(t.isInt=!0)},Me=(t,n)=>{t.mime=t.mime?t.mime.filter(e=>n.includes(e)):[...n]},Ne=(t,n)=>{t.multipleOf??=[],t.multipleOf.includes(n)||t.multipleOf.push(n)},$e=(t,n)=>(t.patterns??=new Set).add(n),Ke={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function D(t){let n={},{def:e,bag:r}=t._zod,i=t._zod.traits.has("$ZodCheck")?[t,...e.checks??[]]:e.checks??[];for(let o of i){let a=o._zod.def;switch(a.check){case"greater_than":$(n,a.inclusive?"minimum":"exclusiveMinimum",a.value);break;case"less_than":J(n,a.inclusive?"maximum":"exclusiveMaximum",a.value);break;case"multiple_of":Ne(n,a.value);break;case"number_format":{G(n,a.format);let l=Ke[a.format];l&&($(n,"minimum",l[0]),J(n,"maximum",l[1]));break}case"bigint_format":G(n,a.format);break;case"min_length":case"min_size":$(n,"minimum",a.minimum);break;case"max_length":case"max_size":J(n,"maximum",a.maximum);break;case"length_equals":$(n,"minimum",a.length),J(n,"maximum",a.length);break;case"size_equals":$(n,"minimum",a.size),J(n,"maximum",a.size);break;case"string_format":G(n,a.format),a.pattern&&$e(n,a.pattern),(a.format==="base64"||a.format==="base64url")&&(n.contentEncoding=a.format),(a.local||a.precision===-1)&&(n.laxFormat=!0);break;case"mime_type":Me(n,a.mime);break}}r.minimum!==void 0&&$(n,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&$(n,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&J(n,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&J(n,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&Ne(n,r.multipleOf),r.format!==void 0&&(n.format??=r.format,r.format.includes("int")&&(n.isInt=!0)),r.mime&&Me(n,r.mime);for(let o of r.patterns??[])$e(n,o);return n}var Ze={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};function z(t){let n=t._zod.def;return n.type==="pipe"&&n.in._zod.traits.has("$ZodTransform")?z(n.out):n.type==="catch"?z(n.innerType):t._zod.optin}var Ye=new Set(["promise","optional","nonoptional","nullable","readonly","default","prefault","catch"]);function A(t,n=new Set){if(n.has(t))return!1;n.add(t);let e=t._zod.def,r=e.type;return r==="transform"?!0:r==="array"?A(e.element,n):r==="set"?A(e.valueType,n):r==="lazy"?A(e.getter(),n):Ye.has(r)?A(e.innerType,n):r==="intersection"?A(e.left,n)||A(e.right,n):r==="record"||r==="map"?A(e.keyType,n)||A(e.valueType,n):r==="pipe"?t._zod.traits.has("$ZodCodec")||A(e.in,n)||A(e.out,n):r==="object"?Object.values(e.shape).some(i=>A(i,n)):r==="union"?e.options.some(i=>A(i,n)):r==="tuple"?e.items.some(i=>A(i,n))||(e.rest?A(e.rest,n):!1):!1}function Xe(t){let n=Object.values(t).filter(e=>typeof e=="number");return Object.entries(t).filter(([e])=>n.indexOf(+e)===-1).map(([,e])=>e)}function De(t){let n=t.anyOf;if(!Array.isArray(n)||n.length===0||t.type!==void 0)return;let e=[];for(let r of n){if(!r||typeof r!="object")return;De(r);let i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;for(let o of[r.type].flat()){if(typeof o!="string")return;e.includes(o)||e.push(o)}}delete t.anyOf,t.type=e.length===1?e[0]:e}var Ee=new Set(["type","properties","required","additionalProperties"]),Je=t=>{let n=t.additionalProperties;return n&&typeof n=="object"&&Object.keys(n).length?n:null},Pe=(t,n)=>JSON.stringify(t)===JSON.stringify(n);function K(t){for(let i of t){if(typeof i!="object"||i.type!=="object")return null;for(let o in i)if(!Ee.has(o))return null}let n={},e=new Set;for(let i of t){for(let o in i.properties){if(Object.prototype.hasOwnProperty.call(n,o))continue;let a=[];for(let l of t){let s=l.properties?.[o]??Je(l);s&&!a.some(b=>Pe(b,s))&&a.push(s)}n[o]=a.length===1?a[0]:K(a)??{allOf:a}}for(let o of i.required??[])e.add(o)}let r={type:"object",properties:n};if(e.size&&(r.required=[...e]),t.every(i=>i.additionalProperties===!1))r.additionalProperties=!1;else{let i=[];for(let o of t){let a=Je(o);a&&!i.some(l=>Pe(l,a))&&i.push(a)}i.length===1?r.additionalProperties=i[0]:i.length>1&&(r.additionalProperties={allOf:i})}return r}function Qe(t){let n=t.allOf;if(!Array.isArray(n)||n.length<2)return;for(let i of Ee)if(i in t)return;let e=n.filter(i=>Array.isArray(i.oneOf)||Array.isArray(i.anyOf)),r;if(!e.length)r=K(n);else{let i=e[0],o=Array.isArray(i.oneOf)?"oneOf":"anyOf";if(Object.keys(i).length!==1)return;let a=n.filter(s=>s!==i),l=i[o].map(s=>K([...a,s]));if(l.some(s=>!s))return;r={[o]:l}}r&&(delete t.allOf,Object.assign(t,r))}function ze(t){let n=t;for(let u of["anyOf","oneOf"]){let f=n[u];if(!Array.isArray(f))continue;let w=f.map(ze);w.some((y,d)=>y!==f[d])&&(n={...n,[u]:w})}let e=[n.type].flat(),r=!e.includes("string")&&e.some(u=>u==="number"||u==="integer"),i=n.enum??(n.const!==void 0?[n.const]:void 0);if(!r&&!i?.some(u=>typeof u=="number"))return n;let{minimum:o,maximum:a,exclusiveMinimum:l,exclusiveMaximum:s,multipleOf:b,format:p,id:S,...h}=n;return h.enum?h.enum=h.enum.map(u=>typeof u=="number"?String(u):u):typeof h.const=="number"&&(h.const=String(h.const)),r&&(h.type="string",i||(h.pattern=e.includes("number")?"^-?\\d+(?:\\.\\d+)?$":"^-?\\d+$")),h}var q=class{constructor(n,e){this.override=n;this.refs=e}done=new Map;path=[];cyclic=new Map;write(n,e=!1){let r=this.refs.get(n);if(r!==void 0&&!e)return{$ref:r};if(this.path.includes(n))return this.cyclic.has(n)||this.cyclic.set(n,""),{};let i=this.done.get(n);if(i)return i;this.path.push(n);try{let o=this.written(n);return this.done.set(n,o),o}finally{this.path.pop()}}written(n){let e={},r,i=n._zod.toJSONSchema?.();i?Object.assign(e,i):r=this.process(n,e);let o=se.get(n);if(o)for(let l of Object.keys(o))e[l]=o[l];A(n)&&(delete e.examples,delete e.default),"_prefault"in e&&(e.default??=e._prefault,delete e._prefault);let a=e;if(r){let l=this.write(r);a={...e};for(let s of Object.keys(l))s in e||(a[s]=l[s])}return this.override({zodSchema:n,jsonSchema:a}),De(a),n._zod.def.type==="intersection"&&Qe(a),a}process(n,e){let r=n._zod.def;switch(r.type){case"string":{e.type="string";let{minimum:i,maximum:o,format:a,patterns:l,contentEncoding:s,laxFormat:b}=D(n);if(typeof i=="number"&&(e.minLength=i),typeof o=="number"&&(e.maxLength=o),a&&(e.format=Ze[a]??a,(e.format===""||a==="time"||b)&&delete e.format),s&&(e.contentEncoding=s),l&&l.size>0){let p=[...l];p.length===1?e.pattern=p[0].source:e.allOf=p.map(S=>({pattern:S.source}))}return}case"number":{let{minimum:i,maximum:o,multipleOf:a,exclusiveMinimum:l,exclusiveMaximum:s,isInt:b}=D(n);if(e.type=b?"integer":"number",typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY)?e.exclusiveMinimum=l:typeof i=="number"&&(e.minimum=i),typeof s=="number"&&s<=(o??Number.POSITIVE_INFINITY)?e.exclusiveMaximum=s:typeof o=="number"&&(e.maximum=o),a){let[p,...S]=new Set(a.filter(h=>Number.isFinite(h)&&h!==0).map(Math.abs));p!==void 0&&(e.multipleOf=p),S.length&&(e.allOf=[...e.allOf??[],...S.map(h=>({multipleOf:h}))])}return}case"boolean":case"success":e.type="boolean";return;case"null":e.type="null";return;case"never":e.not={};return;case"enum":{let i=Xe(r.entries);i.length===0?e.not={}:(i.every(o=>typeof o=="number")&&(e.type="number"),i.every(o=>typeof o=="string")&&(e.type="string"),e.enum=i);return}case"literal":{let i=r.values.filter(o=>o!==void 0).map(o=>typeof o=="bigint"?Number(o):o);if(r.values.length===0)e.not={};else if(i.length===1)e.type=i[0]===null?"null":typeof i[0],e.const=i[0];else if(i.length>1){for(let o of["number","string","boolean"])i.every(a=>typeof a===o)&&(e.type=o);i.every(o=>o===null)&&(e.type="null"),e.enum=i}return}case"template_literal":e.type="string",e.pattern=n._zod.pattern.source;return;case"file":{e.type="string",e.format="binary",e.contentEncoding="binary";let{minimum:i,maximum:o,mime:a}=D(n);i!==void 0&&(e.minLength=i),o!==void 0&&(e.maxLength=o),a&&(a.length===0?e.not={}:a.length===1?e.contentMediaType=a[0]:e.anyOf=a.map(l=>({contentMediaType:l})));return}case"array":{let{minimum:i,maximum:o}=D(n);typeof i=="number"&&(e.minItems=i),typeof o=="number"&&(e.maxItems=o),e.type="array",e.items=this.write(r.element);return}case"object":{let i=r.shape;e.type="object";let o={};e.properties=o;for(let l in i)Object.defineProperty(o,l,{value:this.write(i[l]),writable:!0,enumerable:!0,configurable:!0});let a=Object.keys(i).filter(l=>z(i[l])===void 0);a.length>0&&(e.required=a),r.catchall?._zod.def.type==="never"?e.additionalProperties=!1:r.catchall&&(e.additionalProperties=this.write(r.catchall));return}case"union":e[r.inclusive===!1?"oneOf":"anyOf"]=r.options.map(i=>this.write(i));return;case"intersection":{let i=l=>"allOf"in l&&Object.keys(l).length===1,o=this.write(r.left),a=this.write(r.right);e.allOf=[...i(o)?o.allOf:[o],...i(a)?a.allOf:[a]];return}case"tuple":{let i=r.items;e.type="array",e.prefixItems=i.map(s=>this.write(s)),r.rest?e.items=this.write(r.rest):e.items=!1;let o=i.length;for(;o>0&&z(i[o-1])!==void 0;)o-=1;o>0&&(e.minItems=o),r.rest||(e.maxItems=i.length);let{minimum:a,maximum:l}=D(n);typeof a=="number"&&(e.minItems=a),typeof l=="number"&&(e.maxItems=l);return}case"record":{let i=r.keyType;e.type="object";let o=D(i).patterns;if(r.mode==="loose"&&o&&o.size>0){let l=this.write(r.valueType),s={};for(let b of o)s[b.source]=l;e.patternProperties=s}else e.propertyNames=ze(this.write(i)),e.additionalProperties=this.write(r.valueType);let a=i._zod.values;if(a&&!r.partial&&z(r.valueType)===void 0){let l=[...a].filter(s=>typeof s=="string"||typeof s=="number");l.length>0&&(e.required=l.map(String))}return}case"nullable":e.anyOf=[this.write(r.innerType),{type:"null"}];return;case"default":case"prefault":{let i=r.defaultValue,o,a=!1,l=JSON.stringify(i,(s,b)=>typeof b=="bigint"?(a=!0,null):b);return!a&&l!==void 0&&(o=JSON.parse(l)),a||(e[r.type==="default"?"default":"_prefault"]=o),r.innerType}case"catch":{try{e.default=r.catchValue(void 0)}catch{}return r.innerType}case"readonly":return e.readOnly=!0,r.innerType;case"pipe":return r.in._zod.traits.has("$ZodTransform")?r.out:r.in;case"lazy":return n._zod.innerType;case"optional":case"nonoptional":case"promise":return r.innerType;default:return}}};function Ie(t,n=()=>{}){let e=t,r=new q(n,new Map),i=r.write(e,!0);if(r.cyclic.size>0){let o=new Map,a=0,l=[];for(let b of r.cyclic.keys())if(b===e)o.set(b,"#");else{let p=`__schema${a++}`;o.set(b,`#/$defs/${p}`),l.push([b,p])}r=new q(n,o),i=r.write(e,!0);let s={};for(let[b,p]of l)s[p]=r.write(b,!0);l.length>0&&(i={...i,$defs:s})}return JSON.parse(JSON.stringify({$schema:"https://json-schema.org/draft/2020-12/schema",...i}))}function je(t){return Ie(t,tn)}var en={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"},nn={phone:"A phone number as it is written, like +1 555 123 4567 or 020 7946 0958 ext. 12.",place:"An address or a place's name, as a person would search a map for it.",duration:"A length of time in whole minutes: 90 is 1 h 30 min."};function tn(t){de(t.zodSchema)&&(t.jsonSchema["x-graview-app-link"]=!0);let n=le(t.zodSchema);if(n&&(t.jsonSchema.type==="string"||t.jsonSchema.type==="array")){t.jsonSchema["x-graview-linked"]={address:n.address,kinds:[...n.kinds],cardinality:n.cardinality};let s=n.kinds.join(" or "),b=`${n.cardinality==="many"?"Records":"A record"}: a ${s} in the app ${n.address}, as "${n.kinds[0]}:<id>" \u2014 an id found there with find_linked. Linking never changes that app.`,p=t.jsonSchema.description;typeof p=="string"&&p.includes(b)||(t.jsonSchema.description=`${typeof p=="string"&&p?`${p.replace(/\.?$/,".")} `:""}${b}`)}if(pe(t.zodSchema)&&(t.jsonSchema["x-graview-repeat"]=!0,!t.jsonSchema.type&&!t.jsonSchema.anyOf&&!t.jsonSchema.oneOf&&Object.assign(t.jsonSchema,rn())),me(t.zodSchema)){t.jsonSchema.contentMediaType="text/markdown";let s=t.jsonSchema.description;typeof s=="string"&&s.endsWith("Written in Markdown.")||(t.jsonSchema.description=`${typeof s=="string"&&s?`${s.replace(/\.?$/,".")} `:""}Written in Markdown.`)}let e=Se(t.zodSchema);if(e){let s=t.jsonSchema;s["x-graview-type"]=e,e==="duration"&&(s["x-graview-unit"]="minutes"),s.description??=nn[e]}let r=we(t.zodSchema,!1);if(r){let s=ve(r);t.jsonSchema["x-graview-format"]=s.format??"unit",s.currency&&(t.jsonSchema["x-graview-currency"]=s.currency),s.unit&&s.format!=="money"&&(t.jsonSchema["x-graview-unit"]=s.unit);let b=t.jsonSchema.description;t.jsonSchema.description=typeof b=="string"&&b.length>0?`${b} ${U(s)}`:U(s)}let i=t.zodSchema._zod?.def;if(!i||i.type!=="string"||typeof i.format!="string"||i.format==="regex")return;let o=t.jsonSchema,a=(i.checks??[]).map(s=>s._zod?.def).filter(s=>s?.format==="regex"&&s.pattern instanceof RegExp).map(s=>s.pattern.source);delete o.pattern;let l=o.allOf;Array.isArray(l)&&l.every(s=>typeof s=="object"&&s!==null&&Object.keys(s).length===1&&"pattern"in s)&&delete o.allOf,o.format=en[i.format]??i.format,a.length===1?o.pattern=a[0]:a.length>1&&(o.allOf=a.map(s=>({pattern:s})))}function Z(t){let n=L(t.input),e=je(t.input),r=e.properties??{};if(ge(t)){let i=t.creates.join(" | ");r.id={type:"string",minLength:1,description:`Optional: the id for the ${i} this makes. Refused if the graph already has it; left out, one is minted from the label.`},e.properties=r}be(t)&&(e.additionalProperties=!1);for(let i of n){let o=r[i.name];if(!o)continue;let a=i.kinds.includes("*")?"any node kind":i.kinds.join(" | ");o.description=[o.description,`Id of a node (${a}).`].filter(Boolean).join(" ")}return{name:t.name,...t.title===void 0?{}:{title:t.title},description:t.description??t.title??t.name,inputSchema:e,nodeRefs:n}}function rn(){let t={type:"string",pattern:"^\\d{4}-\\d{2}-\\d{2}$"},n=(e,r)=>({type:"integer",minimum:e,maximum:r});return{type:"object",description:'How the date beside it repeats; the date is the first occurrence. "on" is weekdays for "week", days of the month (-1 the last) for "month".',properties:{every:{type:"string",enum:[...fe]},interval:n(1,99),on:{type:"array",minItems:1,maxItems:31,items:{anyOf:[{type:"string",enum:[...ue]},n(-1,31)]}},until:t,count:n(1,1e3),except:{type:"array",maxItems:500,items:t},continues:{type:"string",maxLength:200}},required:["every"],additionalProperties:!1}}function He(t){let n=new Set;for(let e=t;e;e=e.onBehalfOf)e.id!==void 0&&n.add(`${e.kind}:${e.id}`);return n}function F(t,n){let e=He(n),r=p=>{if(p.kind==="rule")return!1;let S=He(p);if(S.size===0)return!1;for(let h of S)if(e.has(h))return!1;return!0},i,o=()=>{if(i)return i;i=new Map;for(let p of t.log.live()){if(p.undoes!==void 0)continue;let S=r(p.author)?p.author:void 0;for(let h of p.primitives){h.op==="remove-node"&&i.delete(h.node.id);let u=h.op==="add-node"?h.node.id:h.op==="patch-node"?h.id:void 0;if(u===void 0)continue;let f=h.op==="add-node"?Object.keys(h.node):Object.keys(h.after),w=i.get(u);(h.op==="add-node"||!w)&&i.set(u,w=new Map);for(let y of f)y==="id"||y==="kind"||(S?w.set(y,S):w.delete(y))}}return i},a=t.schema,l=new Map,s=(p,S)=>{let h=`${p}\0${S}`,u=l.get(h);if(u===void 0){let f=a.tryDefinition(p)?.fields?.shape;u=f!==void 0&&S in f&&Ae(f[S]).type==="text",l.set(h,u)}return u},b=p=>t.graph.getNode(p)?.kind;return{prose:s,say:p=>H(p,{graph:t.graph,schema:a}),fieldBy(p,S){let h=b(p);if(!(h===void 0||!s(h,S)))return o().get(p)?.get(S)},recordBy(p){let S=b(p),h=o().get(p);if(S===void 0||!h)return;let u;for(let[f,w]of h)s(S,f)&&(u=w);return u}}}var Y=(t,n,e)=>({untrusted:!0,authoredBy:e.say(n),text:t}),on="the host's ranker";function Le(t,n){return{...t,hits:t.hits.map(e=>{if(e.about!=="node")return e;e.why.by==="meaning"&&e.why.matched!==void 0&&(e={...e,why:{...e.why,matched:{untrusted:!0,authoredBy:on,text:e.why.matched}}});let r=n.recordBy(e.id);if(!r)return e;let i=n.prose(e.kind,e.why.field)?n.fieldBy(e.id,e.why.field):r;return{...e,label:Y(e.label,r,n),...e.apart!==void 0?{apart:Y(e.apart,r,n)}:{},why:i?{...e.why,fragment:Y(e.why.fragment,i,n)}:e.why}})}}var X=(t,n,e)=>({title:t,readOnlyHint:n,destructiveHint:!1,idempotentHint:e,openWorldHint:!1}),an={name:"subscribe",title:"Notify me when something happens",description:`Subscribe the person you act for to be told when something happens in this app \u2014 their host delivers it (an email, a push). on is one of: "act" (an act runs; give act, its declared name, and/or record), "created" (a record of kind is added), "changed" (a record of kind, or the one record, changes), "reaches" (a record of kind, or the one record, comes to satisfy condition, an expression in the app's rule language such as done == true or amount > 100). They are told only of changes someone else made, unless alsoMine is true, and only of records they may see. Returns the subscription and its sentence. Changes nothing in the app.`,inputSchema:{type:"object",properties:{on:{type:"string",enum:["act","created","changed","reaches"],description:"What to be told of."},act:{type:"string",description:"An act's declared name, for on: act."},kind:{type:"string",description:"A kind, for created, changed and reaches."},record:{type:"string",description:"One record, by id or name: for act, changed and reaches."},condition:{type:"string",description:"For reaches: what the record should come to satisfy, in the rule language (done == true)."},alsoMine:{type:"boolean",description:"Also when the person themselves made the change; false when unsaid."}},required:["on"],additionalProperties:!1},mutating:!1,annotations:X("Notify me when something happens",!1,!1)},sn={name:"unsubscribe",title:"Stop notifying me",description:"Take away one of the person's subscriptions, by the id list_subscriptions or subscribe answered. Changes nothing in the app.",inputSchema:{type:"object",properties:{id:{type:"string",description:"The subscription's id."}},required:["id"],additionalProperties:!1},mutating:!1,annotations:X("Stop notifying me",!1,!0)},dn={name:"list_subscriptions",title:"What I am notified of",description:`List what the person you act for is told of in this app: each subscription's id and its sentence ("When someone else adds a task").`,inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:X("What I am notified of",!0,!0)},Q=[an,sn,dn];var j=t=>{let n;return()=>n??=t().catch(e=>{throw n=void 0,e})},cn=j(()=>(__graviewPreload(import.meta.url,["./chunk.PW7YH6JV.js","./chunk.QU356VB2.js","./chunk.52QAIGCD.js","./chunk.PPUAPAWR.js","./chunk.IHFNLKXV.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.TPX6AVJL.js"))),ln=()=>(__graviewPreload(import.meta.url,["./chunk.HPD5ZDZH.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.Q7TP4RFE.js")).catch(()=>{}),un=async()=>{(await ln())?.judgeWithLines()},I=j(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.52QAIGCD.js","./chunk.PPUAPAWR.js","./chunk.IHFNLKXV.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.FSAHO3LV.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.6K2HASOH.js"))),fn=j(()=>(__graviewPreload(import.meta.url,["./chunk.VMGWYCXU.js","./chunk.G4JJXA63.js","./chunk.LAF6GTBN.js","./chunk.QU356VB2.js","./chunk.ZSW74NVJ.js","./chunk.ZE4CTZQ3.js","./chunk.Q5WEOX3Q.js","./chunk.DMNXYMLC.js","./chunk.2YGQVI6T.js","./chunk.HPD5ZDZH.js","./chunk.WVUJXDXZ.js","./chunk.52QAIGCD.js","./chunk.PPUAPAWR.js","./chunk.IHFNLKXV.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZFWV4JAJ.js"))),pn=j(()=>(__graviewPreload(import.meta.url,["./chunk.QVUL2FSI.js","./chunk.PW7YH6JV.js","./chunk.QU356VB2.js","./chunk.QVKKXMNK.js","./chunk.UT6642FC.js","./chunk.52QAIGCD.js","./chunk.PPUAPAWR.js","./chunk.IHFNLKXV.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.M5HADQPP.js"))),mn=j(()=>(__graviewPreload(import.meta.url,["./chunk.LIIC25G6.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.UHQD3NTK.js"))),hn=t=>t.definitions.some(n=>C(n).size>0),qe=t=>({value:B(t),label:t.label,...t.describe?{describe:t.describe}:{},...t.card?{card:t.card}:{},fields:t.fields,...t.app?{app:t.app}:{}});async function yn(t,n,e,r){let i=String(e.relation??""),[o,a]=i.includes(".")?i.split(".",2):[void 0,i],l=t.schema.definitions.flatMap(y=>[...C(y)].map(([d,c])=>({kind:y.kind,name:d,relation:c}))),s=l.filter(y=>y.name===a&&(o===void 0||y.kind===o));if(s.length!==1){let y=l.map(d=>`${d.kind}.${d.name}`).join(", ")||"none";return{ok:!1,error:`${s.length===0?`No relation to another app is called "${i}"`:`"${i}" names a relation of several kinds`}. The relations to other apps are: ${y}.`}}let{kind:b,name:p,relation:S}=s[0];if(!r)return{ok:!1,error:`This seat cannot read ${S.address}: its host reads no other app's records. Nothing was changed.`};let h={kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},u=typeof e.of=="string"?e.of:void 0;if(u!==void 0){let y=t.graph.getNode(u);if(!y||y.kind!==b)return{ok:!1,error:`No ${b} "${u}".`};let d=ce(y[p],S),c=await Promise.all(d.map(m=>Promise.resolve().then(()=>r.resolve(m,h)).catch(()=>null)));return{ok:!0,data:{relation:`${b}.${p}`,app:S.address,records:c.map((m,g)=>m===null?{value:B(d[g]),missing:!0}:"denied"in m?{denied:!0,said:"linked record (no access)"}:qe(m))},reads:[u]}}let f=typeof e.limit=="number"&&e.limit>0?Math.min(e.limit,20):20,w=await Promise.resolve().then(()=>r.find({address:S.address,kinds:S.kinds,query:String(e.query??""),limit:f},h)).catch(()=>[]);return Array.isArray(w)?{ok:!0,data:{relation:`${b}.${p}`,app:S.address,records:w.map(qe),link:`edit-${b} with ${p} set to a record's value`}}:{ok:!0,data:{relation:`${b}.${p}`,app:S.address,denied:!0,said:"linked record (no access)"}}}var R=t=>({title:t,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),Fe={description:'Which records: false (the default) the live ones, true only the archived ones, "all" both. An archived record is set aside, not gone: unarchive-<kind> brings it back.',anyOf:[{type:"boolean"},{type:"string",enum:["all"]}]},ee={type:"number",description:"Where the page starts; 0 when unsaid."},ie=[{name:"search_graph",title:"Find by name",description:"Find things by name: records whose name or readable fields carry the words, and the kinds, places and rules the words name \u2014 each with why it matched. Reach for this before get_graph when you know what something is called. Words match the start of words, case and accents aside; key:value tokens narrow as a list's filter does (done:false, is:any for past records, kind:<kind>). Pass subject (a node id) to get the acts you may run on it as hits too. When few records match exactly, records with a near word follow \u2014 a typo, another form of the word, a meaning \u2014 each with near: true and why.matched, the record's own word that answered.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Words, with optional key:value conditions."},limit:{type:"number",description:"Most hits to return; at most 20."},subject:{type:"string",description:"A node id whose acts to include."},archived:Fe},required:["query"],additionalProperties:!1},mutating:!1,annotations:R("Find by name")},{name:"get_graph",title:"Read the graph",description:"Read the graph, 25 nodes a page: their fields, the edges out of them, and how many more. Start here when you need the shape of the domain rather than one thing in it.",inputSchema:{type:"object",properties:{offset:ee,archived:Fe},additionalProperties:!1},mutating:!1,annotations:R("Read the graph")},{name:"get_node",title:"Read one node",description:"Read one node: its fields, its links (id, kind and label, 20 each way a page), the violations that implicate it, and its computed values: read-only fields worked out from what you can see, which no act sets. Use this to check a thing before you change it.",inputSchema:{type:"object",properties:{id:{type:"string",description:"A node's id, or its name."},offset:ee},required:["id"],additionalProperties:!1},mutating:!1,annotations:R("Read one node")},{name:"get_violations",title:"List the problems",description:"List the invariant violations the graph currently has, 20 a page, with the repairs that would resolve each one. Read this before proposing work: a rule that is already broken is more urgent than anything you could add.",inputSchema:{type:"object",properties:{offset:ee,context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:R("List the problems")},{name:"get_affordances",title:"Ask what can be done",description:"Ask what can legally be done with a selection, ranked. Prefer these over composing a mutation by hand: they are derived from the schema, the invariants and the shape of the graph, so they cannot name an action that does not exist.",inputSchema:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"Node ids."},context:{type:"object"}},required:["selection"],additionalProperties:!1},mutating:!1,annotations:R("Ask what can be done")},{name:"describe_place",title:"Say what a place shows",description:`Say what one place of the app shows you, as a person in your seat would see it: its headings, its figures as drawn, its lists with each record's title and what its card or row says, the headings a list is grouped under, what an empty list says, and any block that could not be worked out. Pass a place's slug ("home", a lens's address like "the-offers", a kind's like "offers") or a record's id, and width 390 for a phone. Use it after a change to check what somebody now sees, instead of guessing.`,inputSchema:{type:"object",properties:{place:{type:"string",description:`"home", a place's slug, or a record's id.`},width:{type:"number",description:"The screen's width in CSS pixels; 390 is a phone, 1440 when unsaid."}},required:["place"],additionalProperties:!1},mutating:!1,annotations:R("Say what a place shows")},{name:"preview_mutation",title:"Try an act without applying it",description:"Try a mutation without applying it: get back the diff it would produce and any invariant it would break. Do this when you are unsure, rather than applying and undoing.",inputSchema:{type:"object",properties:{mutation:{type:"string"},args:{type:"object"}},required:["mutation","args"],additionalProperties:!1},mutating:!1,annotations:R("Try an act without applying it")},{name:"undo_batch",title:"Undo a batch",description:"Undo one batch of operations. Fails, naming the blocking operation, when a later operation read what it wrote.",inputSchema:{type:"object",properties:{batch:{type:"string"},include:{type:"array",items:{type:"string"}}},required:["batch"],additionalProperties:!1},mutating:!0,annotations:{title:"Undo a batch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},{name:"list_suggestions",title:"List what is suggested",description:"List the suggestions waiting for a person: changes the app's own actor proposed and did not make, each with its id, what it would do, who suggested it, what it was based on and how sure (0 to 1). Nothing changes until one is accepted (accept_suggestion) or declined (decline_suggestion); a declined one is never suggested again.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:R("List what is suggested")},{name:"accept_suggestion",title:"Accept a suggestion",description:"Make a waiting suggestion's change, as this seat, carrying what it was based on. Returns the batch (undo_batch takes it back).",inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Accept a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1}},{name:"decline_suggestion",title:"Decline a suggestion",description:"Decline a waiting suggestion: nothing changes, the decline is kept in the log, and the same change is never suggested or made by the app's own actor again.",inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Decline a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}],Be={name:"act_on_several",title:"Do one act to several records",description:`Run one act on several records at once, as one change with one undo. act is the act (its tool name or its declared name), records the records it runs on (ids or names; each goes in the act's subject), args what every call shares ("Set stage to Declined" is args { stage: "declined" }). Each record is judged on its own: one this seat may not change is named with why, and the rest still apply. Returns the batch (undo_batch takes it all back), the records changed, those already so, and those refused.`,inputSchema:{type:"object",properties:{act:{type:"string",description:"The act to run on each record."},records:{type:"array",items:{type:"string"},minItems:1,maxItems:200,description:"Ids or names of the records."},args:{type:"object",description:"Arguments every call shares, besides the record."}},required:["act","records"],additionalProperties:!1},mutating:!0,annotations:{title:"Do one act to several records",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},re={type:"object",description:"A lens, as draft_view returns one.",properties:{title:{type:"string"},lens:{type:"string"},on:{type:"string"},bindings:{type:"object"},options:{type:"object"}},required:["title","lens","on"]},oe={name:"draft_view",title:"Draw a view",description:'Draw a view of the data from words ("a board of tasks by status", "who covers what") as a lens the app could keep; or check a lens you wrote (lens); or change the one on screen (current, with ask: "only this month"). Returns the lens and its add-lens edit, or one sentence saying why not. Writes nothing.',inputSchema:{type:"object",properties:{ask:{type:"string",description:"What to see, in words."},lens:re,current:re},additionalProperties:!1},mutating:!1,annotations:R("Draw a view")},Ce={name:"keep_lens",title:"Keep a view as a lens",description:"Keep a lens draft_view drew as one of the app's places: checked again, then written as the add-lens edit. Returns the remove-lens edit that takes it back.",inputSchema:{...re,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},Ue={name:"find_linked",title:"Find a record in another app",description:`A relation may go to a kind in another app (describe_app lists them under "Linked from other apps"). With relation and words, list the records there this seat may link \u2014 each with the value to link it by ("house:h1"), its name and its describe line. With of (a record id here), read the records that record links, as this seat may see them there. Linking one is the record's edit (edit-<kind>) with the relation set to the value. Another app this seat may not open answers denied, and nothing of it. Writes nothing; never changes the other app.`,inputSchema:{type:"object",properties:{relation:{type:"string",description:"The relation, by name (forHouse) or as <kind>.<relation> (scenario.forHouse)."},query:{type:"string",description:"Words to find by, in the other app's names; empty for the first few."},of:{type:"string",description:"A record here whose linked records to read, instead of finding."},limit:{type:"number",description:"Most records to return; at most 20."}},required:["relation"],additionalProperties:!1},mutating:!1,annotations:R("Find a record in another app")};function gn(t,n){return t===void 0?[]:t==="keep"&&!n?[oe,Ce]:[oe]}var bn="An argument that names a record takes its id or its name.",Ve=[...ie.map(t=>t.name),Be.name,oe.name,Ce.name,Ue.name,...Q.map(t=>t.name)],Ge=64;function _(t){let{line:n,...e}=t;return e}function We(t){return{...t,...t.introduces?{introduces:t.introduces.map(_)}:{},...t.resolves?{resolves:t.resolves.map(_)}:{},...t.violationsAfter?{violationsAfter:t.violationsAfter.map(_)}:{}}}function wn(t){let n=t.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return n.length===0&&(n="act"),/^[A-Za-z_]/.test(n)||(n=`act_${n}`),n.slice(0,Ge)}function Sn(t){let n=new Set(Ve),e=new Map;for(let r of t){let i=wn(r),o=i;for(let a=2;n.has(o);a+=1)o=`${i.slice(0,Ge-`_${a}`.length)}_${a}`;n.add(o),e.set(r,o)}return e}function kn(t,n){if(n.size===0)return t;let e=Object.fromEntries(Object.entries(t.properties??{}).filter(([i])=>!n.has(i))),r=(t.required??[]).filter(i=>!n.has(i));return{...t,properties:e,...t.required?{required:r}:{}}}function vn(t,n,e){let r=Z(t),i=W(t),o=r.nodeRefs.length>0?`${r.description}${/[.!?]$/.test(r.description)?"":"."} ${bn}`:r.description;return{name:n,title:i,description:o,inputSchema:kn(r.inputSchema,e),mutating:!0,annotations:{title:i,readOnlyHint:!1,destructiveHint:t.destructive===!0||(t.severs?.length??0)>0,idempotentHint:t.idempotent===!0,openWorldHint:!1},act:t.name}}function ae(t){if(t===null||typeof t!="object")return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(ae).join(",")}]`;let n=t;return`{${Object.keys(n).filter(e=>n[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${ae(n[e])}`).join(",")}}`}function An(t){return`sha256:${ke(ae(t))}`}function On(t,n,e,r,i,o=!1,a=!1){let l=Sn(t.map(p=>p.name)),s=[...gn(r,e),...o?[Ue]:[],...a?Q:[]];return{definitions:e?[...ie.filter(p=>!p.mutating),...s]:[...ie,Be,...s,...t.filter(p=>n.has(p.name)).map(p=>vn(p,l.get(p.name),i(p)))],names:l}}function st(t,n={}){let e=n.author??{kind:"agent"},r=t.allMutations(),i=new Set(t.permittedMutations(e).map(u=>u.name)),{definitions:o,names:a}=On(r,i,n.readOnly===!0,n.drafts?n.drafts.keep?"keep":"draw":void 0,u=>V(t.schema,t.policy,e,u),hn(t.schema),n.subscriptions!==void 0),l=An(o),s=u=>{if(!Ve.includes(u)){for(let[f,w]of a)if(w===u)return f;return a.has(u)?u:void 0}},b=(u,f)=>{let w=r.find(c=>c.name===u);if(!w)return{args:f,resolved:[]};let y={...f},d=[];for(let c of L(w.input)){let m=y[c.name];if(typeof m!="string"||m.trim()==="")continue;let g=t.resolveRef(c,m,e);if(!g.ok){let k=g.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${c.name}.`:" Nothing was changed.";return{ok:!1,error:`${g.message}${k}`,argument:c.name,candidates:g.candidates}}g.by!=="id"&&(y[c.name]=g.id,d.push({argument:c.name,given:m,id:g.id,label:g.label}))}return{args:y,resolved:d}},p=async(u,f)=>{try{await un();let w=o.find(d=>d.name===u)??o.find(d=>d.act===u);if(!w){let d=s(u);if(d){let c=t.permits({name:d,args:f},e);if(!c.ok)return{ok:!1,error:c.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${u}". Available: ${o.map(c=>c.name).join(", ")}`}}if(w.mutating&&n.readOnly)return{ok:!1,error:`"${u}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(w.act!==void 0){let d=b(w.act,f);if("ok"in d)return d;let c=P(t,e,t.apply({name:w.act,args:d.args},{...n.author?{author:n.author}:{},...ne(n.via)}));return{ok:!0,data:{batch:c.batch,intent:c.intent,introduces:c.introduces.map(_),resolves:c.resolves.map(_),...d.resolved.length>0?{resolved:d.resolved}:{}},diff:c.diff}}let y=t.seenBy(e);switch(w.name){case"search_graph":{let d=typeof n.places=="function"?n.places():n.places,c=typeof f.subject=="string"?f.subject:void 0,m=Te(y,String(f.query??""),{principal:e,rank:n.near,archived:he(f.archived),limit:typeof f.limit=="number"&&f.limit>0?Math.min(f.limit,20):20,...d?{places:d}:{},...c?{subject:c,from:[c]}:{}}),g=m.later?await m.later:m;return{ok:!0,data:(await I()).searchRead(g,Le(g,F(y,e))),reads:g.hits.flatMap(k=>k.about==="node"?[k.id]:[])}}case"get_graph":return{ok:!0,...(await I()).graphRead(y,F(y,e),f)};case"get_node":{let d=String(f.id??""),c=d,m;if(!y.graph.getNode(d)){let k=d.trim()===""?void 0:t.resolveRef({name:"id",kinds:["*"]},d,e);if(k?.ok)c=k.id,m={argument:"id",given:d,id:c,label:k.label};else return k?.reason==="ambiguous"?{ok:!1,error:k.message,argument:"id",candidates:k.candidates}:{ok:!1,error:`No node "${d}".`}}let g=(await I()).nodeRead(y,F(y,e),c,f);return{ok:!0,data:m?{...g.data,resolved:[m]}:g.data,reads:g.reads}}case"describe_place":{let d=n.app??{name:"",schema:t.schema},c=typeof f.width=="number"&&Number.isFinite(f.width)&&f.width>0?f.width:1440,{describePlace:m}=await cn(),g=m(t,e,String(f.place??""),{app:d,width:c});if(!g.ok)return{ok:!1,error:`${g.error} The places are: ${g.places.join(", ")}.`};let k=new Set,x=E=>{for(let M of E)for(let O of M.groups??[])for(let T of O.items)k.add(T.id),x(T.parts)};return x(g.description.parts),{ok:!0,data:g.description,reads:[...k]}}case"find_linked":return yn(y,e,f,n.linked);case"draft_view":case"keep_lens":{let d=n.app??{name:"",schema:t.schema};return(await fn()).runDraftTool(w.name,f,{app:d,principal:e,...n.drafts?{drafts:n.drafts}:{}})}case"get_violations":{let d=y.violations(f.context);return{ok:!0,...(await I()).violationsRead(d,f)}}case"get_affordances":{let d=f.selection??[];return{ok:!0,data:xe(y,d,{...typeof n.derive=="function"?n.derive():n.derive,...n.author?{principal:n.author}:{},...f.context?{context:f.context}:{}}),reads:d.filter(m=>y.graph.has(m))}}case"preview_mutation":{let d=String(f.mutation),c=s(d)??d,m=b(c,f.args??{});if("ok"in m)return m;let g=t.missingFor({name:c,args:m.args},e);if(g)return{ok:!1,error:g.message,reason:"missing"};let k=P(t,e,t.preview({name:c,args:m.args},void 0,{author:e})),x=We(k);return{ok:!0,data:m.resolved.length>0?{...x,resolved:m.resolved}:x}}case"act_on_several":{let d=String(f.act??""),c=s(d)??d,m=r.find(v=>v.name===c);if(!m||!i.has(c)){let v=m?t.permits({name:c,args:{}},e):void 0;return v&&!v.ok?{ok:!1,error:v.refusal.message,reason:"forbidden"}:{ok:!1,error:`There is no act "${d}" this seat may run. Nothing was changed.`,reason:"invalid"}}let g=m.subject;if(!g)return{ok:!1,error:`"${W(m)}" does not act on a record, so it cannot be run on several. Nothing was changed.`,reason:"invalid"};let k=Array.isArray(f.records)?f.records.filter(v=>typeof v=="string"&&v.trim()!==""):[];if(k.length===0)return{ok:!1,error:"Name at least one record. Nothing was changed.",reason:"invalid"};let x=[],E=[];for(let v of k.slice(0,200)){let N=t.resolveRef({name:g.arg,kinds:g.kinds},v,e);if(!N.ok)return{ok:!1,error:`${N.message} Nothing was changed.`,argument:"records",candidates:N.candidates};x.push(N.id),N.by!=="id"&&E.push({argument:"records",given:v,id:N.id,label:N.label})}let M=b(c,{...f.args??{}});if("ok"in M)return M;let O=(await pn()).actOnSeveral(t,{mutation:c,subject:g.arg,args:M.args},x,{author:e,...ne(n.via)}),T=O.result?P(t,e,O.result):void 0;return{ok:!0,data:{...O.batch?{batch:O.batch,intent:O.intent}:{},applied:O.applied,unchanged:O.unchanged,refused:O.refused.map(v=>({record:v.id,label:v.label,error:v.message,reason:v.reason})),...O.allOrNothing?{keptNone:!0}:{},...T?{introduces:T.introduces.map(_),resolves:T.resolves.map(_)}:{},...E.length>0||M.resolved.length>0?{resolved:[...E,...M.resolved]}:{}},...T?{diff:T.diff}:{}}}case"subscribe":case"unsubscribe":case"list_subscriptions":{let d=await(await mn()).runSubscriptionTool(w.name,f,{store:t,principal:n.subscriber??e,app:n.app?.name??"app",subscriptions:n.subscriptions});return d.ok?{ok:!0,data:d.data}:{ok:!1,error:d.error}}case"list_suggestions":{let d=Oe(t,e).map(c=>{let m=H(c.author,{graph:y.graph,schema:t.schema});return{id:c.id,intent:c.intent,by:m,at:c.at,about:c.about,...c.lineage?{basis:{untrusted:!0,authoredBy:m,text:c.lineage.basis},...c.lineage.confidence!==void 0?{confidence:c.lineage.confidence}:{}}:{}}});return{ok:!0,data:{suggestions:d},reads:[...new Set(d.flatMap(c=>c.about))]}}case"accept_suggestion":case"decline_suggestion":{let d=String(f.suggestion??""),c={author:e,...ne(n.via)},m=w.name==="accept_suggestion"?Re(t,d,c):_e(t,d,c),g=P(t,e,m);return{ok:!0,data:{batch:g.batch,intent:g.intent,introduces:g.introduces.map(_),resolves:g.resolves.map(_)},diff:g.diff}}case"undo_batch":{let d=String(f.batch),c=f.include??[],m=y.canUndo([d,...c]);if(!m.ok)return{ok:!1,error:m.message};let g=P(t,e,t.undo([d,...c],{...n.author?{author:n.author}:{}}));return{ok:!0,data:We(g),diff:g.diff}}default:return{ok:!1,error:`Unknown tool "${u}".`}}}catch(w){let{reason:y,wouldNeed:d}=ye(w);return{ok:!1,error:w instanceof Error?w.message:String(w),reason:y,...d?{wouldNeed:d}:{}}}},S=new Set,h=u=>{for(let f of S)f(u)};return{definitions:o,hash:l,...n.author?{author:n.author}:{},onDiff(u){return t.subscribe(u)},onCall(u){return S.add(u),()=>S.delete(u)},async call(u,f){let w=(o.find(m=>m.name===u)??o.find(m=>m.act===u))?.mutating??!1,y={name:u,args:f,mutating:w,at:new Date().toISOString()};h({...y,phase:"running"});let d=m=>(h(m.ok?{...y,phase:"ok",...!w&&m.reads?{reads:m.reads}:{}}:{...y,phase:"failed",error:m.error}),m),c=await p(u,f);return d(c.ok&&!w?{...c,data:(await I()).withinReadChars(u,c.data)}:c)}}}function ne(t){let n=typeof t=="function"?t():t;return n?{via:n}:{}}export{ae as a,st as b};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{s as P}from"./chunk.WLBXBNNH.js";import{F as M,N as w,Q as y,Y as m,Z as I,a as p,t as b,x as T,xa as S,y as A}from"./chunk.ZTD2CNC3.js";import{b as f}from"./chunk.AJZBJBMO.js";var x=f(M(),1),h=f(y(),1),C=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.PNVR3CXR.js","./chunk.ZTD2CNC3.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.LCFDM7XY.js")))),O=C.part((e,n)=>(0,h.jsx)(e.Timeline,{...n}),{what:"The timeline"}),q=()=>C.prefetch();function H({face:e}){return w()?.open?(0,h.jsx)(x.Suspense,{fallback:null,children:(0,h.jsx)(O,{face:e})}):null}var i=f(M(),1),u=f(y(),1),v=new WeakMap,E=e=>{let n=v.get(e);return n||v.set(e,n={ask:null,doors:[],listeners:new Set}),n},k=e=>{for(let n of e.listeners)n()};function g(e,n){let t=E(e);t.ask=n,k(t)}var N=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.LIIC25G6.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.PNVR3CXR.js","./chunk.ZTD2CNC3.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.RN3EZVV4.js")))),B=N.part((e,n)=>{let t=e.NotifySheet;return(0,u.jsx)(t,{...n})},{what:"Notify me"}),W=N.part((e,n)=>{let t=e.NotifiedList;return(0,u.jsx)(t,{...n})},{quiet:!0}),D=(e,n)=>n===void 0&&(e.onBehalfOf??e).id!==void 0;function L(e,n,t){let c=d=>t.tryDefinition(d)?.noun??d.replace(/[-_]+/g," "),o=e.on!==void 0?e.on:e.about.length===1?e.about[0]:void 0;if(e.act!==void 0){let d=o!==void 0&&n(o)!==void 0?o:void 0;return{label:"Notify me when someone does this\u2026",choices:[{on:"act",act:e.act,...d!==void 0?{record:d}:{}},...d!==void 0?[{on:"act",act:e.act}]:[]]}}if(o===void 0)return null;let s=n(o);if(s!==void 0)return{label:"Notify me when this changes\u2026",choices:[{on:"changed",record:o},{on:"act",record:o},{on:"reaches",kind:s,condition:"",record:o}]};let r=b(o)!==null?[b(o)]:T(o)?A(o):[];if(r.length!==1||!t.kinds.includes(r[0]))return null;let l=r[0],a=c(l);return{label:`Notify me when ${/^[aeiou]/i.test(a)?"an":"a"} ${a} is added\u2026`,choices:[{on:"created",kind:l},{on:"changed",kind:l},{on:"reaches",kind:l,condition:""}]}}function F(){let{store:e,principal:n,subscriptions:t,signIn:c}=m(),o=D(n,c);return(0,i.useMemo)(()=>o?s=>{let r=L(s,a=>e.graph.getNode(a)?.kind,e.schema);return r?{id:"notify",items:[{id:"notify-me",label:r.label,run:()=>g(t,{choices:r.choices,returnTo:s.element??null})}],prepare:()=>N.prefetch()}:null}:null,[o,e,t])}var z=[];function U({children:e}){let n=F(),t=(0,i.useMemo)(()=>n?[n]:z,[n]);return(0,u.jsx)(P,{sections:t,children:e})}function V(){let{subscriptions:e}=m(),n=(0,i.useId)(),t=E(e);(0,i.useEffect)(()=>(t.doors.push(n),k(t),()=>{t.doors.splice(t.doors.indexOf(n),1),k(t)}),[t,n]);let c=(0,i.useMemo)(()=>r=>(t.listeners.add(r),()=>void t.listeners.delete(r)),[t]),o=(0,i.useSyncExternalStore)(c,()=>t.ask,()=>null),s=(0,i.useSyncExternalStore)(c,()=>t.doors[0]===n,()=>!1);return!o||!s?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(B,{ask:o,close:()=>g(e,null)})})}function X({choices:e,label:n="Notify me",style:t,className:c,testId:o="notify-me"}){let{principal:s,subscriptions:r,signIn:l}=m();return D(s,l)?(0,u.jsx)("button",{type:"button","data-testid":o,className:c,onClick:a=>g(r,{choices:e,returnTo:a.currentTarget}),style:t,children:n}):null}function G(){let e=I(),n=e?.subscriptions,t=e?(e.principal.onBehalfOf??e.principal).id:void 0,[c,o]=(0,i.useState)(0);return(0,i.useEffect)(()=>{if(t===void 0||!n)return;let s=!0,r=()=>void Promise.resolve(n.list(t)).then(a=>s&&o(a.length),()=>s&&o(0));r();let l=n.onChange?.(r);return()=>{s=!1,l?.()}},[n,t]),c}function Y({style:e}){return G()===0?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(W,{...e?{style:e}:{}})})}export{q as a,H as b,F as c,U as d,V as e,X as f,G as g,Y as h};
@@ -0,0 +1 @@
1
+ import{l as O}from"./chunk.OJGHDWI6.js";import{e as C}from"./chunk.Z7ZCR4LN.js";import{F as x,Q as k,Y as b,Z as B,_ as W,d as I,ma as G,y as V}from"./chunk.ZTD2CNC3.js";import{Ab as N,B as D,ac as _,bc as L,hc as j,wb as F}from"./chunk.X7W27IRI.js";import{b as m}from"./chunk.AJZBJBMO.js";function H(n,e){let t=n.graph.getNode(e);if(!t)return[];let i=t.kind,a=n.schema.tryDefinition(i);if(!a)return[];let d=n.seenFor,u=d?j.keptFrom?.(n,d)?.(t):void 0,o=new Map;for(let r of n.allMutations()){let s=r.subject;if(!s||!(s.kinds==="*"||s.kinds.includes(i)))continue;let l=r.input.shape??{};for(let c of N(r,a)){if(u?.(c))continue;let w=c in l,M=[];for(let g of Object.keys(l)){if(g===s.arg||g===c||X(l[g]))continue;let v=F(r.input).find(S=>S.name===g);M.push({name:g,...v?{kinds:v.kinds}:{},...v?{candidates:v.kinds.includes("*")?n.graph.allNodes().map(S=>S.id):v.kinds.flatMap(S=>n.graph.nodesOfKind(S).map(J=>J.id))}:{},shape:C(r.input,g)})}let Q={field:c,mutation:r.name,title:r.title??r.name,shape:w?C(r.input,c):{type:"unknown"},takesValue:w,alternatives:[],open:M,call:g=>({name:r.name,args:w?{[s.arg]:e,[c]:g}:{[s.arg]:e}})};o.set(c,[...o.get(c)??[],Q])}}return[...o.values()].map(r=>{let s=[...r.filter(c=>c.takesValue),...r.filter(c=>!c.takesValue)],[f,...l]=s;return{...f,alternatives:l}})}function X(n){let e=D(n)?.type;return e==="optional"||e==="default"||e==="nullable"}var R=m(x(),1);function we(n){let{store:e,principal:t}=b(),i=W(),a=(0,R.useMemo)(()=>n===null?[]:H(e,n),[e,n,i]),d=(0,R.useCallback)((u,o,r={})=>{let s=u.call(o);e.apply({name:s.name,args:{...s.args,...r}},{author:t})},[e,t]);return{fields:a,commit:d}}var K=m(x(),1);function Qe(){let{brand:n}=b(),e=n?.kit;return(0,K.useMemo)(()=>_(e),[e])}function Je(n,e){let t=L(n,e),i={...t.color!==void 0?{color:t.color}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.width!==void 0?{width:t.width}:{},...t.cap!==void 0?{cap:t.cap}:{},...t.opacity!==void 0?{opacity:t.opacity}:{}};return{connector:t,style:O(e,{[e]:i})}}var $=m(x(),1);var h=m(k(),1);function Z(n){let e=n?.hint;return typeof e=="string"&&e.length>0?e:void 0}function ee(n){if(n instanceof Error&&n.message)return n.message;let e=String(n);return e==="[object Object]"?"The view threw without a message.":e}var U=class extends $.Component{static contextType=G;state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,e,t.componentStack),this.context?.(e,{module:"@graview/react"})}render(){let{error:e}=this.state;if(!e)return this.props.children;let t=Z(e);return(0,h.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,h.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,h.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,h.jsx)("span",{children:ee(e)}),t?(0,h.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:t}):null]})}};var y=m(x(),1);var q=m(k(),1),A=(0,y.createContext)([]);function tn({sections:n,children:e}){let t=(0,y.useContext)(A),i=(0,y.useMemo)(()=>[...t,...n.filter(a=>!t.includes(a))],[t,n]);return(0,q.jsx)(A.Provider,{value:i,children:e})}function z(){let n=(0,y.useContext)(A),e=B()?.menuSections;return(0,y.useMemo)(()=>e?[...n,...e.filter(t=>!n.includes(t))]:n,[n,e])}function rn(){let n=z();return(0,y.useCallback)(e=>{for(let t of n)try{t(e)?.prepare?.()}catch{}},[n])}function on(n){let e=z();if(n===null||e.length===0)return{start:[],end:[]};let t=e.flatMap(i=>{try{let a=i(n);return a&&((a.items?.length??0)>0||a.render)?[a]:[]}catch{return[]}});return{start:t.filter(i=>i.at==="start"),end:t.filter(i=>i.at!=="start")}}var ne=m(x(),1);function dn(){return b().activity}var P=(n,e)=>n.length*e*.58;var te=156,re=2,E=te-18,oe=7.1,ie=16;function ae(n,e){let t=0,i=E;for(let a of n.split(" ")){let d=e(a),u=i+e(" ")+d;if(u<=E)i=u;else{let o=Math.ceil(d/E)||1;t+=o,i=d-(o-1)*E}}return t}var se=16.25,Y=27,de=(n,e)=>{let t=Math.ceil(n.length*oe/E);return e?Math.max(Y,Math.ceil(Math.max(t,ae(n,e))*se)+6):Math.max(Y,t*ie+6)};function ln(n,e,t){return n.length===0?0:10+n.reduce((i,a)=>i+de(a,t),0)+(n.length-1)*re}var ce=27,ue=8,pn=4,le=64,fn=n=>Math.max(1,Math.min(ue,n)),mn=n=>n*ce+le;var p=m(x(),1);function xn(n,{units:e,target:t=0,legibleAt:i=260}){let[a,d]=(0,p.useState)(e);(0,p.useEffect)(()=>{let o=n.current;if(o===null||typeof ResizeObserver>"u")return;let r=new ResizeObserver(([s])=>{let f=s?.contentRect.width??0;f>0&&d(f)});return r.observe(o),()=>r.disconnect()},[n]);let u=a/e;return{scale:u,width:a,touchable:u*t>=24,legible:a>=i}}function bn(n="--graview-font-body",e="sans-serif"){let t=(0,p.useRef)(void 0),i=(0,p.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return e;let a=getComputedStyle(document.documentElement).getPropertyValue(n).trim();return a.length>0?a:e},[n,e]);return(0,p.useMemo)(()=>{t.current===void 0&&(t.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let a=t.current;return a===null?P:(d,u)=>{a.font=`${u}px ${i}`;let o=a.measureText(d).width;return o>0?o:P(d,u)}},[i])}var wn=(0,p.createContext)(void 0);var T=3;function pe(n){let e=I(n),t=e.focusId;if(!t)return null;if(e.within?.view){let[a]=V(t);if(a)return{at:`screen:${a}`,audience:!0}}return{at:t,audience:!1}}var fe=102,me=32;function En(n,e,t){let i=[],a=new Map,d=new Map,u=0;for(let o of n){let r=pe(o.stop),s=r?e(r.at):null;if(!r||!s){o.name&&i.push({kind:"edge",presence:o,point:{x:t-8,y:fe+u++*me}});continue}if(!o.name){let M=d.get(r.at);d.set(r.at,{n:(M?.n??0)+1,box:s});continue}let f=a.get(r.at)??[];if(f.push(o),a.set(r.at,f),f.length>T)continue;let l=s,c=f.length-1,w=r.audience?{x:l.x+l.width*.5+(c-1)*26,y:l.y+Math.min(l.height,24)}:{x:l.x+l.width*.5-26-c*26,y:l.y+l.height-4};i.push({kind:"person",presence:o,point:w,at:r.at,index:c,of:f.length,audience:r.audience})}for(let[o,r]of a){if(r.length<=T)continue;let s=e(o);s&&i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+2*26+18,y:s.y+s.height-4},n:r.length-T})}for(let[o,{n:r,box:s}]of d)i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+40,y:s.y+s.height-4},n:r});for(let o of n)if(o.name){if(o.robot?.at&&o.robot.mode!=="docked"){let r=e(o.robot.at);r&&i.push({kind:"robot",presence:o,point:{x:r.x+r.width/2+22,y:r.y+r.height-4},mode:o.robot.mode})}if(o.over){let r=e(o.over);r&&i.push({kind:"over",presence:o,box:r})}}return i}export{dn as a,P as b,te as c,re as d,Y as e,ln as f,ce as g,pn as h,le as i,fn as j,mn as k,xn as l,bn as m,we as n,Qe as o,Je as p,En as q,U as r,tn as s,rn as t,on as u};
@@ -0,0 +1 @@
1
+ import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p}from"./chunk.ETWVQ3A2.js";import{a,b}from"./chunk.CZRX2FDI.js";import"./chunk.5EAQDBBE.js";import"./chunk.YT2CYCVT.js";import"./chunk.Z7ZCR4LN.js";import"./chunk.RIW7SQH4.js";import"./chunk.FSAHO3LV.js";import"./chunk.PNVR3CXR.js";import"./chunk.ZTD2CNC3.js";import"./chunk.X7W27IRI.js";import"./chunk.AJZBJBMO.js";export{j as ARRANGE_NARROW,o as ArrangeBar,e as CHIP_FIELDS,d as MANY_AT_THE_FAR_END,c as TYPED_FROM,p as arrangementCaption,a as arrangementOf,i as chipOffers,m as directionWords,g as farCount,f as farCounts,l as inSentence,h as offeredFilters,n as preloadArrangeLists,k as sayCondition,b as withArrangement};
@@ -1,4 +1,4 @@
1
- import"./chunk.JOOQUWLT.js";import{Q as o,Y as n}from"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import{b as t}from"./chunk.AJZBJBMO.js";var a=t(o(),1),d=[["waiting","Waiting"],["active","Under way: darker and taller"],["done","Done: flat and pale"],["flagged","A problem, or past its due date"],["recent","Changed since you were last here"],["own","Yours"]],g=i=>{let e=r=>`color-mix(in oklab,var(--graview-ink) ${r}%,var(--graview-panel))`;return`.graview-map-key{display:grid;gap:4px;padding:2px 4px 8px;margin-bottom:6px;border-bottom:1px solid var(--graview-edge);font-size:.8125rem;color:var(--graview-ink-muted)}
1
+ import"./chunk.PNVR3CXR.js";import{Q as o,Y as n}from"./chunk.ZTD2CNC3.js";import"./chunk.X7W27IRI.js";import{b as t}from"./chunk.AJZBJBMO.js";var a=t(o(),1),d=[["waiting","Waiting"],["active","Under way: darker and taller"],["done","Done: flat and pale"],["flagged","A problem, or past its due date"],["recent","Changed since you were last here"],["own","Yours"]],g=i=>{let e=r=>`color-mix(in oklab,var(--graview-ink) ${r}%,var(--graview-panel))`;return`.graview-map-key{display:grid;gap:4px;padding:2px 4px 8px;margin-bottom:6px;border-bottom:1px solid var(--graview-edge);font-size:.8125rem;color:var(--graview-ink-muted)}
2
2
  .graview-map-key>div{display:flex;align-items:center;gap:8px}
3
3
  .graview-map-key>div:first-child{color:var(--graview-ink)}
4
4
  .graview-map-key i{flex:none;width:14px;height:10px;border-radius:2px;background:${e(i?34:42)}}