graview 0.1.70 → 0.1.71
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.23DATB5Y.js +1 -0
- package/dist/preview/chunk.2INDKSJI.js +1 -0
- package/dist/preview/chunk.3CLTABGP.js +1 -0
- package/dist/preview/{chunk.4O3STSC4.js → chunk.3RRK6UTN.js} +1 -1
- package/dist/preview/chunk.45HUV56Z.js +1 -0
- package/dist/preview/chunk.4HU2ILFY.js +1 -0
- package/dist/preview/{chunk.M7DJJRFH.js → chunk.4LWWXIM4.js} +1 -1
- package/dist/preview/chunk.4O64QV2Y.js +1 -0
- package/dist/preview/{chunk.KP7HUXH5.js → chunk.4QMAYVPU.js} +1 -1
- package/dist/preview/chunk.4UDST6IF.js +1 -0
- package/dist/preview/{chunk.7TZXDPPO.js → chunk.4YZ2A6SJ.js} +3 -3
- package/dist/preview/{chunk.PAIBRJVZ.js → chunk.4ZEHLUXV.js} +1 -1
- package/dist/preview/{chunk.I7CSRZC2.js → chunk.5EQRIZ6I.js} +1 -1
- package/dist/preview/chunk.5OS4SYHE.js +1 -0
- package/dist/preview/{chunk.ZIGW5VOT.js → chunk.5PQV7GFE.js} +1 -1
- package/dist/preview/{chunk.SSHEFQ4R.js → chunk.5WCSQFS5.js} +1 -1
- package/dist/preview/{chunk.RJ7UV3XI.js → chunk.64K5ELSQ.js} +1 -1
- package/dist/preview/{chunk.2T24FYAO.js → chunk.67S2UWBT.js} +1 -1
- package/dist/preview/{chunk.FXCKKVT5.js → chunk.6A3KTD66.js} +1 -1
- package/dist/preview/chunk.6BBUTKFC.js +23 -0
- package/dist/preview/chunk.6IMRCKB4.js +1 -0
- package/dist/preview/chunk.6L6RUOSF.js +5 -0
- package/dist/preview/{chunk.ZGJUCVT5.js → chunk.6TBQV3NO.js} +1 -1
- package/dist/preview/chunk.6ZRVVRDQ.js +1 -0
- package/dist/preview/{chunk.4VTUC5TF.js → chunk.7FI75ZVE.js} +1 -1
- package/dist/preview/{chunk.NKUNCQB3.js → chunk.7KX36ENH.js} +1 -1
- package/dist/preview/{chunk.JPJHM62B.js → chunk.7LPHWJB4.js} +1 -1
- package/dist/preview/chunk.7MDGPTYF.js +1 -0
- package/dist/preview/{chunk.JEQ6CA5M.js → chunk.7PWLRRUS.js} +2 -2
- package/dist/preview/{chunk.YBQUP3KE.js → chunk.7TACFS7Q.js} +1 -1
- package/dist/preview/{chunk.DIVANC3G.js → chunk.7THS3DLZ.js} +1 -1
- package/dist/preview/{chunk.5W7EGQCQ.js → chunk.7XGU6KVF.js} +2 -2
- package/dist/preview/chunk.7ZLCA3WK.js +1 -0
- package/dist/preview/{chunk.4BSEYZMS.js → chunk.ARGEGV5T.js} +1 -1
- package/dist/preview/{chunk.3KF5RYPW.js → chunk.BSWR5SGX.js} +1 -1
- package/dist/preview/{chunk.BBMX3IIO.js → chunk.BWMPC7LK.js} +1 -1
- package/dist/preview/{chunk.55C7WO4X.js → chunk.CEJIH3CN.js} +1 -1
- package/dist/preview/{chunk.F5756PXX.js → chunk.CEOQY5KS.js} +2 -2
- package/dist/preview/{chunk.NZFO6BM3.js → chunk.CGRX6SDE.js} +1 -1
- package/dist/preview/{chunk.C67TMA4U.js → chunk.CPK6CYKN.js} +1 -1
- package/dist/preview/{chunk.T552MHMU.js → chunk.CVN2XFMF.js} +1 -1
- package/dist/preview/{chunk.MGG5DH2S.js → chunk.D4F6QX5L.js} +1 -1
- package/dist/preview/{chunk.M3HLZX6Q.js → chunk.D6ODKMOV.js} +1 -1
- package/dist/preview/{chunk.RECTEAG4.js → chunk.DDSAFU3B.js} +1 -1
- package/dist/preview/{chunk.UJF6YTEO.js → chunk.DG3YNOH3.js} +1 -1
- package/dist/preview/chunk.DGYWNM5U.js +1 -0
- package/dist/preview/{chunk.NBB5ALVJ.js → chunk.DHO3QZYK.js} +1 -1
- package/dist/preview/{chunk.4QBW46XV.js → chunk.DJGZOPAS.js} +1 -1
- package/dist/preview/{chunk.2MWEYNVH.js → chunk.DX7RGK5G.js} +1 -1
- package/dist/preview/{chunk.CZI6J5CE.js → chunk.EA2KYBBR.js} +1 -1
- package/dist/preview/{chunk.DWMFLLJO.js → chunk.EEGVI266.js} +1 -1
- package/dist/preview/{chunk.BQWMHHAZ.js → chunk.EHLV3LND.js} +2 -2
- package/dist/preview/{chunk.3MPLUSVY.js → chunk.EJC7ACZT.js} +1 -1
- package/dist/preview/{chunk.6NYSB6OZ.js → chunk.EJIQDMLU.js} +1 -1
- package/dist/preview/{chunk.QQUZ5RTQ.js → chunk.EOSN5DWW.js} +1 -1
- package/dist/preview/{chunk.2QALBEWP.js → chunk.EPSYX2SF.js} +1 -1
- package/dist/preview/chunk.EUXAIG73.js +1 -0
- package/dist/preview/{chunk.S4QSZRKH.js → chunk.EZQK23AB.js} +1 -1
- package/dist/preview/{chunk.ZTHZHBVN.js → chunk.F5O3HR7X.js} +1 -1
- package/dist/preview/chunk.F6MY6WJ4.js +1 -0
- package/dist/preview/{chunk.UVMHC6VM.js → chunk.F7KVEWFH.js} +1 -1
- package/dist/preview/{chunk.FJXKQZZS.js → chunk.FIUPDGUZ.js} +1 -1
- package/dist/preview/chunk.FNSVGSZI.js +1 -0
- package/dist/preview/chunk.FOHZPYUV.js +1 -0
- package/dist/preview/chunk.FW6M6GIU.js +32 -0
- package/dist/preview/{chunk.IJVR7ZL7.js → chunk.G5AF5IXL.js} +1 -1
- package/dist/preview/{chunk.SCN6IYDG.js → chunk.G767NLBH.js} +1 -1
- package/dist/preview/{chunk.X7HMTN3Z.js → chunk.GFBE4VNT.js} +1 -1
- package/dist/preview/{chunk.U5Q7EVZQ.js → chunk.GFOZVQBQ.js} +1 -1
- package/dist/preview/{chunk.KJAOJTZZ.js → chunk.GKYJQE5A.js} +1 -1
- package/dist/preview/{chunk.YCMMATFK.js → chunk.GOVRX2YX.js} +1 -1
- package/dist/preview/{chunk.U3CV227I.js → chunk.H33XWGAY.js} +1 -1
- package/dist/preview/{chunk.DGDOZHYK.js → chunk.H4BPTMED.js} +1 -1
- package/dist/preview/chunk.HLKDYI6J.js +1 -0
- package/dist/preview/{chunk.C4LC2UEU.js → chunk.HPFEYMGP.js} +1 -1
- package/dist/preview/{chunk.CLJKQLK2.js → chunk.HT35PAHI.js} +2 -2
- package/dist/preview/{chunk.6VG2LCES.js → chunk.HXRHEPPJ.js} +1 -1
- package/dist/preview/{chunk.LZNHTROY.js → chunk.IXYG65TM.js} +1 -1
- package/dist/preview/chunk.IZDB777E.js +1 -0
- package/dist/preview/{chunk.ZQSV5XVB.js → chunk.JAPTTM6Y.js} +1 -1
- package/dist/preview/{chunk.CUA7F3YJ.js → chunk.JCKIJSW7.js} +1 -1
- package/dist/preview/{chunk.WAIIXXVI.js → chunk.JLNTE5CH.js} +2 -2
- package/dist/preview/{chunk.5FQHZVE3.js → chunk.JNK5WBSU.js} +1 -1
- package/dist/preview/chunk.JREA2XDG.js +1 -0
- package/dist/preview/{chunk.CHG522KL.js → chunk.KBJ3UUER.js} +1 -1
- package/dist/preview/{chunk.VBHV4TLG.js → chunk.KHRS2SKB.js} +1 -1
- package/dist/preview/{chunk.CZUUFO6A.js → chunk.KJPLX72N.js} +1 -1
- package/dist/preview/{chunk.7LAXSQQY.js → chunk.KZUHXOZU.js} +2 -2
- package/dist/preview/{chunk.R65YX332.js → chunk.L3MLGFIS.js} +1 -1
- package/dist/preview/{chunk.RXUL6P7Y.js → chunk.L6P55HFW.js} +1 -1
- package/dist/preview/{chunk.J4NY2K2A.js → chunk.LDWWUKKX.js} +1 -1
- package/dist/preview/{chunk.RIP2SAQ5.js → chunk.LHCGC3K6.js} +1 -1
- package/dist/preview/{chunk.IQCMV5WD.js → chunk.LNKY6MT4.js} +1 -1
- package/dist/preview/chunk.LQ5J6YQW.js +1 -0
- package/dist/preview/{chunk.O2XPLDMM.js → chunk.MEAUTBVM.js} +1 -1
- package/dist/preview/chunk.MEBKTW7H.js +17 -0
- package/dist/preview/{chunk.K6EKSURO.js → chunk.MFMC35ET.js} +1 -1
- package/dist/preview/chunk.MJ4T6YXI.js +1 -0
- package/dist/preview/{chunk.SWY6DIE4.js → chunk.MKJV3BM5.js} +3 -3
- package/dist/preview/chunk.ML4X7VVK.js +1 -0
- package/dist/preview/{chunk.ZOSTOVXR.js → chunk.MM7MLBGB.js} +1 -1
- package/dist/preview/{chunk.NCBUECIW.js → chunk.MQNW3O67.js} +1 -1
- package/dist/preview/{chunk.CVVNHQPO.js → chunk.MT252WP4.js} +1 -1
- package/dist/preview/{chunk.VKQONZKR.js → chunk.MWWNKM3I.js} +1 -1
- package/dist/preview/chunk.N3MXLORL.js +3 -0
- package/dist/preview/{chunk.SUYYDJGZ.js → chunk.NH3VXTGX.js} +1 -1
- package/dist/preview/{chunk.IRPMGHZN.js → chunk.NI4OPHTL.js} +1 -1
- package/dist/preview/chunk.NNGG7RCO.js +1 -0
- package/dist/preview/{chunk.MZSWWMX6.js → chunk.NXHEOHRR.js} +1 -1
- package/dist/preview/{chunk.A5ENJJZN.js → chunk.O5RPSUXV.js} +1 -1
- package/dist/preview/{chunk.CM7EDQ4E.js → chunk.OKHXXIMN.js} +1 -1
- package/dist/preview/chunk.OOQG2AEF.js +1 -0
- package/dist/preview/{chunk.MYR36HW4.js → chunk.OPMGQS5J.js} +1 -1
- package/dist/preview/{chunk.TUVPQLFL.js → chunk.OUF2QFZL.js} +1 -1
- package/dist/preview/{chunk.6QMRDSTD.js → chunk.OVSKPBPS.js} +1 -1
- package/dist/preview/chunk.OYMN3IFX.js +1 -0
- package/dist/preview/{chunk.3HFBHLXC.js → chunk.P43LPXXJ.js} +1 -1
- package/dist/preview/{chunk.FSZQTX3K.js → chunk.PGT4ZQDG.js} +4 -4
- package/dist/preview/{chunk.5IM2X3VT.js → chunk.PQTXM4VY.js} +1 -1
- package/dist/preview/{chunk.U2DZE7A5.js → chunk.Q6GEPVQ7.js} +1 -1
- package/dist/preview/{chunk.HMV4ILAC.js → chunk.QDDDKEBH.js} +1 -1
- package/dist/preview/{chunk.6KYTCEIH.js → chunk.QJJWAYHB.js} +1 -1
- package/dist/preview/{chunk.QAERSZVB.js → chunk.QK4QZVQG.js} +1 -1
- package/dist/preview/{chunk.XAN7QXMQ.js → chunk.QKRQPUCE.js} +1 -1
- package/dist/preview/{chunk.I3ADXJQW.js → chunk.QNWGDG2Z.js} +1 -1
- package/dist/preview/{chunk.NZ5TJKPT.js → chunk.QVBP4UZG.js} +2 -2
- package/dist/preview/{chunk.YTRUZ56A.js → chunk.RDUGUC7R.js} +1 -1
- package/dist/preview/{chunk.TVNY7F64.js → chunk.RHIP2UYE.js} +1 -1
- package/dist/preview/{chunk.PYGNO2AV.js → chunk.RJ7VSWTA.js} +3 -3
- package/dist/preview/{chunk.LEZGBHPZ.js → chunk.RO3D2RNP.js} +1 -1
- package/dist/preview/{chunk.KOVTQCHX.js → chunk.S2BMI23H.js} +1 -1
- package/dist/preview/{chunk.XJ4JYROM.js → chunk.SPJ34VHA.js} +1 -1
- package/dist/preview/{chunk.LZ3HO3HM.js → chunk.T6KOL7TW.js} +1 -1
- package/dist/preview/{chunk.BJ3G7J2Z.js → chunk.T6UJEXFL.js} +3 -2
- package/dist/preview/{chunk.T4QRIJE4.js → chunk.TBEKEHFS.js} +1 -1
- package/dist/preview/chunk.TO3ZKCA2.js +1 -0
- package/dist/preview/{chunk.QILGAV7H.js → chunk.TQ3MNB6K.js} +1 -1
- package/dist/preview/{chunk.F5XWYO5W.js → chunk.TRP66PHK.js} +1 -1
- package/dist/preview/{chunk.QODVFVWE.js → chunk.TSZ2S3VG.js} +1 -1
- package/dist/preview/{chunk.DWPM7AWA.js → chunk.TTM5GQ2U.js} +1 -1
- package/dist/preview/chunk.TUBY6SV3.js +1 -0
- package/dist/preview/{chunk.7QWGIGHM.js → chunk.U5KJQFAP.js} +1 -1
- package/dist/preview/chunk.U6V4KZF5.js +1 -0
- package/dist/preview/chunk.UJ7RTNT4.js +1 -0
- package/dist/preview/{chunk.MR776WQ2.js → chunk.UQZ2P6KD.js} +1 -1
- package/dist/preview/{chunk.OXXZGPJZ.js → chunk.UZKBFI52.js} +1 -1
- package/dist/preview/{chunk.HIJ72QX6.js → chunk.V5JB5UJS.js} +1 -1
- package/dist/preview/{chunk.3I2SGKKF.js → chunk.VDFQFLTU.js} +1 -1
- package/dist/preview/{chunk.I6HIVTXU.js → chunk.VGYG2IBZ.js} +1 -1
- package/dist/preview/chunk.VICBF3MQ.js +2 -0
- package/dist/preview/{chunk.TD2V74XU.js → chunk.VL3YDD7D.js} +1 -1
- package/dist/preview/{chunk.A7JORJJL.js → chunk.VPFUOTY7.js} +1 -1
- package/dist/preview/{chunk.UWEFODVV.js → chunk.VUDNQOOX.js} +1 -1
- package/dist/preview/{chunk.YIDNZTON.js → chunk.VVIQSFM4.js} +1 -1
- package/dist/preview/{chunk.J65CZJIC.js → chunk.W332P5T3.js} +1 -1
- package/dist/preview/{chunk.S6IKR6RD.js → chunk.W3TJF4EH.js} +1 -1
- package/dist/preview/{chunk.7FTATAH2.js → chunk.W5O5F4FT.js} +1 -1
- package/dist/preview/chunk.W6L2VAJG.js +2 -0
- package/dist/preview/{chunk.QG3LV4RH.js → chunk.WGH2P2YL.js} +1 -1
- package/dist/preview/{chunk.KV3N6VRG.js → chunk.WS5ORRGS.js} +1 -1
- package/dist/preview/{chunk.7HNMG6LG.js → chunk.WU6D3SPL.js} +1 -1
- package/dist/preview/{chunk.MSWOETXN.js → chunk.X2UYEA7H.js} +1 -1
- package/dist/preview/{chunk.FBDCHJS2.js → chunk.X45EITTK.js} +1 -1
- package/dist/preview/{chunk.JIEBGUCA.js → chunk.X7U3JMBR.js} +1 -1
- package/dist/preview/chunk.XSM4OTF4.js +1 -0
- package/dist/preview/{chunk.5A5DI36V.js → chunk.XTHSPLZZ.js} +1 -1
- package/dist/preview/{chunk.TS5APXWC.js → chunk.Y5WQD6KV.js} +1 -1
- package/dist/preview/{chunk.3QPMFUMV.js → chunk.YXVUJ3NB.js} +1 -1
- package/dist/preview/{chunk.F5STM4DX.js → chunk.Z22C2JJ4.js} +1 -1
- package/dist/preview/{chunk.BBLA4PSP.js → chunk.Z2BCOZDZ.js} +1 -1
- package/dist/preview/{chunk.BZXJKWNI.js → chunk.Z3TK2LJM.js} +1 -1
- package/dist/preview/chunk.ZGLOXN7O.js +1 -0
- package/dist/preview/{chunk.UJM5EZDM.js → chunk.ZLQIGZXO.js} +1 -1
- package/dist/preview/{chunk.FUTSLXWN.js → chunk.ZONRIOIA.js} +1 -1
- package/dist/preview/{chunk.NTAC5NNE.js → chunk.ZY3NAJDM.js} +1 -1
- package/dist/preview/index.html +55 -55
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2QOB62XU.js +0 -1
- package/dist/preview/chunk.36FKQJFM.js +0 -2
- package/dist/preview/chunk.3A3DCALP.js +0 -1
- package/dist/preview/chunk.3GPYKWAD.js +0 -1
- package/dist/preview/chunk.3ZP6IDUC.js +0 -1
- package/dist/preview/chunk.53HW224Y.js +0 -1
- package/dist/preview/chunk.AW74DZ5V.js +0 -17
- package/dist/preview/chunk.CCCSZRKU.js +0 -1
- package/dist/preview/chunk.DBSSCJQM.js +0 -1
- package/dist/preview/chunk.DW6KXAUM.js +0 -1
- package/dist/preview/chunk.HHQUCFN4.js +0 -1
- package/dist/preview/chunk.HPWMCS3H.js +0 -23
- package/dist/preview/chunk.HRLCDBMO.js +0 -1
- package/dist/preview/chunk.I7ODVOO5.js +0 -1
- package/dist/preview/chunk.IANOWT3Z.js +0 -1
- package/dist/preview/chunk.IFPJPJ4M.js +0 -1
- package/dist/preview/chunk.IUVRJDL3.js +0 -5
- package/dist/preview/chunk.J4CSY2D5.js +0 -2
- package/dist/preview/chunk.JJIKTTXB.js +0 -1
- package/dist/preview/chunk.KDOJC4FX.js +0 -1
- package/dist/preview/chunk.KLZPUTMU.js +0 -1
- package/dist/preview/chunk.LQ2PDW2M.js +0 -32
- package/dist/preview/chunk.MNWP3TPN.js +0 -1
- package/dist/preview/chunk.NILR2BWR.js +0 -1
- package/dist/preview/chunk.NNYKLENL.js +0 -1
- package/dist/preview/chunk.PZHCWMKT.js +0 -1
- package/dist/preview/chunk.QVID5WHS.js +0 -1
- package/dist/preview/chunk.RHV73CBA.js +0 -3
- package/dist/preview/chunk.RP6C2IUM.js +0 -1
- package/dist/preview/chunk.RPHZY7N4.js +0 -1
- package/dist/preview/chunk.UYBSVE2W.js +0 -1
- package/dist/preview/chunk.WMZ2BINI.js +0 -1
- package/dist/preview/chunk.X2RHBTJI.js +0 -1
- package/dist/preview/chunk.X3FPVFFB.js +0 -1
- package/dist/preview/chunk.X4PFLIXB.js +0 -1
- package/dist/preview/chunk.YR7DKU5T.js +0 -1
- package/dist/preview/chunk.ZBK3FCVE.js +0 -1
- package/dist/preview/chunk.ZH5L746C.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ab as k,Ed as _,Gc as I,Jc as ue,Kc as le,Mb as de,Mc as ge,Nb as P,Nc as pe,Ob as D,Oc as V,Pc as L,Qc as U,Qd as O,Rb as h,Ub as ce,fb as N,ga as ee,gb as ie,ha as F,lb as se,mb as oe,nb as re,ob as ae,pa as ne,ta as te,tc as K,zb as T}from"./chunk.IUVRJDL3.js";import{j as m}from"./chunk.FQLNBIQ5.js";var ye=e=>N(e).id??e.session;function z(e,i={}){let o=I(e),n=new Map,t=i.advisory===!0;for(let s of e){if(s.vote===void 0||s.withheld||o.has(s.id)||s.vote.advisory===!0!==t)continue;let a=t?s.vote.voter:ye(s.author);if(a===void 0)continue;let d=n.get(s.vote.suggestion);d||n.set(s.vote.suggestion,d=new Map),s.vote.vote===null?d.delete(a):d.set(a,s.vote.vote)}return n}function fe(e){let i=0,o=0;for(let n of e?.values()??[])n==="for"?i++:o++;return{for:i,against:o}}function $e(e,i,o){let n=V(i)?L(i):void 0,t=i&&(n===void 0?ye(i):void 0),s=n!==void 0?o?.get(n):t!==void 0?e?.get(t):void 0,a=fe(o);return{...fe(e),...s!==void 0?{mine:s}:{},...a.for+a.against>0?{advisory:a}:{}}}var q=(e,i)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(i),Ce=(e,i,o)=>(e??[]).some(n=>n.suggestion===i&&(n.until===void 0||Date.parse(n.until)>Date.parse(o)));function me(e,i=()=>!0,o={}){let n=I(e),t=Ne(e),s=o.now??new Date().toISOString(),a,d;return e.filter(c=>c.suggests&&!c.withheld&&!n.has(c.id)&&t.get(c.id)!=="all"&&!q(c,s)&&!Ce(o.dismissed,c.id,s)).flatMap(({id:c,batch:r,suggests:u,suggestsSaid:g,intent:l,batchIntent:w,author:S,lineage:f,at:y,expiresAt:je})=>{let Z=t.get(c),C=Ee(u,g,l).filter(v=>!Z?.has(v.at));if(C.length===0)return[];let Q=C.map(v=>v.call),X=new Set;return JSON.stringify(Q.map(v=>v.args),(v,E)=>(typeof E=="string"&&i(E)&&X.add(E),E)),[{id:c,batch:r,calls:Q,intent:Z?C.map(v=>v.intent).join("; "):l,...w!==void 0?{headline:w}:{},items:C,author:S,...f?{lineage:f}:{},at:y,expiresAt:je,about:[...X],tally:$e((a??=z(e)).get(c),o.voter,(d??=z(e,{advisory:!0})).get(c))}]})}function Ee(e,i,o){let n=i&&i.length===e.length?i:void 0;return e.map((t,s)=>({at:s,call:t,intent:n?.[s]??(e.length===1?o:t.name)}))}function Ne(e){let i=new Map;for(let n of e){let t=n.lineage?.suggestion;if(t===void 0)continue;let s=n.lineage.items,a=i.get(t);if(a!=="all")if(s===void 0)i.set(t,"all");else{let d=a??new Set;for(let c of s)d.add(c);i.set(t,d)}}let o=new Map(e.filter(n=>n.suggests&&i.has(n.id)).map(n=>[n.id,n.suggests.length]));for(let[n,t]of i)t!=="all"&&o.has(n)&&t.size>=o.get(n)&&i.set(n,"all");return i}var B=e=>JSON.stringify(e,(i,o)=>o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).sort()):o);var Te=/^(archive|unarchive|remove|leave-alone|allow-tidying)$/;function Ve(e,i){let o=O(e.name),n=i?.act(e.name),t=e.args??{},s=n?n.derived:K(o),{id:a}=t;if(s&&typeof a=="string"){if(Te.test(s.act))return[s.act,a];if(s.act==="merge")return["merge",...[a,t.into].sort()];if(s.relation)return[s.act,s.relation,a,t.to]}let d=n?.subject?.arg??"id",[c,r]=Object.keys(t).filter(u=>u!==d);return n?.connects?.length===1&&c&&!r&&i.has(t[d])&&i.has(t[c])?["connect",n.connects[0],t[d],t[c]]:[o,n?.creates?.length&&typeof a=="string"&&!i.has(a)?{...t,id:0}:t]}var x=(e,i)=>`\u2248${B(e.map(o=>Ve(o,i)))}`;function A(e,i){let o=i?.act(e.name),n=o?.derived?.relation??(o?.connects?.length===1?o.connects[0]:void 0);if(n!==void 0)return`${R}${B([o?.derived?.act??"connect",n])}`;let t=O(e.name),s=o?.derived??K(t),a=o?.subject?.arg??"id",d=s?.act==="edit"?Object.keys(e.args??{}).filter(c=>c!==a).sort():void 0;return`${R}${B(d?[t,d]:[t])}`}var R="\u2200",he=e=>`\u2248${B([["connect",e.kind,e.from,e.to]])}`;function Se(e,i,o,n){let t=j(e,o,n);return[i,...i.map(s=>[s])].map(s=>t.get(x(s,o))).find(Boolean)}function W(e,i){return e.lineage?.liftedStop===!0&&e.undoes!==void 0&&e.mutation===null&&e.primitives.length===0&&!i(e.undoes)}function ve(e,i,o,n){if(i.length===0)return;let t=j(e,o,n),s=i.map(a=>t.get(A(a,o)));return s.every(Boolean)?s[0]:void 0}function j(e,i,o){let n=I(e),t=new Map(e.map(r=>[r.id,r])),s=new Map,a=new Set(e.map(r=>r.id)),d=new Set(e.filter(r=>W(r,u=>a.has(u))&&!n.has(r.id)).map(r=>r.undoes));for(let[r,u]of Object.entries(o??{}))!n.has(u.id)&&!d.has(u.id)&&s.set(r,u);let c=new Map;for(let r of e)r.lineage?.suggestion!==void 0&&r.lineage.items&&c.set(r.lineage.suggestion,[...c.get(r.lineage.suggestion)??[],...r.lineage.items]);for(let r of e){let u=!n.has(r.id)&&!r.withheld,g=r.author.kind==="human",l=r.undoes!==void 0&&u?t.get(r.undoes):void 0;if(l?.suggests&&l.author.kind===r.author.kind&&l.author.id===r.author.id)continue;let w=l?.mutation&&l.undoes===void 0&&(l.lineage||r.undoneLineage||g),S=l?.suggests?l.suggests.filter((f,y)=>!c.get(l.id)?.includes(y)):w?[l.mutation]:[];if(S.length>0)for(let f of[S,...S.map(y=>[y])])s.set(x(f,i),r);if(l?.suggests&&u&&D(r,l))for(let f of S)s.set(A(f,i),r);if(!(!u||!g||r.undoes!==void 0))for(let f of r.primitives)f.op==="remove-edge"?s.set(he(f.edge),r):f.op==="add-edge"&&s.delete(he(f.edge))}return s}function Ae(e,i=[],o){let n=new Map(i.map(s=>[s.id,s])),t=s=>{let a=s.stop;if(a)return a;let d=s;if(d.batch===void 0||s.undoes===void 0||!D(d,n.get(s.undoes)))return;let c=new Map((n.get(s.undoes)?.suggests??[]).map(r=>[A(r,o),r]));return{batch:d.batch,words:d.batchIntent??d.intent??"",calls:[...c.values()]}};return Object.fromEntries([...e].map(([s,a])=>{let d=t(a);return[s,{id:a.id,at:a.at,author:a.author,...a.undoes!==void 0&&{undoes:a.undoes},...d&&{stop:d}}]}))}h.declined=Se;h.kept=(e,i,o)=>Ae(j(e,i,o),e,i);h.stopped=ve;h.liftTold=(e,i)=>{let o=i,n=o.timeline?.log;if(!n?.get||!W(e,s=>n.get(s)!==void 0))return!1;if(o.actor!==void 0&&N(e.author).id===o.actor)return!0;let t=Object.values(n.horizonEpoch?.()?.declines??{}).find(s=>s.id===e.undoes)?.stop;return t!==void 0&&!H(t.calls,o)};function H(e,i){return e.some(o=>{let n=o.args??{};if(ce(n,i.sees))return!0;let t=n.id,s=typeof t=="string"?i.kindOf(t):void 0,a=s&&i.kept?.({id:t,kind:s});return a?Object.keys(n).some(d=>d!=="id"&&a(d)):!1})}h.lift=(e,i,o,n)=>{let t=e,s=Pe(t,i);return s&&ze(t,s,o,n)};h.liftRefusal=(e,i,o)=>{let n=e,t=Pe(n,i);if(!t)return;let s=Me(n,t,o);return s?{refusal:s}:{}};h.undoRefusal=(e,i,o)=>{let n=e;for(let t of i){if(W(t,r=>n.log.get(r)!==void 0))return{mutation:"undo",wouldNeed:[],message:`"${t.intent}" cannot be taken back: it may be suggested again now, and can be stopped again then.`};let s=t,a=!1;for(let r=t;r!==void 0;r=r.undoes===void 0?void 0:n.log.get(r.undoes))s=r,a||=D(r,r.undoes===void 0?void 0:n.log.get(r.undoes));if(!a)continue;let d=s.suggests??Object.values(n.log.horizonEpoch()?.declines??{}).find(r=>r.id===t.id||r.id===s.id)?.stop?.calls,c=d?xe(n,d,o):o.kind==="system"?void 0:{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."};if(c)return c}};var be=new WeakMap;function J(e,i,o){let n=be.get(e);return n?.length!==e.log.length&&be.set(e,n={length:e.log.length,held:new Map}),n.held.has(i)||n.held.set(i,o()),n.held.get(i)}var ke=e=>JSON.stringify([e.kind,e.id,e.roles,e.onBehalfOf?.id,e.onBehalfOf?.roles,e.shared,ie(e)?.id]),we="\0no-such-record",Le=new Set(["remove","archive","unarchive","merge"]);function _e(e,i,o,n){let t=p(e),s=t.mutations.get(i.name);return s?.subject?se(t.policy,n,i.name,o,t.viaOf(s,i,n),we,{},()=>[we],s.derived?()=>{}:void 0,s.derived!==void 0&&Le.has(s.derived.act)).ok:!0}function Oe(e,i,o){let n=p(e),t=n.actMeanings(),s=ke(o);return i.every(a=>e.permits(a,o).ok?J(e,`decides|${s}|${A(a,t)}`,()=>{let d=n.mutations.get(a.name)??n.mutations.get(O(a.name)),c=d?.subject;if(!c)return!0;let r=c.kinds==="*"?[void 0]:[c.kinds].flat();return r.every(g=>_e(e,a,g,o))?d.writesLinked!==void 0||_(e,o).hides?.()!==!1?r.every(g=>(g===void 0?[]:e.graph.nodesOfKind(g,{archived:"all"})).every(l=>e.permits({...a,args:{...a.args,[c.arg]:l.id}},o).ok)):!0:!1}):!1)}function xe(e,i,o){if(!Oe(e,i,o))return{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."}}function Me(e,i,o){let n=_(e,o);return n.hides?.()!==!1&&H(i.stop.calls,n)?{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."}:xe(e,i.stop.calls,o)}function Pe(e,i){if(i.length!==1)return;let o=e.stopsServed?.stops.find(s=>s.batch===i[0]);if(o&&!e.log.all().some(s=>s.batch===o.batch))return{id:`served:${o.batch}`,at:"",author:{kind:"system"},stop:{batch:o.batch,words:o.words,calls:[]}};let n=e.log.horizonEpoch()?.declines;if(!n)return;let t=new Set(e.log.all().flatMap(s=>s.undoes!==void 0?[s.undoes]:[]));return Object.values(n).find(s=>s.stop?.batch===i[0]&&!t.has(s.id)&&e.log.get(s.id)===void 0)}function ze(e,i,o,n){let t=p(e),s=Me(e,i,n);s&&t.refuse(s,n.id,!0);let a=e.violations(),d={id:t.nextId(),seq:e.log.length,batch:o.batch??t.mintBatch("undo"),author:n,intent:`Undo: ${i.stop.words}`,...b("batchIntent",o.intent),mutation:null,primitives:[],reads:[],writes:[],at:t.now(),undoes:i.id,...b("via",o.via),lineage:{basis:"A person let this kind of thing be suggested again",liftedStop:!0}};return e.log.append(d),e.stopsServed&&(e.stopsServed={...e.stopsServed,stops:e.stopsServed.stops.filter(c=>c.batch!==i.stop.batch)}),e.notify(T,[d]),{batch:d.batch,ops:[d],diff:T,primitives:[],reads:[],writes:[],intent:d.intent,...t.moved(a,a),violationsAfter:a}}h.stopRefusal=(e,i,o)=>{let n=e;if(i.length===0||i.some(t=>!t.suggests))return"Only a suggestion can be answered with not suggesting that kind of thing.";for(let t of i){let s=Re(n,t.suggests,t.author,t.lineage,o);if(s)return s}};var p=e=>e,b=(e,i)=>i===void 0?{}:{[e]:i};function wn(e,i,o){let n=m(e)?.store??e,t=p(n),s=le(o.lineage);if(s===void 0)throw new k("A suggestion says what it is based on: { basis, confidence? }");let a=o.author??t.by;if(o.expiresAt!==void 0&&Number.isNaN(Date.parse(o.expiresAt)))throw new k(`A suggestion expires at a time: "${o.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let d=t.actMeanings(),c=x(i,d),r=$(n).find(y=>x(y.calls,d)===c);if(r)return n.log.get(r.id);t.refuseDeclined(i,a),P(a)&&t.refuseStopped(i,a,!0);let u=t.rehearsal();u.suggesting=!0;let g=u.applying(i,{author:a,lineage:s,...b("via",o.via)});if(g.ops.length===0)return;let l=[...new Set(g.ops.flatMap(y=>y.described??[]))],w=g.ops.filter(y=>y.mutation!==null&&y.author===a),S=i.length>1&&w.length===i.length?w.map(y=>y.intent):void 0,f={id:t.nextId(),seq:n.log.length,batch:t.mintBatch("batch"),author:a,intent:g.ops.map(y=>y.intent).join("; "),...b("batchIntent",o.intent),mutation:null,primitives:[],reads:[],writes:[],...l.length>0?{described:l}:{},at:t.now(),...b("via",o.via),lineage:s,suggests:i,...b("suggestsSaid",S),...b("expiresAt",o.expiresAt)};return n.log.append(f),n.notify(T,[f]),f}function $(e,i,o={}){let n=m(e),t=n?.store??e,s=i??n?.principal,a=(s!==void 0?t.seenBy(s):t).log.all(),d=me(a,u=>t.graph.has(u),{now:p(t).now(),dismissed:o.dismissed,voter:s}),c=new Set(Ke(t).keys());for(let u of t.stopsServed?.kinds??[])c.add(u);for(let u of De(t))for(let g of u.kinds)c.add(g);if(c.size===0)return d;let r=p(t).actMeanings();return d.filter(u=>!P(u.author)||G(u)||!u.calls.every(g=>c.has(A(g,r))))}function De(e){let i=e.stopsServed?.stops??[];if(i.length===0)return i;let o=e.log.undoneIds();return i.filter(n=>!e.log.all().some(t=>t.batch===n.batch&&o.has(t.id)))}function Ke(e){let i=e.log.all(),o=e.log.horizonEpoch()?.declines;return!i.some(n=>n.lineage?.stopsKind===!0)&&!Object.keys(o??{}).some(n=>n.startsWith(R))?new Map:new Map([...j(i,p(e).actMeanings(),o)].filter(([n])=>n.startsWith(R)))}function kn(e,i){let o=m(e),n=o?.store??e,t=i??o?.principal,s=t!==void 0?n.seenBy(t):n,a=new Map(s.log.all().map(c=>[c.id,c])),d=new Map;for(let c of Ke(n).values()){let{stop:r}=c;if(r){(t===void 0||!H(r.calls,_(n,t)))&&d.set(r.batch,{batch:r.batch,words:r.words});continue}let u=a.get(c.id);u?.batch!==void 0&&!u.withheld&&d.set(u.batch,{batch:u.batch,words:u.batchIntent??u.intent})}for(let c of De(n))d.set(c.batch,{batch:c.batch,words:c.words});return[...d.values()]}function Y(e,i,o){let n=m(e),t=n?.store??e,s=o??n?.principal??p(t).by;return i.calls.every(a=>t.permits(a,s).ok)}function Ie(e,i,o,n={}){let t=m(e)?.store??e,s=n.author??p(t).by;M(t,i,s);let a=t.applyAll([{name:pe,args:{suggestion:i,vote:o}}],{...n,author:s});return o===null?a:{...a,voted:o}}function M(e,i,o){let n=$(e,o).find(s=>s.id===i),t=n?void 0:e.log.get(i);if(t?.suggests&&q(t,p(e).now()))throw new k(`That suggestion expired on ${t.expiresAt.slice(0,10)}.`);if(!n)throw new k("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return n}function On(e,i,o={}){let n=m(e)?.store??e,{items:t,...s}=o,a=s.author??p(n).by,d=M(n,i,a),c=t===void 0?d.items:d.items.filter(l=>t.includes(l.at));if(t!==void 0&&(t.length===0||c.length!==new Set(t).size))throw new k("Name the changes to accept by their place among those still waiting in the suggestion.");let r={...d,calls:c.map(l=>l.call)};if(!Y(n,r,a))return Ie(n,i,"for",{...s,author:a});let u=n.log.get(i)?.suggests?.length??c.length,g=c.length<u?{items:c.map(l=>l.at)}:{};return n.applyAll(r.calls,{...s,author:a,lineage:{...d.lineage,suggestion:i,...g}})}function xn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t);if(!Y(n,s,t))return Ie(n,i,"against",{...o,author:t});let a=G(s)&&o.intent===void 0?{intent:`Declined ${Ue(Fe(s))} proposal: ${s.intent}`}:{};return n.undo(s.batch,{...o,...a,author:t})}function Be(e,i,o){let n=o.act(i.name),t=n?.derived?.relation??(n?.connects?.length===1?n.connects[0]:void 0);if(t!==void 0)return`\u201C${ee(F(t))}\u201D links`;let s=K(O(n?.name??i.name)),a=s&&e.schema.tryDefinition(s.kind);if(s&&a){let d=ne(e.schema,s.kind).toLowerCase();if(s.act==="edit"){let r=Object.keys(i.args??{}).filter(u=>u!=="id").map(u=>te(a,u));return`changes to the ${r.length>0?r.join(" and "):"details"} of ${d}`}let c={archive:`setting ${d} aside`,unarchive:`bringing ${d} back`,remove:`removing ${d}`,merge:`merging ${d}`};if(c[s.act])return c[s.act]}return`\u201C${n?.title??F(O(i.name))}\u201D`}function We(e,i){let o=m(e)?.store??e,n=p(o).actMeanings();return[...new Set(i.calls.map(t=>Be(o,t,n)))].join(", ")}function Re(e,i,o,n,t){if(n?.proposedBy!==void 0)return"A person proposed this: decline it, and they may propose again.";if(!P(o))return"Only what the app's own actor suggests can be stopped this way: decline this one.";let s=p(e).actMeanings(),a=[...new Set(i.map(c=>A(c,s)))].sort();if(J(e,`stops|${ke(t)}|${a.join("|")}`,()=>{let c=new Set(a),r=J(e,"waiting",()=>$(e)).filter(u=>P(u.author)&&!G(u)&&u.calls.some(g=>c.has(A(g,s))));return!(Oe(e,i,t)&&r.every(u=>Y(e,u,t)))}))return"Only somebody who may decide every suggestion of this kind can say not to suggest it."}function Mn(e,i,o){let n=m(e)?.store??e;return Re(n,i.calls,i.author,i.lineage,o??p(n).by)===void 0}function Pn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t),a=o.intent??`Stopped suggesting ${We(n,s)}`;return n.undo(s.batch,{...o,author:t,intent:a,lineage:{basis:"A person said not to suggest this kind of thing",stopsKind:!0}})}function Dn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t);if(s.author.kind!==t.kind||s.author.id!==t.id)throw new k("Only who made a suggestion withdraws it: a person declines it (declineSuggestion).");return n.undo(s.batch,{...o,author:t})}var Ge={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};U.op=(e,i,o,n,t,s)=>{let a=e,{suggestion:d,vote:c}=o.args,r=M(a,d,t),u=V(t)?L(t):void 0,g=c==="for"?`For: ${r.intent}`:c==="against"?`Against: ${r.intent}`:`Withdraws a vote on: ${r.intent}`;return{id:i.id,seq:a.log.length,batch:n,author:t,intent:g,mutation:o,primitives:[],reads:[],writes:[],...r.about.length>0?{described:r.about}:{},at:i.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:d,vote:c,...u!==void 0?{advisory:!0,voter:u}:{}}}};U.accepting=(e,i)=>{let o=e,n=o.tidying?.autoAcceptAt;if(n===void 0||i.vote?.vote!=="for")return;let t=i.vote.suggestion,s=$(o).find(r=>r.id===t);if(!s)return;let d=[...z(o.log.all()).get(t)??[]].filter(([,r])=>r==="for").map(([r])=>r);if(d.length<n)return;let c=de(s.author)?s.author:Ge;return{calls:s.calls,author:c,lineage:{...s.lineage,suggestion:t,voters:d.slice(0,ue)}}};var G=e=>e.lineage?.proposedBy!==void 0,Fe=e=>e.author.name??e.author.id??"Somebody",Ue=e=>/s$/i.test(e)?`${e}'`:`${e}'s`;function Kn(e,i,o,n){let t=m(e)?.store??e,s=p(t).actMeanings(),a=x(o,s),d=$(t,i).find(r=>G(r)&&x(r.calls,s)===a);if(d)return t.log.get(d.id);let c={calls:o.map(({name:r,args:u})=>({name:r,args:u})),...b("intent",n)};return t.applyAll([{name:ge,args:c}],{author:i}).ops.find(r=>r.suggests!==void 0)}function In(e,i,o){if(!e||!e.grants.some(t=>t.propose!==void 0))return[];let n=new Set(oe(e,i,o));return o.filter(t=>!n.has(t)&&re(t).some(s=>ae(e,i,t.name,s)))}export{wn as a,$ as b,kn as c,Y as d,Ie as e,On as f,xn as g,We as h,Mn as i,Pn as j,Dn as k,G as l,Kn as m,In as n};
|
|
1
|
+
import{Ab as k,Ed as _,Gc as I,Jc as ue,Kc as le,Mb as de,Mc as ge,Nb as P,Nc as pe,Ob as D,Oc as V,Pc as L,Qc as U,Qd as O,Rb as h,Ub as ce,fb as N,ga as ee,gb as ie,ha as F,lb as se,mb as oe,nb as re,ob as ae,pa as ne,ta as te,tc as K,zb as T}from"./chunk.6L6RUOSF.js";import{j as m}from"./chunk.FQLNBIQ5.js";var ye=e=>N(e).id??e.session;function z(e,i={}){let o=I(e),n=new Map,t=i.advisory===!0;for(let s of e){if(s.vote===void 0||s.withheld||o.has(s.id)||s.vote.advisory===!0!==t)continue;let a=t?s.vote.voter:ye(s.author);if(a===void 0)continue;let d=n.get(s.vote.suggestion);d||n.set(s.vote.suggestion,d=new Map),s.vote.vote===null?d.delete(a):d.set(a,s.vote.vote)}return n}function fe(e){let i=0,o=0;for(let n of e?.values()??[])n==="for"?i++:o++;return{for:i,against:o}}function $e(e,i,o){let n=V(i)?L(i):void 0,t=i&&(n===void 0?ye(i):void 0),s=n!==void 0?o?.get(n):t!==void 0?e?.get(t):void 0,a=fe(o);return{...fe(e),...s!==void 0?{mine:s}:{},...a.for+a.against>0?{advisory:a}:{}}}var q=(e,i)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(i),Ce=(e,i,o)=>(e??[]).some(n=>n.suggestion===i&&(n.until===void 0||Date.parse(n.until)>Date.parse(o)));function me(e,i=()=>!0,o={}){let n=I(e),t=Ne(e),s=o.now??new Date().toISOString(),a,d;return e.filter(c=>c.suggests&&!c.withheld&&!n.has(c.id)&&t.get(c.id)!=="all"&&!q(c,s)&&!Ce(o.dismissed,c.id,s)).flatMap(({id:c,batch:r,suggests:u,suggestsSaid:g,intent:l,batchIntent:w,author:S,lineage:f,at:y,expiresAt:je})=>{let Z=t.get(c),C=Ee(u,g,l).filter(v=>!Z?.has(v.at));if(C.length===0)return[];let Q=C.map(v=>v.call),X=new Set;return JSON.stringify(Q.map(v=>v.args),(v,E)=>(typeof E=="string"&&i(E)&&X.add(E),E)),[{id:c,batch:r,calls:Q,intent:Z?C.map(v=>v.intent).join("; "):l,...w!==void 0?{headline:w}:{},items:C,author:S,...f?{lineage:f}:{},at:y,expiresAt:je,about:[...X],tally:$e((a??=z(e)).get(c),o.voter,(d??=z(e,{advisory:!0})).get(c))}]})}function Ee(e,i,o){let n=i&&i.length===e.length?i:void 0;return e.map((t,s)=>({at:s,call:t,intent:n?.[s]??(e.length===1?o:t.name)}))}function Ne(e){let i=new Map;for(let n of e){let t=n.lineage?.suggestion;if(t===void 0)continue;let s=n.lineage.items,a=i.get(t);if(a!=="all")if(s===void 0)i.set(t,"all");else{let d=a??new Set;for(let c of s)d.add(c);i.set(t,d)}}let o=new Map(e.filter(n=>n.suggests&&i.has(n.id)).map(n=>[n.id,n.suggests.length]));for(let[n,t]of i)t!=="all"&&o.has(n)&&t.size>=o.get(n)&&i.set(n,"all");return i}var B=e=>JSON.stringify(e,(i,o)=>o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).sort()):o);var Te=/^(archive|unarchive|remove|leave-alone|allow-tidying)$/;function Ve(e,i){let o=O(e.name),n=i?.act(e.name),t=e.args??{},s=n?n.derived:K(o),{id:a}=t;if(s&&typeof a=="string"){if(Te.test(s.act))return[s.act,a];if(s.act==="merge")return["merge",...[a,t.into].sort()];if(s.relation)return[s.act,s.relation,a,t.to]}let d=n?.subject?.arg??"id",[c,r]=Object.keys(t).filter(u=>u!==d);return n?.connects?.length===1&&c&&!r&&i.has(t[d])&&i.has(t[c])?["connect",n.connects[0],t[d],t[c]]:[o,n?.creates?.length&&typeof a=="string"&&!i.has(a)?{...t,id:0}:t]}var x=(e,i)=>`\u2248${B(e.map(o=>Ve(o,i)))}`;function A(e,i){let o=i?.act(e.name),n=o?.derived?.relation??(o?.connects?.length===1?o.connects[0]:void 0);if(n!==void 0)return`${R}${B([o?.derived?.act??"connect",n])}`;let t=O(e.name),s=o?.derived??K(t),a=o?.subject?.arg??"id",d=s?.act==="edit"?Object.keys(e.args??{}).filter(c=>c!==a).sort():void 0;return`${R}${B(d?[t,d]:[t])}`}var R="\u2200",he=e=>`\u2248${B([["connect",e.kind,e.from,e.to]])}`;function Se(e,i,o,n){let t=j(e,o,n);return[i,...i.map(s=>[s])].map(s=>t.get(x(s,o))).find(Boolean)}function W(e,i){return e.lineage?.liftedStop===!0&&e.undoes!==void 0&&e.mutation===null&&e.primitives.length===0&&!i(e.undoes)}function ve(e,i,o,n){if(i.length===0)return;let t=j(e,o,n),s=i.map(a=>t.get(A(a,o)));return s.every(Boolean)?s[0]:void 0}function j(e,i,o){let n=I(e),t=new Map(e.map(r=>[r.id,r])),s=new Map,a=new Set(e.map(r=>r.id)),d=new Set(e.filter(r=>W(r,u=>a.has(u))&&!n.has(r.id)).map(r=>r.undoes));for(let[r,u]of Object.entries(o??{}))!n.has(u.id)&&!d.has(u.id)&&s.set(r,u);let c=new Map;for(let r of e)r.lineage?.suggestion!==void 0&&r.lineage.items&&c.set(r.lineage.suggestion,[...c.get(r.lineage.suggestion)??[],...r.lineage.items]);for(let r of e){let u=!n.has(r.id)&&!r.withheld,g=r.author.kind==="human",l=r.undoes!==void 0&&u?t.get(r.undoes):void 0;if(l?.suggests&&l.author.kind===r.author.kind&&l.author.id===r.author.id)continue;let w=l?.mutation&&l.undoes===void 0&&(l.lineage||r.undoneLineage||g),S=l?.suggests?l.suggests.filter((f,y)=>!c.get(l.id)?.includes(y)):w?[l.mutation]:[];if(S.length>0)for(let f of[S,...S.map(y=>[y])])s.set(x(f,i),r);if(l?.suggests&&u&&D(r,l))for(let f of S)s.set(A(f,i),r);if(!(!u||!g||r.undoes!==void 0))for(let f of r.primitives)f.op==="remove-edge"?s.set(he(f.edge),r):f.op==="add-edge"&&s.delete(he(f.edge))}return s}function Ae(e,i=[],o){let n=new Map(i.map(s=>[s.id,s])),t=s=>{let a=s.stop;if(a)return a;let d=s;if(d.batch===void 0||s.undoes===void 0||!D(d,n.get(s.undoes)))return;let c=new Map((n.get(s.undoes)?.suggests??[]).map(r=>[A(r,o),r]));return{batch:d.batch,words:d.batchIntent??d.intent??"",calls:[...c.values()]}};return Object.fromEntries([...e].map(([s,a])=>{let d=t(a);return[s,{id:a.id,at:a.at,author:a.author,...a.undoes!==void 0&&{undoes:a.undoes},...d&&{stop:d}}]}))}h.declined=Se;h.kept=(e,i,o)=>Ae(j(e,i,o),e,i);h.stopped=ve;h.liftTold=(e,i)=>{let o=i,n=o.timeline?.log;if(!n?.get||!W(e,s=>n.get(s)!==void 0))return!1;if(o.actor!==void 0&&N(e.author).id===o.actor)return!0;let t=Object.values(n.horizonEpoch?.()?.declines??{}).find(s=>s.id===e.undoes)?.stop;return t!==void 0&&!H(t.calls,o)};function H(e,i){return e.some(o=>{let n=o.args??{};if(ce(n,i.sees))return!0;let t=n.id,s=typeof t=="string"?i.kindOf(t):void 0,a=s&&i.kept?.({id:t,kind:s});return a?Object.keys(n).some(d=>d!=="id"&&a(d)):!1})}h.lift=(e,i,o,n)=>{let t=e,s=Pe(t,i);return s&&ze(t,s,o,n)};h.liftRefusal=(e,i,o)=>{let n=e,t=Pe(n,i);if(!t)return;let s=Me(n,t,o);return s?{refusal:s}:{}};h.undoRefusal=(e,i,o)=>{let n=e;for(let t of i){if(W(t,r=>n.log.get(r)!==void 0))return{mutation:"undo",wouldNeed:[],message:`"${t.intent}" cannot be taken back: it may be suggested again now, and can be stopped again then.`};let s=t,a=!1;for(let r=t;r!==void 0;r=r.undoes===void 0?void 0:n.log.get(r.undoes))s=r,a||=D(r,r.undoes===void 0?void 0:n.log.get(r.undoes));if(!a)continue;let d=s.suggests??Object.values(n.log.horizonEpoch()?.declines??{}).find(r=>r.id===t.id||r.id===s.id)?.stop?.calls,c=d?xe(n,d,o):o.kind==="system"?void 0:{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."};if(c)return c}};var be=new WeakMap;function J(e,i,o){let n=be.get(e);return n?.length!==e.log.length&&be.set(e,n={length:e.log.length,held:new Map}),n.held.has(i)||n.held.set(i,o()),n.held.get(i)}var ke=e=>JSON.stringify([e.kind,e.id,e.roles,e.onBehalfOf?.id,e.onBehalfOf?.roles,e.shared,ie(e)?.id]),we="\0no-such-record",Le=new Set(["remove","archive","unarchive","merge"]);function _e(e,i,o,n){let t=p(e),s=t.mutations.get(i.name);return s?.subject?se(t.policy,n,i.name,o,t.viaOf(s,i,n),we,{},()=>[we],s.derived?()=>{}:void 0,s.derived!==void 0&&Le.has(s.derived.act)).ok:!0}function Oe(e,i,o){let n=p(e),t=n.actMeanings(),s=ke(o);return i.every(a=>e.permits(a,o).ok?J(e,`decides|${s}|${A(a,t)}`,()=>{let d=n.mutations.get(a.name)??n.mutations.get(O(a.name)),c=d?.subject;if(!c)return!0;let r=c.kinds==="*"?[void 0]:[c.kinds].flat();return r.every(g=>_e(e,a,g,o))?d.writesLinked!==void 0||_(e,o).hides?.()!==!1?r.every(g=>(g===void 0?[]:e.graph.nodesOfKind(g,{archived:"all"})).every(l=>e.permits({...a,args:{...a.args,[c.arg]:l.id}},o).ok)):!0:!1}):!1)}function xe(e,i,o){if(!Oe(e,i,o))return{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."}}function Me(e,i,o){let n=_(e,o);return n.hides?.()!==!1&&H(i.stop.calls,n)?{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."}:xe(e,i.stop.calls,o)}function Pe(e,i){if(i.length!==1)return;let o=e.stopsServed?.stops.find(s=>s.batch===i[0]);if(o&&!e.log.all().some(s=>s.batch===o.batch))return{id:`served:${o.batch}`,at:"",author:{kind:"system"},stop:{batch:o.batch,words:o.words,calls:[]}};let n=e.log.horizonEpoch()?.declines;if(!n)return;let t=new Set(e.log.all().flatMap(s=>s.undoes!==void 0?[s.undoes]:[]));return Object.values(n).find(s=>s.stop?.batch===i[0]&&!t.has(s.id)&&e.log.get(s.id)===void 0)}function ze(e,i,o,n){let t=p(e),s=Me(e,i,n);s&&t.refuse(s,n.id,!0);let a=e.violations(),d={id:t.nextId(),seq:e.log.length,batch:o.batch??t.mintBatch("undo"),author:n,intent:`Undo: ${i.stop.words}`,...b("batchIntent",o.intent),mutation:null,primitives:[],reads:[],writes:[],at:t.now(),undoes:i.id,...b("via",o.via),lineage:{basis:"A person let this kind of thing be suggested again",liftedStop:!0}};return e.log.append(d),e.stopsServed&&(e.stopsServed={...e.stopsServed,stops:e.stopsServed.stops.filter(c=>c.batch!==i.stop.batch)}),e.notify(T,[d]),{batch:d.batch,ops:[d],diff:T,primitives:[],reads:[],writes:[],intent:d.intent,...t.moved(a,a),violationsAfter:a}}h.stopRefusal=(e,i,o)=>{let n=e;if(i.length===0||i.some(t=>!t.suggests))return"Only a suggestion can be answered with not suggesting that kind of thing.";for(let t of i){let s=Re(n,t.suggests,t.author,t.lineage,o);if(s)return s}};var p=e=>e,b=(e,i)=>i===void 0?{}:{[e]:i};function wn(e,i,o){let n=m(e)?.store??e,t=p(n),s=le(o.lineage);if(s===void 0)throw new k("A suggestion says what it is based on: { basis, confidence? }");let a=o.author??t.by;if(o.expiresAt!==void 0&&Number.isNaN(Date.parse(o.expiresAt)))throw new k(`A suggestion expires at a time: "${o.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let d=t.actMeanings(),c=x(i,d),r=$(n).find(y=>x(y.calls,d)===c);if(r)return n.log.get(r.id);t.refuseDeclined(i,a),P(a)&&t.refuseStopped(i,a,!0);let u=t.rehearsal();u.suggesting=!0;let g=u.applying(i,{author:a,lineage:s,...b("via",o.via)});if(g.ops.length===0)return;let l=[...new Set(g.ops.flatMap(y=>y.described??[]))],w=g.ops.filter(y=>y.mutation!==null&&y.author===a),S=i.length>1&&w.length===i.length?w.map(y=>y.intent):void 0,f={id:t.nextId(),seq:n.log.length,batch:t.mintBatch("batch"),author:a,intent:g.ops.map(y=>y.intent).join("; "),...b("batchIntent",o.intent),mutation:null,primitives:[],reads:[],writes:[],...l.length>0?{described:l}:{},at:t.now(),...b("via",o.via),lineage:s,suggests:i,...b("suggestsSaid",S),...b("expiresAt",o.expiresAt)};return n.log.append(f),n.notify(T,[f]),f}function $(e,i,o={}){let n=m(e),t=n?.store??e,s=i??n?.principal,a=(s!==void 0?t.seenBy(s):t).log.all(),d=me(a,u=>t.graph.has(u),{now:p(t).now(),dismissed:o.dismissed,voter:s}),c=new Set(Ke(t).keys());for(let u of t.stopsServed?.kinds??[])c.add(u);for(let u of De(t))for(let g of u.kinds)c.add(g);if(c.size===0)return d;let r=p(t).actMeanings();return d.filter(u=>!P(u.author)||G(u)||!u.calls.every(g=>c.has(A(g,r))))}function De(e){let i=e.stopsServed?.stops??[];if(i.length===0)return i;let o=e.log.undoneIds();return i.filter(n=>!e.log.all().some(t=>t.batch===n.batch&&o.has(t.id)))}function Ke(e){let i=e.log.all(),o=e.log.horizonEpoch()?.declines;return!i.some(n=>n.lineage?.stopsKind===!0)&&!Object.keys(o??{}).some(n=>n.startsWith(R))?new Map:new Map([...j(i,p(e).actMeanings(),o)].filter(([n])=>n.startsWith(R)))}function kn(e,i){let o=m(e),n=o?.store??e,t=i??o?.principal,s=t!==void 0?n.seenBy(t):n,a=new Map(s.log.all().map(c=>[c.id,c])),d=new Map;for(let c of Ke(n).values()){let{stop:r}=c;if(r){(t===void 0||!H(r.calls,_(n,t)))&&d.set(r.batch,{batch:r.batch,words:r.words});continue}let u=a.get(c.id);u?.batch!==void 0&&!u.withheld&&d.set(u.batch,{batch:u.batch,words:u.batchIntent??u.intent})}for(let c of De(n))d.set(c.batch,{batch:c.batch,words:c.words});return[...d.values()]}function Y(e,i,o){let n=m(e),t=n?.store??e,s=o??n?.principal??p(t).by;return i.calls.every(a=>t.permits(a,s).ok)}function Ie(e,i,o,n={}){let t=m(e)?.store??e,s=n.author??p(t).by;M(t,i,s);let a=t.applyAll([{name:pe,args:{suggestion:i,vote:o}}],{...n,author:s});return o===null?a:{...a,voted:o}}function M(e,i,o){let n=$(e,o).find(s=>s.id===i),t=n?void 0:e.log.get(i);if(t?.suggests&&q(t,p(e).now()))throw new k(`That suggestion expired on ${t.expiresAt.slice(0,10)}.`);if(!n)throw new k("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return n}function On(e,i,o={}){let n=m(e)?.store??e,{items:t,...s}=o,a=s.author??p(n).by,d=M(n,i,a),c=t===void 0?d.items:d.items.filter(l=>t.includes(l.at));if(t!==void 0&&(t.length===0||c.length!==new Set(t).size))throw new k("Name the changes to accept by their place among those still waiting in the suggestion.");let r={...d,calls:c.map(l=>l.call)};if(!Y(n,r,a))return Ie(n,i,"for",{...s,author:a});let u=n.log.get(i)?.suggests?.length??c.length,g=c.length<u?{items:c.map(l=>l.at)}:{};return n.applyAll(r.calls,{...s,author:a,lineage:{...d.lineage,suggestion:i,...g}})}function xn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t);if(!Y(n,s,t))return Ie(n,i,"against",{...o,author:t});let a=G(s)&&o.intent===void 0?{intent:`Declined ${Ue(Fe(s))} proposal: ${s.intent}`}:{};return n.undo(s.batch,{...o,...a,author:t})}function Be(e,i,o){let n=o.act(i.name),t=n?.derived?.relation??(n?.connects?.length===1?n.connects[0]:void 0);if(t!==void 0)return`\u201C${ee(F(t))}\u201D links`;let s=K(O(n?.name??i.name)),a=s&&e.schema.tryDefinition(s.kind);if(s&&a){let d=ne(e.schema,s.kind).toLowerCase();if(s.act==="edit"){let r=Object.keys(i.args??{}).filter(u=>u!=="id").map(u=>te(a,u));return`changes to the ${r.length>0?r.join(" and "):"details"} of ${d}`}let c={archive:`setting ${d} aside`,unarchive:`bringing ${d} back`,remove:`removing ${d}`,merge:`merging ${d}`};if(c[s.act])return c[s.act]}return`\u201C${n?.title??F(O(i.name))}\u201D`}function We(e,i){let o=m(e)?.store??e,n=p(o).actMeanings();return[...new Set(i.calls.map(t=>Be(o,t,n)))].join(", ")}function Re(e,i,o,n,t){if(n?.proposedBy!==void 0)return"A person proposed this: decline it, and they may propose again.";if(!P(o))return"Only what the app's own actor suggests can be stopped this way: decline this one.";let s=p(e).actMeanings(),a=[...new Set(i.map(c=>A(c,s)))].sort();if(J(e,`stops|${ke(t)}|${a.join("|")}`,()=>{let c=new Set(a),r=J(e,"waiting",()=>$(e)).filter(u=>P(u.author)&&!G(u)&&u.calls.some(g=>c.has(A(g,s))));return!(Oe(e,i,t)&&r.every(u=>Y(e,u,t)))}))return"Only somebody who may decide every suggestion of this kind can say not to suggest it."}function Mn(e,i,o){let n=m(e)?.store??e;return Re(n,i.calls,i.author,i.lineage,o??p(n).by)===void 0}function Pn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t),a=o.intent??`Stopped suggesting ${We(n,s)}`;return n.undo(s.batch,{...o,author:t,intent:a,lineage:{basis:"A person said not to suggest this kind of thing",stopsKind:!0}})}function Dn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t);if(s.author.kind!==t.kind||s.author.id!==t.id)throw new k("Only who made a suggestion withdraws it: a person declines it (declineSuggestion).");return n.undo(s.batch,{...o,author:t})}var Ge={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};U.op=(e,i,o,n,t,s)=>{let a=e,{suggestion:d,vote:c}=o.args,r=M(a,d,t),u=V(t)?L(t):void 0,g=c==="for"?`For: ${r.intent}`:c==="against"?`Against: ${r.intent}`:`Withdraws a vote on: ${r.intent}`;return{id:i.id,seq:a.log.length,batch:n,author:t,intent:g,mutation:o,primitives:[],reads:[],writes:[],...r.about.length>0?{described:r.about}:{},at:i.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:d,vote:c,...u!==void 0?{advisory:!0,voter:u}:{}}}};U.accepting=(e,i)=>{let o=e,n=o.tidying?.autoAcceptAt;if(n===void 0||i.vote?.vote!=="for")return;let t=i.vote.suggestion,s=$(o).find(r=>r.id===t);if(!s)return;let d=[...z(o.log.all()).get(t)??[]].filter(([,r])=>r==="for").map(([r])=>r);if(d.length<n)return;let c=de(s.author)?s.author:Ge;return{calls:s.calls,author:c,lineage:{...s.lineage,suggestion:t,voters:d.slice(0,ue)}}};var G=e=>e.lineage?.proposedBy!==void 0,Fe=e=>e.author.name??e.author.id??"Somebody",Ue=e=>/s$/i.test(e)?`${e}'`:`${e}'s`;function Kn(e,i,o,n){let t=m(e)?.store??e,s=p(t).actMeanings(),a=x(o,s),d=$(t,i).find(r=>G(r)&&x(r.calls,s)===a);if(d)return t.log.get(d.id);let c={calls:o.map(({name:r,args:u})=>({name:r,args:u})),...b("intent",n)};return t.applyAll([{name:ge,args:c}],{author:i}).ops.find(r=>r.suggests!==void 0)}function In(e,i,o){if(!e||!e.grants.some(t=>t.propose!==void 0))return[];let n=new Set(oe(e,i,o));return o.filter(t=>!n.has(t)&&re(t).some(s=>ae(e,i,t.name,s)))}export{wn as a,$ as b,kn as c,Y as d,Ie as e,On as f,xn as g,We as h,Mn as i,Pn as j,Dn as k,G as l,Kn as m,In as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f,b as m,c as g,d as c}from"./chunk.
|
|
1
|
+
import{a as f,b as m,c as g,d as c}from"./chunk.OPMGQS5J.js";import{eb as y,gb as p,pb as u}from"./chunk.6L6RUOSF.js";function b(n,r){let t=y(n);return t==="agent"?"agent":t!=="human"&&t!=="visitor"?"app":n.onBehalfOf!==void 0||r?.id!==void 0&&p(n)?.id!==p(r)?.id?"person":n.id===void 0||r?.id===void 0||n.id===r.id?"you":"person"}var S=n=>n.ops.filter(r=>r.withheld!==!0);function $(n,r={}){let t=[];for(let e of n.batches()){let a=e.ops[0],s=e.ops.at(-1),i=S(e).length===0,o=i?void 0:m(e.ops),d=t.at(-1);if(o&&d?.typed&&d.author&&f(d.author,e.author)&&d.typed.node===o.node&&d.typed.field===o.field){let h=g(d.typed,o);t[t.length-1]={...d,seq:s.seq+1,at:s.at,batch:e.id,batches:[...d.batches??[],e.id],typed:h,said:c(h,n.schema,n.graph,!1)};continue}t.push({seq:s.seq+1,from:a.seq,at:s.at,batch:e.id,maker:i?"person":b(e.author,r.me),author:i?void 0:e.author,said:o?c(o,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:i,...o?{batches:[e.id],typed:o}:{}})}let l=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...r.declarations??[]];for(let e of l){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let a=t.findIndex(s=>s.seq===e.seq);if(a>=0&&!t[a].withheld){t[a]={...t[a],declaration:!0,said:e.sentence};continue}t.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?b(e.author,r.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return t.sort((e,a)=>e.seq-a.seq||+(e.batch!==void 0)-+(a.batch!==void 0))}function j(n,r){let t=n.log.all(),l=new Map(t.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=r).filter(e=>!e.ops.every(a=>a.sentOut!==void 0)).filter(e=>!e.ops.every(a=>a.undoes!==void 0&&(l.get(a.undoes)??-1)>=r)).map(e=>e.id)}function v(n,r){return n.withheld?"Someone":n.maker==="you"?"you":n.author?u(n.author,r):"the app"}export{b as a,$ as b,j as c,v as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as O}from"./chunk.
|
|
1
|
+
import{C as O}from"./chunk.6L6RUOSF.js";var k=3,A=k+1,P=A+1,z=(o,r)=>o<r?-1:o>r?1:0;function L(o){return(o??0)>4?k:2}function N(o,r,a){let n=[];for(let d of Object.values(o.tryDefinition(r)?.edges??{}))if(d.to!=="*")for(let i of d.to)i!==r&&a.includes(i)&&!n.includes(i)&&n.push(i);return n}function W(o,r={}){let a=[...o.kinds],n=[...(r.order??[]).filter(e=>a.includes(e)),...a.filter(e=>!(r.order??[]).includes(e)).sort(z)].filter((e,t,s)=>s.indexOf(e)===t),d=e=>n.indexOf(e),i=new Map,g=[],h=(e,t,s)=>{i.set(e,{col:t,row:s,side:L(r.counts?.[e])}),g.push({col:t,row:s})};for(let e of n){let t=o.tryDefinition(e)?.plot??r.plots?.[e];t&&h(e,t.col,t.row)}let l=new Map(n.map(e=>[e,N(o,e,a)])),b=new Set(n.filter(e=>l.get(e).length>0||n.some(t=>l.get(t).includes(e)))),v=new Map,C=new Set,D=e=>{let t=v.get(e);if(t!==void 0)return t;if(C.has(e))return-1;C.add(e);let s=0;for(let c of l.get(e))s=Math.max(s,D(c)+1);return C.delete(e),v.set(e,s),s};for(let e of n)b.has(e)&&D(e);let f=[];for(let e of n)b.has(e)&&(f[v.get(e)]??=[]).push(e);let I=new Map,T=Math.max(1,Math.ceil(Math.sqrt(f.length))),H=Math.max(1,...f.map(e=>e?.length??0)),w=Math.max(P,Math.round(r.pitch??P)),R=(e,t)=>r.upright?{col:e%T*w,row:(Math.floor(e/T)*(H+1)+t)*w}:{col:t*w,row:e===0?0:-e*w},$=e=>!g.some(t=>V(t,e)),S=(e,t,s)=>{let c=s;for(;!$(R(t,c))&&c<s+64;)c++;return i.has(e)||h(e,R(t,c).col,R(t,c).row),c},x=0;f.forEach((e=[],t)=>{let s=u=>{let m=l.get(u).map(p=>I.get(p)).filter(p=>p!==void 0);return m.length>0?m.reduce((p,q)=>p+q,0)/m.length:1/0},c=[...e].sort((u,m)=>s(u)-s(m)||d(u)-d(m)),y=0;for(let u of c)i.has(u)||(y=S(u,t,y),I.set(u,y),x=Math.max(x,y+1),y++)});let j=n.filter(e=>!b.has(e)&&!i.has(e)),M=Math.max(r.upright?x:f.length,Math.ceil(Math.sqrt(j.length*2)),1),E=b.size>0?1:0;return j.forEach((e,t)=>{r.upright?S(e,f.length+E+Math.floor(t/M),t%M):S(e,t%M,x+E+Math.floor(t/M))}),i}function V(o,r){return Math.abs(o.col-r.col)<A&&Math.abs(o.row-r.row)<A}function X(o,r,a,n=.5){return{x:(o-r)*a/2,y:(o+r)*a*n/2}}var G=1,B=/^(done|completed?|closed|finished|shipped|sent|won|lost|passed|declined|dropped|answered|resolved|fixed|archived|cancell?ed|retired|released|published|delivered|paid|merged|rejected|written[-_ ]?up|out)$/i,F=/^(doing|in[-_ ]?progress|active|building|started|working|in[-_ ]?review|review(ing)?|fixing|ongoing|underway|testing|drafting|writing|running)$/i;function _(o,r,a){let n=O(o.tryDefinition(r)?.fields.shape?.[a]);for(;n&&n.innerType!==void 0&&n.type!=="enum";)n=O(n.innerType);if(n?.type!=="enum")return;let d=(n.entries?Object.values(n.entries):n.values??[]).filter(i=>typeof i=="string");return d.length>0?d:void 0}function J(o,r){let a=o.tryDefinition(r);if(!a)return;let n=a.lifecycle,d=Object.keys(a.fields.shape??{}),i=[n?.field,...d.filter(l=>/^(status|stage|state|phase)$/i.test(l))].find(l=>l!==void 0&&_(o,r,l)!==void 0);if(!i)return;let g=_(o,r,i),h=n?.field===i&&Array.isArray(n.retired)?n.retired:[];return{field:i,values:g,tiers:g.map(l=>h.includes(l)||B.test(l)?"done":F.test(l)?"active":"waiting")}}export{P as a,W as b,X as c,G as d,J as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as K,c as R,d as k}from"./chunk.S4QSZRKH.js";import{a as I}from"./chunk.QDVGHI7R.js";import{L as M,P as j,S as V,gb as O,hb as W,jb as G}from"./chunk.IUVRJDL3.js";function E(e,t,n){let s=e.schema.tryDefinition(t)?.fields?.shape?.[n];return s===void 0?void 0:I(s)}function Z(e,t){if(e===void 0)return[];if(!Array.isArray(e))return[`The view's accepts is a list of { "kind": <a kind>, "field": <its image, video or file field> }.`];let n=[],i=new Set(t.schema.kinds);for(let s of e){let{kind:r,field:o}=s??{};typeof r!="string"||typeof o!="string"?n.push(`Each of the view's accepts is { "kind": <a kind>, "field": <its image, video or file field> }.`):i.has(r)?E(t,r,o)?t.allMutations().some(d=>(d.creates??[]).includes(r)&&Object.hasOwn(d.input?.shape??{},o))||n.push(`No act of this app makes a "${r}" with its "${o}", so a file dropped could become nothing.`):n.push(`The view accepts files into ${r}'s "${o}", which holds no picture, video or file.`):n.push(`The view accepts files for "${r}", which is no kind of this app.`)}return n}function _(e,t,n){if(e===void 0||e===!0)return[];let i=`The view's pictures is true; the kinds whose pictures it draws, ["circuit"]; or { "width": <the widest it draws a picture, in pixels> } with the fields it draws them from, by kind, { "circuit": "photo" }.`;if(typeof e!="object"||e===null)return[i];let s=new Set([...n.attach==="home"?[]:[n.attach],...n.reads?.kinds??[]]),r=new Set(t.schema.kinds),o=[],d=c=>{if(!r.has(c))return void o.push(`The view's pictures chooses "${c}", which is no kind of this app.`);s.has(c)||o.push(`The view's pictures chooses "${c}", whose records it is not handed: add "${c}" to its reads.kinds.`)};if(Array.isArray(e)){if(e.length===0||!e.every(c=>typeof c=="string"))return[i];for(let c of e)d(c);return o}for(let[c,l]of Object.entries(e)){if(c==="width"&&typeof l!="string"&&!Array.isArray(l)){Number.isInteger(l)&&l>=16&&l<=4096||o.push("The view's pictures width is a whole number of pixels from 16 to 4096.");continue}let y=typeof l=="string"?[l]:Array.isArray(l)&&l.length>0&&l.every(u=>typeof u=="string")?l:void 0;if(!y){o.push(`The view's pictures says "${c}": beside "width", it names a kind and the field it draws pictures from, "circuit": "photo", or its fields, "circuit": ["photo", "map"].`);continue}let f=o.length;if(d(c),!(o.length>f))for(let u of y){let g=E(t,c,u);g?g.as==="video"&&o.push(`The view's pictures chooses ${c}'s "${u}", which holds videos: the host plays a video where the view places it, and hands no picture of it.`):o.push(`The view's pictures chooses ${c}'s "${u}", which holds no picture.`)}}return o}function B(e){if(e===void 0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's scene is { "maxHeight": <the tallest its preview on the Scene is drawn, in pixels> }.`];let{maxHeight:t,...n}=e,i=[];return Object.keys(n).length>0&&i.push(`The view's scene says ${Object.keys(n).map(s=>`"${s}"`).join(", ")}: only "maxHeight" is read.`),t!==void 0&&!(Number.isInteger(t)&&t>=80&&t<=4e3)&&i.push("The view's scene maxHeight is a whole number of pixels from 80 to 4000."),i}function N(e){return(e.acts??[]).map(t=>typeof t=="string"?{act:t}:t)}function ee(e,t){let n=[],i=new Set(t.schema.kinds),s=new Set(t.schema.edgeKinds),r=new Set(t.allMutations().map(d=>d.name));(typeof e.name!="string"||!/^[a-z0-9][a-z0-9-]{0,62}$/.test(e.name))&&n.push(`The view's name "${String(e.name)}" is not lower-case letters, digits and hyphens.`),e.title!==void 0&&(typeof e.title!="string"||e.title.trim()===""||e.title.length>80)&&n.push("The view's title is empty or longer than 80 characters."),e.attach!=="home"&&!i.has(e.attach)&&n.push(`The view attaches to "${e.attach}", which is no kind of this app.`),e.cardinality!=="one"&&e.cardinality!=="many"&&n.push(`The view's cardinality is "${String(e.cardinality)}", not one or many.`),e.attach==="home"&&e.cardinality!=="many"&&n.push("A view of the home draws many records: its cardinality is many."),e.replaces!==void 0&&e.replaces!=="page"?n.push(`The view's replaces is "${String(e.replaces)}": the one thing a view replaces is "page", or leave it out to draw the view above the record's own fields.`):e.replaces==="page"&&e.attach==="home"&&n.push(`The home's view is the home already: replaces "page" is for a view of a kind, of one record (its page) or of many (its list).`),e.gestures!==void 0&&typeof e.gestures!="boolean"&&n.push(`The view's gestures is "${String(e.gestures)}": it is true, or left out.`),e.bleed!==void 0&&typeof e.bleed!="boolean"&&e.bleed!=="full"&&n.push(`The view's bleed is "${String(e.bleed)}": it is true, "full", or left out.`),e.heading!==void 0&&(e.heading!=="own"||e.attach==="home"||(e.cardinality==="many"?e.title===void 0:e.replaces!=="page"))&&n.push(`The view's heading is "${String(e.heading)}": it is "own" on a view that is a place (a title, cardinality many) or on a view of one record that replaces its page (replaces "page"), or left out.`),e.flows!==void 0&&typeof e.flows!="boolean"?n.push(`The view's flows is "${String(e.flows)}": it is false for a view that keeps its place's frame, or left out.`):e.flows===!1&&(e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push("Only a view that is a place keeps a frame: flows false needs a title and cardinality many on a kind."),n.push(...B(e.scene)),e.scene!==void 0&&(e.attach==="home"||e.cardinality!=="many")&&n.push("Only a view of a kind's members is drawn on the Scene as a card: scene needs cardinality many on a kind."),n.push(..._(e.pictures,t,e)),n.push(...Z(e.accepts,t));for(let d of e.reads?.kinds??[])i.has(d)||n.push(`The view reads "${d}", which is no kind of this app.`);for(let d of e.reads?.edges??[])s.has(d)||n.push(`The view reads the edge "${d}", which no kind of this app declares.`);let o=new Set;for(let d of N(e)){r.has(d.act)||n.push(`The view asks for the act "${d.act}", which this app does not declare.`);let c=d.as??d.act;o.has(c)&&n.push(`Two of the view's acts are called "${c}".`),o.add(c)}return n}function q(e,t,n){let i=[...new Set([...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]])];if(i.length<2)return[];let s=new Set(t.reads?.edges??[]),r=o=>new RegExp(`(["'\`])${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\1`).test(n);return e.schema.edgeKinds.filter(o=>{let d=e.schema.edge(o);return!s.has(o)&&d!==void 0&&d.from.some(c=>i.includes(c))&&(d.to==="*"||d.to.some(c=>i.includes(c)))&&r(o)})}function ne(e,t,n){let i=q(e,t,n);if(i.length===0)return;let s=(r,o)=>r.length<2?r[0]??"":`${r.slice(0,-1).join(", ")} ${o} ${r[r.length-1]}`;return`"${t.name}" names ${s(i,"and")} but does not read ${i.length>1?"them":"it"}, so the view is handed no such links: add ${s(i.map(r=>`"${r}"`),"and")} to its manifest's reads.edges.`}function J(e,t){let n=t.attach;return n==="home"||t.cardinality!=="one"||(t.reads?.kinds??[]).includes(n)?[]:(t.reads?.edges??[]).filter(i=>{let s=e.schema.edge(i);return s!==void 0&&s.from.includes(n)&&s.to!=="*"&&s.to.includes(n)})}function L(e,t){let n=new Set([...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]]),i=[];for(let s of t.reads?.edges??[]){let r=e.schema.edge(s);if(!r)continue;let o=r.from.some(l=>n.has(l))?[]:r.from,d=r.to==="*"||r.to.some(l=>n.has(l))?[]:r.to,c=[...new Set([...o,...d])];c.length>0?i.push({edge:s,kinds:c}):r.to==="*"&&t.attach!=="home"&&t.cardinality==="one"&&(t.reads?.kinds??[]).length===0&&i.push({edge:s,kinds:[]})}return i}function te(e,t){return L(e,t).map(({edge:n,kinds:i})=>{let s=e.schema.edge(n),r=`${s.from.join(" or ")} to ${s.to==="*"?"any kind":s.to.join(" or ")}`;return i.length===0?`"${t.name}" reads the relation "${n}", from ${r}, and is handed no other kind, so no link of it reaches the view: name the kinds it links to in its manifest's reads.kinds.`:`"${t.name}" reads the relation "${n}", from ${r}, and is handed no ${i.join(" or ")}, so no link of it reaches the view: add ${i.map(o=>`"${o}"`).join(" or ")} to its manifest's reads.kinds.`})}function ie(e,t){return[...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]].some(i=>Object.keys(e.schema.tryDefinition(i)?.computed??{}).length>0)}function se(e,t,n){let{manifest:i}=n,s=n.input??{},o=e.seenBy(t).graph,d=i.attach==="home"?void 0:i.attach,c=d&&i.cardinality==="one"&&s.node?o.getNode(s.node.id):void 0,l=c&&c.kind===d?[c]:[],y=d&&i.cardinality==="many"?s.nodes?s.nodes.flatMap(a=>{let h=o.getNode(a.id);return h&&h.kind===d?[h]:[]}):o.nodesOfKind(d):[],f=l[0],u=f?J(e,i).flatMap(a=>[...o.outEdges(f.id,a).map(h=>h.to),...o.inEdges(f.id,a).map(h=>h.from)].flatMap(h=>{let p=h===f.id?void 0:o.getNode(h);return p&&p.kind===d?[p]:[]})):[],g=new Set([...l,...y,...u].map(a=>a.id)),v=K(o,g,{kinds:(i.reads?.kinds??[]).filter(a=>a!==d||i.cardinality==="one"),edges:i.reads?.edges??[]}),w=new Map;for(let a of[...y,...u,...v.nodes])l.some(h=>h.id===a.id)||w.set(a.id,a);let F=new Set([...l.map(a=>a.id),...w.keys()]),H=[...v.edges],C=new Set(N(i).map(a=>a.act)),D=e.permittedMutations(t).filter(a=>C.has(a.name)).map(a=>({name:a.name,title:a.title??a.name,...a.description!==void 0?{description:a.description}:{},...a.subject?{subject:{kinds:a.subject.kinds,arg:a.subject.arg}}:{}})),$=a=>a?.filter(h=>F.has(h)),x=n.computed,A=a=>x?{...k(e,a),...x(o,a)}:k(e,a),T=O(t),S=W(t),b=!G(t)&&S!==void 0?o.getNode(S):void 0,m=b&&e.schema.tryDefinition(b.kind)?.people?b:void 0,P=T?{...e.schema.definitions.some(a=>a.people)?{id:S}:{},name:T.name}:m?{id:m.id,name:k(e,m).label??m.id}:void 0;return{view:i.name,...l[0]?{node:A(l[0])}:{},nodes:[...w.values()].map(A),edges:H,...i.title!==void 0?{label:i.title}:s.label!==void 0?{label:s.label}:{},cardinality:i.cardinality,...s.fidelity!==void 0?{fidelity:s.fidelity}:{},...s.mode!==void 0?{mode:s.mode}:{},...s.selected!==void 0?{selected:s.selected}:{},...s.implicated?{implicated:$(s.implicated)}:{},...s.flagged?{flagged:$(s.flagged)}:{},acts:D,...P?{me:P}:{},...n.theme?{theme:n.theme}:{},locale:j(),timeZone:V(),today:e.today()??M(),...R(e.schema,[...l,...w.values()]),...n.places?{places:n.places.filter((a,h,p)=>p.findIndex(z=>z.as===a.as)===h).map(({as:a,title:h,kind:p})=>({as:a,title:h,kind:p}))}:{}}}export{E as a,N as b,ee as c,q as d,ne as e,J as f,L as g,te as h,ie as i,se as j};
|
|
1
|
+
import{a as K,c as R,d as k}from"./chunk.EZQK23AB.js";import{a as I}from"./chunk.QDVGHI7R.js";import{L as M,P as j,S as V,gb as O,hb as W,jb as G}from"./chunk.6L6RUOSF.js";function E(e,t,n){let s=e.schema.tryDefinition(t)?.fields?.shape?.[n];return s===void 0?void 0:I(s)}function Z(e,t){if(e===void 0)return[];if(!Array.isArray(e))return[`The view's accepts is a list of { "kind": <a kind>, "field": <its image, video or file field> }.`];let n=[],i=new Set(t.schema.kinds);for(let s of e){let{kind:r,field:o}=s??{};typeof r!="string"||typeof o!="string"?n.push(`Each of the view's accepts is { "kind": <a kind>, "field": <its image, video or file field> }.`):i.has(r)?E(t,r,o)?t.allMutations().some(d=>(d.creates??[]).includes(r)&&Object.hasOwn(d.input?.shape??{},o))||n.push(`No act of this app makes a "${r}" with its "${o}", so a file dropped could become nothing.`):n.push(`The view accepts files into ${r}'s "${o}", which holds no picture, video or file.`):n.push(`The view accepts files for "${r}", which is no kind of this app.`)}return n}function _(e,t,n){if(e===void 0||e===!0)return[];let i=`The view's pictures is true; the kinds whose pictures it draws, ["circuit"]; or { "width": <the widest it draws a picture, in pixels> } with the fields it draws them from, by kind, { "circuit": "photo" }.`;if(typeof e!="object"||e===null)return[i];let s=new Set([...n.attach==="home"?[]:[n.attach],...n.reads?.kinds??[]]),r=new Set(t.schema.kinds),o=[],d=c=>{if(!r.has(c))return void o.push(`The view's pictures chooses "${c}", which is no kind of this app.`);s.has(c)||o.push(`The view's pictures chooses "${c}", whose records it is not handed: add "${c}" to its reads.kinds.`)};if(Array.isArray(e)){if(e.length===0||!e.every(c=>typeof c=="string"))return[i];for(let c of e)d(c);return o}for(let[c,l]of Object.entries(e)){if(c==="width"&&typeof l!="string"&&!Array.isArray(l)){Number.isInteger(l)&&l>=16&&l<=4096||o.push("The view's pictures width is a whole number of pixels from 16 to 4096.");continue}let y=typeof l=="string"?[l]:Array.isArray(l)&&l.length>0&&l.every(u=>typeof u=="string")?l:void 0;if(!y){o.push(`The view's pictures says "${c}": beside "width", it names a kind and the field it draws pictures from, "circuit": "photo", or its fields, "circuit": ["photo", "map"].`);continue}let f=o.length;if(d(c),!(o.length>f))for(let u of y){let g=E(t,c,u);g?g.as==="video"&&o.push(`The view's pictures chooses ${c}'s "${u}", which holds videos: the host plays a video where the view places it, and hands no picture of it.`):o.push(`The view's pictures chooses ${c}'s "${u}", which holds no picture.`)}}return o}function B(e){if(e===void 0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's scene is { "maxHeight": <the tallest its preview on the Scene is drawn, in pixels> }.`];let{maxHeight:t,...n}=e,i=[];return Object.keys(n).length>0&&i.push(`The view's scene says ${Object.keys(n).map(s=>`"${s}"`).join(", ")}: only "maxHeight" is read.`),t!==void 0&&!(Number.isInteger(t)&&t>=80&&t<=4e3)&&i.push("The view's scene maxHeight is a whole number of pixels from 80 to 4000."),i}function N(e){return(e.acts??[]).map(t=>typeof t=="string"?{act:t}:t)}function ee(e,t){let n=[],i=new Set(t.schema.kinds),s=new Set(t.schema.edgeKinds),r=new Set(t.allMutations().map(d=>d.name));(typeof e.name!="string"||!/^[a-z0-9][a-z0-9-]{0,62}$/.test(e.name))&&n.push(`The view's name "${String(e.name)}" is not lower-case letters, digits and hyphens.`),e.title!==void 0&&(typeof e.title!="string"||e.title.trim()===""||e.title.length>80)&&n.push("The view's title is empty or longer than 80 characters."),e.attach!=="home"&&!i.has(e.attach)&&n.push(`The view attaches to "${e.attach}", which is no kind of this app.`),e.cardinality!=="one"&&e.cardinality!=="many"&&n.push(`The view's cardinality is "${String(e.cardinality)}", not one or many.`),e.attach==="home"&&e.cardinality!=="many"&&n.push("A view of the home draws many records: its cardinality is many."),e.replaces!==void 0&&e.replaces!=="page"?n.push(`The view's replaces is "${String(e.replaces)}": the one thing a view replaces is "page", or leave it out to draw the view above the record's own fields.`):e.replaces==="page"&&e.attach==="home"&&n.push(`The home's view is the home already: replaces "page" is for a view of a kind, of one record (its page) or of many (its list).`),e.gestures!==void 0&&typeof e.gestures!="boolean"&&n.push(`The view's gestures is "${String(e.gestures)}": it is true, or left out.`),e.bleed!==void 0&&typeof e.bleed!="boolean"&&e.bleed!=="full"&&n.push(`The view's bleed is "${String(e.bleed)}": it is true, "full", or left out.`),e.heading!==void 0&&(e.heading!=="own"||e.attach==="home"||(e.cardinality==="many"?e.title===void 0:e.replaces!=="page"))&&n.push(`The view's heading is "${String(e.heading)}": it is "own" on a view that is a place (a title, cardinality many) or on a view of one record that replaces its page (replaces "page"), or left out.`),e.flows!==void 0&&typeof e.flows!="boolean"?n.push(`The view's flows is "${String(e.flows)}": it is false for a view that keeps its place's frame, or left out.`):e.flows===!1&&(e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push("Only a view that is a place keeps a frame: flows false needs a title and cardinality many on a kind."),n.push(...B(e.scene)),e.scene!==void 0&&(e.attach==="home"||e.cardinality!=="many")&&n.push("Only a view of a kind's members is drawn on the Scene as a card: scene needs cardinality many on a kind."),n.push(..._(e.pictures,t,e)),n.push(...Z(e.accepts,t));for(let d of e.reads?.kinds??[])i.has(d)||n.push(`The view reads "${d}", which is no kind of this app.`);for(let d of e.reads?.edges??[])s.has(d)||n.push(`The view reads the edge "${d}", which no kind of this app declares.`);let o=new Set;for(let d of N(e)){r.has(d.act)||n.push(`The view asks for the act "${d.act}", which this app does not declare.`);let c=d.as??d.act;o.has(c)&&n.push(`Two of the view's acts are called "${c}".`),o.add(c)}return n}function q(e,t,n){let i=[...new Set([...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]])];if(i.length<2)return[];let s=new Set(t.reads?.edges??[]),r=o=>new RegExp(`(["'\`])${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\1`).test(n);return e.schema.edgeKinds.filter(o=>{let d=e.schema.edge(o);return!s.has(o)&&d!==void 0&&d.from.some(c=>i.includes(c))&&(d.to==="*"||d.to.some(c=>i.includes(c)))&&r(o)})}function ne(e,t,n){let i=q(e,t,n);if(i.length===0)return;let s=(r,o)=>r.length<2?r[0]??"":`${r.slice(0,-1).join(", ")} ${o} ${r[r.length-1]}`;return`"${t.name}" names ${s(i,"and")} but does not read ${i.length>1?"them":"it"}, so the view is handed no such links: add ${s(i.map(r=>`"${r}"`),"and")} to its manifest's reads.edges.`}function J(e,t){let n=t.attach;return n==="home"||t.cardinality!=="one"||(t.reads?.kinds??[]).includes(n)?[]:(t.reads?.edges??[]).filter(i=>{let s=e.schema.edge(i);return s!==void 0&&s.from.includes(n)&&s.to!=="*"&&s.to.includes(n)})}function L(e,t){let n=new Set([...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]]),i=[];for(let s of t.reads?.edges??[]){let r=e.schema.edge(s);if(!r)continue;let o=r.from.some(l=>n.has(l))?[]:r.from,d=r.to==="*"||r.to.some(l=>n.has(l))?[]:r.to,c=[...new Set([...o,...d])];c.length>0?i.push({edge:s,kinds:c}):r.to==="*"&&t.attach!=="home"&&t.cardinality==="one"&&(t.reads?.kinds??[]).length===0&&i.push({edge:s,kinds:[]})}return i}function te(e,t){return L(e,t).map(({edge:n,kinds:i})=>{let s=e.schema.edge(n),r=`${s.from.join(" or ")} to ${s.to==="*"?"any kind":s.to.join(" or ")}`;return i.length===0?`"${t.name}" reads the relation "${n}", from ${r}, and is handed no other kind, so no link of it reaches the view: name the kinds it links to in its manifest's reads.kinds.`:`"${t.name}" reads the relation "${n}", from ${r}, and is handed no ${i.join(" or ")}, so no link of it reaches the view: add ${i.map(o=>`"${o}"`).join(" or ")} to its manifest's reads.kinds.`})}function ie(e,t){return[...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]].some(i=>Object.keys(e.schema.tryDefinition(i)?.computed??{}).length>0)}function se(e,t,n){let{manifest:i}=n,s=n.input??{},o=e.seenBy(t).graph,d=i.attach==="home"?void 0:i.attach,c=d&&i.cardinality==="one"&&s.node?o.getNode(s.node.id):void 0,l=c&&c.kind===d?[c]:[],y=d&&i.cardinality==="many"?s.nodes?s.nodes.flatMap(a=>{let h=o.getNode(a.id);return h&&h.kind===d?[h]:[]}):o.nodesOfKind(d):[],f=l[0],u=f?J(e,i).flatMap(a=>[...o.outEdges(f.id,a).map(h=>h.to),...o.inEdges(f.id,a).map(h=>h.from)].flatMap(h=>{let p=h===f.id?void 0:o.getNode(h);return p&&p.kind===d?[p]:[]})):[],g=new Set([...l,...y,...u].map(a=>a.id)),v=K(o,g,{kinds:(i.reads?.kinds??[]).filter(a=>a!==d||i.cardinality==="one"),edges:i.reads?.edges??[]}),w=new Map;for(let a of[...y,...u,...v.nodes])l.some(h=>h.id===a.id)||w.set(a.id,a);let F=new Set([...l.map(a=>a.id),...w.keys()]),H=[...v.edges],C=new Set(N(i).map(a=>a.act)),D=e.permittedMutations(t).filter(a=>C.has(a.name)).map(a=>({name:a.name,title:a.title??a.name,...a.description!==void 0?{description:a.description}:{},...a.subject?{subject:{kinds:a.subject.kinds,arg:a.subject.arg}}:{}})),$=a=>a?.filter(h=>F.has(h)),x=n.computed,A=a=>x?{...k(e,a),...x(o,a)}:k(e,a),T=O(t),S=W(t),b=!G(t)&&S!==void 0?o.getNode(S):void 0,m=b&&e.schema.tryDefinition(b.kind)?.people?b:void 0,P=T?{...e.schema.definitions.some(a=>a.people)?{id:S}:{},name:T.name}:m?{id:m.id,name:k(e,m).label??m.id}:void 0;return{view:i.name,...l[0]?{node:A(l[0])}:{},nodes:[...w.values()].map(A),edges:H,...i.title!==void 0?{label:i.title}:s.label!==void 0?{label:s.label}:{},cardinality:i.cardinality,...s.fidelity!==void 0?{fidelity:s.fidelity}:{},...s.mode!==void 0?{mode:s.mode}:{},...s.selected!==void 0?{selected:s.selected}:{},...s.implicated?{implicated:$(s.implicated)}:{},...s.flagged?{flagged:$(s.flagged)}:{},acts:D,...P?{me:P}:{},...n.theme?{theme:n.theme}:{},locale:j(),timeZone:V(),today:e.today()??M(),...R(e.schema,[...l,...w.values()]),...n.places?{places:n.places.filter((a,h,p)=>p.findIndex(z=>z.as===a.as)===h).map(({as:a,title:h,kind:p})=>({as:a,title:h,kind:p}))}:{}}}export{E as a,N as b,ee as c,q as d,ne as e,J as f,L as g,te as h,ie as i,se as j};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _,b as I,c as T,d as j,e as P,f as F,g as S,j as D}from"./chunk.
|
|
1
|
+
import{a as _,b as I,c as T,d as j,e as P,f as F,g as S,j as D}from"./chunk.TRP66PHK.js";import{a as M}from"./chunk.PGT4ZQDG.js";var q=0,Q=1,ee=2,ne=3,U=1,te=2,$=3,re=1,se=3,ie=8,z="~",R=s=>typeof s=="object"&&s!==null&&!Array.isArray(s),H=new Set(["input","select","textarea","option"]),oe=new Set(["value","checked","selected"]),W=["aria-label","aria-labelledby","title"],ae=s=>W.some(r=>(s.getAttribute(r)??"").trim()!=="");function ge(s,r){let l=s.ownerDocument??s,h=r.maxNodes??5e3,f=[],p=new Map,E=new WeakMap,b={dom:s,name:"div",namespace:"html",children:[],id:z};p.set(z,b);let v=0,L=!1,k=new WeakMap,A=new Map,w=new Map,c=e=>{f.push(e),f.length>200&&f.shift(),r.onRefused?.(e)},y=()=>({dom:l.createComment(""),children:[],refused:!0}),Y=(e,a)=>{if(e.namespace==="html"&&e.name&&H.has(e.name))return e.dom;if(a?.namespace==="html"&&a.name==="textarea")return a.dom},O=(e,a)=>{let o=e.dom,i=k.get(o)??o.getAttribute("role");if(i===null||!i.split(/\s+/).some(t=>_.includes(t.toLowerCase())))return void k.delete(o);if(ae(o)){k.delete(o),o.getAttribute("role")!==i&&o.setAttribute("role",i);return}k.set(o,i),o.removeAttribute("role"),a&&c({reason:"value",element:e.name,name:"role"})},Z=()=>{if(w.size===0)return;let e=new Set,a=o=>{for(let i of o.children){if(i.refused||i.text)continue;let t=i.dom.getAttribute("id");t&&e.add(t),a(i)}};a(b);for(let[o,i]of w){if(o.id===void 0||p.get(o.id)!==o){w.delete(o);continue}let t=o.dom;for(let[n,u]of i){let d=u.value.split(/\s+/).filter(g=>g!==""),m=d.filter(g=>!e.has(g));if(d.length>0&&m.length===0){if(u.drawn)continue;u.drawn=!0,t.setAttribute(n,u.value),O(o,!1)}else u.drawn&&(u.drawn=!1,t.removeAttribute(n),c({reason:"reference",element:o.name,name:n,ids:m.length>0?m:d}),O(o,!0))}}},N=(e,a,o,i=!0)=>{let t=e.dom;if(o!=null&&typeof o!="string")return c({reason:"value",element:e.name,name:a});let n=D(e.namespace,e.name,a,o??null,r);if("refused"in n){let g=D(e.namespace,e.name,a,null,r);return"refused"in g||t.removeAttribute(g.name),!("refused"in g)&&g.name==="role"&&k.delete(t),c(n.refused)}for(let g of n.dropped??[])c(g);let u=e.namespace==="html"&&oe.has(n.name)&&H.has(e.name),d=t,m=u?n.name==="value"?d.value:n.name==="checked"?d.checked:d.selected:void 0;if(n.name==="role"&&k.delete(t),I.includes(n.name)){let g=w.get(e)??new Map;n.value===null?g.delete(n.name):g.set(n.name,{value:n.value,drawn:!0}),g.size>0?w.set(e,g):w.delete(e)}n.value===null?t.removeAttribute(n.name):t.setAttribute(n.name,n.value),i&&(n.name==="role"||W.includes(n.name))&&O(e,n.name==="role"),r.onAttribute?.(t,n.name),u&&(n.name==="value"&&"value"in d?(d.value=n.value??"",m!==d.value&&r.onFieldSet?.(t)):n.name==="checked"&&"checked"in d?(d.checked=n.value!==null,m!==d.checked&&r.onFieldSet?.(t)):n.name==="selected"&&"selected"in d&&(d.selected=n.value!==null,m!==d.selected&&r.onFieldSet?.(t.parentElement?.closest("select")??t)))},x=e=>{if(!e.refused){v-=1,e.id!==void 0&&p.delete(e.id);for(let a of e.children)x(a)}},C=(e,a)=>{if(!R(e)||typeof e.id!="string"||p.has(e.id))return c({reason:"record"}),y();if(v>=h)return c({reason:"budget"}),L||(L=!0,r.onOverBudget?.()),y();let o=e.id;if(e.type===ie)return y();if(e.type===se){if(S(a.namespace,a.name))return c({reason:"child",element:a.name}),y();let d=l.createTextNode(String(e.data??"").slice(0,T)),m={dom:d,children:[],text:!0,id:o,parent:a};return p.set(o,m),E.set(d,o),v+=1,m}if(e.type!==re)return c({reason:"record"}),y();let i=String(e.element);if(S(a.namespace,a.name))return c({reason:"child",element:i}),y();let t=F(i,a.namespace);if("refused"in t)return c(t.refused),y();let n=l.createElementNS(t.namespace==="svg"?P:j,t.name);t.as&&n.setAttribute("data-graview-as",t.as),t.namespace==="html"&&t.name==="img"&&n.setAttribute("referrerpolicy","no-referrer"),t.namespace==="html"&&t.name==="a"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"),n.setAttribute("referrerpolicy","no-referrer"));let u={dom:n,name:t.name,namespace:t.namespace,children:[],id:o,parent:a};if(p.set(o,u),E.set(n,o),v+=1,R(e.attributes)){for(let[d,m]of Object.entries(e.attributes))N(u,d,m,!1);O(u,!0)}if(r.decorate?.(n,t.name,t.namespace),R(e.properties))for(let d of Object.keys(e.properties))c({reason:"attribute",element:t.name,name:d});if(R(e.eventListeners))for(let d of Object.keys(e.eventListeners))e.eventListeners[d]!=null&&c({reason:"attribute",element:t.name,name:`on${d}`});if(Array.isArray(e.children))for(let d of e.children){let m=C(d,u);u.children.push(m),n.appendChild(m.dom)}return u},K=e=>{if(!Array.isArray(e))return c({reason:"record"});let[a,o]=e,i=typeof o=="string"?p.get(o):void 0;if(!i)return c({reason:"record"});switch(a){case q:{if(i.text)return c({reason:"record"});let t=Number(e[3]),n=Number.isInteger(t)&&t>=0&&t<=i.children.length?t:i.children.length,u=e[2],d=R(u)&&typeof u.id=="string"?A.get(u.id):void 0,m;d&&d.parent?.namespace===i.namespace&&!S(i.namespace,i.name)?(A.delete(u.id),d.parent=i,m=d):m=C(u,i),i.dom.insertBefore(m.dom,i.children[n]?.dom??null),i.children.splice(n,0,m),i.namespace==="html"&&i.name==="textarea"&&r.onFieldSet?.(i.dom);return}case Q:{let t=Number(e[2]),n=i.children[t];if(!n)return c({reason:"record"});i.children.splice(t,1),n.dom.parentNode?.removeChild(n.dom),n.id!==void 0&&!n.refused?A.set(n.id,n):x(n);return}case ee:{if(!i.text)return c({reason:"record"});i.dom.data=String(e[2]??"").slice(0,T);let t=Y(i,i.parent);t&&r.onFieldSet?.(t);return}case ne:{if(i===b||i.text)return c({reason:"record"});let t=String(e[2]),n=e[4]??U;return n===te?N(i,t,e[3]):c(n===U||n===$?{reason:"attribute",element:i.name,name:n===$?`on${t}`:t}:{reason:"record"})}default:return c({reason:"record"})}};return{apply(e,a){if(!Array.isArray(e))return c({reason:"record"}),!0;try{for(let o=0;o<e.length;o+=1){if(a&&o%32===0&&a())return!1;K(e[o])}return!0}finally{for(let o of A.values())x(o);A.clear(),Z()}},get refused(){return f},get size(){return v},idOf:e=>E.get(e),elementOf(e){let a=p.get(e);return a&&!a.text&&a!==b?a.dom:void 0},dispose(){for(let e of b.children)x(e);for(b.children.length=0;s.firstChild;)s.removeChild(s.firstChild)}}}var de="@layer graview-motion, graview-region, graview-view, graview-theme;",le=new Set(["media","supports","container","keyframes","-webkit-keyframes"]),ce=new Set(["src","image-set","-webkit-image-set"]),ue={"}":"{",")":"(","]":"["};function G(s){let r=[],l=M(s);for(let[h,f]of l.entries())switch(f.type){case"bad-string":case"bad-url":case"url":case"CDO":case"CDC":return!1;case"delim":if(f.value==="\\")return!1;break;case"at-keyword":if(!le.has(f.value.toLowerCase()))return!1;break;case";":if(r.length===0)return!1;break;case"function":{let p=f.value.toLowerCase();if(ce.has(p))return!1;if(p==="url"){let E=l[h+1];if(E?.type!=="string"||!E.value.startsWith("#"))return!1}r.push("(");break}case"{":case"(":case"[":r.push(f.type);break;case"}":case")":case"]":if(r.pop()!==ue[f.type])return!1;break;default:}return r.length===0}function B(s,r){return r.trim()===""||!G(r)?"":`@layer ${s} {
|
|
2
2
|
${r}
|
|
3
3
|
}`}function Ee(s,r){return s.trim()===""?G(r)?r:"":[de,B("graview-theme",s),B("graview-view",r)].filter(l=>l!=="").join(`
|
|
4
4
|
`)}var fe=s=>typeof s=="string"&&/^#[A-Za-z_][A-Za-z0-9_.:-]{0,199}$/.test(s),V=["https:","mailto:","tel:"];function X(s){if(!(typeof s!="string"||s.length>2e3||/[\s<>"]/.test(s.trim())||s.trim()!==s))try{let r=new URL(s);return!V.includes(r.protocol)||r.protocol==="https:"&&(r.hostname===""||r.username!==""||r.password!=="")?void 0:r.href}catch{return}}function ke(s){let r=new Set,l=h=>{if(typeof h!="string"||!/^(https|mailto|tel):/i.test(h))return;let f=X(h);f&&r.add(f)};for(let h of[...s?.node?[s.node]:[],...s?.nodes??[]])for(let[f,p]of Object.entries(h))f==="id"||f==="kind"||(Array.isArray(p)?p.forEach(l):l(p));return r}function J(s){return(s??[]).flatMap(r=>{try{let l=new URL(r);return l.protocol==="https:"&&l.hostname!==""&&l.username===""&&l.password===""?[l.origin]:[]}catch{return[]}})}function we(s,r){if(fe(s))return s;let l=X(s);if(l&&(r.handed.has(l)||l.startsWith("https:")&&J(r.origins).includes(new URL(l).origin)))return l}function ve(s,r){let l=s.length>120?`${s.slice(0,119)}\u2026`:s,h="";try{h=new URL(s).protocol}catch{h=""}if(!V.includes(h))return`The link "${l}" was not drawn: a view links only to an https:, mailto: or tel: address.`;let f=J(r);return`The link "${l}" was not drawn: it is no address this view was handed. A view links out only to an address a record it was shown holds (a url field), as the record holds it${f.length>0?`, or an https: address on ${f.join(", ")}`:""}; a record or a place of this app is <a data-record> or <a data-place>.`}export{ge as a,de as b,B as c,Ee as d,ke as e,we as f,ve as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.WVUJXDXZ.js";import{b as P}from"./chunk.
|
|
1
|
+
import"./chunk.WVUJXDXZ.js";import{b as P}from"./chunk.NI4OPHTL.js";import"./chunk.U5KJQFAP.js";import"./chunk.FOHZPYUV.js";import"./chunk.IXYG65TM.js";import"./chunk.W6L2VAJG.js";import"./chunk.N3MXLORL.js";import"./chunk.TQ3MNB6K.js";import"./chunk.VGYG2IBZ.js";import{Aa as T,Ba as E,Ca as L,ya as M}from"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function G(r,l,i){let g=r.getAttribute("data-record")??"",m=r.getAttribute("data-field")??"",c=Number(r.getAttribute("data-index")??"0"),e=[...l?.node?[l.node]:[],...l?.nodes??[]].find(p=>p.id===g);if(!g||!e)return{why:g?`names a record it was not shown ("${g.slice(0,80)}")`:"names no record (data-record)"};let h=m&&Object.hasOwn(e,m)?e[m]:void 0,f=(Array.isArray(h)?h:[h]).filter(M),o=Number.isInteger(c)&&c>=0?f[c]:void 0,v=e.label?`"${e.label}"`:"a record";return m?o?(i==="video"?!E(o):!E(o)&&!T(o))?{why:`names "${o.name}" on ${v}, which is not ${i==="video"?"a video":"a picture or a video"}`}:{file:o,on:e}:{why:f.length===0?`names "${m}" on ${v}, which holds no file it was shown`:`names file ${r.getAttribute("data-index")} of "${m}" on ${v}, which holds ${f.length}`}:{why:`names no field of ${v} (data-field)`}}var C=r=>`${r.caption?.trim()||r.name}, ${L(r)}`;function N(r,l,i,g,m,c={}){let e=r.createElement("video");e.setAttribute("data-graview-video",""),e.setAttribute("playsinline",""),e.setAttribute("aria-label",C(i)),c.autoplay?(e.setAttribute("data-graview-video-autoplay",""),e.setAttribute("muted",""),e.muted=!0,e.setAttribute("loop",""),e.setAttribute("preload",c.still?"metadata":"auto"),c.still?e.setAttribute("data-graview-video-still",""):e.setAttribute("autoplay","")):(e.setAttribute("controls",""),e.setAttribute("preload","metadata"));let h=i.poster?g(i.poster):void 0;h&&e.setAttribute("poster",h),i.width&&i.height?(e.setAttribute("width",String(i.width)),e.setAttribute("height",String(i.height)),e.style.aspectRatio=`${i.width} / ${i.height}`):e.style.aspectRatio="16 / 9",c.cover?(e.setAttribute("data-graview-video-cover",""),e.style.cssText+=";display:block;width:100%;height:100%;max-height:none;aspect-ratio:auto;object-fit:cover;background:#000"):e.style.cssText+=";display:block;width:100%;height:auto;max-height:80vh;background:#000;border-radius:var(--graview-radius, 8px)";let f=i.captions?g(i.captions):void 0;if(f){let o=r.createElement("track");o.setAttribute("kind","captions"),o.setAttribute("src",f),o.setAttribute("srclang","en"),o.setAttribute("label","Captions"),o.setAttribute("default",""),e.appendChild(o)}return i.duration===void 0&&e.addEventListener("loadedmetadata",()=>Number.isFinite(e.duration)&&e.duration>0&&e.setAttribute("aria-label",C({...i,duration:e.duration}))),e.setAttribute("src",m),l.appendChild(e),e}function S(r,l){let i=r.document,g=new Set,m=t=>{g.has(t)||(g.add(t),l.onProblem?.(t))},c=t=>{let a=l.file?l.file(t):t;if(a!==void 0)try{let s=new r.URL(a,i.baseURI);return s.origin===r.location.origin&&/^https?:$/.test(s.protocol)?a:void 0}catch{return}},e=new WeakMap,h=typeof r.matchMedia=="function"?r.matchMedia("(prefers-reduced-motion: reduce)"):void 0,f=new Set,o=(t,a)=>{a?(t.removeAttribute("autoplay"),t.setAttribute("data-graview-video-still",""),t.pause()):(t.removeAttribute("data-graview-video-still"),t.setAttribute("autoplay",""),t.setAttribute("preload","auto"),t.play?.()?.catch?.(()=>{}))},v=()=>{for(let t of f)t.isConnected?o(t,h?.matches===!0):f.delete(t)};h?.addEventListener?.("change",v);let p,k=t=>{if(typeof t.close=="function")return t.close();t.removeAttribute("open"),t.dispatchEvent(new r.Event("close"))},w=(t,a)=>m(`The ${t} in the view ${l.view} was not drawn: it ${a}.`);return{refresh(t){let a=l.shown();for(let s of Array.from(t.querySelectorAll("graview-video"))){let d=s.shadowRoot??s.attachShadow({mode:"open"});if(!l.pictures){e.delete(s),d.replaceChildren(),w("video",`asks for no pictures: a view places a record's video where its manifest says "pictures": true`);continue}let u=G(s,a,"video"),n={autoplay:s.hasAttribute("autoplay"),cover:s.hasAttribute("cover"),still:h?.matches===!0},b="file"in u?JSON.stringify([u.file,n.autoplay,n.cover]):"";if(e.get(s)===b&&d.childNodes.length>0)continue;if(e.set(s,b),d.replaceChildren(),"why"in u){w("video",u.why);continue}let A=c(u.file.href);if(!A){w("video",`names "${u.file.name}", which this host does not say it serves on this page`);continue}let $=i.createElement("style");$.textContent=":host { display: block; min-width: 0; }",d.appendChild($);let y=N(i,d,u.file,c,A,n);n.autoplay&&f.add(y)}},open(t){if(!l.pictures)return w("full-screen viewer",`asks for no pictures: a view opens a record's picture or video full screen where its manifest says "pictures": true`),!1;let a=G(t,l.shown(),"any");if("why"in a)return w("full-screen viewer",a.why),!1;let s=c(a.file.href);if(!s)return w("full-screen viewer",`names "${a.file.name}", which this host does not say it serves on this page`),!1;p&&k(p);let d=a.file,u=d.caption?.trim()||d.name,n=i.createElement("dialog");n.setAttribute("data-graview-lightbox",""),n.setAttribute("aria-label",E(d)?C(d):u),n.style.cssText="padding:0;border:0;border-radius:var(--graview-radius, 8px);max-width:min(96vw, 1600px);max-height:94vh;background:var(--graview-panel, Canvas);color:var(--graview-ink, CanvasText)";let b=i.createElement("figure");if(b.style.cssText="margin:0;display:grid;gap:8px;padding:10px",E(d))N(i,b,d,c,s);else{let x=i.createElement("img");x.setAttribute("src",s),x.setAttribute("alt",u),x.style.cssText="max-width:100%;max-height:80vh;object-fit:contain;display:block;margin:0 auto",b.appendChild(x)}let A=i.createElement("figcaption");A.style.cssText="display:flex;gap:12px;align-items:center;justify-content:space-between";let $=i.createElement("span");$.textContent=E(d)&&d.duration!==void 0?`${u} \xB7 ${P(d.duration)}`:u;let y=i.createElement("button");return y.type="button",y.textContent="Close",y.addEventListener("click",()=>k(n)),A.append($,y),b.appendChild(A),n.appendChild(b),n.addEventListener("click",x=>x.target===n&&k(n)),n.addEventListener("close",()=>{n.remove(),p===n&&(p=void 0),t.focus?.()}),i.body.appendChild(n),p=n,typeof n.showModal=="function"?n.showModal():n.setAttribute("open",""),y.focus(),!0},dispose(){p&&k(p),p?.remove(),p=void 0,h?.removeEventListener?.("change",v),f.clear()}}}export{S as createGuestMedia,G as namedFile};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,b as m,d as k,e as y}from"./chunk.Q355UPFG.js";import"./chunk.
|
|
1
|
+
import{a as r,b as m,d as k,e as y}from"./chunk.Q355UPFG.js";import"./chunk.RJ7VSWTA.js";import"./chunk.P43LPXXJ.js";import"./chunk.JCKIJSW7.js";import"./chunk.SDO3U72B.js";import"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var i="way-back",b='[data-testid="notices-toasts"]';function g(t){let o=document.activeElement;o!==null&&o!==document.body&&!o.closest(b)||(t??document).querySelector('[data-graview-app-bar] [data-testid="app-home"]')?.focus({preventScroll:!0})}function E(t,o,a,d,h){if(t.past)return a?.dismiss(i),()=>{};let c=h?.closest("[data-graview-embed]"),s,f=e=>{if(e!==void 0&&r(t,o)?.batch!==e)return!1;try{let n=k(t,o);return n&&a?.notify({kind:"toast",id:i,sentence:`Took back \u201C${n.intent}\u201D`}),n!==void 0}catch(n){return a?.notify({kind:"toast",id:i,tone:"warn",sentence:n instanceof Error?n.message:String(n)}),!0}},u=()=>{let e=m(t,o,d);if(d=t.batches().length,e){let n=s=e.batch;a?.notify({kind:"toast",id:i,sentence:e.intent,timeout:1e4,action:{label:"Take back",keys:"Meta+Z Control+Z",onSelect:()=>(g(c),f(n))}})}else s&&r(t,o)?.batch!==s&&(s=void 0,a?.dismiss(i))},l=e=>{y(e)&&(!c||c.contains(e.target))&&f()&&e.preventDefault()};u();let p=t.subscribe(u);return document.addEventListener("keydown",l),(e=!1)=>{p(),document.removeEventListener("keydown",l),e&&s&&a?.dismiss(i)}}export{E as sceneWay};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i}from"./chunk.4LWWXIM4.js";import"./chunk.HXRHEPPJ.js";import"./chunk.QNWGDG2Z.js";import"./chunk.BJUUSIQY.js";import"./chunk.QDDDKEBH.js";import"./chunk.F7KVEWFH.js";import"./chunk.QKRQPUCE.js";import"./chunk.SPJ34VHA.js";import"./chunk.XOZU4OFA.js";import"./chunk.KBJ3UUER.js";import"./chunk.U5KJQFAP.js";import"./chunk.6TBQV3NO.js";import"./chunk.MT252WP4.js";import"./chunk.VVIQSFM4.js";import"./chunk.TQ3MNB6K.js";import"./chunk.VGYG2IBZ.js";import"./chunk.RJ7VSWTA.js";import"./chunk.P43LPXXJ.js";import"./chunk.JCKIJSW7.js";import"./chunk.SDO3U72B.js";import"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{i as GhostTray,h as InlineAiMenu,g as askAgain,c as askInline,a as askOf,b as drawPanel,d as heldSuggestion,e as suggestOnce,f as takeOffer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as L}from"./chunk.
|
|
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 L}from"./chunk.QNWGDG2Z.js";import"./chunk.BJUUSIQY.js";import"./chunk.U5KJQFAP.js";import"./chunk.VGYG2IBZ.js";import{Wd as I,pa as O,va as j}from"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var m=e=>e.charAt(0).toUpperCase()+e.slice(1),N=e=>/^(?:[aeio]|u(?![sn]i|se|ser))/i.test(e),q=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"one",D=(e,s)=>e===s?`step ${e}`:`steps ${e}\u2013${s}`;function G(e){let s=e.store.schema,t=Object.fromEntries(s.definitions.map(o=>[o.kind,{noun:j(o,o.kind),plural:O(s,o.kind),fields:Object.fromEntries(Object.keys(o.fields.shape??{}).map(c=>[c,{type:"string"}])),edges:o.edges??{}}]));return{name:e.app.name??"app",kinds:t,acts:{}}}function H(e){let s=(e.store.policy?.grants??[]).filter(o=>o.mutations==="*"&&!o.self&&o.roles!=="*").flatMap(o=>o.roles),t=[...new Set(s)];return t.length>0?`${N(t[0])?"an":"a"} ${t.join(" or ")}`:"whoever may change this app"}function K(e){let s=e.place?e.places.find(t=>t.as===e.place):void 0;return s?`in ${s.title}`:"here"}async function U(e,s){let{missing:t}=s;if(!t.need)return{refused:t.said};let o=await (__graviewPreload(import.meta.url,["./chunk.VDFQFLTU.js","./chunk.TBY5IR7C.js","./chunk.BIDL7GQD.js","./chunk.Q5WEOX3Q.js","./chunk.4O64QV2Y.js","./chunk.OYMN3IFX.js","./chunk.FOHZPYUV.js","./chunk.IXYG65TM.js","./chunk.W6L2VAJG.js","./chunk.N3MXLORL.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.F6MY6WJ4.js")),c=o.documentOfApp(e.app),k=c??G(e),a=L(k,t.need);if("refused"in a)return{refused:`${t.said} ${a.refused}`};let i=a.steps.map(n=>({part:"app",said:n})),b=i.length,C=n=>n.filter(r=>e.store.graph.getNode(r)?.kind===a.on),x=n=>[...e.store.graph.in(n),...e.store.graph.out(n)].filter(r=>r.kind===a.on).map(r=>r.id),f=C(s.members).length>0?C(s.members):[...new Set(s.members.flatMap(x))],p=[],y=f.length,w=n=>k.kinds[n]??void 0,P=n=>(w(n)?.plural??`${w(n)?.noun??n}s`).toLowerCase(),R=n=>(w(n)?.noun??n).toLowerCase(),S=s.where?`in ${s.where}`:K(e);if(y===0)return{refused:`${t.said} There is nothing here to do it to.`};let $=y===1?`the ${R(a.on)} ${S}`:`the ${y} ${P(a.on)} ${S}`,v=m(a.called);if(a.relation&&a.to){let n=t.who;if(!n)return{refused:`${t.said} Say whom to give them to.`};let r=a.made?m(a.edits[0].plural??"people"):m(P(a.to)),h=(a.made?void 0:e.store.graph.allNodes().find(d=>d.kind===a.to&&Object.values(d).some(l=>typeof l=="string"&&l.toLowerCase()===n.toLowerCase())))?.id;if(!h){h=`${a.to}-${q(n)}`;let d=a.makes??e.store.allMutations().find(l=>l.creates?.includes(a.to))?.name;if(!d){let l=e.store.graph.allNodes().filter(g=>g.kind===a.to).slice(0,3).map(g=>String(g.label??g.name??"")).filter(Boolean);return{refused:`${t.said} There is nobody called ${n} among the ${r.toLowerCase()} here${l.length>0?` (${l.join(", ")})`:""}, and no way to add one from here.`}}p.push({name:d,args:{name:n},mintedHint:h}),i.push({part:"record",said:`Add ${n} to ${r}.`})}for(let d of f)p.push({name:a.act,args:{id:d,[a.arg]:h}});let M=/^(\w+?)ed to$/i.exec(a.called)?.[1];i.push({part:"record",said:M?`${m(M.toLowerCase())} ${n} to ${$}.`:`Set \u201C${v}\u201D to ${n} on ${$}.`})}else if(a.field){let n=t.value;if(n===void 0)return{refused:`${t.said} Say what to set it to.`};for(let r of f)p.push({name:a.act,args:{id:r,[a.arg]:n}});i.push({part:"record",said:`Set \u201C${v}\u201D to ${n} on ${$}.`})}let A=i.length;if(!(!!c&&s.host&&s.compose!==void 0&&o.mayChangeDeclaration(e.store,e.principal))){let n=c?!s.host||!s.compose?"whoever hosts this app":H(e):"whoever develops this app";return{question:`${t.said} ${m(n)} would add ${D(1,b)}; then I can do ${D(b+1,A)}.`,parts:i,whoMay:n}}let E=s.compose({document:c,edits:a.edits});if(!E.ok)return{refused:`${t.said} That change could not be made here.`};let u=E.app;try{new I({schema:u.schema,mutations:u.mutations??[],invariants:u.invariants??[],...u.policy?{policy:u.policy}:{},snapshot:e.store.graph.snapshot()}).previewAll(p,{author:e.principal})}catch{return{refused:`${t.said} I could not make that work here.`}}return{question:`${t.said} I can do it in ${A} steps. Should I?`,parts:i,proposal:{said:s.said,add:[],drop:[],card:{said:i.map(n=>n.said).join(" "),adds:[],keeps:[],drops:[],breaking:[]},edits:a.edits,records:p,via:`ai:${e.ai.name??"model"}`}}}export{U as planFor};
|
|
@@ -1,4 +1,4 @@
|
|
|
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 Ct}from"./chunk.JO2X52D4.js";import{a as Nt,b as Bt,c as Ft,d as he,e as Ut,f as zt,g as qt}from"./chunk.
|
|
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 Ct}from"./chunk.JO2X52D4.js";import{a as Nt,b as Bt,c as Ft,d as he,e as Ut,f as zt,g as qt}from"./chunk.VPFUOTY7.js";import{a as Ke,b as we}from"./chunk.SGYZM6ZU.js";import{a as ye}from"./chunk.CEQQIW7Z.js";import{a as Pe,d as _t,f as Lt}from"./chunk.ONAH6MC4.js";import{b as Pt,h as Gt,i as Vt,k as Kt}from"./chunk.Z2BCOZDZ.js";import"./chunk.WGH2P2YL.js";import{h as It}from"./chunk.TRP66PHK.js";import"./chunk.PGT4ZQDG.js";import{e as $t}from"./chunk.MFMC35ET.js";import{c as jt,h as Ht,i as Ge,j as Ve}from"./chunk.GKYJQE5A.js";import{b as me,e as ge}from"./chunk.EZQK23AB.js";import{d as Dt}from"./chunk.QDVGHI7R.js";import"./chunk.M5FP4Y4Q.js";import"./chunk.7KX36ENH.js";import{a as F}from"./chunk.SDO3U72B.js";import{fb as Rt,hb as Wt}from"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var Yt=["good","warn","bad","neutral","accent"],Xt=["value","max","aria-label","placeholder","disabled"],Jt=["click","change"],_e=["_blank","_self"],Qt=["section","div","span","strong","p","hr","a","button","input","progress"],ve={type:{oneOf:Yt}},Le={"gv-card":{host:"section",properties:{tone:ve},events:{},children:"any"},"gv-group":{host:"div",properties:{direction:{type:{oneOf:["row","column"]}}},events:{},children:"any"},"gv-title":{host:"strong",properties:{},events:{},children:"text"},"gv-text":{host:"p",properties:{tone:ve},events:{},children:"text"},"gv-badge":{host:"span",properties:{tone:ve},events:{},children:"text"},"gv-field":{host:"div",properties:{label:{type:"string"}},events:{},children:"text"},"gv-progress":{host:"progress",properties:{value:{type:"number",as:"value"},max:{type:"number",as:"max"},label:{type:"string",as:"aria-label"}},events:{},children:"none"},"gv-divider":{host:"hr",properties:{},events:{},children:"none"},"gv-link":{host:"a",properties:{href:{type:"url"}},events:{},children:"text"},"gv-button":{host:"button",properties:{tone:ve,disabled:{type:"boolean",as:"disabled"}},events:{press:{from:"click"}},children:"text"},"gv-input":{host:"input",properties:{label:{type:"string",as:"aria-label"},value:{type:"string",as:"value"},placeholder:{type:"string",as:"placeholder"}},events:{change:{from:"change",detail:"value"}},children:"none"}},Ne=1e4;var _r=0,Lr=1,Nr=2,Ir=3,Zt=1,Cr=2,Dr=3,jr=1,Hr=3,$r=8,Ie="~",Ce=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),oe=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function er(t,e){return e.type==="url"?"href":e.as??`data-gv-${t.toLowerCase()}`}var Br=2e3;function tr(t,e){if(e==null)return{ok:!0,value:null};let s=t.type;if(s==="boolean")return typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,reason:"value"};if(s==="number")return typeof e=="number"&&Number.isFinite(e)?{ok:!0,value:String(e)}:{ok:!1,reason:"value"};if(typeof e!="string"||e.length>Br)return{ok:!1,reason:s==="url"?"url":"value"};if(typeof s=="object")return s.oneOf.includes(e)?{ok:!0,value:e}:{ok:!1,reason:"value"};if(s==="url"){let d;try{d=new URL(e)}catch{return{ok:!1,reason:"url"}}return d.protocol!=="https:"||d.hostname===""||!/^https:\/\//i.test(e)?{ok:!1,reason:"url"}:{ok:!0,value:d.href}}return{ok:!0,value:e}}function Fr(t){let e=t.host==="a";return Qt.includes(t.host)&&(t.target===void 0||e&&_e.includes(t.target))&&Object.values(t.properties).every(s=>s.type!=="url"||e)&&Object.values(t.properties).every(s=>s.as===void 0||s.type!=="url"&&Xt.includes(s.as))&&Object.values(t.events).every(s=>Jt.includes(s.from))}function De(t,e){let s=e.kit??Le,d=e.maxNodes??2e3,r=t.ownerDocument,m=[],w=new Map,b={dom:t,name:Ie,component:{host:"div",properties:{},events:{},children:"any"},children:[],listeners:new Map,id:Ie};w.set(Ie,b);let T=e.links?new Set(e.links.origins.flatMap(o=>{try{let p=new URL(o);return p.protocol==="https:"&&p.hostname!==""?[p.origin]:[]}catch{return[]}})):void 0,O=0,g=0,K=!1,h=o=>{m.push(o),m.length>200&&m.shift()},k=()=>({dom:r.createComment(""),children:[],refused:!0,listeners:new Map}),S=(o,p,c)=>{let y=o.component;if(!Ce(y.properties,p))return h({reason:"property",element:o.name,name:p});let u=y.properties[p],a=tr(u,c),M=a.ok&&u.type==="url"&&T&&typeof a.value=="string"&&!T.has(new URL(a.value).origin)?{ok:!1,reason:"url"}:a,R=o.dom,V=er(p,u);if(!M.ok)return R.removeAttribute(V),h({reason:M.reason,element:o.name,name:p});let W=M.value;W===null||W===!1?R.removeAttribute(V):R.setAttribute(V,W===!0?"":W),V==="value"&&"value"in R&&(R.value=typeof W=="string"?W:""),V==="disabled"&&"disabled"in R&&(R.disabled=W!==null&&W!==!1)},v=(o,p,c)=>{let y=o.component;if(!Ce(y.events,p))return h({reason:"event",element:o.name,name:p});let u=o.listeners.get(p);if(u&&(u(),o.listeners.delete(p),g-=1),c==null)return;if(!oe(c)||typeof c.listener!="number")return h({reason:"value",element:o.name,name:p});let a=c.listener,M=y.events[p],R=o.dom,V=()=>e.onEvent(a,M.detail==="value"?String(R.value??""):void 0);R.addEventListener(M.from,V),o.listeners.set(p,()=>R.removeEventListener(M.from,V)),g+=1},G=o=>{if(!o.refused){O-=1,o.id!==void 0&&w.delete(o.id);for(let p of o.listeners.values())p();g-=o.listeners.size,o.listeners.clear();for(let p of o.children)G(p)}},x=(o,p)=>{if(!oe(o)||typeof o.id!="string"||w.has(o.id))return h({reason:"record"}),k();if(O>=d)return h({reason:"budget"}),K||(K=!0,e.onOverBudget?.()),k();let c=o.id,y=p.component.children;if(o.type===$r)return k();if(o.type===Hr){if(y==="none")return h({reason:"child",element:p.name}),k();let V={dom:r.createTextNode(String(o.data??"").slice(0,Ne)),children:[],text:!0,listeners:new Map,id:c};return w.set(c,V),O+=1,V}if(o.type!==jr)return h({reason:"record"}),k();let u=String(o.element);if(!Ce(s,u)||!Fr(s[u]))return h({reason:"element",element:u}),k();if(y!=="any")return h({reason:"child",element:u}),k();let a=s[u],M=r.createElement(a.host);M.setAttribute("data-gv",u.replace(/^gv-/,"")),M.className=`graview-guest-${u.replace(/^gv-/,"")}`,a.host==="a"&&(M.setAttribute("rel","noopener noreferrer"),M.setAttribute("target",a.target??"_blank"),M.setAttribute("referrerpolicy","no-referrer")),a.host==="button"&&M.setAttribute("type","button");let R={dom:M,name:u,component:a,children:[],listeners:new Map,id:c};if(w.set(c,R),O+=1,oe(o.properties))for(let[V,W]of Object.entries(o.properties))S(R,V,W);if(oe(o.attributes))for(let V of Object.keys(o.attributes))h({reason:"attribute",element:u,name:V});if(oe(o.eventListeners))for(let[V,W]of Object.entries(o.eventListeners))v(R,V,W);if(Array.isArray(o.children))for(let V of o.children){let W=x(V,R);R.children.push(W),M.appendChild(W.dom)}return R},A=o=>{if(!Array.isArray(o))return h({reason:"record"});let[p,c]=o,y=typeof c=="string"?w.get(c):void 0;if(!y)return h({reason:"record"});switch(p){case _r:{if(y.text)return h({reason:"record"});let u=Number(o[3]),a=Number.isInteger(u)&&u>=0&&u<=y.children.length?u:y.children.length,M=x(o[2],y);y.dom.insertBefore(M.dom,y.children[a]?.dom??null),y.children.splice(a,0,M);return}case Lr:{let u=Number(o[2]),a=y.children[u];if(!a)return h({reason:"record"});y.children.splice(u,1),a.dom.parentNode?.removeChild(a.dom),G(a);return}case Nr:if(!y.text)return h({reason:"record"});y.dom.data=String(o[2]??"").slice(0,Ne);return;case Ir:{if(y===b||y.text)return h({reason:"record"});let u=String(o[2]),a=o[4]??Zt;return a===Zt?S(y,u,o[3]):a===Dr?v(y,u,o[3]):h(a===Cr?{reason:"attribute",element:y.name,name:u}:{reason:"record"})}default:return h({reason:"record"})}};return{apply(o,p){if(!Array.isArray(o))return h({reason:"record"}),!0;for(let c=0;c<o.length;c+=1){if(p&&c%32===0&&p())return!1;A(o[c])}return!0},get refused(){return m},get size(){return O},get listening(){return g},dispose(){for(let o of b.children)G(o);b.children.length=0,t.replaceChildren()}}}var je=`
|
|
2
2
|
.graview-guest { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: var(--graview-ink, inherit); font: inherit; }
|
|
3
3
|
.graview-guest-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--graview-edge, #d0d0d0); border-radius: 10px; background: var(--graview-panel, transparent); }
|
|
4
4
|
.graview-guest-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
|
@@ -18,4 +18,4 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
|
|
|
18
18
|
.graview-guest [data-gv-tone="warn"] { color: var(--graview-warn, inherit); }
|
|
19
19
|
.graview-guest [data-gv-tone="accent"] { color: var(--graview-accent, inherit); }
|
|
20
20
|
.graview-guest [data-gv-tone="neutral"] { color: var(--graview-ink-muted, inherit); }
|
|
21
|
-
`;var rr=new WeakSet;function Ur(t,e){if(t.startsWith("blob:"))return"blob:";try{return new URL(t,e.location.href).origin}catch{return t}}function nr(t,e,s){let d=Ur(e,t),r=`this page's Content-Security-Policy${s?` (${s})`:""} does not allow a worker from ${d}: it needs worker-src ${d}`;return rr.has(t)||(rr.add(t),t.console?.warn?.(`Graview: worker views cannot start on this page, because ${r}. A host that will not allow ${d} serves each view's whole script from its own origin and passes worker: { url } (the @graview/guest README, "What the host page allows").`)),r}function zr(t,e){return t===""?!0:e.startsWith("blob:")?t.startsWith("blob"):e.startsWith(t)||t.startsWith(e)}function ke(t,e){let s="script"in e.source?t.URL.createObjectURL(new t.Blob([e.source.script],{type:"text/javascript"})):void 0,d="script"in e.source?s:e.source.url,r,m,w=!1,b=!1,T=0,O=0,g="",K=0,h=0,k=t.performance,S=k.now(),v,G=u=>{let a=u,M=String(a.effectiveDirective||a.violatedDirective||"").split(" ")[0];/^(worker-src|script-src|script-src-elem|child-src|default-src)$/.test(M)&&zr(String(a.blockedURI??""),d)&&(v=M)},x=t.document;x?.addEventListener("securitypolicyviolation",G);let A=()=>x?.removeEventListener("securitypolicyviolation",G),o=()=>{b||(b=!0,m?.close(),r?.terminate(),r=void 0,t.clearTimeout(T),t.clearInterval(O),A(),s&&t.URL.revokeObjectURL(s))},p=(u,a)=>{b||(o(),e.onStop(u,a))},c=()=>{t.clearTimeout(T),A(),g=Nt();let u=new t.MessageChannel;m=u.port1;let a=Math.max(1,e.silentMs),M=Math.max(10,Math.min(1e3,Math.floor(a/4)));S=k.now();let R=S;O=t.setInterval(()=>{let W=k.now();if(W-R>M*2&&(S+=W-R-M),R=W,W-S>=a)return p("silent");K+=1,u.port1.postMessage({type:"heartbeat",beat:K})},M);let V={graview:"host-hello",protocol:1,nonce:g,view:e.name};r.postMessage(V,[u.port2]),e.onReady(g,u.port1,k.now()-y)},y=k.now();try{r=new t.Worker(d,{name:e.name})}catch(u){r=void 0;let a=u,M=a?.name==="SecurityError"?nr(t,d,v):`the worker could not be made: ${String(a?.message??u)}`;queueMicrotask(()=>p("start",M))}return r&&(T=t.setTimeout(()=>p("start",`it never said it was ready in ${e.readyMs.toLocaleString("en-US")} ms`),e.readyMs),r.onerror=u=>{let a=typeof u.message=="string"&&u.message!==""?u.message:void 0;if(w)return void e.onError?.(a??"an error");t.clearTimeout(T),t.setTimeout(()=>!w&&p("start",v?nr(t,d,v):a?`it failed before it said ready: ${a}`:"it failed before it said ready, and the engine gave no reason (a page policy that refuses it, or a script that does not load)"),0)},r.onmessage=u=>{if(!e.limiter.message()||w||!Lt(u.data)||u.data.protocol!==1){e.onDropped();return}w=!0,c()}),{get worker(){return r},answer(u){let a=u;return typeof a!="object"||a===null||a.type!=="heartbeat"||a.nonce!==g?!1:(typeof a.beat=="number"&&a.beat>h&&a.beat<=K&&(h=a.beat,S=k.now()),!0)},stop:o}}function be(t,e){let s=e(),d=0;return{draw(r){let m=e();m-s>=1e3&&(s=m,d=0);let w=t(),b=r(()=>d+(e()-m)>=w);return d+=e()-m,b&&d<w}}}var qr=200,Yr=64*1024,Xr=120,sr=t=>new TextEncoder().encode(t).length;function $e(){let t=new Map;return{read:async e=>Object.fromEntries(t.get(e)??[]),write:async(e,s,d)=>{let r=t.get(e)??new Map;if(t.set(e,r),d===null)return r.delete(s),{ok:!0};let m=sr(d);for(let[w,b]of r)w!==s&&(m+=sr(b));return m>Yr||!r.has(s)&&r.size>=qr?{ok:!1,sentence:"This view keeps as much as it can for this visit, so this value was not kept."}:(r.set(s,d),{ok:!0})}}}var or=new WeakMap;function dr(t,e){let s=or.get(t)??new Map;or.set(t,s);let d=s.get(e)??$e();return s.set(e,d),d}var Se="What this view keeps for you could not be read just now.",Jr="This value could not be kept just now.",He="The host has not answered yet, so this value is not kept yet.",Qr="This view asked to keep too many values at once, so this one was not kept.",Zr="The host has not answered for too many values, so this one was not kept.",en=200,ir=new WeakMap;function tn(t,e,s){let d=ir.get(t)??new Map;ir.set(t,d);let r=`${e}\0${s}`,m=d.get(r)??{writes:[],lines:new Map,drawings:new Set};return d.set(r,m),m}function lr({view:t,viewer:e="",state:s,onRefused:d,onLate:r,readMs:m=1500,writeMs:w=1e4,now:b=Date.now}){let T=new Map,O=!1,g=!1,K=new Map,h=(c,y)=>{y===null?T.delete(c):T.set(c,y)},k=tn(s,e,t),{writes:S,lines:v,drawings:G}=k,x={landed(c,y){O?h(c,y):K.set(c,y)},onRefused:d,onLate:r};G.add(x);let A=c=>(d?.(c),{ok:!1,sentence:c}),o=(async()=>{try{T=new Map(Object.entries(await s.read(t)).filter(([,c])=>typeof c=="string"));for(let[c,y]of K)h(c,y);O=!0,g&&r?.()}catch{d?.(Se)}})(),p=new Promise(c=>{let y=setTimeout(()=>{g=!0,O||d?.(Se),c()},m);o.then(()=>{clearTimeout(y),c()})});return{ready:p,values:()=>Object.fromEntries(T),get:c=>p.then(()=>new Promise(y=>{let u=()=>{if(!O)return y({ok:!1,sentence:Se});let a=v.get(c);if(!a)return y({ok:!0,value:T.get(c)??null});if(a.late)return y({ok:!1,sentence:He});a.gets.push(u)};u()})),set(c,y){let u=_t(c,y);if(u)return Promise.resolve(A(u));let a=c,M=y;return p.then(()=>new Promise(R=>{if(!O)return R(A(`${Se} So this value was not kept.`));let V={drawing:x,answer:R},W=v.get(a);if(!W){if(v.size>=en)return R(A(Zr));let Y=b();for(;S.length>0&&S[0]<=Y-6e4;)S.shift();if(S.length>=Xr)return R(A(Qr));S.push(Y);let H={late:!1,gets:[],moved:new Set};return v.set(a,H),ur(s,t,k,a,H,M,[V],w)}W.next={value:M,told:W.late?[]:[...W.next?.told??[],V],writeMs:w},W.late&&R(A(He))}))},dispose(){G.delete(x)}}}function ar(t,e){if(!e.ok)for(let s of new Set(t.map(d=>d.drawing)))s.onRefused?.(e.sentence);for(let s of t)s.answer(e)}function ur(t,e,s,d,r,m,w,b){let T=!1,O=setTimeout(()=>{T=!0,r.late=!0,ar([...w,...r.next?.told??[]],{ok:!1,sentence:He}),r.next&&(r.next.told=[]);for(let g of r.gets.splice(0))g()},b);Promise.resolve().then(()=>t.write(e,d,m)).catch(()=>{}).then(g=>{clearTimeout(O);let K=g?.ok===!0,h=g&&!g.ok&&typeof g.sentence=="string"&&g.sentence?g.sentence:Jr;if(K){let S=new Set(T?[]:w.map(v=>v.drawing));for(let v of s.drawings)v.landed(d,m),S.has(v)||r.moved.add(v)}if(!T)ar(w,K?{ok:!0}:{ok:!1,sentence:h});else if(!K)for(let S of s.drawings)S.onRefused?.(h);r.late=!1;let k=r.next;if(r.next=void 0,k)return ur(t,e,s,d,r,k.value,k.told,k.writeMs);s.lines.delete(d);for(let S of r.gets.splice(0))S();for(let S of r.moved)s.drawings.has(S)&&S.onLate?.()})}function fr(t){return!Number.isFinite(t)||t<=60?1:Math.min(4,Math.round(t/60*10)/10)}function pr(t,e){return{...t,pushMs:Math.round(t.pushMs*e),drawMs:Math.round(t.drawMs*e)}}var cr=new WeakMap;function mr(t,e){let s=cr.get(t);return s!==void 0?s:(cr.set(t,e),e)}var rn=F(()=>(__graviewPreload(import.meta.url,["./chunk.YCMMATFK.js","./chunk.F5XWYO5W.js","./chunk.FSZQTX3K.js","./chunk.AJZBJBMO.js"]),import("./chunk.FBDCHJS2.js"))),nn=F(()=>(__graviewPreload(import.meta.url,["./chunk.OXXZGPJZ.js","./chunk.K6EKSURO.js","./chunk.KJAOJTZZ.js","./chunk.S4QSZRKH.js","./chunk.QDVGHI7R.js","./chunk.M5FP4Y4Q.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.X2RHBTJI.js"))),sn=F(()=>(__graviewPreload(import.meta.url,["./chunk.RSMCTI2N.js","./chunk.AJZBJBMO.js"]),import("./chunk.UJPX3BUV.js"))),on=F(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.IRPMGHZN.js","./chunk.7QWGIGHM.js","./chunk.HRLCDBMO.js","./chunk.LZNHTROY.js","./chunk.36FKQJFM.js","./chunk.RHV73CBA.js","./chunk.QILGAV7H.js","./chunk.I6HIVTXU.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.U3CV227I.js"))),an=F(()=>(__graviewPreload(import.meta.url,["./chunk.F5XWYO5W.js","./chunk.FSZQTX3K.js","./chunk.AJZBJBMO.js"]),import("./chunk.DBSSCJQM.js"))),dn=F(()=>(__graviewPreload(import.meta.url,["./chunk.KJAOJTZZ.js","./chunk.S4QSZRKH.js","./chunk.QDVGHI7R.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.3MPLUSVY.js"))),ln=F(()=>(__graviewPreload(import.meta.url,["./chunk.ONAH6MC4.js","./chunk.AJZBJBMO.js"]),import("./chunk.AIFT2HNP.js"))),un=F(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.IRPMGHZN.js","./chunk.7QWGIGHM.js","./chunk.HRLCDBMO.js","./chunk.LZNHTROY.js","./chunk.36FKQJFM.js","./chunk.RHV73CBA.js","./chunk.QILGAV7H.js","./chunk.I6HIVTXU.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KDOJC4FX.js"))),cn=F(()=>(__graviewPreload(import.meta.url,["./chunk.QDVGHI7R.js","./chunk.AJZBJBMO.js"]),import("./chunk.EG7OOJH5.js"))),fn=F(()=>(__graviewPreload(import.meta.url,["./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BZXJKWNI.js"))),pn='a[href^="#"], [data-sight], [data-file]';function mn(t,e,s){switch(t){case"manifest":return s??"Its manifest names something this app does not have.";case"source":return s??`Its code is longer than the ${e.maxSourceBytes.toLocaleString("en-US")} bytes a view may be.`;case"start":return`It could not start${s?`: ${s}.`:"."}`;case"error":return`It failed before it drew anything${s?`: ${s}`:"."}`;case"silent":return`It stopped answering for ${e.silentMs.toLocaleString("en-US")} ms.`;case"nodes":return`It drew more than the ${e.maxNodes.toLocaleString("en-US")} things a view may draw.`;case"flood":return`It sent more than ${e.messages} messages in ${e.messageWindowMs.toLocaleString("en-US")} ms.`;case"slow":return`It took longer than ${e.pushMs.toLocaleString("en-US")} ms to draw what it was shown.`}}function gn(t,e){let s=t.ownerDocument,d=s.defaultView,{manifest:r}=e,m=s.createElement("div");m.className="graview-worker-view",m.setAttribute("role","region"),m.setAttribute("aria-label",r.title??r.name),m.setAttribute("data-worker-view",r.name),m.style.cssText="display:block;position:relative;contain:layout paint style;isolation:isolate;overflow:clip;min-width:0",t.appendChild(m);let w=m.attachShadow({mode:"open"}),b=e.author?s.createElement("p"):void 0;b&&(b.className="graview-worker-view-author",b.setAttribute("data-worker-view-author",r.name),b.style.cssText="margin:4px 0 0;font-size:0.75rem;color:var(--graview-ink-muted, inherit)",b.textContent=e.author,t.appendChild(b));let T={applied:0,refused:0,dropped:0},O=me(e.limits),g={maxSourceBytes:e.limits?.maxSourceBytes??256e3,maxNodes:e.limits?.maxNodes??5e3,messages:e.limits?.messages??120,messageWindowMs:e.limits?.messageWindowMs??1e3,pushMs:e.limits?.pushMs??1e3,silentMs:e.limits?.silentMs??5e3,drawMs:e.limits?.drawMs??100},K={pushMs:g.pushMs,drawMs:g.drawMs},h,k,S,v,G,x,A=!1,o={applied:0,refused:0,dropped:0},p=[],c=()=>{if(!v)return;let n=v.stats;T.applied+=n.applied-o.applied,T.refused+=n.refused-o.refused,T.dropped+=n.dropped-o.dropped,o={...n}},y=()=>{},u,a,M=()=>{let n=w.querySelector("[data-graview-view-root]"),i=d.ResizeObserver;a||!n||typeof i!="function"||(a=new i(E=>{let _=E[E.length-1]?.borderBoxSize?.[0],N=Math.ceil(_?_.blockSize:n.offsetHeight);N!==u&&(u=N,m.setAttribute("data-graview-content-height",String(N)),e.onContentHeight?.(N))}),a.observe(n))},R=()=>{a&&(a.disconnect(),a=void 0,u=void 0,m.removeAttribute("data-graview-content-height"),e.onContentHeight?.(void 0))},V=0,W=()=>{},Y=()=>{},H,vr,X,Be=[],Fe=()=>{W(),W=()=>{},Y(),H?.dispose(),c(),v?.dispose(),v=void 0,G?.stop(),y(),d.clearInterval(V)},D=(n,i)=>{if(A)return;A=!0,Fe(),R(),x?.dispose();let E=mn(n,g,i);m.removeAttribute("data-worker-view-drawn"),m.setAttribute("data-worker-view-failed",n),e.fallback!==!1&&(e.fallback??kr)(m,n,E),e.onFailure?.(n,E)},kr=(n,i,E)=>{let _=k??(()=>{try{return Ve(e.store,e.principal,{manifest:r,...e.input?{input:e.input()}:{},...S?{computed:S}:{}})}catch{return}})(),N=s.createElement("div");N.setAttribute("data-graview-fallback",i),N.style.cssText="padding:12px;display:grid;gap:6px;color:var(--graview-ink, inherit);font-family:var(--graview-font-body, inherit)";let f=s.createElement("strong");f.textContent=r.title??r.name;let C=s.createElement("ul");C.style.cssText="margin:0;padding-left:1.2em";for(let B of[..._?.node?[_.node]:[],..._?.nodes??[]]){let fe=s.createElement("li");fe.textContent=B.label??B.id,C.appendChild(fe)}let I=s.createElement("p");I.style.cssText="margin:0;font-size:0.8125rem;color:var(--graview-ink-muted, inherit)",I.textContent=`This view was stopped. ${E}`,N.append(f,C,I),w.replaceChildren(N)},Ue=jt(r,e.store);if(Ue.length>0)return queueMicrotask(()=>D("manifest",Ue.join(" "))),Ae();for(let n of Ht(e.store,r))queueMicrotask(()=>e.onProblem?.(n));let ze=n=>{if(("source"in n?new TextEncoder().encode(n.source).length:"script"in n?new TextEncoder().encode(n.script).length:0)>g.maxSourceBytes)return["source"];let E="source"in n?ye(n.source):[];return E.length>0?["source",E.join(" ")]:void 0},J=e.worker,qe=typeof J=="function"?void 0:ze(J);if(qe)return queueMicrotask(()=>D(...qe)),Ae();let Ye=qt(d,()=>et(),"blob"),Te=()=>zt(()=>e.theme?.()??he(m),e.brand,Ye),Xe="[[],null]",Je="",ie=0,U,Qe=()=>{let n=e.brand?.()?.views;if(x&&!x.theme(n?.css)&&Je!==n?.css){Je=n?.css??"";let f="The app's stylesheet for its views draws nothing: the open kit leaves all of it out, so views are drawn without it. graview check says which part (brand-views-css).";j?.postMessage({type:"notice",text:f}),e.onProblem?.(f)}x?.motion(n?.motion??"none");let i=n?.fonts??[],E=e.brand?.()?.typography,_=JSON.stringify([i,E??null]);if(_===Xe)return;Xe=_,ie+=1;let N=ie;if(i.length===0){U?.(),U=void 0;return}an().then(({loadViewFonts:f})=>{if(N!==ie)return;let C=U;U=f(s,i,{...e.asset?{asset:e.asset}:{},...e.images?{origins:e.images.origins}:{},...E?{typography:E}:{}},I=>{j?.postMessage({type:"notice",text:I}),e.onProblem?.(I)}),C?.()})},Ze="",xe=()=>{Ze=JSON.stringify(Te()),Qe(),v?.push()},et=()=>{v&&JSON.stringify(Te())!==Ze&&xe()},br=Ut(s,et),z,Sr=Ge(e.store,r)?un().then(({computedOn:n})=>{S=n(e.store.schema)}):Promise.resolve(),q,Tr=r.pictures?sn().then(({createGuestPictures:n})=>{A||(z=n(d,{as:"blob",view:`"${r.title??r.name}"`,pictures:r.pictures,...e.limits?{limits:e.limits}:{},...e.file?{file:e.file}:{},moved:()=>v?.push(),onLeft:i=>{j?.postMessage({type:"notice",text:i}),e.onProblem?.(i)}}))}):Promise.resolve();y=()=>{br(),Ye.dispose(),z?.dispose(),re?.dispose(),q?.dispose(),ue?.dispose(),ie+=1,U?.(),U=void 0};let j,Q=n=>j?.postMessage(n),tt=!1,rt=!1,ae=()=>m.toggleAttribute("data-worker-view-drawn",!A&&rt&&x!==void 0&&p.length===0&&ee.size===0&&!z?.waiting()&&!(q?.waiting??0)),Z=d.performance,ee=new Map,de=Z.now(),xr=()=>{if(V)return;let n=Math.max(10,Math.min(250,Math.floor(g.pushMs/4)));de=Z.now(),V=d.setInterval(()=>{let i=Z.now(),E=i-de>n*2?i-de-n:0;de=i;for(let[_,N]of ee){let f=N+E;if(ee.set(_,f),i-f>=g.pushMs)return D("slow")}},n)},Mr=be(()=>g.drawMs,()=>Z.now()),nt=()=>{},Me=n=>{if(A)return;if(!x)return void p.push(n);let i=x;if(!Mr.draw(_=>n[0]==="render"?i.apply(n[1],_):(i.style(n[1]),!0)))return D("slow");n[0]==="render"&&nt()},st=()=>new Set([...e.store.kindsKeptFrom(e.principal),...e.store.modules.disabledKinds]),ot=()=>Gt(e.store.schema,st()),Ee=()=>Vt(e.store.schema,e.places?.()??[],{kept:st(),...e.arrangement?{pages:e.arrangement()}:{}}),te=Kt({sees:n=>e.store.seenBy(e.principal).graph.has(n),places:Ee,lists:ot,schema:e.store.schema,...e.onNavigate?{onNavigate:e.onNavigate}:e.goTo?{onNavigate:n=>Bt(e.goTo(),n)}:{},...e.hrefOf?{hrefOf:e.hrefOf}:!e.onNavigate&&e.goTo?{hrefOf:n=>Ft(e.goTo(),n)}:{},onLost:n=>{j?.postMessage({type:"notice",text:n}),e.onProblem?.(n)}}),$=new Set,it=new Set,re,at=!1,dt=()=>{at||(at=!0,on().then(({createGuestMedia:n})=>{A||(re=n(d,{view:`"${r.title??r.name}"`,pictures:r.pictures!==void 0,shown:()=>k,...e.file?{file:e.file}:{},onProblem:i=>{j?.postMessage({type:"notice",text:i}),e.onProblem?.(i)}}),re.refresh(w))},()=>e.onProblem?.(`The view "${r.title??r.name}" places a video or a full-screen viewer, and the host's player could not be loaded.`)))},lt=!1,ut=!1,le=new Map,ct=()=>{lt||!r.accepts?.length||(lt=!0,dn().then(({createGuestDrops:n})=>{A||(q=n(d,{shadow:w,manifest:r,store:e.store,principal:e.principal,files:()=>e.files?.(),shown:()=>$,hears:()=>ut,idOf:i=>x?.renderer.idOf(i),send:Q,change:(i,E)=>{if(!v)return{ok:!1,reason:"refused",message:"The view has gone."};let _=v.change(i,E);return c(),_},handed:(i,E)=>le.set(i.href,{file:i,drop:E}),onProblem:i=>{j?.postMessage({type:"notice",text:i}),e.onProblem?.(i)},onBusy:()=>ae()}),q.refresh())},()=>e.onProblem?.(`The view "${r.title??r.name}" takes files, and the host's drop could not be loaded.`)))},ue,ft=[],pt=!1,Er=n=>{ft=n,ue?.bind(n),!(pt||n.length===0)&&(pt=!0,ln().then(({createGuestGestures:i,unheardWords:E})=>{if(!A){if(r.gestures!==!0){let _=E(r.title??r.name);return j?.postMessage({type:"notice",text:_}),e.onProblem?.(_)}ue=i(w,{root:()=>w.querySelector("[data-graview-view-root]")??void 0,idOf:_=>x?.renderer.idOf(_),send:Q}),ue.bind(ft)}},()=>{}))},Or=n=>{let i=e.store.seenBy(e.principal).graph;for(let E of $){let _=i.getNode(E);for(let N of Object.values(_??{}))for(let f of Dt(N))if(f.href===n)return f}},mt=()=>vr??=cn().then(({createGuestSections:n})=>{if(!A)return H=n(d,{shadow:w,idOf:i=>x?.renderer.idOf(i),send:Q,record:i=>$.has(i)?e.store.seenBy(e.principal).graph.getNode(i):void 0,...e.file?{file:e.file}:{},onProblem:i=>{j?.postMessage({type:"notice",text:i}),e.onProblem?.(i)}}),H.refresh(),H},()=>{e.onProblem?.(`The view "${r.title??r.name}" draws a jump or a file link, and the host's part of it could not be loaded.`)}),gt=n=>{if(n.localName==="graview-video")return dt();n.hasAttribute("data-lightbox")&&(n.setAttribute("aria-haspopup","dialog"),dt())};Promise.all([rn(),nn()]).then(([{createOpenDrawing:n,handedLinks:i,judgeLink:E,linkRefusedWords:_},{createPressReader:N,createSaver:f,fillPrefills:C,judgePress:I,markPresses:B,prefillOf:fe,quietPictures:Ar}])=>{if(A)return;let ne=N(),Rr=l=>Be.some(P=>{try{for(let L=l;L&&L.getRootNode()===w&&!L.hasAttribute("data-graview-view-root");L=L.parentElement)if(L.matches(P))return!0}catch{}return!1}),bt=(l,P)=>{let L=x?.renderer.idOf(l);if(L!==void 0&&Q({type:"dom-event",target:L,event:"acted",pressed:P}),P.ok)return X?.clear(l);Rr(l)||fn().then(({createRefusalNotes:se})=>{A||!l.isConnected||(X??=se(w),X.say(l,P.message??"That was not applied."))},()=>e.onProblem?.(`A press in the view "${r.title??r.name}" was refused: ${P.message??P.reason??"not applied"}`))},Re=f({reader:ne,save:(l,P)=>{if(!v)return;let L=v.pressed(I(e.store,r,$,l));c(),bt(P,{as:l.as,...L})}}),St=()=>Re.flush();d.addEventListener("pagehide",St),W=()=>{d.removeEventListener("pagehide",St),Re.flush()};let Wr=new WeakSet;nt=()=>{te.refresh(w),B(w),Ar(w),C(w,ne,Wr,l=>fe(e.store,e.principal,r,$,l)),re?.refresh(w),q?.refresh(),X?.refresh(),H?H.refresh():w.querySelector(pn)&&mt()};let Tt,xt=new Set,Pr=()=>(Tt!==k&&([Tt,xt]=[k,i(k)]),xt),Mt=new Set;x=n(w,{origin:e.origin??d.location.origin,link:l=>E(l,{handed:Pr(),...e.links?{origins:e.links.origins}:{}}),...e.asset?{asset:e.asset}:{},...e.images?{imageOrigins:e.images.origins}:{},...r.pictures?{picture:l=>z?.drawn(l)}:{},onRefused:l=>{if(l.reason==="url"&&l.element==="a"&&l.address!==void 0&&!Mt.has(l.address)){Mt.add(l.address);let L=_(l.address,e.links?.origins);return j?.postMessage({type:"notice",text:L}),e.onProblem?.(L)}if(l.reason!=="url"||l.element!=="img"||l.address===void 0||it.has(l.address))return;it.add(l.address);let P=It(l.address,{...e.images?{origins:e.images.origins}:{},assets:e.asset!==void 0},l.length);j?.postMessage({type:"notice",text:P}),e.onProblem?.(P)},...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>D("nodes"),send:Q,onFieldSet:l=>ne.filled(l),onAttribute:(l,P)=>{(P==="data-record"||P==="data-place")&&te.link(l),P==="data-lightbox"&>(l),P==="data-drop"&&ct()},decorate:l=>{(l.hasAttribute("data-record")||l.hasAttribute("data-place"))&&te.link(l),gt(l),l.hasAttribute("data-drop")&&ct()},before:(l,P,L)=>{ne.heard(l,P),Re.heard(l,P,L),te.pressed(l,P,L);let se=P.closest("a[href]");se&&L.contains(se)&&!se.hasAttribute("data-graview-link")&&l.type==="click"&&l.stopPropagation();let pe=P.closest("[data-lightbox]"),Et=l.type==="keydown"?l.key:void 0;if(pe&&L.contains(pe)&&l.isTrusted&&(l.type==="click"||(Et==="Enter"||Et===" ")&&pe.localName!=="button")&&(l.preventDefault(),l.stopPropagation(),re?.open(pe)),q?.before(l,P,L))return!1;let Ot=l.type==="click"&&l.isTrusted?P.closest('a[href^="#"]'):null;Ot&&L.contains(Ot)&&(l.preventDefault(),H?H.jump(P,L):mt().then(Kr=>Kr?.jump(P,L)));let We=ne.press(l,P,L);if(!We||!v)return;l.stopPropagation(),X?.clear(P.closest("[data-act]")),l.type==="keydown"&&l.preventDefault();let Gr=v.pressed(I(e.store,r,$,We));c();let At={as:We.as,...Gr},Vr=P.closest("[data-act]");return queueMicrotask(()=>bt(Vr,At)),{pressed:At}}}),Qe();for(let l of p.splice(0))Me(l);M(),ae()},()=>D("start","the view's drawing could not be loaded"));let yt=e.draft?void 0:e.viewerState?.(),ht=Wt(e.principal)??Rt(e.principal).id??e.principal.visitorKey??"",ce=lr({view:r.name,viewer:ht,state:yt??(e.draft?$e():dr(e.store,ht)),onRefused:n=>{e.onProblem?.(n),v&&j?.postMessage({type:"notice",text:n})},onLate:()=>v?.push()});Y=()=>ce.dispose();let Oe=n=>G=ke(d,{source:n,name:r.name,limiter:O,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>T.dropped+=1,onStop:(i,E)=>D(i,E),onError:i=>{tt||D("error",i)},onReady:(i,E,_)=>{j=E,h=fr(mr(d,_)),Object.assign(g,pr(K,h)),xr();let N=ge({store:e.store,principal:e.principal,view:r.name,nonce:i,send:f=>{f.type==="props"&&typeof f.push=="number"&&(ee.set(f.push,Z.now()),ae()),E.postMessage(f)},mine:ce,props:()=>{let f={...Ve(e.store,e.principal,{manifest:r,...e.input?{input:e.input()}:{},theme:Te(),places:Pt(Ee()),...S?{computed:S}:{}}),mine:ce.values()},C=$;return $=new Set([...f.node?[f.node.id]:[],...(f.nodes??[]).map(I=>I.id)]),k&&(C.size!==$.size||[...$].some(I=>!C.has(I)))&&x?.fade(),k=f,f},...z?{hand:z.hand}:{},judgeAct:(f,C)=>{let I=$t(e.store,r,f,C,{shown:$,file:B=>le.get(B)?.file??Or(B),dropped:B=>le.get(B)?.drop});if(I.ok)for(let B of I.spent??[])le.delete(B);return I},onHears:f=>{f.includes("drop")&&(ut=!0)},onGestures:Er,onClicks:(f,C)=>{Ct(m,f),Be=C},onRender:f=>{tt=!0,Me(["render",f])},onPushed:(f,C)=>{if(ee.delete(f),C>=g.pushMs)return D("slow");rt=!0,ae()},onFlood:()=>D("flood"),onStyle:f=>Me(["style",f]),places:()=>[...new Set([...Ee().map(f=>f.as),...ot().map(f=>f.slug)])],...e.limits?{limits:e.limits}:{},limiter:O});v=N,E.onmessage=({data:f})=>{if(!G?.answer(f)&&(N.receive(f),c(),!A&&f?.nonce===i&&f.type==="navigate")){let C={...f.where!==void 0?{where:f.where}:{},...f.section!==void 0?{section:f.section}:{}},I=typeof f.place=="string"?{place:f.place,...C}:typeof f.to=="string"&&{record:f.to,...C};I&&te.go(I)}},xe()}}),wt=r.pictures!==void 0||Ge(e.store,r)||yt!==void 0,vt=()=>Promise.all([ce.ready,Tr.catch(()=>Promise.reject(new Error("the view's pictures could not be loaded"))),Sr.catch(()=>Promise.reject(new Error("the view's computed values could not be worked out")))]),kt=n=>{"source"in n?(wt?Promise.all([Ke(n.source),vt()]).then(([i])=>i):Ke(n.source)).then(i=>{A||Oe({script:i})},i=>D("start",i instanceof Error&&i.message.startsWith("the view's")?i.message:"the view's runtime could not be loaded")):wt?vt().then(()=>{A||Oe(n)},i=>D("start",i instanceof Error?i.message:"the view's pictures could not be loaded")):Oe(n)};return typeof J=="function"?we(J).then(n=>{if(A)return;let i=ze(n);i?D(...i):kt(n)},n=>D("source",`Its code did not arrive${n instanceof Error&&n.message?`: ${n.message}`:""}.`)):kt(J),Ae();function Ae(){return{element:m,shadow:w,get worker(){return G?.worker},update:()=>{v&&xe()},get stats(){return c(),T},get refused(){return x?.refused??[]},get contentHeight(){return u},get css(){return x?.css??""},get pace(){return h},dispose(){A=!0,Fe(),a?.disconnect(),x?.dispose(),m.remove(),b?.remove()}}}}var gr=8e3,yr=t=>({root:t?.shadow.querySelector("[data-graview-view-root]")??void 0,css:t?.css??"",height:t?.contentHeight}),hr=t=>(t?.refused??[]).map(e=>`Refused ${e.reason==="css"?"a rule of the stylesheet":`${e.element?`<${e.element}>`:"something"}${e.name?` ${e.name}`:""}`} (${e.reason}).`);function yn({element:t,definition:e,mounted:s,optionsFor:d,draw:r,mount:m,pressing:w}){return{name:e.manifest.name,title:e.manifest.title??e.manifest.name,source:async()=>{let b=typeof e.worker=="function"?await we(e.worker):e.worker;return"source"in b?b.source:void 0},theme:async()=>{let b=s()?.element;return b?{...he(b)}:{}},drawing:()=>yr(s()),refused:()=>hr(s()),check:async b=>ye(b),presses:async b=>{let T=w?.();if(!T)throw new Error("This page cannot press a view's controls.");let{pressedHere:O}=await T(),g=d({source:b}),K=await O({manifest:g.manifest,source:b,store:g.store,principal:g.principal,...g.input?{input:g.input()}:{},...g.places?{places:g.places()}:{}});if(!K.ok){let k={control:"the view",element:"",does:"nothing",ok:!1,says:K.detail};return{ok:!1,controls:[k],problems:[k]}}let h=K.presses;return h?{ok:h.ok,controls:h.controls,problems:h.problems}:{ok:!0,controls:[],problems:[]}},draft:b=>{let T=s()?.element,O=t.ownerDocument.createElement("div");O.setAttribute("data-graview-section-draft",e.manifest.name),O.style.minWidth="0",t.appendChild(O),T&&(T.style.display="none");let g=()=>{},K=new Promise(S=>g=S),h=setTimeout(()=>g({failed:`It did not draw in ${gr/1e3} seconds.`}),gr),k=m(O,{...d({source:b}),draft:!0,fallback:!1,onFailure:(S,v)=>g({failed:v??`It failed (${S}).`}),onContentHeight:S=>{S!==void 0&&S>0&&g({})}});return K.then(()=>clearTimeout(h)),{drawn:K,drawing:()=>yr(k),refused:()=>hr(k),dispose:()=>{clearTimeout(h),k.dispose(),O.remove(),T&&(T.style.display="")}}},draw:r}}var wr="graview-guest-kit";function ts(t,e){let s=t.ownerDocument,d=s.defaultView;if(!s.getElementById(wr)){let G=s.createElement("style");G.id=wr,G.textContent=je,s.head.appendChild(G)}let r=s.createElement("div");r.className="graview-guest",r.setAttribute("role","group"),r.setAttribute("aria-label",e.title??e.view),r.setAttribute("data-guest-view",e.view),t.appendChild(r);let m={applied:0,refused:0,dropped:0},w=me(e.limits),b=be(()=>e.limits?.drawMs??100,()=>d.performance.now()),T,O,g,K=!1,h={applied:0,refused:0,dropped:0},k=()=>{if(!T)return;let G=T.stats;m.applied+=G.applied-h.applied,m.refused+=G.refused-h.refused,m.dropped+=G.dropped-h.dropped,h={...G}},S=()=>{k(),T?.dispose(),T=void 0,g?.stop()},v=(G,x)=>{K||(K=!0,S(),O?.dispose(),e.onFailure?.(G,x))};return g=ke(d,{source:e.worker,name:e.view,limiter:w,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>m.dropped+=1,onStop:(G,x)=>v(G,x),onReady:(G,x)=>{let A=De(r,{...e.kit?{kit:e.kit}:{},...e.links?{links:e.links}:{},onEvent:(p,c)=>x.postMessage({type:"event",listener:p,...c!==void 0?{detail:c}:{}}),...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>v("budget")});O=A;let o=ge({store:e.store,principal:e.principal,view:e.view,nonce:G,send:p=>x.postMessage(p),onRender:p=>{b.draw(c=>A.apply(p,c))||v("slow")},...e.input?{input:e.input}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{},onSize:e.onSize??(p=>r.style.minHeight=`${p}px`),...e.limits?{limits:e.limits}:{},limiter:w});T=o,x.onmessage=p=>{g?.answer(p.data)||(o.receive(p.data),k())},o.push()}}),{element:r,get worker(){return g?.worker},update:()=>T?.push(),get stats(){return k(),m},get refused(){return O?.refused??[]},dispose(){K=!0,S(),O?.dispose(),r.remove()}}}export{Le as GUEST_KIT,je as GUEST_KIT_CSS,_e as KIT_LINK_TARGETS,Yt as KIT_TONES,De as createKitRenderer,er as hostAttribute,tr as kitValue,ts as mountGuestWorker,gn as mountWorkerView,yn as viewPlaceHandle};
|
|
21
|
+
`;var rr=new WeakSet;function Ur(t,e){if(t.startsWith("blob:"))return"blob:";try{return new URL(t,e.location.href).origin}catch{return t}}function nr(t,e,s){let d=Ur(e,t),r=`this page's Content-Security-Policy${s?` (${s})`:""} does not allow a worker from ${d}: it needs worker-src ${d}`;return rr.has(t)||(rr.add(t),t.console?.warn?.(`Graview: worker views cannot start on this page, because ${r}. A host that will not allow ${d} serves each view's whole script from its own origin and passes worker: { url } (the @graview/guest README, "What the host page allows").`)),r}function zr(t,e){return t===""?!0:e.startsWith("blob:")?t.startsWith("blob"):e.startsWith(t)||t.startsWith(e)}function ke(t,e){let s="script"in e.source?t.URL.createObjectURL(new t.Blob([e.source.script],{type:"text/javascript"})):void 0,d="script"in e.source?s:e.source.url,r,m,w=!1,b=!1,T=0,O=0,g="",K=0,h=0,k=t.performance,S=k.now(),v,G=u=>{let a=u,M=String(a.effectiveDirective||a.violatedDirective||"").split(" ")[0];/^(worker-src|script-src|script-src-elem|child-src|default-src)$/.test(M)&&zr(String(a.blockedURI??""),d)&&(v=M)},x=t.document;x?.addEventListener("securitypolicyviolation",G);let A=()=>x?.removeEventListener("securitypolicyviolation",G),o=()=>{b||(b=!0,m?.close(),r?.terminate(),r=void 0,t.clearTimeout(T),t.clearInterval(O),A(),s&&t.URL.revokeObjectURL(s))},p=(u,a)=>{b||(o(),e.onStop(u,a))},c=()=>{t.clearTimeout(T),A(),g=Nt();let u=new t.MessageChannel;m=u.port1;let a=Math.max(1,e.silentMs),M=Math.max(10,Math.min(1e3,Math.floor(a/4)));S=k.now();let R=S;O=t.setInterval(()=>{let W=k.now();if(W-R>M*2&&(S+=W-R-M),R=W,W-S>=a)return p("silent");K+=1,u.port1.postMessage({type:"heartbeat",beat:K})},M);let V={graview:"host-hello",protocol:1,nonce:g,view:e.name};r.postMessage(V,[u.port2]),e.onReady(g,u.port1,k.now()-y)},y=k.now();try{r=new t.Worker(d,{name:e.name})}catch(u){r=void 0;let a=u,M=a?.name==="SecurityError"?nr(t,d,v):`the worker could not be made: ${String(a?.message??u)}`;queueMicrotask(()=>p("start",M))}return r&&(T=t.setTimeout(()=>p("start",`it never said it was ready in ${e.readyMs.toLocaleString("en-US")} ms`),e.readyMs),r.onerror=u=>{let a=typeof u.message=="string"&&u.message!==""?u.message:void 0;if(w)return void e.onError?.(a??"an error");t.clearTimeout(T),t.setTimeout(()=>!w&&p("start",v?nr(t,d,v):a?`it failed before it said ready: ${a}`:"it failed before it said ready, and the engine gave no reason (a page policy that refuses it, or a script that does not load)"),0)},r.onmessage=u=>{if(!e.limiter.message()||w||!Lt(u.data)||u.data.protocol!==1){e.onDropped();return}w=!0,c()}),{get worker(){return r},answer(u){let a=u;return typeof a!="object"||a===null||a.type!=="heartbeat"||a.nonce!==g?!1:(typeof a.beat=="number"&&a.beat>h&&a.beat<=K&&(h=a.beat,S=k.now()),!0)},stop:o}}function be(t,e){let s=e(),d=0;return{draw(r){let m=e();m-s>=1e3&&(s=m,d=0);let w=t(),b=r(()=>d+(e()-m)>=w);return d+=e()-m,b&&d<w}}}var qr=200,Yr=64*1024,Xr=120,sr=t=>new TextEncoder().encode(t).length;function $e(){let t=new Map;return{read:async e=>Object.fromEntries(t.get(e)??[]),write:async(e,s,d)=>{let r=t.get(e)??new Map;if(t.set(e,r),d===null)return r.delete(s),{ok:!0};let m=sr(d);for(let[w,b]of r)w!==s&&(m+=sr(b));return m>Yr||!r.has(s)&&r.size>=qr?{ok:!1,sentence:"This view keeps as much as it can for this visit, so this value was not kept."}:(r.set(s,d),{ok:!0})}}}var or=new WeakMap;function dr(t,e){let s=or.get(t)??new Map;or.set(t,s);let d=s.get(e)??$e();return s.set(e,d),d}var Se="What this view keeps for you could not be read just now.",Jr="This value could not be kept just now.",He="The host has not answered yet, so this value is not kept yet.",Qr="This view asked to keep too many values at once, so this one was not kept.",Zr="The host has not answered for too many values, so this one was not kept.",en=200,ir=new WeakMap;function tn(t,e,s){let d=ir.get(t)??new Map;ir.set(t,d);let r=`${e}\0${s}`,m=d.get(r)??{writes:[],lines:new Map,drawings:new Set};return d.set(r,m),m}function lr({view:t,viewer:e="",state:s,onRefused:d,onLate:r,readMs:m=1500,writeMs:w=1e4,now:b=Date.now}){let T=new Map,O=!1,g=!1,K=new Map,h=(c,y)=>{y===null?T.delete(c):T.set(c,y)},k=tn(s,e,t),{writes:S,lines:v,drawings:G}=k,x={landed(c,y){O?h(c,y):K.set(c,y)},onRefused:d,onLate:r};G.add(x);let A=c=>(d?.(c),{ok:!1,sentence:c}),o=(async()=>{try{T=new Map(Object.entries(await s.read(t)).filter(([,c])=>typeof c=="string"));for(let[c,y]of K)h(c,y);O=!0,g&&r?.()}catch{d?.(Se)}})(),p=new Promise(c=>{let y=setTimeout(()=>{g=!0,O||d?.(Se),c()},m);o.then(()=>{clearTimeout(y),c()})});return{ready:p,values:()=>Object.fromEntries(T),get:c=>p.then(()=>new Promise(y=>{let u=()=>{if(!O)return y({ok:!1,sentence:Se});let a=v.get(c);if(!a)return y({ok:!0,value:T.get(c)??null});if(a.late)return y({ok:!1,sentence:He});a.gets.push(u)};u()})),set(c,y){let u=_t(c,y);if(u)return Promise.resolve(A(u));let a=c,M=y;return p.then(()=>new Promise(R=>{if(!O)return R(A(`${Se} So this value was not kept.`));let V={drawing:x,answer:R},W=v.get(a);if(!W){if(v.size>=en)return R(A(Zr));let Y=b();for(;S.length>0&&S[0]<=Y-6e4;)S.shift();if(S.length>=Xr)return R(A(Qr));S.push(Y);let H={late:!1,gets:[],moved:new Set};return v.set(a,H),ur(s,t,k,a,H,M,[V],w)}W.next={value:M,told:W.late?[]:[...W.next?.told??[],V],writeMs:w},W.late&&R(A(He))}))},dispose(){G.delete(x)}}}function ar(t,e){if(!e.ok)for(let s of new Set(t.map(d=>d.drawing)))s.onRefused?.(e.sentence);for(let s of t)s.answer(e)}function ur(t,e,s,d,r,m,w,b){let T=!1,O=setTimeout(()=>{T=!0,r.late=!0,ar([...w,...r.next?.told??[]],{ok:!1,sentence:He}),r.next&&(r.next.told=[]);for(let g of r.gets.splice(0))g()},b);Promise.resolve().then(()=>t.write(e,d,m)).catch(()=>{}).then(g=>{clearTimeout(O);let K=g?.ok===!0,h=g&&!g.ok&&typeof g.sentence=="string"&&g.sentence?g.sentence:Jr;if(K){let S=new Set(T?[]:w.map(v=>v.drawing));for(let v of s.drawings)v.landed(d,m),S.has(v)||r.moved.add(v)}if(!T)ar(w,K?{ok:!0}:{ok:!1,sentence:h});else if(!K)for(let S of s.drawings)S.onRefused?.(h);r.late=!1;let k=r.next;if(r.next=void 0,k)return ur(t,e,s,d,r,k.value,k.told,k.writeMs);s.lines.delete(d);for(let S of r.gets.splice(0))S();for(let S of r.moved)s.drawings.has(S)&&S.onLate?.()})}function fr(t){return!Number.isFinite(t)||t<=60?1:Math.min(4,Math.round(t/60*10)/10)}function pr(t,e){return{...t,pushMs:Math.round(t.pushMs*e),drawMs:Math.round(t.drawMs*e)}}var cr=new WeakMap;function mr(t,e){let s=cr.get(t);return s!==void 0?s:(cr.set(t,e),e)}var rn=F(()=>(__graviewPreload(import.meta.url,["./chunk.GOVRX2YX.js","./chunk.TRP66PHK.js","./chunk.PGT4ZQDG.js","./chunk.AJZBJBMO.js"]),import("./chunk.X45EITTK.js"))),nn=F(()=>(__graviewPreload(import.meta.url,["./chunk.UZKBFI52.js","./chunk.MFMC35ET.js","./chunk.GKYJQE5A.js","./chunk.EZQK23AB.js","./chunk.QDVGHI7R.js","./chunk.M5FP4Y4Q.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.2INDKSJI.js"))),sn=F(()=>(__graviewPreload(import.meta.url,["./chunk.RSMCTI2N.js","./chunk.AJZBJBMO.js"]),import("./chunk.UJPX3BUV.js"))),on=F(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.NI4OPHTL.js","./chunk.U5KJQFAP.js","./chunk.FOHZPYUV.js","./chunk.IXYG65TM.js","./chunk.W6L2VAJG.js","./chunk.N3MXLORL.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.H33XWGAY.js"))),an=F(()=>(__graviewPreload(import.meta.url,["./chunk.TRP66PHK.js","./chunk.PGT4ZQDG.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZGLOXN7O.js"))),dn=F(()=>(__graviewPreload(import.meta.url,["./chunk.GKYJQE5A.js","./chunk.EZQK23AB.js","./chunk.QDVGHI7R.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.EJC7ACZT.js"))),ln=F(()=>(__graviewPreload(import.meta.url,["./chunk.ONAH6MC4.js","./chunk.AJZBJBMO.js"]),import("./chunk.AIFT2HNP.js"))),un=F(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.NI4OPHTL.js","./chunk.U5KJQFAP.js","./chunk.FOHZPYUV.js","./chunk.IXYG65TM.js","./chunk.W6L2VAJG.js","./chunk.N3MXLORL.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.23DATB5Y.js"))),cn=F(()=>(__graviewPreload(import.meta.url,["./chunk.QDVGHI7R.js","./chunk.AJZBJBMO.js"]),import("./chunk.EG7OOJH5.js"))),fn=F(()=>(__graviewPreload(import.meta.url,["./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Z3TK2LJM.js"))),pn='a[href^="#"], [data-sight], [data-file]';function mn(t,e,s){switch(t){case"manifest":return s??"Its manifest names something this app does not have.";case"source":return s??`Its code is longer than the ${e.maxSourceBytes.toLocaleString("en-US")} bytes a view may be.`;case"start":return`It could not start${s?`: ${s}.`:"."}`;case"error":return`It failed before it drew anything${s?`: ${s}`:"."}`;case"silent":return`It stopped answering for ${e.silentMs.toLocaleString("en-US")} ms.`;case"nodes":return`It drew more than the ${e.maxNodes.toLocaleString("en-US")} things a view may draw.`;case"flood":return`It sent more than ${e.messages} messages in ${e.messageWindowMs.toLocaleString("en-US")} ms.`;case"slow":return`It took longer than ${e.pushMs.toLocaleString("en-US")} ms to draw what it was shown.`}}function gn(t,e){let s=t.ownerDocument,d=s.defaultView,{manifest:r}=e,m=s.createElement("div");m.className="graview-worker-view",m.setAttribute("role","region"),m.setAttribute("aria-label",r.title??r.name),m.setAttribute("data-worker-view",r.name),m.style.cssText="display:block;position:relative;contain:layout paint style;isolation:isolate;overflow:clip;min-width:0",t.appendChild(m);let w=m.attachShadow({mode:"open"}),b=e.author?s.createElement("p"):void 0;b&&(b.className="graview-worker-view-author",b.setAttribute("data-worker-view-author",r.name),b.style.cssText="margin:4px 0 0;font-size:0.75rem;color:var(--graview-ink-muted, inherit)",b.textContent=e.author,t.appendChild(b));let T={applied:0,refused:0,dropped:0},O=me(e.limits),g={maxSourceBytes:e.limits?.maxSourceBytes??256e3,maxNodes:e.limits?.maxNodes??5e3,messages:e.limits?.messages??120,messageWindowMs:e.limits?.messageWindowMs??1e3,pushMs:e.limits?.pushMs??1e3,silentMs:e.limits?.silentMs??5e3,drawMs:e.limits?.drawMs??100},K={pushMs:g.pushMs,drawMs:g.drawMs},h,k,S,v,G,x,A=!1,o={applied:0,refused:0,dropped:0},p=[],c=()=>{if(!v)return;let n=v.stats;T.applied+=n.applied-o.applied,T.refused+=n.refused-o.refused,T.dropped+=n.dropped-o.dropped,o={...n}},y=()=>{},u,a,M=()=>{let n=w.querySelector("[data-graview-view-root]"),i=d.ResizeObserver;a||!n||typeof i!="function"||(a=new i(E=>{let _=E[E.length-1]?.borderBoxSize?.[0],N=Math.ceil(_?_.blockSize:n.offsetHeight);N!==u&&(u=N,m.setAttribute("data-graview-content-height",String(N)),e.onContentHeight?.(N))}),a.observe(n))},R=()=>{a&&(a.disconnect(),a=void 0,u=void 0,m.removeAttribute("data-graview-content-height"),e.onContentHeight?.(void 0))},V=0,W=()=>{},Y=()=>{},H,vr,X,Be=[],Fe=()=>{W(),W=()=>{},Y(),H?.dispose(),c(),v?.dispose(),v=void 0,G?.stop(),y(),d.clearInterval(V)},D=(n,i)=>{if(A)return;A=!0,Fe(),R(),x?.dispose();let E=mn(n,g,i);m.removeAttribute("data-worker-view-drawn"),m.setAttribute("data-worker-view-failed",n),e.fallback!==!1&&(e.fallback??kr)(m,n,E),e.onFailure?.(n,E)},kr=(n,i,E)=>{let _=k??(()=>{try{return Ve(e.store,e.principal,{manifest:r,...e.input?{input:e.input()}:{},...S?{computed:S}:{}})}catch{return}})(),N=s.createElement("div");N.setAttribute("data-graview-fallback",i),N.style.cssText="padding:12px;display:grid;gap:6px;color:var(--graview-ink, inherit);font-family:var(--graview-font-body, inherit)";let f=s.createElement("strong");f.textContent=r.title??r.name;let I=s.createElement("ul");I.style.cssText="margin:0;padding-left:1.2em";for(let B of[..._?.node?[_.node]:[],..._?.nodes??[]]){let fe=s.createElement("li");fe.textContent=B.label??B.id,I.appendChild(fe)}let C=s.createElement("p");C.style.cssText="margin:0;font-size:0.8125rem;color:var(--graview-ink-muted, inherit)",C.textContent=`This view was stopped. ${E}`,N.append(f,I,C),w.replaceChildren(N)},Ue=jt(r,e.store);if(Ue.length>0)return queueMicrotask(()=>D("manifest",Ue.join(" "))),Ae();for(let n of Ht(e.store,r))queueMicrotask(()=>e.onProblem?.(n));let ze=n=>{if(("source"in n?new TextEncoder().encode(n.source).length:"script"in n?new TextEncoder().encode(n.script).length:0)>g.maxSourceBytes)return["source"];let E="source"in n?ye(n.source):[];return E.length>0?["source",E.join(" ")]:void 0},J=e.worker,qe=typeof J=="function"?void 0:ze(J);if(qe)return queueMicrotask(()=>D(...qe)),Ae();let Ye=qt(d,()=>et(),"blob"),Te=()=>zt(()=>e.theme?.()??he(m),e.brand,Ye),Xe="[[],null]",Je="",ie=0,U,Qe=()=>{let n=e.brand?.()?.views;if(x&&!x.theme(n?.css)&&Je!==n?.css){Je=n?.css??"";let f="The app's stylesheet for its views draws nothing: the open kit leaves all of it out, so views are drawn without it. graview check says which part (brand-views-css).";j?.postMessage({type:"notice",text:f}),e.onProblem?.(f)}x?.motion(n?.motion??"none");let i=n?.fonts??[],E=e.brand?.()?.typography,_=JSON.stringify([i,E??null]);if(_===Xe)return;Xe=_,ie+=1;let N=ie;if(i.length===0){U?.(),U=void 0;return}an().then(({loadViewFonts:f})=>{N===ie&&(U=f(s,i,{...e.asset?{asset:e.asset}:{},...e.fonts?{origins:e.fonts.origins}:{},...E?{typography:E}:{}},I=>{j?.postMessage({type:"notice",text:I}),e.onProblem?.(I)},U))})},Ze="",xe=()=>{Ze=JSON.stringify(Te()),Qe(),v?.push()},et=()=>{v&&JSON.stringify(Te())!==Ze&&xe()},br=Ut(s,et),z,Sr=Ge(e.store,r)?un().then(({computedOn:n})=>{S=n(e.store.schema)}):Promise.resolve(),q,Tr=r.pictures?sn().then(({createGuestPictures:n})=>{A||(z=n(d,{as:"blob",view:`"${r.title??r.name}"`,pictures:r.pictures,...e.limits?{limits:e.limits}:{},...e.file?{file:e.file}:{},moved:()=>v?.push(),onLeft:i=>{j?.postMessage({type:"notice",text:i}),e.onProblem?.(i)}}))}):Promise.resolve();y=()=>{br(),Ye.dispose(),z?.dispose(),re?.dispose(),q?.dispose(),ue?.dispose(),ie+=1,U?.(),U=void 0};let j,Q=n=>j?.postMessage(n),tt=!1,rt=!1,ae=()=>m.toggleAttribute("data-worker-view-drawn",!A&&rt&&x!==void 0&&p.length===0&&ee.size===0&&!z?.waiting()&&!(q?.waiting??0)),Z=d.performance,ee=new Map,de=Z.now(),xr=()=>{if(V)return;let n=Math.max(10,Math.min(250,Math.floor(g.pushMs/4)));de=Z.now(),V=d.setInterval(()=>{let i=Z.now(),E=i-de>n*2?i-de-n:0;de=i;for(let[_,N]of ee){let f=N+E;if(ee.set(_,f),i-f>=g.pushMs)return D("slow")}},n)},Mr=be(()=>g.drawMs,()=>Z.now()),nt=()=>{},Me=n=>{if(A)return;if(!x)return void p.push(n);let i=x;if(!Mr.draw(_=>n[0]==="render"?i.apply(n[1],_):(i.style(n[1]),!0)))return D("slow");n[0]==="render"&&nt()},st=()=>new Set([...e.store.kindsKeptFrom(e.principal),...e.store.modules.disabledKinds]),ot=()=>Gt(e.store.schema,st()),Ee=()=>Vt(e.store.schema,e.places?.()??[],{kept:st(),...e.arrangement?{pages:e.arrangement()}:{}}),te=Kt({sees:n=>e.store.seenBy(e.principal).graph.has(n),places:Ee,lists:ot,schema:e.store.schema,...e.onNavigate?{onNavigate:e.onNavigate}:e.goTo?{onNavigate:n=>Bt(e.goTo(),n)}:{},...e.hrefOf?{hrefOf:e.hrefOf}:!e.onNavigate&&e.goTo?{hrefOf:n=>Ft(e.goTo(),n)}:{},onLost:n=>{j?.postMessage({type:"notice",text:n}),e.onProblem?.(n)}}),$=new Set,it=new Set,re,at=!1,dt=()=>{at||(at=!0,on().then(({createGuestMedia:n})=>{A||(re=n(d,{view:`"${r.title??r.name}"`,pictures:r.pictures!==void 0,shown:()=>k,...e.file?{file:e.file}:{},onProblem:i=>{j?.postMessage({type:"notice",text:i}),e.onProblem?.(i)}}),re.refresh(w))},()=>e.onProblem?.(`The view "${r.title??r.name}" places a video or a full-screen viewer, and the host's player could not be loaded.`)))},lt=!1,ut=!1,le=new Map,ct=()=>{lt||!r.accepts?.length||(lt=!0,dn().then(({createGuestDrops:n})=>{A||(q=n(d,{shadow:w,manifest:r,store:e.store,principal:e.principal,files:()=>e.files?.(),shown:()=>$,hears:()=>ut,idOf:i=>x?.renderer.idOf(i),send:Q,change:(i,E)=>{if(!v)return{ok:!1,reason:"refused",message:"The view has gone."};let _=v.change(i,E);return c(),_},handed:(i,E)=>le.set(i.href,{file:i,drop:E}),onProblem:i=>{j?.postMessage({type:"notice",text:i}),e.onProblem?.(i)},onBusy:()=>ae()}),q.refresh())},()=>e.onProblem?.(`The view "${r.title??r.name}" takes files, and the host's drop could not be loaded.`)))},ue,ft=[],pt=!1,Er=n=>{ft=n,ue?.bind(n),!(pt||n.length===0)&&(pt=!0,ln().then(({createGuestGestures:i,unheardWords:E})=>{if(!A){if(r.gestures!==!0){let _=E(r.title??r.name);return j?.postMessage({type:"notice",text:_}),e.onProblem?.(_)}ue=i(w,{root:()=>w.querySelector("[data-graview-view-root]")??void 0,idOf:_=>x?.renderer.idOf(_),send:Q}),ue.bind(ft)}},()=>{}))},Or=n=>{let i=e.store.seenBy(e.principal).graph;for(let E of $){let _=i.getNode(E);for(let N of Object.values(_??{}))for(let f of Dt(N))if(f.href===n)return f}},mt=()=>vr??=cn().then(({createGuestSections:n})=>{if(!A)return H=n(d,{shadow:w,idOf:i=>x?.renderer.idOf(i),send:Q,record:i=>$.has(i)?e.store.seenBy(e.principal).graph.getNode(i):void 0,...e.file?{file:e.file}:{},onProblem:i=>{j?.postMessage({type:"notice",text:i}),e.onProblem?.(i)}}),H.refresh(),H},()=>{e.onProblem?.(`The view "${r.title??r.name}" draws a jump or a file link, and the host's part of it could not be loaded.`)}),gt=n=>{if(n.localName==="graview-video")return dt();n.hasAttribute("data-lightbox")&&(n.setAttribute("aria-haspopup","dialog"),dt())};Promise.all([rn(),nn()]).then(([{createOpenDrawing:n,handedLinks:i,judgeLink:E,linkRefusedWords:_},{createPressReader:N,createSaver:f,fillPrefills:I,judgePress:C,markPresses:B,prefillOf:fe,quietPictures:Ar}])=>{if(A)return;let ne=N(),Rr=l=>Be.some(P=>{try{for(let L=l;L&&L.getRootNode()===w&&!L.hasAttribute("data-graview-view-root");L=L.parentElement)if(L.matches(P))return!0}catch{}return!1}),bt=(l,P)=>{let L=x?.renderer.idOf(l);if(L!==void 0&&Q({type:"dom-event",target:L,event:"acted",pressed:P}),P.ok)return X?.clear(l);Rr(l)||fn().then(({createRefusalNotes:se})=>{A||!l.isConnected||(X??=se(w),X.say(l,P.message??"That was not applied."))},()=>e.onProblem?.(`A press in the view "${r.title??r.name}" was refused: ${P.message??P.reason??"not applied"}`))},Re=f({reader:ne,save:(l,P)=>{if(!v)return;let L=v.pressed(C(e.store,r,$,l));c(),bt(P,{as:l.as,...L})}}),St=()=>Re.flush();d.addEventListener("pagehide",St),W=()=>{d.removeEventListener("pagehide",St),Re.flush()};let Wr=new WeakSet;nt=()=>{te.refresh(w),B(w),Ar(w),I(w,ne,Wr,l=>fe(e.store,e.principal,r,$,l)),re?.refresh(w),q?.refresh(),X?.refresh(),H?H.refresh():w.querySelector(pn)&&mt()};let Tt,xt=new Set,Pr=()=>(Tt!==k&&([Tt,xt]=[k,i(k)]),xt),Mt=new Set;x=n(w,{origin:e.origin??d.location.origin,link:l=>E(l,{handed:Pr(),...e.links?{origins:e.links.origins}:{}}),...e.asset?{asset:e.asset}:{},...e.images?{imageOrigins:e.images.origins}:{},...r.pictures?{picture:l=>z?.drawn(l)}:{},onRefused:l=>{if(l.reason==="url"&&l.element==="a"&&l.address!==void 0&&!Mt.has(l.address)){Mt.add(l.address);let L=_(l.address,e.links?.origins);return j?.postMessage({type:"notice",text:L}),e.onProblem?.(L)}if(l.reason!=="url"||l.element!=="img"||l.address===void 0||it.has(l.address))return;it.add(l.address);let P=It(l.address,{...e.images?{origins:e.images.origins}:{},assets:e.asset!==void 0},l.length);j?.postMessage({type:"notice",text:P}),e.onProblem?.(P)},...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>D("nodes"),send:Q,onFieldSet:l=>ne.filled(l),onAttribute:(l,P)=>{(P==="data-record"||P==="data-place")&&te.link(l),P==="data-lightbox"&>(l),P==="data-drop"&&ct()},decorate:l=>{(l.hasAttribute("data-record")||l.hasAttribute("data-place"))&&te.link(l),gt(l),l.hasAttribute("data-drop")&&ct()},before:(l,P,L)=>{ne.heard(l,P),Re.heard(l,P,L),te.pressed(l,P,L);let se=P.closest("a[href]");se&&L.contains(se)&&!se.hasAttribute("data-graview-link")&&l.type==="click"&&l.stopPropagation();let pe=P.closest("[data-lightbox]"),Et=l.type==="keydown"?l.key:void 0;if(pe&&L.contains(pe)&&l.isTrusted&&(l.type==="click"||(Et==="Enter"||Et===" ")&&pe.localName!=="button")&&(l.preventDefault(),l.stopPropagation(),re?.open(pe)),q?.before(l,P,L))return!1;let Ot=l.type==="click"&&l.isTrusted?P.closest('a[href^="#"]'):null;Ot&&L.contains(Ot)&&(l.preventDefault(),H?H.jump(P,L):mt().then(Kr=>Kr?.jump(P,L)));let We=ne.press(l,P,L);if(!We||!v)return;l.stopPropagation(),X?.clear(P.closest("[data-act]")),l.type==="keydown"&&l.preventDefault();let Gr=v.pressed(C(e.store,r,$,We));c();let At={as:We.as,...Gr},Vr=P.closest("[data-act]");return queueMicrotask(()=>bt(Vr,At)),{pressed:At}}}),Qe();for(let l of p.splice(0))Me(l);M(),ae()},()=>D("start","the view's drawing could not be loaded"));let yt=e.draft?void 0:e.viewerState?.(),ht=Wt(e.principal)??Rt(e.principal).id??e.principal.visitorKey??"",ce=lr({view:r.name,viewer:ht,state:yt??(e.draft?$e():dr(e.store,ht)),onRefused:n=>{e.onProblem?.(n),v&&j?.postMessage({type:"notice",text:n})},onLate:()=>v?.push()});Y=()=>ce.dispose();let Oe=n=>G=ke(d,{source:n,name:r.name,limiter:O,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>T.dropped+=1,onStop:(i,E)=>D(i,E),onError:i=>{tt||D("error",i)},onReady:(i,E,_)=>{j=E,h=fr(mr(d,_)),Object.assign(g,pr(K,h)),xr();let N=ge({store:e.store,principal:e.principal,view:r.name,nonce:i,send:f=>{f.type==="props"&&typeof f.push=="number"&&(ee.set(f.push,Z.now()),ae()),E.postMessage(f)},mine:ce,props:()=>{let f={...Ve(e.store,e.principal,{manifest:r,...e.input?{input:e.input()}:{},theme:Te(),places:Pt(Ee()),...S?{computed:S}:{}}),mine:ce.values()},I=$;return $=new Set([...f.node?[f.node.id]:[],...(f.nodes??[]).map(C=>C.id)]),k&&(I.size!==$.size||[...$].some(C=>!I.has(C)))&&x?.fade(),k=f,f},...z?{hand:z.hand}:{},judgeAct:(f,I)=>{let C=$t(e.store,r,f,I,{shown:$,file:B=>le.get(B)?.file??Or(B),dropped:B=>le.get(B)?.drop});if(C.ok)for(let B of C.spent??[])le.delete(B);return C},onHears:f=>{f.includes("drop")&&(ut=!0)},onGestures:Er,onClicks:(f,I)=>{Ct(m,f),Be=I},onRender:f=>{tt=!0,Me(["render",f])},onPushed:(f,I)=>{if(ee.delete(f),I>=g.pushMs)return D("slow");rt=!0,ae()},onFlood:()=>D("flood"),onStyle:f=>Me(["style",f]),places:()=>[...new Set([...Ee().map(f=>f.as),...ot().map(f=>f.slug)])],...e.limits?{limits:e.limits}:{},limiter:O});v=N,E.onmessage=({data:f})=>{if(!G?.answer(f)&&(N.receive(f),c(),!A&&f?.nonce===i&&f.type==="navigate")){let I={...f.where!==void 0?{where:f.where}:{},...f.section!==void 0?{section:f.section}:{}},C=typeof f.place=="string"?{place:f.place,...I}:typeof f.to=="string"&&{record:f.to,...I};C&&te.go(C)}},xe()}}),wt=r.pictures!==void 0||Ge(e.store,r)||yt!==void 0,vt=()=>Promise.all([ce.ready,Tr.catch(()=>Promise.reject(new Error("the view's pictures could not be loaded"))),Sr.catch(()=>Promise.reject(new Error("the view's computed values could not be worked out")))]),kt=n=>{"source"in n?(wt?Promise.all([Ke(n.source),vt()]).then(([i])=>i):Ke(n.source)).then(i=>{A||Oe({script:i})},i=>D("start",i instanceof Error&&i.message.startsWith("the view's")?i.message:"the view's runtime could not be loaded")):wt?vt().then(()=>{A||Oe(n)},i=>D("start",i instanceof Error?i.message:"the view's pictures could not be loaded")):Oe(n)};return typeof J=="function"?we(J).then(n=>{if(A)return;let i=ze(n);i?D(...i):kt(n)},n=>D("source",`Its code did not arrive${n instanceof Error&&n.message?`: ${n.message}`:""}.`)):kt(J),Ae();function Ae(){return{element:m,shadow:w,get worker(){return G?.worker},update:()=>{v&&xe()},get stats(){return c(),T},get refused(){return x?.refused??[]},get contentHeight(){return u},get css(){return x?.css??""},get pace(){return h},dispose(){A=!0,Fe(),a?.disconnect(),x?.dispose(),m.remove(),b?.remove()}}}}var gr=8e3,yr=t=>({root:t?.shadow.querySelector("[data-graview-view-root]")??void 0,css:t?.css??"",height:t?.contentHeight}),hr=t=>(t?.refused??[]).map(e=>`Refused ${e.reason==="css"?"a rule of the stylesheet":`${e.element?`<${e.element}>`:"something"}${e.name?` ${e.name}`:""}`} (${e.reason}).`);function yn({element:t,definition:e,mounted:s,optionsFor:d,draw:r,mount:m,pressing:w}){return{name:e.manifest.name,title:e.manifest.title??e.manifest.name,source:async()=>{let b=typeof e.worker=="function"?await we(e.worker):e.worker;return"source"in b?b.source:void 0},theme:async()=>{let b=s()?.element;return b?{...he(b)}:{}},drawing:()=>yr(s()),refused:()=>hr(s()),check:async b=>ye(b),presses:async b=>{let T=w?.();if(!T)throw new Error("This page cannot press a view's controls.");let{pressedHere:O}=await T(),g=d({source:b}),K=await O({manifest:g.manifest,source:b,store:g.store,principal:g.principal,...g.input?{input:g.input()}:{},...g.places?{places:g.places()}:{}});if(!K.ok){let k={control:"the view",element:"",does:"nothing",ok:!1,says:K.detail};return{ok:!1,controls:[k],problems:[k]}}let h=K.presses;return h?{ok:h.ok,controls:h.controls,problems:h.problems}:{ok:!0,controls:[],problems:[]}},draft:b=>{let T=s()?.element,O=t.ownerDocument.createElement("div");O.setAttribute("data-graview-section-draft",e.manifest.name),O.style.minWidth="0",t.appendChild(O),T&&(T.style.display="none");let g=()=>{},K=new Promise(S=>g=S),h=setTimeout(()=>g({failed:`It did not draw in ${gr/1e3} seconds.`}),gr),k=m(O,{...d({source:b}),draft:!0,fallback:!1,onFailure:(S,v)=>g({failed:v??`It failed (${S}).`}),onContentHeight:S=>{S!==void 0&&S>0&&g({})}});return K.then(()=>clearTimeout(h)),{drawn:K,drawing:()=>yr(k),refused:()=>hr(k),dispose:()=>{clearTimeout(h),k.dispose(),O.remove(),T&&(T.style.display="")}}},draw:r}}var wr="graview-guest-kit";function ts(t,e){let s=t.ownerDocument,d=s.defaultView;if(!s.getElementById(wr)){let G=s.createElement("style");G.id=wr,G.textContent=je,s.head.appendChild(G)}let r=s.createElement("div");r.className="graview-guest",r.setAttribute("role","group"),r.setAttribute("aria-label",e.title??e.view),r.setAttribute("data-guest-view",e.view),t.appendChild(r);let m={applied:0,refused:0,dropped:0},w=me(e.limits),b=be(()=>e.limits?.drawMs??100,()=>d.performance.now()),T,O,g,K=!1,h={applied:0,refused:0,dropped:0},k=()=>{if(!T)return;let G=T.stats;m.applied+=G.applied-h.applied,m.refused+=G.refused-h.refused,m.dropped+=G.dropped-h.dropped,h={...G}},S=()=>{k(),T?.dispose(),T=void 0,g?.stop()},v=(G,x)=>{K||(K=!0,S(),O?.dispose(),e.onFailure?.(G,x))};return g=ke(d,{source:e.worker,name:e.view,limiter:w,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>m.dropped+=1,onStop:(G,x)=>v(G,x),onReady:(G,x)=>{let A=De(r,{...e.kit?{kit:e.kit}:{},...e.links?{links:e.links}:{},onEvent:(p,c)=>x.postMessage({type:"event",listener:p,...c!==void 0?{detail:c}:{}}),...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>v("budget")});O=A;let o=ge({store:e.store,principal:e.principal,view:e.view,nonce:G,send:p=>x.postMessage(p),onRender:p=>{b.draw(c=>A.apply(p,c))||v("slow")},...e.input?{input:e.input}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{},onSize:e.onSize??(p=>r.style.minHeight=`${p}px`),...e.limits?{limits:e.limits}:{},limiter:w});T=o,x.onmessage=p=>{g?.answer(p.data)||(o.receive(p.data),k())},o.push()}}),{element:r,get worker(){return g?.worker},update:()=>T?.push(),get stats(){return k(),m},get refused(){return O?.refused??[]},dispose(){K=!0,S(),O?.dispose(),r.remove()}}}export{Le as GUEST_KIT,je as GUEST_KIT_CSS,_e as KIT_LINK_TARGETS,Yt as KIT_TONES,De as createKitRenderer,er as hostAttribute,tr as kitValue,ts as mountGuestWorker,gn as mountWorkerView,yn as viewPlaceHandle};
|