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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Ie}from"./chunk.HZPRMHSL.js";import{c as Oe,d as Be,f as Ge}from"./chunk.G7YLK4PX.js";import{e as Ce,f as Re,k as Fe,l as re,n as Me}from"./chunk.ZA5TDCBC.js";import{f as De}from"./chunk.R5MLRKAO.js";import{d as z,e as Pe,k as ne}from"./chunk.5IEZF433.js";import{b as Ae,e as je}from"./chunk.5AD2QHWH.js";import{$c as be,C as Q,Fd as ve,L as de,Wd as ke,Xb as ge,Xc as ye,Zc as we,ea as ue,ee as xe,ga as U,ha as me,ka as H,kd as Z,la as T,ld as $e,ma as pe,na as ee,ne as Se,oa as fe,oc as te,pc as he,ra as _,ta as q}from"./chunk.IQGSEAQ2.js";function Xe(t,e,n){let o=t.tryDefinition(e)?.fields.shape,r=Q(o?.[n]),a=!1,s=!1;for(;r&&(r.type==="optional"||r.type==="default"||r.type==="nullable"||r.type==="prefault");)(r.type==="optional"||r.type==="nullable")&&(a=!0),(r.type==="default"||r.type==="prefault")&&(s=!0),r=Q(r.innerType);if(r?.type!=="enum")return;let p=(r.entries?Object.values(r.entries):r.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function L(t,e,n){let o=Xe(t,e,n);if(!o)return[];let r=t.tryDefinition(e),a=o.values.map(s=>({value:s,label:Ae(r,n,s)}));return o.empty&&a.push({value:null,label:`No ${_(r,n).toLowerCase()}`}),a}function X(t,e,n){let o=t[e];return typeof o=="string"&&n.some(r=>r.value===o)?o:null}function se(t,e,n,o,r=L(t.schema,n.kind,o)){return Ve(t,e,n,o,r).flatMap(a=>a.move?[a.move]:[])}function Ve(t,e,n,o,r=L(t.schema,n.kind,o)){let a=Ne(t.schema,t.allMutations(),n.kind,o,r),s=X(n,o,r),p=q(t.schema.tryDefinition(n.kind),n.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,I,V;for(let c of F){let w=R==="step"?{[c.subject.arg]:n.id}:{[c.subject.arg]:n.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){V??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=t.permits(S,e);if(!k.ok){I??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{ge(t.graph,c,w)}catch(f){I??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:I??V??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ne(t,e,n,o,r=L(t,n,o)){let a=Ke(t,e,n,o),s=We(t,e,n,o);return r.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Ke(t,e,n,o){return e.filter(r=>r.subject!==void 0&&r.derived===void 0&&typeof r.sets?.[o]=="string"&&te(t,r).includes(n))}function We(t,e,n,o){let r=t.tryDefinition(n);return r?e.filter(a=>{if(!a.subject||!te(t,a).includes(n)||!he(a,r).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var oe=(t,e)=>e&&t[e]!==void 0?String(t[e]):"";function Ye(t,e,n){let o=c=>t.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(t.tryDefinition(c),w)):[],r=o(n.rows),a=o(n.columns),s=new Set(r.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=n.link;if(typeof C=="string"){let c=f=>t.tryDefinition(f)?.edges?.[C]?.to,w=(c(n.columns)??[]).some(f=>f===n.rows||f==="*"),S=(c(n.rows)??[]).some(f=>f===n.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let v of k)for(let b of c.get(f).get(v.id)??[])i.has(`${v.id}|${b}`)||(i.add(`${v.id}|${b}`),j.push({id:b,via:[...v.via,v.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=n.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?T(t.tryDefinition(c.kind),c):c[w],I=Z(r,n.sort,x).map(c=>{let w=c;return{node:c,label:T(t.tryDefinition(c.kind),c),group:oe(w,n.rowGroup),ref:oe(w,n.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(n.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),V=Z(a,n.columnSort,x).map(c=>({node:c,label:T(t.tryDefinition(c.kind),c),group:oe(c,n.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:n.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:I,columns:V,cells:A}}function Te(t,e,n){let{rows:o,columns:r,cells:a}=Ye(t,e,n),s=(i,v)=>ee(t,i,v),p=i=>ee(t,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:T(t.tryDefinition(i.kind),i),parts:[]}),A=i=>{let v=e.getNode(i);if(!v)return null;let b=t.tryDefinition(v.kind),P=T(b,v),N=z(v,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...N].join(", ")},C=typeof n.link=="string"?[]:n.link.path.slice(0,-1).flatMap((i,v,b)=>{let P=ve(t,n.columns,b.slice(0,v+1));return P.ok?[...P.reached]:[]}),R=$e(t,n,{rows:o.length,columns:r.length,cells:a.length});if(R)return[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${r.length>0?`: ${r.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(r.map(i=>[i.node.id,i.label])),I=new Map(r.map((i,v)=>[i.node.id,v])),V=new Map,c=new Map;for(let i of a){let v=V.get(i.rowId);v?v.push(i):V.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...V.get(i.node.id)??[]].sort((P,N)=>I.get(P.columnId)-I.get(N.columnId)).map(P=>{let N=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${N.length>0?` (${N.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:r.map(i=>{let v=c.get(i.node.id)??new Set,b=o.filter(P=>v.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=r.filter(i=>!S.has(i.node.id)),j=n.rows===n.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(n.rows,k.length)} with no ${p(n.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(n.columns,f.length)} on no ${p(n.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function ie(t,e,n,o={}){let{app:r,blocks:a=n?r?.viewSpecs?.[n.kind]?.[o.slot??"page"]:r?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(n||o.blocks?void 0:1),p=Me(t,e,n,{...o,money:o.money??r?.brand,firstHeading:s});return n&&!p.node?[]:Re(typeof a[0]?.t=="string"?a:Ce(a),p)}function Y(t,e,n){let o=!(e.optional||e.control==="boolean"),r=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>U(q(t.tryDefinition(s),s))).join(" or "):n(e.name).label,a={name:e.name,label:r,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>n(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${Y(t,e.item,n).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>Y(t,s,n))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>me(s.value))};default:return{...a,input:"answer"}}}function He(t,e,n){let o=Be(t,e,n),r=t.schema,a=Oe(r,n).filter(p=>p.name!==n.subject?.arg&&!o.has(p.name)),s=pe(n);return{act:n.name,title:s,submit:s,fields:a.map(p=>Y(r,p,m=>ne(r,n,m)))}}function Le(t,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(n=>Y(t,n,o=>ne(t,e.act,o)))}}function Ee(t,e,n){return t.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(n))}function Ze(t,e=""){let n=[`${e}Form "${t.title}" (${t.visitor?`the visitor form ${t.visitor}, running `:""}act ${t.act}), button "${t.submit}":`],o=(r,a)=>{for(let s of r){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";n.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(t.fields,`${e} `),t.fields.length===0&&n.push(`${e} (asks nothing)`),n}function Ue(t,e){let n=t.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(n[o.attach]?.page?.length??0)>0).map(o=>{let r=E(t.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Je(r)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Je=t=>`${/^[aeiou]/i.test(t)?"an":"a"} ${t}`,Qe=240,ze=10,et=1160,tt=40,_e=640,nt=3,rt=t=>Math.max(1,Math.floor((Math.min(t,et)-tt+ze)/(Qe+ze)));function st(t,e,n,o){let{app:r}=o,a=o.width??1440,s=o.today??t.today()??de(r.brand?.timeZone),p=t.seenBy(e),m=p.schema,A=p.graph,C=Ie(r,o.views?{views:o.views}:{}),R=typeof n=="string"?n.trim():n.slug,F=typeof n=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===n.slug&&l.kind===n.kind)??n,x=!F&&typeof n=="string"?A.getNode(R):void 0,I=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,V=I!==void 0?Ge(r,I):void 0;if(V)return{ok:!0,description:ot(m,V,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(r.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=r.viewSpecs??{},S=rt(a),k=(l,h)=>ie(p,null,l,{app:r,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=T(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let G=k(l,{slot:h}),[B,...O]=G,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:G,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?re(m,A,l):l,W=z(u,d,{limit:3,said:[g],glance:!0,locale:r.brand?.locale,timeZone:r.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:W.map(G=>({t:"text",text:G.alone}))}};function j(l,h,M,d="",g=0){let $=[];return l.forEach((u,W)=>{let G=`${M}.${W+g}`;switch("problem"in u&&u.problem&&c.push({at:`${G}${d}`,says:u.problem}),u.t){case"title":$.push({t:"heading",level:3,text:u.text});return;case"text":$.push({t:"text",text:u.markdown?je(u.text):u.runs?lt(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":$.push({t:"badge",text:u.text});return;case"field":case"image":$.push({t:"field",label:u.label,text:u.text});return;case"progress":$.push({t:"progress",label:u.label,text:u.text});return;case"group":$.push(...j(u.blocks,h,`${G}.group`,d));return;case"when":$.push(...j(u.blocks,h,`${G}.show`,d));return;case"divider":case"figure":return;case"headline":$.push({t:"heading",level:u.level,text:u.text});return;case"number":$.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){$.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&$.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>nt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(J=>J.value===D.value)??D).members.length}:{},items:D.members.map(J=>f(J,O,B))}));$.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),$}let i=[],v,b,P,N=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=T(l,x);P={slug:x.id,title:h,kind:x.kind,address:ke(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(...Ue(r,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?re(m,A,x):x;for(let $ of Pe(l,z(g,l,{said:[h],locale:r.brand?.locale,timeZone:r.brand?.timeZone}))){$.title&&i.push({t:"heading",level:2,text:$.title});for(let u of $.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?xe(r).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(N=Ee(t,e,l.kind).map(d=>He(t,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=r.brand,g=d?.name??r.name,$=be(d)?.light,u=$&&we($)?$:void 0;if(v={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...ye(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},r.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let W=t.kindsKeptFrom(e),G=new Set([...r.pages?.hide??[],...W,...t.modules.disabledKinds]),B=Se(m.kinds,r.pages?.order).filter(O=>!G.has(O));i.push({t:"heading",level:1,text:r.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${E(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let $=d[g]?.column;if(!$)continue;let u=L(m,g,$),W=Z(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?T(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:E(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${W.length} ${E(m,g,W.length)} in columns by ${_(m.tryDefinition(g),$).toLowerCase()}.`});let G=u.map(y=>({column:y,items:W.filter(D=>X(D,$,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:G});let B=new Map;for(let y of W)for(let D of se(t,e,y,$,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=Te(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter($=>H(m.tryDefinition(g),$)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>E(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${E(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,qe=a<_e?"phone":"wide",le=P.kind===null?it(m,A):[],ce={...v?{masthead:v}:{},...le.length>0?{facts:le}:{},place:P,seat:K,width:a,variant:qe,drawnBy:b,parts:i,...N.length>0?{forms:N}:{},problems:c};return{ok:!0,description:{...ce,text:ae(ce)}}}function ot(t,e,n){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],r={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:n,variant:n<_e?"phone":"wide",drawnBy:"form",parts:o,forms:[Le(t,e)],problems:[]};return{...r,text:ae(r)}}function it(t,e){let n=Fe(t,e,null),o=r=>Array.isArray(r)?r.map(o).join(", "):r===null?"nothing":typeof r=="boolean"?r?"yes":"no":typeof r=="object"?r.label:String(r);return[...De(t)].map(([r,a])=>{let s=a.label??U(r);return Object.hasOwn(n.values,r)?{name:r,label:s,value:o(n.values[r])}:{name:r,label:s,refused:n.refused[r]??"it could not be worked out"}})}function E(t,e,n){let o=t.tryDefinition(e);if(n===1)return o?.noun??e;let r=fe(t,e);return ue(r)}function ae(t){let e=[`${t.place.title} (${t.place.address}) \u2014 as ${t.seat}, ${t.width} wide (${t.variant}).`],n=t.masthead;n&&e.push(`Masthead: ${n.logo?`the logo ("${n.logo.alt}", ${n.logo.drawn==="image"?n.logo.src:"inline SVG"}), `:""}${n.name}${n.subtitle?` \u2014 ${n.subtitle}`:""}`);let o=(r,a)=>{for(let s of r)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(t.parts,"");for(let r of t.forms??[])e.push(...Ze(r));if(t.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let r of t.facts)e.push(`- ${r.label} (${r.name}): ${r.value??`not worked out \u2014 ${r.refused}`}`)}if(t.videos&&t.videos.length>0){e.push("Videos:");for(let r of t.videos)e.push(`- ${at(r)}`)}if(t.problems.length>0){e.push("Problems:");for(let r of t.problems)e.push(`- ${r.at}: ${r.says}`)}return e.join(`
|
|
1
|
+
import{a as Ie}from"./chunk.XTTESA7X.js";import{c as Oe,d as Be,f as Ge}from"./chunk.5M34BJIQ.js";import{e as Ce,f as Re,k as Fe,l as re,n as Me}from"./chunk.S2DOVJRL.js";import{d as z,e as Pe,k as ne}from"./chunk.FOSY7MZF.js";import{a as Ae,d as je}from"./chunk.NBVPWLRY.js";import{f as De}from"./chunk.ZMWAZACO.js";import{$c as be,C as Q,Fd as ve,L as de,Wd as ke,Xb as ge,Xc as ye,Zc as we,ea as ue,ee as xe,ga as U,ha as me,ka as H,kd as Z,la as T,ld as $e,ma as pe,na as ee,ne as Se,oa as fe,oc as te,pc as he,ra as _,ta as q}from"./chunk.J24YPQ5I.js";function Xe(t,e,n){let o=t.tryDefinition(e)?.fields.shape,r=Q(o?.[n]),a=!1,s=!1;for(;r&&(r.type==="optional"||r.type==="default"||r.type==="nullable"||r.type==="prefault");)(r.type==="optional"||r.type==="nullable")&&(a=!0),(r.type==="default"||r.type==="prefault")&&(s=!0),r=Q(r.innerType);if(r?.type!=="enum")return;let p=(r.entries?Object.values(r.entries):r.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function L(t,e,n){let o=Xe(t,e,n);if(!o)return[];let r=t.tryDefinition(e),a=o.values.map(s=>({value:s,label:Ae(r,n,s)}));return o.empty&&a.push({value:null,label:`No ${_(r,n).toLowerCase()}`}),a}function X(t,e,n){let o=t[e];return typeof o=="string"&&n.some(r=>r.value===o)?o:null}function se(t,e,n,o,r=L(t.schema,n.kind,o)){return Ve(t,e,n,o,r).flatMap(a=>a.move?[a.move]:[])}function Ve(t,e,n,o,r=L(t.schema,n.kind,o)){let a=Ne(t.schema,t.allMutations(),n.kind,o,r),s=X(n,o,r),p=q(t.schema.tryDefinition(n.kind),n.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,I,V;for(let c of F){let w=R==="step"?{[c.subject.arg]:n.id}:{[c.subject.arg]:n.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){V??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=t.permits(S,e);if(!k.ok){I??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{ge(t.graph,c,w)}catch(f){I??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:I??V??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ne(t,e,n,o,r=L(t,n,o)){let a=Ke(t,e,n,o),s=We(t,e,n,o);return r.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Ke(t,e,n,o){return e.filter(r=>r.subject!==void 0&&r.derived===void 0&&typeof r.sets?.[o]=="string"&&te(t,r).includes(n))}function We(t,e,n,o){let r=t.tryDefinition(n);return r?e.filter(a=>{if(!a.subject||!te(t,a).includes(n)||!he(a,r).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var oe=(t,e)=>e&&t[e]!==void 0?String(t[e]):"";function Ye(t,e,n){let o=c=>t.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(t.tryDefinition(c),w)):[],r=o(n.rows),a=o(n.columns),s=new Set(r.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=n.link;if(typeof C=="string"){let c=f=>t.tryDefinition(f)?.edges?.[C]?.to,w=(c(n.columns)??[]).some(f=>f===n.rows||f==="*"),S=(c(n.rows)??[]).some(f=>f===n.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let v of k)for(let b of c.get(f).get(v.id)??[])i.has(`${v.id}|${b}`)||(i.add(`${v.id}|${b}`),j.push({id:b,via:[...v.via,v.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=n.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?T(t.tryDefinition(c.kind),c):c[w],I=Z(r,n.sort,x).map(c=>{let w=c;return{node:c,label:T(t.tryDefinition(c.kind),c),group:oe(w,n.rowGroup),ref:oe(w,n.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(n.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),V=Z(a,n.columnSort,x).map(c=>({node:c,label:T(t.tryDefinition(c.kind),c),group:oe(c,n.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:n.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:I,columns:V,cells:A}}function Te(t,e,n){let{rows:o,columns:r,cells:a}=Ye(t,e,n),s=(i,v)=>ee(t,i,v),p=i=>ee(t,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:T(t.tryDefinition(i.kind),i),parts:[]}),A=i=>{let v=e.getNode(i);if(!v)return null;let b=t.tryDefinition(v.kind),P=T(b,v),N=z(v,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...N].join(", ")},C=typeof n.link=="string"?[]:n.link.path.slice(0,-1).flatMap((i,v,b)=>{let P=ve(t,n.columns,b.slice(0,v+1));return P.ok?[...P.reached]:[]}),R=$e(t,n,{rows:o.length,columns:r.length,cells:a.length});if(R)return[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${r.length>0?`: ${r.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(r.map(i=>[i.node.id,i.label])),I=new Map(r.map((i,v)=>[i.node.id,v])),V=new Map,c=new Map;for(let i of a){let v=V.get(i.rowId);v?v.push(i):V.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...V.get(i.node.id)??[]].sort((P,N)=>I.get(P.columnId)-I.get(N.columnId)).map(P=>{let N=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${N.length>0?` (${N.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:r.map(i=>{let v=c.get(i.node.id)??new Set,b=o.filter(P=>v.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=r.filter(i=>!S.has(i.node.id)),j=n.rows===n.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(n.rows,k.length)} with no ${p(n.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(n.columns,f.length)} on no ${p(n.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function ie(t,e,n,o={}){let{app:r,blocks:a=n?r?.viewSpecs?.[n.kind]?.[o.slot??"page"]:r?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(n||o.blocks?void 0:1),p=Me(t,e,n,{...o,money:o.money??r?.brand,firstHeading:s});return n&&!p.node?[]:Re(typeof a[0]?.t=="string"?a:Ce(a),p)}function Y(t,e,n){let o=!(e.optional||e.control==="boolean"),r=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>U(q(t.tryDefinition(s),s))).join(" or "):n(e.name).label,a={name:e.name,label:r,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>n(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${Y(t,e.item,n).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>Y(t,s,n))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>me(s.value))};default:return{...a,input:"answer"}}}function He(t,e,n){let o=Be(t,e,n),r=t.schema,a=Oe(r,n).filter(p=>p.name!==n.subject?.arg&&!o.has(p.name)),s=pe(n);return{act:n.name,title:s,submit:s,fields:a.map(p=>Y(r,p,m=>ne(r,n,m)))}}function Le(t,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(n=>Y(t,n,o=>ne(t,e.act,o)))}}function Ee(t,e,n){return t.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(n))}function Ze(t,e=""){let n=[`${e}Form "${t.title}" (${t.visitor?`the visitor form ${t.visitor}, running `:""}act ${t.act}), button "${t.submit}":`],o=(r,a)=>{for(let s of r){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";n.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(t.fields,`${e} `),t.fields.length===0&&n.push(`${e} (asks nothing)`),n}function Ue(t,e){let n=t.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(n[o.attach]?.page?.length??0)>0).map(o=>{let r=E(t.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Je(r)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Je=t=>`${/^[aeiou]/i.test(t)?"an":"a"} ${t}`,Qe=240,ze=10,et=1160,tt=40,_e=640,nt=3,rt=t=>Math.max(1,Math.floor((Math.min(t,et)-tt+ze)/(Qe+ze)));function st(t,e,n,o){let{app:r}=o,a=o.width??1440,s=o.today??t.today()??de(r.brand?.timeZone),p=t.seenBy(e),m=p.schema,A=p.graph,C=Ie(r,o.views?{views:o.views}:{}),R=typeof n=="string"?n.trim():n.slug,F=typeof n=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===n.slug&&l.kind===n.kind)??n,x=!F&&typeof n=="string"?A.getNode(R):void 0,I=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,V=I!==void 0?Ge(r,I):void 0;if(V)return{ok:!0,description:ot(m,V,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(r.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=r.viewSpecs??{},S=rt(a),k=(l,h)=>ie(p,null,l,{app:r,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=T(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let G=k(l,{slot:h}),[B,...O]=G,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:G,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?re(m,A,l):l,W=z(u,d,{limit:3,said:[g],glance:!0,locale:r.brand?.locale,timeZone:r.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:W.map(G=>({t:"text",text:G.alone}))}};function j(l,h,M,d="",g=0){let $=[];return l.forEach((u,W)=>{let G=`${M}.${W+g}`;switch("problem"in u&&u.problem&&c.push({at:`${G}${d}`,says:u.problem}),u.t){case"title":$.push({t:"heading",level:3,text:u.text});return;case"text":$.push({t:"text",text:u.markdown?je(u.text):u.runs?lt(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":$.push({t:"badge",text:u.text});return;case"field":case"image":$.push({t:"field",label:u.label,text:u.text});return;case"progress":$.push({t:"progress",label:u.label,text:u.text});return;case"group":$.push(...j(u.blocks,h,`${G}.group`,d));return;case"when":$.push(...j(u.blocks,h,`${G}.show`,d));return;case"divider":case"figure":return;case"headline":$.push({t:"heading",level:u.level,text:u.text});return;case"number":$.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){$.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&$.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>nt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(J=>J.value===D.value)??D).members.length}:{},items:D.members.map(J=>f(J,O,B))}));$.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),$}let i=[],v,b,P,N=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=T(l,x);P={slug:x.id,title:h,kind:x.kind,address:ke(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(...Ue(r,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?re(m,A,x):x;for(let $ of Pe(l,z(g,l,{said:[h],locale:r.brand?.locale,timeZone:r.brand?.timeZone}))){$.title&&i.push({t:"heading",level:2,text:$.title});for(let u of $.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?xe(r).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(N=Ee(t,e,l.kind).map(d=>He(t,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=r.brand,g=d?.name??r.name,$=be(d)?.light,u=$&&we($)?$:void 0;if(v={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...ye(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},r.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let W=t.kindsKeptFrom(e),G=new Set([...r.pages?.hide??[],...W,...t.modules.disabledKinds]),B=Se(m.kinds,r.pages?.order).filter(O=>!G.has(O));i.push({t:"heading",level:1,text:r.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${E(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let $=d[g]?.column;if(!$)continue;let u=L(m,g,$),W=Z(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?T(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:E(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${W.length} ${E(m,g,W.length)} in columns by ${_(m.tryDefinition(g),$).toLowerCase()}.`});let G=u.map(y=>({column:y,items:W.filter(D=>X(D,$,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:G});let B=new Map;for(let y of W)for(let D of se(t,e,y,$,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=Te(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter($=>H(m.tryDefinition(g),$)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>E(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${E(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,qe=a<_e?"phone":"wide",le=P.kind===null?it(m,A):[],ce={...v?{masthead:v}:{},...le.length>0?{facts:le}:{},place:P,seat:K,width:a,variant:qe,drawnBy:b,parts:i,...N.length>0?{forms:N}:{},problems:c};return{ok:!0,description:{...ce,text:ae(ce)}}}function ot(t,e,n){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],r={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:n,variant:n<_e?"phone":"wide",drawnBy:"form",parts:o,forms:[Le(t,e)],problems:[]};return{...r,text:ae(r)}}function it(t,e){let n=Fe(t,e,null),o=r=>Array.isArray(r)?r.map(o).join(", "):r===null?"nothing":typeof r=="boolean"?r?"yes":"no":typeof r=="object"?r.label:String(r);return[...De(t)].map(([r,a])=>{let s=a.label??U(r);return Object.hasOwn(n.values,r)?{name:r,label:s,value:o(n.values[r])}:{name:r,label:s,refused:n.refused[r]??"it could not be worked out"}})}function E(t,e,n){let o=t.tryDefinition(e);if(n===1)return o?.noun??e;let r=fe(t,e);return ue(r)}function ae(t){let e=[`${t.place.title} (${t.place.address}) \u2014 as ${t.seat}, ${t.width} wide (${t.variant}).`],n=t.masthead;n&&e.push(`Masthead: ${n.logo?`the logo ("${n.logo.alt}", ${n.logo.drawn==="image"?n.logo.src:"inline SVG"}), `:""}${n.name}${n.subtitle?` \u2014 ${n.subtitle}`:""}`);let o=(r,a)=>{for(let s of r)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(t.parts,"");for(let r of t.forms??[])e.push(...Ze(r));if(t.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let r of t.facts)e.push(`- ${r.label} (${r.name}): ${r.value??`not worked out \u2014 ${r.refused}`}`)}if(t.videos&&t.videos.length>0){e.push("Videos:");for(let r of t.videos)e.push(`- ${at(r)}`)}if(t.problems.length>0){e.push("Problems:");for(let r of t.problems)e.push(`- ${r.at}: ${r.says}`)}return e.join(`
|
|
2
2
|
`)}function at(t){let e=t.autoplay?"plays as a background, muted and looping, with no controls":"plays with the browser's controls";return`${t.text} (${t.field} of ${t.record}): ${t.source}${t.duration!==void 0?`, ${Math.round(t.duration)} s`:""}, ${t.poster?"with a poster":"no poster"}; ${e}${t.cover?", filling its box":""}; ${t.playable?"playable":`not playable: ${t.why??"it is not a video a browser plays"}`}.`}function lt(t){return t.map((e,n)=>(n===0?"":e.field===void 0&&t[n-1].field===void 0?" \xB7 ":" ")+e.text).join("")}export{L as a,X as b,se as c,Ve as d,Ne as e,Ke as f,We as g,ie as h,Ue as i,st as j,ae as k};
|