graview 0.1.64 → 0.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/chunk.2P34ML3O.js +111 -0
- package/dist/preview/{chunk.77JI5T4F.js → chunk.2PK335JQ.js} +1 -1
- package/dist/preview/{chunk.YEXFVDRA.js → chunk.2QQ37RCZ.js} +1 -1
- package/dist/preview/{chunk.YIZPW7IK.js → chunk.2TZSLREX.js} +2 -2
- package/dist/preview/chunk.2UW5CRHF.js +1 -0
- package/dist/preview/{chunk.X36BYTEG.js → chunk.2YMO7ZVX.js} +1 -1
- package/dist/preview/chunk.33ULA3CG.js +1 -0
- package/dist/preview/{chunk.WX23K7ZU.js → chunk.35E75QJ7.js} +1 -1
- package/dist/preview/chunk.3CJLAJXP.js +25 -0
- package/dist/preview/chunk.3IJSB5ET.js +1 -0
- package/dist/preview/{chunk.BVIJXL4J.js → chunk.3IZEZPJB.js} +1 -1
- package/dist/preview/chunk.3KO35VN4.js +1 -0
- package/dist/preview/{chunk.UDU545CL.js → chunk.3KUYB5ZT.js} +1 -1
- package/dist/preview/chunk.3RFAUIGT.js +1 -0
- package/dist/preview/{chunk.DN7UCBOA.js → chunk.3WP66LB5.js} +1 -1
- package/dist/preview/{chunk.VZAF3452.js → chunk.44ZHHPPJ.js} +2 -2
- package/dist/preview/chunk.4GJ7F4SP.js +35 -0
- package/dist/preview/{chunk.7ZG77OI3.js → chunk.4IJTPV5X.js} +1 -1
- package/dist/preview/{chunk.HPG6CNKM.js → chunk.4JFBLVXJ.js} +1 -1
- package/dist/preview/{chunk.P6FNJR6E.js → chunk.4O3C2LJF.js} +1 -1
- package/dist/preview/chunk.4PCVQEVI.js +1 -0
- package/dist/preview/{chunk.T4JP6BGP.js → chunk.5FQSYMAE.js} +1 -1
- package/dist/preview/chunk.5M34BJIQ.js +1 -0
- package/dist/preview/chunk.5NCLZ4NZ.js +1 -0
- package/dist/preview/{chunk.5B7NG6WH.js → chunk.5THLLSS4.js} +1 -1
- package/dist/preview/chunk.5YNLFOBJ.js +5 -0
- package/dist/preview/{chunk.2JEN2RCB.js → chunk.64FCAUAJ.js} +1 -1
- package/dist/preview/chunk.6RZHKQP3.js +1 -0
- package/dist/preview/chunk.6YDC6IDA.js +1 -0
- package/dist/preview/{chunk.F6BNFLQM.js → chunk.74B6KQF4.js} +1 -1
- package/dist/preview/chunk.77XQEDT5.js +1 -0
- package/dist/preview/chunk.7E4CSXBT.js +1 -0
- package/dist/preview/chunk.7HPQI5SY.js +1 -0
- package/dist/preview/{chunk.JOM6MFVE.js → chunk.7IGD2K4M.js} +1 -1
- package/dist/preview/{chunk.4U45EY5M.js → chunk.7Q43N5JS.js} +1 -1
- package/dist/preview/{chunk.B6JR7EQO.js → chunk.7VQ3C7F4.js} +1 -1
- package/dist/preview/{chunk.DMENNIHT.js → chunk.A4VA3DU5.js} +1 -1
- package/dist/preview/{chunk.2JDAUKSN.js → chunk.AB4RZSYW.js} +31 -23
- package/dist/preview/chunk.ABSY3UZF.js +1 -0
- package/dist/preview/chunk.ARHAD5IS.js +1 -0
- package/dist/preview/chunk.BOC2EOGB.js +9 -0
- package/dist/preview/chunk.BR6TINGU.js +1 -0
- package/dist/preview/{chunk.4DZOAB4D.js → chunk.BU5PVRX7.js} +1 -1
- package/dist/preview/{chunk.4VRX7FCO.js → chunk.BUQKRXI6.js} +1 -1
- package/dist/preview/{chunk.S7SHWDPR.js → chunk.C437FVD7.js} +1 -1
- package/dist/preview/{chunk.YMXWS4XN.js → chunk.CD6YWH6T.js} +1 -1
- package/dist/preview/chunk.CDEAAWPS.js +1 -0
- package/dist/preview/{chunk.NGRL3QOI.js → chunk.CGQ6KXVK.js} +1 -1
- package/dist/preview/{chunk.YSBTE3PX.js → chunk.CPYBJNHP.js} +1 -1
- package/dist/preview/{chunk.REXU6ARY.js → chunk.CS72MISN.js} +2 -2
- package/dist/preview/chunk.CXJJB3MK.js +1 -0
- package/dist/preview/{chunk.TYIBLD2D.js → chunk.CXLQPE4J.js} +1 -1
- package/dist/preview/{chunk.75JQCTR6.js → chunk.DA4RSHLW.js} +1 -1
- package/dist/preview/{chunk.K5YFUMRS.js → chunk.DICM56FT.js} +1 -1
- package/dist/preview/{chunk.JS2UZYGB.js → chunk.DJMSXXP4.js} +1 -1
- package/dist/preview/{chunk.AJEK3I5X.js → chunk.DJPNVXBQ.js} +1 -1
- package/dist/preview/chunk.DJVHKBEI.js +1 -0
- package/dist/preview/chunk.E5WJSTOV.js +1 -0
- package/dist/preview/{chunk.XIVELWAM.js → chunk.F2TWV4TX.js} +1 -1
- package/dist/preview/chunk.F5VEHAP2.js +1 -0
- package/dist/preview/{chunk.2DH42I7L.js → chunk.FDWRH5P2.js} +1 -1
- package/dist/preview/chunk.FEGSYSA7.js +1 -0
- package/dist/preview/{chunk.2VIS2NAT.js → chunk.FHHVW2WB.js} +1 -1
- package/dist/preview/chunk.FOSY7MZF.js +2 -0
- package/dist/preview/{chunk.P4TAX3HE.js → chunk.FXG5AJF6.js} +1 -1
- package/dist/preview/{chunk.UJNLT3L6.js → chunk.G3Q5IMM3.js} +1 -1
- package/dist/preview/{chunk.APUQIELA.js → chunk.GPCKOYSF.js} +1 -1
- package/dist/preview/{chunk.GH5UBSQI.js → chunk.HJS3LTSR.js} +1 -1
- package/dist/preview/chunk.HJUXC5GM.js +1 -0
- package/dist/preview/chunk.HNMSYQRA.js +1 -0
- package/dist/preview/chunk.HWLRKOI3.js +1 -0
- package/dist/preview/{chunk.77MLXWZV.js → chunk.IFBGYFS4.js} +1 -1
- package/dist/preview/chunk.IHUMKFYH.js +10 -0
- package/dist/preview/{chunk.PVDDSBRG.js → chunk.IJ3YDBWI.js} +1 -1
- package/dist/preview/{chunk.7VAHHEDX.js → chunk.IMKD6QQG.js} +1 -1
- package/dist/preview/{chunk.DUP2CGVH.js → chunk.INTJD5WG.js} +1 -1
- package/dist/preview/chunk.IQ54QTA5.js +1 -0
- package/dist/preview/{chunk.LTOQ22ZJ.js → chunk.IQC3GOXO.js} +1 -1
- package/dist/preview/{chunk.2VYGDY5Z.js → chunk.IR4OW67N.js} +1 -1
- package/dist/preview/{chunk.DJIF7IAQ.js → chunk.ISN2QTVL.js} +1 -1
- package/dist/preview/{chunk.IQGSEAQ2.js → chunk.J24YPQ5I.js} +4 -4
- package/dist/preview/chunk.J545NAMY.js +1 -0
- package/dist/preview/{chunk.TQ2G4AM4.js → chunk.J6KNEI5R.js} +1 -1
- package/dist/preview/chunk.K3JARAWU.js +1 -0
- package/dist/preview/{chunk.E4TXLT25.js → chunk.KHAVEYT7.js} +1 -1
- package/dist/preview/{chunk.D2XLECMP.js → chunk.KIQXTQDU.js} +1 -1
- package/dist/preview/chunk.KROR65KD.js +2 -0
- package/dist/preview/{chunk.KHXRJLLU.js → chunk.KV7GZBJ6.js} +1 -1
- package/dist/preview/{chunk.DLWFULWE.js → chunk.L6FGKJ5H.js} +1 -1
- package/dist/preview/chunk.L7NJLZWV.js +1 -0
- package/dist/preview/{chunk.JHUCKEJS.js → chunk.LGRQDILY.js} +1 -1
- package/dist/preview/{chunk.UDYFGYJP.js → chunk.LKK5YF2H.js} +1 -1
- package/dist/preview/chunk.LON75VHP.js +1 -0
- package/dist/preview/chunk.LQWVJQ5X.js +18 -0
- package/dist/preview/{chunk.XJWKIXPV.js → chunk.LVD3V77M.js} +1 -1
- package/dist/preview/{chunk.ITBG37WJ.js → chunk.LY5CY7GE.js} +1 -1
- package/dist/preview/{chunk.ATHLE33D.js → chunk.M5W2RHC6.js} +1 -1
- package/dist/preview/chunk.M6BTLH24.js +1 -0
- package/dist/preview/chunk.MAGKI4PD.js +1 -0
- package/dist/preview/chunk.MD36ZSM5.js +74 -0
- package/dist/preview/chunk.MFZJVHWP.js +1 -0
- package/dist/preview/{chunk.LDMBJC3B.js → chunk.MH46V556.js} +1 -1
- package/dist/preview/chunk.MHTA4HYB.js +19 -0
- package/dist/preview/chunk.N2FNHRI2.js +1 -0
- package/dist/preview/chunk.N2YM247R.js +1 -0
- package/dist/preview/chunk.N35SJWAM.js +1 -0
- package/dist/preview/chunk.NBVPWLRY.js +3 -0
- package/dist/preview/{chunk.2TCOLAL2.js → chunk.NKYYDFIX.js} +1 -1
- package/dist/preview/{chunk.WPQP54FM.js → chunk.NSO6RUKW.js} +1 -1
- package/dist/preview/{chunk.47N2G7A5.js → chunk.O2W5JTWA.js} +1 -1
- package/dist/preview/chunk.OHMHPTEW.js +1 -0
- package/dist/preview/{chunk.CJHYGRWV.js → chunk.P6TZGR3A.js} +1 -1
- package/dist/preview/{chunk.OXFDB5BB.js → chunk.PTQPS2FJ.js} +1 -1
- package/dist/preview/chunk.PV2I4UPH.js +1 -0
- package/dist/preview/chunk.QFQSSZN7.js +1 -0
- package/dist/preview/{chunk.WFCE7NLK.js → chunk.QO5RXOCS.js} +2 -2
- package/dist/preview/{chunk.2V7QTIAV.js → chunk.QSDBF7VL.js} +1 -1
- package/dist/preview/{chunk.Z26T5E76.js → chunk.R2TSTDS3.js} +1 -1
- package/dist/preview/{chunk.T4TRJDBF.js → chunk.RFVOXX3P.js} +1 -1
- package/dist/preview/chunk.RSS6OHXG.js +1 -0
- package/dist/preview/{chunk.ZA5TDCBC.js → chunk.S2DOVJRL.js} +1 -1
- package/dist/preview/chunk.S3EEY7T3.js +1 -0
- package/dist/preview/chunk.SBCAYTMT.js +1 -0
- package/dist/preview/chunk.SMTGRCMG.js +3 -0
- package/dist/preview/{chunk.7SRSE5IS.js → chunk.SOMRYDDH.js} +1 -1
- package/dist/preview/{chunk.7CLKGKSF.js → chunk.SPCAMQJE.js} +1 -1
- package/dist/preview/{chunk.OW3M4OBN.js → chunk.T3KNLP7C.js} +1 -1
- package/dist/preview/chunk.TBY5IR7C.js +1 -0
- package/dist/preview/chunk.TCZIZ2PU.js +1 -0
- package/dist/preview/{chunk.TMHVYI5R.js → chunk.TUCSUZNO.js} +1 -1
- package/dist/preview/{chunk.2G5WLG3Z.js → chunk.TY74U3EI.js} +1 -1
- package/dist/preview/chunk.U74PTRHJ.js +1 -0
- package/dist/preview/chunk.UAORKZLO.js +1 -0
- package/dist/preview/chunk.UDVTPI2W.js +1 -0
- package/dist/preview/{chunk.S6QZBWCJ.js → chunk.UETLP5KC.js} +1 -1
- package/dist/preview/{chunk.2E62YCMZ.js → chunk.UHI3X2YD.js} +1 -1
- package/dist/preview/chunk.UL62ELNR.js +1 -0
- package/dist/preview/chunk.VRYSZYAD.js +1 -0
- package/dist/preview/{chunk.G5BVZLCM.js → chunk.VUZFLDOX.js} +1 -1
- package/dist/preview/chunk.X2NGFOAF.js +1 -0
- package/dist/preview/chunk.XE762VL2.js +2 -0
- package/dist/preview/{chunk.TA2JTUNX.js → chunk.XSWR5LI4.js} +1 -1
- package/dist/preview/{chunk.HZPRMHSL.js → chunk.XTTESA7X.js} +1 -1
- package/dist/preview/chunk.Y2RZ5B4U.js +1 -0
- package/dist/preview/chunk.Y7QDQ3WF.js +1 -0
- package/dist/preview/{chunk.TUR2DA2M.js → chunk.YKMBXMZE.js} +1 -1
- package/dist/preview/chunk.Z34KASY7.js +1 -0
- package/dist/preview/{chunk.WHX47OJM.js → chunk.ZDUTEM3Z.js} +1 -1
- package/dist/preview/{chunk.DQAMVVE6.js → chunk.ZJFXM3LE.js} +1 -1
- package/dist/preview/{chunk.UN2IAA5R.js → chunk.ZMGKWMID.js} +1 -1
- package/dist/preview/{chunk.R5MLRKAO.js → chunk.ZMWAZACO.js} +1 -1
- package/dist/preview/chunk.ZT5YQSSP.js +21 -0
- package/dist/preview/{chunk.XCLW4GP7.js → chunk.ZTN7BS5O.js} +1 -1
- package/dist/preview/{chunk.4XCYZRZ3.js → chunk.ZYNC73DJ.js} +1 -1
- package/dist/preview/chunk.ZZM75ZTN.js +4 -0
- package/dist/preview/index.html +56 -56
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2D7K2IJQ.js +0 -4
- package/dist/preview/chunk.2HV5FF6O.js +0 -1
- package/dist/preview/chunk.37I45R6V.js +0 -35
- package/dist/preview/chunk.3FKKH2XU.js +0 -74
- package/dist/preview/chunk.3J7XLJP2.js +0 -1
- package/dist/preview/chunk.3OEODIHB.js +0 -1
- package/dist/preview/chunk.3RD4JHVG.js +0 -88
- package/dist/preview/chunk.3RUV4HE4.js +0 -1
- package/dist/preview/chunk.3SAESG6X.js +0 -1
- package/dist/preview/chunk.4HTB6TX2.js +0 -1
- package/dist/preview/chunk.4Q5PCMGZ.js +0 -18
- package/dist/preview/chunk.52MBXPEK.js +0 -1
- package/dist/preview/chunk.5AD2QHWH.js +0 -3
- package/dist/preview/chunk.5HJ2GTKZ.js +0 -1
- package/dist/preview/chunk.5IEZF433.js +0 -2
- package/dist/preview/chunk.5PPCK7QT.js +0 -1
- package/dist/preview/chunk.6NRWLCIZ.js +0 -5
- package/dist/preview/chunk.7AOEZJRM.js +0 -1
- package/dist/preview/chunk.7ZHH7WBN.js +0 -1
- package/dist/preview/chunk.APRWUIE3.js +0 -1
- package/dist/preview/chunk.B2YTHEX5.js +0 -1
- package/dist/preview/chunk.BN42H3C6.js +0 -1
- package/dist/preview/chunk.CC7P435K.js +0 -9
- package/dist/preview/chunk.CM65MCHA.js +0 -1
- package/dist/preview/chunk.DYRULRFX.js +0 -1
- package/dist/preview/chunk.FN34P4IS.js +0 -1
- package/dist/preview/chunk.FUPYIOXZ.js +0 -1
- package/dist/preview/chunk.FXRYMT3U.js +0 -1
- package/dist/preview/chunk.G7YLK4PX.js +0 -1
- package/dist/preview/chunk.GF62K25C.js +0 -1
- package/dist/preview/chunk.GFQPO3NC.js +0 -1
- package/dist/preview/chunk.GHHKRFPD.js +0 -1
- package/dist/preview/chunk.GP5DAA4P.js +0 -3
- package/dist/preview/chunk.HSJEOM3W.js +0 -1
- package/dist/preview/chunk.K2PXP5H6.js +0 -1
- package/dist/preview/chunk.K54ISAXN.js +0 -1
- package/dist/preview/chunk.KMIFSPGQ.js +0 -1
- package/dist/preview/chunk.L4V5VLSM.js +0 -1
- package/dist/preview/chunk.M5VHUIDB.js +0 -1
- package/dist/preview/chunk.N643PVQA.js +0 -1
- package/dist/preview/chunk.NRPBTV6O.js +0 -21
- package/dist/preview/chunk.O7HHNQK4.js +0 -2
- package/dist/preview/chunk.PR74PGLC.js +0 -1
- package/dist/preview/chunk.QROPDEJF.js +0 -1
- package/dist/preview/chunk.QRT6BZR6.js +0 -1
- package/dist/preview/chunk.RDA35HZB.js +0 -2
- package/dist/preview/chunk.SADHOSRC.js +0 -19
- package/dist/preview/chunk.SJHUC4TL.js +0 -1
- package/dist/preview/chunk.SL5FXE3R.js +0 -1
- package/dist/preview/chunk.TOLW64EO.js +0 -1
- package/dist/preview/chunk.TP3PZRHE.js +0 -1
- package/dist/preview/chunk.UD2GGG7L.js +0 -1
- package/dist/preview/chunk.VLX7YWVH.js +0 -25
- package/dist/preview/chunk.VT4YBFZL.js +0 -1
- package/dist/preview/chunk.WMARJ5E3.js +0 -1
- package/dist/preview/chunk.XEG7ZDRG.js +0 -1
- package/dist/preview/chunk.XQ5RTPEF.js +0 -1
- package/dist/preview/chunk.YLOGIJOH.js +0 -1
- package/dist/preview/chunk.Z4XGEV34.js +0 -1
- package/dist/preview/chunk.ZNDVJGTY.js +0 -1
- package/dist/preview/chunk.ZQGLPP7A.js +0 -1
- /package/dist/preview/{chunk.GZHZLJBF.js → chunk.MIE4TJRW.js} +0 -0
|
@@ -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{r as qe}from"./chunk.IMKD6QQG.js";import{d as Je,e as Ee,h as He,i as je,k as ze,l as Ie,m as Le}from"./chunk.UETLP5KC.js";import{a as We}from"./chunk.J6KNEI5R.js";import{e as X}from"./chunk.5M34BJIQ.js";import{a as j}from"./chunk.2QQ37RCZ.js";import{f as $e,g as Y,i as De}from"./chunk.FOSY7MZF.js";import{a as be}from"./chunk.S3EEY7T3.js";import{Fa as me,Ia as K,Ic as xe,Id as Ne,Jc as Pe,Ka as he,Kc as Me,Ma as ye,Na as Z,Nb as ve,O as pe,Ua as ge,Va as we,Vb as Ae,Wb as Oe,Ya as ke,_b as Re,a as fe,bc as _e,db as F,ec as C,hb as Se,ma as G,mc as Te}from"./chunk.J24YPQ5I.js";var E=(t,e,n)=>{(t[e]===void 0||n>t[e])&&(t[e]=n)},H=(t,e,n)=>{(t[e]===void 0||n<t[e])&&(t[e]=n)},Q=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},Fe=(t,e)=>{t.mime=t.mime?t.mime.filter(n=>e.includes(n)):[...e]},Ce=(t,e)=>{t.multipleOf??=[],t.multipleOf.includes(e)||t.multipleOf.push(e)},Be=(t,e)=>(t.patterns??=new Set).add(e),gt={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 z(t){let e={},{def:n,bag:o}=t._zod,i=t._zod.traits.has("$ZodCheck")?[t,...n.checks??[]]:n.checks??[];for(let r of i){let a=r._zod.def;switch(a.check){case"greater_than":E(e,a.inclusive?"minimum":"exclusiveMinimum",a.value);break;case"less_than":H(e,a.inclusive?"maximum":"exclusiveMaximum",a.value);break;case"multiple_of":Ce(e,a.value);break;case"number_format":{Q(e,a.format);let d=gt[a.format];d&&(E(e,"minimum",d[0]),H(e,"maximum",d[1]));break}case"bigint_format":Q(e,a.format);break;case"min_length":case"min_size":E(e,"minimum",a.minimum);break;case"max_length":case"max_size":H(e,"maximum",a.maximum);break;case"length_equals":E(e,"minimum",a.length),H(e,"maximum",a.length);break;case"size_equals":E(e,"minimum",a.size),H(e,"maximum",a.size);break;case"string_format":Q(e,a.format),a.pattern&&Be(e,a.pattern),(a.format==="base64"||a.format==="base64url")&&(e.contentEncoding=a.format),(a.local||a.precision===-1)&&(e.laxFormat=!0);break;case"mime_type":Fe(e,a.mime);break}}o.minimum!==void 0&&E(e,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&E(e,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&H(e,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&H(e,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Ce(e,o.multipleOf),o.format!==void 0&&(e.format??=o.format,o.format.includes("int")&&(e.isInt=!0)),o.mime&&Fe(e,o.mime);for(let r of o.patterns??[])Be(e,r);return e}var wt={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};function L(t){let e=t._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?L(e.out):e.type==="catch"?L(e.innerType):t._zod.optin}var kt=new Set(["promise","optional","nonoptional","nullable","readonly","default","prefault","catch"]);function T(t,e=new Set){if(e.has(t))return!1;e.add(t);let n=t._zod.def,o=n.type;return o==="transform"?!0:o==="array"?T(n.element,e):o==="set"?T(n.valueType,e):o==="lazy"?T(n.getter(),e):kt.has(o)?T(n.innerType,e):o==="intersection"?T(n.left,e)||T(n.right,e):o==="record"||o==="map"?T(n.keyType,e)||T(n.valueType,e):o==="pipe"?t._zod.traits.has("$ZodCodec")||T(n.in,e)||T(n.out,e):o==="object"?Object.values(n.shape).some(i=>T(i,e)):o==="union"?n.options.some(i=>T(i,e)):o==="tuple"?n.items.some(i=>T(i,e))||(n.rest?T(n.rest,e):!1):!1}function bt(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n])=>e.indexOf(+n)===-1).map(([,n])=>n)}function Ge(t){let e=t.anyOf;if(!Array.isArray(e)||e.length===0||t.type!==void 0)return;let n=[];for(let o of e){if(!o||typeof o!="object")return;Ge(o);let i=Object.keys(o);if(i.length!==1||i[0]!=="type")return;for(let r of[o.type].flat()){if(typeof r!="string")return;n.includes(r)||n.push(r)}}delete t.anyOf,t.type=n.length===1?n[0]:n}var Ke=new Set(["type","properties","required","additionalProperties"]),Ue=t=>{let e=t.additionalProperties;return e&&typeof e=="object"&&Object.keys(e).length?e:null},Ve=(t,e)=>JSON.stringify(t)===JSON.stringify(e);function ee(t){for(let i of t){if(typeof i!="object"||i.type!=="object")return null;for(let r in i)if(!Ke.has(r))return null}let e={},n=new Set;for(let i of t){for(let r in i.properties){if(Object.prototype.hasOwnProperty.call(e,r))continue;let a=[];for(let d of t){let s=d.properties?.[r]??Ue(d);s&&!a.some(g=>Ve(g,s))&&a.push(s)}e[r]=a.length===1?a[0]:ee(a)??{allOf:a}}for(let r of i.required??[])n.add(r)}let o={type:"object",properties:e};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let r of t){let a=Ue(r);a&&!i.some(d=>Ve(d,a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function St(t){let e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(let i of Ke)if(i in t)return;let n=e.filter(i=>Array.isArray(i.oneOf)||Array.isArray(i.anyOf)),o;if(!n.length)o=ee(e);else{let i=n[0],r=Array.isArray(i.oneOf)?"oneOf":"anyOf";if(Object.keys(i).length!==1)return;let a=e.filter(s=>s!==i),d=i[r].map(s=>ee([...a,s]));if(d.some(s=>!s))return;o={[r]:d}}o&&(delete t.allOf,Object.assign(t,o))}function Ze(t){let e=t;for(let k of["anyOf","oneOf"]){let R=e[k];if(!Array.isArray(R))continue;let v=R.map(Ze);v.some((A,m)=>A!==R[m])&&(e={...e,[k]:v})}let n=[e.type].flat(),o=!n.includes("string")&&n.some(k=>k==="number"||k==="integer"),i=e.enum??(e.const!==void 0?[e.const]:void 0);if(!o&&!i?.some(k=>typeof k=="number"))return e;let{minimum:r,maximum:a,exclusiveMinimum:d,exclusiveMaximum:s,multipleOf:g,format:p,id:w,...h}=e;return h.enum?h.enum=h.enum.map(k=>typeof k=="number"?String(k):k):typeof h.const=="number"&&(h.const=String(h.const)),o&&(h.type="string",i||(h.pattern=n.includes("number")?"^-?\\d+(?:\\.\\d+)?$":"^-?\\d+$")),h}var B=class{constructor(e,n){this.override=e;this.refs=n}done=new Map;path=[];cyclic=new Map;write(e,n=!1){let o=this.refs.get(e);if(o!==void 0&&!n)return{$ref:o};if(this.path.includes(e))return this.cyclic.has(e)||this.cyclic.set(e,""),{};let i=this.done.get(e);if(i)return i;this.path.push(e);try{let r=this.written(e);return this.done.set(e,r),r}finally{this.path.pop()}}written(e){let n={},o,i=e._zod.toJSONSchema?.();i?Object.assign(n,i):o=this.process(e,n);let r=fe.get(e);if(r)for(let d of Object.keys(r))n[d]=r[d];T(e)&&(delete n.examples,delete n.default),"_prefault"in n&&(n.default??=n._prefault,delete n._prefault);let a=n;if(o){let d=this.write(o);a={...n};for(let s of Object.keys(d))s in n||(a[s]=d[s])}return this.override({zodSchema:e,jsonSchema:a}),Ge(a),e._zod.def.type==="intersection"&&St(a),a}process(e,n){let o=e._zod.def;switch(o.type){case"string":{n.type="string";let{minimum:i,maximum:r,format:a,patterns:d,contentEncoding:s,laxFormat:g}=z(e);if(typeof i=="number"&&(n.minLength=i),typeof r=="number"&&(n.maxLength=r),a&&(n.format=wt[a]??a,(n.format===""||a==="time"||g)&&delete n.format),s&&(n.contentEncoding=s),d&&d.size>0){let p=[...d];p.length===1?n.pattern=p[0].source:n.allOf=p.map(w=>({pattern:w.source}))}return}case"number":{let{minimum:i,maximum:r,multipleOf:a,exclusiveMinimum:d,exclusiveMaximum:s,isInt:g}=z(e);if(n.type=g?"integer":"number",typeof d=="number"&&d>=(i??Number.NEGATIVE_INFINITY)?n.exclusiveMinimum=d:typeof i=="number"&&(n.minimum=i),typeof s=="number"&&s<=(r??Number.POSITIVE_INFINITY)?n.exclusiveMaximum=s:typeof r=="number"&&(n.maximum=r),a){let[p,...w]=new Set(a.filter(h=>Number.isFinite(h)&&h!==0).map(Math.abs));p!==void 0&&(n.multipleOf=p),w.length&&(n.allOf=[...n.allOf??[],...w.map(h=>({multipleOf:h}))])}return}case"boolean":case"success":n.type="boolean";return;case"null":n.type="null";return;case"never":n.not={};return;case"enum":{let i=bt(o.entries);i.length===0?n.not={}:(i.every(r=>typeof r=="number")&&(n.type="number"),i.every(r=>typeof r=="string")&&(n.type="string"),n.enum=i);return}case"literal":{let i=o.values.filter(r=>r!==void 0).map(r=>typeof r=="bigint"?Number(r):r);if(o.values.length===0)n.not={};else if(i.length===1)n.type=i[0]===null?"null":typeof i[0],n.const=i[0];else if(i.length>1){for(let r of["number","string","boolean"])i.every(a=>typeof a===r)&&(n.type=r);i.every(r=>r===null)&&(n.type="null"),n.enum=i}return}case"template_literal":n.type="string",n.pattern=e._zod.pattern.source;return;case"file":{n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:i,maximum:r,mime:a}=z(e);i!==void 0&&(n.minLength=i),r!==void 0&&(n.maxLength=r),a&&(a.length===0?n.not={}:a.length===1?n.contentMediaType=a[0]:n.anyOf=a.map(d=>({contentMediaType:d})));return}case"array":{let{minimum:i,maximum:r}=z(e);typeof i=="number"&&(n.minItems=i),typeof r=="number"&&(n.maxItems=r),n.type="array",n.items=this.write(o.element);return}case"object":{let i=o.shape;n.type="object";let r={};n.properties=r;for(let d in i)Object.defineProperty(r,d,{value:this.write(i[d]),writable:!0,enumerable:!0,configurable:!0});let a=Object.keys(i).filter(d=>L(i[d])===void 0);a.length>0&&(n.required=a),o.catchall?._zod.def.type==="never"?n.additionalProperties=!1:o.catchall&&(n.additionalProperties=this.write(o.catchall));return}case"union":n[o.inclusive===!1?"oneOf":"anyOf"]=o.options.map(i=>this.write(i));return;case"intersection":{let i=d=>"allOf"in d&&Object.keys(d).length===1,r=this.write(o.left),a=this.write(o.right);n.allOf=[...i(r)?r.allOf:[r],...i(a)?a.allOf:[a]];return}case"tuple":{let i=o.items;n.type="array",n.prefixItems=i.map(s=>this.write(s)),o.rest?n.items=this.write(o.rest):n.items=!1;let r=i.length;for(;r>0&&L(i[r-1])!==void 0;)r-=1;r>0&&(n.minItems=r),o.rest||(n.maxItems=i.length);let{minimum:a,maximum:d}=z(e);typeof a=="number"&&(n.minItems=a),typeof d=="number"&&(n.maxItems=d);return}case"record":{let i=o.keyType;n.type="object";let r=z(i).patterns;if(o.mode==="loose"&&r&&r.size>0){let d=this.write(o.valueType),s={};for(let g of r)s[g.source]=d;n.patternProperties=s}else n.propertyNames=Ze(this.write(i)),n.additionalProperties=this.write(o.valueType);let a=i._zod.values;if(a&&!o.partial&&L(o.valueType)===void 0){let d=[...a].filter(s=>typeof s=="string"||typeof s=="number");d.length>0&&(n.required=d.map(String))}return}case"nullable":n.anyOf=[this.write(o.innerType),{type:"null"}];return;case"default":case"prefault":{let i=o.defaultValue,r,a=!1,d=JSON.stringify(i,(s,g)=>typeof g=="bigint"?(a=!0,null):g);return!a&&d!==void 0&&(r=JSON.parse(d)),a||(n[o.type==="default"?"default":"_prefault"]=r),o.innerType}case"catch":{try{n.default=o.catchValue(void 0)}catch{}return o.innerType}case"readonly":return n.readOnly=!0,o.innerType;case"pipe":return o.in._zod.traits.has("$ZodTransform")?o.out:o.in;case"lazy":return e._zod.innerType;case"optional":case"nonoptional":case"promise":return o.innerType;default:return}}};function Ye(t,e=()=>{}){let n=t,o=new B(e,new Map),i=o.write(n,!0);if(o.cyclic.size>0){let r=new Map,a=0,d=[];for(let g of o.cyclic.keys())if(g===n)r.set(g,"#");else{let p=`__schema${a++}`;r.set(g,`#/$defs/${p}`),d.push([g,p])}o=new B(e,r),i=o.write(n,!0);let s={};for(let[g,p]of d)s[p]=o.write(g,!0);d.length>0&&(i={...i,$defs:s})}return JSON.parse(JSON.stringify({$schema:"https://json-schema.org/draft/2020-12/schema",...i}))}function Xe(t){return Ye(t,Ot)}var vt={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"},At={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 Ot(t){me(t.zodSchema)&&(t.jsonSchema["x-graview-app-link"]=!0);let e=ye(t.zodSchema);if(e&&(t.jsonSchema.type==="string"||t.jsonSchema.type==="array")){t.jsonSchema["x-graview-linked"]={address:e.address,kinds:[...e.kinds],cardinality:e.cardinality};let s=e.kinds.join(" or "),g=`${e.cardinality==="many"?"Records":"A record"}: a ${s} in the app ${e.address}, as "${e.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(g)||(t.jsonSchema.description=`${typeof p=="string"&&p?`${p.replace(/\.?$/,".")} `:""}${g}`)}if(ke(t.zodSchema)&&(t.jsonSchema["x-graview-repeat"]=!0,!t.jsonSchema.type&&!t.jsonSchema.anyOf&&!t.jsonSchema.oneOf&&Object.assign(t.jsonSchema,Rt())),be(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 n=_e(t.zodSchema);if(n){let s=t.jsonSchema;s["x-graview-type"]=n,n==="duration"&&(s["x-graview-unit"]="minutes"),s.description??=At[n]}let o=Re(t.zodSchema,!1);if(o){let s=$e(o);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 g=t.jsonSchema.description;t.jsonSchema.description=typeof g=="string"&&g.length>0?`${g} ${Y(s)}`:Y(s)}let i=t.zodSchema._zod?.def;if(!i||i.type!=="string"||typeof i.format!="string"||i.format==="regex")return;let r=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 r.pattern;let d=r.allOf;Array.isArray(d)&&d.every(s=>typeof s=="object"&&s!==null&&Object.keys(s).length===1&&"pattern"in s)&&delete r.allOf,r.format=vt[i.format]??i.format,a.length===1?r.pattern=a[0]:a.length>1&&(r.allOf=a.map(s=>({pattern:s})))}function te(t,e){let n=C(t.input),o=Xe(t.input);if(e&&o.properties){let r=a=>e.includes(a)?e.indexOf(a):e.length;o.properties=Object.fromEntries(Object.entries(o.properties).sort(([a],[d])=>r(a)-r(d)))}let i=o.properties??{};if(Ae(t)){let r=t.creates.join(" | ");i.id={type:"string",minLength:1,description:`Optional: the id for the ${r} this makes, beginning with its kind (${t.creates.map(a=>`"${a}:"`).join(" or ")}). Refused if the graph already has it; left out, one is minted from the label.`},o.properties=i}Oe(t)&&(o.additionalProperties=!1);for(let r of n){let a=i[r.name];if(!a)continue;let d=r.kinds.includes("*")?"any node kind":r.kinds.join(" | ");a.description=[a.description,`Id of a node (${d}).`].filter(Boolean).join(" ")}return{name:t.name,...t.title===void 0?{}:{title:t.title},description:t.description??t.title??t.name,inputSchema:o,nodeRefs:n}}function Rt(){let t={type:"string",pattern:"^\\d{4}-\\d{2}-\\d{2}$"},e=(n,o)=>({type:"integer",minimum:n,maximum:o});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:[...we]},interval:e(1,99),on:{type:"array",minItems:1,maxItems:31,items:{anyOf:[{type:"string",enum:[...ge]},e(-1,31)]}},until:t,count:e(1,1e3),except:{type:"array",maxItems:500,items:t},continues:{type:"string",maxLength:200}},required:["every"],additionalProperties:!1}}function Qe(t){let e=new Set;for(let n=t;n;n=n.onBehalfOf)n.id!==void 0&&e.add(`${n.kind}:${n.id}`);return e}function U(t,e){let n=Qe(e),o=p=>{if(p.kind==="rule")return!1;let w=Qe(p);if(w.size===0)return!1;for(let h of w)if(n.has(h))return!1;return!0},i,r=()=>{if(i)return i;i=new Map;for(let p of t.log.live()){if(p.undoes!==void 0)continue;let w=o(p.author)?p.author:void 0;for(let h of p.primitives){h.op==="remove-node"&&i.delete(h.node.id);let k=h.op==="add-node"?h.node.id:h.op==="patch-node"||h.op==="splice-text"?h.id:void 0;if(k===void 0)continue;let R=h.op==="add-node"?Object.keys(h.node):h.op==="splice-text"?[h.field]:Object.keys(h.after),v=i.get(k);(h.op==="add-node"||!v)&&i.set(k,v=new Map);for(let A of R)A==="id"||A==="kind"||(w?v.set(A,w):v.delete(A))}}return i},a=t.schema,d=new Map,s=(p,w)=>{let h=`${p}\0${w}`,k=d.get(h);if(k===void 0){let R=a.tryDefinition(p)?.fields?.shape;k=R!==void 0&&w in R&&De(R[w]).type==="text",d.set(h,k)}return k},g=p=>t.graph.getNode(p)?.kind;return{prose:s,say:p=>F(p,{graph:t.graph,schema:a}),fieldBy(p,w){let h=g(p);if(!(h===void 0||!s(h,w)))return r().get(p)?.get(w)},recordBy(p){let w=g(p),h=r().get(p);if(w===void 0||!h)return;let k;for(let[R,v]of h)s(w,R)&&(k=v);return k}}}var ne=(t,e,n)=>({untrusted:!0,authoredBy:n.say(e),text:t}),_t="the host's ranker";function et(t,e){return{...t,hits:t.hits.map(n=>{if(n.about!=="node")return n;n.why.by==="meaning"&&n.why.matched!==void 0&&(n={...n,why:{...n.why,matched:{untrusted:!0,authoredBy:_t,text:n.why.matched}}});let o=e.recordBy(n.id);if(!o)return n;let i=e.prose(n.kind,n.why.field)?e.fieldBy(n.id,n.why.field):o;return{...n,label:ne(n.label,o,e),...n.apart!==void 0?{apart:ne(n.apart,o,e)}:{},why:i?{...n.why,fragment:ne(n.why.fragment,i,e)}:n.why}})}}var ie=(t,e,n)=>({title:t,readOnlyHint:e,destructiveHint:!1,idempotentHint:n,openWorldHint:!1}),Tt={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:ie("Notify me when something happens",!1,!1)},xt={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:ie("Stop notifying me",!1,!0)},Pt={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:ie("What I am notified of",!0,!0)},oe=[Tt,xt,Pt];var it=t=>({type:"string",enum:[...t],description:"The workflow, by its name."}),tt=t=>({name:"run_workflow",title:"Run a workflow now",description:"Run one of the app's workflows now, by hand, as the app's own actor: its steps make, change, set aside or suggest what they say, as its approve setting says. With dryRun: true nothing is kept and the answer says what it would do. The first run after a workflow is added or changed is a dry run whatever you ask; run it again to keep it. A paused workflow only dry-runs. Returns the run: its outcome, what it made, changed, archived and suggested, what it held back and why.",inputSchema:{type:"object",properties:{name:it(t),dryRun:{type:"boolean",description:"Keep nothing; say what it would do. False when unsaid."}},required:["name"],additionalProperties:!1},mutating:!0,annotations:{title:"Run a workflow now",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1}}),nt=(t,e)=>({name:t?"pause_workflow":"resume_workflow",title:t?"Pause a workflow":"Resume a workflow",description:t?"Pause one of the app's workflows: it runs on no schedule and no change until it is resumed, and run_workflow only dry-runs it. Changes the app's declaration, not its records. Returns the edit that takes it back.":"Resume a paused workflow: it runs again on its schedule and the changes it waits for. Changes the app's declaration, not its records. Returns the edit that takes it back.",inputSchema:{type:"object",properties:{name:it(e)},required:["name"],additionalProperties:!1},mutating:!0,annotations:{title:t?"Pause a workflow":"Resume a workflow",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}),ot=["run_workflow","pause_workflow","resume_workflow"];function rt(t,e){return e===void 0||t.length===0?[]:e==="manage"?[tt(t),nt(!0,t),nt(!1,t)]:[tt(t)]}function Mt(t){return{run:t.id,workflow:t.workflow,outcome:t.outcome,dry:t.dry,made:t.made,changed:t.changed,archived:t.archived,suggested:t.suggested,heldBack:t.heldBack,notes:t.notes}}async function at(t,e,n){let o=n.workflows.declared(),i=o.map(w=>w.name),r=String(e.name??"");if(!i.includes(r))return{ok:!1,error:`No workflow is called "${r}". The app's workflows are: ${i.join(", ")||"none"}. Nothing was changed.`,reason:"invalid"};if(t==="run_workflow"){let w=await n.workflows.run(r,{dryRun:e.dryRun===!0,...n.principal.id!==void 0?{who:n.principal.id}:{}});return{ok:!0,data:Mt(w)}}let a=n.workflows.edit;if(!a)return{ok:!1,error:"This seat's host does not write the app's declaration, so it cannot pause or resume a workflow. Nothing was changed.",reason:"forbidden"};let d=t==="pause_workflow",s=o.find(w=>w.name===r),g=s.status;if(g==="paused"===d)return{ok:!0,data:{workflow:r,status:g,said:`\u201C${s.title}\u201D is already ${g}. Nothing was changed.`}};let p=await a({op:d?"pause-workflow":"resume-workflow",name:r});return p.ok?{ok:!0,data:{workflow:r,status:d?"paused":"active",...p.said?{said:p.said}:{},undo:{op:d?"resume-workflow":"pause-workflow",name:r}}}:{ok:!1,error:p.error}}var q=t=>{let e;return()=>e??=t().catch(n=>{throw e=void 0,n})},Nt=q(()=>(__graviewPreload(import.meta.url,["./chunk.ISN2QTVL.js","./chunk.XTTESA7X.js","./chunk.5M34BJIQ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BR6TINGU.js"))),$t=()=>(__graviewPreload(import.meta.url,["./chunk.2QQ37RCZ.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KHAVEYT7.js")).catch(()=>{}),Dt=async()=>{(await $t())?.judgeWithLines()},W=q(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.3RFAUIGT.js"))),Jt=q(()=>(__graviewPreload(import.meta.url,["./chunk.CS72MISN.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.XSWR5LI4.js","./chunk.BIDL7GQD.js","./chunk.XTTESA7X.js","./chunk.MH46V556.js","./chunk.XOZU4OFA.js","./chunk.5M34BJIQ.js","./chunk.Q5WEOX3Q.js","./chunk.UHI3X2YD.js","./chunk.INTJD5WG.js","./chunk.2QQ37RCZ.js","./chunk.WVUJXDXZ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VRYSZYAD.js"))),Et=q(()=>(__graviewPreload(import.meta.url,["./chunk.7VQ3C7F4.js","./chunk.ISN2QTVL.js","./chunk.XTTESA7X.js","./chunk.J6KNEI5R.js","./chunk.2YMO7ZVX.js","./chunk.5M34BJIQ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.3KO35VN4.js"))),Ht=q(()=>(__graviewPreload(import.meta.url,["./chunk.5THLLSS4.js","./chunk.LKK5YF2H.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.C437FVD7.js"))),jt=t=>t.definitions.some(e=>Z(e).size>0),st=t=>({value:K(t),label:t.label,...t.describe?{describe:t.describe}:{},...t.card?{card:t.card}:{},fields:t.fields,...t.app?{app:t.app}:{}});async function zt(t,e,n,o){let i=String(n.relation??""),[r,a]=i.includes(".")?i.split(".",2):[void 0,i],d=t.schema.definitions.flatMap(A=>[...Z(A)].map(([m,u])=>({kind:A.kind,name:m,relation:u}))),s=d.filter(A=>A.name===a&&(r===void 0||A.kind===r));if(s.length!==1){let A=d.map(m=>`${m.kind}.${m.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: ${A}.`}}let{kind:g,name:p,relation:w}=s[0];if(!o)return{ok:!1,error:`This seat cannot read ${w.address}: its host reads no other app's records. Nothing was changed.`};let h={kind:e.kind,...e.id===void 0?{}:{id:e.id},...e.roles?{roles:e.roles}:{},...e.onBehalfOf?{onBehalfOf:e.onBehalfOf}:{}},k=typeof n.of=="string"?n.of:void 0;if(k!==void 0){let A=t.graph.getNode(k);if(!A||A.kind!==g)return{ok:!1,error:`No ${g} "${k}".`};let m=he(A[p],w),u=await Promise.all(m.map(b=>Promise.resolve().then(()=>o.resolve(b,h)).catch(()=>null)));return{ok:!0,data:{relation:`${g}.${p}`,app:w.address,records:u.map((b,S)=>b===null?{value:K(m[S]),missing:!0}:"denied"in b?{denied:!0,said:"linked record (no access)"}:st(b))},reads:[k]}}let R=typeof n.limit=="number"&&n.limit>0?Math.min(n.limit,20):20,v=await Promise.resolve().then(()=>o.find({address:w.address,kinds:w.kinds,query:String(n.query??""),limit:R},h)).catch(()=>[]);return Array.isArray(v)?{ok:!0,data:{relation:`${g}.${p}`,app:w.address,records:v.map(st),link:`edit-${g} with ${p} set to a record's value`}}:{ok:!0,data:{relation:`${g}.${p}`,app:w.address,denied:!0,said:"linked record (no access)"}}}var M=t=>({title:t,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),dt={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"]}]},re={type:"number",description:"Where the page starts; 0 when unsaid."},se=[{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:dt},required:["query"],additionalProperties:!1},mutating:!1,annotations:M("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:re,archived:dt},additionalProperties:!1},mutating:!1,annotations:M("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:re},required:["id"],additionalProperties:!1},mutating:!1,annotations:M("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:re,context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:M("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:M("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, the forms it offers (each field in the order asked, its label, whether it must be answered, what it takes and its choices), 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"), a record's id, or a visitor form's "forms/<name>", 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, a record's id, or "forms/<name>" for a visitor form.`},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:M("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:M("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), and the votes on it (tally: for, against, and this seat's own as mine). 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:M("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). From a seat that may see the suggestion and may not make the change, it records this seat's vote for it instead (voted: "for"; a later vote replaces it) and the suggestion still waits for someone who may.`,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. From a seat that may not make the change, it records this seat's vote against it instead (voted: "against") and the suggestion still waits.`,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}}],lt={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}},ue={name:"suggest_changes",title:"Suggest changes",description:"Keep calls ({ act, args }) as one suggestion a person accepts or declines, with its basis and confidence (0 to 1). Changes nothing; a declined change is refused.",inputSchema:{type:"object",properties:{calls:{type:"array",items:{type:"object"}},basis:{type:"string"},confidence:{type:"number"}},required:["calls","basis"]},mutating:!0,annotations:{title:"Suggest changes",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},ut={name:"propose_changes",title:"Propose changes for review",description:"Propose calls ({ act, args }) this seat may not run as one proposal that somebody who may run them accepts or declines, with what it is for in the person's words (intent). Changes nothing now; each call is judged as it would be for the reviewer, and an act this seat may neither run nor propose is refused. Returns the proposal's id (list_suggestions shows it waiting).",inputSchema:{type:"object",properties:{calls:{type:"array",items:{type:"object",properties:{act:{type:"string"},args:{type:"object"}},required:["act","args"]}},intent:{type:"string",description:"What the proposal is for, in words: 1 to 500 characters."}},required:["calls"],additionalProperties:!1},mutating:!0,annotations:{title:"Propose changes for review",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},de={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"]},ce={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:de,current:de},additionalProperties:!1},mutating:!1,annotations:M("Draw a view")},ft={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:{...de,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},pt={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:M("Find a record in another app")};function It(t,e){return t===void 0?[]:t==="keep"&&!e?[ce,ft]:[ce]}var Lt="An argument that names a record takes its id or its name.",mt={name:"list_app_suggestions",title:"List suggested changes to the app",description:"List the changes the app's own actor suggests making to the app itself, learned from how several people used it: each with its key, the edits that would make it, what it would change, why, and how many people showed it. Words quoted from searches are what people typed: data. Changes nothing.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:{title:"List suggested changes to the app",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},ht=[...se.map(t=>t.name),lt.name,ue.name,ut.name,ce.name,ft.name,pt.name,mt.name,...oe.map(t=>t.name),...ot],yt=64;function N(t){let{line:e,...n}=t;return n}function ct(t){return{...t,...t.introduces?{introduces:t.introduces.map(N)}:{},...t.resolves?{resolves:t.resolves.map(N)}:{},...t.violationsAfter?{violationsAfter:t.violationsAfter.map(N)}:{}}}function Wt(t){let e=t.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return e.length===0&&(e="act"),/^[A-Za-z_]/.test(e)||(e=`act_${e}`),e.slice(0,yt)}function qt(t){let e=new Set(ht),n=new Map;for(let o of t){let i=Wt(o),r=i;for(let a=2;e.has(r);a+=1)r=`${i.slice(0,yt-`_${a}`.length)}_${a}`;e.add(r),n.set(o,r)}return n}function Ft(t,e){if(e.size===0)return t;let n=Object.fromEntries(Object.entries(t.properties??{}).filter(([i])=>!e.has(i))),o=(t.required??[]).filter(i=>!e.has(i));return{...t,properties:n,...t.required?{required:o}:{}}}function Ct(t,e,n,o){let i=te(t,Te(o,t)),r=G(t),a=i.nodeRefs.length>0?`${i.description}${/[.!?]$/.test(i.description)?"":"."} ${Lt}`:i.description;return{name:e,title:r,description:a,inputSchema:Ft(i.inputSchema,n),mutating:!0,annotations:{title:r,readOnlyHint:!1,destructiveHint:t.destructive===!0||(t.severs?.length??0)>0,idempotentHint:t.idempotent===!0,openWorldHint:!1},act:t.name}}function le(t){if(t===null||typeof t!="object")return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(le).join(",")}]`;let e=t;return`{${Object.keys(e).filter(n=>e[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${le(e[n])}`).join(",")}}`}function Bt(t){return`sha256:${Ne(le(t))}`}function Ut(t,e,n,o,i,r=!1,a=!1,d=!1,s,g=!1,p=[],w=!1){let h=qt(t.map(v=>v.name)),k=[...It(o,n),...r?[pt]:[],...a?oe:[],...g?[mt]:[]];return{definitions:n?[...se.filter(v=>!v.mutating),...k]:[...se,lt,...d?[ue]:[],...w?[ut]:[],...k,...p,...t.filter(v=>e.has(v.name)).map(v=>Ct(v,h.get(v.name),i(v),s))],names:h}}function jn(t,e={}){let n=e.author??{kind:"agent"},o=t.allMutations(),i=new Set(t.permittedMutations(n).map(m=>m.name)),{definitions:r,names:a}=Ut(o,i,e.readOnly===!0,e.drafts?e.drafts.keep?"keep":"draw":void 0,m=>X(t.schema,t.policy,n,m),jt(t.schema),e.subscriptions!==void 0,Me(n),t.schema,e.learned!==void 0,rt(e.workflows?.declared().map(m=>m.name)??[],e.workflows?e.workflows.edit?"manage":"run":void 0),Le(t.policy,n,o).length>0),d=Bt(r),s={app:e.app?.brand?.locale,appTimeZone:e.app?.brand?.timeZone},g=m=>pe(s,m),p=m=>{if(!ht.includes(m)){for(let[u,b]of a)if(b===m)return u;return a.has(m)?m:xe(m,a.keys())}},w=m=>{let u=Pe(m,a.keys());return u?` Did you mean "${u}"?`:""},h=m=>{let u=r.find(S=>S.name===m)??r.find(S=>S.act===m);if(u)return u;let b=p(m);return b===void 0?void 0:r.find(S=>S.act===b)},k=(m,u)=>{let b=o.find(l=>l.name===m);if(!b)return{args:u,resolved:[]};let S={...u},c=[];for(let l of C(b.input)){let f=S[l.name];if(typeof f!="string"||f.trim()==="")continue;let y=t.resolveRef(l,f,n);if(!y.ok){let O=y.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${l.name}.`:" Nothing was changed.";return{ok:!1,error:`${y.message}${O}`,argument:l.name,candidates:y.candidates}}y.by!=="id"&&(S[l.name]=y.id,c.push({argument:l.name,given:f,id:y.id,label:y.label}))}return{args:S,resolved:c}},R=async(m,u)=>{try{await Dt();let b=h(m);if(!b&&m===ue.name)return{ok:!1,error:"Only the app's own actor (automated: true) suggests changes.",reason:"forbidden"};if(!b){let c=p(m);if(c){let l=t.permits({name:c,args:u},n);if(!l.ok)return{ok:!1,error:l.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${m}".${w(m)} Available: ${r.map(l=>l.name).join(", ")}`}}if(b.mutating&&e.readOnly)return{ok:!1,error:`"${m}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(b.act!==void 0){let c=k(b.act,u);if("ok"in c)return c;let l=b.act,f=g(()=>j(t,n,t.apply({name:l,args:c.args},{...e.author?{author:e.author}:{},...V(e.via)})));return{ok:!0,data:{batch:f.batch,intent:f.intent,introduces:f.introduces.map(N),resolves:f.resolves.map(N),...c.resolved.length>0?{resolved:c.resolved}:{}},diff:f.diff}}let S=t.seenBy(n);switch(b.name){case"search_graph":{let c=typeof e.places=="function"?e.places():e.places,l=typeof u.subject=="string"?u.subject:void 0,f=qe(S,String(u.query??""),{principal:n,rank:e.near,archived:Se(u.archived),limit:typeof u.limit=="number"&&u.limit>0?Math.min(u.limit,20):20,...c?{places:c}:{},...l?{subject:l,from:[l]}:{}}),y=f.later?await f.later:f;return{ok:!0,data:(await W()).searchRead(y,et(y,U(S,n))),reads:y.hits.flatMap(O=>O.about==="node"?[O.id]:[])}}case"get_graph":return{ok:!0,...(await W()).graphRead(S,U(S,n),u)};case"get_node":{let c=String(u.id??""),l=c,f;if(!S.graph.getNode(c)){let O=c.trim()===""?void 0:t.resolveRef({name:"id",kinds:["*"]},c,n);if(O?.ok)l=O.id,f={argument:"id",given:c,id:l,label:O.label};else return O?.reason==="ambiguous"?{ok:!1,error:O.message,argument:"id",candidates:O.candidates}:{ok:!1,error:`No node "${c}".`}}let y=(await W()).nodeRead(S,U(S,n),l,u);return{ok:!0,data:f?{...y.data,resolved:[f]}:y.data,reads:y.reads}}case"describe_place":{let c=e.app??{name:"",schema:t.schema},l=typeof u.width=="number"&&Number.isFinite(u.width)&&u.width>0?u.width:1440,{describePlace:f}=await Nt(),y=f(t,n,String(u.place??""),{app:c,width:l});if(!y.ok)return{ok:!1,error:`${y.error} The places are: ${y.places.join(", ")}.`};let O=new Set,P=I=>{for(let D of I)for(let x of D.groups??[])for(let $ of x.items)O.add($.id),P($.parts)};return P(y.description.parts),{ok:!0,data:y.description,reads:[...O]}}case"find_linked":return zt(S,n,u,e.linked);case"draft_view":case"keep_lens":{let c=e.app??{name:"",schema:t.schema};return(await Jt()).runDraftTool(b.name,u,{app:c,principal:n,...e.drafts?{drafts:e.drafts}:{}})}case"get_violations":{let c=S.violations(u.context);return{ok:!0,...(await W()).violationsRead(c,u)}}case"get_affordances":{let c=u.selection??[];return{ok:!0,data:We(S,c,{...typeof e.derive=="function"?e.derive():e.derive,...e.author?{principal:e.author}:{},...u.context?{context:u.context}:{}}),reads:c.filter(f=>S.graph.has(f))}}case"preview_mutation":{let c=String(u.mutation),l=p(c)??c,f=k(l,u.args??{});if("ok"in f)return f;let y=t.missingFor({name:l,args:f.args},n);if(y)return{ok:!1,error:y.message,reason:"missing"};let O=j(t,n,t.preview({name:l,args:f.args},void 0,{author:n})),P=ct(O);return{ok:!0,data:f.resolved.length>0?{...P,resolved:f.resolved}:P}}case"act_on_several":{let c=String(u.act??""),l=p(c)??c,f=o.find(_=>_.name===l);if(!f||!i.has(l)){let _=f?t.permits({name:l,args:{}},n):void 0;return _&&!_.ok?{ok:!1,error:_.refusal.message,reason:"forbidden"}:{ok:!1,error:`There is no act "${c}" this seat may run.${w(c)} Nothing was changed.`,reason:"invalid"}}let y=f.subject;if(!y)return{ok:!1,error:`"${G(f)}" does not act on a record, so it cannot be run on several. Nothing was changed.`,reason:"invalid"};let O=Array.isArray(u.records)?u.records.filter(_=>typeof _=="string"&&_.trim()!==""):[];if(O.length===0)return{ok:!1,error:"Name at least one record. Nothing was changed.",reason:"invalid"};let P=[],I=[];for(let _ of O.slice(0,200)){let J=t.resolveRef({name:y.arg,kinds:y.kinds},_,n);if(!J.ok)return{ok:!1,error:`${J.message} Nothing was changed.`,argument:"records",candidates:J.candidates};P.push(J.id),J.by!=="id"&&I.push({argument:"records",given:_,id:J.id,label:J.label})}let D=k(l,{...u.args??{}});if("ok"in D)return D;let x=(await Et()).actOnSeveral(t,{mutation:l,subject:y.arg,args:D.args},P,{author:n,...V(e.via)}),$=x.result?j(t,n,x.result):void 0;return{ok:!0,data:{...x.batch?{batch:x.batch,intent:x.intent}:{},applied:x.applied,unchanged:x.unchanged,refused:x.refused.map(_=>({record:_.id,label:_.label,error:_.message,reason:_.reason})),...x.allOrNothing?{keptNone:!0}:{},...$?{introduces:$.introduces.map(N),resolves:$.resolves.map(N)}:{},...I.length>0||D.resolved.length>0?{resolved:[...I,...D.resolved]}:{}},...$?{diff:$.diff}:{}}}case"subscribe":case"unsubscribe":case"list_subscriptions":{let c=await(await Ht()).runSubscriptionTool(b.name,u,{store:t,principal:e.subscriber??n,app:e.app?.name??"app",subscriptions:e.subscriptions});return c.ok?{ok:!0,data:c.data}:{ok:!1,error:c.error}}case"run_workflow":case"pause_workflow":case"resume_workflow":{let c=await at(b.name,u,{principal:n,workflows:e.workflows});return c.ok?{ok:!0,data:c.data}:{ok:!1,error:c.error,...c.reason?{reason:c.reason}:{}}}case"list_app_suggestions":return{ok:!0,data:{suggestions:(await e.learned()).map(({key:l,said:f,why:y,edits:O,evidence:P})=>({key:l,said:f,why:y,edits:O,evidence:P}))}};case"list_suggestions":{let c=Ee(t,n).map(l=>{let f=F(l.author,{graph:S.graph,schema:t.schema});return{id:l.id,intent:l.intent,by:f,at:l.at,about:l.about,tally:l.tally,...ze(l)?{proposedBy:l.lineage.proposedBy}:{},...l.lineage?{basis:{untrusted:!0,authoredBy:f,text:l.lineage.basis},...l.lineage.confidence!==void 0?{confidence:l.lineage.confidence}:{}}:{}}});return{ok:!0,data:{suggestions:c},reads:[...new Set(c.flatMap(l=>l.about))]}}case"suggest_changes":{let c=u.calls.map(f=>({name:p(f.act)??f.act,args:f.args}));return{ok:!0,data:{suggestion:Je(t,c,{author:n,lineage:{basis:u.basis,confidence:u.confidence},...V(e.via)})?.id??null}}}case"propose_changes":{let c=(u.calls??[]).map(y=>({name:p(y.act)??y.act,args:y.args??{}})),l=typeof u.intent=="string"&&u.intent.trim()!==""?u.intent.trim():void 0,f=Ie(t,n,c,l);return{ok:!0,data:{proposal:f?.id??null,...f?{intent:f.intent}:{}}}}case"accept_suggestion":case"decline_suggestion":{let c=String(u.suggestion??""),l={author:n,...V(e.via)},f=b.name==="accept_suggestion"?He(t,c,l):je(t,c,l),y=j(t,n,f);return{ok:!0,data:{batch:y.batch,intent:y.intent,...f.voted?{voted:f.voted}:{},introduces:y.introduces.map(N),resolves:y.resolves.map(N)},diff:y.diff}}case"undo_batch":{let c=String(u.batch),l=u.include??[],f=S.canUndo([c,...l]);if(!f.ok)return{ok:!1,error:f.message};let y=j(t,n,t.undo([c,...l],{...e.author?{author:e.author}:{}}));return{ok:!0,data:ct(y),diff:y.diff}}default:return{ok:!1,error:`Unknown tool "${m}".`}}}catch(b){let{reason:S,wouldNeed:c}=ve(b);return{ok:!1,error:b instanceof Error?b.message:String(b),reason:S,...c?{wouldNeed:c}:{}}}},v=new Set,A=m=>{for(let u of v)u(m)};return{definitions:r,hash:d,...e.author?{author:e.author}:{},onDiff(m){return t.subscribe(m)},onCall(m){return v.add(m),()=>v.delete(m)},async call(m,u){let b=h(m)?.mutating??!1,S={name:m,args:u,mutating:b,at:new Date().toISOString()};A({...S,phase:"running"});let c=f=>(A(f.ok?{...S,phase:"ok",...!b&&f.reads?{reads:f.reads}:{}}:{...S,phase:"failed",error:f.error}),f),l=await R(m,u);return c(l.ok&&!b?{...l,data:(await W()).withinReadChars(m,l.data)}:l)}}}function V(t){let e=typeof t=="function"?t():t;return e?{via:e}:{}}export{le as a,jn as b};
|
|
@@ -0,0 +1,18 @@
|
|
|
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{A as yn,B as He,C as Fo,D as pt,E as ke,F as ia,G as Xe,H as rt,I as Io,J as sa,K as Fe,L as Do,M as Wo,N as $,O as Tt,P as Wt,Q as Go,R as Gt,S as hn,T as Bo,U as se,V as ot,W as le,X as la,a as j,b as Te,c as Z,d as fn,e as aa,f as ra,g as Rt,h as ae,i as Ae,j as de,k as L,l as ce,m as _,n as je,o as Ce,p as Lt,q as ve,r as we,s as Oo,t as Ft,u as $o,v as It,w as Dt,x as Y,y as Ue,z as Ho}from"./chunk.KV7GZBJ6.js";import{b as na,c as Mo,d as No,e as Qe,f as oa,h as re}from"./chunk.5YNLFOBJ.js";import{a as $e}from"./chunk.FHHVW2WB.js";import{a as Lo,d as To,e as Eo}from"./chunk.Q355UPFG.js";import{a as bo,c as vo,f as ko,g as xo,i as Po,j as Ao,l as Co,n as Ro}from"./chunk.HNMSYQRA.js";import{a as mn,b as ct}from"./chunk.SOMRYDDH.js";import{a as co,b as po,c as uo,d as ta}from"./chunk.44ZHHPPJ.js";import{b as lo}from"./chunk.ZDUTEM3Z.js";import{a as go,b as mo,d as un,e as fo,f as yo,g as ho,j as gn}from"./chunk.ARHAD5IS.js";import{m as so}from"./chunk.MHTA4HYB.js";import{a as _r,b as zr,c as Jr,e as ro,f as ea,h as cn}from"./chunk.3KUYB5ZT.js";import{d as Yr,e as Qr,f as Xr,g as Zr,o as ln,p as no,r as ao,t as dn}from"./chunk.IMKD6QQG.js";import{a as nn,b as Sr,c as br,d as an,e as vr}from"./chunk.FXG5AJF6.js";import{b as Lr,c as qr,e as Vr,f as Qn}from"./chunk.RFVOXX3P.js";import{a as Yn,b as Kr}from"./chunk.NKYYDFIX.js";import{a as pn,b as Ht,c as oo,e as io}from"./chunk.N35SJWAM.js";import{a as Ct,b as Gr,e as Br}from"./chunk.L7NJLZWV.js";import{a as jr}from"./chunk.BJUUSIQY.js";import{a as Xn}from"./chunk.J6KNEI5R.js";import{a as Jn,b as Cr,c as Rr}from"./chunk.2YMO7ZVX.js";import{a as Ur}from"./chunk.5M34BJIQ.js";import{A as Dr,B as Wr,n as Hr,s as $t,t as Fr,z as Ir}from"./chunk.CXJJB3MK.js";import{c as sn,d as Er,e as Mr,f as Nr,j as Or,l as dt,n as $r}from"./chunk.S2DOVJRL.js";import{a as Tr}from"./chunk.64FCAUAJ.js";import{n as Ar}from"./chunk.DA4RSHLW.js";import{b as kr,c as xr,d as rn,e as Pr,l as on}from"./chunk.FOSY7MZF.js";import{b as nr,c as ar}from"./chunk.ZMWAZACO.js";import{a as Un,d as _n,f as tr}from"./chunk.CD6YWH6T.js";import{E as Zn,M as wo,P as So,e as hr,f as wr,w as eo,x as to}from"./chunk.MD36ZSM5.js";import{c as qi}from"./chunk.L6FGKJ5H.js";import{$ as pr,Fa as tn,G as Le,L as ir,N as sr,P as lr,Sa as yr,T as dr,V,W as zn,_ as cr,da as ur,ea as me,ha as gr,ia as mr,ma as fr,qa as Pt,r as or,sa as At,ua as Ye,v as Ve}from"./chunk.3CJLAJXP.js";import{a as rr}from"./chunk.SDO3U72B.js";import{$d as en,Ac as ja,Ea as Wa,Ed as Qa,Fa as Ga,Ib as kt,Mc as Ua,N as Fa,Oc as _a,Sd as jn,Wb as Va,Yd as Zt,Z as bt,Zd as Xa,fb as Ba,ga as ze,hb as Ka,ie as Za,jd as Vn,je as xt,ka as lt,kd as za,ke as Ot,la as ie,na as vt,oa as Ia,pa as at,pe as er,ra as Da,rd as Ja,sa as Xt,sd as Ya,ta as Je,ub as qn,vb as qa}from"./chunk.J24YPQ5I.js";import{b as O}from"./chunk.AJZBJBMO.js";var Vi=new Set(["text","date","number","choice","several"]);function Ko(e,t,n){let a=e.graph.getNode(t);if(!a)return[];let r=n??e.seenFor,o=new Set(sn(e.schema.tryDefinition(a.kind)));return Hr(e,t,...r?[{principal:r}]:[]).filter(i=>{let s=a[i.field],l=s==null||s===""||Array.isArray(s)&&s.length===0,p=i.shape.type==="several"?i.shape.of.type==="choice"?"several":"":i.shape.type;return l&&i.takesValue&&i.open.length===0&&Vi.has(p)&&!o.has(i.field)}).map(i=>i.field)}function wn(e,t,n={}){let a=e.graph.getNode(t);if(!a)return;let r=e.schema.tryDefinition(a.kind),o=s=>ie(e.schema.tryDefinition(s.kind),s),i=new Map;for(let s of e.graph.allEdges()){let l=s.from===t?"out":s.to===t?"in":null;if(!l)continue;let p=l==="out"?s.to:s.from,g=e.graph.getNode(p);if(!g)continue;let u=(l==="out"?r:e.schema.tryDefinition(g.kind))?.edges?.[s.kind],h=l==="in"?u?.inverse??u?.description:u?.description,T=`${s.kind}|${l}|${h??""}`;(i.get(T)??(()=>{let P={edgeKind:s.kind,direction:l,...h?{description:h}:{},targets:[]};return i.set(T,P),P})()).targets.push({id:g.id,kind:g.kind,label:o(g)})}return{id:t,kind:a.kind,label:o(a),fields:rn(dt(e.schema,e.graph,a),r,n.blanks?{blanks:n.blanks}:{}),violations:qn(e.violations(n.context),[t]),actions:Xn(e,[t],{focus:t,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...i.values()].map(s=>{let l=kr(s.targets.flatMap(p=>{let g=e.graph.getNode(p.id);return g?[g]:[]}),p=>e.schema.tryDefinition(p));return{...s,targets:[...s.targets].map(p=>l.has(p.id)?{...p,apart:l.get(p.id)}:p).sort((p,g)=>p.label.localeCompare(g.label))}})}}function ut(e,t,n={}){return{kind:t,members:e.graph.nodesOfKind(t),actions:Xn(e,[],{kindSelection:[t],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function qo(e,t){let n=(o,i)=>`${o}|${JSON.stringify(i)}`,a=new Map;for(let o of[...e.affordances,...e.withheld]){if(o.provider!=="invariant")continue;let i=n(o.mutation,o.args);a.has(i)||a.set(i,o.rank??Number.MAX_SAFE_INTEGER)}let r=Number.MAX_SAFE_INTEGER;return[...t].map((o,i)=>({repair:o,declared:i})).sort((o,i)=>(a.get(n(o.repair.mutation,o.repair.args??{}))??r)-(a.get(n(i.repair.mutation,i.repair.args??{}))??r)||o.declared-i.declared).map(o=>o.repair)}function gt(e){let t=e.schema.kinds.map(r=>({kind:r,plural:at(e.schema,r),count:e.graph.nodesOfKind(r).length})),n=new Map;for(let r of e.graph.allEdges()){let o=e.graph.getNode(r.from),i=e.graph.getNode(r.to);if(!o||!i)continue;let s=`${r.kind}|${o.kind}|${i.kind}`;n.set(s,(n.get(s)??0)+1)}let a=[];for(let{kind:r}of t){let o=e.schema.tryDefinition(r)?.edges??{};for(let[i,s]of Object.entries(o)){let l=s.to==="*"||s.to===void 0?(()=>{let p=[...n.keys()].filter(g=>g.startsWith(`${i}|${r}|`)).map(g=>g.split("|")[2]);return p.length>0?p:["*"]})():s.to;for(let p of l)a.push({edgeKind:i,from:r,to:p,...s.description?{description:s.description}:{},...s.inverse?{inverse:s.inverse}:{},count:n.get(`${i}|${r}|${p}`)??0})}}return{kinds:t,relations:a}}var Ze=O(Le(),1);var Bt=O(Le(),1);var Ie=O(V(),1),Ui={problems:"Problems",search:"Search",map:"Connections",places:"Pictures","~draft":"A view drawn"},_i=e=>{try{return decodeURIComponent(e)}catch{return e}};function zi(e,t,n={}){let{store:a}=e,r=a.schema,o=(n.base??"").replace(/\/$/,""),[i="/",s=""]=t.split("#")[0].split("?"),l=(M,I,v)=>({label:M,href:`${o}${I}`,path:I,...v?{current:v}:{}}),p=M=>{let I=n.registry?.sectionOf(M);return I?[I.path===void 0?{label:I.label}:l(I.label,I.path)]:[]},g=M=>n.registry?.sectionOf(M)?.label,S=M=>{let I=g(M);return I===void 0?{}:{section:I}},[u,h,...T]=i.split("/").filter(Boolean).map(_i);if(u===void 0)return{as:"home",label:"Home",trail:[l("Home","/",!0)]};if(u==="places"&&h!==void 0&&T.length===0){let M=new URLSearchParams(s).get("of"),I=new Set(Ue(a,e.principal)),v=e.views?.places()??[],H=v.find(ee=>I.has(ee.kind)&&ee.as===h&&(!M||j(r,ee.kind)===M));if(H){let ee=fn(H.as,Zt(H,v)?j(r,H.kind):void 0);return{as:"place",kind:H.kind,label:H.title,...S(H.kind),trail:[...p(H.kind),l(H.title,ee,!0)]}}}let f=T.length===0?Te(r,u):void 0;if(f!==void 0){let M=l(at(r,f),`/${j(r,f)}`);if(h===void 0)return{as:"list",kind:f,label:M.label,...S(f),trail:[...p(f),{...M,current:!0}]};let I=a.graph.getNode(h),v=I&&I.kind===f?ie(r.tryDefinition(f),I):"Nothing lives here";return{as:"record",kind:f,id:h,label:v,...S(f),trail:[...p(f),M,l(v,Z(r,f,h),!0)]}}let P=Ui[u]??Ji((T.at(-1)??h??u).replace(/[-_]+/g," "));return{as:"page",label:P,trail:[l(P,i,!0)]}}var Ji=e=>e.charAt(0).toUpperCase()+e.slice(1),da=(0,Bt.createContext)(null);function Yi(e){let t=ke(),n=pt("/");return re(e.context.store),zi(e.context,`${t.pathname}${t.search}`,{registry:e.registry,base:n})}var Qi={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},Vo={display:"flex",alignItems:"center",gap:6,minWidth:0},jo={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,lineHeight:"24px"};function mt({context:e,style:t}){let n=(0,Bt.useContext)(da),a=(0,Bt.useContext)(Wt);return Gt(a??Zi,"trail")||n?.registry?.without().has("trail")?null:(0,Ie.jsx)(Xi,{root:n??{context:e,registry:void 0},context:e,...t?{style:t}:{}})}function Xi({root:e,context:t,style:n}){let a=Yi(e);return a.trail.length<2?null:(0,Ie.jsx)(es,{here:a,mark:a.as==="record"?{kind:a.kind,context:t}:void 0,...n?{style:n}:{},"data-testid":"page-trail"})}var Zi={count:()=>0,place:()=>()=>{},subscribe:()=>()=>{}};function es({here:e,mark:t,style:n,...a}){let r=e.as==="record"?e.trail.length-2:-1;return(0,Ie.jsx)("nav",{"aria-label":"You are here","data-graview-trail":"",style:{minWidth:0,...n},...a,children:(0,Ie.jsx)("ol",{style:{...Ae,listStyle:"none",padding:0,display:"flex",alignItems:"center",gap:6,minWidth:0,overflow:"hidden"},children:e.trail.map((o,i)=>(0,Ie.jsxs)("li",{style:o.current?Qi:{...Vo,flexShrink:i===e.trail.length-2?0:1,maxWidth:"100%"},...o.current?{"aria-current":"page"}:{},children:[i>0&&!o.current?(0,Ie.jsx)("span",{"aria-hidden":"true",children:"\u203A"}):null,o.current?o.label:o.path!==void 0?(0,Ie.jsxs)($,{to:o.path,style:{...Ce,...Vo},...i===r?{"data-testid":"trail-list"}:{},children:[i===r&&t?(0,Ie.jsx)(we,{kind:t.kind,brand:t.context.brand,schema:t.context.store.schema,size:8}):null,(0,Ie.jsx)("span",{style:jo,children:o.label})]}):(0,Ie.jsx)("span",{style:jo,children:o.label})]},`${i}:${o.label}`))})})}var E=O(V(),1);function Ge(e){let t=e.views;if(!t)return[];let n=new Set(Ue(e.store,e.principal));return t.places().filter(a=>n.has(a.kind))}function Kt(e,t){if(!t.over)return[t.kind];let n=new Set(Ue(e.store,e.principal));return t.over.filter(a=>a===t.kind||n.has(a))}var ft=e=>`place:${e.kind}:${e.as}`;function Se(e,t){return fn(t.as,Zt(t,e.views?.places()??[])?j(e.store.schema,t.kind):void 0)}function Et(e,t){let n=e.schema.tryDefinition(t);return e.graph.nodesOfKind(t).filter(a=>lt(n,a))}function ca(e,t,n){let a=(o,i)=>vt(e.schema,i,o),r=(typeof t=="string"?[t]:t).map(o=>a(Et(e,o).length,o)).join(" and ");return n?`${r} across ${a(Et(e,n).length,n)}`:r}function pa({context:e,place:t,chosen:n,filter:a}){let{store:r,views:o,invariantContext:i}=e,l=o?.resolve(t.kind,{cardinality:"many",fidelity:"full"},t.as)?.view,p=[...new Set(r.violations(i).flatMap(u=>u.nodeIds))],g=Kt(e,t).flatMap(u=>Et(r,u));if(!l)return null;let S=ts(r,g,a,p);return(0,E.jsx)($t,{kind:t.kind,view:t.title,children:(0,E.jsx)(ot,{when:Ye(l),children:(0,E.jsx)(l,{nodes:S,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...p.length>0?{flagged:p}:{}})})})}function ts(e,t,n,a){let r=n?en({filter:n}).filter??[]:[];return r.length===0?t:cn(t,{filter:r},{schema:e.schema,graph:e.graph,flagged:new Set(a)}).nodes}function ns({store:e,views:t,as:n,invariantContext:a}){re(e);let r={store:e,views:t,...a?{invariantContext:a}:{}},o=t.places().find(i=>i.as===n);return o?(0,E.jsx)(pa,{context:r,place:o}):null}function as({context:e,kind:t}){let{store:n,views:a,invariantContext:r}=e,o=Et(n,t),i=n.schema.tryDefinition(t),s=Y(n,t),p=a?.resolve(t,{cardinality:"many",fidelity:"full"})?.view,g=[...new Set(n.violations(r).flatMap(T=>T.nodeIds))];if(p&&!Pt(p))return(0,E.jsx)($t,{kind:t,children:(0,E.jsx)(p,{nodes:o,label:s,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...g.length>0?{flagged:g}:{}})});let S=a?.resolve(t,{cardinality:"one",fidelity:"summary"})?.view,u=8,h=o.slice(0,u);return(0,E.jsxs)("div",{"data-testid":"kind-sheet",style:S?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[h.map(T=>S?(0,E.jsx)(S,{node:T,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...g.includes(T.id)?{flagged:[T.id]}:{}},T.id):(0,E.jsx)("span",{style:{padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:ie(i,T)},T.id)),o.length>u?(0,E.jsxs)("span",{style:{...L,alignSelf:"center",padding:"0 6px"},children:["+",o.length-u," more ",s.toLowerCase()]}):null]})}function Sn(e){let{store:t}=e,n=Ho(e),a=Ge(e),r=e.views?.arrangement?.()?.order??[],o=l=>{let p=l.name===void 0?-1:r.indexOf(`view:${l.name}`);return p>=0?p-r.length:n.indexOf(l.kind)},i=jn([...a].sort((l,p)=>o(l)-o(p))).filter(l=>!l.hidden),s=new Set(i.flatMap(l=>l.over??[l.kind]));return[...i.map(l=>({key:ft(l),kind:l.kind,title:Xa(l,a,t.schema),to:Se(e,l),place:l})),...yn(e).filter(l=>!s.has(l)).map(l=>({key:`kind:${l}`,kind:l,title:Y(t,l),to:`/${j(t.schema,l)}`}))]}function zo(e){let t=new Set(Sn(e).flatMap(n=>n.place?Kt(e,n.place):[n.kind]));return new Set([...t].flatMap(n=>Et(e.store,n).map(a=>a.id)))}var Uo=.72,rs=540,_o=16/10;function os(e){let t=(0,Ze.useRef)(null),[n,a]=(0,Ze.useState)(e);return(0,Ze.useLayoutEffect)(()=>{let r=t.current;if(!r||typeof ResizeObserver>"u")return;let o=()=>{let s=r.getBoundingClientRect().width;s>0&&a(l=>Math.abs(l-s)<.5?l:s)};o();let i=new ResizeObserver(o);return i.observe(r),()=>i.disconnect()},[]),{ref:t,width:n}}function is(e){for(let t=e.parentElement;t;t=t.parentElement)if(/(auto|scroll)/.test(getComputedStyle(t).overflowY))return t;return null}function ss(e){let[t,n]=(0,Ze.useState)(()=>typeof IntersectionObserver>"u");return(0,Ze.useLayoutEffect)(()=>{let a=e.current;if(t||!a)return;let r=new IntersectionObserver(o=>{o.some(i=>i.isIntersecting)&&(r.disconnect(),n(!0))},{root:is(a),rootMargin:"50% 0px"});return r.observe(a),()=>r.disconnect()},[t,e]),t}function ua({context:e,entry:t,small:n=!1}){let{store:a,brand:r,principal:o}=e,{ref:i,width:s}=os(rs),l=ss(i),p=s/Uo,g=Et(a,t.kind),S=a.schema.tryDefinition(t.kind),u=g.length===0?ut(a,t.kind,{...o?{principal:o}:{},...e.invariantContext?{context:e.invariantContext}:{}}).actions.affordances[0]:void 0,h=t.place!==void 0;return(0,E.jsxs)($,{to:t.to,"data-testid":h?"place-card":"kind-card",className:"graview-gallery-card",style:{...Ce,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,E.jsxs)("span",{ref:i,"data-testid":h?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${_o}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,E.jsx)("span",{style:{position:"absolute",left:0,top:0,width:p,height:p/_o,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${Uo})`,transformOrigin:"0 0"},children:l?(0,E.jsx)(un.Provider,{value:null,children:t.place?(0,E.jsx)(pa,{context:e,place:t.place}):(0,E.jsx)(as,{context:e,kind:t.kind})}):null}),g.length===0?(0,E.jsx)("span",{"data-testid":"picture-empty",style:{position:"absolute",inset:0,display:"grid",placeContent:"center",justifyItems:"center",gap:2,padding:20,textAlign:"center"},children:(0,E.jsxs)("span",{style:{display:"grid",gap:2,padding:"10px 16px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:[(0,E.jsxs)("span",{style:{fontFamily:ra,fontWeight:"var(--graview-weight-display)"},children:["No ",Y(a,t.kind).toLowerCase()," yet"]}),u?(0,E.jsxs)("span",{style:L,children:["Begin with \u201C",u.label,"\u201D"]}):null]})}):null]}),(0,E.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,E.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[h?null:(0,E.jsx)(we,{kind:t.kind,brand:r,schema:a.schema,size:8}),(0,E.jsx)("span",{style:{fontFamily:ra,fontSize:n?"var(--graview-text-body)":"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:t.title})]}),(0,E.jsxs)("span",{style:L,children:[t.place?ca(a,Kt(e,t.place),t.place.across):ca(a,t.kind),!h&&S?.description?` \xB7 ${S.description}`:null]})]})]})}var Jo={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},ls={display:"grid",gap:"20px 16px",gridTemplateColumns:"repeat(auto-fill, minmax(clamp(140px, 22%, 260px), 1fr))"},ds=`
|
|
2
|
+
.graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
|
|
3
|
+
.graview-gallery-card:hover > span:first-child,
|
|
4
|
+
.graview-gallery-card:focus-visible > span:first-child { border-color: var(--graview-edge-bright); box-shadow: 0 1px 0 var(--graview-edge), 0 10px 30px -18px var(--graview-ink); }
|
|
5
|
+
`;function bn({context:e,small:t=!1}){re(e.store);let n=Sn(e);return n.length===0?null:(0,E.jsxs)("section",{style:t?ls:Jo,"data-testid":"gallery",...t?{"data-small":""}:{},children:[(0,E.jsx)("style",{children:ds}),n.map(a=>(0,E.jsx)(ua,{context:e,entry:a,small:t},a.key))]})}function ga({context:e}){let{store:t}=e;re(t);let n=jn(Ge(e)).filter(r=>!r.hidden),a=Sn(e);return(0,E.jsxs)(se,{context:e,style:Rt,children:[(0,E.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,E.jsx)("p",{style:Ae,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,E.jsx)(le,{context:e,children:"Pictures"}),(0,E.jsx)("p",{style:de,children:n.length===0?"Nothing here has a picture of its own yet, so each kind is drawn as the scene draws it. Title a group view and it appears here by name.":"The ways this installation looks at what it holds \u2014 each one the same picture the scene shows, here as a page."})]}),a.length>0?(0,E.jsx)("div",{style:Jo,"data-testid":"places",children:a.map(r=>(0,E.jsx)(ua,{context:e,entry:r},r.key))}):null]})}var cs={lede:!0},ps={lede:!1},us={...de,textWrap:"pretty"};function gs(e,t){if(t===void 0)return;let[n]=Nr(Mr([t]),$r(e.store,null,null,e.brand?{money:e.brand}:{}));return n?.t==="headline"&&!n.problem&&n.text.trim()!==""?n.text:void 0}function ma({context:e}){let{store:t,principal:n}=e;re(t);let a=rt(),r=Xe(),[o]=Tt(),i=decodeURIComponent(a.as??""),[s,l]=(0,Ze.useState)(null),p=o.get("of"),g=o.get("filter"),u=Ge(e).find(A=>A.as===i&&(!p||j(t.schema,A.kind)===p));if(!u)return(0,E.jsxs)(se,{context:e,children:[(0,E.jsx)(le,{context:e,children:"No picture is called that."}),(0,E.jsx)("p",{style:de,children:(0,E.jsx)($,{to:"/places",style:je,children:(0,E.jsx)(Qe,{children:"The pictures there are"})})})]});let h=Y(t,u.kind),T=e.views?.resolve(u.kind,{cardinality:"many",fidelity:"full"},u.as)?.view,f=T?.flows===!0,P=T?.ownHeading===!0,M=T?.creates!==!1,I=gs(e,T?.lede),v=At(T)&&e.views?.lookup(u.kind,{cardinality:"many",fidelity:"full"})===T,H=ut(t,u.kind,{...n?{principal:n}:{},...e.invariantContext?{context:e.invariantContext}:{}}),ee=M?H.actions.affordances.map(A=>({affordance:A,mutation:t.allMutations().find(C=>C.name===A.mutation)})).filter(A=>A.mutation!==void 0):[];return(0,E.jsxs)(se,{context:e,style:{...Rt,gap:"var(--graview-space-6, 32px)"},children:[(0,E.jsxs)("header",{style:{display:"grid",gap:"var(--graview-space-2, 8px)"},children:[(0,E.jsx)(mt,{context:e}),(0,E.jsx)(le,{context:e,unseen:P,children:u.title}),P?null:(0,E.jsx)("p",{style:us,"data-testid":"place-lede",...I!==void 0?{"data-graview-lede":"headline"}:{},children:I??`${ca(t,Kt(e,u),u.across)}.`}),g&&!f?(0,E.jsxs)("p",{style:{...L,margin:0},"data-testid":"place-narrowed",children:[`Only those where ${g.split(",").map(A=>A.replace(":"," is ")).join(" and ")}. `,(0,E.jsx)($,{to:`?${(()=>{let A=new URLSearchParams(o);return A.delete("filter"),A.toString()})()}`,style:{..._,...L},children:"Show all"})]}):null,(0,E.jsx)("p",{style:{...L,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:Kt(e,u).filter(A=>!(v&&A===u.kind)).map((A,C)=>(0,E.jsx)($,{to:`/${j(t.schema,A)}`,style:{...je,...L},...C===0?{"data-testid":"place-as-list"}:{},children:(0,E.jsxs)(Qe,{children:["All ",(A===u.kind?h:Y(t,A)).toLowerCase()," as a list"]})},A))})]}),(0,E.jsx)("div",{"data-testid":"place-lens","data-flows":f?"":void 0,...f?{}:{role:"group","aria-label":u.title,tabIndex:0},style:f?{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",maxWidth:"100%"}:{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",maxWidth:"100%",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},onClick:A=>{let C=A.target?.closest("[data-graview-pick]"),G=C?.getAttribute("data-graview-pick"),ne=C?.getAttribute("data-graview-joins");if(ne)try{let pe=JSON.parse(ne);if(Array.isArray(pe)&&pe.every(Re=>typeof Re=="string")){A.preventDefault(),l({at:ft(u),ids:pe});return}}catch{}if(!G)return;let ge=t.graph.getNode(G);ge&&(A.preventDefault(),r(Z(t.schema,ge.kind,G)))},children:(0,E.jsx)(ho.Provider,{value:I!==void 0?cs:ps,children:(0,E.jsx)(pa,{context:e,place:u,filter:g,...s?.at===ft(u)?{chosen:s.ids}:{}})})}),ee.length>0?(0,E.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},"data-testid":"place-creators",children:ee.map(({affordance:A,mutation:C})=>(0,E.jsxs)("section",{style:{...ce,display:"grid",gap:14},children:[(0,E.jsx)("h2",{style:ae,children:C.title??C.name}),C.description?(0,E.jsx)("p",{style:{...L,margin:0,maxWidth:"58ch"},children:C.description}):null,(0,E.jsx)($e,{store:t,mutation:C,prefilled:A.args,open:A.open,label:A.label,...n?{principal:n}:{}})]},A.id))}):null]})}function ms(e,t=document){let n=mn(e);if(!n)return null;let a=[t,...[...t.querySelectorAll("[data-worker-view]")].flatMap(r=>r.shadowRoot?[r.shadowRoot]:[])];for(let r of a)for(let o of r.querySelectorAll("[id], [data-section]")){let i=o.getAttribute("data-section")??o.id;if(i===e||mn(i)===n)return o}for(let r of a)for(let o of r.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]"))if(mn(o.textContent??"")===n)return o;return null}function Yo(e,t={}){if(typeof document>"u"||typeof requestAnimationFrame>"u")return()=>{};let n=t.frames??120,a=0,r=()=>{let o=ms(e,t.root??document);if(o){o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.scrollIntoView?.({block:"start"}),o.focus({preventScroll:!0});return}n-=1,n>0&&(a=requestAnimationFrame(r))};return a=requestAnimationFrame(()=>{a=requestAnimationFrame(r)}),()=>cancelAnimationFrame(a)}var K=O(Le(),1);var vn=O(Le(),1);var yt=O(V(),1);function Qo({context:e}){return me()?(0,yt.jsxs)(yt.Fragment,{children:[(0,yt.jsx)(fs,{context:e}),(0,yt.jsx)(vo,{face:"pages",on:e.quickAsk??!0})]}):null}function fs({context:e}){let{store:t}=e,n=me(),{pathname:a}=ke(),r=(0,vn.useRef)(n?.setSelection);return r.current=n?.setSelection,(0,vn.useEffect)(()=>{let o=r.current;if(!o)return;let[,i,s]=a.split("/"),l=(()=>{if(i==="places"){let g=e.views?.places().find(S=>S.as===decodeURIComponent(s??""));return g?[Ve(g.kind)]:[]}let p=i?Te(t.schema,i):void 0;return p&&s?[decodeURIComponent(s)]:p?[or(p)]:[]})();o(p=>p.length===l.length&&p.every((g,S)=>g===l[S])?p:l)},[a]),null}var Ee=O(Le(),1);var Zo=O(qi(),1);var be=O(V(),1);var ys=tn(rr(()=>(__graviewPreload(import.meta.url,["./chunk.5YNLFOBJ.js","./chunk.Q355UPFG.js","./chunk.HNMSYQRA.js","./chunk.44ZHHPPJ.js","./chunk.ZDUTEM3Z.js","./chunk.ARHAD5IS.js","./chunk.R2TSTDS3.js","./chunk.QSDBF7VL.js","./chunk.2PK335JQ.js","./chunk.MHTA4HYB.js","./chunk.BU5PVRX7.js","./chunk.3KUYB5ZT.js","./chunk.IMKD6QQG.js","./chunk.MB7LKKUD.js","./chunk.FXG5AJF6.js","./chunk.RFVOXX3P.js","./chunk.NKYYDFIX.js","./chunk.IR4OW67N.js","./chunk.6RZHKQP3.js","./chunk.N35SJWAM.js","./chunk.L7NJLZWV.js","./chunk.QO5RXOCS.js","./chunk.MIE4TJRW.js","./chunk.CXJJB3MK.js","./chunk.OJGHDWI6.js","./chunk.74B6KQF4.js","./chunk.WVUJXDXZ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DJPNVXBQ.js")).then(e=>({default:e.TakeBack}))));function hs({context:e,docked:t,at:n,...a}){let{store:r}=e,o=re(r),[i]=(0,Ee.useState)(()=>r.batches().length),s=(0,Ee.useRef)(!1);return s.current||=o>0||!t&&i>0,s.current?(0,be.jsx)(Ee.Suspense,{fallback:null,children:(0,be.jsx)(ys,{context:e,docked:t,at:n,since:i,...a})}):null}function ws(e,t,n){let{store:a,principal:r,embedded:o}=e;(0,Ee.useEffect)(()=>{if(!n)return;let i=s=>{if(!Eo(s))return;let l=s.target,p=l instanceof Node&&t.current?.contains(l),g=l===document.body||l===document.documentElement||l===document;if(!(!p&&!(g&&!o))&&Lo(a,r)){s.preventDefault();try{To(a,r)}catch{}}};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[a,r,o,t,n])}function ei({context:e,registry:t,root:n,children:a}){let r=(0,Ee.useMemo)(Go,[]),o=t?.without()??new Set;return ws(e,n,!o.has("undo")),(0,be.jsxs)(Wt.Provider,{value:r,children:[(0,be.jsx)(Ss,{context:e,placed:r,without:o}),a]})}function Ss({context:e,placed:t,without:n}){let[a,r]=(0,Ee.useState)(!1);(0,Ee.useLayoutEffect)(()=>r(!0),[]);let o=Gt(t,"find"),i=Gt(t,"undo"),s=ke(),l=to();if(!a)return null;let p=s.pathname.split("/").filter(Boolean),S=(p.length===1?Te(e.store.schema,p[0]):void 0)!==void 0;return(0,be.jsxs)(be.Fragment,{children:[!o&&!n.has("find")&&l?(0,Zo.createPortal)((0,be.jsx)(Xo,{context:e,narrowsLists:S}),l.slot):null,!o&&!n.has("find")&&!l?(0,be.jsx)("div",{"data-testid":"face-find-bar",style:{display:"flex",alignItems:"center",padding:"8px 16px",borderBottom:"1px solid var(--graview-edge)",background:"var(--graview-bar)",minWidth:0},children:(0,be.jsx)(Xo,{context:e,narrowsLists:S})}):null,!i&&!n.has("undo")?(0,be.jsx)(hs,{context:e,docked:!0,at:s.pathname+s.search}):null,l?.own&&!n.has("undo")?(0,be.jsx)(Fo,{context:e,own:l.own}):null]})}function Xo({context:e,narrowsLists:t}){return(0,be.jsx)(Wt.Provider,{value:null,children:(0,be.jsx)(la,{context:e,narrowsLists:t})})}var U=O(Le(),1);var xe=O(V(),1),bs=500,vs=10;function qt(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function ks(e){let t=typeof getSelection=="function"?getSelection():null;if(t===null||t.isCollapsed)return!1;for(let n=0;n<t.rangeCount;n++)if(t.getRangeAt(n).intersectsNode(e))return!0;return!1}function ti(e){let t=e.nativeEvent.composedPath?.()[0];return t instanceof Element?t:e.target}function ii(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode();return t instanceof ShadowRoot?t.host:null}function ni(e,t){for(let n=e;n;n=ii(n))if(n.hasAttribute(t))return n;return null}var xs='a[href], button, summary, label, input, select, [role="button"], [draggable="true"], [data-graview-pick], [data-graview-listed], [data-graview-record], [data-graview-act], [data-graview-editable], [data-record], [data-act], [data-column]';function Ps(e,t,n){for(let a=e;a;a=ii(a))if(a.matches(xs))return!1;if(typeof getComputedStyle=="function"&&getComputedStyle(e).userSelect==="none")return!1;for(let a of e.childNodes){if(a.nodeType!==Node.TEXT_NODE||!a.nodeValue?.trim())continue;let r=document.createRange();if(r.selectNodeContents(a),typeof r.getClientRects!="function")return!1;for(let o of r.getClientRects())if(t>=o.left&&t<=o.right&&n>=o.top&&n<=o.bottom)return!0}return!1}function As(e){let t=typeof getSelection=="function"?getSelection():null;if(!t||t.isCollapsed||!e||!t.anchorNode||!e.contains(t.anchorNode))return null;let n=t.toString();return n.trim()?n:null}function ai(e,t,n){let a=navigator.clipboard?.writeText?.(e);if(!a)return t(`${n} could not be copied here`);a.then(()=>t(`${n} copied`),()=>t(`${n} could not be copied here`))}function ri(e){let t=e.closest('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])');if(t)return t;let n=document.activeElement;return n instanceof HTMLElement&&n!==document.body?n:null}function si({context:e,root:t,children:n}){return me()===null?(0,xe.jsx)(xe.Fragment,{children:n}):(0,xe.jsx)(Cs,{context:e,root:t,children:n})}function Cs({context:e,root:t,children:n}){let{setMenuAt:a}=ur(),{store:r}=e,o=r.schema,i=Xe(),{pathname:s,search:l}=ke(),p=pt("/").replace(/\/$/,""),g=(0,U.useCallback)((d,m)=>e.views?.places().find(k=>k.as===d&&(m===null||k.kind===m)),[e.views]),S=(0,U.useCallback)((d,m)=>{let[k="",R,q]=d.split("/").filter(Boolean).map(X=>{try{return decodeURIComponent(X)}catch{return X}});if(q!==void 0)return null;if(k==="places"&&R!==void 0){let X=g(R,new URLSearchParams(m).get("of"));return X?{face:"pages",place:X.as,about:[Ve(X.kind)],title:X.title}:null}let te=Te(o,k);return te?R===void 0?{face:"pages",about:[Ve(te)],title:at(o,te)}:r.graph.getNode(R)?{face:"pages",on:R,about:[R]}:null:null},[o,r,g]),u=(0,U.useCallback)(d=>{let m=d.href;try{let k=new URL(m,location.href);if(k.origin===location.origin&&(p===""||k.pathname===p||k.pathname.startsWith(`${p}/`))){let R=S(k.pathname.slice(p.length),k.search);if(R)return{...R,href:m}}}catch{}return{face:"pages",about:[],href:m}},[p,S]),h=(0,U.useCallback)(()=>S(s,l)??{face:"pages",about:[]},[S,s,l]),T=(0,U.useCallback)(d=>{let m=h(),k=d.closest("[data-graview-field]")?.getAttribute("data-graview-field");if(k&&m.on!==void 0&&d.closest("[data-graview-pick], a[href]")===null)return{...m,field:k};let R=d.closest("[data-graview-act]")?.getAttribute("data-graview-act");if(R)return{...m,act:R};let q=d.closest("a[href]"),te=d.closest("[data-graview-listed]"),X=[d.closest("[data-graview-pick]")?.getAttribute("data-graview-pick"),te&&(!q||te.contains(q)&&q.classList.contains("graview-spec-item-link"))?te.getAttribute("data-graview-listed"):null].map(J=>J?r.graph.getNode(J):void 0).find(Boolean);if(X)return{face:"pages",on:X.id,about:[X.id],href:`${p}${Z(o,X.kind,X.id)}`};if(q)return u(q);let ye=d.closest("[data-graview-record]")?.getAttribute("data-graview-record");return ye&&r.graph.getNode(ye)?{face:"pages",on:ye,about:[ye]}:m},[h,u,r,o,p]),f=(0,U.useCallback)((d,m)=>{let k=ni(d,"data-column"),R=k?.getAttribute("data-column")??"",q=R.indexOf(":");if(!k||q<=0||q===R.length-1)return;let te=R.slice(0,q),X=R.slice(q+1),ye=m.place===void 0?void 0:e.views?.places().find(Oe=>Oe.as===m.place),J=ni(k,"data-column-kind")?.getAttribute("data-column-kind")??ye?.kind??(m.about?.length===1&&m.about[0].startsWith("aggregate:")?oi(m.about[0]):void 0);if(!(J===void 0||!o.tryDefinition(J)))return{kind:J,field:te,value:X,label:k.getAttribute("data-column-label")??ze(X)}},[e.views,o]),P=(0,U.useCallback)(d=>{let m=t.current;if(m===null||!m.contains(d)||qt(d)||d.closest("[data-graview-popover]"))return null;let k=T(d);return{face:"pages",on:k.on,about:k.about??[],field:k.field,place:k.place,href:k.href,act:k.act,column:f(d,k),element:ri(d)}},[T,f,t]),M=(0,U.useRef)(null),I=(0,U.useRef)(null),v=(0,U.useCallback)((d,m,k,R=d,q=!1)=>{if(!q&&Wr(R)){let Oe=()=>v(d,m,k,R,!0);Ir().then(Oe,Oe);return}let te=T(d),X=f(R,te),ye=Dr(R);I.current=As(t.current);let J={...te,...X?{column:X}:{},...ye?{section:ye,title:ye.name}:{},x:Math.round(m),y:Math.round(k),returnTo:ri(d)};M.current=J,a(J)},[T,f,a,t]),[H,ee]=(0,U.useState)(null);(0,U.useEffect)(()=>{if(!H)return;let d=setTimeout(()=>ee(null),2400);return()=>clearTimeout(d)},[H]);let A=(0,U.useCallback)(d=>ee({sentence:d,at:Date.now()}),[]),C=(0,U.useCallback)(d=>{let m=d.getBoundingClientRect();v(d,m.left+Math.min(16,m.width/2),Math.min(m.bottom,m.top+36))},[v]),G=(0,U.useRef)(0),ne=(0,U.useRef)(null),ge=(0,U.useRef)(null),pe=(0,U.useRef)(!1),Re=()=>{ne.current&&clearTimeout(ne.current.timer),ne.current=null};(0,U.useEffect)(()=>Re,[]),(0,U.useEffect)(()=>{let d=m=>{if(m.defaultPrevented||!(m.key==="ContextMenu"||m.key==="F10"&&m.shiftKey))return;let k=t.current,R=m.target instanceof Element?m.target:null,q=R===null||R===document.body||R===document.documentElement,te=k!==null&&R!==null&&k.contains(R);if(!te&&!(q&&document.querySelector("[data-graview-face='pages']")===k)||qt(R)||R?.closest("[data-graview-popover]"))return;m.preventDefault(),G.current=Date.now();let X=te&&R instanceof HTMLElement?R:k?.querySelector("[data-graview-page-title], main h1, main")??null;X&&C(X)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,C]),(0,U.useEffect)(()=>{let d=t.current;if(!d)return;let m=k=>{let R=k.detail;R&&a({...R,face:"pages"})};return d.addEventListener(zn,m),()=>d.removeEventListener(zn,m)},[t,a]);let Me=(0,U.useMemo)(()=>d=>{if(d.face!=="pages")return null;let m=[],k=d.on===void 0?void 0:r.graph.getNode(d.on),R=d.place===void 0?void 0:e.views?.places().find(oe=>oe.as===d.place),q=k?void 0:d.about.length===1&&d.about[0].startsWith("aggregate:")&&!R?oi(d.about[0]):void 0,te=k?Z(o,k.kind,k.id):R?Se(e,R):q?`/${j(o,q)}`:void 0,X=te!==void 0&&s===te.split("?")[0];te!==void 0&&!X&&m.push({id:"open",label:"Open",run:()=>i(te)});let ye=te!==void 0?`${p}${te}`:d.href;ye!==void 0&&(m.push({id:"open-in-a-new-tab",label:"Open in a new tab",run:()=>void window.open(ye,"_blank","noopener")}),m.push({id:"copy-link",label:"Copy link",run:()=>ai(new URL(ye,location.href).href,A,"Link")}));let J=d.on===void 0?d.column:void 0;if(J){let oe=r.allMutations().find(nt=>nt.creates?.includes(J.kind)&&(Va(nt)?.includes(J.field)??!1));if(oe&&M.current){let nt=M.current;m.push({id:"add-in-column",label:`Add ${Xt(Je(o.tryDefinition(J.kind),J.kind))} in ${J.label}`,run:()=>a({...nt,begin:{act:oe.name,given:{[J.field]:J.value}}})})}let En=R?Se(e,R):`/${j(o,J.kind)}`;m.push({id:"show-only-column",label:`Show only ${J.label}`,run:()=>i(ct(En,{filter:`${J.field}:${J.value}`}))})}let Oe=k?`#focus=${encodeURIComponent(k.id)}`:R?`#focus=${encodeURIComponent(Ve(R.kind))}&view=${encodeURIComponent(R.as)}`:q?`#focus=${encodeURIComponent(Ve(q))}`:void 0;if(Oe!==void 0&&(e.overview||!e.embedded)){let oe=e.overview;m.push({id:"in-the-scene",label:"Show in the scene",run:()=>oe?oe(Oe):location.assign(`${e.sceneHref??"/"}${Oe}`)})}return k===void 0&&d.href===void 0&&m.push({id:"find",label:"Find\u2026",run:()=>{let oe=t.current?.querySelector('[data-testid="nav-find"]')??document.querySelector('[data-testid="nav-find"]');oe&&oe.offsetParent!==null?oe.focus():i("/search")}}),m.length>0?{id:"pages",items:m}:null},[r,o,e,s,p,i,t,A,a]),Pe=(0,U.useMemo)(()=>d=>{let m=I.current;return d.face!=="pages"||m===null?null:{id:"selection",at:"start",items:[{id:"copy-selection",label:"Copy",run:()=>ai(m,A,"Text")}]}},[A]),z=(0,U.useMemo)(()=>d=>{if(d.face!=="pages"||d.field===void 0||d.on===void 0)return null;let m=r.graph.getNode(d.on),k=d.element?.closest("[data-graview-field]")??t.current?.querySelector(`[data-graview-field="${CSS.escape(d.field)}"]`);return!m||!(k instanceof HTMLElement)||!k.hasAttribute("data-graview-editable")?null:{id:"field",at:"start",items:[{id:"change-field",label:`Change \u201C${Da(o.tryDefinition(m.kind),d.field)}\u201D`,run:()=>k.click()}]}},[r,o,t]),fe=xo(),_e=qr(),Be=lo(),tt=(0,U.useCallback)((d,m)=>{s===Se(e,d).split("?")[0]&&i(m?Se(e,m):"/")},[s,e,i]),Ke=Ao(tt),Ne=Co(),wt=(0,U.useMemo)(()=>[Pe,z,Be,Me,...Ke?[Ke]:[],..._e?[_e]:[],...Ne?[Ne]:[],...fe?[fe]:[]],[Pe,z,Be,Me,Ke,_e,Ne,fe]);return(0,xe.jsxs)(Fr,{sections:wt,children:[(0,xe.jsx)("div",{"data-graview-menu-ground":"",style:{display:"contents"},onContextMenu:d=>{let m=d.target,k=ge.current;ge.current=null,k!==null&&!k.had&&Date.now()-k.at<2e3&&!d.shiftKey&&!d.altKey&&!qt(m)&&getSelection()?.removeAllRanges(),!(d.shiftKey||d.altKey||qt(m)||ks(m))&&(d.preventDefault(),!m.closest("[data-graview-popover]")&&(Date.now()-G.current<700||(d.clientX===0&&d.clientY===0&&m instanceof HTMLElement?C(m):v(m,d.clientX,d.clientY,ti(d)))))},onMouseDownCapture:d=>{if(d.button!==2)return;let m=typeof getSelection=="function"?getSelection():null;ge.current={at:Date.now(),had:m!==null&&!m.isCollapsed}},onPointerDown:d=>{if(pe.current=!1,d.pointerType==="mouse"||!d.isPrimary)return;let m=d.target,k=ti(d);if(qt(m)||m.closest("[data-graview-choose], [data-graview-popover]"))return;let{clientX:R,clientY:q}=d;Ps(k,R,q)||(Re(),ne.current={x:R,y:q,timer:setTimeout(()=>{ne.current=null,pe.current=!0,G.current=Date.now(),v(m,R,q,k)},bs)})},onPointerMove:d=>{let m=ne.current;m&&Math.hypot(d.clientX-m.x,d.clientY-m.y)>vs&&Re()},onPointerUp:Re,onPointerCancel:Re,onClickCapture:d=>{pe.current&&(pe.current=!1,d.preventDefault(),d.stopPropagation())},children:n}),(0,xe.jsx)(Ts,{openAt:C,readyAt:P}),(0,xe.jsx)(Po,{placement:"page"}),(0,xe.jsx)(Vr,{}),(0,xe.jsx)(Ro,{}),(0,xe.jsx)("p",{role:"status","data-testid":"menu-said",style:H?Rs:Ls,children:H?.sentence??""})]})}var Rs={position:"fixed",left:"50%",bottom:24,transform:"translateX(-50%)",margin:0,padding:"6px 12px",borderRadius:8,fontSize:"0.875rem",background:"var(--graview-panel)",color:"var(--graview-ink)",border:"1px solid var(--graview-edge)",boxShadow:"var(--graview-lift-low)",zIndex:Ya("toast"),pointerEvents:"none"},Ls={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function oi(e){let t=e.slice(10).split("+");return t.length===1&&t[0]?t[0]:void 0}function Ts({openAt:e,readyAt:t}){return(0,xe.jsx)("span",{"data-graview-menu-home":"",tabIndex:-1,onFocus:n=>{if(n.target!==n.currentTarget)return;let a=n.currentTarget.closest("[data-graview-face]"),r=a?.querySelector("[data-graview-page-title]")??a?.querySelector("main h1, main")??null;r&&(r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0}))},style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:(0,xe.jsx)(bo,{placement:"menu",openActs:e,aimAt:t})})}var B=O(V(),1);function li(e,t){return t==="*"?{label:"anything",path:null}:{label:Y(e,t),path:`/${j(e.schema,t)}`}}function Es({context:e,relation:t}){let{store:n}=e,a=li(n,t.from),r=li(n,t.to),o=i=>i.path?(0,B.jsx)($,{to:i.path,style:{...Ce,fontWeight:550},children:i.label}):(0,B.jsx)("span",{children:i.label});return(0,B.jsxs)("li",{"data-testid":"relation","data-relation":t.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,B.jsx)(ko,{edgeKind:t.edgeKind,...e.brand?.kit?{kit:e.brand.kit}:{}}),(0,B.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,B.jsxs)("span",{children:[o(a)," ",(0,B.jsxs)("span",{style:L,"data-graview-speaks-ids":"",children:[ze(t.edgeKind)," \u2192"]})," ",o(r)]}),t.description||t.inverse?(0,B.jsxs)("span",{style:L,children:[t.description?He(t.description):null,t.description&&t.inverse?" \xB7 ":null,t.inverse?`from the other end, ${t.inverse}`:null]}):null]}),r.path?(0,B.jsx)($,{to:`${r.path}?with=${encodeURIComponent(t.edgeKind)}`,style:{..._,...L,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${r.label.toLowerCase()} that have this`,children:t.count}):(0,B.jsx)("span",{style:{...L,fontVariantNumeric:"tabular-nums"},children:t.count})]})}function di({context:e,heading:t=!0}){let{store:n}=e,a=new Set(Ue(n,e.principal)),r=gt(n).relations.filter(o=>a.has(o.from)&&(o.to==="*"||a.has(o.to)));return r.length===0?null:(0,B.jsxs)("section",{style:{...ce,display:"grid",gap:12},"data-testid":"kind-map",children:[t?(0,B.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,B.jsx)("h2",{style:ae,children:(0,B.jsx)($,{to:"/map",style:Ce,children:"Connections"})}),(0,B.jsx)("span",{style:L,children:r.length===1?"1 relation":`${r.length} relations`})]}):null,(0,B.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:r.map(o=>(0,B.jsx)(Es,{context:e,relation:o},`${o.edgeKind}|${o.from}|${o.to}`))})]})}function fa({context:e}){let{store:t}=e;re(t);let n=new Set(Ue(t,e.principal)),a=gt(t),r=a.relations.filter(o=>n.has(o.from));return(0,B.jsxs)(se,{context:e,children:[(0,B.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,B.jsx)("p",{style:Ae,children:r.length===0?"No relations":`${r.length} ${r.length===1?"relation":"relations"}`}),(0,B.jsx)(le,{context:e,children:"Connections"}),(0,B.jsx)("p",{style:de,children:r.length===0?"Nothing here is declared to relate to anything else yet.":"The kinds this installation holds, and the relations declared between them \u2014 each in the declaration's own words, with how many of it there are."})]}),(0,B.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:a.kinds.filter(o=>n.has(o.kind)).map(o=>(0,B.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,B.jsx)(we,{kind:o.kind,brand:e.brand,schema:t.schema,size:7}),(0,B.jsx)($,{to:`/${j(t.schema,o.kind)}`,style:_,children:o.plural}),(0,B.jsx)("span",{style:L,children:o.count})]},o.kind))}),(0,B.jsx)(di,{context:e,heading:!1})]})}function ci({context:e}){let n=[...me()?.robots.values()??[]].filter(r=>r.mode==="asking"&&r.say);if(n.length===0)return null;let{store:a}=e;return(0,B.jsxs)("section",{style:{...ce,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,B.jsx)("h2",{style:ae,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,B.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(r=>{let o=r.at?a.graph.getNode(r.at):void 0;return(0,B.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,B.jsx)("span",{children:r.say}),o?(0,B.jsxs)($,{to:Z(a.schema,o.kind,o.id),style:{..._,...L},children:[ie(a.schema.tryDefinition(o.kind),o)," \u2192"]}):null]},r.participant)})})]})}function ui(e){let t=new Set(e.schema.kinds);return(Array.isArray(e.purpose?.jobs)?e.purpose.jobs:[]).flatMap(a=>{if(typeof a!="object"||a===null||typeof a.name!="string"||typeof a.ask!="string"||!t.has(a.kind))return[];let r=Vn(a.sort);return[{name:a.name,ask:a.ask,kind:a.kind,plural:Ia(e.schema,a.kind),...a.where!==void 0?{where:a.where}:{},...r?{sort:r}:{},...a.act!==void 0?{act:a.act}:{},...a.roles&&a.roles.length>0?{roles:[...a.roles]}:{}}]})}function gi(e,t){return e.filter(n=>jr(n,t.roles))}var kn=new Map;function pi(e){if(!kn.has(e))try{kn.set(e,ar(e))}catch(t){if(!(t instanceof nr))throw t;kn.set(e,null)}return kn.get(e)}var Ms=e=>e instanceof Un?e.nodes.length>0:Array.isArray(e)?e.length>0:!!e,Ns=(e,t)=>t instanceof Un?t.nodes.length:t!==null&&typeof t=="object"&&!Array.isArray(t)?ie(e.tryDefinition(t.kind),t):t;function mi(e,t,n){let a=e;if(a.kindsKeptFrom(n).has(t.kind)||!a.schema.tryDefinition(t.kind))return{count:0,ids:[]};let r=a.seenBy(n),o=r.graph,i=r.schema,s=Or(i),l=r.today?.(),p=(P,M)=>tr(P,{graph:o,subject:M,kinds:s,...l?{today:l}:{}}),g=t.where===void 0?void 0:pi(t.where);if(g===null)return{count:0,ids:[]};let S=o.nodesOfKind(t.kind).filter(P=>{if(!g)return!0;try{return Ms(p(g,P))}catch(M){if(!(M instanceof _n))throw M;return!1}}),u=Vn(t.sort),h=u&&u.by!=="label"?pi(u.by):void 0,f=(u?za(S,u,P=>{if(u.by==="label")return ie(i.tryDefinition(P.kind),P);if(h)try{return Ns(i,p(h,P))}catch(M){if(!(M instanceof _n))throw M;return}}):S).map(P=>P.id);return{count:f.length,ids:f}}var xn=O(Le(),1);var Q=O(V(),1),Os=5,$s=3,yi={kind:"human"};function hi(e){if(!e.app)return[];let t=e.principal??yi;return gi(ui(e.app),t).map(n=>({job:n,...mi(e.store,n,t)}))}function wi({context:e,answered:t}){let n=t.filter(i=>i.count>0),a=t.filter(i=>i.count===0),[r,...o]=n;return(0,Q.jsxs)("div",{style:{display:"grid",gap:40,maxWidth:"46rem",outline:"none"},"data-testid":"jobs",tabIndex:-1,children:[(0,Q.jsx)("style",{children:Lt}),r?(0,Q.jsx)(fi,{context:e,answered:r,leads:!0}):null,o.map(i=>(0,Q.jsx)(fi,{context:e,answered:i},i.job.name)),a.length>0?(0,Q.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"jobs-quiet",children:a.map(({job:i})=>(0,Q.jsxs)("li",{"data-testid":"job-quiet","data-job":i.name,style:{overflowWrap:"anywhere"},children:[i.ask," ",(0,Q.jsxs)("span",{style:L,children:["No ",Y(e.store,i.kind).toLowerCase()," right now."]})]},i.name))}):null]})}function fi({context:e,answered:t,leads:n=!1}){let{store:a}=e,{job:r,count:o,ids:i}=t,s=i.slice(0,n?Os:$s),l=Y(a,r.kind),p=n?(0,Q.jsx)(le,{context:e,"data-testid":"job-ask",children:r.ask}):(0,Q.jsx)("h2",{style:ae,"data-testid":"job-ask",children:r.ask});return(0,Q.jsxs)("section",{className:"graview-list",style:{display:"grid",gap:n?12:8,minWidth:0},"data-testid":"job","data-job":r.name,...n?{"data-leads":""}:{},children:[(0,Q.jsxs)("header",{style:{display:"grid",gap:4},children:[p,(0,Q.jsx)("p",{style:{...n?de:L,margin:0},"data-testid":"job-count",children:vt(a.schema,r.kind,o)})]}),(0,Q.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",borderBottom:"1px solid var(--graview-edge)"},"data-testid":"job-rows",children:s.map(g=>(0,Q.jsx)(Hs,{context:e,job:r,id:g},g))}),(0,Q.jsxs)("p",{style:{...L,margin:0,display:"flex",flexWrap:"wrap",gap:"0 12px",alignItems:"baseline"},children:[o>s.length?(0,Q.jsxs)("span",{"data-testid":"job-more",children:[o-s.length," more"]}):null,(0,Q.jsx)($,{to:`/${j(a.schema,r.kind)}`,style:je,"data-testid":"job-all",children:(0,Q.jsxs)(Qe,{children:["All ",l.toLowerCase()]})})]})]})}function Hs({context:e,job:t,id:n}){let{store:a,principal:r,invariantContext:o}=e,[i,s]=(0,xn.useState)(!1),l=(0,xn.useRef)(null),p=a.seenBy(r??yi).graph.getNode(n);if(!p)return null;let g=a.schema.tryDefinition(p.kind),S=ie(g,p),u=It(p,g,S),h=t.act?wn(a,n,{...r?{principal:r}:{},...o?{context:o}:{}})?.actions.affordances.find(P=>P.mutation===t.act&&P.provider!=="invariant"):void 0,T=h?a.allMutations().find(P=>P.name===h.mutation):void 0,f=`job-${t.name}-${n}`;return(0,Q.jsxs)("li",{ref:l,"data-testid":"job-row","data-graview-record":n,style:{position:"relative",display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"center",gap:"8px 12px",minHeight:"2.75rem",padding:"8px 0",borderTop:"1px solid var(--graview-edge)"},children:[(0,Q.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,Q.jsx)($,{to:Z(a.schema,p.kind,n),className:"graview-row-title",...S.length>60?{title:S}:{},children:S}),u.length>0?(0,Q.jsx)("span",{className:"graview-row-glance",children:(0,Q.jsx)(Dt,{runs:u})}):null]}),h&&T?(0,Q.jsx)("button",{type:"button","data-testid":"job-act","data-graview-act":h.mutation,"aria-expanded":i,"aria-controls":f,"aria-label":`${h.label}: ${S}`,onClick:()=>s(!i),style:{...ve,position:"relative",...i?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:h.label}):null,i&&h&&T?(0,Q.jsx)("div",{id:f,style:{gridColumn:"1 / -1",position:"relative",display:"grid",gap:10,padding:"4px 0 8px"},children:(0,Q.jsx)($e,{store:a,mutation:T,prefilled:h.args,open:h.open,label:h.label,autoFocus:!0,onDone:()=>{let P=l.current?.closest('[data-testid="jobs"]');s(!1),requestAnimationFrame(()=>{((l.current?.isConnected?l.current.querySelector('[data-testid="job-act"]'):null)??P?.querySelector('[data-testid="job-act"]')??P)?.focus()})},...r?{principal:r}:{}})}):null]})}var F=O(V(),1);function Fs({violations:e}){let t=e.some(n=>n.status==="could-not-judge"||n.status==="over-budget");return(0,F.jsxs)($,{to:"/problems","data-testid":"problems-here","data-graview-problems-tone":t?"error":"rule",style:{..._,color:t?"var(--graview-warn)":"var(--graview-ink-muted)"},children:[e.length===1?"A rule is broken":"Rules are broken"," \u2014 see what, and what would fix it"]})}function Is(e,t=5){let n=[],a=0;for(let r=e.length-1;r>=0;r--){let o=e[r];if(kt(o))a++;else if(n.length<t)n.push(o);else break}return{recent:n,kept:a}}function ya({context:e}){let{principal:t}=e,{store:n,brand:a,invariantContext:r}=e;re(n);let o=n.violations(r),{recent:i,kept:s}=Is(n.log.all()),p=yn(e).map(C=>({kind:C,members:n.graph.nodesOfKind(C).filter(G=>lt(n.schema.tryDefinition(C),G))})),g=p.filter(C=>C.members.length>0),S=p.map(C=>({entry:C,creator:n.allMutations().find(G=>(G.creates??[]).includes(C.kind)&&n.permits({name:G.name,args:{}},e.principal).ok)})).find(C=>C.creator!==void 0),u=g.length===0?"Nothing here yet.":`${g.map(C=>vt(n.schema,C.kind,C.members.length)).join(", ").replace(/, ([^,]*)$/," and $1")}.`,h=e.views?.homeView?.(),T=n.schema.kinds.some(C=>n.graph.nodesOfKind(C).length>0);if(h&&T){let C=[...new Set(o.flatMap(ge=>ge.nodeIds))],G=a?.subtitle&&a.subtitleDrawn!==!1?(0,F.jsx)("p",{style:{...L,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,ne=h[Symbol.for("graview.home-blocks")]===!0;return(0,F.jsx)(se,{context:e,style:Rt,bleedTop:Ye(h),children:(0,F.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[ne?null:G,(0,F.jsx)(yo.Provider,{value:ne?G:null,children:(0,F.jsx)(ot,{when:Ye(h),children:(0,F.jsx)(h,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1,...C.length>0?{flagged:C}:{}})})})]})})}let f=new Set(Ue(n,e.principal)),P=gt(n).relations.filter(C=>f.has(C.from)&&(C.to==="*"||f.has(C.to))),M=hi(e),I=M.some(C=>C.count>0),v=new Set([...zo(e),...M.flatMap(C=>C.ids)]),H=o.filter(C=>C.nodeIds.some(G=>v.has(G))),A=g.length===0&&S!==void 0||H.length>0||o.length===0&&!I;return(0,F.jsxs)(se,{context:e,style:Rt,children:[(0,F.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle&&a.subtitleDrawn!==!1?(0,F.jsx)("p",{style:{...L,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,I?null:(0,F.jsx)(le,{context:e,"data-testid":"standing",children:u}),A?(0,F.jsxs)("p",{style:{...de,display:"grid",gap:4},"data-testid":"standing-card",children:[g.length===0&&S?(0,F.jsxs)("span",{children:["Begin with \u201C",S.creator?.title??S.creator?.name,"\u201D, under"," ",(0,F.jsx)($,{to:`/${j(n.schema,S.entry.kind)}`,style:_,children:Y(n,S.entry.kind)}),"."]}):null,o.length===0?(0,F.jsx)("span",{children:"All rules hold."}):H.length>0?(0,F.jsx)(Fs,{violations:H}):null]}):null]}),M.length>0?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(wi,{context:e,answered:M}),(0,F.jsxs)("section",{style:{display:"grid",gap:20},"data-testid":"after-the-jobs",children:[I?(0,F.jsxs)("p",{style:{...L,margin:0},"data-testid":"standing",children:[u,o.length===0?" All rules hold.":""]}):null,(0,F.jsx)(bn,{context:e,small:!0})]})]}):(0,F.jsx)(bn,{context:e}),(0,F.jsxs)("section",{style:{...ce,display:"grid",gap:14},"data-testid":"kinds",children:[(0,F.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,F.jsx)("h2",{style:ae,children:"What is here"}),P.length>0?(0,F.jsx)($,{to:"/map",style:{...je,...L,marginLeft:"auto"},"data-testid":"map-link",children:(0,F.jsxs)(Qe,{children:["Connections \xB7 ",P.length===1?"1 relation":`${P.length} relations`]})}):null]}),(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:p.map(({kind:C,members:G})=>(0,F.jsx)("li",{style:{maxWidth:"100%"},children:(0,F.jsxs)($,{to:`/${j(n.schema,C)}`,style:{...Ce,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,F.jsx)(we,{kind:C,brand:a,schema:n.schema,size:7}),(0,F.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:Y(n,C)}),(0,F.jsx)("span",{style:{...L,fontVariantNumeric:"tabular-nums"},children:G.length===0?"none yet":bt(G.length)})]})},C))})]}),i.length>0||s>0?(0,F.jsxs)("section",{style:{...ce,display:"grid",gap:10},"data-testid":"recently",children:[(0,F.jsx)("h2",{style:ae,children:"Recently"}),i.length>0?(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:i.map(C=>(0,F.jsxs)("li",{style:L,"data-testid":"recently-row",children:[(0,F.jsx)("span",{style:{color:"var(--graview-ink)"},children:C.intent})," \u2014 ",Ft(C,t,{graph:n.graph,schema:n.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},C.id))}):null,s>0?(0,F.jsxs)("p",{style:{...L,margin:0},"data-testid":"recently-kept",children:[i.length>0?"and ":"",s===1?"1 change":`${bt(s)} changes`," kept from you"]}):null]}):null]})}var Si=O(Le(),1);function bi(e,t){(0,Si.useEffect)(()=>{let n=globalThis[Symbol.for("graview.shown-lists")]??=new Map;return n.set(e,()=>t),()=>void n.delete(e)})}var ha=e=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(t=>t.saveShownList(e.read()));function vi(e,t,n){let a={off:e,about:t,read:n,menu:(r,o,i)=>[...e?[]:[{id:"export-csv",label:"Export CSV",run:()=>void ha(a)}],...r&&o?[{id:e?"export-on":"export-off",label:e?"Turn on export":"Turn off export",run:()=>void (__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(s=>s.switchExport(a,o,e,i))}]:[]]};return a}function wa(e){let{schema:t,graph:n,kind:a,nodes:r,arrangement:o,offers:i,declaredGroup:s}=e,l=t.tryDefinition(a),p=ln(o.query??""),g=[...o.filter??[],...p.conditions],S=g.some(A=>A.key==="is"&&(A.value==="past"||A.value==="any"))||Yr(l,g),u=S||!l?.lifecycle?o:{...o,filter:[...o.filter??[],{key:"is",value:"current"}]},h=new Map,T=cn(r,u,{schema:t,graph:n,...e.flagged?{flagged:e.flagged}:{},...e.today!==void 0?{today:e.today}:{},read:(A,C)=>{let G=h.get(A.id);return G||h.set(A.id,G=dt(t,n,A)),G[C]}}),f=T.grouped&&!!o.group?.by,P=s&&o.group?.by===s.by&&!o.group.bucket?i.groups.find(A=>A.key===s.by):void 0,M=s&&P&&(P.type==="choice"||P.type==="boolean")?Jr(T.groups,s,{type:P.type,...P.options?{options:P.options}:{}}):T.groups.map(A=>({...A,closed:!1})),I=!!o.query||(o.filter??[]).some(A=>A.key===s?.by),v=A=>P?.type==="boolean"?A==="1"?"true":"false":A,H=e.opened??new Set,ee=M.map(A=>{let C=v(A.key);return{...A,value:C,shut:A.closed&&!I&&!H.has(C)}});return{arrangement:u,showingPast:S,arranged:T,grouped:f,groups:ee,nodes:f?ee.flatMap(A=>A.shut?[]:A.nodes):T.nodes}}var De=O(Le(),1);var ht=O(V(),1);function Pn({context:e,withheld:t,style:n,testId:a}){let r=me(),o=_a(t,e.signIn??r?.signIn);return o?(0,ht.jsx)("p",{style:{...n,margin:0},children:(0,ht.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>o.run(),style:ve,children:o.label})}):t.length===0?null:(0,ht.jsx)("ul",{style:{...n,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},...a?{"data-testid":a}:{},children:t.map(i=>(0,ht.jsxs)("li",{style:L,children:[(0,ht.jsx)("s",{children:i.label})," \u2014 ",i.refusal.message]},i.id))})}var ki=O(Le(),1);var N=O(V(),1);function Sa({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;re(t);let[o]=Tt(),i=o.get("q")??"",s=typeof r?.today=="string"?r.today:void 0,l=ao(t,i,{...a?{principal:a}:{},places:Ge(e),flagged:new Set(t.violations(r).flatMap(f=>f.nodeIds)),...s?{today:s}:{},limit:200}),p=l.hits.filter(f=>f.about==="node"),g=l.hits.filter(f=>f.about==="kind"||f.about==="place"||f.about==="rule"),S=[...new Set(p.map(f=>f.kind))],u=i.trim(),h=u.length>=2&&l.hits.length===0,T=l.searched.kinds.length===1?l.searched.kinds[0]:void 0;return(0,ki.useEffect)(()=>{if(!h)return;let f=setTimeout(()=>Qa(t,{type:"search-miss",words:u,...T?{kind:T}:{}},a),Ds);return()=>clearTimeout(f)},[t,u,h,T,a]),(0,N.jsxs)(se,{context:e,children:[(0,N.jsx)("style",{children:Lt}),(0,N.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,N.jsx)("p",{style:Ae,children:"Search"}),(0,N.jsx)(le,{context:e,"data-testid":"search-heading",children:u.length===0?"Find anything by its name":l.hits.length===0?(0,N.jsxs)(N.Fragment,{children:["Nothing here is called \u201C",u,"\u201D."]}):(0,N.jsxs)(N.Fragment,{children:[Ws(t,l.byKind)," for \u201C",u,"\u201D"]})}),u.length>0?(0,N.jsxs)("p",{style:{...L,margin:0},"data-testid":"search-searched",children:[dn(t.schema,l.searched),l.conditions.filter(f=>f.key!=="is"&&f.admittedBy.length<l.searched.kinds.length).map(f=>(0,N.jsxs)("span",{children:[" ",f.key,":",f.value," narrows"," ",f.admittedBy.length===0?"nothing here":f.admittedBy.map(P=>Y(t,P).toLowerCase()).join(" and "),"."]},`${f.key}:${f.value}`))]}):(0,N.jsxs)("p",{style:de,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,N.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,N.jsx)("code",{children:"is:any"})," includes what is past."]})]}),g.length>0?(0,N.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:g.map(f=>(0,N.jsx)("li",{"data-testid":"search-hit","data-about":f.about,children:f.about==="kind"?(0,N.jsxs)($,{to:`/${j(t.schema,f.kind)}`,style:_,children:[f.label,f.count>0?(0,N.jsxs)("span",{style:L,children:[" \xB7 ",f.count," match"]}):null]}):f.about==="place"?(0,N.jsxs)($,{to:Se(e,f),style:_,children:["Go to ",f.title]}):f.about==="rule"?(0,N.jsxs)($,{to:"/problems",style:_,children:["The rule \u201C",f.label,"\u201D"]}):null},`${f.about}:${f.about==="rule"?f.name:f.about==="place"?f.as:f.kind}`))}):null,S.map(f=>(0,N.jsxs)("section",{className:"graview-list",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},"data-testid":"search-group","data-kind":f,children:[(0,N.jsxs)("h2",{className:"graview-group-head",style:{alignItems:"center"},children:[(0,N.jsx)(we,{kind:f,brand:n,schema:t.schema,size:8}),(0,N.jsx)($,{to:`/${j(t.schema,f)}?${new URLSearchParams({q:u}).toString()}`,style:_,"data-testid":"search-kind-link",children:Y(t,f)}),(0,N.jsx)("span",{children:l.byKind[f]})]}),(0,N.jsx)("ul",{className:"graview-rows",children:p.filter(P=>P.kind===f).map(P=>(0,N.jsxs)("li",{"data-testid":"search-hit","data-about":"node",className:"graview-row",children:[(0,N.jsxs)($,{to:Z(t.schema,f,P.id),className:"graview-row-title",...P.label.length>60?{title:P.label}:{},children:[P.flagged?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,P.label]}),P.apart||!P.current?(0,N.jsx)("span",{className:"graview-row-glance",children:[P.apart,P.current?"":"past"].filter(Boolean).join(" \xB7 ")}):null,(0,N.jsx)(An,{why:P.why})]},P.id))})]},f)),u.length>0?(0,N.jsx)(Gs,{asked:u}):null,u.length>0&&l.hits.length===0?(0,N.jsx)(Pi,{store:t,kinds:l.searched.kinds,words:l.words,...a?{principal:a}:{},...r?{invariantContext:r}:{}}):null]})}var Ds=1500;function An({why:e}){return e.strength==="near"?(0,N.jsxs)("span",{style:L,"data-testid":"search-why","data-near":"",children:["Near \u201C",e.asked,"\u201D",e.field==="label"?"":` \u2014 ${e.reading}: ${e.fragment}`]}):e.field==="label"?null:(0,N.jsxs)("span",{style:L,"data-testid":"search-why",children:[e.reading,": ",e.fragment]})}function Ws(e,t){let n=Object.entries(t).map(([a,r])=>`${r} ${r===1?Je(e.schema.tryDefinition(a),a):Y(e,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?He(n[0]):He(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function xi(e,t,n={}){let a=[];for(let r of t){let o=ut(e,r,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let i of Cn(e,r,o.actions.affordances))a.some(s=>s.mutation.name===i.mutation.name)||a.push(i)}return a}function Cn(e,t,n){let a=e.schema.tryDefinition(t)?.fieldRoles?.label,r=[];for(let o of n){let i=e.allMutations().find(p=>p.name===o.mutation);if(!i||!i.creates?.includes(t)||r.some(p=>p.mutation.name===i.name))continue;let s=Ur(i.input).map(p=>p.name),l=s.includes("label")?"label":a&&s.includes(a)?a:void 0;!l||o.args[l]!==void 0||r.push({kind:t,affordance:o,mutation:i,arg:l})}return r}function Pi({store:e,kinds:t,words:n,principal:a,invariantContext:r}){let o=xi(e,t,{...a?{principal:a}:{},...r?{invariantContext:r}:{}});return o.length===0||n.trim().length===0?null:(0,N.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:o.map(({kind:i,affordance:s,mutation:l,arg:p})=>(0,N.jsxs)("section",{style:{...ce,display:"grid",gap:14},children:[(0,N.jsxs)("h2",{style:ae,children:[He(Xt(Je(e.schema.tryDefinition(i),i)))," called \u201C",n,"\u201D"]}),(0,N.jsx)($e,{store:e,mutation:l,prefilled:s.args,open:s.open,initial:{[p]:n},...a?{principal:a}:{}})]},`${s.id}|${n}`))})}function Gs({asked:e}){let t=me();return t?(0,N.jsx)(Bs,{asked:e,desk:t.aiDesk}):null}function Bs({asked:e,desk:t}){return wr(t)?(0,N.jsx)("p",{style:{margin:0},children:(0,N.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:a=>hr(t,{pointed:{about:[]},asked:e,returnTo:a.currentTarget}),style:{..._,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",e,"\u2019"]})}):null}var y=O(V(),1),Ci=8,Ri=40;function Ks(e,t){let n=t?.fields?.shape??{},a=Object.keys(n).find(r=>Ga(n[r])&&Wa(e[r]));return a===void 0?void 0:e[a]}function ba({context:e}){let t=rt(),n=Te(e.store.schema,t.slug??"");if(!n)return(0,y.jsx)(se,{context:e,children:(0,y.jsx)(le,{context:e,children:"No such kind of thing here."})});let a=e.views?.lookup(n,{cardinality:"many",fidelity:"full"});return a!==void 0&&At(a)?(0,y.jsx)(qs,{context:e,kind:n,view:a}):(0,y.jsx)(Li,{context:e,kind:n})}function qs({context:e,kind:t,view:n}){let{store:a,invariantContext:r}=e;re(a);let o=a.schema.tryDefinition(t),i=Y(a,t),s=a.graph.nodesOfKind(t).filter(p=>lt(o,p)),l=[...new Set(a.violations(r).flatMap(p=>p.nodeIds))];return(0,y.jsxs)(se,{context:e,children:[(0,y.jsxs)("header",{style:{display:"grid",gap:4},children:[(0,y.jsx)(mt,{context:e}),(0,y.jsx)(le,{context:e,children:i})]}),(0,y.jsx)("section",{"data-testid":"list-view",style:{display:"grid",minWidth:0},children:(0,y.jsx)($t,{kind:t,view:i,children:(0,y.jsx)(ot,{when:Ye(n),children:(0,y.jsx)(n,{nodes:s,label:i,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...l.length>0?{flagged:l}:{}})})})})]})}function Li({context:e,kind:t,opening:n,row:a,layout:r="list",description:o,bare:i}){let{store:s,brand:l,invariantContext:p}=e;re(s);let[g,S]=Tt(),u=`list-${(0,De.useId)().replace(/:/g,"")}`,h=s.schema.tryDefinition(t),T=Ka(g.get("archived")),f=s.graph.nodesOfKind(t,{archived:T}),P=gt(s).relations.filter(c=>c.from===t||c.to===t),M=new Set(s.violations(p).flatMap(c=>c.nodeIds)),I=Zr(s.schema,Xr(s.schema,Qr(s.schema,t))),v=P.map(c=>c.edgeKind),H=Js(g,I,v),ee=["sort","filter","group","q","by","with","past","archived",...v].some(c=>g.has(c)),A=f.length>=Ri,C=h?.fieldRoles?.when,G=e.views?.arrangement?.()?.lists?.[t],ne=zr(G),ge=_r(G?.group),pe=zs(A,C),Re=n??(ne?{...pe,...ne}:pe),Me=ee?H.arrangement:ea(Re,I).arrangement,Pe=ne?.sort,z=Me.sort&&Pe?.then&&Me.sort.by===Pe.by&&Me.sort.direction===Pe.direction?{...Me,sort:Pe}:Me,fe=ln(z.query??""),_e=new Set((g.get("open")??"").split(",").filter(Boolean)),Be=wa({schema:s.schema,graph:s.graph,kind:t,nodes:f,arrangement:z,offers:I,declaredGroup:ge,flagged:M,...typeof p?.today=="string"?{today:p.today}:{},opened:_e}),{showingPast:tt,arranged:Ke}=Be,Ne=Be.groups,wt=me(),d=vi(G?.export===!1,{kind:t},()=>({title:Y(s,t),schema:s.schema,graph:s.graph,kind:t,groups:Be.groups,grouped:Be.grouped,onExport:e.onExport??wt?.onExport,words:{labelOf:ie,readableFields:rn,withComputed:dt}}));bi(`list:${t}`,d);let m=c=>c.shut,k=c=>{let w=new URLSearchParams(g),D=new Set(_e);D.has(c)?D.delete(c):D.add(c),D.size>0?w.set("open",[...D].join(",")):w.delete("open"),S(w,{replace:!0})},R=Ke.nodes,q=h?.lifecycle&&!tt?f.filter(c=>lt(h,c)):f,te=f.length-q.length,X=z.group?.by??null,ye=c=>{let w=new URLSearchParams(g);for(let he of["sort","filter","group","q","by","with","past","archived",...P.map(Yt=>Yt.edgeKind)])w.delete(he);let D=ro(c);for(let he of["sort","filter","group","q","archived"])D[he]&&w.set(he,D[he]);![...w.keys()].some(he=>["sort","filter","group","q"].includes(he))&&(n||ne||A||C)&&w.set("sort",""),S(w)},{principal:J}=e,Oe=ut(s,t,{...J?{principal:J}:{},...e.invariantContext?{context:e.invariantContext}:{}}),oe=Oe.actions.affordances.map(c=>({affordance:c,mutation:s.allMutations().find(w=>w.name===c.mutation)})).filter(c=>c.mutation!==void 0),En=Oe.actions.withheld,nt=()=>new Set(R.length===0?oe.map(({mutation:c})=>c.name):[]),[Mn,Pa]=(0,De.useState)(()=>({kind:t,open:nt()}));Mn.kind!==t&&Pa({kind:t,open:nt()});let Aa=c=>(Mn.kind===t?Mn.open:nt()).has(c),Ca=(c,w)=>Pa(D=>{let he=new Set(D.open);return w?he.add(c):he.delete(c),{kind:D.kind,open:he}}),Ra=`begin-${(0,De.useId)().replace(/:/g,"")}`,La=fe.words&&R.length===0?Object.fromEntries(Cn(s,t,Oe.actions.affordances).map(c=>[c.mutation.name,c.arg])):{},st=Y(s,t),jt=e.views?.lookup(t,{cardinality:"one",fidelity:"glyph"}),Nn=jt!==void 0&&!Pt(jt)?jt:void 0,On=(z.group?.bucket??"day")==="day"?z.group?.by:void 0,$n=(z.filter??[]).map(c=>c.key),Hi=$n.filter(c=>$n.indexOf(c)===$n.lastIndexOf(c)&&/choice|boolean/.test(I.filters.find(w=>w.key===c)?.type??"")),Hn=c=>{let w={...h?.computed?dt(s.schema,s.graph,c):c};On&&!String(w[On]).includes("T")&&delete w[On];for(let D of Hi)delete w[D];return w},Ta=c=>Tr(h?.fields?.shape?.[c])?.type==="enum",Ut=c=>{let w=ie(h,c);if(a)return(0,y.jsxs)("li",{"data-testid":"record-row","data-graview-record":c.id,style:{minWidth:0},...Bn(c.id),children:[Gn(c,w),a(c,{label:w,href:Z(s.schema,t,c.id),flagged:M.has(c.id),glance:$o(Hn(c),h,w)})]},c.id);if(Nn){let Kn=gn(jt,c,s.graph),Bi=Object.fromEntries(Object.entries(Hn(c)).filter(([Ki])=>!Kn?.fields.has(Ki))),Ha=Kn?It(Bi,h,Kn.title??w,Ta):[];return(0,y.jsxs)("li",{"data-testid":"record-row","data-graview-record":c.id,style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,paddingBlock:10,borderTop:"1px solid var(--graview-edge)"},...Bn(c.id),children:[Gn(c,w),(0,y.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,y.jsx)(Nn,{node:c,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...M.has(c.id)?{flagged:[c.id]}:{}})}),Ha.length>0?(0,y.jsx)("span",{style:{...L,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:(0,y.jsx)(Dt,{runs:Ha})}):null,(0,y.jsx)(Xs,{to:Z(s.schema,t,c.id),label:M.has(c.id)?`${w} \u2014 implicated in a problem`:w})]},c.id)}let D=It(Hn(c),h,w,Ta),he=D.length>0,Yt=fe.words?no(h,c,fe.words):void 0,Oa=A?void 0:Er(c,h),Qt=Ks(c,h),$a=(0,y.jsxs)($,{to:Z(s.schema,t,c.id),className:"graview-row-title",...w.length>60?{title:w}:{},children:[M.has(c.id)?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,w]});return(0,y.jsxs)("li",{className:"graview-row","data-graview-record":c.id,...Bn(c.id),children:[Gn(c,w),Oa?(0,y.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,y.jsx)(Ct,{as:"thumb",file:Oa}),$a]}):$a,he||Qt?(0,y.jsxs)("span",{className:"graview-row-glance",children:[(0,y.jsx)(Dt,{runs:D}),he&&Qt?" \xB7 ":null,Qt?(0,y.jsx)(pn,{address:Qt}):null]}):null,Yt?(0,y.jsx)(An,{why:Yt}):null]},c.id)},Fn=Ge(e).filter(c=>c.kind===t&&!c.hidden),Ea=G?.filters,Fi=(z.filter??[]).some(c=>c.key!=="is"||c.value!=="any"),Ii=!!(z.sort||z.group||z.query||Fi),Di=q.length>=Ci||ee&&Ii,qe=z.sort?I.sorts.find(c=>c.key===z.sort.by):void 0,In=qe?.type==="date"||qe!==void 0&&qe.key===C,Ma=A&&!Ke.grouped&&qe&&(qe.about==="label"||qe.type==="text"||In)?c=>{let w=qe.about==="label"?ie(h,c):c[qe.key];if(typeof w!="string"||w.length===0)return In?"No date":"#";if(In)return w.slice(0,4);let D=w.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(D)?D:"#"}:void 0,_t=Ma?R.reduce((c,w)=>{let D=Ma(w);return c.at(-1)?.key===D?c.at(-1).nodes.push(w):c.push({key:D,nodes:[w]}),c},[]):void 0,Na=Be.nodes,Dn=(0,De.useMemo)(()=>Na.map(c=>c.id),[Na.map(c=>c.id).join(`
|
|
6
|
+
`)]),We=co(Dn),Wn=(0,De.useId)(),Mt=(J?s.permittedMutations(J):s.permittedMutations()).some(c=>{let w=c.subject?.kinds;return w!==void 0&&(w==="*"||w.includes(t))}),Gn=(c,w)=>Mt?(0,y.jsx)("span",{className:"graview-choose-at",children:(0,y.jsx)("input",{...We.boxProps(c.id,w),onPointerEnter:ta,onFocus:ta})}):null,Bn=c=>Mt?{"data-graview-choose":c}:{},Wi=(0,De.useCallback)(c=>{We.choose(c),requestAnimationFrame(()=>{let w=We.list.current;((c[0]===void 0?null:w?.querySelector(`[data-graview-choose-box="${CSS.escape(c[0])}"]`))??w)?.focus({preventScroll:!0})})},[We]),St=r==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||Nn?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&r==="list"?6:0}:void 0,zt=St?void 0:"graview-rows",Nt=c=>`list-at-${c.replace(/[^\p{L}\p{N}]/gu,"_")}`,Jt=P.map(c=>{let w=c.from===t?c.to:c.from,D=c.from===t?c.description:c.inverse??c.description;return{relation:c,far:w,words:D}}),Gi=new Set(Jt.map(c=>(c.words??"").toLowerCase()).filter((c,w,D)=>c&&D.indexOf(c)!==w));return(0,y.jsxs)(i?_s:se,{context:e,children:[(0,y.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,y.jsxs)("header",{style:{display:"grid",gap:4},children:[i?null:(0,y.jsx)(mt,{context:e}),(0,y.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:10,rowGap:4,minWidth:0},children:[(0,y.jsx)(we,{kind:t,brand:l,schema:s.schema,size:8}),(0,y.jsx)(le,{context:e,children:st}),oe.length>0?(0,y.jsx)("span",{style:{marginLeft:"auto",display:"flex",flexWrap:"wrap",columnGap:14,rowGap:8},"data-testid":"beginnings-open",children:oe.map(({affordance:c,mutation:w})=>(0,y.jsx)(Ys,{name:w.name,title:w.title??w.name,panel:`${Ra}-${w.name}`,open:Aa(w.name),onOpen:D=>Ca(w.name,D)},c.id))}):null,!d.off&&q.length>0?(0,y.jsxs)("button",{type:"button","data-testid":"list-export","aria-label":"Export CSV",title:"Export CSV",onClick:()=>void ha(d),style:{...Ce,minHeight:28,margin:"-4px 0",...oe.length>0?{}:{marginLeft:"auto"},padding:"0 2px",border:0,background:"none",font:"inherit",color:"var(--graview-ink-muted)",cursor:"pointer"},children:[(0,y.jsx)("span",{"aria-hidden":"true",style:{marginRight:4},children:"\u2193"}),"CSV"]}):null]}),R.length>0?(0,y.jsx)(Mo,{place:"here",to:[{label:`Skip to the ${R.length===1?Je(h,t):`${R.length} ${st.toLowerCase()}`}`,testid:"records",go:()=>{let c=document.querySelector(`[data-graview-skip-target="${CSS.escape(Wn)}"]`);na(c?.querySelector('[data-graview-choose-box][tabindex="0"]')??c)}},...q.length>0?[{label:"Skip to arranging them",testid:"arranging",go:()=>{let c=document.querySelector(`[data-graview-skip-target="${CSS.escape(Wn)}"]`)?.parentElement?.querySelector('[role="group"][aria-label="Arrange"]');na(c?.querySelector('button[data-testid$="-add"], button[data-testid$="-all"]')??c)}}]:[]]}):null,o??h?.description?(0,y.jsx)("p",{style:de,children:o??h?.description}):null,Jt.length>0||Fn.length>0?(0,y.jsxs)("p",{style:{...L,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[Jt.length>0?(0,y.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",Jt.map(({relation:c,far:w,words:D},he)=>(0,y.jsxs)("span",{"data-relation":c.edgeKind,children:[he>0?(0,y.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,w==="*"?He(D??ze(c.edgeKind)):(0,y.jsx)($,{to:`/${j(s.schema,w)}`,style:_,title:Y(s,w),children:D&&Gi.has(D.toLowerCase())?`${He(D)}: ${Y(s,w).toLowerCase()}`:He(D??Y(s,w))})]},`${c.edgeKind}|${c.from}|${c.to}`))]}):null,Fn.length>0?(0,y.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",Fn.map((c,w)=>(0,y.jsxs)("span",{children:[w>0?(0,y.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,y.jsx)($,{to:Se(e,c),style:_,children:c.title})]},ft(c)))]}):null]}):null]}),oe.length>0?(0,y.jsx)("div",{style:{display:"contents"},"data-testid":"beginnings",children:oe.map(({affordance:c,mutation:w})=>{let D=!!(La[w.name]&&R.length===0);return(0,y.jsx)(Qs,{name:w.name,id:`${Ra}-${w.name}`,description:w.description,open:Aa(w.name),onClose:()=>Ca(w.name,!1),children:(0,y.jsx)($e,{store:s,mutation:w,prefilled:c.args,open:c.open,...D?{initial:{[La[w.name]]:fe.words}}:{},...e.principal?{principal:e.principal}:{}},D?`${w.name}|${fe.words}`:w.name)},c.id)})}):null,H.dropped.length>0?(0,y.jsxs)("p",{style:{...L,margin:0},"data-testid":"list-dropped",children:["This link asked for ",H.dropped.join(", "),", which ",st.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,q.length>0?(0,y.jsx)(so,{schema:s.schema,graph:s.graph,kind:t,arrangement:z,onChange:ye,kept:{shown:R.length,of:q.length},noun:{one:Je(h,t),many:st.toLowerCase()},...Di?{}:{allow:!1},...Ea?{filters:Ea}:{},offers:I,chips:{nodes:q,flagged:M,...typeof p?.today=="string"?{today:p.today}:{}},query:e.framed===!0&&e.barAbove!==!0}):null,(0,y.jsx)("style",{children:Lt}),Mt?(0,y.jsx)("style",{children:po+Us}):null,(0,y.jsx)("div",{className:"graview-list","data-graview-skip-target":Wn,...Mt?{...We.listProps,ref:We.list,tabIndex:-1,"data-graview-choosable":"","aria-label":We.chosen.length>0?`${st}, ${We.chosen.length} chosen`:st,role:"group"}:{},children:R.length===0&&fe.words?(0,y.jsxs)("p",{style:de,"data-testid":"none-yet",children:["Nothing here is called \u201C",fe.words,"\u201D."," ",(0,y.jsx)("span",{style:L,"data-testid":"list-searched",children:dn(s.schema,{kinds:[t],past:tt})})," ",(0,y.jsx)($,{to:"?",style:_,children:"Show every one"})]}):R.length===0?(0,y.jsxs)("p",{style:de,"data-testid":"none-yet",children:[z.filter?.length||z.query?"None of them.":"None yet",!z.filter?.length&&!z.query&&oe.length>0?` \u2014 the first one starts above, with \u201C${oe[0]?.mutation.title??oe[0]?.mutation.name}\u201D.`:!z.filter?.length&&!z.query?".":"",z.filter?.length||z.query?(0,y.jsxs)(y.Fragment,{children:[" ",(0,y.jsx)($,{to:"?",style:_,children:"Show every one"})]}):null]}):Ke.grouped&&X?(0,y.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":X,children:Ne.map(c=>{if(!c.closed)return(0,y.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,y.jsxs)("h2",{className:"graview-group-head",children:[c.label," ",(0,y.jsx)("span",{children:c.nodes.length})]}),(0,y.jsx)("ul",{style:St,className:zt,"data-graview-rows":"",children:c.nodes.map(Ut)})]},c.key||"-");let w=m(c),D=`${u}-${Nt(c.key||"none")}`;return(0,y.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group","data-closed":w?"shut":"open",children:[(0,y.jsx)("h2",{className:"graview-group-head",children:(0,y.jsxs)("button",{type:"button",className:"graview-group-toggle","aria-expanded":!w,"aria-controls":D,"data-testid":"list-group-toggle",onClick:()=>k(c.value),children:[(0,y.jsx)("span",{"aria-hidden":"true",children:w?"\u25B8":"\u25BE"}),c.label," ",(0,y.jsxs)("span",{children:["\xB7 ",c.nodes.length]}),(0,y.jsxs)("span",{style:Vs,children:[" ",c.nodes.length===1?Je(h,t):st.toLowerCase()]})]})}),(0,y.jsx)("ul",{id:D,style:w?{...St,display:"none"}:St,className:zt,"data-graview-rows":"",hidden:w,children:w?null:c.nodes.map(Ut)})]},c.key||"-")})}):_t&&_t.length>1?(0,y.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":qe?.type==="date"?"year":"letter",children:[(0,y.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...L,display:"flex",flexWrap:"wrap",gap:qe?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:_t.map(c=>(0,y.jsx)("a",{href:`#${Nt(c.key)}`,onClick:w=>{w.preventDefault(),document.getElementById(Nt(c.key))?.scrollIntoView({block:"start"})},style:{...Ce,minWidth:24,justifyContent:"center"},children:c.key},c.key))}),_t.map(c=>(0,y.jsxs)("section",{"data-testid":"list-section","aria-labelledby":Nt(c.key),style:{display:"grid",gap:0},children:[(0,y.jsx)("h2",{id:Nt(c.key),className:"graview-group-head",children:c.key}),(0,y.jsx)("ul",{style:St,className:zt,"data-graview-rows":"",children:c.nodes.map(Ut)})]},c.key))]}):(0,y.jsx)("ul",{style:St,className:zt,"data-testid":"records","data-graview-rows":"",children:R.map(Ut)})}),Mt?(0,y.jsx)(uo,{store:s,chosen:We.chosen,...J?{principal:J}:{},...p?{context:p}:{},anchor:js,of:Dn.length,onChooseAll:()=>We.choose(Dn),onClear:We.clear,onActed:Wi}):null,te>0?(0,y.jsxs)($,{to:Ai(g,"filter","is:any"),style:{..._,...L,justifySelf:"start"},"data-testid":"past-link",children:["+",te," past"]}):null,T===!1&&s.graph.count(t,{archived:!0})>0?(0,y.jsxs)($,{to:Ai(g,"archived","true"),style:{..._,...L,justifySelf:"start"},"data-testid":"archived-link",children:["+",s.graph.count(t,{archived:!0})," archived"]}):null]}),(0,y.jsx)(Pn,{context:e,withheld:En,style:ce,testId:"withheld"})]})}var Vs={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},js=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,Us=`
|
|
7
|
+
.graview-list[data-graview-choosable]{outline:none}
|
|
8
|
+
.graview-list [data-graview-choose]{position:relative;padding-left:34px}
|
|
9
|
+
.graview-choose-at{position:absolute;left:2px;top:0;bottom:0;z-index:${Ja.raised};display:flex;align-items:center}
|
|
10
|
+
@media (min-width: 900px) and (pointer: fine){
|
|
11
|
+
.graview-list [data-graview-choose]{padding-left:0}
|
|
12
|
+
.graview-choose-at{left:-34px}
|
|
13
|
+
}
|
|
14
|
+
@media (pointer: coarse){
|
|
15
|
+
.graview-list:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
|
|
16
|
+
.graview-list:not([data-graview-choosing]) .graview-choose-at{display:none}
|
|
17
|
+
}
|
|
18
|
+
`;function _s({children:e}){return(0,y.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:e})}var zs=(e,t)=>t?{sort:{by:t,direction:"desc"}}:e?{sort:{by:"label",direction:"asc"}}:{};function Js(e,t,n){let a=en({...e.get("sort")?{sort:e.get("sort")}:{},...e.get("filter")?{filter:e.get("filter")}:{},...e.get("group")?{group:e.get("group")}:{},...e.get("q")?{q:e.get("q")}:{},...e.get("archived")?{archived:e.get("archived")}:{}}),r=[...a.filter??[]],o=e.get("by"),i=a.group??(o?{by:o}:void 0);for(let l of n){let p=e.get(l);p&&r.push({key:l,value:p})}let s=e.get("with");return s&&r.push({key:s,value:"*"}),e.get("past")==="1"&&!r.some(l=>l.key==="is")&&r.push({key:"is",value:"any"}),ea({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...r.length>0?{filter:r}:{},...i?{group:i}:{},...a.archived!==void 0?{archived:a.archived}:{}},t)}function Ai(e,t,n){let a=new URLSearchParams(e);return a.set(t,n),a.delete("past"),`?${a.toString()}`}function Ys({name:e,title:t,panel:n,open:a,onOpen:r}){return(0,y.jsxs)("button",{type:"button","data-testid":`act-open-${e}`,"data-graview-act":e,"aria-expanded":a,"aria-controls":n,onClick:()=>{r(!a),a||requestAnimationFrame(()=>document.getElementById(n)?.querySelector("input, select, textarea, button")?.focus())},style:{...Ce,minHeight:28,margin:"-4px 0",padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,y.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),t]})}function Qs({name:e,id:t,description:n,open:a,onClose:r,children:o}){return(0,y.jsxs)("div",{"data-testid":`act-${e}`,id:t,hidden:!a,onKeyDown:i=>{i.key==="Escape"&&(i.preventDefault(),r(),document.querySelector(`[aria-controls="${t}"]`)?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,y.jsx)("p",{style:{...L,margin:0,maxWidth:"58ch"},children:n}):null,o]})}function Xs({to:e,label:t}){let n=(0,De.useRef)(null);return go(n),(0,y.jsx)($,{ref:n,to:e,"aria-label":t,style:{position:"absolute",inset:0,borderRadius:6}})}var et=O(Le(),1);var Vt=O(Le(),1);var W=O(V(),1);function va({context:e}){let{store:t,brand:n,invariantContext:a,principal:r}=e;re(t);let o=t.violations(a),i=t.allInvariants(),s=nn(t,o),l=Sr(t.schema,i);return(0,W.jsxs)(se,{context:e,children:[(0,W.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,W.jsx)(le,{context:e,children:o.length===0?"All rules hold":"What is broken"}),(0,W.jsx)("p",{style:de,"data-testid":"problems-count",children:o.length===0?"Every declared rule is satisfied by what is here.":qa(o)})]}),(0,W.jsx)(ci,{context:e}),s.map((p,g)=>{let S=p.nodeIds[0],u=S?t.graph.getNode(S):void 0;return(0,W.jsxs)("section",{style:{display:"grid",gap:10,padding:"16px 18px",border:"1px solid var(--graview-edge)",background:"var(--graview-panel-warning)",borderRadius:"var(--graview-radius, 12px)"},children:[p.line?null:(0,W.jsx)(Rn,{violation:p,schema:t.schema,...n?{brand:n}:{}}),u?(0,W.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,W.jsx)(we,{kind:u.kind,brand:n,schema:t.schema,size:7}),(0,W.jsx)($,{to:Z(t.schema,u.kind,u.id),style:_,children:ie(t.schema.tryDefinition(u.kind),u)})]}):null,p.line?(0,W.jsx)(Rn,{violation:p,schema:t.schema,...n?{brand:n}:{}}):null,(0,W.jsx)(Ln,{store:t,repairs:p.repairs,...r?{principal:r}:{}})]},g)}),i.length>0?(0,W.jsxs)("section",{style:{...ce,display:"grid",gap:12},"data-testid":"rules",children:[(0,W.jsx)("h2",{style:ae,children:"The rules"}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:i.map(p=>{let g=o.filter(h=>h.invariant===p.name).length,S=l.get(p.name),u=p.label??p.name;return(0,W.jsxs)("li",{"data-graview-rule":p.name,style:{display:"grid",gap:2},children:[(0,W.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[S?(0,W.jsx)(an,{line:S,schema:t.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,W.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:u}),(0,W.jsx)("span",{style:{...L,color:g>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:g===0?"holds":`broken in ${g} ${g===1?"place":"places"}`})]}),S&&u.trim().length>0?(0,W.jsx)("span",{style:L,children:u}):null]},p.name)})})]}):null]})}function Rn({violation:e,schema:t,brand:n}){if(!e.line)return(0,W.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:e.message});let a=vr(e),r=br(e);return r?(0,W.jsxs)("div",{style:{display:"grid",gap:4},"data-testid":"problem-line",children:[(0,W.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},"data-testid":"problem-says",children:r}),a?(0,W.jsx)("span",{style:L,children:a}):null,(0,W.jsxs)("details",{"data-testid":"problem-judged",style:L,children:[(0,W.jsx)("summary",{style:{cursor:"pointer",width:"fit-content",minHeight:24},children:"How it is judged"}),(0,W.jsx)(an,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none"})]})]}):(0,W.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",children:[(0,W.jsx)(an,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)"}}),a?(0,W.jsx)("span",{style:L,children:a}):null]})}function Ln({store:e,repairs:t,principal:n}){let[a,r]=(0,Vt.useState)(null),[o,i]=(0,Vt.useState)(null),s=(0,Vt.useRef)([]);if(t.length===0)return null;let l=a===null?null:t[a],p=l&&(l.missing??[]).length>0?e.allMutations().find(g=>g.name===l.mutation):void 0;return(0,W.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,W.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:t.map((g,S)=>{let u=(g.missing??[]).length>0,h=e.permits({name:g.mutation,args:{...g.args}},n);return h.ok?(0,W.jsx)("button",{ref:T=>{s.current[S]=T},type:"button","data-graview-repair":g.mutation,"data-graview-asks":u||void 0,"aria-expanded":u?a===S:void 0,onClick:()=>{if(i(null),u){r(a===S?null:S);return}r(null);try{e.apply({name:g.mutation,args:{...g.args}},n?{author:n}:{})}catch(T){i(on(e.schema,e.allMutations(),T))}},style:ve,children:u?`${g.label} \u2026`:g.label},S):(0,W.jsxs)("p",{"data-testid":"withheld","data-withheld":h.refusal.wouldNeed.join(",")||"nobody",style:{...L,margin:0},children:[(0,W.jsx)("s",{children:g.label})," \u2014 ",h.refusal.message]},S)})}),p&&l?(0,W.jsx)($e,{store:e,mutation:p,prefilled:{...l.args},only:l.missing??[],label:l.label,autoFocus:!0,onDone:()=>{let g=a;r(null),requestAnimationFrame(()=>{let S=g===null?null:s.current[g];if(S?.isConnected){S.focus();return}let u=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");u&&(u.hasAttribute("tabindex")||(u.tabIndex=-1),u.focus())})},...n?{principal:n}:{}}):null,l&&!p&&(l.missing??[]).length>0?(0,W.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:aa},children:["\u201C",l.label,"\u201D names ",l.mutation,", which this app does not declare."]}):null,o?(0,W.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:aa},children:o}):null]})}var ka=O(Le(),1);var it=O(V(),1);function Ti({store:e,link:t,principal:n}){let[a,r]=(0,ka.useState)(!1),[o,i]=(0,ka.useState)(null),s=Cr(t);return(0,it.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,it.jsx)("button",{type:"button","data-graview-provisional":"",title:s,"aria-label":`Unsure link: ${s}`,"aria-expanded":a,onClick:()=>r(!a),style:{border:"1px dashed var(--graview-ink-muted)",borderRadius:999,background:"transparent",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.75rem",lineHeight:1,padding:"2px 6px",cursor:"pointer"},children:"unsure"}),a?(0,it.jsxs)("span",{style:{...L,display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,it.jsx)("span",{children:s}),(0,it.jsx)("button",{type:"button",style:{...ve,padding:"4px 10px"},onClick:()=>{try{e.apply({name:ja,args:{kind:t.edge.kind,from:t.edge.from,to:t.edge.to}},n?{author:n}:{}),r(!1)}catch(l){i(on(e.schema,e.allMutations(),l))}},children:"Keep this link"}),o?(0,it.jsx)("span",{role:"alert",children:o}):null]}):null]})}var ue=O(V(),1);function Ei({nodeId:e,node:t,field:n,inPlace:a,labelStyle:r=Ae}){return n.blank?(0,ue.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},"data-graview-blank-fact":n.key,children:[(0,ue.jsx)("dt",{style:r,children:n.label}),(0,ue.jsx)("dd",{style:{margin:0,minWidth:0},children:a?(0,ue.jsx)(Ht,{nodeId:e,field:n.key,value:"",said:`Add ${n.label}`,blank:!0}):null})]}):n.files?(0,ue.jsx)(Ct,{as:"field",read:!a,nodeId:e,field:n.key,label:n.label,files:n.files,labelStyle:r,style:{gap:4}}):n.long?(0,ue.jsx)(io,{nodeId:e,field:n.key,label:n.label,value:n.value,markdown:n.markdown,style:{gridColumn:"1 / -1",gap:4},labelStyle:r,valueStyle:{lineHeight:1.6}}):(0,ue.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,ue.jsx)("dt",{style:r,children:n.label}),(0,ue.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:n.linked?(0,ue.jsx)(Gr,{relation:n.linked.relation,refs:n.linked.refs,...a?{nodeId:e,field:n.key}:{}}):n.app?(0,ue.jsx)(pn,{address:n.app,as:"record",...a?{nodeId:e,field:n.key}:{}}):n.href?(0,ue.jsx)(oo,{href:n.href,field:n.key,value:n.value,stored:n.stored,...a?{nodeId:e}:{}}):a?(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(Ht,{nodeId:e,field:n.key,value:n.value,stored:n.stored}),n.repeats?(0,ue.jsx)(Br,{nodeId:e,field:n.key,start:t?.[n.key],value:t?.[`${n.key}Repeat`],label:`${n.label} repeats`}):null]}):n.value})]})}var b=O(V(),1),Zs=[];function xa({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;re(t);let o=me()!==null,i=rt(),s=decodeURIComponent(i.id??""),l=wn(t,s,{...a?{principal:a}:{},...r?{context:r}:{},...o?{blanks:Ko(t,s,a)}:{}}),p=nn(t,l?.violations??Zs),[g,S]=(0,et.useState)(null),[u,h]=(0,et.useState)(!1),[T,f]=(0,et.useState)(null),P=(0,et.useRef)(null),M=(0,et.useRef)(null),I=Kr({flow:"both",letters:!0}),v=d=>{(P.current?.parentElement?.querySelector(`[data-affordance="${d.replace(/["\\]/g,"\\$&")}"]`)??P.current)?.focus()};if(!l)return(0,b.jsx)(se,{context:e,children:(0,b.jsx)(le,{context:e,children:"Nothing lives at this address."})});let H=t.graph.getNode(s),ee=t.schema.tryDefinition(l.kind),A=ee?.describe&&H?xr(ee,H):null,C=[...t.log.all()].filter(d=>!kt(d)&&(d.writes.includes(s)||d.reads.includes(s))).slice(-8).reverse(),G=t.log.all().find(d=>!kt(d)&&d.undoes===void 0&&d.primitives.some(m=>m.op==="add-node"&&m.node.id===s)),ne=a??t.seenFor,ge=ne?l.actions.withheld.filter(d=>d.provider!=="invariant"&&t.mayPropose({name:d.mutation,args:{...d.args}},ne)):[],pe=[...l.actions.affordances.filter(d=>d.provider!=="invariant"),...ge],Re=pe.filter(d=>d.destructive||d.setsAside),Me=u||Re.length<2?pe:pe.filter(d=>!Re.includes(d)),Pe=e.views?.lookup(l.kind,{cardinality:"one",fidelity:"full"}),z=Pe!==void 0&&!Pt(Pe)?Pe:void 0,fe=z&&H?gn(Pe,H,t.graph):void 0,_e=fe?l.fields.filter(d=>!fe.fields.has(d.key)):l.fields,Be=fe?l.links.flatMap(d=>{let m=d.targets.filter(k=>!fe.records.has(k.id));return m.length>0?[{...d,targets:m}]:[]}):l.links,tt=z!==void 0&&At(Pe),Ke=o&&sn(ee).length>0,Ne=H?Ar(e.app?.connections,l.kind,s):void 0,wt=Ge(e).filter(d=>!d.hidden&&(d.kind===l.kind||d.across===l.kind));return(0,b.jsxs)(se,{context:e,children:[(0,b.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,b.jsx)(mt,{context:e}),(0,b.jsx)(le,{context:e,children:o&&H?.label===l.label?(0,b.jsx)(Ht,{nodeId:s,field:"label",value:l.label,said:l.label}):l.label}),A&&A!==l.label?(0,b.jsx)("p",{style:de,children:A}):null,G?.lineage?(0,b.jsxs)("p",{style:{...L,margin:0},"data-testid":"record-lineage",children:["Made by ",Ft(G,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}}),", ",Jn(G.lineage)]}):null,(0,b.jsx)(oa,{context:e,stop:`#focus=${encodeURIComponent(s)}`,style:{...je,...L},"data-testid":"spatial-link"}),o&&H?(0,b.jsx)(Qn,{choices:[{on:"changed",record:s},{on:"act",record:s},{on:"reaches",kind:l.kind,condition:"",record:s}],label:"Notify me when this changes",testId:"record-notify",style:{...ve,...L,justifySelf:"start"}}):null,wt.length>0?(0,b.jsx)(el,{context:e,places:wt}):null,Ne?(0,b.jsxs)("p",{style:{...L,margin:0},"data-testid":"record-kept-in-step","data-graview-system":Ne.system,children:["Kept in step with ",Ne.words,Ne.href?(0,b.jsxs)(b.Fragment,{children:[" \xB7 ",(0,b.jsxs)("a",{href:Ne.href,target:"_blank",rel:"noopener noreferrer",style:_,children:["Open in ",Ne.system==="notion"?"Notion":"Google Calendar"]})]}):null]}):null]}),H&&Ba(H)?(0,b.jsx)(al,{context:e,id:s,kind:l.kind}):null,H&&Ua(t,s)?(0,b.jsx)(nl,{context:e,id:s,kind:l.kind}):null,z&&H?(0,b.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,b.jsx)(mo,{children:(0,b.jsx)(ot,{when:Ye(Pe),children:(0,b.jsx)(z,{node:H,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...l.violations.length>0?{flagged:[s]}:{}})})})}):null,l.violations.length>0?(0,b.jsx)("section",{"data-testid":"record-violations",style:{display:"grid",gap:12,padding:"16px 18px",border:"1px solid var(--graview-edge)",background:"var(--graview-panel-warning)",borderRadius:"var(--graview-radius, 12px)"},children:p.map((d,m)=>(0,b.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,b.jsx)(Rn,{violation:d,schema:t.schema,...n?{brand:n}:{}}),(0,b.jsx)(Ln,{store:t,repairs:qo(l.actions,d.repairs),...a?{principal:a}:{}})]},m))}):null,!tt&&(_e.length>0||Ke)?(0,b.jsxs)("section",{style:{...ce,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,b.jsx)("h2",{style:ae,children:"The facts"}),Pr(ee,_e).map((d,m)=>{let k=(0,b.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:d.fields.map(R=>(0,b.jsx)(Ei,{nodeId:s,node:H,field:R,inPlace:o},R.key))});return d.title?(0,b.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,b.jsx)("h3",{"data-graview-field-group":d.title,style:{...ae,fontSize:"inherit"},children:d.title}),k]},m):(0,b.jsx)("div",{children:k},m)}),Ke?(0,b.jsx)(Ct,{as:"unfilled",nodeId:s,skip:[...fe?.fields??[]],labelStyle:Ae,style:{gap:4}}):null]}):null,(tt?[]:Be).map(d=>(0,b.jsxs)("section",{style:{...ce,display:"grid",gap:10},children:[(0,b.jsx)("p",{style:Ae,children:Oo(t,d)}),d.description?(0,b.jsx)("h2",{style:ae,children:He(d.description)}):(0,b.jsxs)("h2",{style:ae,"aria-label":ze(d.edgeKind),children:[d.direction==="in"?"\u2190 ":"\u2192 ",ze(d.edgeKind)]}),(0,b.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:d.targets.map(m=>{let k=Rr(t,d.direction==="in"?{kind:d.edgeKind,from:m.id,to:s}:{kind:d.edgeKind,from:s,to:m.id});return(0,b.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,b.jsx)(we,{kind:m.kind,brand:n,schema:t.schema,size:7}),(0,b.jsxs)($,{to:Z(t.schema,m.kind,m.id),style:_,children:[m.label,m.apart?(0,b.jsxs)("span",{style:L,children:[" \xB7 ",m.apart]}):null]}),k?.provisional?(0,b.jsx)(Ti,{store:t,link:k,...a?{principal:a}:{}}):null]},m.id)})}),(d.direction==="out"&&t.schema.edge(d.edgeKind)?.cardinality==="one"?[]:[...new Set(d.targets.map(m=>m.kind))]).map(m=>(0,b.jsx)($,{to:`/${j(t.schema,m)}?${encodeURIComponent(d.edgeKind)}=${encodeURIComponent(s)}`,style:{...je,...L},"data-testid":"related-all",children:(0,b.jsxs)(Qe,{children:["Sort and filter ",d.description??`these ${Y(t,m).toLowerCase()}`,d.targets.some(k=>k.kind!==m)?` (${Y(t,m).toLowerCase()})`:""]})},m))]},`${d.edgeKind}|${d.direction}|${d.description??""}`)),!tt&&(pe.length>0||l.actions.withheld.length>0)?(0,b.jsxs)("section",{style:{...ce,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,b.jsx)("h2",{style:ae,ref:P,tabIndex:-1,children:"What can be done"}),(0,b.jsxs)("div",{role:"toolbar","aria-label":"What can be done",...I,style:{display:"flex",flexWrap:"wrap",gap:8},children:[Me.map(d=>{let m=g===d.id;return(0,b.jsx)("button",{type:"button","data-affordance":d.id,"data-rank":d.rank,"data-graview-act":d.mutation,[Yn]:"",autoFocus:u&&d===Re[0],"aria-expanded":m,onClick:()=>S(m?null:d.id),style:{...ve,...m?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:d.label},d.id)}),Me.length<pe.length?(0,b.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>h(!0),style:{...ve,...L},"data-testid":"record-actions-more",[Yn]:"",children:["Show ",pe.length-Me.length," more"]}):null]}),pe.map(d=>{if(g!==d.id)return null;let m=t.allMutations().find(k=>k.name===d.mutation);return m?(0,b.jsxs)("div",{ref:M,onKeyDown:k=>{if(k.key!=="Escape"||k.defaultPrevented)return;k.preventDefault(),S(null);let R=d.id;requestAnimationFrame(()=>v(R))},style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,b.jsx)("h3",{style:ae,children:d.label}),m.description?(0,b.jsx)("p",{style:{...L,margin:0},children:m.description}):null,(0,b.jsx)($e,{store:t,mutation:m,prefilled:d.args,open:d.open,label:d.label,autoFocus:!0,onDone:()=>{S(null),f(d.mutation);let k=d.id;requestAnimationFrame(()=>v(k))},...a?{principal:a}:{}})]},d.id):null}),o&&T!==null&&g===null?(0,b.jsx)(Qn,{choices:[{on:"act",act:T,record:s},{on:"act",act:T}],label:"Notify me when someone else does this",testId:"notify-after-act",style:{...ve,...L,justifySelf:"start"}}):null,(0,b.jsx)(Pn,{context:e,withheld:l.actions.withheld.filter(d=>!ge.includes(d))})]}):null,o?(0,b.jsx)(No,{id:s,style:ce,headingStyle:ae}):null,C.length>0?(0,b.jsxs)("section",{style:{...ce,display:"grid",gap:10},"data-testid":"record-history",children:[(0,b.jsx)("h2",{style:ae,children:"What has happened"}),(0,b.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:C.map(d=>(0,b.jsxs)("li",{style:L,children:[(0,b.jsx)("span",{style:{color:"var(--graview-ink)"},children:d.intent}),d.lineage?(0,b.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",Jn(d.lineage)]}):null," \u2014 ",Ft(d,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},d.id))})]}):null]})}function el({context:e,places:t}){let[n,a]=(0,et.useState)(!1),r=(0,et.useRef)(null),o=n||t.length<=Tn+1?0:t.length-Tn;return(0,b.jsxs)("p",{ref:r,style:{...L,margin:0},"data-testid":"seen-in",...n?{"data-open":""}:{},children:["Seen in:"," ",t.map((i,s)=>(0,b.jsxs)("span",{...o>0&&s>=Tn?{"data-graview-later":""}:{},children:[s>0?(0,b.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,b.jsx)($,{to:Se(e,i),style:_,children:i.title})]},ft(i))),o>0?(0,b.jsxs)(b.Fragment,{children:[" ",(0,b.jsxs)("button",{type:"button","data-graview-seen-more":"","aria-expanded":"false",style:{..._,...L,font:"inherit",background:"none",border:0,padding:0,cursor:"pointer"},onClick:()=>{a(!0),requestAnimationFrame(()=>r.current?.querySelectorAll("a")[Tn]?.focus())},children:[o," more"]}),(0,b.jsx)("style",{children:tl})]}):null]})}var Tn=3,tl="[data-graview-seen-more]{display:none!important}@media (max-width:680px){[data-graview-seen-more]{display:inline!important}[data-testid=seen-in] [data-graview-later]{display:none}}";function nl({context:e,id:t,kind:n}){let{store:a,principal:r}=e,o={name:`allow-tidying-${n}`,args:{id:t}},i=a.allMutations().some(s=>s.name===o.name)&&a.permits(o,r).ok;return(0,b.jsxs)("section",{"data-testid":"record-left-alone",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,b.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,b.jsx)("strong",{children:"Left alone."})," Nothing automated changes it; tidying passes it by."]}),i?(0,b.jsx)("button",{type:"button",style:ve,"data-testid":"allow-tidying",onClick:()=>a.apply(o,r?{author:r}:{}),children:"Allow tidying again"}):null]})}function al({context:e,id:t,kind:n}){let{store:a,principal:r}=e,o={name:`unarchive-${n}`,args:{id:t}},i=a.allMutations().some(p=>p.name===o.name)&&a.permits(o,r).ok,s=[...a.log.all()].reverse().find(p=>!kt(p)&&p.mergedInto!==void 0&&p.writes.includes(t)),l=s?.mergedInto!==void 0?a.graph.getNode(s.mergedInto):void 0;return(0,b.jsxs)("section",{"data-testid":"record-archived",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,b.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,b.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",l?(0,b.jsxs)(b.Fragment,{children:[" ","Merged into ",(0,b.jsx)($,{to:Z(a.schema,l.kind,l.id),style:_,children:ie(a.schema.tryDefinition(l.kind),l)}),"."]}):null]}),i?(0,b.jsx)("button",{type:"button",style:ve,"data-testid":"bring-it-back",onClick:()=>a.apply(o,r?{author:r}:{}),children:"Bring it back"}):null]})}var x=O(V(),1),rl=tn(()=>(__graviewPreload(import.meta.url,["./chunk.KV7GZBJ6.js","./chunk.5YNLFOBJ.js","./chunk.Q355UPFG.js","./chunk.HNMSYQRA.js","./chunk.44ZHHPPJ.js","./chunk.ZDUTEM3Z.js","./chunk.ARHAD5IS.js","./chunk.R2TSTDS3.js","./chunk.QSDBF7VL.js","./chunk.2PK335JQ.js","./chunk.MHTA4HYB.js","./chunk.BU5PVRX7.js","./chunk.3KUYB5ZT.js","./chunk.IMKD6QQG.js","./chunk.MB7LKKUD.js","./chunk.FXG5AJF6.js","./chunk.RFVOXX3P.js","./chunk.NKYYDFIX.js","./chunk.IR4OW67N.js","./chunk.6RZHKQP3.js","./chunk.N35SJWAM.js","./chunk.L7NJLZWV.js","./chunk.QO5RXOCS.js","./chunk.MIE4TJRW.js","./chunk.CXJJB3MK.js","./chunk.OJGHDWI6.js","./chunk.74B6KQF4.js","./chunk.WVUJXDXZ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.IQ54QTA5.js")).then(e=>({default:e.DraftPage}))),ol={kind:"human"};function il({list:e,store:t}){let n=new Set(e.members.map(i=>i.kind)),a=e.total-e.members.length,r=n.size===1?[...n][0]:void 0;if(!r)return(0,x.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let o=at(t.schema,r).toLowerCase();return(0,x.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,x.jsx)($,{to:`/${j(t.schema,r)}`,className:"graview-spec-link graview-spec-see-all","data-testid":"see-all",children:e.total===t.graph.nodesOfKind(r).length?`See all ${bt(e.total)} ${o}`:`${bt(a)} more \xB7 all ${o}`})})}function sl({context:e,children:t}){let n=Xe(),a=e.store.schema,r=pt("/").replace(/\/$/,""),o=(0,K.useMemo)(()=>({href:i=>`${r}${Z(a,i.kind,i.id)}`,go:i=>n(Z(a,i.kind,i.id)),more:i=>(0,x.jsx)(il,{list:i,store:e.store})}),[r,a,n,e.store]);return(0,x.jsx)(un.Provider,{value:o,children:(0,x.jsx)(fo.Provider,{value:(e.titleLevel??(e.framed&&!e.barAbove?1:2))-1,children:t})})}var Ni=(0,K.createContext)(void 0);function ll({steering:e}){let t=ke(),n=Xe(),a=`${t.pathname}${t.search}`;return(0,K.useLayoutEffect)(()=>e.at(a),[a,e]),(0,K.useLayoutEffect)(()=>{let r=i=>{i!==a&&n(i)};e.go.current=r;let o=e.pending?.current;return o!==void 0&&(e.pending.current=void 0,r(o)),()=>{e.go.current===r&&(e.go.current=void 0)}},[a,n,e]),null}function dl({context:e,to:t}){let{pathname:n}=ke(),a=me(),r=(t??a)?.sayWhere,o=cl(e,n);return(0,K.useEffect)(()=>(r?.(o),()=>r?.(null)),[r,o]),null}function cl(e,t){let[n="",a,r]=t.split("/").filter(Boolean).map(i=>{try{return decodeURIComponent(i)}catch{return i}});if(r!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===xt)return"#overview=1";let i=e.views?.places().find(s=>s.as===a);return i?`#focus=${encodeURIComponent(Ve(i.kind))}&view=${encodeURIComponent(i.as)}`:"#"}let o=Te(e.store.schema,n);return o?`#focus=${encodeURIComponent(a??Ve(o))}`:"#"}function pl({onNavigate:e,path:t}){let n=ke(),a=ia(),r=Xe(),o=n.hash&&!n.hash.includes("=")?n.hash:"",i=`${n.pathname}${n.search}${o}`,s=(0,K.useRef)(e);s.current=e;let l=(0,K.useRef)(null);(0,K.useEffect)(()=>{let g=l.current;l.current=i,g!==null&&(i===g&&a!=="PUSH"||s.current?.(i,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let p=(0,K.useRef)(t);return(0,K.useEffect)(()=>{t===void 0||t===p.current||(p.current=t,t!==i&&r(t))},[t]),null}function Mi({context:e,registry:t,page:n}){let a=rt(),r=Te(e.store.schema,a.slug??""),o=n==="list"?ba:xa,s=(r?t?.lookup(r,n):void 0)??o;return(0,x.jsx)(s,{context:e})}function ul({context:e,registry:t,children:n}){let a=(0,K.useRef)(null);return yr(a),(0,x.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,x.jsx)(ei,{context:e,registry:t,root:a,children:(0,x.jsx)(si,{context:e,root:a,children:n})})})}function gl(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function ml(){let{pathname:e}=ke(),t=ia(),n=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{if(t!=="POP"){for(let o=n.current?.parentElement;o;o=o.parentElement){let{overflowY:i}=getComputedStyle(o);if((i==="auto"||i==="scroll")&&o.scrollHeight>o.clientHeight){o.scrollTop=0;return}}window.scrollTo(0,0)}},[e]);let a=(0,K.useRef)(e),r=(0,K.useRef)(!1);return(0,K.useEffect)(()=>{if(!r.current&&e===a.current)return;r.current=!0;let o=document.activeElement;if(gl(o))return;let i=n.current?.closest("main")??document.querySelector("main"),l=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??i?.querySelector("h1, h2")??null??i??null;l&&(l.hasAttribute("tabindex")||l.setAttribute("tabindex","-1"),l.focus({preventScroll:!0}))},[e]),(0,x.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function Oi({context:e,children:t}){let n=Xe(),a=pt("/").replace(/\/$/,""),r=(0,K.useContext)(Ni),o=(0,K.useMemo)(()=>{let i=(g,S)=>{if("record"in g){let u=e.store.graph.getNode(g.record);return u?ct(Z(e.store.schema,u.kind,g.record),{section:S?.section}):void 0}if("place"in g){if(g.place===Za)return ct("/",{section:S?.section});if(g.place===xt)return Ot;let u=e.views?.places().find(h=>h.as===g.place);return u?ct(Se(e,u),S):void 0}return e.store.schema.tryDefinition(g.list)?ct(`/${j(e.store.schema,g.list)}`,S):void 0},s=g=>{g!==void 0&&n(g)},l=()=>{if(e.overview)return e.overview();e.embedded||window.location.assign(e.sceneHref??"/")},p=()=>e.overview?r===!1?void 0:r?r(Ot):`${a}${Ot}`:e.embedded?void 0:e.sceneHref??"/";return{record:(g,S)=>s(i({record:g},S)),place:(g,S)=>g===xt?l():s(i({place:g},S)),list:(g,S)=>s(i({list:g},S)),draft:()=>n("/~draft"),href:(g,S)=>{if("place"in g&&g.place===xt)return p();let u=r===!1?void 0:i(g,S);if(u!==void 0)return r?r(u):`${a}${u}`}}},[e,n,a,r]);return(0,x.jsx)(fr.Provider,{value:o,children:t})}function fl(){let{pathname:e,search:t,hash:n}=ke();return(0,K.useEffect)(()=>{let a=decodeURIComponent(n.replace(/^#/,""));if(!(!a||a.includes("=")))return Yo(a)},[e,t,n]),null}function yl({context:e,Home:t}){let n=ke(),a=e.views,r=n.key==="default"&&!(a&&gr(a));(0,K.useEffect)(()=>{a&&mr(a)},[a]);let o=r?er(e.views?.arrangement?.()?.first,e.store.schema,e.views?.places()??[]):void 0,i=o?.to==="place"?Se(e,o.place):o?.to==="kind"?`/${j(e.store.schema,o.kind)}`:void 0;return i?(0,x.jsx)(sa,{to:i,replace:!0}):(0,x.jsx)(t,{context:e})}function $i({context:e,registry:t}){let n=t?.lookupSurface("shell"),a=n!==void 0,r=a&&(t?.without().has("bar")??!1),o=a&&!r&&!e.embedded?{...e,barAbove:!0}:e,i=f=>n===void 0?(0,x.jsx)(hn,{context:e,children:f}):r?(0,x.jsx)(n,{context:e,children:f}):(0,x.jsx)(hn,{context:e,children:(0,x.jsx)(n,{context:o,children:f})}),s=t?.lookupSurface("home")??ya,l=t?.lookupSurface("problems")??va,p=a?{...o,framed:!0}:e,[g,S]=(0,K.useState)(null),u=(0,K.useMemo)(()=>({context:p,registry:t}),[p,t]),h=(0,K.useMemo)(()=>({onFind:S,find:!(t?.without().has("find")??!1),places:!(t?.without().has("places")??!1)}),[t]),T=(0,x.jsx)(da.Provider,{value:u,children:(0,x.jsx)(Oi,{context:e,children:(0,x.jsx)(ul,{context:e,registry:t,children:i((0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(Lr,{face:"pages"}),(0,x.jsxs)(sl,{context:p,children:[(0,x.jsx)(ml,{}),(0,x.jsx)(fl,{}),(0,x.jsxs)(Do,{children:[(t?.routes()??[]).map(({path:f,component:P})=>(0,x.jsx)(Fe,{path:f,element:(0,x.jsx)(P,{context:p})},f)),(0,x.jsx)(Fe,{path:"/",element:(0,x.jsx)(yl,{context:p,Home:s})}),(0,x.jsx)(Fe,{path:"/problems",element:(0,x.jsx)(l,{context:p})}),(0,x.jsx)(Fe,{path:"/~draft",element:(0,x.jsx)(K.Suspense,{fallback:null,children:(0,x.jsx)(rl,{context:p})})}),(0,x.jsx)(Fe,{path:"/search",element:(0,x.jsx)(Sa,{context:p})}),(0,x.jsx)(Fe,{path:"/map",element:(0,x.jsx)(fa,{context:p})}),(0,x.jsx)(Fe,{path:"/places",element:(0,x.jsx)(ga,{context:p})}),Ge(p).some(f=>f.as===xt)?null:(0,x.jsx)(Fe,{path:Ot,element:(0,x.jsx)(sa,{to:"/",replace:!0})}),(0,x.jsx)(Fe,{path:"/places/:as",element:(0,x.jsx)(ma,{context:p})}),(0,x.jsx)(Fe,{path:"/:slug",element:(0,x.jsx)(Mi,{context:p,registry:t,page:"list"})}),(0,x.jsx)(Fe,{path:"/:slug/:id",element:(0,x.jsx)(Mi,{context:p,registry:t,page:"record"})})]})]})]}))})})});return e.embedded||!a||r?T:(0,x.jsx)(Bo.Provider,{value:h,children:(0,x.jsx)(eo.Provider,{value:g,children:T})})}var hl=()=>typeof document>"u"?null:document.body;function wl({context:e,registry:t,basename:n,initialPath:a,onNavigate:r,path:o,steering:i,firstLook:s,hrefOf:l,typing:p}){let[g,S]=(0,K.useState)(void 0),u=g!==void 0&&g.from===e.principal?{...e,principal:g.seat}:e;(0,K.useState)(()=>u.views?wo(u.views,u.store.schema,Zn(u.brand,u.store.schema)):void 0);let h=me(),T=p??u.typing;Fa({reader:u.locale??h?.locale,app:u.brand?.locale??u.app?.brand?.locale,readerTimeZone:u.timeZone??h?.timeZone,appTimeZone:u.brand?.timeZone??u.app?.brand?.timeZone});let f=u.principal??ol,P=dr(u.store,f,u.history),I=(P.past&&P.live===u.store?P.past.store:u.store).seenBy(f),v=I===u.store?u:{...u,store:I};cr(u.store,u.principal);let H=(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(pl,{onNavigate:r,path:o}),i?(0,x.jsx)(ll,{steering:i}):null,v.presence||h?(0,x.jsx)(dl,{context:v,to:h}):null,(0,x.jsx)($i,{context:v,...t?{registry:t}:{}}),s?(0,x.jsx)(So,{firstLook:s,root:hl,app:Zn(u.brand,u.store.schema)}):null]}),ee=v.views?(0,x.jsxs)(pr,{store:v.store,views:v.views,...v.principal?{principal:v.principal}:{},...v.brand?{brand:v.brand}:{},...v.locale?{locale:v.locale}:{},...v.timeZone?{timeZone:v.timeZone}:{},...v.settings?{settings:v.settings}:{},...v.presence&&!h?{presence:v.presence}:{},...T?{typing:T}:{},...v.people?{people:v.people}:{},...v.seats?{seats:v.seats}:{},onSeat:ge=>h?h.takeSeat(ge):S({from:e.principal,seat:ge}),...v.onKeepLens?{onKeepLens:v.onKeepLens}:{},...v.onProposeChange?{onProposeChange:v.onProposeChange}:{},...v.composeChange?{composeChange:v.composeChange}:{},...v.keptViews?{keptViews:v.keptViews}:{},...v.onExport?{onExport:v.onExport}:{},...v.ai?{ai:v.ai}:{},...v.subscriptions?{subscriptions:v.subscriptions}:{},dismissals:v.dismissals,whileAway:v.whileAway,...v.signIn?{signIn:v.signIn}:{},resolveApp:v.resolveApp??h?.resolveApp,linkedRecords:v.linkedRecords??h?.linkedRecords,...v.app?{app:v.app}:{},...v.menuSections?{menuSections:v.menuSections}:{},children:[H,(0,x.jsx)(Oi,{context:v,children:(0,x.jsx)(Qo,{context:v})})]}):H,A=(0,x.jsx)(lr.Provider,{value:P,children:ee}),C=v.assetsAt?(0,x.jsx)(sr.Provider,{value:v.assetsAt,children:A}):A,G=v.files?(0,x.jsx)(ir.Provider,{value:v.files,children:C}):C,ne=l===void 0?G:(0,x.jsx)(Ni.Provider,{value:l,children:G});if(a!==void 0){let ge=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,x.jsx)(Io,{initialEntries:[ge],...n===void 0?{}:{basename:n},children:ne})}return(0,x.jsx)(Wo,{...n===void 0?{}:{basename:n},children:ne})}export{ns as a,wl as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Ry}from"./chunk.
|
|
1
|
+
import{c as Ry}from"./chunk.L6FGKJ5H.js";import{G as Cy}from"./chunk.3CJLAJXP.js";import{a as an}from"./chunk.AJZBJBMO.js";var Ti=an(J=>{"use strict";function Gf(l,a){var t=l.length;l.push(a);l:for(;0<t;){var u=t-1>>>1,n=l[u];if(0<tn(n,a))l[u]=a,l[t]=n,t=u;else break l}}function Ll(l){return l.length===0?null:l[0]}function nn(l){if(l.length===0)return null;var a=l[0],t=l.pop();if(t!==a){l[0]=t;l:for(var u=0,n=l.length,f=n>>>1;u<f;){var e=2*(u+1)-1,c=l[e],i=e+1,m=l[i];if(0>tn(c,t))i<n&&0>tn(m,c)?(l[u]=m,l[i]=t,u=i):(l[u]=c,l[e]=t,u=e);else if(i<n&&0>tn(m,t))l[u]=m,l[i]=t,u=i;else break l}}return a}function tn(l,a){var t=l.sortIndex-a.sortIndex;return t!==0?t:l.id-a.id}J.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(yi=performance,J.unstable_now=function(){return yi.now()}):(Yf=Date,mi=Yf.now(),J.unstable_now=function(){return Yf.now()-mi});var yi,Yf,mi,Il=[],Aa=[],jy=1,Bl=null,ml=3,Zf=!1,au=!1,tu=!1,Cf=!1,Si=typeof setTimeout=="function"?setTimeout:null,gi=typeof clearTimeout=="function"?clearTimeout:null,hi=typeof setImmediate<"u"?setImmediate:null;function un(l){for(var a=Ll(Aa);a!==null;){if(a.callback===null)nn(Aa);else if(a.startTime<=l)nn(Aa),a.sortIndex=a.expirationTime,Gf(Il,a);else break;a=Ll(Aa)}}function Rf(l){if(tu=!1,un(l),!au)if(Ll(Il)!==null)au=!0,ht||(ht=!0,mt());else{var a=Ll(Aa);a!==null&&jf(Rf,a.startTime-l)}}var ht=!1,uu=-1,bi=5,zi=-1;function Ai(){return Cf?!0:!(J.unstable_now()-zi<bi)}function Qf(){if(Cf=!1,ht){var l=J.unstable_now();zi=l;var a=!0;try{l:{au=!1,tu&&(tu=!1,gi(uu),uu=-1),Zf=!0;var t=ml;try{a:{for(un(l),Bl=Ll(Il);Bl!==null&&!(Bl.expirationTime>l&&Ai());){var u=Bl.callback;if(typeof u=="function"){Bl.callback=null,ml=Bl.priorityLevel;var n=u(Bl.expirationTime<=l);if(l=J.unstable_now(),typeof n=="function"){Bl.callback=n,un(l),a=!0;break a}Bl===Ll(Il)&&nn(Il),un(l)}else nn(Il);Bl=Ll(Il)}if(Bl!==null)a=!0;else{var f=Ll(Aa);f!==null&&jf(Rf,f.startTime-l),a=!1}}break l}finally{Bl=null,ml=t,Zf=!1}a=void 0}}finally{a?mt():ht=!1}}}var mt;typeof hi=="function"?mt=function(){hi(Qf)}:typeof MessageChannel<"u"?(Xf=new MessageChannel,di=Xf.port2,Xf.port1.onmessage=Qf,mt=function(){di.postMessage(null)}):mt=function(){Si(Qf,0)};var Xf,di;function jf(l,a){uu=Si(function(){l(J.unstable_now())},a)}J.unstable_IdlePriority=5;J.unstable_ImmediatePriority=1;J.unstable_LowPriority=4;J.unstable_NormalPriority=3;J.unstable_Profiling=null;J.unstable_UserBlockingPriority=2;J.unstable_cancelCallback=function(l){l.callback=null};J.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):bi=0<l?Math.floor(1e3/l):5};J.unstable_getCurrentPriorityLevel=function(){return ml};J.unstable_next=function(l){switch(ml){case 1:case 2:case 3:var a=3;break;default:a=ml}var t=ml;ml=a;try{return l()}finally{ml=t}};J.unstable_requestPaint=function(){Cf=!0};J.unstable_runWithPriority=function(l,a){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var t=ml;ml=l;try{return a()}finally{ml=t}};J.unstable_scheduleCallback=function(l,a,t){var u=J.unstable_now();switch(typeof t=="object"&&t!==null?(t=t.delay,t=typeof t=="number"&&0<t?u+t:u):t=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=t+n,l={id:jy++,callback:a,priorityLevel:l,startTime:t,expirationTime:n,sortIndex:-1},t>u?(l.sortIndex=t,Gf(Aa,l),Ll(Il)===null&&l===Ll(Aa)&&(tu?(gi(uu),uu=-1):tu=!0,jf(Rf,t-u))):(l.sortIndex=n,Gf(Il,l),au||Zf||(au=!0,ht||(ht=!0,mt()))),l};J.unstable_shouldYield=Ai;J.unstable_wrapCallback=function(l){var a=ml;return function(){var t=ml;ml=a;try{return l.apply(this,arguments)}finally{ml=t}}}});var Mi=an((dd,Ei)=>{"use strict";Ei.exports=Ti()});var Qy=an(qf=>{"use strict";var tl=Mi(),w0=Cy(),Vy=Ry();function A(l){var a="https://react.dev/errors/"+l;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)a+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+l+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function F0(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function Ku(l){var a=l,t=l;if(l.alternate)for(;a.return;)a=a.return;else{l=a;do a=l,(a.flags&4098)!==0&&(t=a.return),l=a.return;while(l)}return a.tag===3?t:null}function $0(l){if(l.tag===13){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function k0(l){if(l.tag===31){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function Oi(l){if(Ku(l)!==l)throw Error(A(188))}function xy(l){var a=l.alternate;if(!a){if(a=Ku(l),a===null)throw Error(A(188));return a!==l?null:l}for(var t=l,u=a;;){var n=t.return;if(n===null)break;var f=n.alternate;if(f===null){if(u=n.return,u!==null){t=u;continue}break}if(n.child===f.child){for(f=n.child;f;){if(f===t)return Oi(n),l;if(f===u)return Oi(n),a;f=f.sibling}throw Error(A(188))}if(t.return!==u.return)t=n,u=f;else{for(var e=!1,c=n.child;c;){if(c===t){e=!0,t=n,u=f;break}if(c===u){e=!0,u=n,t=f;break}c=c.sibling}if(!e){for(c=f.child;c;){if(c===t){e=!0,t=f,u=n;break}if(c===u){e=!0,u=f,t=n;break}c=c.sibling}if(!e)throw Error(A(189))}}if(t.alternate!==u)throw Error(A(190))}if(t.tag!==3)throw Error(A(188));return t.stateNode.current===t?l:a}function I0(l){var a=l.tag;if(a===5||a===26||a===27||a===6)return l;for(l=l.child;l!==null;){if(a=I0(l),a!==null)return a;l=l.sibling}return null}var L=Object.assign,py=Symbol.for("react.element"),fn=Symbol.for("react.transitional.element"),mu=Symbol.for("react.portal"),At=Symbol.for("react.fragment"),r0=Symbol.for("react.strict_mode"),Te=Symbol.for("react.profiler"),P0=Symbol.for("react.consumer"),fa=Symbol.for("react.context"),Sc=Symbol.for("react.forward_ref"),Ee=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),gc=Symbol.for("react.memo"),Ta=Symbol.for("react.lazy");Symbol.for("react.scope");var Oe=Symbol.for("react.activity");Symbol.for("react.legacy_hidden");Symbol.for("react.tracing_marker");var Ky=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var Di=Symbol.iterator;function nu(l){return l===null||typeof l!="object"?null:(l=Di&&l[Di]||l["@@iterator"],typeof l=="function"?l:null)}var Ly=Symbol.for("react.client.reference");function De(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Ly?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case At:return"Fragment";case Te:return"Profiler";case r0:return"StrictMode";case Ee:return"Suspense";case Me:return"SuspenseList";case Oe:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case mu:return"Portal";case fa:return l.displayName||"Context";case P0:return(l._context.displayName||"Context")+".Consumer";case Sc:var a=l.render;return l=l.displayName,l||(l=a.displayName||a.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case gc:return a=l.displayName||null,a!==null?a:De(l.type)||"Memo";case Ta:a=l._payload,l=l._init;try{return De(l(a))}catch{}}return null}var hu=Array.isArray,D=w0.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Vy.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ka={pending:!1,data:null,method:null,action:null},Ue=[],Tt=-1;function $l(l){return{current:l}}function fl(l){0>Tt||(l.current=Ue[Tt],Ue[Tt]=null,Tt--)}function x(l,a){Tt++,Ue[Tt]=l.current,l.current=a}var Fl=$l(null),Nu=$l(null),Ba=$l(null),jn=$l(null);function Vn(l,a){switch(x(Ba,a),x(Nu,l),x(Fl,null),a.nodeType){case 9:case 11:l=(l=a.documentElement)&&(l=l.namespaceURI)?B0(l):0;break;default:if(l=a.tagName,a=a.namespaceURI)a=B0(a),l=Ty(a,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}fl(Fl),x(Fl,l)}function Ct(){fl(Fl),fl(Nu),fl(Ba)}function se(l){l.memoizedState!==null&&x(jn,l);var a=Fl.current,t=Ty(a,l.type);a!==t&&(x(Nu,l),x(Fl,t))}function xn(l){Nu.current===l&&(fl(Fl),fl(Nu)),jn.current===l&&(fl(jn),Vu._currentValue=ka)}var Vf,Ui;function Wa(l){if(Vf===void 0)try{throw Error()}catch(t){var a=t.stack.trim().match(/\n( *(at )?)/);Vf=a&&a[1]||"",Ui=-1<t.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<t.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
3
|
`+Vf+l+Ui}var xf=!1;function pf(l,a){if(!l||xf)return"";xf=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var z=function(){throw Error()};if(Object.defineProperty(z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(z,[])}catch(S){var d=S}Reflect.construct(l,[],z)}else{try{z.call()}catch(S){d=S}l.call(z.prototype)}}else{try{throw Error()}catch(S){d=S}(z=l())&&typeof z.catch=="function"&&z.catch(function(){})}}catch(S){if(S&&d&&typeof S.stack=="string")return[S.stack,d.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=u.DetermineComponentFrameRoot(),e=f[0],c=f[1];if(e&&c){var i=e.split(`
|
|
4
4
|
`),m=c.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as X}from"./chunk.
|
|
1
|
+
import{b as X}from"./chunk.QO5RXOCS.js";import"./chunk.MD36ZSM5.js";import"./chunk.L6FGKJ5H.js";import{G as ce,V as Y,da as N,ga as _}from"./chunk.3CJLAJXP.js";import"./chunk.SDO3U72B.js";import{Eb as R,ue as U}from"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import{b as O}from"./chunk.AJZBJBMO.js";var u=O(ce(),1);function M(e,t,s=!1){if(e<t.at||e===t.at&&s)return e;let i=t.at+t.removed.length;return e>=i?e+t.inserted.length-t.removed.length:s?t.at:t.at+t.inserted.length}var G=e=>e>=55296&&e<=56319,V=e=>e>=56320&&e<=57343;function q(e,t,s){let i=Math.min(e.length,t.length),n=0,l=Math.max(0,Math.min(i,t.length-s));for(;n<l&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;let r=0;for(;r<i-n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return r>0&&G(e.charCodeAt(r-1))&&r--,n>0&&V(e.charCodeAt(e.length-n))&&n--,{at:r,removed:e.slice(r,e.length-n),inserted:t.slice(r,t.length-n)}}function B(e,t){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)===t.charCodeAt(i);)i++;i>0&&G(e.charCodeAt(i-1))&&i--;let n=0;for(;n<s-i&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;return n>0&&V(e.charCodeAt(e.length-n))&&n--,{at:i,removed:e.slice(i,e.length-n),inserted:t.slice(i,t.length-n)}}function Z(e,t){let s=c=>c.at+c.removed.length;if(s(e)<t.at)return e;if(e.at>s(t))return{...e,at:e.at+t.inserted.length-t.removed.length};let i=Math.min(e.at,t.at),n=s(e)-s(t),l=e.removed.slice(0,t.at-i)+t.inserted+(n>0?e.removed.slice(e.removed.length-n):""),r=t.at<=e.at?t.inserted+e.inserted:e.inserted+t.inserted,d=B(l,r);return{...d,at:i+d.at}}function I(e,t){let s=M(e.start,t,!0),i=e.end===e.start?s:M(e.end,t);return{start:s,end:Math.max(s,i)}}function le(e,t){let{kind:s,id:i,session:n}=e.author,l=`${s}:${i??""}:`;return t.startsWith(l)&&(!n||t.slice(l.length)===n)}function J(e,t,s,i){let n=e.anchor,l=e.head;for(let d of s)if(!(d.seq<e.rev||le(d,t)))for(let c of d.primitives)c.op!=="splice-text"||c.id!==e.node||c.field!==e.field||(n=M(n,c),l=M(l,c));let r=d=>Math.max(0,Math.min(i,d));return{start:r(n),end:r(l)}}var W=(e,t,s)=>e.ops.length>0&&e.ops.every(i=>{let n=i.mutation?.args;return i.mutation?.name===R&&n?.node===t&&n.field===s}),de=(e,t,s,i)=>t.ops.length>0&&t.ops.every(n=>n.undoes!==void 0)&&e.batches().some(n=>t.ops.some(l=>l.undoes===n.id||l.undoes===n.ops[0]?.id)&&W(n,s,i)),Q=(e,t)=>e.author.kind==="human"&&(t?.id===void 0||e.author.id===void 0||e.author.id===t.id);function j(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(!(!Q(r,t)||r.undone||!W(r,s,i))&&e.canUndo(r.id).ok)return r.id}}function ee(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(Q(r,t)){if(W(r,s,i))return;if(de(e,r,s,i))return r.undone?void 0:r.id}}}var p=O(Y(),1);function ue(e){let{store:t}=N(),{live:s,nodeId:i,field:n}=e,[l,r]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let d=!0;return s.typing(i,n).then(c=>d&&r(c)),()=>{d=!1}},[i,n]),l&&!t.collaborative(i,n)?(0,p.jsx)(p.Fragment,{children:e.writtenWhole}):(0,p.jsx)(pe,{...e,typing:l})}function pe({nodeId:e,field:t,label:s,markdown:i,live:n,onDone:l,typing:r}){let{store:d,principal:c}=N(),m=_(e),f=ne(m?.[t]),[T,ie]=(0,u.useState)(!1),v=(0,u.useRef)(null),D=(0,u.useRef)(f),E=(0,u.useRef)(!1),H=(0,u.useRef)(n);H.current=n;let K=()=>ne(d.graph.getNode(e)?.[t]),b=!r||d.permits({name:R,args:{node:e,field:t,at:0,remove:0,insert:""}},c).ok;(0,u.useEffect)(()=>v.current?.focus(),[T,r]);let C=(0,u.useRef)(void 0),k=()=>{C.current===void 0&&(C.current=setTimeout(()=>{C.current=void 0;let o=v.current;if(!o||o.ownerDocument.activeElement!==o)return;let a=o.selectionDirection==="backward";H.current.sayCaret({node:e,field:t,anchor:a?o.selectionEnd:o.selectionStart,head:a?o.selectionStart:o.selectionEnd,rev:d.log.length})},ge))};(0,u.useEffect)(()=>()=>{clearTimeout(C.current),H.current.sayCaret(null)},[]);let F=o=>{let a=v.current;if(a){if(a.value!==o){let h=I({start:a.selectionStart,end:a.selectionEnd},B(a.value,o)),g=a.selectionDirection??"none";a.value=o,a.setSelectionRange(h.start,h.end,g)}D.current=o}},$=()=>{let o=v.current;if(!o||!r||!b||E.current)return;let a=D.current,h=K(),g=q(a,o.value,o.selectionEnd);if(g.removed===""&&g.inserted==="")return F(h);let y=a===h?g:Z(g,B(a,h));try{r.splice(y.at,y.removed.length,y.inserted)}catch{}let w=K();if(o.value!==w){o.value=w;let S=Math.min(w.length,y.at+y.inserted.length);o.setSelectionRange(S,S)}D.current=w,k()};(0,u.useLayoutEffect)(()=>{E.current||F(f)},[f]);let ae=async o=>{if(!r)return;r.flush();for(let h=0;r.waiting()>0&&h<100;h++)await new Promise(g=>setTimeout(g,30));let a=o?ee(d,c,e,t):j(d,c,e,t);if(a)try{o?d.redo(a,{author:c}):d.undo(a,{author:c})}catch{}},x=o=>{r?.flush(),n.sayCaret(null),l(o)},A=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>A.current?.(),[]);let se=o=>{A.current?.();let a=o.ownerDocument,h=v.current?.closest("[data-graview-live]"),g=P=>{let L=P.target;if(L instanceof Node&&h?.contains(L))return S();L instanceof Element&&L.closest(te)||(S(),x(!0))},y=()=>{let P=a.activeElement;P!==null&&P!==a.body||o.isConnected&&fe(o)||(S(),v.current?.focus({preventScroll:!0}))},w=new MutationObserver(y);w.observe(a.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["open","hidden"]}),a.addEventListener("focusin",g),a.addEventListener("toggle",y,!0);let S=()=>{A.current=void 0,w.disconnect(),a.removeEventListener("focusin",g),a.removeEventListener("toggle",y,!0)};A.current=S},z=[...n.who.values()].filter(o=>o.caret?.node===e&&o.caret.field===t);return(0,p.jsxs)("div",{style:{display:"grid",gap:8,minWidth:0},"data-graview-live":t,children:[T?(0,p.jsx)("div",{"data-graview-preview":t,"aria-label":`${s}, as it will read`,role:"region",style:ye,children:(0,p.jsx)(X,{text:f,markdown:!0})}):(0,p.jsxs)("div",{style:{position:"relative",minWidth:0},children:[(0,p.jsx)("textarea",{ref:v,"aria-label":s,"data-graview-field":t,defaultValue:f,readOnly:!r||!b,rows:3,onInput:$,onCompositionStart:()=>{E.current=!0},onCompositionEnd:()=>{E.current=!1,$()},onSelect:k,onFocus:k,onPointerDown:()=>r?.flush(),onKeyDown:o=>{let a=o.key;a==="Escape"?(o.preventDefault(),x(!1)):(o.metaKey||o.ctrlKey)&&!o.altKey&&a.toLowerCase()==="z"?(o.preventDefault(),ae(o.shiftKey)):(o.metaKey||o.ctrlKey)&&a==="Enter"?(o.preventDefault(),x(!1)):(a==="Enter"||me.has(a))&&r?.flush()},onKeyUp:k,onBlur:o=>{r?.flush(),n.sayCaret(null);let a=o.relatedTarget;if(a instanceof Node&&o.currentTarget.closest("[data-graview-live]")?.contains(a))return;let h=a instanceof Element?a.closest(te):null;if(h)return se(h);x(!0)},style:ve}),z.length>0?(0,p.jsx)(he,{text:f,others:z,area:v,log:d.log.all()}):null]}),(0,p.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,p.jsx)("button",{type:"button",onClick:()=>x(!1),style:re,children:"Done"}),i?(0,p.jsx)("button",{type:"button","aria-pressed":T,onClick:()=>ie(!T),style:re,children:T?"Write":"Preview"}):null,(0,p.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},...b?{}:{"data-graview-readonly":""},children:b?"Saved as you type \xB7 Ctrl or \u2318 Z takes back your typing":`Read only: the ${s.toLowerCase()} can't be changed here now`})]})]})}function he({text:e,others:t,area:s,log:i}){let n=(0,u.useRef)(null);(0,u.useLayoutEffect)(()=>{let c=s.current,m=n.current;if(!c||!m)return;let f=()=>{m.scrollTop=c.scrollTop};return f(),c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)});let l=t.map(c=>({one:c,at:J(c.caret,c.participant,i,e.length).end})).sort((c,m)=>c.at-m.at),r=[],d=0;for(let{one:c,at:m}of l){r.push(e.slice(d,m)),d=m;let f=U(c)||"Somebody";r.push((0,p.jsx)("span",{"data-graview-caret":c.participant,title:`${f} is typing here`,style:{borderLeft:`2px solid hsl(${Math.round(c.hue)} 55% 52%)`,marginLeft:-1,marginRight:-1,pointerEvents:"auto"}},c.participant))}return r.push(`${e.slice(d)}\u200B`),(0,p.jsx)("div",{ref:n,"aria-hidden":"true",style:we,children:r})}var te='[data-graview-overlay], dialog, [role="dialog"], [role="alertdialog"], [popover]',fe=e=>{if(e.hasAttribute("hidden")||e instanceof HTMLDialogElement&&!e.open)return!1;if(e.hasAttribute("popover"))try{return e.matches(":popover-open")}catch{}return!0},ge=120,ne=e=>typeof e=="string"?e:"",me=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),ye={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},re={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},oe={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",borderRadius:6},ve={...oe,resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)"},we={...oe,position:"absolute",inset:0,height:"100%",border:"1px solid transparent",color:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflow:"hidden",pointerEvents:"none"};export{ue as default};
|