graview 0.1.61 → 0.1.63
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/preview/{chunk.JEQO24GS.js → chunk.24HNOLUS.js} +1 -1
- package/dist/preview/chunk.25CQCCLN.js +1 -0
- package/dist/preview/{chunk.C634A6ZC.js → chunk.26H33GJC.js} +1 -1
- package/dist/preview/chunk.2F4AZZQR.js +1 -0
- package/dist/preview/chunk.2KIWGQXC.js +2 -0
- package/dist/preview/{chunk.IA5ZBMRD.js → chunk.2PJ6STKA.js} +1 -1
- package/dist/preview/{chunk.7LZ6JDJA.js → chunk.2RASWDMQ.js} +2 -2
- package/dist/preview/chunk.33XNYHI6.js +1 -0
- package/dist/preview/{chunk.SJALH7IX.js → chunk.34DRUCH2.js} +1 -1
- package/dist/preview/{chunk.SKQO467Y.js → chunk.36OE6RKG.js} +1 -1
- package/dist/preview/{chunk.3SMNWZ3M.js → chunk.37FLKAVZ.js} +1 -1
- package/dist/preview/chunk.3JCHJLH6.js +1 -0
- package/dist/preview/chunk.3L37FY3G.js +4 -0
- package/dist/preview/chunk.3OQ6S6H4.js +1 -0
- package/dist/preview/chunk.47QEWSSE.js +1 -0
- package/dist/preview/{chunk.W5TVQYAI.js → chunk.4DAKQXDG.js} +1 -1
- package/dist/preview/{chunk.BI6DS3PZ.js → chunk.4EXC26LI.js} +1 -1
- package/dist/preview/{chunk.ZKAZA6UJ.js → chunk.4MEQUUG4.js} +1 -1
- package/dist/preview/{chunk.LA2DMHZC.js → chunk.4TH3CGAZ.js} +1 -1
- package/dist/preview/{chunk.5POG3G2C.js → chunk.57YDGGJK.js} +1 -1
- package/dist/preview/chunk.5GC4VAHU.js +1 -0
- package/dist/preview/{chunk.XZWXDQ3N.js → chunk.5QXQ7PBI.js} +1 -1
- package/dist/preview/chunk.6CSHRMJC.js +1 -0
- package/dist/preview/chunk.6HKWAHPT.js +1 -0
- package/dist/preview/{chunk.ULHB3RYK.js → chunk.6XHPBJ5F.js} +1 -1
- package/dist/preview/chunk.6YK5E7ZQ.js +4 -0
- package/dist/preview/{chunk.UACSX64H.js → chunk.6Z2GHQQH.js} +3 -3
- package/dist/preview/chunk.72YXFJKC.js +2 -0
- package/dist/preview/{chunk.XFSGB6EU.js → chunk.735AFUP5.js} +1 -1
- package/dist/preview/chunk.75GENXGP.js +1 -0
- package/dist/preview/{chunk.SBLYBRDU.js → chunk.A2R53GWF.js} +1 -1
- package/dist/preview/{chunk.7R727IKU.js → chunk.AHPYNDVA.js} +2 -2
- package/dist/preview/chunk.ATDIDPKZ.js +1 -0
- package/dist/preview/{chunk.HQNE4I4M.js → chunk.AW26EETU.js} +1 -1
- package/dist/preview/chunk.AWUO3M5D.js +1 -0
- package/dist/preview/chunk.B46UZHGW.js +1 -0
- package/dist/preview/{chunk.WS7LAT4Z.js → chunk.B5PJCYBU.js} +1 -1
- package/dist/preview/chunk.BF3EZCG3.js +1 -0
- package/dist/preview/chunk.BIDL7GQD.js +0 -0
- package/dist/preview/chunk.BKQICGFW.js +1 -0
- package/dist/preview/{chunk.6HZY5NRX.js → chunk.BN7C5ZYX.js} +1 -1
- package/dist/preview/chunk.BQM3YAMR.js +35 -0
- package/dist/preview/chunk.C65EHQ7V.js +1 -0
- package/dist/preview/{chunk.3FUUYYR5.js → chunk.CAXILB7K.js} +1 -1
- package/dist/preview/{chunk.NUEPFPRA.js → chunk.CCQMDZHO.js} +1 -1
- package/dist/preview/{chunk.HOQMD6WQ.js → chunk.CGK2PY76.js} +14 -14
- package/dist/preview/chunk.CI4RZL4Z.js +1 -0
- package/dist/preview/chunk.CXDGE5ZS.js +1 -0
- package/dist/preview/chunk.CYTTZOYL.js +25 -0
- package/dist/preview/chunk.D5LOTCBU.js +3 -0
- package/dist/preview/chunk.DBFJVVWF.js +1 -0
- package/dist/preview/{chunk.A2ZQASQV.js → chunk.DDFRFSVN.js} +1 -1
- package/dist/preview/{chunk.UXOBUK3C.js → chunk.DIFIHNR3.js} +1 -1
- package/dist/preview/chunk.DVSTLVIH.js +15 -0
- package/dist/preview/chunk.DWK3GXRR.js +1 -0
- package/dist/preview/{chunk.2QFKNTAZ.js → chunk.DZSZUX34.js} +1 -1
- package/dist/preview/chunk.E3XJMO7Q.js +1 -0
- package/dist/preview/chunk.EJ2WE764.js +18 -0
- package/dist/preview/{chunk.SAYAFOF6.js → chunk.EJ4MSVX2.js} +1 -1
- package/dist/preview/chunk.ERPILTRY.js +1 -0
- package/dist/preview/chunk.FFXBDOKA.js +1 -0
- package/dist/preview/chunk.FGDGTES4.js +20 -0
- package/dist/preview/chunk.FNVGNISQ.js +3 -0
- package/dist/preview/chunk.FXCQJPN4.js +6 -0
- package/dist/preview/chunk.G2JAYG2Z.js +1 -0
- package/dist/preview/chunk.GHN62OMG.js +32 -0
- package/dist/preview/{chunk.F4VHCQNP.js → chunk.H5SN46VK.js} +1 -1
- package/dist/preview/{chunk.2XSIJH5J.js → chunk.H7AH3IW4.js} +1 -1
- package/dist/preview/{chunk.GI6XQF5X.js → chunk.HMMK7LCL.js} +1 -1
- package/dist/preview/{chunk.WICFQROI.js → chunk.HOFATBGD.js} +1 -1
- package/dist/preview/{chunk.PJ5AO7CK.js → chunk.HRNNRA2I.js} +1 -1
- package/dist/preview/{chunk.E7UDVC4V.js → chunk.HSMJHCR3.js} +1 -1
- package/dist/preview/{chunk.6SO64TUI.js → chunk.IEDCFSN5.js} +1 -1
- package/dist/preview/{chunk.VYFMUCBT.js → chunk.JIEDJEHK.js} +1 -1
- package/dist/preview/chunk.JNIDS66Z.js +1 -0
- package/dist/preview/{chunk.DHY7KOBV.js → chunk.JO3BBRSR.js} +1 -1
- package/dist/preview/chunk.JVDPRQ7J.js +1 -0
- package/dist/preview/chunk.K2HDEL7I.js +1 -0
- package/dist/preview/chunk.K7TK3KRB.js +7 -0
- package/dist/preview/{chunk.U2ISOUM2.js → chunk.KB5BCW23.js} +1 -1
- package/dist/preview/{chunk.EN2ABVIP.js → chunk.KL5H7KEV.js} +1 -1
- package/dist/preview/{chunk.ZC3FRCJQ.js → chunk.KPQLM4TM.js} +1 -1
- package/dist/preview/{chunk.R3N73BJO.js → chunk.KQPKYWDM.js} +1 -1
- package/dist/preview/{chunk.6DOOLVT4.js → chunk.KXFNRJ46.js} +1 -1
- package/dist/preview/chunk.KZUMXT5J.js +74 -0
- package/dist/preview/chunk.MAHNJO6U.js +1 -0
- package/dist/preview/{chunk.VN7I7XIO.js → chunk.MBB5A6BT.js} +1 -1
- package/dist/preview/chunk.MENLUNM5.js +1 -0
- package/dist/preview/{chunk.747OH3EE.js → chunk.MIE3ODQ2.js} +1 -1
- package/dist/preview/chunk.MT5DXJKN.js +1 -0
- package/dist/preview/chunk.MY5HJW2Z.js +1 -0
- package/dist/preview/{chunk.4LG34OC2.js → chunk.N3T2O6EW.js} +2 -2
- package/dist/preview/{chunk.E6RNMWFN.js → chunk.NEPQBMFT.js} +1 -1
- package/dist/preview/{chunk.ISRQQVS4.js → chunk.NIAM7OTV.js} +1 -1
- package/dist/preview/{chunk.5IEFTFKQ.js → chunk.NJSK3UO2.js} +1 -1
- package/dist/preview/chunk.NTC2H5ZX.js +1 -0
- package/dist/preview/chunk.NWWJNNEK.js +2 -0
- package/dist/preview/{chunk.6VLCMBRE.js → chunk.O3YIWIVQ.js} +1 -1
- package/dist/preview/chunk.O67JXUVG.js +1 -0
- package/dist/preview/{chunk.CRCJ3TAG.js → chunk.OIMGD7FR.js} +1 -1
- package/dist/preview/{chunk.ZJCM62GH.js → chunk.OM2NIQWA.js} +1 -1
- package/dist/preview/chunk.OMRQTLI5.js +1 -0
- package/dist/preview/{chunk.BDTT4ENI.js → chunk.OTSBF367.js} +2 -2
- package/dist/preview/{chunk.MU3XII7I.js → chunk.OXWOUE3W.js} +1 -1
- package/dist/preview/chunk.PDMX3GTL.js +1 -0
- package/dist/preview/{chunk.SIYBHZDD.js → chunk.PDS4HT46.js} +1 -1
- package/dist/preview/chunk.PWAP2GJS.js +1 -0
- package/dist/preview/chunk.Q2EGESEZ.js +1 -0
- package/dist/preview/{chunk.DHJI7LIW.js → chunk.Q4GJIJAU.js} +1 -1
- package/dist/preview/chunk.Q4MI53KK.js +5 -0
- package/dist/preview/chunk.Q5WEOX3Q.js +1 -0
- package/dist/preview/{chunk.2LNSENPV.js → chunk.QAMW5QDT.js} +1 -1
- package/dist/preview/{chunk.WD4VPMEE.js → chunk.QS32TO4N.js} +1 -1
- package/dist/preview/chunk.QSPLKCTX.js +1 -0
- package/dist/preview/chunk.R4HDKNT3.js +88 -0
- package/dist/preview/chunk.REUMBCSV.js +1 -0
- package/dist/preview/{chunk.CUTLO6DA.js → chunk.RUFYORIJ.js} +1 -1
- package/dist/preview/{chunk.PYVWGTQS.js → chunk.SGPXYDSG.js} +1 -1
- package/dist/preview/chunk.SJUXFPTI.js +1 -0
- package/dist/preview/{chunk.MBPOYZ3J.js → chunk.SME4HD5I.js} +1 -1
- package/dist/preview/{chunk.XZUHFXME.js → chunk.SMHP2CQH.js} +1 -1
- package/dist/preview/chunk.SSAETRHR.js +5 -0
- package/dist/preview/{chunk.PZXTSWDH.js → chunk.STDJ6XG5.js} +1 -1
- package/dist/preview/{chunk.66IKLMYX.js → chunk.T3JIZNE7.js} +2 -2
- package/dist/preview/chunk.T535ZLRM.js +1 -0
- package/dist/preview/chunk.T6PU3NKP.js +1 -0
- package/dist/preview/{chunk.U3JK2DNC.js → chunk.UAVK54Z6.js} +1 -1
- package/dist/preview/{chunk.EVEHSENK.js → chunk.V4HVFLFQ.js} +1 -1
- package/dist/preview/chunk.V6IL7CIZ.js +1 -0
- package/dist/preview/{chunk.ZVG3DR5G.js → chunk.VCTAFSZ5.js} +1 -1
- package/dist/preview/{chunk.GIW657OR.js → chunk.VZDHRY3U.js} +2 -1
- package/dist/preview/chunk.WBS7ND2C.js +1 -0
- package/dist/preview/chunk.WNS5LEO5.js +1 -0
- package/dist/preview/chunk.WUVXIUA7.js +1 -0
- package/dist/preview/{chunk.JHAFQNGC.js → chunk.WYPCLZL7.js} +1 -1
- package/dist/preview/{chunk.DLDP6OWD.js → chunk.XBYJCGPU.js} +1 -1
- package/dist/preview/{chunk.65KFZV3A.js → chunk.XCEZCOX4.js} +1 -1
- package/dist/preview/{chunk.KRFRREEW.js → chunk.XCWZFLIB.js} +1 -1
- package/dist/preview/chunk.XIW4SZHD.js +1 -0
- package/dist/preview/{chunk.MK72IRIY.js → chunk.XUO67YMT.js} +1 -1
- package/dist/preview/{chunk.FWUG7Y6C.js → chunk.XUXZW7DU.js} +1 -1
- package/dist/preview/chunk.XYGNS637.js +1 -0
- package/dist/preview/{chunk.FJIXSGYU.js → chunk.Y4ZM75WL.js} +1 -1
- package/dist/preview/{chunk.D5Q64GA4.js → chunk.YOUB3J3Y.js} +1 -1
- package/dist/preview/{chunk.3HFUO3DC.js → chunk.YXAKHXYB.js} +1 -1
- package/dist/preview/chunk.YZBJUAS6.js +1 -0
- package/dist/preview/chunk.Z2ZQJ3DD.js +1 -0
- package/dist/preview/chunk.ZELWW7UA.js +21 -0
- package/dist/preview/{chunk.YGIJDHAV.js → chunk.ZLTHWCKL.js} +2 -2
- package/dist/preview/chunk.ZP7JEVVU.js +1 -0
- package/dist/preview/chunk.ZRH5X3MR.js +1 -0
- package/dist/preview/{chunk.R5547CJ7.js → chunk.ZSGDVNVN.js} +1 -1
- package/dist/preview/chunk.ZVG4FXJK.js +1 -0
- package/dist/preview/chunk.ZY7US4Y7.js +6 -0
- package/dist/preview/{chunk.GQNSNJTJ.js → chunk.ZZAI57VI.js} +1 -1
- package/dist/preview/index.html +54 -51
- package/dist/preview/page.js +2 -2
- package/dist/preview/splash.js +58 -0
- package/package.json +6 -6
- package/dist/preview/chunk.2AWVQ5SW.js +0 -1
- package/dist/preview/chunk.2WZAFKJ2.js +0 -2
- package/dist/preview/chunk.3ICWPRRJ.js +0 -1
- package/dist/preview/chunk.3RW677X6.js +0 -1
- package/dist/preview/chunk.4G32374Q.js +0 -1
- package/dist/preview/chunk.4OEWFPH3.js +0 -1
- package/dist/preview/chunk.4STDIZVI.js +0 -2
- package/dist/preview/chunk.5S7IGASX.js +0 -28
- package/dist/preview/chunk.5T53SF2K.js +0 -1
- package/dist/preview/chunk.5X22RKB3.js +0 -1
- package/dist/preview/chunk.644FUGSX.js +0 -1
- package/dist/preview/chunk.7CETF4A6.js +0 -1
- package/dist/preview/chunk.AVFOTYZR.js +0 -74
- package/dist/preview/chunk.BFDJTWGX.js +0 -88
- package/dist/preview/chunk.BJI2C3IZ.js +0 -1
- package/dist/preview/chunk.D4TA5XDC.js +0 -4
- package/dist/preview/chunk.DKXVEVDG.js +0 -1
- package/dist/preview/chunk.DP5DUV6F.js +0 -6
- package/dist/preview/chunk.DXWTM4SH.js +0 -1
- package/dist/preview/chunk.F7IQ4B6A.js +0 -1
- package/dist/preview/chunk.F7PIW2EM.js +0 -5
- package/dist/preview/chunk.G4VMRYS4.js +0 -1
- package/dist/preview/chunk.GPWYWALF.js +0 -1
- package/dist/preview/chunk.HGVBGSRS.js +0 -6
- package/dist/preview/chunk.HZHNM2KI.js +0 -3
- package/dist/preview/chunk.ISXNAFRC.js +0 -20
- package/dist/preview/chunk.JU3BCCQM.js +0 -1
- package/dist/preview/chunk.K2AC536Q.js +0 -21
- package/dist/preview/chunk.K3UOXAZS.js +0 -1
- package/dist/preview/chunk.KNYLY7MH.js +0 -1
- package/dist/preview/chunk.LQAT7FA6.js +0 -3
- package/dist/preview/chunk.LTI5PKTS.js +0 -1
- package/dist/preview/chunk.MBP7VDYM.js +0 -1
- package/dist/preview/chunk.MBU7UH6J.js +0 -1
- package/dist/preview/chunk.MH6CCHEX.js +0 -1
- package/dist/preview/chunk.MNRTA2CB.js +0 -1
- package/dist/preview/chunk.MYVED5LU.js +0 -1
- package/dist/preview/chunk.N5WDQAIM.js +0 -5
- package/dist/preview/chunk.N7T7VB77.js +0 -25
- package/dist/preview/chunk.ODVRO2BJ.js +0 -1
- package/dist/preview/chunk.OVPFROL3.js +0 -1
- package/dist/preview/chunk.PGA5TUSN.js +0 -1
- package/dist/preview/chunk.PHC2MI4C.js +0 -1
- package/dist/preview/chunk.PXQVXBNG.js +0 -1
- package/dist/preview/chunk.Q5I5M3FR.js +0 -1
- package/dist/preview/chunk.QATUGE34.js +0 -1
- package/dist/preview/chunk.QL77K3D4.js +0 -1
- package/dist/preview/chunk.QUJS63OJ.js +0 -13
- package/dist/preview/chunk.REH6RXNH.js +0 -1
- package/dist/preview/chunk.RZ5PPQBV.js +0 -1
- package/dist/preview/chunk.SCGF4ZPP.js +0 -1
- package/dist/preview/chunk.SLAZFFCQ.js +0 -1
- package/dist/preview/chunk.SLPJWOKC.js +0 -1
- package/dist/preview/chunk.TKLYUVMR.js +0 -32
- package/dist/preview/chunk.TKUNRFDE.js +0 -1
- package/dist/preview/chunk.TMAZNDA6.js +0 -1
- package/dist/preview/chunk.UDCDK7XJ.js +0 -4
- package/dist/preview/chunk.UO544PZH.js +0 -1
- package/dist/preview/chunk.VKHAAH32.js +0 -1
- package/dist/preview/chunk.VOOOIECX.js +0 -1
- package/dist/preview/chunk.VS6NT5C4.js +0 -1
- package/dist/preview/chunk.VUAOCYG2.js +0 -1
- package/dist/preview/chunk.VX65S2FA.js +0 -1
- package/dist/preview/chunk.X2I3XH2E.js +0 -2
- package/dist/preview/chunk.XWWSW3ZV.js +0 -7
- package/dist/preview/chunk.Y7H5O2SL.js +0 -1
- package/dist/preview/chunk.YOT7ESDG.js +0 -18
- package/dist/preview/chunk.ZQHCNFJK.js +0 -1
- package/dist/preview/chunk.ZYNUMVEC.js +0 -1
package/dist/preview/page.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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 co}from"./chunk.SIYBHZDD.js";import{a as qt,b as hr,c as yr,d as gr,e as zt,f as wr,g as vr,h as br,i as Sr,j as Ar,k as kr,l as Pr,m as Er,n as Ze}from"./chunk.QATUGE34.js";import{b as mr}from"./chunk.3RW677X6.js";import{a as It,b as dr,c as lr,d as ur,e as fr,f as _t,g as pr,h as jt}from"./chunk.3HFUO3DC.js";import{a as Ot,g as Dn}from"./chunk.DXWTM4SH.js";import{k as dt}from"./chunk.LQAT7FA6.js";import{E as ir,I as sr,J as cr,h as tr,k as Nt,l as nr,n as rr,r as or,w as Wt,z as ar}from"./chunk.AVFOTYZR.js";import{c as so}from"./chunk.HOQMD6WQ.js";import{Aa as Jn,Ca as Yn,Da as Qn,Fa as Zn,G as Dt,Ga as $t,Ka as Xn,La as er,Oa as ft,T as Wn,Z as In,a as $n,b as lt,c as ut,ga as _n,ha as jn,j as Nn,m as Bt,va as qn,wa as zn,xa as Gn,ya as Un,za as Kn}from"./chunk.N7T7VB77.js";import{a as Te}from"./chunk.SDO3U72B.js";import{$d as Mt,Eb as Rn,Gb as Tn,Td as Re,Ud as Hn,Vd as Vn,_d as Lt,ae as Ht,de as Bn,ee as Vt,fb as je,ld as Fn,md as On,nc as Ct,oc as xn,qb as st,rd as Cn,td as Ln,ud as Mn,vb as En,wd as ct}from"./chunk.F7PIW2EM.js";import"./chunk.FQLNBIQ5.js";import{b as He}from"./chunk.AJZBJBMO.js";function Gt(e){if(Array.isArray(e))return e.map(Gt);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=Gt(i))}return n}return e}function Ut(e){return JSON.stringify(Gt(e))??"undefined"}async function pt(e,n={}){let o=e.compiled===void 0||!uo(e.compiled,e.document)?void 0:Dn(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await lo();return i(e.document,n)}var Rr,lo=()=>Rr??=(__graviewPreload(import.meta.url,["./chunk.DXWTM4SH.js","./chunk.BI6DS3PZ.js","./chunk.7R727IKU.js","./chunk.LQAT7FA6.js","./chunk.F7PIW2EM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TMAZNDA6.js")).catch(e=>{throw Rr=void 0,e});function uo(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,i=n;if(typeof i=="string")try{i=JSON.parse(i)}catch{return!1}return o!==void 0&&Ut(Ot(o).document)===Ut(Ot(i).document)}var d=He(Dt(),1);var ht=He(Dt(),1),Kt="data-graview-drawn",fo=200,Tr=50,po=1e4,mt=()=>typeof performance<"u"?performance.now():Date.now();function mo(e){let n=[...e.querySelectorAll("img")];for(let o of e.querySelectorAll("[data-worker-view]"))o.shadowRoot&&n.push(...o.shadowRoot.querySelectorAll("img"));return n}function ho(e,n){if(e.ownerDocument.fonts?.status==="loading"||zn()>0||Jn(n)>0||e.querySelector('[aria-busy="true"]')||mo(e).some(i=>!i.complete&&i.loading!=="lazy"))return!1;for(let i of e.querySelectorAll("[data-worker-view-place]"))if(!i.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function xr(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(i=>`${i.offsetWidth}x${i.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function yo(e,n,o,i){e.removeAttribute(Kt);let l=e.ownerDocument.defaultView;if(!l)return()=>{};let u=mt(),c=u,w=xr(e),m=!1,k,F=typeof MutationObserver>"u"?void 0:new MutationObserver(x=>{x.some(O=>!(O.target===e&&O.attributeName===Kt))&&(c=mt())});F?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let N=()=>{m=!0,F?.disconnect(),k!==void 0&&clearTimeout(k)},b=x=>{let O=!1,ne=()=>{O||(O=!0,x())};typeof l.requestAnimationFrame=="function"&&l.requestAnimationFrame(()=>setTimeout(ne,0)),setTimeout(ne,100)},T=()=>{if(m)return;let x=xr(e);x!==w&&(w=x,c=mt());let O=mt();if(ho(e,i)&&O-c>=fo||O-u>=po){b(()=>{m||(N(),e.setAttribute(Kt,n),Qn(),o())});return}k=setTimeout(T,Tr)};return k=setTimeout(T,Tr),N}function Fr(e,n,o,i,l){Yn();let u=(0,ht.useRef)({place:o,onDrawn:i});u.current={place:o,onDrawn:i},(0,ht.useLayoutEffect)(()=>{l&&Kn(l);let c=k=>yo(k,u.current.place.path,()=>u.current.onDrawn?.(u.current.place),l);if(e.current)return c(e.current);let w,m=!1;return queueMicrotask(()=>{!m&&e.current&&(w=c(e.current))}),()=>{m=!0,w?.()}},[n,e,l])}var ve=He(Dt(),1),Xe,go=Te(()=>(__graviewPreload(import.meta.url,["./chunk.5IEFTFKQ.js","./chunk.VKHAAH32.js","./chunk.MK72IRIY.js","./chunk.DHJI7LIW.js","./chunk.QL77K3D4.js","./chunk.N7T7VB77.js","./chunk.SDO3U72B.js","./chunk.F7PIW2EM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.F7IQ4B6A.js"))),Or=()=>go().then(e=>void(Xe=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Or)),Jt=qn(Or),Cr=e=>!!e&&Xe===void 0;function Yt({onReady:e,fetch:n}){return(0,ve.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var wo=0;function Lr(e){let[n,o]=(0,ve.useState)(()=>Xe);(0,ve.useEffect)(()=>{if(!e||n)return;let u=!1;return Jt().then(()=>{u||o(Xe)}),()=>{u=!0}},[e,n]);let i=(0,ve.useMemo)(()=>wo+=1,[e]);return{over:(0,ve.useMemo)(()=>{let u=n??Xe;if(!e||!u)return;let{source:c,worker:w,...m}=e,k={...m,worker:w??{source:c},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:F=>u.registerWorkerView(F,k)}},[e,n]),n:i}}var Vr=He(co(),1),$=He(so(),1);var g=He(Wn(),1);function yt(e,n={}){let o=$t(e);return{Face:o.part((l,u)=>(0,d.createElement)(l,u),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Xt=e=>Promise.all([e,sr()]).then(([n])=>n),Br=Te(()=>(__graviewPreload(import.meta.url,["./chunk.ZQHCNFJK.js","./chunk.KRFRREEW.js","./chunk.D4TA5XDC.js","./chunk.GIW657OR.js","./chunk.SBLYBRDU.js","./chunk.5X22RKB3.js","./chunk.XZUHFXME.js","./chunk.HJCQ6I3S.js","./chunk.SAYAFOF6.js","./chunk.R3N73BJO.js","./chunk.MU3XII7I.js","./chunk.SJALH7IX.js","./chunk.6DOOLVT4.js","./chunk.VX65S2FA.js","./chunk.747OH3EE.js","./chunk.E6RNMWFN.js","./chunk.VN7I7XIO.js","./chunk.MBP7VDYM.js","./chunk.WD4VPMEE.js","./chunk.VUAOCYG2.js","./chunk.5POG3G2C.js","./chunk.2XSIJH5J.js","./chunk.U5P23GO7.js","./chunk.QATUGE34.js","./chunk.3RW677X6.js","./chunk.ISRQQVS4.js","./chunk.GZHZLJBF.js","./chunk.Y7H5O2SL.js","./chunk.OJGHDWI6.js","./chunk.6HZY5NRX.js","./chunk.UO544PZH.js","./chunk.4STDIZVI.js","./chunk.HZHNM2KI.js","./chunk.AVFOTYZR.js","./chunk.HOQMD6WQ.js","./chunk.N7T7VB77.js","./chunk.SDO3U72B.js","./chunk.F7PIW2EM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UACSX64H.js"))),vo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.YOT7ESDG.js","./chunk.66IKLMYX.js","./chunk.C634A6ZC.js","./chunk.N5WDQAIM.js","./chunk.ZQHCNFJK.js","./chunk.Q355UPFG.js","./chunk.PXQVXBNG.js","./chunk.7LZ6JDJA.js","./chunk.KRFRREEW.js","./chunk.VOOOIECX.js","./chunk.GIW657OR.js","./chunk.EVEHSENK.js","./chunk.SBLYBRDU.js","./chunk.2LNSENPV.js","./chunk.WS7LAT4Z.js","./chunk.5X22RKB3.js","./chunk.XZUHFXME.js","./chunk.GQNSNJTJ.js","./chunk.SJALH7IX.js","./chunk.E6RNMWFN.js","./chunk.IA5ZBMRD.js","./chunk.VN7I7XIO.js","./chunk.REH6RXNH.js","./chunk.MBP7VDYM.js","./chunk.BDTT4ENI.js","./chunk.BJUUSIQY.js","./chunk.5POG3G2C.js","./chunk.2XSIJH5J.js","./chunk.XOZU4OFA.js","./chunk.LA2DMHZC.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.MBU7UH6J.js","./chunk.2QFKNTAZ.js","./chunk.BI6DS3PZ.js","./chunk.PGA5TUSN.js","./chunk.7R727IKU.js","./chunk.LQAT7FA6.js","./chunk.GZHZLJBF.js","./chunk.Y7H5O2SL.js","./chunk.OJGHDWI6.js","./chunk.6HZY5NRX.js","./chunk.UO544PZH.js","./chunk.4STDIZVI.js","./chunk.HZHNM2KI.js","./chunk.AVFOTYZR.js","./chunk.HOQMD6WQ.js","./chunk.N7T7VB77.js","./chunk.SDO3U72B.js","./chunk.F7PIW2EM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Q5I5M3FR.js"))),bo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.YOT7ESDG.js","./chunk.66IKLMYX.js","./chunk.C634A6ZC.js","./chunk.N5WDQAIM.js","./chunk.ZQHCNFJK.js","./chunk.Q355UPFG.js","./chunk.PXQVXBNG.js","./chunk.7LZ6JDJA.js","./chunk.KRFRREEW.js","./chunk.VOOOIECX.js","./chunk.GIW657OR.js","./chunk.EVEHSENK.js","./chunk.SBLYBRDU.js","./chunk.2LNSENPV.js","./chunk.WS7LAT4Z.js","./chunk.5X22RKB3.js","./chunk.XZUHFXME.js","./chunk.GQNSNJTJ.js","./chunk.SJALH7IX.js","./chunk.E6RNMWFN.js","./chunk.IA5ZBMRD.js","./chunk.VN7I7XIO.js","./chunk.REH6RXNH.js","./chunk.MBP7VDYM.js","./chunk.BDTT4ENI.js","./chunk.BJUUSIQY.js","./chunk.5POG3G2C.js","./chunk.2XSIJH5J.js","./chunk.XOZU4OFA.js","./chunk.LA2DMHZC.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.MBU7UH6J.js","./chunk.2QFKNTAZ.js","./chunk.BI6DS3PZ.js","./chunk.PGA5TUSN.js","./chunk.7R727IKU.js","./chunk.LQAT7FA6.js","./chunk.GZHZLJBF.js","./chunk.Y7H5O2SL.js","./chunk.OJGHDWI6.js","./chunk.6HZY5NRX.js","./chunk.UO544PZH.js","./chunk.4STDIZVI.js","./chunk.HZHNM2KI.js","./chunk.AVFOTYZR.js","./chunk.HOQMD6WQ.js","./chunk.N7T7VB77.js","./chunk.SDO3U72B.js","./chunk.F7PIW2EM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5T53SF2K.js"))),Dr=yt(()=>Xt(Br().then(e=>e.SceneFace)),{what:"This view"}),$r=yt(()=>Br().then(e=>e.SceneKeeping),{quiet:!0}),Nr=yt(()=>Xt(vo().then(e=>e.PagesContent)),{what:"This page"}),Wr=yt(()=>Xt(bo().then(e=>e.PictureFace)),{what:"This picture"}),So=Dr.Face,Ao=$r.Face,ko=Nr.Face,Po=Wr.Face;function Ve(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Ir));return Promise.all([...[...o].map(i=>i.fetch()),rr()]).then(()=>{},()=>{})}var Ir=e=>e==="pages"?[Nr]:e==="picture"?[Wr]:[Dr,$r],_r=e=>Ir(e).every(n=>n.here()),Eo=150,Qt=0;function Mr(e,n){if(_r(e))return n();let o=++Qt,i=()=>{o===Qt&&(Qt+=1,n())};Ve(e).then(i),setTimeout(i,Eo)}var Ro=768;function To(e,n){let o=n!==null&&n>=Ro;(0,d.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(_r(i))return;let l=globalThis,u=()=>void Ve(i),c=()=>{},w=Zn(()=>{if(l.requestIdleCallback&&l.cancelIdleCallback){let m=l.requestIdleCallback(u,{timeout:4e3});c=()=>l.cancelIdleCallback?.(m)}else{let m=setTimeout(u,1500);c=()=>clearTimeout(m)}});return()=>(w(),c())},[e,o])}function xo({asked:e,shown:n,onDrawn:o}){return(0,d.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function Fo({auto:e,scene:n}){return(0,g.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${zt}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Oo=$t(Te(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,g.jsx)(e.StudioPlace,{...n}),{quiet:!0});function jr(e,n,o,i,l){return _t(e,fr(n?ut(n):l??$n,i),o)}function en(e){return e&&ut(e).overview?"graview":"scene"}function Hr(e,n){if(n.homeView?.()===void 0)return!1;let o=e.pages?.first?.trim();return o===void 0||o===""||o==="/"||o.toLowerCase()==="home"}function qr(e){let[,n]=(0,d.useState)(!1),o=(0,d.useCallback)(()=>n(!0),[]),i=(0,d.useRef)(!1);return e.at&&!gt?(0,g.jsx)(Yt,{onReady:o,fetch:tn}):!i.current&&Cr(e.draftView)?(0,g.jsx)(Yt,{onReady:o,fetch:Jt}):(i.current=!0,(0,g.jsx)(Co,{...e}))}function Co(e){let{app:n,stop:o,bar:i=!0,standing:l="Everything is in order",principal:u,heading:c=2}=e,{rootRef:w,scope:m,css:k,scheme:F,store:N,presence:b,brand:T,auto:x,height:O}=wr(e),ne=Lr(e.draftView),R=yr(e,cr,ne.over),[ce]=(0,d.useState)(Un),p=e.basePath===void 0?{}:{basePath:e.basePath},[B]=(0,d.useState)(Nt),W=e.notices??B,U=v=>Lt(v,p),oe={...e.routing?{routing:e.routing}:{},...p},[ae]=(0,d.useState)(()=>{let v=e.at?.face;if(v)return v;let X=o===void 0&&Hr(n,R)?"pages":en(o),D=It({...oe,face:X});return e.face===void 0&&e.onOpening?.(D),D}),[Se,H]=(0,d.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&dr(oe)&&Hr(n,R)),Ae=(0,d.useRef)(e.onFace);Ae.current=e.onFace,(0,d.useLayoutEffect)(()=>{Se&&(Ae.current?.("pages"),H(!1))},[Se]);let P=Se?"pages":e.face??ae,A=n.schema.kinds,V=e.routing==="address",ke=(0,d.useMemo)(()=>e.at?gt.settleAt(e,N.seenBy(u??{kind:"human"}),R.places()):void 0,[]),L=(0,d.useMemo)(()=>jn(R,n.schema),[R,n.schema]),me=(0,d.useMemo)(()=>{let v=ke?.stop??(V?lr(e.basePath):void 0)??o;return P==="scene"&&v===void 0&&L===void 0&&(e.path===void 0||Zt(e.path))?jt(void 0):jr(P,v,A,R.places(),L)},[]),[I]=(0,d.useState)(P);(0,d.useEffect)(()=>{I!=="pages"&&_n(R)},[I,R]);let M=(0,d.useRef)(void 0),z=v=>v===void 0||Zt(v)?"/":v;M.current??={path:z(ke?.path??(V?P==="pages"?(Mt(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==M.current.asked&&(M.current={path:z(e.path),asked:e.path});let Y=(0,d.useRef)(e.onNavigate);Y.current=e.onNavigate;let Fe=(0,d.useCallback)((v,X)=>{M.current.path=v,Y.current?.(v,X)},[]),{at:Pe,setAt:j,steering:K,steer:re}=kr(M.current.path),C=(0,d.useContext)(zr);C&&(C.pages=()=>M.current.path);let Oe=(0,d.useRef)(void 0),Q=(0,d.useCallback)(v=>void(M.current.path=v),[]),J=tr(w),[_,he]=(0,d.useState)(!1),de=e.pagesBelow!==void 0&&J!==null&&J<e.pagesBelow&&(P==="scene"||P==="graview")&&!_,E=de?"pages":P,Z=(0,d.useRef)(!1);Z.current=_&&e.pagesBelow!==void 0&&J!==null&&J<e.pagesBelow&&(P==="scene"||P==="graview"),C&&(C.shown=E);let Be=(0,d.useRef)(P==="graview"?"graview":"scene");(E==="scene"||E==="graview")&&(Be.current=E),(0,d.useState)(()=>{if(!V||typeof window>"u"||E==="pages"||E==="picture")return;let{pathname:v,search:X,hash:D}=window.location;Mt(v,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${U(Re)}${X}${D}`)}),gr(w,E,e.onIntrinsicHeight),To(E,J);let le=Pr(e.onError,E),Ce=Er(e.onReady,E),Ue=(0,d.useRef)(e.onFaceDrawn);Ue.current=e.onFaceDrawn;let ye=(0,d.useCallback)((v,X)=>{Ce(X),Ue.current?.(v)},[Ce]),[De,Le]=(0,d.useState)(null),Ke=R.places(),ge=(0,d.useRef)({shown:E,onFace:e.onFace});ge.current={shown:E,onFace:e.onFace};let $e=(0,d.useCallback)((v,X,D)=>{if(V){Oe.current?.(v,X,D);return}ge.current.onFace?.(v),Y.current?.(v==="pages"?X??M.current.path:Re,"push")},[V]),[At,Je]=(0,d.useState)(void 0);(0,d.useEffect)(()=>{E==="pages"&&Je(void 0)},[E]);let G=(0,d.useRef)(o);(0,d.useEffect)(()=>{G.current!==o&&(G.current=o,Je(void 0))},[o]);let ue=(0,d.useCallback)(v=>{if(ge.current.shown==="pages"){if(he(!0),Je(v),P==="scene"||P==="graview"){Mr(P,()=>{V?window.history.pushState(null,"",`${U(Re)}${v??""}`):Y.current?.(Re,"push")});return}Mr(Be.current,()=>$e(Be.current,void 0,v))}},[V,P,e.basePath,$e]),q=(0,d.useCallback)(v=>{if(ge.current.shown==="pages"){K.go.current||(M.current.path=v),re(v);return}if(M.current.path=v,j(v),Z.current){he(!1),V?window.history.pushState(null,"",U(v)):Y.current?.(v,"push");return}$e("pages",v)},[K,re,j,$e,V,e.basePath]),Ne=R.arrangement?.(),ie=E==="pages",We=e.hrefOf,Me=We??(V?U:void 0),Ie=(0,d.useMemo)(()=>({open:q,...We?{href:We}:V?{href:v=>Lt(v,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[q,V,e.basePath,We]);return(0,g.jsxs)("section",{ref:w,className:m,"aria-label":e.label??n.name,"data-graview-embed":E,"data-graview-scheme":F,...de?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:O,minHeight:x?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,g.jsx)("style",{children:k}),(0,g.jsxs)(er.Provider,{value:le,children:[(0,g.jsx)(vr,{rootRef:w,board:W}),(0,g.jsx)(hr,{rootRef:w,firstLook:e.firstLook,app:ar(T??{name:n.name},n.schema)}),(0,g.jsx)(Ze,{module:"@graview/react",report:le,content:!0,children:(0,g.jsx)(Gn.Provider,{value:ce,children:(0,g.jsx)(In,{store:N,views:R,initialView:me,scheme:F,...br(e,b,T),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,g.jsxs)(nr.Provider,{value:W,children:[(0,g.jsx)(Vo,{face:E,stop:At??o,kinds:A,places:Ke,opens:L}),C?(0,g.jsx)(Lo,{into:C}):null,(0,g.jsx)(Mo,{rootRef:w,face:P,shown:E,path:Pe,stop:o,draft:ne.n,onDrawn:e.onDrawn,parts:ce}),V?(0,g.jsx)(ur,{pagesWere:ke?.path,basePath:e.basePath,shown:E,onFace:e.onFace,toggle:Oe,kinds:A,places:Ke,opens:L,landed:Q}):null,i&&E!=="picture"?(0,g.jsx)(Ze,{module:"@graview/embed",report:le,children:(0,g.jsx)(Sr,{name:T?.name??n.name,heading:c,named:qt(i).name!==!1,faces:qt(i).faces===!1?void 0:{scene:{label:Hn(Ne),current:!ie,go:()=>ue(),reach:()=>void Ve(Be.current)},pages:{label:Vn(Ne),current:ie,go:()=>q(M.current.path),reach:()=>void Ve("pages")}},at:ie?Pe:null,without:e.pages?.without(),home:{...Me?.("/")!==void 0?{href:Me("/")}:{},go:()=>q("/"),current:ie&&Pe.split("?")[0]==="/"},reach:{...Me?{href:Me}:{},go:v=>q(v.path)},standing:l,hostActions:e.hostActions,barActions:e.barActions,keeping:ie?void 0:(0,g.jsx)(Bo,{app:n,studio:e.studio,report:le}),onFind:Le,switch:e.switch})}):null,(0,g.jsx)(or.Provider,{value:De,children:(0,g.jsx)(Ze,{module:E==="pages"||E==="picture"?"@graview/pages":"@graview/react",report:le,content:!0,children:(0,g.jsxs)(d.Suspense,{fallback:(0,g.jsx)(Fo,{auto:x,scene:E!=="pages"&&E!=="picture"}),children:[E==="picture"?(0,g.jsx)(Po,{scope:m,store:N,views:R,as:(o?ut(o).within?.view:void 0)??""}):E==="pages"?(0,g.jsx)(ko,{store:N,views:R,presence:b,auto:x,brand:T,steering:K,overview:ue,scope:m,titleLevel:Ar(c),quickAsk:Wt(e.quickAsk),props:{...e,onNavigate:Fe,...V?{}:{path:M.current.path}}}):(0,g.jsx)(Xn.Provider,{value:Ie,children:(0,g.jsx)(So,{address:V,auto:x,scheme:F,scope:m,quickAsk:Wt(e.quickAsk)})}),(0,g.jsx)(xo,{asked:P,shown:E,onDrawn:ye})]})},E)})]})})})})]})]})}var Zt=e=>e.split(/[?#]/)[0]===Re,zr=(0,d.createContext)(null);function Lo({into:e}){return e.view=ft().view,null}function Mo({rootRef:e,face:n,shown:o,path:i,stop:l,draft:u,onDrawn:c,parts:w}){let{view:m}=ft(),k=o==="scene"||o==="graview",F=lt(m),{pan:N,...b}=m,T=m.pan?lt(b):F,x={face:n,path:k?Re:o==="picture"?l??"#":i,stop:F};return Fr(e,`${o} ${k?T:x.path} ${u}`,x,c,w),null}var gt,Ho=Te(()=>(__graviewPreload(import.meta.url,["./chunk.3HFUO3DC.js","./chunk.AVFOTYZR.js","./chunk.HOQMD6WQ.js","./chunk.N7T7VB77.js","./chunk.SDO3U72B.js","./chunk.F7PIW2EM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.WICFQROI.js"))),tn=()=>Ho().then(e=>void(gt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(tn));function Vo({face:e,stop:n,kinds:o,places:i,opens:l}){let{view:u,go:c}=ft(),w=(0,d.useRef)({face:e,stop:n});return(0,d.useLayoutEffect)(()=>{let m=w.current.stop!==n,k=w.current.face!==e,F=w.current.face==="pages";if(w.current={face:e,stop:n},!m&&!k||e==="pages"||e==="picture")return;let N=(m||F)&&n!==void 0?jr(e,n,o,i):F&&pr(u)?_t(e,jt(l),o):e==="graview"?Bt(u,!0):u.overview?Nn(Bt(u,!1),ir(u,o)):u;c(N)},[e,n,o,u,c,l]),null}function Bo({app:e,studio:n,report:o}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(Ao,{})}),n!==!1?(0,g.jsx)(Ze,{module:"@graview/studio",report:o,children:(0,g.jsx)(Do,{app:e,studio:n})}):null]})}function Do({app:e,studio:n}){let o={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},i=n?.place;return i?(0,g.jsx)(i,{...o}):(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(Oo,{...o})})}function $o({path:e,stop:n,...o},i){return{...o,app:i.app,at:i.at,remote:i.remote,...i.remote.presence?{presence:i.remote.presence}:{}}}function nn(e,n){let o=n.store??n.remote?.store??mr(n.app,n.seed),i=n.notices??Nt(),l=null,u={},c=0,w=n.label,m=n.app,k=Promise.resolve(),F=n.at?.face??n.face,N=F===void 0?void 0:It({...n,face:F}),b=N??en(n.stop),T=null,x=[],O=p=>{if(T=p,p!==b)return;let B=x;x=[];for(let W of B)W()};function ne(){let[p,B]=(0,d.useState)(N),[W,U]=(0,d.useState)(n.stop),[oe,ae]=(0,d.useState)(n.path),[Se,H]=(0,d.useState)(n.scheme??"auto"),[Ae,P]=(0,d.useState)(n.principal),[A,V]=(0,d.useState)(n.seats),[ke,L]=(0,d.useState)(n.quickAsk),[me,I]=(0,d.useState)(n.people),[M,z]=(0,d.useState)(n.hostContext),[Y,Fe]=(0,d.useState)(n.brand),[Pe,j]=(0,d.useState)(n.whileAway),[K,re]=(0,d.useState)(n.label),[C,Oe]=(0,d.useState)(n.hostActions),[Q,J]=(0,d.useState)(n.barActions),[_,he]=(0,d.useState)(void 0),[de,E]=(0,d.useState)(n.draftView);return l={app:Z=>{he(Z),ae(void 0),U(void 0)},face:B,stop:U,path:ae,scheme:H,seat:P,seats:V,quickAsk:L,people:I,hostContext:z,brand:Fe,whileAway:j,label:re,hostActions:Oe,barActions:J,draft:E},(0,g.jsx)(zr.Provider,{value:u,children:(0,g.jsx)(qr,{..._?$o(n,_):n,store:o,notices:i,...p!==void 0?{face:p}:{},onOpening:Z=>{b=Z},...W!==void 0?{stop:W}:{},...oe!==void 0?{path:oe}:{},...Ae?{principal:Ae}:{},...A?{seats:A}:{},...ke!==void 0?{quickAsk:ke}:{},...me?{people:me}:{},...M?{hostContext:M}:{},...Y?{brand:Y}:{},whileAway:Pe,label:K,hostActions:C,barActions:Q,draftView:de,scheme:Se,onFace:Z=>{b=Z,B(Z)},onSeat:P,onFaceDrawn:O},_?.n??0)})}let R=()=>{let p=u.view?.focusId,B=p?o.graph.getNode(p)?.kind:void 0,W=(u.shown??b)==="scene"||(u.shown??b)==="graview";return{face:b,path:W?Re:u.pages?.()??n.path??"/",stop:u.view?lt(u.view):n.stop??"#",...B?{kind:B}:{}}},ce=(0,Vr.createRoot)(e);return(0,$.flushSync)(()=>ce.render((0,g.jsx)(ne,{}))),{get store(){return o},where:R,setApp:(p,B,W)=>{let U="graph"in B?{store:B}:B,oe=()=>{let ae=R();o=U.store,w=W?.label??(w===m.name?p.name:w),m=p,(0,$.flushSync)(()=>{l?.label(w),l?.app({app:p,remote:U,at:ae,n:++c})})};gt?oe():k=k.then(tn).then(oe)},setFace:p=>{b=p,(0,$.flushSync)(()=>l?.face(p))},setStop:p=>(0,$.flushSync)(()=>l?.stop(p)),setPath:p=>(0,$.flushSync)(()=>{if(Zt(p)){(b==="pages"||b==="picture")&&(b="scene",l?.face("scene"));return}l?.path(p),b!=="pages"&&(b="pages",l?.face("pages"))}),setScheme:p=>(0,$.flushSync)(()=>l?.scheme(p)),setSeat:p=>(0,$.flushSync)(()=>l?.seat(p)),setSeats:p=>(0,$.flushSync)(()=>l?.seats(p)),setQuickAsk:p=>(0,$.flushSync)(()=>l?.quickAsk(p)),setPeople:p=>(0,$.flushSync)(()=>l?.people(p)),setHostContext:p=>(0,$.flushSync)(()=>l?.hostContext(p)),setBrand:p=>(0,$.flushSync)(()=>l?.brand(p)),setWhileAway:p=>(0,$.flushSync)(()=>l?.whileAway(p)),setDraftView:p=>(0,$.flushSync)(()=>l?.draft(p)),setLabel:p=>{w=p,(0,$.flushSync)(()=>l?.label(p))},setHostActions:p=>(0,$.flushSync)(()=>l?.hostActions(p)),setBarActions:p=>(0,$.flushSync)(()=>l?.barActions(p)),drawn:()=>k.then(()=>T===b?void 0:new Promise(p=>x.push(p))),notify:p=>{let B;return(0,$.flushSync)(()=>{B=i.notify(p)}),B},unmount:()=>ce.unmount()}}var wt=e=>`s${(e+1).toString(36)}`;var be={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"},qe={header:"x-graview-key",param:"graview_key",cookie:"graview_key"};function vt(e,n={}){try{let o=new URL(e),i=o.searchParams.get(qe.param);if(i)return o.searchParams.delete(qe.param),{url:o.origin+o.pathname.replace(/\/$/,"")+o.search,key:i,headers:{[qe.header]:i,...n}}}catch{}return{url:e.replace(/\/$/,""),headers:n}}var Gr="/graview/friction";var Ur="/graview/live",rn="graview.ship",on=`${rn}.${st}`;var ze=class extends Error{constructor(n){super(n),this.name="Superseded"}},xe=e=>e?.lineage?{lineage:e.lineage}:{},No=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
|
|
2
|
-
`)[0]??"":String(n)})`;function Wo(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let o=JSON.parse(n);return Array.isArray(o)?o.filter(i=>!!i&&Array.isArray(i.calls)):[]}catch{return[]}}var Ge=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Io={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},pe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},et=class extends Error{constructor(n){super(n),this.name="Unreached"}},_o=new Set([502,503,504]);async function jo(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function qo(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var zo=1,Go=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function bt(e){return(await Kr(e,Wo(e.carry),"This app was updated while your changes were on the way.",Go())).remote}async function Kr(e,n,o,i){let{key:l,...u}=vt(e.url,e.headers),c={...e,...u},w=c.fetch??fetch,m={"content-type":"application/json",...c.headers??{}},k={...St(c.principal),[be.via]:c.via??"web"};Object.assign(m,k);let F=c.live===!0,N=c.presenceEveryMs,b=c.visible??Jo,T="connecting",x=i.statuses,O=i.tally,ne=[],R,ce=[],p=()=>T==="online"&&R!==void 0?"held":T,B=()=>{let t=p();if(i.told!==t){i.told=t;for(let r of[...x])r(t)}},W=t=>{if(!(t===T||se)&&(T==="offline"&&t==="online"&&O.reconnects++,T=t,B(),t==="online"))for(let r of ne.splice(0))r.again()},U=t=>{if(se)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==R;if(R=r,oe(),!!s&&(B(),r===void 0)){for(let a of ce.splice(0))a();ee&&clearTimeout(ee),un()}},oe=()=>{if(i.toldHeld!==R){i.toldHeld=R;for(let t of[...i.helds])t(R??null)}},ae=async(t,r)=>{let s;try{s=await w(t,r)}catch(a){throw D()||W("offline"),new et(a instanceof Error?a.message:String(a))}if(s.status===503&&await jo(s))return W("online"),s;if(_o.has(s.status))throw D()||W("offline"),new et(`The server is away (${s.status})`);return W("online"),s},Se=async(t=!1)=>{let r=`${c.url}/graview/state?opFormat=${je.op}`,s=t?await w(r,{headers:m}):await ae(r,{headers:m});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},H=c.state??await Se(!0);F||(T="online"),R=typeof H.held=="string"&&H.held.length>0?H.held:void 0,oe();let Ae=H.enabledModules??c.enabledModules,P=c.localApp?c.localApp(c.app):c.app,A=new Mn({schema:P.schema,mutations:P.mutations??[],invariants:P.invariants??[],...P.policy?{policy:P.policy}:{},...P.publishing?{publishing:P.publishing}:{},...P.modules?{modules:P.modules}:{},...Ae?{enabledModules:Ae}:{},...P.intelligence?{intelligence:P.intelligence}:{},...P.brand?.timeZone?{timeZone:P.brand.timeZone}:{},snapshot:H.snapshot,log:H.log,...H.horizon!==void 0?{horizon:H.horizon}:{},ids:qo(),...c.storeOptions??{}});Tn.served.add(A);let V=c.friction!==!1&&c.principal?.kind!=="visitor";V&&Fn(A,t=>{V&&w(`${c.url}${Gr}`,{method:"POST",headers:m,body:JSON.stringify({event:t})}).then(r=>void(V=r.status!==404&&r.status!==410),()=>{})});let ke=Cn(A),L=H.log.at(-1)?.seq??(H.horizon??0)-1,me=Ct.of(H.log,{horizon:H.horizon??0}),I=null,M,z=new Map,Y=i.who,Fe=!1,Pe=t=>{if(se)return;Fe=!0;let r=Bn(new Map,t,Date.now(),Ht,I?.participant);M!==void 0&&r.delete(M);let s=r.size!==z.size;if(!s)for(let[a,f]of r)Vt(f,z.get(a))||(s=!0);if(z=r,!!s)for(let a of[...Y])a([...z.values()])},j=[],K=new Set,re=t=>{let r=j.indexOf(t);r>=0&&j.splice(r,1)},C=new Map,Oe=(t,r)=>{let s=C.get(t);s&&(C.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},Q,J=[],_=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(Q)return J.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(h=>h.seq>L).map(h=>h.seq));if(Number.isFinite(s)&&s>L+1)return J.push({ops:t,drop:r}),he(),[];let a=j.filter(h=>t.some(te=>te.batch===h)),f=[...new Set([...r,...a])].filter(h=>K.has(h)),y,S=j.filter(h=>!a.includes(h));try{y=A.rebase({confirmed:t,pending:S,drop:f}).confirmed}catch(h){if(!(h instanceof Ln))throw h;return J.push({ops:t,drop:r}),he(),[]}for(let h of a)re(h);t.some(h=>h.seq>L)&&S.some(h=>!f.includes(h))&&O.rebases++,t.length>0&&(L=Math.max(L,...t.map(h=>h.seq)),me.note(t));for(let h of f)K.delete(h);for(let h of a)Oe(h,t);return y},he=()=>{Q||(Q=Le(Se().then(t=>{if(de(t)){J=[];return}let r=new Set(t.log.map(f=>f.batch)),s=j.filter(f=>r.has(f));for(let f of s)re(f);let a=A.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...j],drop:[...K].filter(f=>!j.includes(f))});K.clear();for(let f of a.pending)K.add(f.batch);L=t.log.at(-1)?.seq??(t.horizon??0)-1,me=Ct.of(t.log,{horizon:t.horizon??0}),O.resyncs++;for(let f of s)Oe(f,t.log)}).then(()=>{Q=void 0;let t=J;J=[];for(let{ops:r,drop:s}of t)_(r,s)},()=>{Q=void 0,J=[]})))},de=t=>(typeof t.build=="string"&&pn(t.build),typeof t.version=="number"&&U(t.held),typeof t.version!="number"||t.version===H.version?!1:(Et(t.version),!0)),E=async t=>{let s=await(await ae(`${c.url}/graview/since?seq=${wt(t)}&opFormat=${je.op}`,{headers:m})).json();return de(s)?[]:s.reset===!0?(he(),[]):s.ops??[]},Z=async()=>{let t=await Be();return Q&&await Q,t},Be=async()=>{if(I&&!D()&&b()){let r=await(await ae(`${c.url}/graview/here?opFormat=${je.op}`,{method:"POST",headers:m,body:JSON.stringify({presence:I,seq:wt(L)})})).json();return de(r)?[]:(typeof r.participant=="string"&&(M=r.participant),Pe(r.who??[]),_(r.ops??[]))}return _(await E(L))},le=new Map,Ce=new Map,Ue=new Set,ye=new Map,De=new Set,Le=t=>(De.add(t),t.finally(()=>De.delete(t)).catch(()=>{}),t),Ke=Promise.resolve(),ge=0,$e=(t,r)=>{let s=Ke.then(()=>Je(t,r));return Ke=s.catch(()=>{}),s},At=()=>new Promise((t,r)=>ne.push({again:t,give:r})),Je=async(t,r)=>{let s,a;for(;;){try{s=await ae(`${c.url}/graview/ops`,{method:"POST",headers:m,body:JSON.stringify({...t,opFormat:je.op})})}catch(h){if(!(h instanceof et)||q)throw h;if(await At(),D())return tt(t,r);continue}if(a=await s.json().catch(()=>({})),s.status===503&&a.reason==="unavailable"&&typeof a.held=="string"&&!q){if(typeof a.version=="number"?de(a):(U(a.held),!1))break;if(R!==void 0&&(Ft>0||F)){if(await new Promise(h=>ce.push(h)),q)throw new ze("The client closed.");if(D())return tt(t,r);continue}}let S;if(s.status===503&&a.reason==="unavailable"&&!q)S=an(c.backoff,ge++);else{if(ge=0,s.status!==429||q)break;S=Uo(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(h=>setTimeout(h,S)),D())return tt(t,r)}if(se||de(a))throw new ze("The app was changed.");if(!s.ok){let S=a.error??`The server refused (${s.status})`;throw a.conflict?new pe(S,a.conflicts??[]):new Ge({reason:a.reason??Io[s.status]??"invalid",sentence:S,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let f=a.ops??[],y=f[0]?.seq;return y!==void 0&&y>L+1&&(f=await E(L)),r!==void 0&&(a.batch&&le.set(r,a.batch),re(r)),_(f,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},G,ue=!1,q=!1,Ne=0,ie,We=0,Me=0,Ie=null,v=()=>{},X=new Promise(t=>{v=t}),D=()=>F&&ue&&G?.readyState===zo,Ye=t=>{if(!D())return!1;try{return G.send(JSON.stringify(t)),!0}catch{return!1}},ln=(t=!1)=>{!I||!D()||!b()||!t&&Ie&&Vt(I,Ie)&&(N===void 0||Date.now()-Me<N)||Ye({t:"here",presence:I})&&(Ie=I,Me=Date.now())},Ee=new Set,ee,un=()=>{if(ee=void 0,R!==void 0)return;let t=[...C.entries()].filter(([r])=>Ee.has(r));Ee.clear();for(let[,r]of t)Ye(r.message)},fn=(t,r)=>{C.has(t)&&(Ee.add(t),ee&&clearTimeout(ee),ee=setTimeout(un,Math.max(0,r)))},Qr=t=>{C.has(t)&&Ee.add(t)},tt=(t,r)=>new Promise((s,a)=>{let f=r??`send-${++We}`,y=t.undo?{t:"undo",cid:f,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...xe(t)}:{t:"call",cid:f,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...xe(t)};if(C.set(f,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),Ee.size>0||R!==void 0){Ee.add(f);return}Ye(y)}),nt=(t,r)=>D()?tt(t,r):$e(t,r),Zr=t=>{switch(t.t){case"welcome":{if(pn(t.build),typeof t.version=="number"&&t.version!==H.version){Et(t.version);return}if(ue=!0,Ne=0,typeof t.participant=="string"&&(M=t.participant),U(t.held),t.state?he():_(t.ops??[]),Ee.clear(),ee&&clearTimeout(ee),ee=void 0,R!==void 0)for(let r of C.keys())Ee.add(r);else for(let r of C.values())Ye(r.message);ln(!0),W("online"),v();return}case"ops":_(t.ops??[]);return;case"ack":{let r=C.get(t.cid);if(!r){_(t.ops??[]);return}C.delete(t.cid),ge=0,r.mine!==void 0&&(le.set(r.mine,t.batch),re(r.mine)),_(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=C.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){R!==void 0?Qr(t.cid):fn(t.cid,an(c.backoff,ge++));return}C.delete(t.cid),r.reject(t.t==="conflict"?new pe(t.sentence,t.conflicts??[]):new Ge({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&fn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":Pe(t.who??[]);return;case"held":U(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==H.version&&Et(t.version);return;case"reload":gn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&G){let r=G;vn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},se=!1,kt=i.declarations,Pt=i.builds,pn=t=>{if(!(se||i.otherBuild!==void 0||!c.build||typeof t!="string"||t.length===0||t===c.build)){i.otherBuild=t;for(let r of[...Pt])r(t)}},mn=()=>{let t=[],r=0;for(let s of j){let a=ye.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...xe(a),batch:s}):r++}return{carried:t,undos:r}},hn=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,yn=t=>{se=!0,I=null;let r=new ze(t);for(let a of C.values())a.reject(r);C.clear(),at&&clearInterval(at),q=!0,ie&&clearTimeout(ie),ee&&clearTimeout(ee),we&&clearTimeout(we);for(let a of ne.splice(0))a.give(r);for(let a of ce.splice(0))a();let s=G;G=void 0,ue=!1;try{s?.close(1e3,t)}catch{}v()};async function Et(t){if(se)return;if(!c.resolveApp){gn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=mn(),a=c.resolveApp,f=I;yn("The app was changed.");try{let y=await a(t),{state:S,...h}=c,te=await Kr({...h,app:y},r,"The app was changed while your changes were on the way.",i);f&&te.remote.presence.here(f);for(let it of[...kt])it(te.remote,t);let fe=[...s>0?[rt(hn(s,"The app was changed"))]:[],...te.unheard()];for(let it of fe)for(let io of _e)io(it.sentence,it)}catch(y){let S=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let h of _e)h(S,rt(S))}}function gn(t){if(se)return;let{carried:r,undos:s}=mn();yn(t);let a=!1;if(c.carry&&r.length>0)try{c.carry.storage.setItem(c.carry.key,JSON.stringify(r)),a=!0}catch{}let f=[];!a&&r.length>0&&f.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),s>0&&f.push(hn(s,"This app was updated"));for(let y of f)for(let S of _e)S(y,rt(y));(c.reloadPage??Ko)()}let wn=()=>{if(q||!F)return;let t=`${c.url.replace(/^http/,"ws").replace(/\/$/,"")}${Ur}`,{"content-type":r,...s}=m,a;try{a=c.socket?c.socket(t,s,[on]):ao(t,s)}catch{return bn()}G=a,ue=!1,a.onopen=()=>{G===a&&a.send(JSON.stringify({t:"hello",seq:wt(L),protocol:st,wire:rn,opFormat:je.op,...c.build?{build:c.build.slice(0,64)}:{},...c.hostProtocol!==void 0?{hostProtocol:c.hostProtocol}:{}}))},a.onmessage=f=>{if(G!==a)return;let y;try{y=JSON.parse(String(f.data))}catch{return}Zr(y)},a.onclose=()=>vn(a),a.onerror=()=>{}},we,Xr=()=>{Fe=!1,we&&clearTimeout(we),we=setTimeout(()=>{if(we=void 0,Fe||q)return;let t=new Map([...z].filter(([,r])=>r.held!=="socket"));if(t.size!==z.size){z=t;for(let r of Y)r([...z.values()])}},Ht),we.unref?.()};function vn(t){if(G!==t)return;let r=ue;G=void 0,ue=!1,Ie=null,r&&(W("offline"),Xr()),bn()}let bn=()=>{if(q)return;let t=an(c.backoff,Ne);Ne++,ie=setTimeout(wn,t)},Sn=A.applyAll.bind(A),eo=A.undo.bind(A),to=A.previewAll.bind(A);A.previewAll=(t,r)=>to(t,{...c.principal?{author:c.principal}:{},...r});let _e=i.refusals,Qe=[],rt=t=>({reason:"invalid",sentence:t}),ot=i.conflicts,Rt=!1,An,Tt=async(t,r)=>{if(r instanceof ze||se)return;let s=r instanceof Ge?r.refusal:Rn(r),a=s.sentence,f=r instanceof pe?An?.yoursOf(A,ye.get(t)?.calls??[]):void 0;re(t);try{_([],[t])}catch{}let y=ye.get(t);ye.delete(t);let S=y?.calls[0];if(S&&!(r instanceof pe)){let h=A.allMutations().find(fe=>fe.name===S.name)?.subject?.arg,te=h&&A.graph.getNode(S.args[h])?.kind;On(A,{type:"refused",act:S.name,code:s.reason,...te?{kind:te}:{}},c.principal)}if(r instanceof pe&&O.conflicts++,r instanceof pe&&!D()&&await Z().catch(()=>[]),r instanceof pe&&Q&&await Q,r instanceof pe&&ot.size>0){let h=!1,te={sentence:a,conflicts:f?r.conflicts.map(fe=>fe.node===f.node&&fe.field===f.field?{...fe,yours:f.yours}:fe):r.conflicts,keepTheirs(){h=!0},useMine(){if(!(h||!y)){h=!0,Rt=!0;try{A.applyAll(f?[f.over(L)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...xe(y)})}finally{Rt=!1}}}};for(let fe of ot)fe(te);return}for(let h of _e)h(a,s)},no=(t,r)=>t.flatMap(s=>s.mutation?.name===En?[]:s.primitives.flatMap(a=>a.op==="splice-text"&&!r.has(a.id)&&!r.has(`${a.id}\0${a.field}`)?[{node:a.id,field:a.field,rev:L}]:[]));A.applyAll=(t,r)=>{let s=xn(A.log.all().filter(S=>K.has(S.batch))),a=Sn(t,{...c.principal?{author:c.principal}:{},...r}),f=t.map((S,h)=>{let te=a.minted?.[h];return te===void 0||S.args?.id!==void 0?S:{...S,mintedHint:te}});j.push(a.batch),K.add(a.batch),ye.set(a.batch,{calls:f,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...xe(r)});let y=Rt?[]:[...me.baseFor(a.ops,s,(S,h)=>A.collaborative(S,h)),...no(a.ops,s)];return Ce.set(a.batch,Le(nt({calls:f,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...xe(r)},a.batch).catch(S=>Tt(a.batch,S)))),a},A.apply=(t,r)=>A.applyAll([t],r),A.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=eo(s.map(y=>le.get(y)??y),{...c.principal?{author:c.principal}:{},...r});j.push(a.batch),K.add(a.batch);let f=Promise.allSettled(s.map(y=>Ce.get(y)));return Ce.set(a.batch,Le(f.then(()=>{let y=s.filter(S=>!Ue.has(S));if(y.length===0){re(a.batch),ye.delete(a.batch),_([],[a.batch]);return}return nt({undo:y.map(S=>le.get(S)??S),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...xe(r)},a.batch)}).catch(y=>Tt(a.batch,y)))),a};let ro=async(t,r={})=>{xt++;try{return(await Le(nt({calls:t,...r}))).ops}finally{xt--}},xt=0,kn={here(t){I=t,ln()},onWho(t){return Y.add(t),z.size>0&&t([...z.values()]),()=>{Y.delete(t)}},leave(){if(!I)return;let t=JSON.stringify({participant:M??I.participant});if(I=null,Ye({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${c.url}/graview/leave${l!==void 0?`?${qe.param}=${encodeURIComponent(l)}`:""}`,t):w(`${c.url}/graview/leave`,{method:"POST",headers:m,body:t}).catch(()=>{})}},Ft=c.pollMs??800,at=Ft>0&&typeof setInterval=="function"?setInterval(()=>{D()||Z().catch(()=>{})},Ft):null;if(F){wn();let t;await Promise.race([X,new Promise(r=>t=setTimeout(r,c.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!se){let t=[],r=new Set(A.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{A.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...xe(s)})}catch(a){t.push(No(s,a))}t.length>0&&Qe.push(rt(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let Pn=new Map,oo=()=>({store:A,author:c.principal,appliedAll:Sn,pending:j,provisional:K,asked:ye,answers:Ce,letGo:Ue,sent:(t,r)=>Le(nt({calls:r,batch:t},t).catch(s=>Tt(t,s))),settle:re,land:_,seen:()=>L,gone:()=>q||se});return{remote:{store:A,typing(t,r){let s=`${t}\0${r}`,a=Pn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.6SO64TUI.js","./chunk.F7PIW2EM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZJCM62GH.js")).then(f=>(An=f,f.typingOf(t,r,f.wireOf(oo())))),Pn.set(s,a)),a},version:H.version,migrated:H.migrated??[],send:ro,pull:Z,onRefusal(t){_e.add(t);let r=Qe;Qe=[];for(let s of r)t(s.sentence,s);return()=>_e.delete(t)},onDeclaration(t){return kt.add(t),()=>kt.delete(t)},onBuild(t){return Pt.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>Pt.delete(t)},onConflict(t){return ot.add(t),()=>ot.delete(t)},revision:(t,r)=>me.of(t,r),seq:()=>L,participant:()=>M,transport:()=>D()?"socket":"poll",status:p,onStatus(t){return x.add(t),()=>x.delete(t)},held:()=>R,onHeld(t){return i.helds.add(t),R!==void 0&&t(R),()=>i.helds.delete(t)},counters:()=>({...O}),who:()=>[...z.values()],pending:()=>j.length+xt,async settled(){for(;De.size>0;)await Promise.allSettled([...De])},presence:kn,close(){at&&clearInterval(at),ke(),kn.leave(),q=!0,ie&&clearTimeout(ie),ee&&clearTimeout(ee),we&&clearTimeout(we);for(let r of ne.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of ce.splice(0))r();let t=G;G=void 0,ue=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Qe;return Qe=[],t}};function ao(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let a=typeof globalThis.document<"u",f=c.subprotocol?[on]:[];if(!a)try{return new s(t,{headers:r,...f.length>0?{protocols:f}:{}})}catch{}let y=new URL(t);for(let[S,h]of Object.entries(k))y.searchParams.set(S,h);return l!==void 0&&y.searchParams.set(qe.param,l),f.length>0?new s(y.toString(),f):new s(y.toString())}}function Uo(e,n,o=Date.now()){let i,l=e?.trim();if(l)if(/^\d+(\.\d+)?$/.test(l))i=Number(l)*1e3;else{let w=Date.parse(l);Number.isFinite(w)&&(i=Math.max(0,w-o))}let u=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,c=u!==void 0&&u<50&&i!==void 0&&Math.abs(u*1e3-i)<1e3;return u!==void 0&&!c?u:i??1e3}function Ko(){globalThis.location?.reload?.()}function Jo(){return globalThis.document?.visibilityState!=="hidden"}function an(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:l=2}=e??{};return Math.min(i,o*l**n)*(.75+Math.random()*.5)}function St(e){let n={};if(!e)return n;e.id&&(n[be.seat]=e.id),e.roles?.length&&(n[be.roles]=e.roles.join(",")),e.kind!=="human"&&(n[be.kind]=e.kind),e.name&&(n[be.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[be.for]=o.id),o?.roles?.length&&(n[be.forRoles]=o.roles.join(",")),o?.name&&(n[be.forName]=encodeURIComponent(o.name)),n}var Jr="/graview/views";function sn(e){let n=e.fetch??fetch,o=vt(e.url,e.headers),i=o.url,l={"content-type":"application/json",...e.principal?St(e.principal):{},...o.headers},u=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??ct.may}:ct,c=new Set,w=b=>{if(JSON.stringify(b)!==JSON.stringify(u)){u=b;for(let T of c)T()}},m=async(b,T)=>{let x=await n(`${i}${e.path??Jr}`,{method:b,headers:l,...T!==void 0?{body:JSON.stringify(T)}:{}}),O=await x.json();if(!x.ok)throw new Error(O.error??`The store answered ${x.status}.`);w({hidden:O.hidden??[],removed:O.removed??[],may:O.may??ct.may})},k=()=>m("GET"),F=e.state?Promise.resolve():k().catch(()=>{}),N=e.pollMs?setInterval(()=>void k().catch(()=>{}),e.pollMs):void 0;return{ready:F,refresh:k,close:()=>clearInterval(N),current:()=>u,onChange(b){return c.add(b),()=>void c.delete(b)},hide:b=>m("POST",{hide:b}),show:b=>m("POST",{show:b}),remove:(b,T)=>m("POST",{remove:b,...T?{about:T}:{}}),async restore(b){let T=u.removed.find(x=>x.name===b)?.lens;await m("POST",{restore:b}),T&&await e.onDeclaration?.()},async lens(b){await m("POST",{lens:b}),await e.onDeclaration?.()}}}var dn=document.getElementById("graview-app"),cn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),Yr=cn?(__graviewPreload(import.meta.url,["./chunk.66IKLMYX.js","./chunk.MBP7VDYM.js","./chunk.XOZU4OFA.js","./chunk.LA2DMHZC.js","./chunk.SIYBHZDD.js","./chunk.3RW677X6.js","./chunk.UO544PZH.js","./chunk.4STDIZVI.js","./chunk.HZHNM2KI.js","./chunk.HOQMD6WQ.js","./chunk.N7T7VB77.js","./chunk.SDO3U72B.js","./chunk.F7PIW2EM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ULHB3RYK.js")):Ve("pages");try{cn?await Yo(decodeURIComponent(cn[1])):await Qo()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),dn.replaceChildren(n),window.__graviewFailed=n.textContent}async function Yo(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),o=await n.json();if(!n.ok)throw new Error(o.error??`The preview server did not hand over the form (${n.status}).`);let i=await pt(o);if(!i.ok)throw new Error(dt(i.findings));let l=i.app,u=o.principal,c=await bt({app:l,url:location.origin,principal:u,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=l.forms?.[e]?.title??l.name;let{mount:w}=await Yr;window.__graview=w(dn,{app:l,form:e,principal:u,remote:c,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Qo(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),i=await(async m=>{if(typeof m.module=="string")return(await import(m.module)).app;let k=await pt(m);if(!k.ok)throw new Error(dt(k.findings));return k.app})(n);if(!i||typeof i!="object"||!("schema"in i))throw new Error("The app module the preview server handed does not export an app.");let l=n.principal,u=await bt({app:i,url:location.origin,principal:l,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let c,w=sn({url:location.origin,principal:l,...n.views?{state:n.views}:{},onDeclaration:async()=>{let m=await(await fetch("/graview/document")).json();if(typeof m.module=="string")return;let k=await pt(m);k.ok&&c?.setApp(k.app,u)}});await Promise.all([Yr,w.ready]),c=nn(dn,{app:i,remote:u,principal:l,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:w,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=c,c.drawn().then(()=>{window.__graviewReady=!0})}
|
|
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 jt,b as lr,c as ur,d as fr,e as pr,f as qt,g as mr,h as zt}from"./chunk.YXAKHXYB.js";import{a as uo}from"./chunk.PDS4HT46.js";import{a as Gt,b as yr,c as gr,d as wr,e as Ut,f as vr,g as br,h as Sr,i as Ar,j as Pr,k as kr,l as Er,m as Rr,n as Tr,o as Ye}from"./chunk.Z2ZQJ3DD.js";import{b as hr}from"./chunk.PDMX3GTL.js";import{a as Ct}from"./chunk.Q5WEOX3Q.js";import{b as Lt,i as Bn}from"./chunk.75GENXGP.js";import{k as lt}from"./chunk.FNVGNISQ.js";import{B as ir,G as sr,K as cr,L as dr,h as er,k as tr,l as nr,m as It,n as rr,p as or,t as ar,y as _t}from"./chunk.KZUMXT5J.js";import{c as lo}from"./chunk.CGK2PY76.js";import{Aa as Un,Ba as Kn,Ca as Jn,Ea as Yn,Fa as Qn,G as Wt,Ha as Zn,Ia as Nt,La as Xn,Oa as pt,T as Wn,Z as Nn,a as Dn,b as ut,c as ft,ga as In,ha as _n,j as $n,ja as jn,m as $t,xa as qn,ya as zn,za as Gn}from"./chunk.CYTTZOYL.js";import{a as xe}from"./chunk.SDO3U72B.js";import{Bd as xn,Cd as Fn,Eb as kn,Hd as On,Jd as Cn,Kd as Ln,Md as dt,Nb as En,Pb as Rn,ie as Te,je as Mn,ke as Hn,lb as qe,pe as Ht,qe as Vt,re as Bt,ue as Vn,ve as Dt,wb as ct,wc as Mt,xc as Tn}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as Be}from"./chunk.AJZBJBMO.js";async function mt(e,n={}){let o=e.compiled===void 0||!po(e.compiled,e.document)?void 0:Bn(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await fo();return i(e.document,n)}var xr,fo=()=>xr??=(__graviewPreload(import.meta.url,["./chunk.MAHNJO6U.js","./chunk.75GENXGP.js","./chunk.4EXC26LI.js","./chunk.AHPYNDVA.js","./chunk.FNVGNISQ.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.WNS5LEO5.js")).catch(e=>{throw xr=void 0,e});function po(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,i=n;if(typeof i=="string")try{i=JSON.parse(i)}catch{return!1}return o!==void 0&&Ct(Lt(o).document)===Ct(Lt(i).document)}var d=Be(Wt(),1);var yt=Be(Wt(),1),Kt="data-graview-drawn",mo=200,Fr=50,ho=1e4,ht=()=>typeof performance<"u"?performance.now():Date.now();function yo(e){let n=[...e.querySelectorAll("img")];for(let o of e.querySelectorAll("[data-worker-view]"))o.shadowRoot&&n.push(...o.shadowRoot.querySelectorAll("img"));return n}function go(e,n){if(e.ownerDocument.fonts?.status==="loading"||zn()>0||Jn(n)>0||e.querySelector('[aria-busy="true"]')||yo(e).some(i=>!i.complete&&i.loading!=="lazy"))return!1;for(let i of e.querySelectorAll("[data-worker-view-place]"))if(!i.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function Or(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(i=>`${i.offsetWidth}x${i.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function wo(e,n,o,i){e.removeAttribute(Kt);let l=e.ownerDocument.defaultView;if(!l)return()=>{};let u=ht(),c=u,v=Or(e),m=!1,E,F=typeof MutationObserver>"u"?void 0:new MutationObserver(x=>{x.some(O=>!(O.target===e&&O.attributeName===Kt))&&(c=ht())});F?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let W=()=>{m=!0,F?.disconnect(),E!==void 0&&clearTimeout(E)},b=x=>{let O=!1,oe=()=>{O||(O=!0,x())};typeof l.requestAnimationFrame=="function"&&l.requestAnimationFrame(()=>setTimeout(oe,0)),setTimeout(oe,100)},T=()=>{if(m)return;let x=Or(e);x!==v&&(v=x,c=ht());let O=ht();if(go(e,i)&&O-c>=mo||O-u>=ho){b(()=>{m||(W(),e.setAttribute(Kt,n),Qn(),o())});return}E=setTimeout(T,Fr)};return E=setTimeout(T,Fr),W}function Cr(e,n,o,i,l){Yn();let u=(0,yt.useRef)({place:o,onDrawn:i});u.current={place:o,onDrawn:i},(0,yt.useLayoutEffect)(()=>{l&&Kn(l);let c=E=>wo(E,u.current.place.path,()=>u.current.onDrawn?.(u.current.place),l);if(e.current)return c(e.current);let v,m=!1;return queueMicrotask(()=>{!m&&e.current&&(v=c(e.current))}),()=>{m=!0,v?.()}},[n,e,l])}var we=Be(Wt(),1),Qe,vo=xe(()=>(__graviewPreload(import.meta.url,["./chunk.NJSK3UO2.js","./chunk.CI4RZL4Z.js","./chunk.XUO67YMT.js","./chunk.Q4GJIJAU.js","./chunk.MT5DXJKN.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BF3EZCG3.js"))),Lr=()=>vo().then(e=>void(Qe=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Lr)),Jt=qn(Lr),Mr=e=>!!e&&Qe===void 0;function Yt({onReady:e,fetch:n}){return(0,we.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var bo=0;function Hr(e){let[n,o]=(0,we.useState)(()=>Qe);(0,we.useEffect)(()=>{if(!e||n)return;let u=!1;return Jt().then(()=>{u||o(Qe)}),()=>{u=!0}},[e,n]);let i=(0,we.useMemo)(()=>bo+=1,[e]);return{over:(0,we.useMemo)(()=>{let u=n??Qe;if(!e||!u)return;let{source:c,worker:v,...m}=e,E={...m,worker:v??{source:c},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:F=>u.registerWorkerView(F,E)}},[e,n]),n:i}}var Dr=Be(uo(),1),$=Be(lo(),1);var w=Be(Wn(),1);function gt(e,n={}){let o=Nt(e);return{Face:o.part((l,u)=>(0,d.createElement)(l,u),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Xt=e=>Promise.all([e,cr()]).then(([n])=>n),$r=xe(()=>(__graviewPreload(import.meta.url,["./chunk.YZBJUAS6.js","./chunk.XCWZFLIB.js","./chunk.6YK5E7ZQ.js","./chunk.VZDHRY3U.js","./chunk.A2R53GWF.js","./chunk.Q2EGESEZ.js","./chunk.SMHP2CQH.js","./chunk.HJCQ6I3S.js","./chunk.EJ4MSVX2.js","./chunk.KQPKYWDM.js","./chunk.OXWOUE3W.js","./chunk.34DRUCH2.js","./chunk.KXFNRJ46.js","./chunk.OMRQTLI5.js","./chunk.MIE3ODQ2.js","./chunk.NEPQBMFT.js","./chunk.MBB5A6BT.js","./chunk.ERPILTRY.js","./chunk.BIDL7GQD.js","./chunk.QS32TO4N.js","./chunk.JVDPRQ7J.js","./chunk.57YDGGJK.js","./chunk.H7AH3IW4.js","./chunk.U5P23GO7.js","./chunk.Z2ZQJ3DD.js","./chunk.PDMX3GTL.js","./chunk.Q5WEOX3Q.js","./chunk.MAHNJO6U.js","./chunk.75GENXGP.js","./chunk.NIAM7OTV.js","./chunk.4EXC26LI.js","./chunk.PWAP2GJS.js","./chunk.AHPYNDVA.js","./chunk.FNVGNISQ.js","./chunk.GZHZLJBF.js","./chunk.WUVXIUA7.js","./chunk.OJGHDWI6.js","./chunk.BN7C5ZYX.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.6Z2GHQQH.js"))),So=xe(()=>(__graviewPreload(import.meta.url,["./chunk.EJ2WE764.js","./chunk.T3JIZNE7.js","./chunk.26H33GJC.js","./chunk.DBFJVVWF.js","./chunk.SSAETRHR.js","./chunk.Q355UPFG.js","./chunk.YZBJUAS6.js","./chunk.NTC2H5ZX.js","./chunk.2RASWDMQ.js","./chunk.XCWZFLIB.js","./chunk.AWUO3M5D.js","./chunk.VZDHRY3U.js","./chunk.V4HVFLFQ.js","./chunk.A2R53GWF.js","./chunk.QAMW5QDT.js","./chunk.B5PJCYBU.js","./chunk.Q2EGESEZ.js","./chunk.SMHP2CQH.js","./chunk.ZZAI57VI.js","./chunk.34DRUCH2.js","./chunk.NEPQBMFT.js","./chunk.2PJ6STKA.js","./chunk.MBB5A6BT.js","./chunk.T535ZLRM.js","./chunk.ERPILTRY.js","./chunk.OTSBF367.js","./chunk.JVDPRQ7J.js","./chunk.BJUUSIQY.js","./chunk.57YDGGJK.js","./chunk.H7AH3IW4.js","./chunk.XOZU4OFA.js","./chunk.4TH3CGAZ.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.XYGNS637.js","./chunk.DZSZUX34.js","./chunk.4EXC26LI.js","./chunk.PWAP2GJS.js","./chunk.AHPYNDVA.js","./chunk.FNVGNISQ.js","./chunk.GZHZLJBF.js","./chunk.WUVXIUA7.js","./chunk.OJGHDWI6.js","./chunk.BN7C5ZYX.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SJUXFPTI.js"))),Ao=xe(()=>(__graviewPreload(import.meta.url,["./chunk.EJ2WE764.js","./chunk.T3JIZNE7.js","./chunk.26H33GJC.js","./chunk.DBFJVVWF.js","./chunk.SSAETRHR.js","./chunk.Q355UPFG.js","./chunk.YZBJUAS6.js","./chunk.NTC2H5ZX.js","./chunk.2RASWDMQ.js","./chunk.XCWZFLIB.js","./chunk.AWUO3M5D.js","./chunk.VZDHRY3U.js","./chunk.V4HVFLFQ.js","./chunk.A2R53GWF.js","./chunk.QAMW5QDT.js","./chunk.B5PJCYBU.js","./chunk.Q2EGESEZ.js","./chunk.SMHP2CQH.js","./chunk.ZZAI57VI.js","./chunk.34DRUCH2.js","./chunk.NEPQBMFT.js","./chunk.2PJ6STKA.js","./chunk.MBB5A6BT.js","./chunk.T535ZLRM.js","./chunk.ERPILTRY.js","./chunk.OTSBF367.js","./chunk.JVDPRQ7J.js","./chunk.BJUUSIQY.js","./chunk.57YDGGJK.js","./chunk.H7AH3IW4.js","./chunk.XOZU4OFA.js","./chunk.4TH3CGAZ.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.XYGNS637.js","./chunk.DZSZUX34.js","./chunk.4EXC26LI.js","./chunk.PWAP2GJS.js","./chunk.AHPYNDVA.js","./chunk.FNVGNISQ.js","./chunk.GZHZLJBF.js","./chunk.WUVXIUA7.js","./chunk.OJGHDWI6.js","./chunk.BN7C5ZYX.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.C65EHQ7V.js"))),Wr=gt(()=>Xt($r().then(e=>e.SceneFace)),{what:"This view"}),Nr=gt(()=>$r().then(e=>e.SceneKeeping),{quiet:!0}),Ir=gt(()=>Xt(So().then(e=>e.PagesContent)),{what:"This page"}),_r=gt(()=>Xt(Ao().then(e=>e.PictureFace)),{what:"This picture"}),Po=Wr.Face,ko=Nr.Face,Eo=Ir.Face,Ro=_r.Face;function De(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(jr));return Promise.all([...[...o].map(i=>i.fetch()),or()]).then(()=>{},()=>{})}var jr=e=>e==="pages"?[Ir]:e==="picture"?[_r]:[Wr,Nr],qr=e=>jr(e).every(n=>n.here()),To=150,Qt=0;function Vr(e,n){if(qr(e))return n();let o=++Qt,i=()=>{o===Qt&&(Qt+=1,n())};De(e).then(i),setTimeout(i,To)}var xo=768;function Fo(e,n){let o=n!==null&&n>=xo;(0,d.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(qr(i))return;let l=globalThis,u=()=>void De(i),c=()=>{},v=Zn(()=>{if(l.requestIdleCallback&&l.cancelIdleCallback){let m=l.requestIdleCallback(u,{timeout:4e3});c=()=>l.cancelIdleCallback?.(m)}else{let m=setTimeout(u,1500);c=()=>clearTimeout(m)}});return()=>(v(),c())},[e,o])}function Oo({asked:e,shown:n,onDrawn:o}){return(0,d.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function Co({auto:e,scene:n}){return(0,w.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${Ut}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Lo=Nt(xe(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,w.jsx)(e.StudioPlace,{...n}),{quiet:!0});function zr(e,n,o,i,l){return qt(e,pr(n?ft(n):l??Dn,i),o)}function en(e){return e&&ft(e).overview?"graview":"scene"}function Br(e,n){if(n.homeView?.()===void 0)return!1;let o=e.pages?.first?.trim();return o===void 0||o===""||o==="/"||o.toLowerCase()==="home"}function Gr(e){let[,n]=(0,d.useState)(!1),o=(0,d.useCallback)(()=>n(!0),[]),i=(0,d.useRef)(!1);return e.at&&!wt?(0,w.jsx)(Yt,{onReady:o,fetch:tn}):!i.current&&Mr(e.draftView)?(0,w.jsx)(Yt,{onReady:o,fetch:Jt}):(i.current=!0,(0,w.jsx)(Mo,{...e}))}function Mo(e){let{app:n,stop:o,bar:i=!0,standing:l="Everything is in order",principal:u,heading:c=2}=e,{rootRef:v,scope:m,css:E,scheme:F,store:W,presence:b,brand:T,auto:x,height:O}=vr(e),oe=Hr(e.draftView),R=gr(e,dr,oe.over),[le]=(0,d.useState)(Un),p=e.basePath===void 0?{}:{basePath:e.basePath},[B]=(0,d.useState)(It),D=e.notices??B,z=g=>Ht(g,p),ie={...e.routing?{routing:e.routing}:{},...p},[se]=(0,d.useState)(()=>{let g=e.at?.face;if(g)return g;let Q=o===void 0&&Br(n,R)?"pages":en(o),K=jt({...ie,face:Q});return e.face===void 0&&e.onOpening?.(K),K}),[be,H]=(0,d.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&lr(ie)&&Br(n,R)),Se=(0,d.useRef)(e.onFace);Se.current=e.onFace,(0,d.useLayoutEffect)(()=>{be&&(Se.current?.("pages"),H(!1))},[be]);let A=be?"pages":e.face??se,k=n.schema.kinds,V=e.routing==="address",Ae=(0,d.useMemo)(()=>e.at?wt.settleAt(e,W.seenBy(u??{kind:"human"}),R.places()):void 0,[]),C=(0,d.useMemo)(()=>_n(R,n.schema),[R,n.schema]),me=(0,d.useMemo)(()=>{let g=Ae?.stop??(V?ur(e.basePath):void 0)??o;return A==="scene"&&g===void 0&&C===void 0&&(e.path===void 0||Zt(e.path))?zt(void 0):zr(A,g,k,R.places(),C)},[]),[N]=(0,d.useState)(A);(0,d.useEffect)(()=>{N!=="pages"&&In(R)},[N,R]);let L=(0,d.useRef)(void 0),q=g=>g===void 0||Zt(g)?"/":g;L.current??={path:q(Ae?.path??(V?A==="pages"?(Vt(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==L.current.asked&&(L.current={path:q(e.path),asked:e.path});let Z=(0,d.useRef)(e.onNavigate);Z.current=e.onNavigate;let Oe=(0,d.useCallback)((g,Q)=>{L.current.path=g,Z.current?.(g,Q)},[]),{at:he,setAt:j,steering:G,steer:ae}=Er(L.current.path),M=(0,d.useContext)(Ur);M&&(M.pages=()=>L.current.path);let[$e]=(0,d.useState)(()=>({})),J=M??$e,ce=(0,d.useMemo)(()=>tr(D),[D]),I=(0,d.useRef)(void 0),Pe=(0,d.useCallback)(g=>void(L.current.path=g),[]),X=er(v),[Ce,ee]=(0,d.useState)(!1),Xe=e.pagesBelow!==void 0&&X!==null&&X<e.pagesBelow&&(A==="scene"||A==="graview")&&!Ce,P=Xe?"pages":A,Le=(0,d.useRef)(!1);Le.current=Ce&&e.pagesBelow!==void 0&&X!==null&&X<e.pagesBelow&&(A==="scene"||A==="graview"),M&&(M.shown=P);let Me=(0,d.useRef)(A==="graview"?"graview":"scene");(P==="scene"||P==="graview")&&(Me.current=P),(0,d.useState)(()=>{if(!V||typeof window>"u"||P==="pages"||P==="picture")return;let{pathname:g,search:Q,hash:K}=window.location;Vt(g,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${z(Te)}${Q}${K}`)}),wr(v,P,e.onIntrinsicHeight),Fo(P,X);let te=Rr(e.onError,P),He=Tr(e.onReady,P),ke=(0,d.useRef)(e.onFaceDrawn);ke.current=e.onFaceDrawn;let et=(0,d.useCallback)((g,Q)=>{He(Q),ke.current?.(g)},[He]),[We,Pt]=(0,d.useState)(null),tt=R.places(),Ne=(0,d.useRef)({shown:P,onFace:e.onFace});Ne.current={shown:P,onFace:e.onFace};let _=(0,d.useCallback)((g,Q,K)=>{if(V){I.current?.(g,Q,K);return}Ne.current.onFace?.(g),Z.current?.(g==="pages"?Q??L.current.path:Te,"push")},[V]),[ye,U]=(0,d.useState)(void 0);(0,d.useEffect)(()=>{P==="pages"&&U(void 0)},[P]);let Ie=(0,d.useRef)(o);(0,d.useEffect)(()=>{Ie.current!==o&&(Ie.current=o,U(void 0))},[o]);let Ee=(0,d.useCallback)(g=>{if(Ne.current.shown==="pages"){if(ee(!0),U(g),A==="scene"||A==="graview"){Vr(A,()=>{V?window.history.pushState(null,"",`${z(Te)}${g??""}`):Z.current?.(Te,"push")});return}Vr(Me.current,()=>_(Me.current,void 0,g))}},[V,A,e.basePath,_]),Ve=(0,d.useCallback)(g=>{if(Ne.current.shown==="pages"){G.go.current||(L.current.path=g),ae(g);return}if(L.current.path=g,j(g),Le.current){ee(!1),V?window.history.pushState(null,"",z(g)):Z.current?.(g,"push");return}_("pages",g)},[G,ae,j,_,V,e.basePath]),Ke=R.arrangement?.(),ue=P==="pages",Re=e.hrefOf,_e=Re??(V?z:void 0),Y=(0,d.useMemo)(()=>({open:Ve,...Re?{href:Re}:V?{href:g=>Ht(g,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[Ve,V,e.basePath,Re]);return(0,w.jsxs)("section",{ref:v,className:m,"aria-label":e.label??n.name,"data-graview-embed":P,"data-graview-scheme":F,...Xe?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:O,minHeight:x?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,w.jsx)("style",{children:E}),(0,w.jsxs)(Xn.Provider,{value:te,children:[(0,w.jsx)(br,{rootRef:v,board:D,onReport:e.onReport,where:()=>P==="pages"?Sr(he):P==="picture"?{place:"picture"}:nr(J.view?.focusId)}),(0,w.jsx)(yr,{rootRef:v,firstLook:e.firstLook,app:ir(T??{name:n.name},n.schema)}),(0,w.jsx)(Ye,{module:"@graview/react",report:te,content:!0,children:(0,w.jsx)(Gn.Provider,{value:le,children:(0,w.jsx)(Nn,{store:W,views:R,initialView:me,scheme:F,...Ar(e,b,T),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,w.jsxs)(rr.Provider,{value:ce,children:[(0,w.jsx)(Do,{face:P,stop:ye??o,kinds:k,places:tt,opens:C}),(0,w.jsx)(Ho,{into:J}),(0,w.jsx)(Vo,{rootRef:v,face:A,shown:P,path:he,stop:o,draft:oe.n,onDrawn:e.onDrawn,parts:le}),V?(0,w.jsx)(fr,{pagesWere:Ae?.path,basePath:e.basePath,shown:P,onFace:e.onFace,toggle:I,kinds:k,places:tt,opens:C,landed:Pe}):null,i&&P!=="picture"?(0,w.jsx)(Ye,{module:"@graview/embed",report:te,children:(0,w.jsx)(Pr,{name:T?.name??n.name,heading:c,named:Gt(i).name!==!1,faces:Gt(i).faces===!1?void 0:{scene:{label:Mn(Ke),current:!ue,go:()=>Ee(),reach:()=>void De(Me.current)},pages:{label:Hn(Ke),current:ue,go:()=>Ve(L.current.path),reach:()=>void De("pages")}},at:ue?he:null,without:e.pages?.without(),home:{..._e?.("/")!==void 0?{href:_e("/")}:{},go:()=>Ve("/"),current:ue&&he.split("?")[0]==="/"},reach:{..._e?{href:_e}:{},go:g=>Ve(g.path)},standing:l,hostActions:e.hostActions,barActions:e.barActions,keeping:ue?void 0:(0,w.jsx)($o,{app:n,studio:e.studio,report:te}),onFind:Pt,switch:e.switch})}):null,(0,w.jsx)(ar.Provider,{value:We,children:(0,w.jsx)(Ye,{module:P==="pages"||P==="picture"?"@graview/pages":"@graview/react",report:te,content:!0,children:(0,w.jsxs)(d.Suspense,{fallback:(0,w.jsx)(Co,{auto:x,scene:P!=="pages"&&P!=="picture"}),children:[P==="picture"?(0,w.jsx)(Ro,{scope:m,store:W,views:R,as:(o?ft(o).within?.view:void 0)??""}):P==="pages"?(0,w.jsx)(Eo,{store:W,views:R,presence:b,auto:x,brand:T,steering:G,overview:Ee,scope:m,titleLevel:kr(c),quickAsk:_t(e.quickAsk),props:{...e,onNavigate:Oe,...V?{}:{path:L.current.path}}}):(0,w.jsx)(jn.Provider,{value:Y,children:(0,w.jsx)(Po,{address:V,auto:x,scheme:F,scope:m,quickAsk:_t(e.quickAsk)})}),(0,w.jsx)(Oo,{asked:A,shown:P,onDrawn:et})]})},P)})]})})})})]})]})}var Zt=e=>e.split(/[?#]/)[0]===Te,Ur=(0,d.createContext)(null);function Ho({into:e}){return e.view=pt().view,null}function Vo({rootRef:e,face:n,shown:o,path:i,stop:l,draft:u,onDrawn:c,parts:v}){let{view:m}=pt(),E=o==="scene"||o==="graview",F=ut(m),{pan:W,...b}=m,T=m.pan?ut(b):F,x={face:n,path:E?Te:o==="picture"?l??"#":i,stop:F};return Cr(e,`${o} ${E?T:x.path} ${u}`,x,c,v),null}var wt,Bo=xe(()=>(__graviewPreload(import.meta.url,["./chunk.YXAKHXYB.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.HOFATBGD.js"))),tn=()=>Bo().then(e=>void(wt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(tn));function Do({face:e,stop:n,kinds:o,places:i,opens:l}){let{view:u,go:c}=pt(),v=(0,d.useRef)({face:e,stop:n});return(0,d.useLayoutEffect)(()=>{let m=v.current.stop!==n,E=v.current.face!==e,F=v.current.face==="pages";if(v.current={face:e,stop:n},!m&&!E||e==="pages"||e==="picture")return;let W=(m||F)&&n!==void 0?zr(e,n,o,i):F&&mr(u)?qt(e,zt(l),o):e==="graview"?$t(u,!0):u.overview?$n($t(u,!1),sr(u,o)):u;c(W)},[e,n,o,u,c,l]),null}function $o({app:e,studio:n,report:o}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(d.Suspense,{fallback:null,children:(0,w.jsx)(ko,{})}),n!==!1?(0,w.jsx)(Ye,{module:"@graview/studio",report:o,children:(0,w.jsx)(Wo,{app:e,studio:n})}):null]})}function Wo({app:e,studio:n}){let o={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},i=n?.place;return i?(0,w.jsx)(i,{...o}):(0,w.jsx)(d.Suspense,{fallback:null,children:(0,w.jsx)(Lo,{...o})})}function No({path:e,stop:n,...o},i){return{...o,app:i.app,at:i.at,remote:i.remote,...i.remote.presence?{presence:i.remote.presence}:{}}}function nn(e,n){let o=n.store??n.remote?.store??hr(n.app,n.seed),i=n.notices??It(),l=null,u={},c=0,v=n.label,m=n.app,E=Promise.resolve(),F=n.at?.face??n.face,W=F===void 0?void 0:jt({...n,face:F}),b=W??en(n.stop),T=null,x=[],O=p=>{if(T=p,p!==b)return;let B=x;x=[];for(let D of B)D()};function oe(){let[p,B]=(0,d.useState)(W),[D,z]=(0,d.useState)(n.stop),[ie,se]=(0,d.useState)(n.path),[be,H]=(0,d.useState)(n.scheme??"auto"),[Se,A]=(0,d.useState)(n.principal),[k,V]=(0,d.useState)(n.seats),[Ae,C]=(0,d.useState)(n.quickAsk),[me,N]=(0,d.useState)(n.people),[L,q]=(0,d.useState)(n.hostContext),[Z,Oe]=(0,d.useState)(n.brand),[he,j]=(0,d.useState)(n.whileAway),[G,ae]=(0,d.useState)(n.label),[M,$e]=(0,d.useState)(n.hostActions),[J,ce]=(0,d.useState)(n.barActions),[I,Pe]=(0,d.useState)(void 0),[X,Ce]=(0,d.useState)(n.draftView);return l={app:ee=>{Pe(ee),se(void 0),z(void 0)},face:B,stop:z,path:se,scheme:H,seat:A,seats:V,quickAsk:C,people:N,hostContext:q,brand:Oe,whileAway:j,label:ae,hostActions:$e,barActions:ce,draft:Ce},(0,w.jsx)(Ur.Provider,{value:u,children:(0,w.jsx)(Gr,{...I?No(n,I):n,store:o,notices:i,...p!==void 0?{face:p}:{},onOpening:ee=>{b=ee},...D!==void 0?{stop:D}:{},...ie!==void 0?{path:ie}:{},...Se?{principal:Se}:{},...k?{seats:k}:{},...Ae!==void 0?{quickAsk:Ae}:{},...me?{people:me}:{},...L?{hostContext:L}:{},...Z?{brand:Z}:{},whileAway:he,label:G,hostActions:M,barActions:J,draftView:X,scheme:be,onFace:ee=>{b=ee,B(ee)},onSeat:A,onFaceDrawn:O},I?.n??0)})}let R=()=>{let p=u.view?.focusId,B=p?o.graph.getNode(p)?.kind:void 0,D=(u.shown??b)==="scene"||(u.shown??b)==="graview";return{face:b,path:D?Te:u.pages?.()??n.path??"/",stop:u.view?ut(u.view):n.stop??"#",...B?{kind:B}:{}}},le=(0,Dr.createRoot)(e);return(0,$.flushSync)(()=>le.render((0,w.jsx)(oe,{}))),{get store(){return o},where:R,setApp:(p,B,D)=>{let z="graph"in B?{store:B}:B,ie=()=>{let se=R();o=z.store,v=D?.label??(v===m.name?p.name:v),m=p,(0,$.flushSync)(()=>{l?.label(v),l?.app({app:p,remote:z,at:se,n:++c})})};wt?ie():E=E.then(tn).then(ie)},setFace:p=>{b=p,(0,$.flushSync)(()=>l?.face(p))},setStop:p=>(0,$.flushSync)(()=>l?.stop(p)),setPath:p=>(0,$.flushSync)(()=>{if(Zt(p)){(b==="pages"||b==="picture")&&(b="scene",l?.face("scene"));return}l?.path(p),b!=="pages"&&(b="pages",l?.face("pages"))}),setScheme:p=>(0,$.flushSync)(()=>l?.scheme(p)),setSeat:p=>(0,$.flushSync)(()=>l?.seat(p)),setSeats:p=>(0,$.flushSync)(()=>l?.seats(p)),setQuickAsk:p=>(0,$.flushSync)(()=>l?.quickAsk(p)),setPeople:p=>(0,$.flushSync)(()=>l?.people(p)),setHostContext:p=>(0,$.flushSync)(()=>l?.hostContext(p)),setBrand:p=>(0,$.flushSync)(()=>l?.brand(p)),setWhileAway:p=>(0,$.flushSync)(()=>l?.whileAway(p)),setDraftView:p=>(0,$.flushSync)(()=>l?.draft(p)),setLabel:p=>{v=p,(0,$.flushSync)(()=>l?.label(p))},setHostActions:p=>(0,$.flushSync)(()=>l?.hostActions(p)),setBarActions:p=>(0,$.flushSync)(()=>l?.barActions(p)),drawn:()=>E.then(()=>T===b?void 0:new Promise(p=>x.push(p))),notify:p=>{let B;return(0,$.flushSync)(()=>{B=i.notify(p)}),B},unmount:()=>le.unmount()}}var vt=e=>`s${(e+1).toString(36)}`;var ve={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"},ze={header:"x-graview-key",param:"graview_key",cookie:"graview_key"};function bt(e,n={}){try{let o=new URL(e),i=o.searchParams.get(ze.param);if(i)return o.searchParams.delete(ze.param),{url:o.origin+o.pathname.replace(/\/$/,"")+o.search,key:i,headers:{[ze.header]:i,...n}}}catch{}return{url:e.replace(/\/$/,""),headers:n}}var Kr="/graview/friction";var Jr="/graview/live",rn="graview.ship",on=`${rn}.${ct}`;var Ge=class extends Error{constructor(n){super(n),this.name="Superseded"}},Fe=e=>e?.lineage?{lineage:e.lineage}:{},Io=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
|
|
2
|
+
`)[0]??"":String(n)})`;function _o(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let o=JSON.parse(n);return Array.isArray(o)?o.filter(i=>!!i&&Array.isArray(i.calls)):[]}catch{return[]}}var Ue=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},jo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},pe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},Ze=class extends Error{constructor(n){super(n),this.name="Unreached"}},qo=new Set([502,503,504]);async function zo(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function Go(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Uo=1,Ko=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function St(e){return(await Yr(e,_o(e.carry),"This app was updated while your changes were on the way.",Ko())).remote}async function Yr(e,n,o,i){let{key:l,...u}=bt(e.url,e.headers),c={...e,...u},v=c.fetch??fetch,m={"content-type":"application/json",...c.headers??{}},E={...At(c.principal),[ve.via]:c.via??"web"};Object.assign(m,E);let F=c.live===!0,W=c.presenceEveryMs,b=c.visible??Qo,T="connecting",x=i.statuses,O=i.tally,oe=[],R,le=[],p=()=>T==="online"&&R!==void 0?"held":T,B=()=>{let t=p();if(i.told!==t){i.told=t;for(let r of[...x])r(t)}},D=t=>{if(!(t===T||de)&&(T==="offline"&&t==="online"&&O.reconnects++,T=t,B(),t==="online"))for(let r of oe.splice(0))r.again()},z=t=>{if(de)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==R;if(R=r,ie(),!!s&&(B(),r===void 0)){for(let a of le.splice(0))a();ne&&clearTimeout(ne),ln()}},ie=()=>{if(i.toldHeld!==R){i.toldHeld=R;for(let t of[...i.helds])t(R??null)}},se=async(t,r)=>{let s;try{s=await v(t,r)}catch(a){throw Y()||D("offline"),new Ze(a instanceof Error?a.message:String(a))}if(s.status===503&&await zo(s))return D("online"),s;if(qo.has(s.status))throw Y()||D("offline"),new Ze(`The server is away (${s.status})`);return D("online"),s},be=async(t=!1)=>{let r=`${c.url}/graview/state?opFormat=${qe.op}`,s=t?await v(r,{headers:m}):await se(r,{headers:m});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},H=c.state??await be(!0);F||(T="online"),R=typeof H.held=="string"&&H.held.length>0?H.held:void 0,ie();let Se=H.enabledModules??c.enabledModules,A=c.localApp?c.localApp(c.app):c.app,k=new Ln({schema:A.schema,mutations:A.mutations??[],invariants:A.invariants??[],...A.policy?{policy:A.policy}:{},...A.publishing?{publishing:A.publishing}:{},...A.tidying?{tidying:A.tidying}:{},...A.modules?{modules:A.modules}:{},...Se?{enabledModules:Se}:{},...A.intelligence?{intelligence:A.intelligence}:{},...A.brand?.timeZone?{timeZone:A.brand.timeZone}:{},snapshot:H.snapshot,log:H.log,...H.horizon!==void 0?{horizon:H.horizon}:{},ids:Go(),...c.storeOptions??{}});Rn.served.add(k);let V=c.friction!==!1&&c.principal?.kind!=="visitor";V&&xn(k,t=>{V&&v(`${c.url}${Kr}`,{method:"POST",headers:m,body:JSON.stringify({event:t})}).then(r=>void(V=r.status!==404&&r.status!==410),()=>{})});let Ae=On(k),C=H.log.at(-1)?.seq??(H.horizon??0)-1,me=Mt.of(H.log,{horizon:H.horizon??0}),N=null,L,q=new Map,Z=i.who,Oe=!1,he=t=>{if(de)return;Oe=!0;let r=Vn(new Map,t,Date.now(),Bt,N?.participant);L!==void 0&&r.delete(L);let s=r.size!==q.size;if(!s)for(let[a,f]of r)Dt(f,q.get(a))||(s=!0);if(q=r,!!s)for(let a of[...Z])a([...q.values()])},j=[],G=new Set,ae=t=>{let r=j.indexOf(t);r>=0&&j.splice(r,1)},M=new Map,$e=(t,r)=>{let s=M.get(t);s&&(M.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},J,ce=[],I=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(J)return ce.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(h=>h.seq>C).map(h=>h.seq));if(Number.isFinite(s)&&s>C+1)return ce.push({ops:t,drop:r}),Pe(),[];let a=j.filter(h=>t.some(re=>re.batch===h)),f=[...new Set([...r,...a])].filter(h=>G.has(h)),y,S=j.filter(h=>!a.includes(h));try{y=k.rebase({confirmed:t,pending:S,drop:f}).confirmed}catch(h){if(!(h instanceof Cn))throw h;return ce.push({ops:t,drop:r}),Pe(),[]}for(let h of a)ae(h);t.some(h=>h.seq>C)&&S.some(h=>!f.includes(h))&&O.rebases++,t.length>0&&(C=Math.max(C,...t.map(h=>h.seq)),me.note(t));for(let h of f)G.delete(h);for(let h of a)$e(h,t);return y},Pe=()=>{J||(J=ke(be().then(t=>{if(X(t)){ce=[];return}let r=new Set(t.log.map(f=>f.batch)),s=j.filter(f=>r.has(f));for(let f of s)ae(f);let a=k.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...j],drop:[...G].filter(f=>!j.includes(f))});G.clear();for(let f of a.pending)G.add(f.batch);C=t.log.at(-1)?.seq??(t.horizon??0)-1,me=Mt.of(t.log,{horizon:t.horizon??0}),O.resyncs++;for(let f of s)$e(f,t.log)}).then(()=>{J=void 0;let t=ce;ce=[];for(let{ops:r,drop:s}of t)I(r,s)},()=>{J=void 0,ce=[]})))},X=t=>(typeof t.build=="string"&&fn(t.build),typeof t.version=="number"&&z(t.held),typeof t.version!="number"||t.version===H.version?!1:(Rt(t.version),!0)),Ce=async t=>{let s=await(await se(`${c.url}/graview/since?seq=${vt(t)}&opFormat=${qe.op}`,{headers:m})).json();return X(s)?[]:s.reset===!0?(Pe(),[]):s.ops??[]},ee=async()=>{let t=await Xe();return J&&await J,t},Xe=async()=>{if(N&&!Y()&&b()){let r=await(await se(`${c.url}/graview/here?opFormat=${qe.op}`,{method:"POST",headers:m,body:JSON.stringify({presence:N,seq:vt(C)})})).json();return X(r)?[]:(typeof r.participant=="string"&&(L=r.participant),he(r.who??[]),I(r.ops??[]))}return I(await Ce(C))},P=new Map,Le=new Map,Me=new Set,te=new Map,He=new Set,ke=t=>(He.add(t),t.finally(()=>He.delete(t)).catch(()=>{}),t),et=Promise.resolve(),We=0,Pt=(t,r)=>{let s=et.then(()=>Ne(t,r));return et=s.catch(()=>{}),s},tt=()=>new Promise((t,r)=>oe.push({again:t,give:r})),Ne=async(t,r)=>{let s,a;for(;;){try{s=await se(`${c.url}/graview/ops`,{method:"POST",headers:m,body:JSON.stringify({...t,opFormat:qe.op})})}catch(h){if(!(h instanceof Ze)||U)throw h;if(await tt(),Y())return nt(t,r);continue}if(a=await s.json().catch(()=>({})),s.status===503&&a.reason==="unavailable"&&typeof a.held=="string"&&!U){if(typeof a.version=="number"?X(a):(z(a.held),!1))break;if(R!==void 0&&(Ot>0||F)){if(await new Promise(h=>le.push(h)),U)throw new Ge("The client closed.");if(Y())return nt(t,r);continue}}let S;if(s.status===503&&a.reason==="unavailable"&&!U)S=an(c.backoff,We++);else{if(We=0,s.status!==429||U)break;S=Jo(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(h=>setTimeout(h,S)),Y())return nt(t,r)}if(de||X(a))throw new Ge("The app was changed.");if(!s.ok){let S=a.error??`The server refused (${s.status})`;throw a.conflict?new pe(S,a.conflicts??[]):new Ue({reason:a.reason??jo[s.status]??"invalid",sentence:S,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let f=a.ops??[],y=f[0]?.seq;return y!==void 0&&y>C+1&&(f=await Ce(C)),r!==void 0&&(a.batch&&P.set(r,a.batch),ae(r)),I(f,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},_,ye=!1,U=!1,Ie=0,Ee,Ve=0,Ke=0,ue=null,Re=()=>{},_e=new Promise(t=>{Re=t}),Y=()=>F&&ye&&_?.readyState===Uo,g=t=>{if(!Y())return!1;try{return _.send(JSON.stringify(t)),!0}catch{return!1}},Q=(t=!1)=>{!N||!Y()||!b()||!t&&ue&&Dt(N,ue)&&(W===void 0||Date.now()-Ke<W)||g({t:"here",presence:N})&&(ue=N,Ke=Date.now())},K=new Set,ne,ln=()=>{if(ne=void 0,R!==void 0)return;let t=[...M.entries()].filter(([r])=>K.has(r));K.clear();for(let[,r]of t)g(r.message)},un=(t,r)=>{M.has(t)&&(K.add(t),ne&&clearTimeout(ne),ne=setTimeout(ln,Math.max(0,r)))},Xr=t=>{M.has(t)&&K.add(t)},nt=(t,r)=>new Promise((s,a)=>{let f=r??`send-${++Ve}`,y=t.undo?{t:"undo",cid:f,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...Fe(t)}:{t:"call",cid:f,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...Fe(t)};if(M.set(f,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),K.size>0||R!==void 0){K.add(f);return}g(y)}),rt=(t,r)=>Y()?nt(t,r):Pt(t,r),eo=t=>{switch(t.t){case"welcome":{if(fn(t.build),typeof t.version=="number"&&t.version!==H.version){Rt(t.version);return}if(ye=!0,Ie=0,typeof t.participant=="string"&&(L=t.participant),z(t.held),t.state?Pe():I(t.ops??[]),K.clear(),ne&&clearTimeout(ne),ne=void 0,R!==void 0)for(let r of M.keys())K.add(r);else for(let r of M.values())g(r.message);Q(!0),D("online"),Re();return}case"ops":I(t.ops??[]);return;case"ack":{let r=M.get(t.cid);if(!r){I(t.ops??[]);return}M.delete(t.cid),We=0,r.mine!==void 0&&(P.set(r.mine,t.batch),ae(r.mine)),I(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=M.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){R!==void 0?Xr(t.cid):un(t.cid,an(c.backoff,We++));return}M.delete(t.cid),r.reject(t.t==="conflict"?new pe(t.sentence,t.conflicts??[]):new Ue({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&un(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":he(t.who??[]);return;case"held":z(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==H.version&&Rt(t.version);return;case"reload":yn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&_){let r=_;wn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},de=!1,kt=i.declarations,Et=i.builds,fn=t=>{if(!(de||i.otherBuild!==void 0||!c.build||typeof t!="string"||t.length===0||t===c.build)){i.otherBuild=t;for(let r of[...Et])r(t)}},pn=()=>{let t=[],r=0;for(let s of j){let a=te.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...Fe(a),batch:s}):r++}return{carried:t,undos:r}},mn=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,hn=t=>{de=!0,N=null;let r=new Ge(t);for(let a of M.values())a.reject(r);M.clear(),it&&clearInterval(it),U=!0,Ee&&clearTimeout(Ee),ne&&clearTimeout(ne),ge&&clearTimeout(ge);for(let a of oe.splice(0))a.give(r);for(let a of le.splice(0))a();let s=_;_=void 0,ye=!1;try{s?.close(1e3,t)}catch{}Re()};async function Rt(t){if(de)return;if(!c.resolveApp){yn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=pn(),a=c.resolveApp,f=N;hn("The app was changed.");try{let y=await a(t),{state:S,...h}=c,re=await Yr({...h,app:y},r,"The app was changed while your changes were on the way.",i);f&&re.remote.presence.here(f);for(let st of[...kt])st(re.remote,t);let fe=[...s>0?[ot(mn(s,"The app was changed"))]:[],...re.unheard()];for(let st of fe)for(let co of je)co(st.sentence,st)}catch(y){let S=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let h of je)h(S,ot(S))}}function yn(t){if(de)return;let{carried:r,undos:s}=pn();hn(t);let a=!1;if(c.carry&&r.length>0)try{c.carry.storage.setItem(c.carry.key,JSON.stringify(r)),a=!0}catch{}let f=[];!a&&r.length>0&&f.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),s>0&&f.push(mn(s,"This app was updated"));for(let y of f)for(let S of je)S(y,ot(y));(c.reloadPage??Yo)()}let gn=()=>{if(U||!F)return;let t=`${c.url.replace(/^http/,"ws").replace(/\/$/,"")}${Jr}`,{"content-type":r,...s}=m,a;try{a=c.socket?c.socket(t,s,[on]):so(t,s)}catch{return vn()}_=a,ye=!1,a.onopen=()=>{_===a&&a.send(JSON.stringify({t:"hello",seq:vt(C),protocol:ct,wire:rn,opFormat:qe.op,...c.build?{build:c.build.slice(0,64)}:{},...c.hostProtocol!==void 0?{hostProtocol:c.hostProtocol}:{}}))},a.onmessage=f=>{if(_!==a)return;let y;try{y=JSON.parse(String(f.data))}catch{return}eo(y)},a.onclose=()=>wn(a),a.onerror=()=>{}},ge,to=()=>{Oe=!1,ge&&clearTimeout(ge),ge=setTimeout(()=>{if(ge=void 0,Oe||U)return;let t=new Map([...q].filter(([,r])=>r.held!=="socket"));if(t.size!==q.size){q=t;for(let r of Z)r([...q.values()])}},Bt),ge.unref?.()};function wn(t){if(_!==t)return;let r=ye;_=void 0,ye=!1,ue=null,r&&(D("offline"),to()),vn()}let vn=()=>{if(U)return;let t=an(c.backoff,Ie);Ie++,Ee=setTimeout(gn,t)},bn=k.applyAll.bind(k),no=k.undo.bind(k),ro=k.previewAll.bind(k);k.previewAll=(t,r)=>ro(t,{...c.principal?{author:c.principal}:{},...r});let je=i.refusals,Je=[],ot=t=>({reason:"invalid",sentence:t}),at=i.conflicts,Tt=!1,Sn,xt=async(t,r)=>{if(r instanceof Ge||de)return;let s=r instanceof Ue?r.refusal:En(r),a=s.sentence,f=r instanceof pe?Sn?.yoursOf(k,te.get(t)?.calls??[]):void 0;ae(t);try{I([],[t])}catch{}let y=te.get(t);te.delete(t);let S=y?.calls[0];if(S&&!(r instanceof pe)){let h=k.allMutations().find(fe=>fe.name===S.name)?.subject?.arg,re=h&&k.graph.getNode(S.args[h])?.kind;Fn(k,{type:"refused",act:S.name,code:s.reason,...re?{kind:re}:{}},c.principal)}if(r instanceof pe&&O.conflicts++,r instanceof pe&&!Y()&&await ee().catch(()=>[]),r instanceof pe&&J&&await J,r instanceof pe&&at.size>0){let h=!1,re={sentence:a,conflicts:f?r.conflicts.map(fe=>fe.node===f.node&&fe.field===f.field?{...fe,yours:f.yours}:fe):r.conflicts,keepTheirs(){h=!0},useMine(){if(!(h||!y)){h=!0,Tt=!0;try{k.applyAll(f?[f.over(C)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...Fe(y)})}finally{Tt=!1}}}};for(let fe of at)fe(re);return}for(let h of je)h(a,s)},oo=(t,r)=>t.flatMap(s=>s.mutation?.name===kn?[]:s.primitives.flatMap(a=>a.op==="splice-text"&&!r.has(a.id)&&!r.has(`${a.id}\0${a.field}`)?[{node:a.id,field:a.field,rev:C}]:[]));k.applyAll=(t,r)=>{let s=Tn(k.log.all().filter(S=>G.has(S.batch))),a=bn(t,{...c.principal?{author:c.principal}:{},...r}),f=t.map((S,h)=>{let re=a.minted?.[h];return re===void 0||S.args?.id!==void 0?S:{...S,mintedHint:re}});j.push(a.batch),G.add(a.batch),te.set(a.batch,{calls:f,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Fe(r)});let y=Tt?[]:[...me.baseFor(a.ops,s,(S,h)=>k.collaborative(S,h)),...oo(a.ops,s)];return Le.set(a.batch,ke(rt({calls:f,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...Fe(r)},a.batch).catch(S=>xt(a.batch,S)))),a},k.apply=(t,r)=>k.applyAll([t],r),k.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=no(s.map(y=>P.get(y)??y),{...c.principal?{author:c.principal}:{},...r});j.push(a.batch),G.add(a.batch);let f=Promise.allSettled(s.map(y=>Le.get(y)));return Le.set(a.batch,ke(f.then(()=>{let y=s.filter(S=>!Me.has(S));if(y.length===0){ae(a.batch),te.delete(a.batch),I([],[a.batch]);return}return rt({undo:y.map(S=>P.get(S)??S),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...Fe(r)},a.batch)}).catch(y=>xt(a.batch,y)))),a};let ao=async(t,r={})=>{Ft++;try{return(await ke(rt({calls:t,...r}))).ops}finally{Ft--}},Ft=0,An={here(t){N=t,Q()},onWho(t){return Z.add(t),q.size>0&&t([...q.values()]),()=>{Z.delete(t)}},leave(){if(!N)return;let t=JSON.stringify({participant:L??N.participant});if(N=null,g({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${c.url}/graview/leave${l!==void 0?`?${ze.param}=${encodeURIComponent(l)}`:""}`,t):v(`${c.url}/graview/leave`,{method:"POST",headers:m,body:t}).catch(()=>{})}},Ot=c.pollMs??800,it=Ot>0&&typeof setInterval=="function"?setInterval(()=>{Y()||ee().catch(()=>{})},Ot):null;if(F){gn();let t;await Promise.race([_e,new Promise(r=>t=setTimeout(r,c.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!de){let t=[],r=new Set(k.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{k.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...Fe(s)})}catch(a){t.push(Io(s,a))}t.length>0&&Je.push(ot(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let Pn=new Map,io=()=>({store:k,author:c.principal,appliedAll:bn,pending:j,provisional:G,asked:te,answers:Le,letGo:Me,sent:(t,r)=>ke(rt({calls:r,batch:t},t).catch(s=>xt(t,s))),settle:ae,land:I,seen:()=>C,gone:()=>U||de});return{remote:{store:k,typing(t,r){let s=`${t}\0${r}`,a=Pn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.IEDCFSN5.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.OM2NIQWA.js")).then(f=>(Sn=f,f.typingOf(t,r,f.wireOf(io())))),Pn.set(s,a)),a},version:H.version,migrated:H.migrated??[],send:ao,pull:ee,onRefusal(t){je.add(t);let r=Je;Je=[];for(let s of r)t(s.sentence,s);return()=>je.delete(t)},onDeclaration(t){return kt.add(t),()=>kt.delete(t)},onBuild(t){return Et.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>Et.delete(t)},onConflict(t){return at.add(t),()=>at.delete(t)},revision:(t,r)=>me.of(t,r),seq:()=>C,participant:()=>L,transport:()=>Y()?"socket":"poll",status:p,onStatus(t){return x.add(t),()=>x.delete(t)},held:()=>R,onHeld(t){return i.helds.add(t),R!==void 0&&t(R),()=>i.helds.delete(t)},counters:()=>({...O}),who:()=>[...q.values()],pending:()=>j.length+Ft,async settled(){for(;He.size>0;)await Promise.allSettled([...He])},presence:An,close(){it&&clearInterval(it),Ae(),An.leave(),U=!0,Ee&&clearTimeout(Ee),ne&&clearTimeout(ne),ge&&clearTimeout(ge);for(let r of oe.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of le.splice(0))r();let t=_;_=void 0,ye=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Je;return Je=[],t}};function so(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let a=typeof globalThis.document<"u",f=c.subprotocol?[on]:[];if(!a)try{return new s(t,{headers:r,...f.length>0?{protocols:f}:{}})}catch{}let y=new URL(t);for(let[S,h]of Object.entries(E))y.searchParams.set(S,h);return l!==void 0&&y.searchParams.set(ze.param,l),f.length>0?new s(y.toString(),f):new s(y.toString())}}function Jo(e,n,o=Date.now()){let i,l=e?.trim();if(l)if(/^\d+(\.\d+)?$/.test(l))i=Number(l)*1e3;else{let v=Date.parse(l);Number.isFinite(v)&&(i=Math.max(0,v-o))}let u=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,c=u!==void 0&&u<50&&i!==void 0&&Math.abs(u*1e3-i)<1e3;return u!==void 0&&!c?u:i??1e3}function Yo(){globalThis.location?.reload?.()}function Qo(){return globalThis.document?.visibilityState!=="hidden"}function an(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:l=2}=e??{};return Math.min(i,o*l**n)*(.75+Math.random()*.5)}function At(e){let n={};if(!e)return n;e.id&&(n[ve.seat]=e.id),e.roles?.length&&(n[ve.roles]=e.roles.join(",")),e.kind!=="human"&&(n[ve.kind]=e.kind),e.name&&(n[ve.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[ve.for]=o.id),o?.roles?.length&&(n[ve.forRoles]=o.roles.join(",")),o?.name&&(n[ve.forName]=encodeURIComponent(o.name)),n}var Qr="/graview/views";function sn(e){let n=e.fetch??fetch,o=bt(e.url,e.headers),i=o.url,l={"content-type":"application/json",...e.principal?At(e.principal):{},...o.headers},u=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??dt.may}:dt,c=new Set,v=b=>{if(JSON.stringify(b)!==JSON.stringify(u)){u=b;for(let T of c)T()}},m=async(b,T)=>{let x=await n(`${i}${e.path??Qr}`,{method:b,headers:l,...T!==void 0?{body:JSON.stringify(T)}:{}}),O=await x.json();if(!x.ok)throw new Error(O.error??`The store answered ${x.status}.`);v({hidden:O.hidden??[],removed:O.removed??[],may:O.may??dt.may})},E=()=>m("GET"),F=e.state?Promise.resolve():E().catch(()=>{}),W=e.pollMs?setInterval(()=>void E().catch(()=>{}),e.pollMs):void 0;return{ready:F,refresh:E,close:()=>clearInterval(W),current:()=>u,onChange(b){return c.add(b),()=>void c.delete(b)},hide:b=>m("POST",{hide:b}),show:b=>m("POST",{show:b}),remove:(b,T)=>m("POST",{remove:b,...T?{about:T}:{}}),async restore(b){let T=u.removed.find(x=>x.name===b)?.lens;await m("POST",{restore:b}),T&&await e.onDeclaration?.()},async lens(b){await m("POST",{lens:b}),await e.onDeclaration?.()}}}var dn=document.getElementById("graview-app"),cn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),Zr=cn?(__graviewPreload(import.meta.url,["./chunk.T3JIZNE7.js","./chunk.ERPILTRY.js","./chunk.XOZU4OFA.js","./chunk.4TH3CGAZ.js","./chunk.PDS4HT46.js","./chunk.PDMX3GTL.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.6XHPBJ5F.js")):De("pages");try{cn?await Zo(decodeURIComponent(cn[1])):await Xo()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),dn.replaceChildren(n),window.__graviewFailed=n.textContent}async function Zo(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),o=await n.json();if(!n.ok)throw new Error(o.error??`The preview server did not hand over the form (${n.status}).`);let i=await mt(o);if(!i.ok)throw new Error(lt(i.findings));let l=i.app,u=o.principal,c=await St({app:l,url:location.origin,principal:u,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=l.forms?.[e]?.title??l.name;let{mount:v}=await Zr;window.__graview=v(dn,{app:l,form:e,principal:u,remote:c,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Xo(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),i=await(async m=>{if(typeof m.module=="string")return(await import(m.module)).app;let E=await mt(m);if(!E.ok)throw new Error(lt(E.findings));return E.app})(n);if(!i||typeof i!="object"||!("schema"in i))throw new Error("The app module the preview server handed does not export an app.");let l=n.principal,u=await St({app:i,url:location.origin,principal:l,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let c,v=sn({url:location.origin,principal:l,...n.views?{state:n.views}:{},onDeclaration:async()=>{let m=await(await fetch("/graview/document")).json();if(typeof m.module=="string")return;let E=await mt(m);E.ok&&c?.setApp(E.app,u)}});await Promise.all([Zr,v.ready]),c=nn(dn,{app:i,remote:u,principal:l,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:v,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=c,c.drawn().then(()=>{window.__graviewReady=!0})}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var P=["plain","editorial","shader","ascii"],k=["drift","ripple","veil","caustics"],S="graview-splash",u=/^#[0-9a-fA-F]{6}$/,F=/^[A-Za-z0-9 ,'"-]{1,200}$/,o='system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',I='Georgia, "Times New Roman", serif',h='ui-monospace, "SF Mono", Menlo, Consolas, monospace',r=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function p(e){if(!e)return;let t=e.trim();if(/^<svg[\s>]/i.test(t)&&!/<script|\bon[a-z]+\s*=|javascript:/i.test(t))return`data:image/svg+xml,${encodeURIComponent(t)}`;if(!(/^</.test(t)||/^[a-z][a-z0-9+.-]*:/i.test(t)||t.startsWith("//")))return/^[A-Za-z0-9._~/-]+$/.test(t)?t:void 0}function $(e,t){if(e)return typeof e=="string"?e:"src"in e?e.src:t==="dark"&&e.dark?e.dark:e.light}function q(e){return e?e==="system-serif"?I:e==="system-mono"?h:e==="system-sans"?o:F.test(e)?e:o:o}function C(e){let t=typeof e.ground=="string"?{light:e.ground}:e.ground??{},i=t.light&&u.test(t.light)?t.light:"#f7f7f2",l=t.dark&&u.test(t.dark)?t.dark:"#0a0f1f",n=e.accent&&u.test(e.accent)?e.accent:void 0;return{light:i,dark:l,tintLight:n??"#001769",tintDark:n??"#9aabff",inkLight:"#18213a",inkDark:"#e8ecf5"}}function E(e){return[1,3,5].map(t=>(parseInt(e.slice(t,t+2),16)/255).toFixed(3)).join(",")}function H(e,t={}){let i=e.splash;if(!i||!P.includes(i.style))return{html:"",css:"",script:""};let l=t.scheme??e.scheme??"auto",{light:n,dark:b,tintLight:m,tintDark:f,inkLight:A,inkDark:T}=C(e),c=t.title??i.title??e.name??t.name??"",v=t.kicker??i.kicker,y=i.style==="shader"?k.includes(i.shader??"")?i.shader:k[0]:void 0,g=p(i.image),d=g??(i.style==="plain"?p($(e.logo,"light")):void 0),w=g??(i.style==="plain"?p($(e.logo,"dark")):void 0),s=(_,L)=>_?`<img class="graview-splash-image" data-scheme="${L}" src="${r(_)}" alt="" decoding="async">`:"",R=i.style==="plain"?d===w?s(d,"light").replace(' data-scheme="light"',""):s(d,"light")+s(w,"dark"):s(g,"light").replace(' data-scheme="light"',""),U=`${v?`<p class="graview-splash-kicker">${r(v)}</p>`:""}<p class="graview-splash-title"${i.style==="ascii"?` data-types="${r(c)}" aria-hidden="true"`:""}>${i.style==="ascii"?"":r(c)}</p>`,D=`<div id="${S}" popover="manual" data-style="${i.style}" data-scheme="${l}"${y?` data-shader="${y}"`:""} data-tint-light="${E(m)}" data-tint-dark="${E(f)}"${t.fade===!1?' data-fade="off"':""} role="status" aria-label="${r(c)}">${R}${i.style==="ascii"?'<pre class="graview-splash-ascii" aria-hidden="true"></pre>':""}${i.style==="shader"?'<canvas class="graview-splash-canvas" aria-hidden="true"></canvas>':""}<div class="graview-splash-words">${U}</div></div>`,a=`#${S}`,x=`--gs-ground:${b};--gs-ink:${T};--gs-tint:${f};--gs-light:0`,M=[`${a}{--gs-ground:${n};--gs-ink:${A};--gs-tint:${m};--gs-light:1;position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;overflow:hidden;background:var(--gs-ground);color:var(--gs-ink);font-family:${q(e.typography?.display)};transition:opacity .28s ease}`,`${a}::backdrop{background:transparent}`,`${a}[data-scheme="dark"]{${x}}`,`@media (prefers-color-scheme: dark){${a}[data-scheme="auto"]{${x}}}`,`${a}[data-gone]{opacity:0;pointer-events:none}`,`${a} .graview-splash-words{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:flex-end;padding:clamp(24px,6vw,72px);box-sizing:border-box}`,`${a} .graview-splash-kicker{margin:0 0 .6em;font:600 clamp(12px,1.4vw,15px)/1.3 ${o};letter-spacing:.14em;text-transform:uppercase;color:var(--gs-tint)}`,`${a} .graview-splash-title{margin:0;font-size:clamp(40px,9vw,128px);font-weight:600;line-height:.95;letter-spacing:-.03em;max-width:14ch;overflow-wrap:anywhere}`,`${a} .graview-splash-image{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}`,`${a}[data-style="editorial"] .graview-splash-words,${a}[data-style="shader"] .graview-splash-words{background:linear-gradient(to top,var(--gs-ground) 0,transparent 55%)}`,`${a}[data-style="plain"] .graview-splash-words{justify-content:center;align-items:center;text-align:center}`,`${a}[data-style="plain"] .graview-splash-title{font-size:clamp(28px,5vw,56px);letter-spacing:-.02em}`,`${a}[data-style="plain"] .graview-splash-image{position:static;width:min(160px,30vw);height:auto;max-height:160px;object-fit:contain;margin:0 auto 24px}`,`${a}[data-style="plain"] .graview-splash-image[data-scheme="dark"]{display:none}`,`${a}[data-scheme="dark"][data-style="plain"] .graview-splash-image[data-scheme="light"]{display:none}${a}[data-scheme="dark"][data-style="plain"] .graview-splash-image[data-scheme="dark"]{display:block}`,`@media (prefers-color-scheme: dark){${a}[data-scheme="auto"][data-style="plain"] .graview-splash-image[data-scheme="light"]{display:none}${a}[data-scheme="auto"][data-style="plain"] .graview-splash-image[data-scheme="dark"]{display:block}}`,`${a} .graview-splash-canvas{position:absolute;inset:0;width:100%;height:100%}`,`${a}[data-style="ascii"] .graview-splash-image{visibility:hidden}`,`${a} .graview-splash-ascii{position:absolute;inset:0;margin:0;padding:0;overflow:hidden;font:12px/14px ${h};color:var(--gs-tint);opacity:.85;white-space:pre;user-select:none}`,`${a}[data-style="ascii"] .graview-splash-title{font-family:${h};font-weight:500}`,`${a}[data-style="ascii"] .graview-splash-title::after{content:"_";animation:graview-splash-blink 1s steps(2) infinite}`,"@keyframes graview-splash-blink{to{visibility:hidden}}",`@media (prefers-reduced-motion: reduce){${a}{transition:none}${a}[data-style="ascii"] .graview-splash-title::after{animation:none;content:""}}`].join(`
|
|
2
|
+
`);return{html:D,css:M,script:N}}var N=String.raw`(function(){
|
|
3
|
+
var s=document.getElementById("graview-splash");if(!s)return;
|
|
4
|
+
if(s.showPopover){try{s.showPopover()}catch(e){}}
|
|
5
|
+
var mq=window.matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null,still=!!(mq&&mq.matches),quick=still||navigator.webdriver===true||s.getAttribute("data-fade")==="off";
|
|
6
|
+
var dark=s.getAttribute("data-scheme")==="dark"||(s.getAttribute("data-scheme")==="auto"&&window.matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches);
|
|
7
|
+
var tint=(s.getAttribute(dark?"data-tint-dark":"data-tint-light")||"0,0,0").split(",").map(Number);
|
|
8
|
+
var stop=null,gone=false,t0=Date.now();
|
|
9
|
+
function go(){if(gone)return;gone=true;ob.disconnect();clearTimeout(most);if(stop)stop();if(quick){if(s.parentNode)s.parentNode.removeChild(s);return}
|
|
10
|
+
s.setAttribute("data-gone","");setTimeout(function(){if(s.parentNode)s.parentNode.removeChild(s)},320)}
|
|
11
|
+
function drawn(){return !!document.querySelector("[data-graview-drawn],[role=alert]")}
|
|
12
|
+
var ob=new MutationObserver(function(){if(drawn())go()});
|
|
13
|
+
ob.observe(document.documentElement,{attributes:true,childList:true,subtree:true,attributeFilter:["data-graview-drawn","role"]});
|
|
14
|
+
var most=setTimeout(go,15000);
|
|
15
|
+
if(drawn()){go();return}
|
|
16
|
+
var style=s.getAttribute("data-style"),img=s.querySelector(".graview-splash-image");
|
|
17
|
+
function ready(fn){if(!img){fn(null);return}if(img.complete&&img.naturalWidth)fn(img);else{img.addEventListener("load",function(){fn(img)});img.addEventListener("error",function(){fn(null)})}}
|
|
18
|
+
function loop(frame){if(still){frame(0);return}var on=true,last=0;function tick(now){if(!on)return;if(now-last>66){last=now;frame((Date.now()-t0)/1000)}requestAnimationFrame(tick)}requestAnimationFrame(tick);stop=function(){on=false}}
|
|
19
|
+
if(style==="ascii"){
|
|
20
|
+
var pre=s.querySelector(".graview-splash-ascii"),title=s.querySelector(".graview-splash-title"),words=title?title.getAttribute("data-types")||"":"";
|
|
21
|
+
var ramp=dark?" .:-=+*#%@":"@%#*+=-:. ";
|
|
22
|
+
var cv=document.createElement("canvas"),cx=cv.getContext("2d",{willReadFrequently:true});
|
|
23
|
+
ready(function(im){var cols=Math.ceil(s.clientWidth/7.2),rows=Math.ceil(s.clientHeight/14);cv.width=cols;cv.height=rows;
|
|
24
|
+
var px=null;if(im&&cx){try{var r=Math.max(cols/im.naturalWidth,rows/im.naturalHeight),w=im.naturalWidth*r,h=im.naturalHeight*r;cx.drawImage(im,(cols-w)/2,(rows-h)/2,w,h);px=cx.getImageData(0,0,cols,rows).data}catch(e){px=null}}
|
|
25
|
+
loop(function(t){var out="",p=Math.min(1,t/1.6);for(var y=0;y<rows;y++){for(var x=0;x<cols;x++){var v;if(px){var i=(y*cols+x)*4;v=(px[i]*.3+px[i+1]*.59+px[i+2]*.11)/255}else{v=.5+.5*Math.sin(x*.11+t*.6)*Math.cos(y*.19-t*.4)}
|
|
26
|
+
if(dark)v=v*p;else v=1-(1-v)*p;out+=ramp.charAt(Math.max(0,Math.min(ramp.length-1,Math.floor(v*(ramp.length-1)))))}out+="\n"}pre.textContent=out});
|
|
27
|
+
});
|
|
28
|
+
if(title&&words){if(still)title.textContent=words;else{var n=0,ty=setInterval(function(){n++;title.textContent=words.slice(0,n);if(n>=words.length)clearInterval(ty)},Math.max(30,Math.min(90,1200/words.length)));var before=stop;stop=function(){clearInterval(ty);if(before)before()}}}
|
|
29
|
+
}
|
|
30
|
+
if(style==="shader"){
|
|
31
|
+
var canvas=s.querySelector(".graview-splash-canvas"),gl=canvas&&(canvas.getContext("webgl",{premultipliedAlpha:false})||canvas.getContext("experimental-webgl"));
|
|
32
|
+
var which=s.getAttribute("data-shader")||"drift";
|
|
33
|
+
var F={drift:"vec2 d=vec2(sin(u_time*.21)*.02,cos(u_time*.17)*.02);vec2 q=(uv-.5)*(1.06-.04*u_progress)+.5+d;q+=vec2(sin(q.y*6.+u_time*.5),cos(q.x*5.-u_time*.4))*.004;vec3 c=pic(q);c=mix(c,u_tint,(1.-u_progress)*.35+.12*(1.-uv.y));",
|
|
34
|
+
ripple:"vec2 p=uv-.5;p.x*=u_resolution.x/u_resolution.y;float r=length(p);float w=sin(r*28.-u_time*2.6)*exp(-r*2.2)*.012*(1.-u_progress*.6);vec3 c=pic(uv+normalize(p+1e-5)*w);c=mix(c,u_tint,.18*(1.-u_progress)+.1*(1.-uv.y));",
|
|
35
|
+
veil:"vec3 c=pic(uv);float band=smoothstep(-.3,.3,uv.x-uv.y*.6+sin(u_time*.35)*.25-.2);c=mix(c,u_tint,(.55-.4*u_progress)*band+.1*(1.-uv.y));",
|
|
36
|
+
caustics:"vec2 p=(uv-.5)*vec2(u_resolution.x/u_resolution.y,1.)*5.;vec2 i=p;float k=1.;for(int n=0;n<4;n++){float t=u_time*.3*(1.-3.5/float(n+1));i=p+vec2(cos(t-i.x)+sin(t+i.y),sin(t-i.y)+cos(t+i.x));k+=1./length(vec2(p.x/(sin(i.x+t)/.005),p.y/(cos(i.y+t)/.005)));}k=1.17-pow(k/4.,1.4);float l=clamp(pow(abs(k),8.),0.,1.);vec3 c=pic(uv+vec2(sin(i.x),cos(i.y))*.004);c=mix(c,u_tint,(1.-u_progress)*.3+.1*(1.-uv.y));c+=l*(.18+.22*u_light)*(1.-.5*u_progress);"};
|
|
37
|
+
if(gl){
|
|
38
|
+
var vs="attribute vec2 a;void main(){gl_Position=vec4(a,0.,1.);}";
|
|
39
|
+
var fs="precision mediump float;uniform sampler2D u_image;uniform float u_time,u_progress,u_light,u_has;uniform vec2 u_resolution,u_size;uniform vec3 u_tint,u_ground;"+
|
|
40
|
+
"vec3 pic(vec2 q){if(u_has<.5){return mix(u_ground,u_tint,.25+.35*q.y);}float ra=u_resolution.x/u_resolution.y,ia=u_size.x/u_size.y;vec2 t=q;if(ra>ia){t.y=(q.y-.5)*ia/ra+.5;}else{t.x=(q.x-.5)*ra/ia+.5;}return texture2D(u_image,vec2(t.x,1.-t.y)).rgb;}"+
|
|
41
|
+
"void main(){vec2 uv=gl_FragCoord.xy/u_resolution;"+(F[which]||F.drift)+"gl_FragColor=vec4(c,1.);}";
|
|
42
|
+
function sh(type,src){var o=gl.createShader(type);gl.shaderSource(o,src);gl.compileShader(o);return gl.getShaderParameter(o,gl.COMPILE_STATUS)?o:null}
|
|
43
|
+
var v=sh(gl.VERTEX_SHADER,vs),f=sh(gl.FRAGMENT_SHADER,fs),prog=v&&f&&gl.createProgram();
|
|
44
|
+
if(prog){gl.attachShader(prog,v);gl.attachShader(prog,f);gl.linkProgram(prog)}
|
|
45
|
+
if(prog&&gl.getProgramParameter(prog,gl.LINK_STATUS)){gl.useProgram(prog);
|
|
46
|
+
var buf=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,buf);gl.bufferData(gl.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),gl.STATIC_DRAW);
|
|
47
|
+
var a=gl.getAttribLocation(prog,"a");gl.enableVertexAttribArray(a);gl.vertexAttribPointer(a,2,gl.FLOAT,false,0,0);
|
|
48
|
+
var U=function(n){return gl.getUniformLocation(prog,n)};
|
|
49
|
+
var tex=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,tex);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);
|
|
50
|
+
gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,new Uint8Array([0,0,0,255]));
|
|
51
|
+
var g=getComputedStyle(s).backgroundColor.match(/[\d.]+/g)||[0,0,0];
|
|
52
|
+
gl.uniform3f(U("u_tint"),tint[0],tint[1],tint[2]);gl.uniform3f(U("u_ground"),g[0]/255,g[1]/255,g[2]/255);gl.uniform1f(U("u_light"),dark?0:1);gl.uniform1f(U("u_has"),0);gl.uniform2f(U("u_size"),1,1);
|
|
53
|
+
ready(function(im){if(!im)return;try{gl.bindTexture(gl.TEXTURE_2D,tex);gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.UNSIGNED_BYTE,im);gl.uniform1f(U("u_has"),1);gl.uniform2f(U("u_size"),im.naturalWidth,im.naturalHeight)}catch(e){}});
|
|
54
|
+
loop(function(t){var w=s.clientWidth,h=s.clientHeight,dpr=Math.min(2,window.devicePixelRatio||1);if(canvas.width!==(w*dpr|0)||canvas.height!==(h*dpr|0)){canvas.width=w*dpr;canvas.height=h*dpr;gl.viewport(0,0,canvas.width,canvas.height)}
|
|
55
|
+
gl.uniform1f(U("u_time"),t);gl.uniform1f(U("u_progress"),Math.min(1,t/2.4));gl.uniform2f(U("u_resolution"),canvas.width,canvas.height);gl.drawArrays(gl.TRIANGLES,0,3)});
|
|
56
|
+
}else if(canvas)canvas.remove()}else if(canvas)canvas.remove();
|
|
57
|
+
}
|
|
58
|
+
})();`;export{S as SPLASH_ID,k as SPLASH_SHADERS,P as SPLASH_STYLES,H as splashHtml};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graview",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.63",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Graview command line: start a product, check its declaration, write its agent docs, serve its store, preview a document with no product and photograph its places, say whether a product is on one release, host it for an agent over MCP, apply an act to it, sync its seed, install the authoring skills. The tool; @graview/* is the framework.",
|
|
6
6
|
"keywords": [
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@graview/
|
|
33
|
-
"@graview/
|
|
34
|
-
"@graview/
|
|
35
|
-
"@graview/
|
|
36
|
-
"@graview/
|
|
32
|
+
"@graview/ship": "0.1.63",
|
|
33
|
+
"@graview/skills": "0.1.63",
|
|
34
|
+
"@graview/core": "0.1.63",
|
|
35
|
+
"@graview/guest": "0.1.63",
|
|
36
|
+
"@graview/tools": "0.1.63"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=22"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk.KHRS2SKB.js";import"./chunk.SCGF4ZPP.js";import"./chunk.25VJPUDH.js";import"./chunk.644FUGSX.js";import"./chunk.U2ISOUM2.js";import{a as L,b as R,c as N}from"./chunk.LTI5PKTS.js";import{b as T}from"./chunk.TKLYUVMR.js";import"./chunk.7LZ6JDJA.js";import"./chunk.KRFRREEW.js";import"./chunk.D4TA5XDC.js";import"./chunk.VOOOIECX.js";import"./chunk.GIW657OR.js";import"./chunk.EVEHSENK.js";import"./chunk.SBLYBRDU.js";import"./chunk.2LNSENPV.js";import"./chunk.WS7LAT4Z.js";import"./chunk.5X22RKB3.js";import"./chunk.XZUHFXME.js";import"./chunk.HJCQ6I3S.js";import"./chunk.SAYAFOF6.js";import"./chunk.R3N73BJO.js";import"./chunk.X2I3XH2E.js";import"./chunk.VX65S2FA.js";import"./chunk.747OH3EE.js";import"./chunk.E6RNMWFN.js";import"./chunk.IA5ZBMRD.js";import"./chunk.VN7I7XIO.js";import"./chunk.REH6RXNH.js";import"./chunk.MBP7VDYM.js";import"./chunk.BDTT4ENI.js";import"./chunk.WD4VPMEE.js";import"./chunk.VUAOCYG2.js";import"./chunk.5POG3G2C.js";import"./chunk.2XSIJH5J.js";import"./chunk.ZVG3DR5G.js";import"./chunk.XOZU4OFA.js";import"./chunk.LA2DMHZC.js";import"./chunk.YFVJUHAK.js";import"./chunk.ISRQQVS4.js";import"./chunk.WVUJXDXZ.js";import"./chunk.MBU7UH6J.js";import"./chunk.2QFKNTAZ.js";import"./chunk.BI6DS3PZ.js";import"./chunk.PGA5TUSN.js";import"./chunk.7R727IKU.js";import"./chunk.LQAT7FA6.js";import"./chunk.GZHZLJBF.js";import{r as C}from"./chunk.Y7H5O2SL.js";import"./chunk.OJGHDWI6.js";import"./chunk.6HZY5NRX.js";import"./chunk.UO544PZH.js";import"./chunk.4STDIZVI.js";import"./chunk.HZHNM2KI.js";import"./chunk.AVFOTYZR.js";import"./chunk.HOQMD6WQ.js";import{G as S,I as $,T as p,ba as x,da as A}from"./chunk.N7T7VB77.js";import"./chunk.SDO3U72B.js";import{ad as k,fa as h}from"./chunk.F7PIW2EM.js";import"./chunk.FQLNBIQ5.js";import{b as i}from"./chunk.AJZBJBMO.js";var r=i(S(),1);var l=i(S(),1);var g=i(p(),1);var m={font:"inherit",fontSize:"0.875rem",minHeight:24,padding:0,border:0,borderRadius:2,background:"transparent",boxShadow:"none",color:"var(--graview-accent)",textDecoration:"underline",textUnderlineOffset:3,textAlign:"start",cursor:"pointer"};var e=i(p(),1);function Q({page:n=!1,go:E,onPick:y,onDiscard:D}){let{store:d,seatTalk:c}=x(),u=$(c),M=N(),b=E??M,{keep:P}=L(b),[H,f]=(0,r.useState)(!1);A();let t=u.draft;(0,r.useEffect)(()=>f(!1),[t]),(0,r.useEffect)(()=>{n||R(!1)},[n]);let v=(0,r.useRef)(null),w=t!==null&&!n;if((0,r.useLayoutEffect)(()=>{let s=v.current;if(!w||!s?.parentElement)return;let o=[];for(let a=s.previousElementSibling;a;a=a.previousElementSibling)a instanceof HTMLElement&&!a.inert&&a.tagName!=="STYLE"&&(a.inert=!0,o.push(a));return()=>{for(let a of o)a.inert=!1}},[w]),!t)return null;let G=T(t.drawn),F=d.schema.tryDefinition(t.kind),q=d.graph.nodesOfKind(t.kind).filter(s=>h(F,s)),z=()=>{c.setDraft(null),D?.()};return(0,e.jsxs)("section",{ref:v,"data-testid":"draft-frame","data-graview-draft-frame":n?"page":"scene","aria-label":`Draft: ${t.title}`,style:n?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:12,zIndex:k("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:12,boxShadow:"var(--graview-lift-high)",overflow:"hidden",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...K,...n?{}:{padding:"10px 16px"}},children:[n?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:H,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{f(!0),P(t).finally(()=>f(!1))},style:m,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:z,style:m,children:"Discard"})]}),u.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:n?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:u.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,role:"group","aria-label":t.title,tabIndex:0,style:n?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:s=>{let o=s.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!o||!d.graph.getNode(o))return;s.preventDefault();let a=d.graph.getNode(o);y?(c.setDraft(null),y(o)):b({to:"record",id:o,kind:a.kind,label:o,address:"",said:""})},children:(0,e.jsx)(C,{kind:t.kind,view:t.title,children:(0,e.jsx)(G,{nodes:q,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var K={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};export{Q as DraftFrame};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as Z,b as qe}from"./chunk.KHRS2SKB.js";import"./chunk.SCGF4ZPP.js";import"./chunk.644FUGSX.js";import"./chunk.U2ISOUM2.js";import{j as De,k as Ne,l as Oe}from"./chunk.D4TA5XDC.js";import"./chunk.SBLYBRDU.js";import"./chunk.5X22RKB3.js";import"./chunk.XZUHFXME.js";import"./chunk.HJCQ6I3S.js";import"./chunk.SAYAFOF6.js";import"./chunk.R3N73BJO.js";import"./chunk.X2I3XH2E.js";import"./chunk.VX65S2FA.js";import{a as We,b as S}from"./chunk.747OH3EE.js";import{a as X,b as $e}from"./chunk.E6RNMWFN.js";import"./chunk.VN7I7XIO.js";import"./chunk.MBP7VDYM.js";import"./chunk.WD4VPMEE.js";import"./chunk.VUAOCYG2.js";import"./chunk.5POG3G2C.js";import{b as Pe,c as Le}from"./chunk.2XSIJH5J.js";import"./chunk.ZVG3DR5G.js";import"./chunk.XOZU4OFA.js";import"./chunk.LA2DMHZC.js";import"./chunk.YFVJUHAK.js";import"./chunk.ISRQQVS4.js";import"./chunk.MBU7UH6J.js";import"./chunk.2QFKNTAZ.js";import"./chunk.BI6DS3PZ.js";import"./chunk.PGA5TUSN.js";import"./chunk.7R727IKU.js";import"./chunk.LQAT7FA6.js";import{u as Re}from"./chunk.Y7H5O2SL.js";import"./chunk.OJGHDWI6.js";import"./chunk.6HZY5NRX.js";import"./chunk.UO544PZH.js";import{l as ze}from"./chunk.4STDIZVI.js";import{c as Ce}from"./chunk.HZHNM2KI.js";import{j as Ie}from"./chunk.AVFOTYZR.js";import"./chunk.HOQMD6WQ.js";import{G as ot,Ma as J,Ra as He,T as Me,Va as Ee,ba as O,h as Ae,u as Te}from"./chunk.N7T7VB77.js";import"./chunk.SDO3U72B.js";import{Fb as be,ad as Se,na as Q,oa as N,xc as xe,zc as ke}from"./chunk.F7PIW2EM.js";import"./chunk.FQLNBIQ5.js";import{b as Y}from"./chunk.AJZBJBMO.js";var a=Y(ot(),1);var t=Y(Me(),1);function wt(u,r,o){let c=r.on??r.about[r.about.length-1];De(u,r.about,{...o,pins:Z(),...c===void 0?{}:{focus:c}})}function bt({placement:u="float",chosen:r=!0}={}){let{menuAt:o}=O();return u==="menu"&&o===null?r?(0,t.jsx)(at,{}):null:(0,t.jsx)(lt,{placement:u})}function at(){let{store:u,setMenuAt:r,view:o}=O(),{selection:c}=J(),h=(0,a.useRef)(null),[E,y]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let b=h.current?.offsetParent??h.current?.parentElement;if(!b)return;let m=Math.round(b.getBoundingClientRect().width);m!==E&&y(m)});let v=c.length===1&&!o.overview?u.graph.getNode(c[0]):void 0;return!v||E===null||E>=Be?(0,t.jsx)("span",{ref:h,hidden:!0}):(0,t.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${S(u,v.id)}`,"aria-haspopup":"menu",onClick:b=>{let m=b.currentTarget.getBoundingClientRect();r({x:Math.round(m.right),y:Math.round(m.bottom+4),on:v.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var Be=564;function lt({placement:u}){let{store:r,menuAt:o,setMenuAt:c,view:h,signIn:E}=O(),y=(0,a.useRef)(null),v=(0,a.useRef)(null),b=(0,a.useRef)(null),m=(0,a.useRef)(null);o?.returnTo&&(m.current=o.returnTo);let Ke=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),n=e.getAttribute("data-pin-for"),d=i??e.getAttribute("data-affordance")??(n===null?null:`pin:${n}`)??e.getAttribute("data-menu-item");v.current=d===null?null:{key:d,element:e}};(0,a.useEffect)(()=>{let e=y.current,i=v.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let n=i.key;if(!e){v.current=null;let k=m.current;m.current=null,(k?.isConnected?k:b.current)?.focus();return}((n.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(n.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(n)}"]:not([disabled])`)??e).focus()});let[_e,je]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let e=y.current?.offsetParent??y.current?.parentElement;if(e instanceof HTMLElement&&(b.current=e),!e)return;let i=e.getBoundingClientRect();je(n=>n&&n.left===i.left&&n.top===i.top&&n.width===i.width&&n.height===i.height?n:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Ue,set:Ve,clear:Ge}=J(),s=o?.about??Ue,[q,Ye]=(0,a.useState)(()=>Z()),F=o?.on??s[s.length-1],B=o?.about,Qe=(0,a.useMemo)(()=>({pins:q,...F===void 0?{}:{focus:F},...B?{about:B}:{}}),[q,F,B]),Je=(0,a.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:g,withheld:ee,observations:te}=Ne(Qe),I=ke(ee,E),f=I?st:ee,Xe=o===null?null:{face:o.face??"scene",on:o.on,about:s,field:o.field,place:o.place,href:o.href,act:o.act,element:o.returnTo},ne=Re(Xe),ie=te.some(e=>e.id.startsWith("schema:waits:")),{apply:Ze,preview:et}=Oe(),[C,z]=(0,a.useState)(null),[tt,re]=(0,a.useState)(!1),[oe,ae]=(0,a.useState)(!1),[L,R]=(0,a.useState)(""),nt=$e({letters:!0}),[le,K]=(0,a.useState)(null),_=(0,a.useRef)([]),j=(e,i)=>{try{return et(e,i),Ze(e,i),K(null),c(null),_.current=[],!0}catch(n){return K(ze(r.schema,r.allMutations(),n)),_.current=n instanceof be?n.issues.map(d=>String(d.path[0]??"")).filter(Boolean):[],!1}},$=[...new Set(s.flatMap(e=>{let i=r.graph.getNode(e);return i?[i.kind]:[]}))],x=$.length>0?$:[...new Set(s.flatMap(e=>Te(e)))],p=s.length===1?Ae(s[0]):null,U=p?{from:r.graph.getNode(p.from),to:r.graph.getNode(p.to)}:null,se=p?Le(r,p):void 0,de=se?.provisional?se:void 0,ue=p?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(p.from)?.kind??"")?.edges?.[p.kind],i=r.graph.getNode(p.to);return e?.inverse&&i?`From ${S(r,i.id)}: ${e.inverse}`:null})():null;(0,a.useEffect)(()=>{z(null),re(!1),ae(!1),K(null),R("")},[s,o?.about]);let l=o!==null,it=u==="menu"&&!l,A=(0,a.useRef)(o);A.current=o;let pe=Ee("acts",{open:l&&u==="menu",onOpenChange:e=>{e||c(null)},at:()=>A.current?{x:A.current.x,y:A.current.y}:null,returnTo:()=>{let e=A.current?.returnTo;if(e?.isConnected)return e;let i=A.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),ce=(_e?.width??Number.POSITIVE_INFINITY)<Be;if((0,a.useLayoutEffect)(()=>{let e=y.current?.offsetParent;if(!e||!ce||l)return;let i=y.current?.getBoundingClientRect().height??0,n=`${Math.round(i)+20}px`;if(e.style.paddingBottom===n)return;let d=e.style.paddingBottom;return e.style.paddingBottom=n,()=>{e.style.paddingBottom=d}}),s.length===0&&!l)return null;let ge=o?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),he=Math.max(1,Math.min(9,g.length)),T=[...g.filter(e=>e.provider==="invariant"&&!e.destructive),...g.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...g.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...g.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...g.filter(e=>e.destructive)],me=T.length>he&&!l,fe=L.trim().toLowerCase(),w=me&&fe.length>0?T.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(fe)):null,V=w??(tt||l?T:T.slice(0,he)),ye=w?0:T.length-V.length,W=[];for(let e of V){let i=!l&&e.provider==="invariant",n=!l&&!i&&e.pinned!==void 0&&!e.destructive,d=!l&&!i&&!n&&e.ties===!0&&!e.destructive,k=i?e.why:n?"pinned":d?"its ties":null,D=i?"violation":n||d?"ties":null,H=W[W.length-1];H&&H.heading===k?H.items.push(e):W.push({heading:k,tone:D,items:[e]})}let G=g.find(e=>e.id===C),P=s.length===1?S(r,s[0]):null,ve=e=>{if(!P)return e;let i=e.startsWith(`"${P}"`)?e.slice(P.length+2):e.startsWith(P)?e.slice(P.length):null;if(i===null)return e;let n=i.trimStart();return n.length===0?e:n[0].toUpperCase()+n.slice(1)},rt=new Set(l?[]:V.filter(e=>e.provider==="invariant").map(e=>e.why)),M=te.filter(e=>!rt.has(e.text)).map(e=>({...e,text:ve(e.text)}));return it?null:(0,t.jsxs)("section",{...l?pe.pane:{},ref:e=>{y.current=e,l&&pe.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>Ke(e.target),onBlur:e=>{e.relatedTarget!==null&&(v.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?He:{position:"absolute",zIndex:Se("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...l?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:ce?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,t.jsx)("h2",{style:{...Ie,margin:0},children:"Inspector"}),(0,t.jsxs)("div",{style:{display:ge||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[ge?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:o?.title??(s.length===1?S(r,s[0]):`${s.length} selected`)}),$.length>0||p?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:p?"relation":$.map(e=>N(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!p&&o?.face!=="pages"?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(s[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,t.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,t.jsx)("button",{type:"button",onClick:()=>{c(null),Ge()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),p&&U?(0,t.jsxs)("div",{style:{display:"grid",gap:6},children:[ue?(0,t.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ue}):null,de?(0,t.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Pe(de)}):null,(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",U.from],["to",U.to]].map(([e,i],n)=>(0,t.jsxs)(a.Fragment,{children:[n===1?(0,t.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,t.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>Ve([i.id]),title:`Select ${S(r,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:S(r,i.id)}):(0,t.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!p&&s.length===1&&xe(r,s[0])?(0,t.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,M.length>0?(0,t.jsx)("div",{"data-testid":"observations",title:M.map(e=>e.text).join(`
|
|
2
|
-
`),style:{display:"grid",gap:3},children:M.slice(0,2).map(e=>(0,t.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===M[1]&&M.length>2?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",M.length-2]}):null]},e.id))}):null,l?ne.start.map(e=>(0,t.jsx)(Fe,{section:e,close:()=>c(null)},e.id)):null,le?(0,t.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:le}):null,me?(0,t.jsx)("input",{"data-testid":"action-filter",value:L,onChange:e=>R(e.target.value),placeholder:`Filter ${T.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),L.length>0?R(""):e.currentTarget.blur();return}if(e.key==="Enter"&&w?.length===1){let i=w[0];if(i.destructive)return;i.open.length>0?z(i.id):j(i)&&R("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,w!==null&&w.length===0?(0,t.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",L.trim(),"\u201D."]}):null,I&&g.length===0||g.length===0&&!ie&&s.length===0?null:g.length===0&&!ie?(0,t.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:f.length>0?`Nothing you may do with ${p?"this relation":x.length===1?Q(N(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} \u2014 ${f.length} action${f.length===1?"":"s"} withheld.`:p?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${Ce(r.schema,r.graph.getNode(p.from)?.kind??"",p.kind,"out")}\u201D.`:`Nothing can be done with ${x.length===1?Q(N(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${x.length===1?"it":"them"}.`}):(0,t.jsxs)("ol",{...nt,"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[W.map((e,i)=>(0,t.jsxs)(a.Fragment,{children:[e.heading?(0,t.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:i>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?ve(e.heading):e.heading]}):i>0?(0,t.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},onKeyDown:d=>{if(d.metaKey||d.ctrlKey||d.altKey)return;let k=d.currentTarget.querySelector("[data-affordance]"),D=d.currentTarget.querySelector("[data-pin-for]"),H=d.target===D,we=d.key==="ArrowRight"&&!H?D:H&&["ArrowLeft","ArrowUp","ArrowDown"].includes(d.key)?k:null;we&&(d.preventDefault(),d.stopPropagation(),we.focus())},children:[(0,t.jsxs)("button",{type:"button",[X]:"","data-affordance":n.id,"data-rank":n.rank,"data-graview-destructive":n.destructive||void 0,"aria-pressed":C===n.id,title:n.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:C===n.id?"var(--graview-accent)":l?"transparent":"var(--graview-edge)",background:l?"none":"var(--graview-panel)",boxShadow:"none",...n.destructive?{color:"var(--graview-warn)"}:{},...C===n.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(n.open.length>0){z(C===n.id?null:n.id);return}j(n)},children:[n.label,n.open.length>0?(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,w?.length===1&&w[0]?.id===n.id&&!n.destructive?(0,t.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,t.jsx)("button",{type:"button","data-testid":"pin-toggle",tabIndex:-1,"data-pin-for":n.mutation,"aria-pressed":n.pinned!==void 0,"aria-label":n.pinned!==void 0?`Unpin ${n.label}`:`Pin ${n.label}`,title:n.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":n.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Ye(qe(q,n.mutation,Je.has(n.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:n.pinned==="user"?"var(--graview-accent)":n.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:n.pinned!==void 0?"\u2605":"\u2606"})]},n.id))]},`${e.heading??"plain"}-${i}`)),ye>0?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",[X]:"",onClick:()=>re(!0),title:`Show all ${g.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",ye," more"]})}):null]}),I?(0,t.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{c(null),I.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left"},children:I.label}):null,f.length>0?(0,t.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[f.slice(0,l||oe?f.length:3).map(e=>(0,t.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,t.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,t.jsx)("s",{children:e.label})}),(0,t.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!l&&!oe&&f.length>3?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>ae(!0),title:`Show all ${f.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",f.length-3," more withheld"]})}):null]}):null,l?ne.end.map(e=>(0,t.jsx)(Fe,{section:e,close:()=>c(null)},e.id)):null,G?(0,t.jsx)(We,{affordance:G,onApply:e=>{if(j(G,e))z(null);else return _.current},onCancel:()=>z(null)}):null]})}var st=[];function Fe({section:u,close:r}){return(0,t.jsxs)("div",{"data-menu-section":u.id,...u.heading?{role:"group","aria-label":u.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[u.heading?(0,t.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:u.heading}):null,u.items&&u.items.length>0?(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:u.items.map(o=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-menu-item":o.id,onClick:()=>{r(),o.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},children:[o.label,o.hint?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",o.hint]}):null]})},o.id))}):null,u.render?.(r)]})}export{bt as InspectorPane,wt as prepareActs};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as L,b as M}from"./chunk.25VJPUDH.js";import{a as I}from"./chunk.6DOOLVT4.js";import{e as T,f as N,g as z}from"./chunk.VX65S2FA.js";import{b as O}from"./chunk.747OH3EE.js";import"./chunk.E6RNMWFN.js";import"./chunk.VN7I7XIO.js";import"./chunk.MBP7VDYM.js";import{a as R}from"./chunk.2XSIJH5J.js";import"./chunk.UO544PZH.js";import"./chunk.4STDIZVI.js";import"./chunk.HZHNM2KI.js";import{j as h}from"./chunk.AVFOTYZR.js";import"./chunk.HOQMD6WQ.js";import{G as P,Ra as D,T as W,Va as E,ba as x,da as A,ja as C}from"./chunk.N7T7VB77.js";import"./chunk.SDO3U72B.js";import{_a as H}from"./chunk.F7PIW2EM.js";import"./chunk.FQLNBIQ5.js";import{b as S}from"./chunk.AJZBJBMO.js";var i=S(P(),1);var e=S(W(),1);function G(t,a){let d=[t>0?`${t===1?"one suggestion":`${t} suggestions`} waiting`:"",a>0?`tidied ${a===1?"one thing":`${a} things`} while you were away`:""].filter(Boolean);return d.length>0?d.join(" \xB7 ").replace(/^./,u=>u.toUpperCase()):void 0}function Q(){let{store:t,principal:a,dismissals:d,whileAway:u,app:r}=x(),m=A(),g=(0,i.useMemo)(()=>M(d,r?.name??"app",a),[d,r?.name,a]),[w,y]=(0,i.useReducer)(l=>l+1,0);(0,i.useEffect)(()=>g.onChange?.(y),[g]);let n=(0,i.useMemo)(()=>T(t,a,{dismissed:g.list()}),[t,a,m,g,w]),[f,v]=(0,i.useState)(""),o=E("suggested"),s=C(),p=l=>t.graph.has(l)?q=>{o.setOpen(!1),s.record(q)}:null,b=u?.tidied??0,c=u?G(n.length,b):void 0;if(n.length===0&&b===0)return null;let $=l=>{if(v(l),n.length>1){requestAnimationFrame(()=>document.querySelector('[data-testid="suggested"] [data-testid="suggestion-accept"]')?.focus());return}o.setOpen(!1),(document.querySelector('[data-testid="activity-button"]')??document.querySelector('[data-graview-app-bar] button:not([data-testid="suggested-button"])'))?.focus()};return(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"suggested-button",...o.trigger,onClick:o.toggle,title:c??"What tidying suggests, waiting for you",...c?{"aria-label":`Suggested: ${c}`}:{},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:[n.length>0?n.length:`Tidied ${b}`,(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),n.length>0?(0,e.jsx)("span",{className:"graview-activity-word",children:" Suggested"}):null]}),o.open?(0,e.jsxs)("section",{...o.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...D,width:"min(320px, calc(100vw - 16px))",maxHeight:"min(52cqh, 460px)",overflowX:"hidden",overflowY:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...h,margin:0},children:"Suggested"}),c?(0,e.jsxs)("p",{"data-testid":"while-away",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[c,"."]}):null,(0,e.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:n.length>0?"Not made yet: each waits for you.":"What it did is in Activity."}),(0,e.jsx)("ol",{"data-testid":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:10,fontSize:"0.8125rem",minWidth:0},children:n.map(l=>(0,e.jsx)(B,{suggestion:l,notNow:g,settled:$,goes:p},l.id))}),(0,e.jsx)("span",{role:"status","data-testid":"suggestion-heard",style:h,children:f})]}):null]})}var k={minWidth:0,overflowWrap:"anywhere"},Y={accept:"Accepted.",decline:"Declined: it will not be suggested again.",later:"Hidden from you until tomorrow."};function B({suggestion:t,notNow:a,settled:d,goes:u}){let{store:r,principal:m,seats:g,people:w}=x(),[y,n]=(0,i.useState)(null),f=(0,i.useId)(),v=H(t.author,{graph:r.graph,schema:r.schema,seats:g,people:w}),o=async s=>{n(null);try{s==="accept"?N(r,t.id,{author:m}):s==="decline"?z(r,t.id,{author:m}):await a.dismiss({suggestion:t.id,at:new Date().toISOString(),until:L()}),d(Y[s])}catch(p){n(p instanceof Error?p.message:String(p))}};return(0,e.jsxs)("li",{"data-testid":"suggestion","data-suggestion":t.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:5,lineHeight:1.45,minWidth:0},children:[(0,e.jsxs)("span",{"data-graview-suggestion-words":"",style:k,children:[(0,e.jsx)("strong",{style:{fontWeight:600},children:v})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," ",t.intent]}),t.lineage?(0,e.jsx)("span",{"data-graview-lineage":"",style:{...k,color:"var(--graview-ink-faint)"},children:R(t.lineage)}):null,t.about.length>0?(0,e.jsx)("div",{"data-graview-suggestion-records":"",style:{display:"flex",flexWrap:"wrap",gap:4,minWidth:0},children:t.about.slice(0,4).map(s=>(0,e.jsx)(I,{id:s,label:O(r,s),go:u(s),testId:"suggestion-record"},s))}):null,(0,e.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:6,minWidth:0},children:[(0,e.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>void o("accept"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Accept"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>void o("decline"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-not-now",onClick:()=>void o("later"),title:"Hide it from you until tomorrow. It still waits for everyone else.","aria-describedby":f,style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem",marginInlineStart:"auto",border:"1px solid transparent",background:"transparent",boxShadow:"none",color:"var(--graview-ink-muted)"},children:"Not now"}),(0,e.jsx)("span",{id:f,style:h,children:"Hides it from you until tomorrow; it still waits for everyone else."})]}),y?(0,e.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{...k,fontSize:"0.75rem",color:"var(--graview-warn)"},children:y}):null]})}export{Q as SuggestedTray,G as awayWords};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{G as h}from"./chunk.N7T7VB77.js";import{Bc as a,Nc as m,ud as u}from"./chunk.F7PIW2EM.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function g(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.publishing?{publishing:e.publishing}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{g as a,k as b,v as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as U,b as Y,c as G,d as D}from"./chunk.6SO64TUI.js";import"./chunk.AVFOTYZR.js";import"./chunk.HOQMD6WQ.js";import{G as ae,O as L,P as F,T as V,ca as _}from"./chunk.N7T7VB77.js";import"./chunk.SDO3U72B.js";import{T as H,Za as K,_a as B,ad as M}from"./chunk.F7PIW2EM.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";function O(n,t){let r=K(n);return r==="agent"?"agent":r!=="human"&&r!=="visitor"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var re=n=>n.ops.filter(t=>t.withheld!==!0);function X(n,t={}){let r=[];for(let e of n.batches()){let s=e.ops[0],d=e.ops.at(-1),l=re(e).length===0,h=l?void 0:Y(e.ops),c=r.at(-1);if(h&&c?.typed&&c.author&&U(c.author,e.author)&&c.typed.node===h.node&&c.typed.field===h.field){let S=G(c.typed,h);r[r.length-1]={...c,seq:d.seq+1,at:d.at,batch:e.id,batches:[...c.batches??[],e.id],typed:S,said:D(S,n.schema,n.graph,!1)};continue}r.push({seq:d.seq+1,from:s.seq,at:d.at,batch:e.id,maker:l?"person":O(e.author,t.me),author:l?void 0:e.author,said:h?D(h,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:l,...h?{batches:[e.id],typed:h}:{}})}let i=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of i){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let s=r.findIndex(d=>d.seq===e.seq);if(s>=0&&!r[s].withheld){r[s]={...r[s],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?O(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,s)=>e.seq-s.seq||+(e.batch!==void 0)-+(s.batch!==void 0))}function J(n,t){let r=n.log.all(),i=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(s=>s.undoes!==void 0&&(i.get(s.undoes)??-1)>=t)).map(e=>e.id)}function Q(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?B(n.author,t):"the app"}var p=R(ae(),1);var o=R(V(),1),oe={kind:"human"},ie=[1,2,4,8],se=900,E={you:"You",person:"A person",agent:"An agent",app:"The app"},Z={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function de(n,t,r){return[...new Set([...r,t,...n.map(i=>i.seq)])].sort((i,e)=>i-e)}function le(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":O(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ce(n,t){let r=0;for(let i=0;i<n.length;i++)n[i]<=t&&(r=i);return r}function pe(n,t,r){let i=J(n,t);if(i.length===0)return null;let e=n.canUndo(i);if(!e.ok)return null;let s=new Set(n.permittedMutations(r).map(d=>d.name));return e.ops.every(d=>d.mutation!==null&&s.has(d.mutation.name))?i:null}function we({face:n}){let t=L(),r=_(),i=r?.principal??oe,e=F(t.live,i),s=e.log.length,d=(0,p.useMemo)(()=>X(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),l=e.log.horizon,h=l>0&&t.host?.archived!==void 0,c=t.kept,S=(0,p.useMemo)(()=>h?c?.stops??Array.from({length:l},(a,g)=>g):[],[h,c,l]),m=(0,p.useMemo)(()=>de(d,l,S),[d,l,S]),f=t.archive,y=f?.seq??t.past?.seq??s,x=t.host?.kept&&(f?.behindKept||c!==void 0&&(y<=c.through||c.from>0&&y<=c.from))?t.host.kept:void 0,w=ce(m,y),b=m.length-1,j=y<l&&t.past?.seq===y?t.past.store.log.all().at(-1):void 0,q=j?le(j,i):y<l?void 0:[...d].reverse().find(a=>a.seq<=y&&a.seq>(m[w-1]??-1))??[...d].reverse().find(a=>a.seq<=y),[k,A]=(0,p.useState)(!1),[T,ee]=(0,p.useState)(1),[C,W]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!k)return;if(w>=b){A(!1);return}let a=setTimeout(()=>t.show(m[w+1]),se/T);return()=>clearTimeout(a)},[k,w,b,T,m,t]);let z=(0,p.useMemo)(()=>t.past&&!f&&y>=l?pe(e,y,i):null,[t.past,f,e,y,l,i,s]),N=a=>Q(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),v=t.past?t.past.at?H(t.past.at,r?.locale):"the start":null,$=f?f.refused?"The archive could not be read":f.behindKept?"Nothing this far back is kept":"Reading the older changes from the archive\u2026":q?`${N(q)==="you"?"You":N(q)}: ${q.said}`:"Nothing had happened yet",I=(0,p.useRef)(null);(0,p.useLayoutEffect)(()=>{let a=I.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let P=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return P?.observe(a),()=>{P?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let te=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:M("rail")}:{position:"sticky",top:0,zIndex:M("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:I,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...te,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,o.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:f?"Archived changes":v?`As of ${v}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:$}),v?(0,o.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,o.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[h?(0,o.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${b===0?0:m.indexOf(l)/b*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,m.slice(1).map((a,g)=>{let u=[...d].reverse().find(ne=>ne.seq===a);if(!u)return null;let P=b===0?0:(g+1)/b*100;return(0,o.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${E[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${P}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":Z[u.maker],opacity:a<=y?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:b,step:1,value:w,"aria-valuetext":v?`As of ${v}. ${$}`:`Now. ${$}`,onChange:a=>{A(!1),t.show(m[Number(a.currentTarget.value)]??s)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{type:"button","data-testid":"play","aria-pressed":k,onClick:()=>{!k&&w>=b&&t.show(m[0]),A(!k)},style:{minHeight:28,minWidth:64},children:k?"Pause":"Play"}),(0,o.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,o.jsx)("select",{"data-testid":"speed",value:T,onChange:a=>ee(Number(a.currentTarget.value)),style:{minHeight:28},children:ie.map(a=>(0,o.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(E).filter(a=>d.some(g=>g.maker===a)).map(a=>(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:Z[a]}}),E[a]]},a))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[z?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{W(null);try{e.undo([...z],{author:i,intent:v?`Restore to ${v}`:"Restore"}),t.show(null)}catch(a){W(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,o.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),C?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:C}):null,f?.refused?(0,o.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,x?(0,o.jsxs)("span",{"data-testid":"timeline-kept",style:{color:"var(--graview-ink-faint)"},children:[x.sentence,x.action?(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsx)("a",{"data-testid":"timeline-kept-action",href:x.action.href,style:{color:"var(--graview-ink-muted)"},children:x.action.label})]}):null]}):null,l>0&&!h?(0,o.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{we as Timeline};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as mt}from"./chunk.ISRQQVS4.js";import{a as pt}from"./chunk.PGA5TUSN.js";import{f as dt}from"./chunk.7R727IKU.js";import{a as F,f as q}from"./chunk.LQAT7FA6.js";import{F as Q,I as X,K as k,Q as G,T as tt,Tb as ft,V as nt,W as et,ba as rt,da as M,ga as _,ja as ot,kb as lt,ma as at,nb as ut,oa as st,sd as ct}from"./chunk.F7PIW2EM.js";import{e as it}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function J(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let s=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!s}),n=r.as==="open"}return e}function D(t,e){return J(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function Et(t){return D(t,!1)}function Pt(t){return D(t,!0)}function yt(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function z(t){let e=u=>J(u).map(({part:o,space:a})=>({...o,space:a})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,s=u=>`${D(n,u)}${r?`, when ${D(r,u)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:s(!1),said:s(!0)}}function Lt(t,e=!1){return t.line?yt(t.line,e):t.message}var gt=60,O=t=>({text:t,as:"name"}),c=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},L=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},R=(t,e)=>({text:t,as:"op",said:e}),v={text:"(",as:"open"},w={text:")",as:"close"},N={text:"\u2014",as:"value",said:"empty"},V={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},B={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},At={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},xt=t=>t.t==="binary"&&t.op in V;function I(t){return rt(t)}function bt(t){let{schema:e}=t,n=l=>l===null?void 0:e.tryDefinition(l),r=(l,m)=>{let g=n(l)?.edges;return g&&Object.hasOwn(g,m)?g[m]:void 0},s=(l,m)=>{let g=r(l,m)?.to;return Array.isArray(g)&&g.length===1?g[0]:null},u=(l,m)=>{let g=(e.edge(m)?.from??[]).filter(W=>{let K=r(W,m)?.to;return l===null||K==="*"||Array.isArray(K)&&K.includes(l)});return g.length===1?g[0]:null},o=(l,m)=>r(l,m)?M(m).toLowerCase():I(at(n(l),m)),a=l=>I(ot(e,l)),d=l=>I(dt(e).get(l)?.label??M(l)),b=l=>I(st(n(l),l)),i=(l,m)=>{let g=l===null?void 0:t.formatOf?.(l,m);if(g?.format)return g;let W=t.said?.get(m);return W?{...g,format:W}:g},p=l=>_(e.tryDefinition(l.kind),l),h=t.money?.locale,y=(l,m)=>{if(l==null)return N;if(l instanceof F){if(l.nodes.length===0)return N;let A=l.nodes.slice(0,3).map(p),Y=l.nodes.length-A.length;return L(Y>0?`${A.join(", ")} and ${Y} more`:A.length>1?`${A.slice(0,-1).join(", ")} and ${A[A.length-1]}`:A[0])}if(Array.isArray(l))return L(`{${l.map(A=>y(A,m).text).join(", ")}}`,l.map(A=>y(A,m).text).join(" or "));if(typeof l=="object")return L(p(l));if(typeof l=="boolean")return L(l?"yes":"no");let g=m?.format??(m?i(m.kind,m.key):void 0);if(typeof l=="number")return L(g&&g.format!=="date"?ft(l,{...t.money,...g}):et(l,h));if(Q.test(l)||g?.format==="date")return L(G(nt(l,t.money?.timeZone)??l.slice(0,10),h));if(X.test(l))return L(tt(l,h,t.money?.timeZone));let W=m&&m.kind!==null?n(m.kind)?.display?.format?.[m.key]:void 0;if(W)return L(W(l));let K=l.length>gt?`${l.slice(0,gt-1).trimEnd()}\u2026`:l;return L(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test(K)?K.replace(/[-_]+/g," "):K)};return{definition:n,relation:r,farOf:s,nearOf:u,fieldName:o,plural:a,noun:b,factName:d,formatOf:i,valueWords:y,locale:h}}function P(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:E(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=E(t.args[0],e,n),s=t.args[1];if(s.t==="ident")return{kind:r,key:s.name};if(s.t==="lit"&&typeof s.value=="string")return{kind:r,key:s.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return P(t.left,e,n)??P(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return P(t.args[1],e,n)??P(t.args[2],e,n)}function E(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(E(t.object,e,n),t.name);case"where":return E(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?E(t.left,e,n):null;case"call":{let r=s=>{let u=t.args[s];return u?.t==="lit"&&typeof u.value=="string"?u.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(E(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(E(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?E(t.args[0],e,n):null}default:return null}}function j(t){return t.t==="binary"?t.op==="||"?H(t)?4:1:t.op==="&&"?2:t.op in V||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var $=t=>t.t==="lit",x=(t,e)=>t.t==="call"&&t.fn===e;function C(t,e){return t.t==="binary"&&t.op===e?[...C(t.left,e),...C(t.right,e)]:[t]}function H(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...C(t,"||"));let n,r=[];for(let s of e){if(s.t!=="binary"||s.op!=="=="||!$(s.right)||typeof s.right.value!="string"||n&&JSON.stringify(ht(n))!==JSON.stringify(ht(s.left)))return;n=s.left,r.push(s.right)}return n?{subject:n,values:r}:void 0}var ht=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function f(t,e,n,r){let s=(u,o,a=e)=>j(u)<o?[v,...f(u,a,n),w]:f(u,a,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(u=>u.t==="lit"?u.value:null),r)];case"ident":return[O(n.fieldName(e,t.name))];case"member":{let u=x(t.object,"first")&&t.object.args[0]&&x(t.object.args[0],"all"),o=E(t.object,e,n);if(u&&o)return e!==null&&n.fieldName(e,t.name)===n.fieldName(o,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[O(`${n.noun(o)}'s ${n.fieldName(o,t.name)}`)]:[O(n.fieldName(o,t.name))];let a=f(t.object,e,n),d=a[a.length-1];return a.length===1&&d?.as==="name"?[O(`${d.text}'s ${n.fieldName(o,t.name)}`)]:[...a,c("'s"),O(n.fieldName(o,t.name))]}case"unary":return t.op==="-"?[R("\u2212","minus"),...s(t.operand,7)]:T(t.operand,e,n);case"where":{let u=E(t.set,e,n),o=f(t.filter,u,n),a=o.every(d=>d.as==="name"||d.as==="word"&&d.text==="not");return[...s(t.set,4),...a?[]:[c("with")],...j(t.filter)<=2?[v,...o,w]:o]}case"binary":return Rt(t,e,n);case"call":return jt(t,e,n)}}function T(t,e,n){return xt(t)?Rt({...t,op:B[t.op]},e,n):x(t,"present")||x(t,"exists")?[...f(t.args[0],e,n),R("=","is"),N]:t.t==="ident"?[c("not"),O(n.fieldName(e,t.name))]:[c("not"),v,...f(t,e,n),w]}function Rt(t,e,n){let r=(o,a)=>j(o)<a?[v,...f(o,e,n),w]:f(o,e,n);if(t.op==="&&"||t.op==="||"){let o=H(t);if(o){let d=P(o.subject,e,n);return[...f(o.subject,e,n),R("\u2208","is one of"),n.valueWords(o.values.map(b=>b.value),d)]}let a=t.op==="&&"?2:1;return[...r(t.left,a),c(t.op==="&&"?"and":"or"),...r(t.right,a+.5)]}if(t.op in V){if($(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?f(t.left,e,n):T(t.left,e,n);let[o,a]=V[t.op],d=P(t.left,e,n),b=P(t.right,e,n);return[...S(t.left,e,n,b),R(o,a),...S(t.right,e,n,d)]}if(t.op==="in")return[...r(t.left,5),R("\u2208","is one of"),...S(t.right,e,n,P(t.left,e,n))];let s=At[t.op];if(s){let o=j(t);return[...r(t.left,o),R(s[0],s[1]),...r(t.right,o+.5)]}let u={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),c(u[t.op]??t.op),...r(t.right,5)]}function S(t,e,n,r){return t.t==="lit"||t.t==="list"?f(t,e,n,r):j(t)<5?[v,...f(t,e,n),w]:f(t,e,n)}function jt(t,e,n){let r=o=>t.args[o],s=o=>{let a=t.args[o];return a?.t==="lit"&&typeof a.value=="string"?a.value:void 0},u=o=>{let a=r(o);return j(a)<9&&a.t!=="where"?[v,...f(a,e,n),w]:f(a,e,n)};switch(t.fn){case"out":{let o=s(t.args.length-1)??"",a=O(M(o).toLowerCase());return t.args.length===2?[a,c("of"),...u(0)]:[a]}case"in":{let o=s(t.args.length-1)??"",a=t.args.length===2?n.nearOf(E(r(0),e,n),o):n.nearOf(e,o),d=O(a?n.plural(a):M(o).toLowerCase());return t.args.length===2?[d,c("of"),...u(0)]:[d]}case"all":{let o=s(0),a=t.args[1]?.t==="lit"?t.args[1].value:void 0,d=a===!0?[c("archived")]:a==="all"?[c("archived or not")]:[];return a===!0?[...d,O(o?n.plural(o):"everything")]:[O(o?n.plural(o):"everything"),...d]}case"fact":{let o=s(0);return[O(o?n.factName(o):"fact")]}case"count":return[c("number of"),...u(0)];case"exists":return[...u(0),R("\u2260","is not"),N];case"present":return[...f(r(0),e,n),R("\u2260","is not"),N];case"some":case"every":{let o=E(r(0),e,n),a=r(1);return[...t.fn==="some"?[c("some")]:[],...u(0),c(t.fn==="some"?"with":"all with"),...j(a)<=2?[v,...f(a,o,n),w]:f(a,o,n)]}case"sum":case"min":case"max":{let o=E(r(0),e,n),a=r(1),d=a.t==="lit"&&typeof a.value=="string"?[O(n.fieldName(o,a.value))]:j(a)<9?[v,...f(a,o,n),w]:f(a,o,n);return[c(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...d,c("of"),...u(0)]}case"first":{let o=r(0);if(x(o,"all")){let a=o.args[0]?.value;if(typeof a=="string")return[O(`the ${n.noun(a)}`)]}return[c("first of"),...u(0)]}case"sort":return[...u(0),c("by"),...f(r(1),E(r(0),e,n),n)];case"len":return[c("length of"),...f(r(0),e,n)];case"lower":return f(r(0),e,n);case"round":return[...f(r(0),e,n),c(t.args.length===2&&$(r(1))?`rounded to ${String(r(1).value)} places`:"rounded")];case"contains":case"startsWith":return[...f(r(0),e,n),c(t.fn==="contains"?"contains":"starts with"),...S(r(1),e,n,P(r(0),e,n))];case"today":return[L("today")];case"now":return[L("now")];case"date":return $(r(0))&&typeof r(0).value=="string"?[L(G(String(r(0).value),n.locale))]:f(r(0),e,n);case"days":case"hours":{let o=t.fn,[a,d]=[r(0),r(1)];return x(d,"today")||x(d,"now")?[c(`${o} since`),...f(a,e,n)]:x(a,"today")||x(a,"now")?[c(`${o} until`),...f(d,e,n)]:[c(`${o} from`),...f(a,e,n),c("to"),...f(d,e,n)]}case"if":return[v,...f(r(1),e,n),c("if"),...f(r(0),e,n),c(","),c("else"),...f(r(2),e,n),w];case"either":return t.args.flatMap((o,a)=>a===0?f(o,e,n):[c(","),c("else"),...f(o,e,n)]);default:return[c(t.fn),v,...t.args.flatMap((o,a)=>a===0?f(o,e,n):[c(","),...f(o,e,n)]),w]}}function U(t,e){let n=bt(e),r=t.over==="graph"?null:t.over;return z({...r===null?{}:{kind:r},parts:f(t.require,r,n),...t.when?{when:f(t.when,r,n)}:{}})}function Z(t,e,n){let r=bt(e),s=t.over==="graph"?null:t.over,u=n.subject,o=i=>{try{return q(i,{...n,budget:2e3})}catch{return}},a=(i,p)=>{let h=S(i,s,r,p);if(i.t==="lit"||i.t==="list"||x(i,"today")||x(i,"now")||x(i,"date"))return h;let y=o(i);if(y===void 0)return h;let l=P(i,s,r),m=r.valueWords(y,l?{...l,format:r.formatOf(l.kind,l.key)??(p?r.formatOf(p.kind,p.key):void 0)}:p);return y instanceof F?[...h,c(":"),m]:[...h,m]},d=i=>{if(i.t==="binary"&&i.op==="&&"){let p=[];p.push(...C(i,"&&"));let h=p.filter(y=>o(y)!==!0);return(h.length>0?h:p).flatMap((y,l)=>[...l>0?[c("and")]:[],...j(y)<=2?[v,...d(y),w]:d(y)])}if(i.t==="binary"&&i.op==="||"){let p=H(i);if(p){let y=P(p.subject,s,r);return[...a(p.subject),R("\u2209","is not one of"),r.valueWords(p.values.map(l=>l.value),y)]}let h=[];return h.push(...C(i,"||")),h.flatMap((y,l)=>[...l>0?[c("and")]:[],...j(y)<=2?[v,...d(y),w]:d(y)])}if(i.t==="binary"&&i.op in V){if($(i.right)&&typeof i.right.value=="boolean"&&(i.op==="=="||i.op==="!="))return i.op==="=="===i.right.value?T(i.left,s,r):f(i.left,s,r);let p=B[i.op],[h,y]=V[p],l=P(i.left,s,r),m=P(i.right,s,r);if($(i.right)&&i.right.value===null)return[...p==="=="?S(i.left,s,r,m):a(i.left,m),R(h,y),N];let g=p==="=="&&($(i.right)||$(i.left));return[...g?S(i.left,s,r,m):a(i.left,m),R(h,y),...g?S(i.right,s,r,l):a(i.right,l)]}if(i.t==="binary"&&i.op==="in")return[...a(i.left),R("\u2209","is not one of"),...S(i.right,s,r,P(i.left,s,r))];if(i.t==="unary"&&i.op==="!"){let p=i.operand;return xt(p)?d({...p,op:B[p.op]}):x(p,"present")||x(p,"exists")?[...a(p.args[0]),R("\u2260","is not"),N]:p.t==="ident"?f(p,s,r):[c("not"),v,...T(p,s,r),w]}if(x(i,"present")||x(i,"exists"))return[...f(i.args[0],s,r),R("=","is"),N];if(x(i,"some"))return[...f(i,s,r).slice(1),R("=","is"),N];if(x(i,"every")&&i.args.length===2){let p=o(i.args[0]);if(p instanceof F){let h=p.nodes.filter(y=>{try{return q(i.args[1],{...n,subject:y,budget:2e3})!==!0}catch{return!0}});return[...f(i,s,r),c(","),c("not"),r.valueWords(new F(h))]}}return i.t==="ident"?[c("not"),O(r.fieldName(s,i.name))]:[c("not"),v,...f(i,s,r),w]},b;try{b=d(t.require)}catch{b=[c("not"),v,...f(t.require,s,r),w]}return z({...s===null?{}:{kind:s},parts:b,...u?{record:_(e.schema.tryDefinition(u.kind),u)}:{}})}function vt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function St(t){return(e,n)=>{let r=t[e]?.fields?.[n],s=r?.format??(r?.type==="date"?"date":void 0);return s||r?.unit?{...s?{format:s}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function Ot(t,e){return{schema:e,said:vt(t.says),...t.declared?{formatOf:St(t.declared)}:{},...t.money?{money:t.money}:{}}}function Qt(t,e){return t.shape?U(t.shape,Ot(t.shape,e)):void 0}var wt=new WeakMap;function Nt(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let s=Kt(r),u=n.get(s.invariant)?.shape;if(!u||s.status&&s.status!=="violated")return s;let o=s.subjectId?t.graph.getNode(s.subjectId):void 0;if(u.over!=="graph"&&!o)return s;let a=u.kinds;a||(a=wt.get(t.schema),a||wt.set(t.schema,a=pt(t.schema)));try{let d=t.today?.()??u.today?.()??k(),b=Z(u,Ot(u,t.schema),{graph:t.graph,subject:o??null,kinds:a,today:d});return{...s,line:b,...u.says?{}:{message:`${s.message} \u2014 ${b.text}`}}}catch{return s}})}function Wt(){ut((t,e,n,r)=>Nt({graph:t,schema:t.schema,allInvariants:()=>e,today:()=>r},n)),mt($t)}function $t(t,e,n,r){let s=e.graph,u=lt.from(t.schema,s.snapshot(),{validate:!1});for(let b of n?[...r].reverse().map(it):r)try{u.applyPrimitives([b],{restoring:!0})}catch{}let o=b=>t.violations(void 0,b),a=o(n?u:s),d=o(n?s:u);return{...ct(t.allInvariants(),a,d),violationsAfter:d}}function Kt(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}Wt();export{Z as brokenLineOf,Wt as judgeWithLines,$t as judgedForASeat,Lt as problemWords,Qt as ruleLine,U as ruleLineOf,yt as ruleLineWords,J as ruleSpacing,Pt as ruleSpoken,Et as ruleText,Kt as unlined,Nt as withLines};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as le,b as U,d as ce,g as ye,h as pe,i as me,j as ge,k as he}from"./chunk.HZHNM2KI.js";import{Aa as oe,C as j,Fa as re,Fb as fe,H as _,Ha as ie,I as E,J as Z,K as B,Pa as C,Q as x,Rb as O,T as H,Ta as se,Tb as ue,U as X,Ub as I,Va as de,Xa as ae,Y as L,_ as Y,ba as q,da as W,ga as M,ma as v,oa as J,ua as Q,va as ee,wa as ne,xa as te}from"./chunk.F7PIW2EM.js";var _e=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,xe={day:"day",week:"week",month:"month",year:"year"},F=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function ve(t,e,n){let o=e.interval??1,i=xe[e.every],s=t.slice(0,10),l=o===1?`Every ${i}`:o===2?`Every other ${i}`:`Every ${o} ${i}s`,d;if(e.every==="week"){let y=(e.on?.length?e.on:[C[new Date(`${s}T00:00:00Z`).getUTCDay()]]).map(r=>Y(C.indexOf(r),"long",n));d=o===1?`Every ${F(y)}`:o===2?`Every other ${F(y)}`:`${l} on ${F(y)}`}else if(e.every==="month"){let y=(e.on?.length?e.on:[+s.slice(8,10)]).map(r=>r===-1?"the last day":`the ${_e(Number(r))}`);d=`${l} on ${F(y)}`}else e.every==="year"?d=`${l} on ${L(s,n)}`:d=l;return E.test(t)&&(d+=` at ${X(t,n)}`),e.until&&(d+=`, until ${x(e.until,n)}`),e.count&&(d+=`, ${e.count===1?"once":`${e.count} times`}`),d}function ke(t,e,n={}){if(!de(e)||typeof t!="string")return;let o=n.today??B(),i=ae(t,e,o),s=ve(t,e,n.locale),l=i.slice(0,4)===o.slice(0,4)?L(i.slice(0,10),n.locale):x(i.slice(0,10),n.locale);return i.slice(0,10)<o?`${s}, last ${l}`:`${s}, next ${l}`}function dn(t,e){let n=new Map,o=new Map;for(let i of t){let s=M(e(i.kind),i).trim().toLowerCase();o.set(s,[...o.get(s)??[],i])}for(let i of o.values()){if(i.length<2)continue;let s=new Map;for(let l of i)s.set(l.kind,[...s.get(l.kind)??[],l]);for(let[l,d]of s){if(d.length===1){n.set(d[0].id,J(e(l),l));continue}let y=d.map(u=>new Map(Ee(u,e(u.kind)).map(p=>[p.key,p.alone]))),r=[...new Set(y.flatMap(u=>[...u.keys()]))],c=u=>y.every(p=>!/\d/.test(p.get(u)??"")),h=[...r.filter(c),...r.filter(u=>!c(u))],b=(u,p)=>p.map(m=>y[u].get(m)??"").filter(Boolean).join(" \xB7 "),S=u=>new Set(d.map((p,m)=>b(m,u))).size===d.length&&d.every((p,m)=>b(m,u)!==""),f=h.find(u=>S([u])),a=f?void 0:h.flatMap((u,p)=>h.slice(p+1).map(m=>[u,m])).find(u=>S(u));d.forEach((u,p)=>{if(f||a)return void n.set(u.id,b(p,f?[f]:a));let m=h.find($=>{let w=y[p].get($);return w!==void 0&&w!==""&&y.every((R,k)=>k===p||R.get($)!==w)});n.set(u.id,m?y[p].get(m):`${p+1} of ${d.length}`)})}}return n}function an(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var Oe=new Set(["id","kind","label"]);function Se(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Ee(t,e,n={}){let o=e?.display,i=new Set([...Oe,...o?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&i.delete("label");let s=(n.said??[]).filter(f=>!!f),l=s.filter(f=>f.endsWith("\u2026")).map(f=>f.replace(/…$/,"").trim()).filter(f=>f.length>12),d=[],y=e?.fields?.shape,r=e?.fieldRoles,c=n.glance?o?.glance??[r?.who,r?.when].filter(f=>!!f):be(o?.page),h=n.glance&&o?.glance!==void 0,S=[...new Set(h?c:[...c,...De(e),...Object.keys(t)])].filter(f=>Object.hasOwn(t,f)).map(f=>[f,t[f]]);for(let[f,a]of S){if(i.has(f)||a===void 0||a===null||pe(e,f))continue;let u=o?.format?.[f],p=u?[]:ne(a);if(p[0]&&n.glance)continue;let m=e?.fields?.shape?.[f],$=!u&&typeof a=="string"&&oe(m)?a:void 0,w=!u&&typeof a=="string"&&le(m);if($&&n.glance)continue;let R=u?void 0:ie(m),k=R?{relation:R,refs:re(a,R)}:void 0;if(k&&(n.glance||k.refs.length===0)||!p[0]&&typeof a=="object"&&(!Array.isArray(a)||a.some(g=>typeof g=="object"&&g!==null))&&u===void 0)continue;let V=typeof a=="string"&&!u?ke(a,t[`${f}Repeat`],{locale:n.locale}):void 0,N=p[0]?p.map(g=>`${g.caption?`${g.name} \u2014 ${g.caption}`:g.name}${Q(g)?` (${ee(g)})`:""}`).join(", "):Array.isArray(a)?a.join(", "):typeof a=="boolean"?a?"Yes":"No":String(a),z=u?void 0:me(e,f),G=he(z,a),K=!u&&!z&&typeof a=="number"?O(e?.fields?.shape?.[f])??ye(e,f):void 0,D=k?k.refs.length>1?`${k.refs.length} linked records`:"linked record":u?u(a):K?ue(a,K):ge(z,a,n.locale)??(Array.isArray(a)||typeof a=="boolean"?N:typeof a=="string"&&V!==void 0?V:typeof a=="string"&&_.test(a)&&(a.length===10||Ne(e,f))?x(a,n.locale):typeof a=="string"&&E.test(a)?H(a,n.locale,n.timeZone):typeof a=="string"&&ze(e,f)?U(e,f,a):N),P=typeof a=="string"&&We(e,f,D),A=(n.glance||n.excerpt)&&!u&&(P||w)?ce(D,{markdown:w}):D;if(s.includes(A)||l.some(g=>A.startsWith(g))||n.glance&&(typeof a=="string"||typeof a=="number")&&s.some(g=>Se(g,A)))continue;let T=v(e,f),Re=typeof a=="number"?`${T} ${A}`:typeof a=="boolean"&&!u?`${T}: ${A.toLowerCase()}`:A;if(d.push({key:f,label:T,value:A,stored:N,alone:Re,long:P,...w?{markdown:!0}:{},...p[0]?{files:p}:{},...$?{app:$}:{},...k?{linked:k}:{},...G?{href:G}:{},...se(y?.[`${f}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&d.length>=n.limit)break}return Me(d,e)}function Me(t,e){let n=new Map;for(let o of t){let i=Fe(e,o.key);i&&n.set(o.key,new Set(i.map(s=>U(e,o.key,s).toLowerCase())))}return n.size<2?t:t.map(o=>{let i=n.get(o.key);return i!==void 0&&[...n].some(([l,d])=>l!==o.key&&[...i].some(y=>d.has(y)))?{...o,alone:`${o.label}: ${o.value.toLowerCase()}`}:o})}function Fe(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Ne(t,e){let n=t?.fields?.shape?.[e]?._zod?.def;for(let o=0;o<6&&n?.innerType!==void 0;o++)n=n.innerType._zod?.def;return n?.type==="string"&&(n.checks??[]).some(o=>o._zod?.def?.pattern?.source===_.source)}function ze(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function De(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function be(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Te=500,je=160;function Le(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function We(t,e,n){return Le(t?.fields?.shape?.[e])?.checks?.some(i=>i._zod?.def?.check==="max_length"&&(i._zod.def.maximum??0)>Te)?!0:typeof n=="string"&&(n.includes(`
|
|
2
|
-
`)||n.length>je)}function ln(t,e){let n=t?.display?.page,o=n?.groups??[],i=new Map(e.map(r=>[r.key,r])),s=new Set(be(n)),l=r=>r.flatMap(c=>i.has(c)?[i.get(c)]:[]),d=e.filter(r=>!s.has(r.key));return[{fields:[...l(n?.fields??[]),...o.length>0?[]:d]},...o.map(r=>({title:r.title,fields:l(r.fields)})),...o.length>0?[{title:"Details",fields:d}]:[]].filter(r=>r.fields.length>0)}function Ce(t,e,n){let o=[...e?.creates??[],...e?.subject&&e.subject.kinds!=="*"?e.subject.kinds:[]];for(let i of o){let s=t.tryDefinition(i),l=s?.fields?.shape??{};if(!s||!(n in l))continue;let d=s.display?.format?.[n];return{label:s.display?.labels?.[n]??v(s,n),option:r=>d?d(r):W(r)}}return{label:v(void 0,n),option:i=>W(i)}}function pn(t,e,n){if(n instanceof fe){let o=e.find(s=>s.name===n.mutation);return`Not yet: ${n.issues.map(s=>{let l=s.path.length>0?Ce(t,o,String(s.path[0])).label:void 0;return l?`${l} \u2014 ${q(s.message)}`:s.message}).join("; ")}.`}return n instanceof Error?n.message:String(n)}var Ie=t=>/^[A-Z]{3}$/.test(t??"");function we(t){let{format:e,unit:n,currency:o,locale:i}=t,s=Ie(n),l=e==="money"||!e&&s,d=l?s?n:o:void 0;return{...l?{format:"money"}:e?{format:e}:{},...n&&!(l&&s)?{unit:n}:{},...d?{currency:d}:{},...i?{locale:i}:{}}}function gn(t){switch(t.format){case"money":return t.currency?`An amount of money in ${t.currency}: a plain number, 1250.5 for 1,250.50 ${t.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return t.unit?`A number of ${t.unit}.`:"A number."}}function Ae(t){let e=j(t)?.innerType;return e===void 0?t:Ae(e)}var Ue={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ve=t=>(t?._zod?.def?.checks??[]).map(e=>e._zod?.def).filter(e=>e!==void 0);function $e(t){let e=Ae(t),n=j(e),o=n?.type,i=Ve(e);if(o==="enum")return{type:"choice",options:Object.keys(n?.entries??{})};let s=te(e);if(s)return s==="image"?{type:"file",image:!0}:s==="video"?{type:"file",video:!0}:{type:"file"};if(o==="boolean")return{type:"boolean"};if(o==="array"){let l=$e(n?.element);return l.type==="unknown"?{type:"unknown"}:{type:"several",of:l}}if(o==="number"){let l,d,y;for(let r of i){r.check==="multiple_of"&&typeof r.value=="number"?y=r.value:r.check==="number_format"&&(r.format==="safeint"||r.format==="int32"||r.format==="uint32")&&(y??=1);let c=r.check==="number_format"&&r.format?Ue[r.format]:void 0,h=c?c[0]:r.check==="greater_than"&&r.inclusive&&typeof r.value=="number"?r.value:void 0,b=c?c[1]:r.check==="less_than"&&r.inclusive&&typeof r.value=="number"?r.value:void 0;h!==void 0&&(l=l===void 0?h:Math.max(l,h)),b!==void 0&&(d=d===void 0?b:Math.min(d,b))}return{type:"number",...l===void 0?{}:{min:l},...d===void 0?{}:{max:d},...y===void 0?{}:{step:y},...I(e)==="duration"?{duration:!0}:{},...O(t)?{amount:we(O(t))}:{}}}if(o==="string"){if(i.some(c=>c.fn===Z||c.format==="datetime")||n?.format==="datetime")return{type:"date",time:!0,instant:!0};let d=[n?.pattern,...i.map(c=>c.pattern)].filter(c=>c instanceof RegExp).map(c=>c.source);if(d.some(c=>c.includes("\\d{4}")))return d.some(c=>c.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:d.includes(_.source)?{type:"date",partial:!0}:{type:"date"};let y=i.some(c=>c.check==="max_length"&&typeof c.maximum=="number"&&c.maximum>500),r=I(e);return y?{type:"text",long:!0}:r==="phone"||r==="place"?{type:"text",holds:r}:{type:"text"}}return{type:"unknown"}}function _n(t,e){let n=t?.shape;return!n||!(e in n)?{type:"unknown"}:$e(n[e])}export{ve as a,dn as b,an as c,Ee as d,ln as e,we as f,gn as g,Ae as h,$e as i,_n as j,Ce as k,pn as l};
|