graview 0.1.56 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/{chunk.5B4HNQGR.js → chunk.2PWVDUOU.js} +1 -1
- package/dist/preview/{chunk.DWMAFMYZ.js → chunk.33PZEW5A.js} +1 -1
- package/dist/preview/{chunk.D4LN33J2.js → chunk.3DPTDMJ7.js} +1 -1
- package/dist/preview/{chunk.PJCVFYFU.js → chunk.47T3KUAA.js} +1 -1
- package/dist/preview/{chunk.AKVBU5K5.js → chunk.4BRM5SGO.js} +1 -1
- package/dist/preview/{chunk.NQ4VGKEC.js → chunk.4HFCOMR3.js} +1 -1
- package/dist/preview/{chunk.PMPDLE56.js → chunk.4HPP35XQ.js} +1 -1
- package/dist/preview/{chunk.USB6B6L3.js → chunk.4JDHBNEA.js} +1 -1
- package/dist/preview/{chunk.4EUH6TLG.js → chunk.4K6VAC2S.js} +2 -2
- package/dist/preview/{chunk.VDD3RHLB.js → chunk.4L4F47QP.js} +1 -1
- package/dist/preview/{chunk.J3YBEZKE.js → chunk.4NPXMYA5.js} +1 -1
- package/dist/preview/{chunk.TAIYNHSW.js → chunk.4OP4IEEY.js} +1 -1
- package/dist/preview/chunk.4SBYXHCQ.js +1 -0
- package/dist/preview/{chunk.QW3QLE53.js → chunk.4UQBMFJZ.js} +1 -1
- package/dist/preview/{chunk.MLRPCZVS.js → chunk.4W5GCPAP.js} +1 -1
- package/dist/preview/{chunk.NUE5VG4G.js → chunk.4XKRCAJZ.js} +1 -1
- package/dist/preview/{chunk.PRV3KYT6.js → chunk.534TBZJ3.js} +2 -2
- package/dist/preview/{chunk.2HZGUVB2.js → chunk.53U6E5LD.js} +1 -1
- package/dist/preview/{chunk.AQCU6TPV.js → chunk.547FQPYG.js} +1 -1
- package/dist/preview/{chunk.N3Q5CPVA.js → chunk.57BKS5KD.js} +1 -1
- package/dist/preview/chunk.57KRCHQT.js +1 -0
- package/dist/preview/{chunk.6HLKAUWF.js → chunk.5BPRGXIW.js} +1 -1
- package/dist/preview/{chunk.E4EN4X5F.js → chunk.5GTOF5D5.js} +1 -1
- package/dist/preview/{chunk.KY7QD22S.js → chunk.5IEFTFKQ.js} +1 -1
- package/dist/preview/{chunk.IT763BYH.js → chunk.5NZDFT6R.js} +1 -1
- package/dist/preview/{chunk.K2JE3PD7.js → chunk.66LWZIY5.js} +1 -1
- package/dist/preview/{chunk.QYFZ7AZS.js → chunk.6AH26OL7.js} +2 -2
- package/dist/preview/{chunk.EC5IWN74.js → chunk.6SD7YZ4U.js} +2 -2
- package/dist/preview/{chunk.N7EEPFYV.js → chunk.72IHABM5.js} +1 -1
- package/dist/preview/chunk.7INWDFNG.js +1 -0
- package/dist/preview/{chunk.7O6Z3BFR.js → chunk.7IXTNST2.js} +1 -1
- package/dist/preview/{chunk.DTSTUC2W.js → chunk.7ML2BWSP.js} +1 -1
- package/dist/preview/{chunk.QAIYYIZQ.js → chunk.7UBABS2T.js} +1 -1
- package/dist/preview/{chunk.KBL4Y4UN.js → chunk.7VIFAN3O.js} +1 -1
- package/dist/preview/chunk.7VZA34T4.js +1 -0
- package/dist/preview/{chunk.JQY2UKU6.js → chunk.AD3EC5DU.js} +1 -1
- package/dist/preview/{chunk.RDL6652E.js → chunk.BCE6LIDR.js} +1 -1
- package/dist/preview/{chunk.Q7X2IVLH.js → chunk.BPEUHOKH.js} +1 -1
- package/dist/preview/{chunk.SRC37GNP.js → chunk.BUSFJM6P.js} +1 -1
- package/dist/preview/{chunk.FCUDBMGC.js → chunk.BZEJM2PY.js} +1 -1
- package/dist/preview/{chunk.22MIRLL6.js → chunk.C5EFUODO.js} +1 -1
- package/dist/preview/{chunk.64IKLRUS.js → chunk.C7EJPV2N.js} +1 -1
- package/dist/preview/chunk.CMLNBJZG.js +3 -0
- package/dist/preview/{chunk.RXYE2DAJ.js → chunk.CUKRUQQ2.js} +1 -1
- package/dist/preview/chunk.CXB4BSI4.js +1 -0
- package/dist/preview/{chunk.2E6EWVWR.js → chunk.D3LQJXVP.js} +1 -1
- package/dist/preview/{chunk.I2C5LPB5.js → chunk.D4EP7FEC.js} +1 -1
- package/dist/preview/{chunk.NPAWTPLQ.js → chunk.DBMZ3AQB.js} +1 -1
- package/dist/preview/{chunk.YEJ4LNUP.js → chunk.DIFR37EZ.js} +1 -1
- package/dist/preview/{chunk.LLOZKUCA.js → chunk.DJ4A76SX.js} +1 -1
- package/dist/preview/{chunk.VEOS25PQ.js → chunk.DM5X3JBH.js} +1 -1
- package/dist/preview/chunk.DQUISKTC.js +1 -0
- package/dist/preview/chunk.DSLGMCB6.js +1 -0
- package/dist/preview/chunk.DSWMXM57.js +1 -0
- package/dist/preview/{chunk.C2VFDBSG.js → chunk.DWLKJGVT.js} +1 -1
- package/dist/preview/{chunk.WMB2NNBD.js → chunk.EQAAKYLA.js} +1 -1
- package/dist/preview/{chunk.2YNZVNCA.js → chunk.EXZLG3HK.js} +1 -1
- package/dist/preview/{chunk.LP3SHWJG.js → chunk.EZ4NUZWX.js} +1 -1
- package/dist/preview/{chunk.E33EJU3Q.js → chunk.EZ4TZUMM.js} +1 -1
- package/dist/preview/{chunk.AKW6NR3X.js → chunk.FJTWAU7N.js} +1 -1
- package/dist/preview/{chunk.VYW7DSUW.js → chunk.FLMNWVSY.js} +2 -2
- package/dist/preview/{chunk.ILSK2E3R.js → chunk.FLVE6IBM.js} +1 -1
- package/dist/preview/{chunk.SOTB6C5A.js → chunk.FPGU43SC.js} +1 -1
- package/dist/preview/{chunk.K5YLQAFW.js → chunk.FRERJWZJ.js} +1 -1
- package/dist/preview/{chunk.D6BMAGPR.js → chunk.G3BDQ6EA.js} +1 -1
- package/dist/preview/chunk.GBAUQXXD.js +1 -0
- package/dist/preview/{chunk.WPJVMVAL.js → chunk.H5CRRBNU.js} +1 -1
- package/dist/preview/{chunk.4KMY24YC.js → chunk.HFSG3F5Z.js} +1 -1
- package/dist/preview/chunk.I2NI7CT7.js +1 -0
- package/dist/preview/{chunk.T6HG2XIP.js → chunk.I5PSHASU.js} +1 -1
- package/dist/preview/{chunk.XGCOWCA2.js → chunk.I636CZE4.js} +1 -1
- package/dist/preview/chunk.I6H3HRWT.js +1 -0
- package/dist/preview/{chunk.CGM7OER2.js → chunk.IRQOJATD.js} +1 -1
- package/dist/preview/chunk.IV7AUO53.js +1 -0
- package/dist/preview/{chunk.ONGZ3YQF.js → chunk.IX63LTRQ.js} +1 -1
- package/dist/preview/{chunk.JZDKHWRL.js → chunk.JBSW7ZNH.js} +1 -1
- package/dist/preview/chunk.JD5HSAMC.js +18 -0
- package/dist/preview/{chunk.LKK7VQBA.js → chunk.JETT6ELP.js} +1 -1
- package/dist/preview/{chunk.IF4FCQPG.js → chunk.JNNBHD4Z.js} +1 -1
- package/dist/preview/{chunk.HFVMGTNL.js → chunk.JQFIZRAZ.js} +2 -2
- package/dist/preview/chunk.KNYLY7MH.js +1 -0
- package/dist/preview/chunk.KO7IOFNY.js +1 -0
- package/dist/preview/{chunk.XY5EVI22.js → chunk.KPIDJYIU.js} +1 -1
- package/dist/preview/{chunk.APXYWI3L.js → chunk.KTV24HY7.js} +1 -1
- package/dist/preview/{chunk.YL5ZCRHQ.js → chunk.KYOI7BG3.js} +1 -1
- package/dist/preview/{chunk.SVAQGVS4.js → chunk.LE2KAR25.js} +1 -1
- package/dist/preview/{chunk.VLBY66PB.js → chunk.LHIT3EZD.js} +2 -2
- package/dist/preview/{chunk.7Z4USR3Y.js → chunk.LKJ6FD6Y.js} +1 -1
- package/dist/preview/chunk.LUIRQ5UF.js +2 -0
- package/dist/preview/chunk.LWRXCO2Z.js +1 -0
- package/dist/preview/{chunk.AZUTYY2S.js → chunk.M72JKVHP.js} +4 -4
- package/dist/preview/{chunk.65Q5MKDW.js → chunk.MAZFQIL5.js} +1 -1
- package/dist/preview/{chunk.V3NPUAPB.js → chunk.MBLFZF5R.js} +1 -1
- package/dist/preview/{chunk.QNNRSPIJ.js → chunk.MRHPOUA4.js} +1 -1
- package/dist/preview/{chunk.BNEOLRQG.js → chunk.MWWOI5PW.js} +1 -1
- package/dist/preview/{chunk.4EY6WPSM.js → chunk.N2DM42SG.js} +2 -2
- package/dist/preview/chunk.N33WUCAN.js +3 -0
- package/dist/preview/{chunk.MFDSWA2W.js → chunk.N5MQARN6.js} +1 -1
- package/dist/preview/{chunk.2OX4YI46.js → chunk.NF72Z2HG.js} +1 -1
- package/dist/preview/{chunk.TXWCTHMI.js → chunk.NGK6IRV3.js} +1 -1
- package/dist/preview/{chunk.2DETYEJM.js → chunk.NL3AJZ3N.js} +1 -1
- package/dist/preview/{chunk.GUP7LC5O.js → chunk.NUS5K56R.js} +2 -2
- package/dist/preview/{chunk.7NP2I2UP.js → chunk.NX7CR4AE.js} +1 -1
- package/dist/preview/{chunk.7RJGEU3Y.js → chunk.NZDWXX6H.js} +1 -1
- package/dist/preview/{chunk.QSO5BP2H.js → chunk.O47MN7E5.js} +1 -1
- package/dist/preview/chunk.OYUDK3LK.js +1 -0
- package/dist/preview/chunk.PF5P5YVD.js +1 -0
- package/dist/preview/{chunk.V6X3U3JF.js → chunk.PHC2MI4C.js} +1 -1
- package/dist/preview/{chunk.MJMVGW6Z.js → chunk.PQMMISCQ.js} +1 -1
- package/dist/preview/{chunk.E4HSSGF7.js → chunk.Q6OZLBNL.js} +1 -1
- package/dist/preview/{chunk.AM2YRNOQ.js → chunk.QMYHXMRV.js} +1 -1
- package/dist/preview/chunk.QPL3OXW3.js +1 -0
- package/dist/preview/{chunk.ZFXHZZHW.js → chunk.QS6YW7UY.js} +1 -1
- package/dist/preview/chunk.QUJS63OJ.js +13 -0
- package/dist/preview/{chunk.USQNSNIA.js → chunk.RALAID6N.js} +1 -1
- package/dist/preview/{chunk.XJFAUOJS.js → chunk.RQX4CQJN.js} +1 -1
- package/dist/preview/{chunk.NBLMANHT.js → chunk.RVR6FWAF.js} +1 -1
- package/dist/preview/{chunk.O6LDZWLR.js → chunk.S5ECRIG5.js} +1 -1
- package/dist/preview/{chunk.CKV2QCH5.js → chunk.SAJLIA5M.js} +1 -1
- package/dist/preview/{chunk.IRMO4FUC.js → chunk.TBRXNU6T.js} +1 -1
- package/dist/preview/{chunk.MORMTKVR.js → chunk.TVURUMU4.js} +1 -1
- package/dist/preview/{chunk.3X3GLNWQ.js → chunk.UBNZDSS7.js} +1 -1
- package/dist/preview/chunk.UDCDK7XJ.js +4 -0
- package/dist/preview/{chunk.NFU4UM6F.js → chunk.UGOKORIF.js} +1 -1
- package/dist/preview/{chunk.CU2NQ5WF.js → chunk.UV3U4FRT.js} +1 -1
- package/dist/preview/{chunk.IUQOSPQX.js → chunk.UWQ3I5OW.js} +1 -1
- package/dist/preview/chunk.V6FUYRZI.js +1 -0
- package/dist/preview/{chunk.DH7M57SE.js → chunk.VDS3IOTK.js} +1 -1
- package/dist/preview/{chunk.OBUKZQCZ.js → chunk.VHPGGC2P.js} +1 -1
- package/dist/preview/{chunk.FBR4HJ2Q.js → chunk.VSGTNYM2.js} +1 -1
- package/dist/preview/{chunk.G3ORIU7C.js → chunk.VW4JAQCH.js} +1 -1
- package/dist/preview/{chunk.VSM72NVF.js → chunk.WASWMHND.js} +1 -1
- package/dist/preview/chunk.WYPL2QUA.js +1 -0
- package/dist/preview/{chunk.UQQAGT3R.js → chunk.XTBS64IT.js} +1 -1
- package/dist/preview/chunk.XVN3CQKH.js +2 -0
- package/dist/preview/{chunk.D6KF72MZ.js → chunk.Y3EOGXRS.js} +1 -1
- package/dist/preview/chunk.Y4KNR76Z.js +1 -0
- package/dist/preview/chunk.YDTXCVBU.js +1 -0
- package/dist/preview/{chunk.YLMOGGEP.js → chunk.YPP7FSEZ.js} +1 -1
- package/dist/preview/{chunk.45VIF2SX.js → chunk.YQXA4WAM.js} +2 -2
- package/dist/preview/{chunk.JHFHIG4P.js → chunk.YR75TWDV.js} +1 -1
- package/dist/preview/{chunk.AIK3Z25Y.js → chunk.YS5U3DUX.js} +1 -1
- package/dist/preview/chunk.Z5UVYOGC.js +1 -0
- package/dist/preview/{chunk.5MS2TQFX.js → chunk.ZNXRHOUI.js} +1 -1
- package/dist/preview/index.html +50 -50
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2BLRCT3E.js +0 -1
- package/dist/preview/chunk.3V2WH6F7.js +0 -1
- package/dist/preview/chunk.4YI6656P.js +0 -1
- package/dist/preview/chunk.5MSWUTDB.js +0 -1
- package/dist/preview/chunk.6Q6BW4QT.js +0 -2
- package/dist/preview/chunk.7U2JO7ET.js +0 -3
- package/dist/preview/chunk.7Z2PRPYE.js +0 -1
- package/dist/preview/chunk.AGTFYPXY.js +0 -1
- package/dist/preview/chunk.BT7RLFPO.js +0 -1
- package/dist/preview/chunk.DPPT6WAJ.js +0 -2
- package/dist/preview/chunk.DVG47BK3.js +0 -1
- package/dist/preview/chunk.DZYLH5IM.js +0 -1
- package/dist/preview/chunk.E5XNQTEU.js +0 -1
- package/dist/preview/chunk.F5RN6YXG.js +0 -4
- package/dist/preview/chunk.FOQENWF5.js +0 -1
- package/dist/preview/chunk.GNQW4JOG.js +0 -18
- package/dist/preview/chunk.HVN2DVP3.js +0 -1
- package/dist/preview/chunk.JL4DGITZ.js +0 -1
- package/dist/preview/chunk.K4MO22RM.js +0 -1
- package/dist/preview/chunk.KMEKMCKG.js +0 -3
- package/dist/preview/chunk.LVOVPU64.js +0 -1
- package/dist/preview/chunk.MEJUAV3Y.js +0 -1
- package/dist/preview/chunk.OYGPNO7A.js +0 -1
- package/dist/preview/chunk.RR2IFETZ.js +0 -1
- package/dist/preview/chunk.T2RME6XF.js +0 -1
- package/dist/preview/chunk.TAJ2R44N.js +0 -1
- package/dist/preview/chunk.TQCRFZ53.js +0 -1
- package/dist/preview/chunk.UE5YS3GN.js +0 -1
- package/dist/preview/chunk.VIQ6EF2O.js +0 -1
- package/dist/preview/chunk.XE72DFBV.js +0 -13
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 ro}from"./chunk.2OX4YI46.js";import{a as Wt,b as lr,c as ur,d as fr,e as It,f as pr,g as mr,h as hr,i as yr,j as gr,k as wr,l as vr,m as br,n as Ue}from"./chunk.APXYWI3L.js";import{b as dr}from"./chunk.XY5EVI22.js";import{a as Bt,b as or,c as ar,d as ir,e as sr,f as $t,g as cr,h as Nt}from"./chunk.MFDSWA2W.js";import{a as Rt,g as Ln}from"./chunk.K4MO22RM.js";import{k as it}from"./chunk.KMEKMCKG.js";import{E as tr,I as nr,J as rr,h as Yn,k as Dt,l as Qn,n as Zn,r as Xn,w as Vt,z as er}from"./chunk.HFVMGTNL.js";import{c as no}from"./chunk.7Z4USR3Y.js";import{Aa as qn,Ca as zn,Da as Gn,Fa as Un,G as Mt,Ga as Ht,Ka as Kn,La as Jn,Oa as dt,T as Dn,Z as Vn,a as Mn,b as st,c as ct,ga as Bn,ha as $n,j as Hn,m as Lt,va as Nn,wa as Wn,xa as In,ya as _n,za as jn}from"./chunk.NPAWTPLQ.js";import{a as Te}from"./chunk.SDO3U72B.js";import{$d as Cn,Eb as Sn,Pd as Re,Qd as Fn,Rd as On,Wd as xt,Xc as kn,Xd as Ft,Yd as Ot,ae as Ct,fb as _e,hc as Tt,hd as An,ic as Pn,id as En,nd as Rn,pd as Tn,qb as ot,qd as xn,rb as bn,sd as at}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as De}from"./chunk.AJZBJBMO.js";function _t(e){if(Array.isArray(e))return e.map(_t);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=_t(i))}return n}return e}function jt(e){return JSON.stringify(_t(e))??"undefined"}async function lt(e,n={}){let o=e.compiled===void 0||!ao(e.compiled,e.document)?void 0:Ln(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await oo();return i(e.document,n)}var Sr,oo=()=>Sr??=(__graviewPreload(import.meta.url,["./chunk.K4MO22RM.js","./chunk.TQCRFZ53.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5MSWUTDB.js")).catch(e=>{throw Sr=void 0,e});function ao(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&&jt(Rt(o).document)===jt(Rt(i).document)}var d=De(Mt(),1);var ft=De(Mt(),1),qt="data-graview-drawn",io=200,Pr=50,so=1e4,ut=()=>typeof performance<"u"?performance.now():Date.now();function co(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 lo(e,n){if(e.ownerDocument.fonts?.status==="loading"||Wn()>0||qn(n)>0||e.querySelector('[aria-busy="true"]')||co(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 kr(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 uo(e,n,o,i){e.removeAttribute(qt);let c=e.ownerDocument.defaultView;if(!c)return()=>{};let l=ut(),S=l,p=kr(e),w=!1,E,T=typeof MutationObserver>"u"?void 0:new MutationObserver(v=>{v.some(_=>!(_.target===e&&_.attributeName===qt))&&(S=ut())});T?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let P=()=>{w=!0,T?.disconnect(),E!==void 0&&clearTimeout(E)},k=v=>{let _=!1,de=()=>{_||(_=!0,v())};typeof c.requestAnimationFrame=="function"&&c.requestAnimationFrame(()=>setTimeout(de,0)),setTimeout(de,100)},F=()=>{if(w)return;let v=kr(e);v!==p&&(p=v,S=ut());let _=ut();if(lo(e,i)&&_-S>=io||_-l>=so){k(()=>{w||(P(),e.setAttribute(qt,n),Gn(),o())});return}E=setTimeout(F,Pr)};return E=setTimeout(F,Pr),P}function Ar(e,n,o,i,c){zn();let l=(0,ft.useRef)({place:o,onDrawn:i});l.current={place:o,onDrawn:i},(0,ft.useLayoutEffect)(()=>{c&&jn(c);let S=E=>uo(E,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),c);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,c])}var ve=De(Mt(),1),Ke,fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.KY7QD22S.js","./chunk.QW3QLE53.js","./chunk.AM2YRNOQ.js","./chunk.AGTFYPXY.js","./chunk.FBR4HJ2Q.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.AKW6NR3X.js"))),Er=()=>fo().then(e=>void(Ke=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Er)),zt=Nn(Er),Rr=e=>!!e&&Ke===void 0;function Gt({onReady:e,fetch:n}){return(0,ve.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var po=0;function Tr(e){let[n,o]=(0,ve.useState)(()=>Ke);(0,ve.useEffect)(()=>{if(!e||n)return;let l=!1;return zt().then(()=>{l||o(Ke)}),()=>{l=!0}},[e,n]);let i=(0,ve.useMemo)(()=>po+=1,[e]);return{over:(0,ve.useMemo)(()=>{let l=n??Ke;if(!e||!l)return;let{source:S,worker:p,...w}=e,E={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:T=>l.registerWorkerView(T,E)}},[e,n]),n:i}}var Or=De(ro(),1),I=De(no(),1);var g=De(Dn(),1);function pt(e,n={}){let o=Ht(e);return{Face:o.part((c,l)=>(0,d.createElement)(c,l),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Jt=e=>Promise.all([e,nr()]).then(([n])=>n),Cr=Te(()=>(__graviewPreload(import.meta.url,["./chunk.IUQOSPQX.js","./chunk.LKK7VQBA.js","./chunk.EC5IWN74.js","./chunk.ONGZ3YQF.js","./chunk.MORMTKVR.js","./chunk.PJCVFYFU.js","./chunk.7RJGEU3Y.js","./chunk.HJCQ6I3S.js","./chunk.7O6Z3BFR.js","./chunk.I2C5LPB5.js","./chunk.Q7X2IVLH.js","./chunk.NFU4UM6F.js","./chunk.AKVBU5K5.js","./chunk.LLOZKUCA.js","./chunk.DH7M57SE.js","./chunk.CKV2QCH5.js","./chunk.TAJ2R44N.js","./chunk.64IKLRUS.js","./chunk.DTSTUC2W.js","./chunk.RDL6652E.js","./chunk.V3NPUAPB.js","./chunk.APXYWI3L.js","./chunk.XY5EVI22.js","./chunk.UQQAGT3R.js","./chunk.GZHZLJBF.js","./chunk.E5XNQTEU.js","./chunk.OJGHDWI6.js","./chunk.K5YLQAFW.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QYFZ7AZS.js"))),mo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.GNQW4JOG.js","./chunk.USB6B6L3.js","./chunk.AZUTYY2S.js","./chunk.45VIF2SX.js","./chunk.IUQOSPQX.js","./chunk.UGFDSE37.js","./chunk.PXQVXBNG.js","./chunk.VYW7DSUW.js","./chunk.LKK7VQBA.js","./chunk.RR2IFETZ.js","./chunk.ONGZ3YQF.js","./chunk.XGCOWCA2.js","./chunk.MORMTKVR.js","./chunk.CU2NQ5WF.js","./chunk.E33EJU3Q.js","./chunk.PJCVFYFU.js","./chunk.7RJGEU3Y.js","./chunk.22MIRLL6.js","./chunk.NFU4UM6F.js","./chunk.DH7M57SE.js","./chunk.AIK3Z25Y.js","./chunk.CKV2QCH5.js","./chunk.BT7RLFPO.js","./chunk.TAJ2R44N.js","./chunk.VLBY66PB.js","./chunk.BJUUSIQY.js","./chunk.RDL6652E.js","./chunk.V3NPUAPB.js","./chunk.XOZU4OFA.js","./chunk.IT763BYH.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.T2RME6XF.js","./chunk.SOTB6C5A.js","./chunk.TQCRFZ53.js","./chunk.6HLKAUWF.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.GZHZLJBF.js","./chunk.E5XNQTEU.js","./chunk.OJGHDWI6.js","./chunk.K5YLQAFW.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.2BLRCT3E.js"))),ho=Te(()=>(__graviewPreload(import.meta.url,["./chunk.GNQW4JOG.js","./chunk.USB6B6L3.js","./chunk.AZUTYY2S.js","./chunk.45VIF2SX.js","./chunk.IUQOSPQX.js","./chunk.UGFDSE37.js","./chunk.PXQVXBNG.js","./chunk.VYW7DSUW.js","./chunk.LKK7VQBA.js","./chunk.RR2IFETZ.js","./chunk.ONGZ3YQF.js","./chunk.XGCOWCA2.js","./chunk.MORMTKVR.js","./chunk.CU2NQ5WF.js","./chunk.E33EJU3Q.js","./chunk.PJCVFYFU.js","./chunk.7RJGEU3Y.js","./chunk.22MIRLL6.js","./chunk.NFU4UM6F.js","./chunk.DH7M57SE.js","./chunk.AIK3Z25Y.js","./chunk.CKV2QCH5.js","./chunk.BT7RLFPO.js","./chunk.TAJ2R44N.js","./chunk.VLBY66PB.js","./chunk.BJUUSIQY.js","./chunk.RDL6652E.js","./chunk.V3NPUAPB.js","./chunk.XOZU4OFA.js","./chunk.IT763BYH.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.T2RME6XF.js","./chunk.SOTB6C5A.js","./chunk.TQCRFZ53.js","./chunk.6HLKAUWF.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.GZHZLJBF.js","./chunk.E5XNQTEU.js","./chunk.OJGHDWI6.js","./chunk.K5YLQAFW.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DZYLH5IM.js"))),Lr=pt(()=>Jt(Cr().then(e=>e.SceneFace)),{what:"This view"}),Mr=pt(()=>Cr().then(e=>e.SceneKeeping),{quiet:!0}),Hr=pt(()=>Jt(mo().then(e=>e.PagesContent)),{what:"This page"}),Dr=pt(()=>Jt(ho().then(e=>e.PictureFace)),{what:"This picture"}),yo=Lr.Face,go=Mr.Face,wo=Hr.Face,vo=Dr.Face;function Ve(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Vr));return Promise.all([...[...o].map(i=>i.fetch()),Zn()]).then(()=>{},()=>{})}var Vr=e=>e==="pages"?[Hr]:e==="picture"?[Dr]:[Lr,Mr],Br=e=>Vr(e).every(n=>n.here()),bo=150,Ut=0;function xr(e,n){if(Br(e))return n();let o=++Ut,i=()=>{o===Ut&&(Ut+=1,n())};Ve(e).then(i),setTimeout(i,bo)}var So=768;function Po(e,n){let o=n!==null&&n>=So;(0,d.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(Br(i))return;let c=globalThis,l=()=>void Ve(i),S=()=>{},p=Un(()=>{if(c.requestIdleCallback&&c.cancelIdleCallback){let w=c.requestIdleCallback(l,{timeout:4e3});S=()=>c.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,o])}function ko({asked:e,shown:n,onDrawn:o}){return(0,d.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function Ao({auto:e,scene:n}){return(0,g.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${It}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Eo=Ht(Te(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,g.jsx)(e.StudioPlace,{...n}),{quiet:!0});function $r(e,n,o,i,c){return $t(e,sr(n?ct(n):c??Mn,i),o)}function Yt(e){return e&&ct(e).overview?"graview":"scene"}function Fr(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 Nr(e){let[,n]=(0,d.useState)(!1),o=(0,d.useCallback)(()=>n(!0),[]),i=(0,d.useRef)(!1);return e.at&&!mt?(0,g.jsx)(Gt,{onReady:o,fetch:Qt}):!i.current&&Rr(e.draftView)?(0,g.jsx)(Gt,{onReady:o,fetch:zt}):(i.current=!0,(0,g.jsx)(Ro,{...e}))}function Ro(e){let{app:n,stop:o,bar:i=!0,standing:c="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:E,scheme:T,store:P,presence:k,brand:F,auto:v,height:_}=pr(e),de=Tr(e.draftView),D=ur(e,rr,de.over),[ie]=(0,d.useState)(_n),f=e.basePath===void 0?{}:{basePath:e.basePath},[V]=(0,d.useState)(Dt),j=e.notices??V,Z=h=>xt(h,f),x={...e.routing?{routing:e.routing}:{},...f},[me]=(0,d.useState)(()=>{let h=e.at?.face;if(h)return h;let Q=o===void 0&&Fr(n,D)?"pages":Yt(o),K=Bt({...x,face:Q});return e.face===void 0&&e.onOpening?.(K),K}),[B,R]=(0,d.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&or(x)&&Fr(n,D)),he=(0,d.useRef)(e.onFace);he.current=e.onFace,(0,d.useLayoutEffect)(()=>{B&&(he.current?.("pages"),R(!1))},[B]);let L=B?"pages":e.face??me,O=n.schema.kinds,C=e.routing==="address",H=(0,d.useMemo)(()=>e.at?mt.settleAt(e,P.seenBy(l??{kind:"human"}),D.places()):void 0,[]),X=(0,d.useMemo)(()=>$n(D,n.schema),[D,n.schema]),q=(0,d.useMemo)(()=>{let h=H?.stop??(C?ar(e.basePath):void 0)??o;return L==="scene"&&h===void 0&&X===void 0&&(e.path===void 0||Kt(e.path))?Nt(void 0):$r(L,h,O,D.places(),X)},[]),[ye]=(0,d.useState)(L);(0,d.useEffect)(()=>{ye!=="pages"&&Bn(D)},[ye,D]);let $=(0,d.useRef)(void 0),Fe=h=>h===void 0||Kt(h)?"/":h;$.current??={path:Fe(H?.path??(C?L==="pages"?(Ft(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==$.current.asked&&($.current={path:Fe(e.path),asked:e.path});let M=(0,d.useRef)(e.onNavigate);M.current=e.onNavigate;let ee=(0,d.useCallback)((h,Q)=>{$.current.path=h,M.current?.(h,Q)},[]),{at:te,setAt:N,steering:Se,steer:J}=wr($.current.path),z=(0,d.useContext)(Wr);z&&(z.pages=()=>$.current.path);let G=(0,d.useRef)(void 0),le=(0,d.useCallback)(h=>void($.current.path=h),[]),ne=Yn(p),[Oe,Pe]=(0,d.useState)(!1),se=e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview")&&!Oe,A=se?"pages":L,Ce=(0,d.useRef)(!1);Ce.current=Oe&&e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview"),z&&(z.shown=A);let Le=(0,d.useRef)(L==="graview"?"graview":"scene");(A==="scene"||A==="graview")&&(Le.current=A),(0,d.useState)(()=>{if(!C||typeof window>"u"||A==="pages"||A==="picture")return;let{pathname:h,search:Q,hash:K}=window.location;Ft(h,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Z(Re)}${Q}${K}`)}),fr(p,A,e.onIntrinsicHeight),Po(A,ne);let re=vr(e.onError,A),Me=br(e.onReady,A),ke=(0,d.useRef)(e.onFaceDrawn);ke.current=e.onFaceDrawn;let Ye=(0,d.useCallback)((h,Q)=>{Me(Q),ke.current?.(h)},[Me]),[Be,wt]=(0,d.useState)(null),Qe=D.places(),$e=(0,d.useRef)({shown:A,onFace:e.onFace});$e.current={shown:A,onFace:e.onFace};let W=(0,d.useCallback)((h,Q,K)=>{if(C){G.current?.(h,Q,K);return}$e.current.onFace?.(h),M.current?.(h==="pages"?Q??$.current.path:Re,"push")},[C]),[ge,U]=(0,d.useState)(void 0);(0,d.useEffect)(()=>{A==="pages"&&U(void 0)},[A]);let Ne=(0,d.useRef)(o);(0,d.useEffect)(()=>{Ne.current!==o&&(Ne.current=o,U(void 0))},[o]);let Ae=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){if(Pe(!0),U(h),L==="scene"||L==="graview"){xr(L,()=>{C?window.history.pushState(null,"",`${Z(Re)}${h??""}`):M.current?.(Re,"push")});return}xr(Le.current,()=>W(Le.current,void 0,h))}},[C,L,e.basePath,W]),He=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){Se.go.current||($.current.path=h),J(h);return}if($.current.path=h,N(h),Ce.current){Pe(!1),C?window.history.pushState(null,"",Z(h)):M.current?.(h,"push");return}W("pages",h)},[Se,J,N,W,C,e.basePath]),ze=D.arrangement?.(),ue=A==="pages",Ee=e.hrefOf,We=Ee??(C?Z:void 0),Y=(0,d.useMemo)(()=>({open:He,...Ee?{href:Ee}:C?{href:h=>xt(h,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[He,C,e.basePath,Ee]);return(0,g.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":A,"data-graview-scheme":T,...se?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:_,minHeight:v?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,g.jsx)("style",{children:E}),(0,g.jsxs)(Jn.Provider,{value:re,children:[(0,g.jsx)(mr,{rootRef:p,board:j}),(0,g.jsx)(lr,{rootRef:p,firstLook:e.firstLook,app:er(F??{name:n.name},n.schema)}),(0,g.jsx)(Ue,{module:"@graview/react",report:re,content:!0,children:(0,g.jsx)(In.Provider,{value:ie,children:(0,g.jsx)(Vn,{store:P,views:D,initialView:q,scheme:T,...hr(e,k,F),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,g.jsxs)(Qn.Provider,{value:j,children:[(0,g.jsx)(Oo,{face:A,stop:ge??o,kinds:O,places:Qe,opens:X}),z?(0,g.jsx)(To,{into:z}):null,(0,g.jsx)(xo,{rootRef:p,face:L,shown:A,path:te,stop:o,draft:de.n,onDrawn:e.onDrawn,parts:ie}),C?(0,g.jsx)(ir,{pagesWere:H?.path,basePath:e.basePath,shown:A,onFace:e.onFace,toggle:G,kinds:O,places:Qe,opens:X,landed:le}):null,i&&A!=="picture"?(0,g.jsx)(Ue,{module:"@graview/embed",report:re,children:(0,g.jsx)(yr,{name:F?.name??n.name,heading:S,named:Wt(i).name!==!1,faces:Wt(i).faces===!1?void 0:{scene:{label:Fn(ze),current:!ue,go:()=>Ae(),reach:()=>void Ve(Le.current)},pages:{label:On(ze),current:ue,go:()=>He($.current.path),reach:()=>void Ve("pages")}},at:ue?te:null,without:e.pages?.without(),home:{...We?.("/")!==void 0?{href:We("/")}:{},go:()=>He("/"),current:ue&&te.split("?")[0]==="/"},reach:{...We?{href:We}:{},go:h=>He(h.path)},standing:c,hostActions:e.hostActions,keeping:ue?void 0:(0,g.jsx)(Co,{app:n,studio:e.studio,report:re}),onFind:wt,switch:e.switch})}):null,(0,g.jsx)(Xn.Provider,{value:Be,children:(0,g.jsx)(Ue,{module:A==="pages"||A==="picture"?"@graview/pages":"@graview/react",report:re,content:!0,children:(0,g.jsxs)(d.Suspense,{fallback:(0,g.jsx)(Ao,{auto:v,scene:A!=="pages"&&A!=="picture"}),children:[A==="picture"?(0,g.jsx)(vo,{scope:w,store:P,views:D,as:(o?ct(o).within?.view:void 0)??""}):A==="pages"?(0,g.jsx)(wo,{store:P,views:D,presence:k,auto:v,brand:F,steering:Se,overview:Ae,scope:w,titleLevel:gr(S),quickAsk:Vt(e.quickAsk),props:{...e,onNavigate:ee,...C?{}:{path:$.current.path}}}):(0,g.jsx)(Kn.Provider,{value:Y,children:(0,g.jsx)(yo,{address:C,auto:v,scheme:T,scope:w,quickAsk:Vt(e.quickAsk)})}),(0,g.jsx)(ko,{asked:L,shown:A,onDrawn:Ye})]})},A)})]})})})})]})]})}var Kt=e=>e.split(/[?#]/)[0]===Re,Wr=(0,d.createContext)(null);function To({into:e}){return e.view=dt().view,null}function xo({rootRef:e,face:n,shown:o,path:i,stop:c,draft:l,onDrawn:S,parts:p}){let{view:w}=dt(),E=o==="scene"||o==="graview",T=st(w),{pan:P,...k}=w,F=w.pan?st(k):T,v={face:n,path:E?Re:o==="picture"?c??"#":i,stop:T};return Ar(e,`${o} ${E?F:v.path} ${l}`,v,S,p),null}var mt,Fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.MFDSWA2W.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.J3YBEZKE.js"))),Qt=()=>Fo().then(e=>void(mt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Qt));function Oo({face:e,stop:n,kinds:o,places:i,opens:c}){let{view:l,go:S}=dt(),p=(0,d.useRef)({face:e,stop:n});return(0,d.useLayoutEffect)(()=>{let w=p.current.stop!==n,E=p.current.face!==e,T=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!E||e==="pages"||e==="picture")return;let P=(w||T)&&n!==void 0?$r(e,n,o,i):T&&cr(l)?$t(e,Nt(c),o):e==="graview"?Lt(l,!0):l.overview?Hn(Lt(l,!1),tr(l,o)):l;S(P)},[e,n,o,l,S,c]),null}function Co({app:e,studio:n,report:o}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(go,{})}),n!==!1?(0,g.jsx)(Ue,{module:"@graview/studio",report:o,children:(0,g.jsx)(Lo,{app:e,studio:n})}):null]})}function Lo({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)(Eo,{...o})})}function Mo({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 Zt(e,n){let o=n.store??n.remote?.store??dr(n.app,n.seed),i=n.notices??Dt(),c=null,l={},S=0,p=n.label,w=n.app,E=Promise.resolve(),T=n.at?.face??n.face,P=T===void 0?void 0:Bt({...n,face:T}),k=P??Yt(n.stop),F=null,v=[],_=f=>{if(F=f,f!==k)return;let V=v;v=[];for(let j of V)j()};function de(){let[f,V]=(0,d.useState)(P),[j,Z]=(0,d.useState)(n.stop),[x,me]=(0,d.useState)(n.path),[B,R]=(0,d.useState)(n.scheme??"auto"),[he,L]=(0,d.useState)(n.principal),[O,C]=(0,d.useState)(n.seats),[H,X]=(0,d.useState)(n.quickAsk),[q,ye]=(0,d.useState)(n.people),[$,Fe]=(0,d.useState)(n.hostContext),[M,ee]=(0,d.useState)(n.brand),[te,N]=(0,d.useState)(n.whileAway),[Se,J]=(0,d.useState)(n.label),[z,G]=(0,d.useState)(n.hostActions),[le,ne]=(0,d.useState)(void 0),[Oe,Pe]=(0,d.useState)(n.draftView);return c={app:se=>{ne(se),me(void 0),Z(void 0)},face:V,stop:Z,path:me,scheme:R,seat:L,seats:C,quickAsk:X,people:ye,hostContext:Fe,brand:ee,whileAway:N,label:J,hostActions:G,draft:Pe},(0,g.jsx)(Wr.Provider,{value:l,children:(0,g.jsx)(Nr,{...le?Mo(n,le):n,store:o,notices:i,...f!==void 0?{face:f}:{},onOpening:se=>{k=se},...j!==void 0?{stop:j}:{},...x!==void 0?{path:x}:{},...he?{principal:he}:{},...O?{seats:O}:{},...H!==void 0?{quickAsk:H}:{},...q?{people:q}:{},...$?{hostContext:$}:{},...M?{brand:M}:{},whileAway:te,label:Se,hostActions:z,draftView:Oe,scheme:B,onFace:se=>{k=se,V(se)},onSeat:L,onFaceDrawn:_},le?.n??0)})}let D=()=>{let f=l.view?.focusId,V=f?o.graph.getNode(f)?.kind:void 0,j=(l.shown??k)==="scene"||(l.shown??k)==="graview";return{face:k,path:j?Re:l.pages?.()??n.path??"/",stop:l.view?st(l.view):n.stop??"#",...V?{kind:V}:{}}},ie=(0,Or.createRoot)(e);return(0,I.flushSync)(()=>ie.render((0,g.jsx)(de,{}))),{get store(){return o},where:D,setApp:(f,V,j)=>{let Z="graph"in V?{store:V}:V,x=()=>{let me=D();o=Z.store,p=j?.label??(p===w.name?f.name:p),w=f,(0,I.flushSync)(()=>{c?.label(p),c?.app({app:f,remote:Z,at:me,n:++S})})};mt?x():E=E.then(Qt).then(x)},setFace:f=>{k=f,(0,I.flushSync)(()=>c?.face(f))},setStop:f=>(0,I.flushSync)(()=>c?.stop(f)),setPath:f=>(0,I.flushSync)(()=>{if(Kt(f)){(k==="pages"||k==="picture")&&(k="scene",c?.face("scene"));return}c?.path(f),k!=="pages"&&(k="pages",c?.face("pages"))}),setScheme:f=>(0,I.flushSync)(()=>c?.scheme(f)),setSeat:f=>(0,I.flushSync)(()=>c?.seat(f)),setSeats:f=>(0,I.flushSync)(()=>c?.seats(f)),setQuickAsk:f=>(0,I.flushSync)(()=>c?.quickAsk(f)),setPeople:f=>(0,I.flushSync)(()=>c?.people(f)),setHostContext:f=>(0,I.flushSync)(()=>c?.hostContext(f)),setBrand:f=>(0,I.flushSync)(()=>c?.brand(f)),setWhileAway:f=>(0,I.flushSync)(()=>c?.whileAway(f)),setDraftView:f=>(0,I.flushSync)(()=>c?.draft(f)),setLabel:f=>{p=f,(0,I.flushSync)(()=>c?.label(f))},setHostActions:f=>(0,I.flushSync)(()=>c?.hostActions(f)),drawn:()=>E.then(()=>F===k?void 0:new Promise(f=>v.push(f))),notify:f=>{let V;return(0,I.flushSync)(()=>{V=i.notify(f)}),V},unmount:()=>ie.unmount()}}var ht=e=>`s${(e+1).toString(36)}`;var Ir="/graview/friction";var _r="/graview/live",Xt="graview.ship",en=`${Xt}.${ot}`;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"};var je=class extends Error{constructor(n){super(n),this.name="Superseded"}},xe=e=>e?.lineage?{lineage:e.lineage}:{},Ho=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
|
|
2
|
-
`)[0]??"":String(n)})`;function Do(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 qe=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Vo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},pe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},Je=class extends Error{constructor(n){super(n),this.name="Unreached"}},Bo=new Set([502,503,504]);async function $o(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function No(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Wo=1,Io=()=>({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 yt(e){return(await jr(e,Do(e.carry),"This app was updated while your changes were on the way.",Io())).remote}async function jr(e,n,o,i){let c=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...gt(e.principal),[be.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,E=e.visible??qo,T="connecting",P=i.statuses,k=i.tally,F=[],v,_=[],de=()=>T==="online"&&v!==void 0?"held":T,D=()=>{let t=de();if(i.told!==t){i.told=t;for(let r of[...P])r(t)}},ie=t=>{if(!(t===T||ce)&&(T==="offline"&&t==="online"&&k.reconnects++,T=t,D(),t==="online"))for(let r of F.splice(0))r.again()},f=t=>{if(ce)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==v;if(v=r,V(),!!s&&(D(),r===void 0)){for(let a of _.splice(0))a();oe&&clearTimeout(oe),an()}},V=()=>{if(i.toldHeld!==v){i.toldHeld=v;for(let t of[...i.helds])t(v??null)}},j=async(t,r)=>{let s;try{s=await c(t,r)}catch(a){throw Y()||ie("offline"),new Je(a instanceof Error?a.message:String(a))}if(s.status===503&&await $o(s))return ie("online"),s;if(Bo.has(s.status))throw Y()||ie("offline"),new Je(`The server is away (${s.status})`);return ie("online"),s},Z=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,s=t?await c(r,{headers:l}):await j(r,{headers:l});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},x=e.state??await Z(!0);p||(T="online"),v=typeof x.held=="string"&&x.held.length>0?x.held:void 0,V();let me=x.enabledModules??e.enabledModules,B=e.localApp?e.localApp(e.app):e.app,R=new xn({schema:B.schema,mutations:B.mutations??[],invariants:B.invariants??[],...B.policy?{policy:B.policy}:{},...B.publishing?{publishing:B.publishing}:{},...B.modules?{modules:B.modules}:{},...me?{enabledModules:me}:{},...B.intelligence?{intelligence:B.intelligence}:{},...B.brand?.timeZone?{timeZone:B.brand.timeZone}:{},snapshot:x.snapshot,log:x.log,...x.horizon!==void 0?{horizon:x.horizon}:{},ids:No(),...e.storeOptions??{}});kn.served.add(R);let he=e.friction!==!1&&e.principal?.kind!=="visitor";he&&An(R,t=>{he&&c(`${e.url}${Ir}`,{method:"POST",headers:l,body:JSON.stringify({event:t})}).then(r=>void(he=r.status!==404&&r.status!==410),()=>{})});let L=Rn(R),O=x.log.at(-1)?.seq??(x.horizon??0)-1,C=Tt.of(x.log,{horizon:x.horizon??0}),H=null,X,q=new Map,ye=i.who,$=!1,Fe=t=>{if(ce)return;$=!0;let r=Cn(new Map,t,Date.now(),Ot,H?.participant);X!==void 0&&r.delete(X);let s=r.size!==q.size;if(!s)for(let[a,u]of r)Ct(u,q.get(a))||(s=!0);if(q=r,!!s)for(let a of[...ye])a([...q.values()])},M=[],ee=new Set,te=t=>{let r=M.indexOf(t);r>=0&&M.splice(r,1)},N=new Map,Se=(t,r)=>{let s=N.get(t);s&&(N.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},J,z=[],G=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(J)return z.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(m=>m.seq>O).map(m=>m.seq));if(Number.isFinite(s)&&s>O+1)return z.push({ops:t,drop:r}),le(),[];let a=M.filter(m=>t.some(ae=>ae.batch===m)),u=[...new Set([...r,...a])].filter(m=>ee.has(m)),y,b=M.filter(m=>!a.includes(m));try{y=R.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(m){if(!(m instanceof Tn))throw m;return z.push({ops:t,drop:r}),le(),[]}for(let m of a)te(m);t.some(m=>m.seq>O)&&b.some(m=>!u.includes(m))&&k.rebases++,t.length>0&&(O=Math.max(O,...t.map(m=>m.seq)),C.note(t));for(let m of u)ee.delete(m);for(let m of a)Se(m,t);return y},le=()=>{J||(J=ke(Z().then(t=>{if(ne(t)){z=[];return}let r=new Set(t.log.map(u=>u.batch)),s=M.filter(u=>r.has(u));for(let u of s)te(u);let a=R.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...M],drop:[...ee].filter(u=>!M.includes(u))});ee.clear();for(let u of a.pending)ee.add(u.batch);O=t.log.at(-1)?.seq??(t.horizon??0)-1,C=Tt.of(t.log,{horizon:t.horizon??0}),k.resyncs++;for(let u of s)Se(u,t.log)}).then(()=>{J=void 0;let t=z;z=[];for(let{ops:r,drop:s}of t)G(r,s)},()=>{J=void 0,z=[]})))},ne=t=>(typeof t.build=="string"&&cn(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===x.version?!1:(St(t.version),!0)),Oe=async t=>{let s=await(await j(`${e.url}/graview/since?seq=${ht(t)}&opFormat=${_e.op}`,{headers:l})).json();return ne(s)?[]:s.reset===!0?(le(),[]):s.ops??[]},Pe=async()=>{let t=await se();return J&&await J,t},se=async()=>{if(H&&!Y()&&E()){let r=await(await j(`${e.url}/graview/here?opFormat=${_e.op}`,{method:"POST",headers:l,body:JSON.stringify({presence:H,seq:ht(O)})})).json();return ne(r)?[]:(typeof r.participant=="string"&&(X=r.participant),Fe(r.who??[]),G(r.ops??[]))}return G(await Oe(O))},A=new Map,Ce=new Map,Le=new Set,re=new Map,Me=new Set,ke=t=>(Me.add(t),t.finally(()=>Me.delete(t)).catch(()=>{}),t),Ye=Promise.resolve(),Be=0,wt=(t,r)=>{let s=Ye.then(()=>$e(t,r));return Ye=s.catch(()=>{}),s},Qe=()=>new Promise((t,r)=>F.push({again:t,give:r})),$e=async(t,r)=>{let s,a;for(;;){try{s=await j(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(m){if(!(m instanceof Je)||U)throw m;if(await Qe(),Y())return Ze(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"?ne(a):(f(a.held),!1))break;if(v!==void 0&&(Et>0||p)){if(await new Promise(m=>_.push(m)),U)throw new je("The client closed.");if(Y())return Ze(t,r);continue}}let b;if(s.status===503&&a.reason==="unavailable"&&!U)b=tn(e.backoff,Be++);else{if(Be=0,s.status!==429||U)break;b=_o(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(m=>setTimeout(m,b)),Y())return Ze(t,r)}if(ce||ne(a))throw new je("The app was changed.");if(!s.ok){let b=a.error??`The server refused (${s.status})`;throw a.conflict?new pe(b,a.conflicts??[]):new qe({reason:a.reason??Vo[s.status]??"invalid",sentence:b,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let u=a.ops??[],y=u[0]?.seq;return y!==void 0&&y>O+1&&(u=await Oe(O)),r!==void 0&&(a.batch&&A.set(r,a.batch),te(r)),G(u,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},W,ge=!1,U=!1,Ne=0,Ae,He=0,ze=0,ue=null,Ee=()=>{},We=new Promise(t=>{Ee=t}),Y=()=>p&&ge&&W?.readyState===Wo,h=t=>{if(!Y())return!1;try{return W.send(JSON.stringify(t)),!0}catch{return!1}},Q=(t=!1)=>{!H||!Y()||!E()||!t&&ue&&Ct(H,ue)&&(w===void 0||Date.now()-ze<w)||h({t:"here",presence:H})&&(ue=H,ze=Date.now())},K=new Set,oe,an=()=>{if(oe=void 0,v!==void 0)return;let t=[...N.entries()].filter(([r])=>K.has(r));K.clear();for(let[,r]of t)h(r.message)},sn=(t,r)=>{N.has(t)&&(K.add(t),oe&&clearTimeout(oe),oe=setTimeout(an,Math.max(0,r)))},Gr=t=>{N.has(t)&&K.add(t)},Ze=(t,r)=>new Promise((s,a)=>{let u=r??`send-${++He}`,y=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...xe(t)}:{t:"call",cid:u,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(N.set(u,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),K.size>0||v!==void 0){K.add(u);return}h(y)}),Xe=(t,r)=>Y()?Ze(t,r):wt(t,r),Ur=t=>{switch(t.t){case"welcome":{if(cn(t.build),typeof t.version=="number"&&t.version!==x.version){St(t.version);return}if(ge=!0,Ne=0,typeof t.participant=="string"&&(X=t.participant),f(t.held),t.state?le():G(t.ops??[]),K.clear(),oe&&clearTimeout(oe),oe=void 0,v!==void 0)for(let r of N.keys())K.add(r);else for(let r of N.values())h(r.message);Q(!0),ie("online"),Ee();return}case"ops":G(t.ops??[]);return;case"ack":{let r=N.get(t.cid);if(!r){G(t.ops??[]);return}N.delete(t.cid),Be=0,r.mine!==void 0&&(A.set(r.mine,t.batch),te(r.mine)),G(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=N.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){v!==void 0?Gr(t.cid):sn(t.cid,tn(e.backoff,Be++));return}N.delete(t.cid),r.reject(t.t==="conflict"?new pe(t.sentence,t.conflicts??[]):new qe({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&sn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":Fe(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==x.version&&St(t.version);return;case"reload":fn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&W){let r=W;mn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},ce=!1,vt=i.declarations,bt=i.builds,cn=t=>{if(!(ce||i.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){i.otherBuild=t;for(let r of[...bt])r(t)}},dn=()=>{let t=[],r=0;for(let s of M){let a=re.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}},ln=(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.`,un=t=>{ce=!0,H=null;let r=new je(t);for(let a of N.values())a.reject(r);N.clear(),nt&&clearInterval(nt),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let a of F.splice(0))a.give(r);for(let a of _.splice(0))a();let s=W;W=void 0,ge=!1;try{s?.close(1e3,t)}catch{}Ee()};async function St(t){if(ce)return;if(!e.resolveApp){fn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=dn(),a=e.resolveApp,u=H;un("The app was changed.");try{let y=await a(t),{state:b,...m}=e,ae=await jr({...m,app:y},r,"The app was changed while your changes were on the way.",i);u&&ae.remote.presence.here(u);for(let rt of[...vt])rt(ae.remote,t);let fe=[...s>0?[et(ln(s,"The app was changed"))]:[],...ae.unheard()];for(let rt of fe)for(let to of Ie)to(rt.sentence,rt)}catch(y){let b=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let m of Ie)m(b,et(b))}}function fn(t){if(ce)return;let{carried:r,undos:s}=dn();un(t);let a=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),a=!0}catch{}let u=[];!a&&r.length>0&&u.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&&u.push(ln(s,"This app was updated"));for(let y of u)for(let b of Ie)b(y,et(y));(e.reloadPage??jo)()}let pn=()=>{if(U||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${_r}`,{"content-type":r,...s}=l,a;try{a=e.socket?e.socket(t,s,[en]):eo(t,s)}catch{return hn()}W=a,ge=!1,a.onopen=()=>{W===a&&a.send(JSON.stringify({t:"hello",seq:ht(O),protocol:ot,wire:Xt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},a.onmessage=u=>{if(W!==a)return;let y;try{y=JSON.parse(String(u.data))}catch{return}Ur(y)},a.onclose=()=>mn(a),a.onerror=()=>{}},we,Kr=()=>{$=!1,we&&clearTimeout(we),we=setTimeout(()=>{if(we=void 0,$||U)return;let t=new Map([...q].filter(([,r])=>r.held!=="socket"));if(t.size!==q.size){q=t;for(let r of ye)r([...q.values()])}},Ot),we.unref?.()};function mn(t){if(W!==t)return;let r=ge;W=void 0,ge=!1,ue=null,r&&(ie("offline"),Kr()),hn()}let hn=()=>{if(U)return;let t=tn(e.backoff,Ne);Ne++,Ae=setTimeout(pn,t)},yn=R.applyAll.bind(R),Jr=R.undo.bind(R),Yr=R.previewAll.bind(R);R.previewAll=(t,r)=>Yr(t,{...e.principal?{author:e.principal}:{},...r});let Ie=i.refusals,Ge=[],et=t=>({reason:"invalid",sentence:t}),tt=i.conflicts,Pt=!1,gn,kt=async(t,r)=>{if(r instanceof je||ce)return;let s=r instanceof qe?r.refusal:Sn(r),a=s.sentence,u=r instanceof pe?gn?.yoursOf(R,re.get(t)?.calls??[]):void 0;te(t);try{G([],[t])}catch{}let y=re.get(t);re.delete(t);let b=y?.calls[0];if(b&&!(r instanceof pe)){let m=R.allMutations().find(fe=>fe.name===b.name)?.subject?.arg,ae=m&&R.graph.getNode(b.args[m])?.kind;En(R,{type:"refused",act:b.name,code:s.reason,...ae?{kind:ae}:{}},e.principal)}if(r instanceof pe&&k.conflicts++,r instanceof pe&&!Y()&&await Pe().catch(()=>[]),r instanceof pe&&J&&await J,r instanceof pe&&tt.size>0){let m=!1,ae={sentence:a,conflicts:u?r.conflicts.map(fe=>fe.node===u.node&&fe.field===u.field?{...fe,yours:u.yours}:fe):r.conflicts,keepTheirs(){m=!0},useMine(){if(!(m||!y)){m=!0,Pt=!0;try{R.applyAll(u?[u.over(O)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...xe(y)})}finally{Pt=!1}}}};for(let fe of tt)fe(ae);return}for(let m of Ie)m(a,s)},Qr=(t,r)=>t.flatMap(s=>s.mutation?.name===bn?[]: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:O}]:[]));R.applyAll=(t,r)=>{let s=Pn(R.log.all().filter(b=>ee.has(b.batch))),a=yn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,m)=>{let ae=a.minted?.[m];return ae===void 0||b.args?.id!==void 0?b:{...b,mintedHint:ae}});M.push(a.batch),ee.add(a.batch),re.set(a.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...xe(r)});let y=Pt?[]:[...C.baseFor(a.ops,s,(b,m)=>R.collaborative(b,m)),...Qr(a.ops,s)];return Ce.set(a.batch,ke(Xe({calls:u,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...xe(r)},a.batch).catch(b=>kt(a.batch,b)))),a},R.apply=(t,r)=>R.applyAll([t],r),R.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=Jr(s.map(y=>A.get(y)??y),{...e.principal?{author:e.principal}:{},...r});M.push(a.batch),ee.add(a.batch);let u=Promise.allSettled(s.map(y=>Ce.get(y)));return Ce.set(a.batch,ke(u.then(()=>{let y=s.filter(b=>!Le.has(b));if(y.length===0){te(a.batch),re.delete(a.batch),G([],[a.batch]);return}return Xe({undo:y.map(b=>A.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...xe(r)},a.batch)}).catch(y=>kt(a.batch,y)))),a};let Zr=async(t,r={})=>{At++;try{return(await ke(Xe({calls:t,...r}))).ops}finally{At--}},At=0,wn={here(t){H=t,Q()},onWho(t){return ye.add(t),q.size>0&&t([...q.values()]),()=>{ye.delete(t)}},leave(){if(!H)return;let t=JSON.stringify({participant:X??H.participant});if(H=null,h({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):c(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},Et=e.pollMs??800,nt=Et>0&&typeof setInterval=="function"?setInterval(()=>{Y()||Pe().catch(()=>{})},Et):null;if(p){pn();let t;await Promise.race([We,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!ce){let t=[],r=new Set(R.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{R.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...xe(s)})}catch(a){t.push(Ho(s,a))}t.length>0&&Ge.push(et(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let vn=new Map,Xr=()=>({store:R,author:e.principal,appliedAll:yn,pending:M,provisional:ee,asked:re,answers:Ce,letGo:Le,sent:(t,r)=>ke(Xe({calls:r,batch:t},t).catch(s=>kt(t,s))),settle:te,land:G,seen:()=>O,gone:()=>U||ce});return{remote:{store:R,typing(t,r){let s=`${t}\0${r}`,a=vn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.MJMVGW6Z.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TAIYNHSW.js")).then(u=>(gn=u,u.typingOf(t,r,u.wireOf(Xr())))),vn.set(s,a)),a},version:x.version,migrated:x.migrated??[],send:Zr,pull:Pe,onRefusal(t){Ie.add(t);let r=Ge;Ge=[];for(let s of r)t(s.sentence,s);return()=>Ie.delete(t)},onDeclaration(t){return vt.add(t),()=>vt.delete(t)},onBuild(t){return bt.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>bt.delete(t)},onConflict(t){return tt.add(t),()=>tt.delete(t)},revision:(t,r)=>C.of(t,r),seq:()=>O,participant:()=>X,transport:()=>Y()?"socket":"poll",status:de,onStatus(t){return P.add(t),()=>P.delete(t)},held:()=>v,onHeld(t){return i.helds.add(t),v!==void 0&&t(v),()=>i.helds.delete(t)},counters:()=>({...k}),who:()=>[...q.values()],pending:()=>M.length+At,async settled(){for(;Me.size>0;)await Promise.allSettled([...Me])},presence:wn,close(){nt&&clearInterval(nt),L(),wn.leave(),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let r of F.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of _.splice(0))r();let t=W;W=void 0,ge=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ge;return Ge=[],t}};function eo(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",u=e.subprotocol?[en]:[];if(!a)try{return new s(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let y=new URL(t);for(let[b,m]of Object.entries(S))y.searchParams.set(b,m);return u.length>0?new s(y.toString(),u):new s(y.toString())}}function _o(e,n,o=Date.now()){let i,c=e?.trim();if(c)if(/^\d+(\.\d+)?$/.test(c))i=Number(c)*1e3;else{let p=Date.parse(c);Number.isFinite(p)&&(i=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&i!==void 0&&Math.abs(l*1e3-i)<1e3;return l!==void 0&&!S?l:i??1e3}function jo(){globalThis.location?.reload?.()}function qo(){return globalThis.document?.visibilityState!=="hidden"}function tn(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:c=2}=e??{};return Math.min(i,o*c**n)*(.75+Math.random()*.5)}function gt(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 qr="/graview/views";function nn(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),i={"content-type":"application/json",...e.principal?gt(e.principal):{},...e.headers??{}},c=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??at.may}:at,l=new Set,S=P=>{if(JSON.stringify(P)!==JSON.stringify(c)){c=P;for(let k of l)k()}},p=async(P,k)=>{let F=await n(`${o}${e.path??qr}`,{method:P,headers:i,...k!==void 0?{body:JSON.stringify(k)}:{}}),v=await F.json();if(!F.ok)throw new Error(v.error??`The store answered ${F.status}.`);S({hidden:v.hidden??[],removed:v.removed??[],may:v.may??at.may})},w=()=>p("GET"),E=e.state?Promise.resolve():w().catch(()=>{}),T=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:E,refresh:w,close:()=>clearInterval(T),current:()=>c,onChange(P){return l.add(P),()=>void l.delete(P)},hide:P=>p("POST",{hide:P}),show:P=>p("POST",{show:P}),remove:(P,k)=>p("POST",{remove:P,...k?{about:k}:{}}),async restore(P){let k=c.removed.find(F=>F.name===P)?.lens;await p("POST",{restore:P}),k&&await e.onDeclaration?.()},async lens(P){await p("POST",{lens:P}),await e.onDeclaration?.()}}}var on=document.getElementById("graview-app"),rn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),zr=rn?(__graviewPreload(import.meta.url,["./chunk.USB6B6L3.js","./chunk.TAJ2R44N.js","./chunk.XOZU4OFA.js","./chunk.IT763BYH.js","./chunk.2OX4YI46.js","./chunk.XY5EVI22.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SRC37GNP.js")):Ve("pages");try{rn?await zo(decodeURIComponent(rn[1])):await Go()}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),on.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 lt(o);if(!i.ok)throw new Error(it(i.findings));let c=i.app,l=o.principal,S=await yt({app:c,url:location.origin,principal:l,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=c.forms?.[e]?.title??c.name;let{mount:p}=await zr;window.__graview=p(on,{app:c,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Go(){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 w=>{if(typeof w.module=="string")return(await import(w.module)).app;let E=await lt(w);if(!E.ok)throw new Error(it(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 c=n.principal,l=await yt({app:i,url:location.origin,principal:c,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let S,p=nn({url:location.origin,principal:c,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let E=await lt(w);E.ok&&S?.setApp(E.app,l)}});await Promise.all([zr,p.ready]),S=Zt(on,{app:i,remote:l,principal:c,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.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 ro}from"./chunk.NF72Z2HG.js";import{a as Wt,b as lr,c as ur,d as fr,e as It,f as pr,g as mr,h as hr,i as yr,j as gr,k as wr,l as vr,m as br,n as Ue}from"./chunk.KTV24HY7.js";import{b as dr}from"./chunk.KPIDJYIU.js";import{a as Bt,b as or,c as ar,d as ir,e as sr,f as $t,g as cr,h as Nt}from"./chunk.N5MQARN6.js";import{a as Rt,g as Ln}from"./chunk.IV7AUO53.js";import{k as it}from"./chunk.CMLNBJZG.js";import{E as tr,I as nr,J as rr,h as Yn,k as Dt,l as Qn,n as Zn,r as Xn,w as Vt,z as er}from"./chunk.JQFIZRAZ.js";import{c as no}from"./chunk.LKJ6FD6Y.js";import{Aa as qn,Ca as zn,Da as Gn,Fa as Un,G as Mt,Ga as Ht,Ka as Kn,La as Jn,Oa as dt,T as Dn,Z as Vn,a as Mn,b as st,c as ct,ga as Bn,ha as $n,j as Hn,m as Lt,va as Nn,wa as Wn,xa as In,ya as _n,za as jn}from"./chunk.DBMZ3AQB.js";import{a as Te}from"./chunk.SDO3U72B.js";import{$d as Cn,Eb as Sn,Pd as Re,Qd as Fn,Rd as On,Wd as xt,Xc as kn,Xd as Ft,Yd as Ot,ae as Ct,fb as _e,hc as Tt,hd as An,ic as Pn,id as En,nd as Rn,pd as Tn,qb as ot,qd as xn,rb as bn,sd as at}from"./chunk.DIFR37EZ.js";import"./chunk.FQLNBIQ5.js";import{b as De}from"./chunk.AJZBJBMO.js";function _t(e){if(Array.isArray(e))return e.map(_t);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=_t(i))}return n}return e}function jt(e){return JSON.stringify(_t(e))??"undefined"}async function lt(e,n={}){let o=e.compiled===void 0||!ao(e.compiled,e.document)?void 0:Ln(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await oo();return i(e.document,n)}var Sr,oo=()=>Sr??=(__graviewPreload(import.meta.url,["./chunk.IV7AUO53.js","./chunk.V6FUYRZI.js","./chunk.BZEJM2PY.js","./chunk.CMLNBJZG.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DQUISKTC.js")).catch(e=>{throw Sr=void 0,e});function ao(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&&jt(Rt(o).document)===jt(Rt(i).document)}var d=De(Mt(),1);var ft=De(Mt(),1),qt="data-graview-drawn",io=200,Pr=50,so=1e4,ut=()=>typeof performance<"u"?performance.now():Date.now();function co(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 lo(e,n){if(e.ownerDocument.fonts?.status==="loading"||Wn()>0||qn(n)>0||e.querySelector('[aria-busy="true"]')||co(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 kr(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 uo(e,n,o,i){e.removeAttribute(qt);let c=e.ownerDocument.defaultView;if(!c)return()=>{};let l=ut(),S=l,p=kr(e),w=!1,E,T=typeof MutationObserver>"u"?void 0:new MutationObserver(v=>{v.some(_=>!(_.target===e&&_.attributeName===qt))&&(S=ut())});T?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let P=()=>{w=!0,T?.disconnect(),E!==void 0&&clearTimeout(E)},k=v=>{let _=!1,de=()=>{_||(_=!0,v())};typeof c.requestAnimationFrame=="function"&&c.requestAnimationFrame(()=>setTimeout(de,0)),setTimeout(de,100)},F=()=>{if(w)return;let v=kr(e);v!==p&&(p=v,S=ut());let _=ut();if(lo(e,i)&&_-S>=io||_-l>=so){k(()=>{w||(P(),e.setAttribute(qt,n),Gn(),o())});return}E=setTimeout(F,Pr)};return E=setTimeout(F,Pr),P}function Ar(e,n,o,i,c){zn();let l=(0,ft.useRef)({place:o,onDrawn:i});l.current={place:o,onDrawn:i},(0,ft.useLayoutEffect)(()=>{c&&jn(c);let S=E=>uo(E,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),c);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,c])}var ve=De(Mt(),1),Ke,fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.5IEFTFKQ.js","./chunk.4UQBMFJZ.js","./chunk.QMYHXMRV.js","./chunk.Z5UVYOGC.js","./chunk.VSGTNYM2.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.FJTWAU7N.js"))),Er=()=>fo().then(e=>void(Ke=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Er)),zt=Nn(Er),Rr=e=>!!e&&Ke===void 0;function Gt({onReady:e,fetch:n}){return(0,ve.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var po=0;function Tr(e){let[n,o]=(0,ve.useState)(()=>Ke);(0,ve.useEffect)(()=>{if(!e||n)return;let l=!1;return zt().then(()=>{l||o(Ke)}),()=>{l=!0}},[e,n]);let i=(0,ve.useMemo)(()=>po+=1,[e]);return{over:(0,ve.useMemo)(()=>{let l=n??Ke;if(!e||!l)return;let{source:S,worker:p,...w}=e,E={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:T=>l.registerWorkerView(T,E)}},[e,n]),n:i}}var Or=De(ro(),1),I=De(no(),1);var g=De(Dn(),1);function pt(e,n={}){let o=Ht(e);return{Face:o.part((c,l)=>(0,d.createElement)(c,l),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Jt=e=>Promise.all([e,nr()]).then(([n])=>n),Cr=Te(()=>(__graviewPreload(import.meta.url,["./chunk.UWQ3I5OW.js","./chunk.JETT6ELP.js","./chunk.6SD7YZ4U.js","./chunk.IX63LTRQ.js","./chunk.TVURUMU4.js","./chunk.47T3KUAA.js","./chunk.NZDWXX6H.js","./chunk.HJCQ6I3S.js","./chunk.7IXTNST2.js","./chunk.D4EP7FEC.js","./chunk.BPEUHOKH.js","./chunk.UGOKORIF.js","./chunk.4BRM5SGO.js","./chunk.DJ4A76SX.js","./chunk.VDS3IOTK.js","./chunk.SAJLIA5M.js","./chunk.I2NI7CT7.js","./chunk.C7EJPV2N.js","./chunk.7ML2BWSP.js","./chunk.BCE6LIDR.js","./chunk.MBLFZF5R.js","./chunk.KTV24HY7.js","./chunk.KPIDJYIU.js","./chunk.XTBS64IT.js","./chunk.GZHZLJBF.js","./chunk.QPL3OXW3.js","./chunk.OJGHDWI6.js","./chunk.FRERJWZJ.js","./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.JQFIZRAZ.js","./chunk.LKJ6FD6Y.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.6AH26OL7.js"))),mo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.JD5HSAMC.js","./chunk.4JDHBNEA.js","./chunk.M72JKVHP.js","./chunk.YQXA4WAM.js","./chunk.UWQ3I5OW.js","./chunk.UGFDSE37.js","./chunk.PXQVXBNG.js","./chunk.FLMNWVSY.js","./chunk.JETT6ELP.js","./chunk.DSLGMCB6.js","./chunk.IX63LTRQ.js","./chunk.I636CZE4.js","./chunk.TVURUMU4.js","./chunk.UV3U4FRT.js","./chunk.EZ4TZUMM.js","./chunk.47T3KUAA.js","./chunk.NZDWXX6H.js","./chunk.C5EFUODO.js","./chunk.UGOKORIF.js","./chunk.VDS3IOTK.js","./chunk.YS5U3DUX.js","./chunk.SAJLIA5M.js","./chunk.LWRXCO2Z.js","./chunk.I2NI7CT7.js","./chunk.LHIT3EZD.js","./chunk.BJUUSIQY.js","./chunk.BCE6LIDR.js","./chunk.MBLFZF5R.js","./chunk.XOZU4OFA.js","./chunk.5NZDFT6R.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.7INWDFNG.js","./chunk.FPGU43SC.js","./chunk.V6FUYRZI.js","./chunk.5BPRGXIW.js","./chunk.BZEJM2PY.js","./chunk.CMLNBJZG.js","./chunk.GZHZLJBF.js","./chunk.QPL3OXW3.js","./chunk.OJGHDWI6.js","./chunk.FRERJWZJ.js","./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.JQFIZRAZ.js","./chunk.LKJ6FD6Y.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.I6H3HRWT.js"))),ho=Te(()=>(__graviewPreload(import.meta.url,["./chunk.JD5HSAMC.js","./chunk.4JDHBNEA.js","./chunk.M72JKVHP.js","./chunk.YQXA4WAM.js","./chunk.UWQ3I5OW.js","./chunk.UGFDSE37.js","./chunk.PXQVXBNG.js","./chunk.FLMNWVSY.js","./chunk.JETT6ELP.js","./chunk.DSLGMCB6.js","./chunk.IX63LTRQ.js","./chunk.I636CZE4.js","./chunk.TVURUMU4.js","./chunk.UV3U4FRT.js","./chunk.EZ4TZUMM.js","./chunk.47T3KUAA.js","./chunk.NZDWXX6H.js","./chunk.C5EFUODO.js","./chunk.UGOKORIF.js","./chunk.VDS3IOTK.js","./chunk.YS5U3DUX.js","./chunk.SAJLIA5M.js","./chunk.LWRXCO2Z.js","./chunk.I2NI7CT7.js","./chunk.LHIT3EZD.js","./chunk.BJUUSIQY.js","./chunk.BCE6LIDR.js","./chunk.MBLFZF5R.js","./chunk.XOZU4OFA.js","./chunk.5NZDFT6R.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.7INWDFNG.js","./chunk.FPGU43SC.js","./chunk.V6FUYRZI.js","./chunk.5BPRGXIW.js","./chunk.BZEJM2PY.js","./chunk.CMLNBJZG.js","./chunk.GZHZLJBF.js","./chunk.QPL3OXW3.js","./chunk.OJGHDWI6.js","./chunk.FRERJWZJ.js","./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.JQFIZRAZ.js","./chunk.LKJ6FD6Y.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4SBYXHCQ.js"))),Lr=pt(()=>Jt(Cr().then(e=>e.SceneFace)),{what:"This view"}),Mr=pt(()=>Cr().then(e=>e.SceneKeeping),{quiet:!0}),Hr=pt(()=>Jt(mo().then(e=>e.PagesContent)),{what:"This page"}),Dr=pt(()=>Jt(ho().then(e=>e.PictureFace)),{what:"This picture"}),yo=Lr.Face,go=Mr.Face,wo=Hr.Face,vo=Dr.Face;function Ve(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Vr));return Promise.all([...[...o].map(i=>i.fetch()),Zn()]).then(()=>{},()=>{})}var Vr=e=>e==="pages"?[Hr]:e==="picture"?[Dr]:[Lr,Mr],Br=e=>Vr(e).every(n=>n.here()),bo=150,Ut=0;function xr(e,n){if(Br(e))return n();let o=++Ut,i=()=>{o===Ut&&(Ut+=1,n())};Ve(e).then(i),setTimeout(i,bo)}var So=768;function Po(e,n){let o=n!==null&&n>=So;(0,d.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(Br(i))return;let c=globalThis,l=()=>void Ve(i),S=()=>{},p=Un(()=>{if(c.requestIdleCallback&&c.cancelIdleCallback){let w=c.requestIdleCallback(l,{timeout:4e3});S=()=>c.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,o])}function ko({asked:e,shown:n,onDrawn:o}){return(0,d.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function Ao({auto:e,scene:n}){return(0,g.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${It}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Eo=Ht(Te(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,g.jsx)(e.StudioPlace,{...n}),{quiet:!0});function $r(e,n,o,i,c){return $t(e,sr(n?ct(n):c??Mn,i),o)}function Yt(e){return e&&ct(e).overview?"graview":"scene"}function Fr(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 Nr(e){let[,n]=(0,d.useState)(!1),o=(0,d.useCallback)(()=>n(!0),[]),i=(0,d.useRef)(!1);return e.at&&!mt?(0,g.jsx)(Gt,{onReady:o,fetch:Qt}):!i.current&&Rr(e.draftView)?(0,g.jsx)(Gt,{onReady:o,fetch:zt}):(i.current=!0,(0,g.jsx)(Ro,{...e}))}function Ro(e){let{app:n,stop:o,bar:i=!0,standing:c="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:E,scheme:T,store:P,presence:k,brand:F,auto:v,height:_}=pr(e),de=Tr(e.draftView),D=ur(e,rr,de.over),[ie]=(0,d.useState)(_n),f=e.basePath===void 0?{}:{basePath:e.basePath},[V]=(0,d.useState)(Dt),j=e.notices??V,Z=h=>xt(h,f),x={...e.routing?{routing:e.routing}:{},...f},[me]=(0,d.useState)(()=>{let h=e.at?.face;if(h)return h;let Q=o===void 0&&Fr(n,D)?"pages":Yt(o),K=Bt({...x,face:Q});return e.face===void 0&&e.onOpening?.(K),K}),[B,R]=(0,d.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&or(x)&&Fr(n,D)),he=(0,d.useRef)(e.onFace);he.current=e.onFace,(0,d.useLayoutEffect)(()=>{B&&(he.current?.("pages"),R(!1))},[B]);let L=B?"pages":e.face??me,O=n.schema.kinds,C=e.routing==="address",H=(0,d.useMemo)(()=>e.at?mt.settleAt(e,P.seenBy(l??{kind:"human"}),D.places()):void 0,[]),X=(0,d.useMemo)(()=>$n(D,n.schema),[D,n.schema]),q=(0,d.useMemo)(()=>{let h=H?.stop??(C?ar(e.basePath):void 0)??o;return L==="scene"&&h===void 0&&X===void 0&&(e.path===void 0||Kt(e.path))?Nt(void 0):$r(L,h,O,D.places(),X)},[]),[ye]=(0,d.useState)(L);(0,d.useEffect)(()=>{ye!=="pages"&&Bn(D)},[ye,D]);let $=(0,d.useRef)(void 0),Fe=h=>h===void 0||Kt(h)?"/":h;$.current??={path:Fe(H?.path??(C?L==="pages"?(Ft(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==$.current.asked&&($.current={path:Fe(e.path),asked:e.path});let M=(0,d.useRef)(e.onNavigate);M.current=e.onNavigate;let ee=(0,d.useCallback)((h,Q)=>{$.current.path=h,M.current?.(h,Q)},[]),{at:te,setAt:N,steering:Se,steer:J}=wr($.current.path),z=(0,d.useContext)(Wr);z&&(z.pages=()=>$.current.path);let G=(0,d.useRef)(void 0),le=(0,d.useCallback)(h=>void($.current.path=h),[]),ne=Yn(p),[Oe,Pe]=(0,d.useState)(!1),se=e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview")&&!Oe,A=se?"pages":L,Ce=(0,d.useRef)(!1);Ce.current=Oe&&e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview"),z&&(z.shown=A);let Le=(0,d.useRef)(L==="graview"?"graview":"scene");(A==="scene"||A==="graview")&&(Le.current=A),(0,d.useState)(()=>{if(!C||typeof window>"u"||A==="pages"||A==="picture")return;let{pathname:h,search:Q,hash:K}=window.location;Ft(h,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Z(Re)}${Q}${K}`)}),fr(p,A,e.onIntrinsicHeight),Po(A,ne);let re=vr(e.onError,A),Me=br(e.onReady,A),ke=(0,d.useRef)(e.onFaceDrawn);ke.current=e.onFaceDrawn;let Ye=(0,d.useCallback)((h,Q)=>{Me(Q),ke.current?.(h)},[Me]),[Be,wt]=(0,d.useState)(null),Qe=D.places(),$e=(0,d.useRef)({shown:A,onFace:e.onFace});$e.current={shown:A,onFace:e.onFace};let W=(0,d.useCallback)((h,Q,K)=>{if(C){G.current?.(h,Q,K);return}$e.current.onFace?.(h),M.current?.(h==="pages"?Q??$.current.path:Re,"push")},[C]),[ge,U]=(0,d.useState)(void 0);(0,d.useEffect)(()=>{A==="pages"&&U(void 0)},[A]);let Ne=(0,d.useRef)(o);(0,d.useEffect)(()=>{Ne.current!==o&&(Ne.current=o,U(void 0))},[o]);let Ae=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){if(Pe(!0),U(h),L==="scene"||L==="graview"){xr(L,()=>{C?window.history.pushState(null,"",`${Z(Re)}${h??""}`):M.current?.(Re,"push")});return}xr(Le.current,()=>W(Le.current,void 0,h))}},[C,L,e.basePath,W]),He=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){Se.go.current||($.current.path=h),J(h);return}if($.current.path=h,N(h),Ce.current){Pe(!1),C?window.history.pushState(null,"",Z(h)):M.current?.(h,"push");return}W("pages",h)},[Se,J,N,W,C,e.basePath]),ze=D.arrangement?.(),ue=A==="pages",Ee=e.hrefOf,We=Ee??(C?Z:void 0),Y=(0,d.useMemo)(()=>({open:He,...Ee?{href:Ee}:C?{href:h=>xt(h,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[He,C,e.basePath,Ee]);return(0,g.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":A,"data-graview-scheme":T,...se?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:_,minHeight:v?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,g.jsx)("style",{children:E}),(0,g.jsxs)(Jn.Provider,{value:re,children:[(0,g.jsx)(mr,{rootRef:p,board:j}),(0,g.jsx)(lr,{rootRef:p,firstLook:e.firstLook,app:er(F??{name:n.name},n.schema)}),(0,g.jsx)(Ue,{module:"@graview/react",report:re,content:!0,children:(0,g.jsx)(In.Provider,{value:ie,children:(0,g.jsx)(Vn,{store:P,views:D,initialView:q,scheme:T,...hr(e,k,F),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,g.jsxs)(Qn.Provider,{value:j,children:[(0,g.jsx)(Oo,{face:A,stop:ge??o,kinds:O,places:Qe,opens:X}),z?(0,g.jsx)(To,{into:z}):null,(0,g.jsx)(xo,{rootRef:p,face:L,shown:A,path:te,stop:o,draft:de.n,onDrawn:e.onDrawn,parts:ie}),C?(0,g.jsx)(ir,{pagesWere:H?.path,basePath:e.basePath,shown:A,onFace:e.onFace,toggle:G,kinds:O,places:Qe,opens:X,landed:le}):null,i&&A!=="picture"?(0,g.jsx)(Ue,{module:"@graview/embed",report:re,children:(0,g.jsx)(yr,{name:F?.name??n.name,heading:S,named:Wt(i).name!==!1,faces:Wt(i).faces===!1?void 0:{scene:{label:Fn(ze),current:!ue,go:()=>Ae(),reach:()=>void Ve(Le.current)},pages:{label:On(ze),current:ue,go:()=>He($.current.path),reach:()=>void Ve("pages")}},at:ue?te:null,without:e.pages?.without(),home:{...We?.("/")!==void 0?{href:We("/")}:{},go:()=>He("/"),current:ue&&te.split("?")[0]==="/"},reach:{...We?{href:We}:{},go:h=>He(h.path)},standing:c,hostActions:e.hostActions,keeping:ue?void 0:(0,g.jsx)(Co,{app:n,studio:e.studio,report:re}),onFind:wt,switch:e.switch})}):null,(0,g.jsx)(Xn.Provider,{value:Be,children:(0,g.jsx)(Ue,{module:A==="pages"||A==="picture"?"@graview/pages":"@graview/react",report:re,content:!0,children:(0,g.jsxs)(d.Suspense,{fallback:(0,g.jsx)(Ao,{auto:v,scene:A!=="pages"&&A!=="picture"}),children:[A==="picture"?(0,g.jsx)(vo,{scope:w,store:P,views:D,as:(o?ct(o).within?.view:void 0)??""}):A==="pages"?(0,g.jsx)(wo,{store:P,views:D,presence:k,auto:v,brand:F,steering:Se,overview:Ae,scope:w,titleLevel:gr(S),quickAsk:Vt(e.quickAsk),props:{...e,onNavigate:ee,...C?{}:{path:$.current.path}}}):(0,g.jsx)(Kn.Provider,{value:Y,children:(0,g.jsx)(yo,{address:C,auto:v,scheme:T,scope:w,quickAsk:Vt(e.quickAsk)})}),(0,g.jsx)(ko,{asked:L,shown:A,onDrawn:Ye})]})},A)})]})})})})]})]})}var Kt=e=>e.split(/[?#]/)[0]===Re,Wr=(0,d.createContext)(null);function To({into:e}){return e.view=dt().view,null}function xo({rootRef:e,face:n,shown:o,path:i,stop:c,draft:l,onDrawn:S,parts:p}){let{view:w}=dt(),E=o==="scene"||o==="graview",T=st(w),{pan:P,...k}=w,F=w.pan?st(k):T,v={face:n,path:E?Re:o==="picture"?c??"#":i,stop:T};return Ar(e,`${o} ${E?F:v.path} ${l}`,v,S,p),null}var mt,Fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.N5MQARN6.js","./chunk.JQFIZRAZ.js","./chunk.LKJ6FD6Y.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4NPXMYA5.js"))),Qt=()=>Fo().then(e=>void(mt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Qt));function Oo({face:e,stop:n,kinds:o,places:i,opens:c}){let{view:l,go:S}=dt(),p=(0,d.useRef)({face:e,stop:n});return(0,d.useLayoutEffect)(()=>{let w=p.current.stop!==n,E=p.current.face!==e,T=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!E||e==="pages"||e==="picture")return;let P=(w||T)&&n!==void 0?$r(e,n,o,i):T&&cr(l)?$t(e,Nt(c),o):e==="graview"?Lt(l,!0):l.overview?Hn(Lt(l,!1),tr(l,o)):l;S(P)},[e,n,o,l,S,c]),null}function Co({app:e,studio:n,report:o}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(go,{})}),n!==!1?(0,g.jsx)(Ue,{module:"@graview/studio",report:o,children:(0,g.jsx)(Lo,{app:e,studio:n})}):null]})}function Lo({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)(Eo,{...o})})}function Mo({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 Zt(e,n){let o=n.store??n.remote?.store??dr(n.app,n.seed),i=n.notices??Dt(),c=null,l={},S=0,p=n.label,w=n.app,E=Promise.resolve(),T=n.at?.face??n.face,P=T===void 0?void 0:Bt({...n,face:T}),k=P??Yt(n.stop),F=null,v=[],_=f=>{if(F=f,f!==k)return;let V=v;v=[];for(let j of V)j()};function de(){let[f,V]=(0,d.useState)(P),[j,Z]=(0,d.useState)(n.stop),[x,me]=(0,d.useState)(n.path),[B,R]=(0,d.useState)(n.scheme??"auto"),[he,L]=(0,d.useState)(n.principal),[O,C]=(0,d.useState)(n.seats),[H,X]=(0,d.useState)(n.quickAsk),[q,ye]=(0,d.useState)(n.people),[$,Fe]=(0,d.useState)(n.hostContext),[M,ee]=(0,d.useState)(n.brand),[te,N]=(0,d.useState)(n.whileAway),[Se,J]=(0,d.useState)(n.label),[z,G]=(0,d.useState)(n.hostActions),[le,ne]=(0,d.useState)(void 0),[Oe,Pe]=(0,d.useState)(n.draftView);return c={app:se=>{ne(se),me(void 0),Z(void 0)},face:V,stop:Z,path:me,scheme:R,seat:L,seats:C,quickAsk:X,people:ye,hostContext:Fe,brand:ee,whileAway:N,label:J,hostActions:G,draft:Pe},(0,g.jsx)(Wr.Provider,{value:l,children:(0,g.jsx)(Nr,{...le?Mo(n,le):n,store:o,notices:i,...f!==void 0?{face:f}:{},onOpening:se=>{k=se},...j!==void 0?{stop:j}:{},...x!==void 0?{path:x}:{},...he?{principal:he}:{},...O?{seats:O}:{},...H!==void 0?{quickAsk:H}:{},...q?{people:q}:{},...$?{hostContext:$}:{},...M?{brand:M}:{},whileAway:te,label:Se,hostActions:z,draftView:Oe,scheme:B,onFace:se=>{k=se,V(se)},onSeat:L,onFaceDrawn:_},le?.n??0)})}let D=()=>{let f=l.view?.focusId,V=f?o.graph.getNode(f)?.kind:void 0,j=(l.shown??k)==="scene"||(l.shown??k)==="graview";return{face:k,path:j?Re:l.pages?.()??n.path??"/",stop:l.view?st(l.view):n.stop??"#",...V?{kind:V}:{}}},ie=(0,Or.createRoot)(e);return(0,I.flushSync)(()=>ie.render((0,g.jsx)(de,{}))),{get store(){return o},where:D,setApp:(f,V,j)=>{let Z="graph"in V?{store:V}:V,x=()=>{let me=D();o=Z.store,p=j?.label??(p===w.name?f.name:p),w=f,(0,I.flushSync)(()=>{c?.label(p),c?.app({app:f,remote:Z,at:me,n:++S})})};mt?x():E=E.then(Qt).then(x)},setFace:f=>{k=f,(0,I.flushSync)(()=>c?.face(f))},setStop:f=>(0,I.flushSync)(()=>c?.stop(f)),setPath:f=>(0,I.flushSync)(()=>{if(Kt(f)){(k==="pages"||k==="picture")&&(k="scene",c?.face("scene"));return}c?.path(f),k!=="pages"&&(k="pages",c?.face("pages"))}),setScheme:f=>(0,I.flushSync)(()=>c?.scheme(f)),setSeat:f=>(0,I.flushSync)(()=>c?.seat(f)),setSeats:f=>(0,I.flushSync)(()=>c?.seats(f)),setQuickAsk:f=>(0,I.flushSync)(()=>c?.quickAsk(f)),setPeople:f=>(0,I.flushSync)(()=>c?.people(f)),setHostContext:f=>(0,I.flushSync)(()=>c?.hostContext(f)),setBrand:f=>(0,I.flushSync)(()=>c?.brand(f)),setWhileAway:f=>(0,I.flushSync)(()=>c?.whileAway(f)),setDraftView:f=>(0,I.flushSync)(()=>c?.draft(f)),setLabel:f=>{p=f,(0,I.flushSync)(()=>c?.label(f))},setHostActions:f=>(0,I.flushSync)(()=>c?.hostActions(f)),drawn:()=>E.then(()=>F===k?void 0:new Promise(f=>v.push(f))),notify:f=>{let V;return(0,I.flushSync)(()=>{V=i.notify(f)}),V},unmount:()=>ie.unmount()}}var ht=e=>`s${(e+1).toString(36)}`;var Ir="/graview/friction";var _r="/graview/live",Xt="graview.ship",en=`${Xt}.${ot}`;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"};var je=class extends Error{constructor(n){super(n),this.name="Superseded"}},xe=e=>e?.lineage?{lineage:e.lineage}:{},Ho=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
|
|
2
|
+
`)[0]??"":String(n)})`;function Do(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 qe=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Vo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},pe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},Je=class extends Error{constructor(n){super(n),this.name="Unreached"}},Bo=new Set([502,503,504]);async function $o(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function No(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Wo=1,Io=()=>({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 yt(e){return(await jr(e,Do(e.carry),"This app was updated while your changes were on the way.",Io())).remote}async function jr(e,n,o,i){let c=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...gt(e.principal),[be.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,E=e.visible??qo,T="connecting",P=i.statuses,k=i.tally,F=[],v,_=[],de=()=>T==="online"&&v!==void 0?"held":T,D=()=>{let t=de();if(i.told!==t){i.told=t;for(let r of[...P])r(t)}},ie=t=>{if(!(t===T||ce)&&(T==="offline"&&t==="online"&&k.reconnects++,T=t,D(),t==="online"))for(let r of F.splice(0))r.again()},f=t=>{if(ce)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==v;if(v=r,V(),!!s&&(D(),r===void 0)){for(let a of _.splice(0))a();oe&&clearTimeout(oe),an()}},V=()=>{if(i.toldHeld!==v){i.toldHeld=v;for(let t of[...i.helds])t(v??null)}},j=async(t,r)=>{let s;try{s=await c(t,r)}catch(a){throw Y()||ie("offline"),new Je(a instanceof Error?a.message:String(a))}if(s.status===503&&await $o(s))return ie("online"),s;if(Bo.has(s.status))throw Y()||ie("offline"),new Je(`The server is away (${s.status})`);return ie("online"),s},Z=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,s=t?await c(r,{headers:l}):await j(r,{headers:l});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},x=e.state??await Z(!0);p||(T="online"),v=typeof x.held=="string"&&x.held.length>0?x.held:void 0,V();let me=x.enabledModules??e.enabledModules,B=e.localApp?e.localApp(e.app):e.app,R=new xn({schema:B.schema,mutations:B.mutations??[],invariants:B.invariants??[],...B.policy?{policy:B.policy}:{},...B.publishing?{publishing:B.publishing}:{},...B.modules?{modules:B.modules}:{},...me?{enabledModules:me}:{},...B.intelligence?{intelligence:B.intelligence}:{},...B.brand?.timeZone?{timeZone:B.brand.timeZone}:{},snapshot:x.snapshot,log:x.log,...x.horizon!==void 0?{horizon:x.horizon}:{},ids:No(),...e.storeOptions??{}});kn.served.add(R);let he=e.friction!==!1&&e.principal?.kind!=="visitor";he&&An(R,t=>{he&&c(`${e.url}${Ir}`,{method:"POST",headers:l,body:JSON.stringify({event:t})}).then(r=>void(he=r.status!==404&&r.status!==410),()=>{})});let L=Rn(R),O=x.log.at(-1)?.seq??(x.horizon??0)-1,C=Tt.of(x.log,{horizon:x.horizon??0}),H=null,X,q=new Map,ye=i.who,$=!1,Fe=t=>{if(ce)return;$=!0;let r=Cn(new Map,t,Date.now(),Ot,H?.participant);X!==void 0&&r.delete(X);let s=r.size!==q.size;if(!s)for(let[a,u]of r)Ct(u,q.get(a))||(s=!0);if(q=r,!!s)for(let a of[...ye])a([...q.values()])},M=[],ee=new Set,te=t=>{let r=M.indexOf(t);r>=0&&M.splice(r,1)},N=new Map,Se=(t,r)=>{let s=N.get(t);s&&(N.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},J,z=[],G=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(J)return z.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(m=>m.seq>O).map(m=>m.seq));if(Number.isFinite(s)&&s>O+1)return z.push({ops:t,drop:r}),le(),[];let a=M.filter(m=>t.some(ae=>ae.batch===m)),u=[...new Set([...r,...a])].filter(m=>ee.has(m)),y,b=M.filter(m=>!a.includes(m));try{y=R.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(m){if(!(m instanceof Tn))throw m;return z.push({ops:t,drop:r}),le(),[]}for(let m of a)te(m);t.some(m=>m.seq>O)&&b.some(m=>!u.includes(m))&&k.rebases++,t.length>0&&(O=Math.max(O,...t.map(m=>m.seq)),C.note(t));for(let m of u)ee.delete(m);for(let m of a)Se(m,t);return y},le=()=>{J||(J=ke(Z().then(t=>{if(ne(t)){z=[];return}let r=new Set(t.log.map(u=>u.batch)),s=M.filter(u=>r.has(u));for(let u of s)te(u);let a=R.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...M],drop:[...ee].filter(u=>!M.includes(u))});ee.clear();for(let u of a.pending)ee.add(u.batch);O=t.log.at(-1)?.seq??(t.horizon??0)-1,C=Tt.of(t.log,{horizon:t.horizon??0}),k.resyncs++;for(let u of s)Se(u,t.log)}).then(()=>{J=void 0;let t=z;z=[];for(let{ops:r,drop:s}of t)G(r,s)},()=>{J=void 0,z=[]})))},ne=t=>(typeof t.build=="string"&&cn(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===x.version?!1:(St(t.version),!0)),Oe=async t=>{let s=await(await j(`${e.url}/graview/since?seq=${ht(t)}&opFormat=${_e.op}`,{headers:l})).json();return ne(s)?[]:s.reset===!0?(le(),[]):s.ops??[]},Pe=async()=>{let t=await se();return J&&await J,t},se=async()=>{if(H&&!Y()&&E()){let r=await(await j(`${e.url}/graview/here?opFormat=${_e.op}`,{method:"POST",headers:l,body:JSON.stringify({presence:H,seq:ht(O)})})).json();return ne(r)?[]:(typeof r.participant=="string"&&(X=r.participant),Fe(r.who??[]),G(r.ops??[]))}return G(await Oe(O))},A=new Map,Ce=new Map,Le=new Set,re=new Map,Me=new Set,ke=t=>(Me.add(t),t.finally(()=>Me.delete(t)).catch(()=>{}),t),Ye=Promise.resolve(),Be=0,wt=(t,r)=>{let s=Ye.then(()=>$e(t,r));return Ye=s.catch(()=>{}),s},Qe=()=>new Promise((t,r)=>F.push({again:t,give:r})),$e=async(t,r)=>{let s,a;for(;;){try{s=await j(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(m){if(!(m instanceof Je)||U)throw m;if(await Qe(),Y())return Ze(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"?ne(a):(f(a.held),!1))break;if(v!==void 0&&(Et>0||p)){if(await new Promise(m=>_.push(m)),U)throw new je("The client closed.");if(Y())return Ze(t,r);continue}}let b;if(s.status===503&&a.reason==="unavailable"&&!U)b=tn(e.backoff,Be++);else{if(Be=0,s.status!==429||U)break;b=_o(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(m=>setTimeout(m,b)),Y())return Ze(t,r)}if(ce||ne(a))throw new je("The app was changed.");if(!s.ok){let b=a.error??`The server refused (${s.status})`;throw a.conflict?new pe(b,a.conflicts??[]):new qe({reason:a.reason??Vo[s.status]??"invalid",sentence:b,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let u=a.ops??[],y=u[0]?.seq;return y!==void 0&&y>O+1&&(u=await Oe(O)),r!==void 0&&(a.batch&&A.set(r,a.batch),te(r)),G(u,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},W,ge=!1,U=!1,Ne=0,Ae,He=0,ze=0,ue=null,Ee=()=>{},We=new Promise(t=>{Ee=t}),Y=()=>p&&ge&&W?.readyState===Wo,h=t=>{if(!Y())return!1;try{return W.send(JSON.stringify(t)),!0}catch{return!1}},Q=(t=!1)=>{!H||!Y()||!E()||!t&&ue&&Ct(H,ue)&&(w===void 0||Date.now()-ze<w)||h({t:"here",presence:H})&&(ue=H,ze=Date.now())},K=new Set,oe,an=()=>{if(oe=void 0,v!==void 0)return;let t=[...N.entries()].filter(([r])=>K.has(r));K.clear();for(let[,r]of t)h(r.message)},sn=(t,r)=>{N.has(t)&&(K.add(t),oe&&clearTimeout(oe),oe=setTimeout(an,Math.max(0,r)))},Gr=t=>{N.has(t)&&K.add(t)},Ze=(t,r)=>new Promise((s,a)=>{let u=r??`send-${++He}`,y=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...xe(t)}:{t:"call",cid:u,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(N.set(u,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),K.size>0||v!==void 0){K.add(u);return}h(y)}),Xe=(t,r)=>Y()?Ze(t,r):wt(t,r),Ur=t=>{switch(t.t){case"welcome":{if(cn(t.build),typeof t.version=="number"&&t.version!==x.version){St(t.version);return}if(ge=!0,Ne=0,typeof t.participant=="string"&&(X=t.participant),f(t.held),t.state?le():G(t.ops??[]),K.clear(),oe&&clearTimeout(oe),oe=void 0,v!==void 0)for(let r of N.keys())K.add(r);else for(let r of N.values())h(r.message);Q(!0),ie("online"),Ee();return}case"ops":G(t.ops??[]);return;case"ack":{let r=N.get(t.cid);if(!r){G(t.ops??[]);return}N.delete(t.cid),Be=0,r.mine!==void 0&&(A.set(r.mine,t.batch),te(r.mine)),G(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=N.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){v!==void 0?Gr(t.cid):sn(t.cid,tn(e.backoff,Be++));return}N.delete(t.cid),r.reject(t.t==="conflict"?new pe(t.sentence,t.conflicts??[]):new qe({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&sn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":Fe(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==x.version&&St(t.version);return;case"reload":fn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&W){let r=W;mn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},ce=!1,vt=i.declarations,bt=i.builds,cn=t=>{if(!(ce||i.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){i.otherBuild=t;for(let r of[...bt])r(t)}},dn=()=>{let t=[],r=0;for(let s of M){let a=re.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}},ln=(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.`,un=t=>{ce=!0,H=null;let r=new je(t);for(let a of N.values())a.reject(r);N.clear(),nt&&clearInterval(nt),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let a of F.splice(0))a.give(r);for(let a of _.splice(0))a();let s=W;W=void 0,ge=!1;try{s?.close(1e3,t)}catch{}Ee()};async function St(t){if(ce)return;if(!e.resolveApp){fn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=dn(),a=e.resolveApp,u=H;un("The app was changed.");try{let y=await a(t),{state:b,...m}=e,ae=await jr({...m,app:y},r,"The app was changed while your changes were on the way.",i);u&&ae.remote.presence.here(u);for(let rt of[...vt])rt(ae.remote,t);let fe=[...s>0?[et(ln(s,"The app was changed"))]:[],...ae.unheard()];for(let rt of fe)for(let to of Ie)to(rt.sentence,rt)}catch(y){let b=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let m of Ie)m(b,et(b))}}function fn(t){if(ce)return;let{carried:r,undos:s}=dn();un(t);let a=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),a=!0}catch{}let u=[];!a&&r.length>0&&u.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&&u.push(ln(s,"This app was updated"));for(let y of u)for(let b of Ie)b(y,et(y));(e.reloadPage??jo)()}let pn=()=>{if(U||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${_r}`,{"content-type":r,...s}=l,a;try{a=e.socket?e.socket(t,s,[en]):eo(t,s)}catch{return hn()}W=a,ge=!1,a.onopen=()=>{W===a&&a.send(JSON.stringify({t:"hello",seq:ht(O),protocol:ot,wire:Xt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},a.onmessage=u=>{if(W!==a)return;let y;try{y=JSON.parse(String(u.data))}catch{return}Ur(y)},a.onclose=()=>mn(a),a.onerror=()=>{}},we,Kr=()=>{$=!1,we&&clearTimeout(we),we=setTimeout(()=>{if(we=void 0,$||U)return;let t=new Map([...q].filter(([,r])=>r.held!=="socket"));if(t.size!==q.size){q=t;for(let r of ye)r([...q.values()])}},Ot),we.unref?.()};function mn(t){if(W!==t)return;let r=ge;W=void 0,ge=!1,ue=null,r&&(ie("offline"),Kr()),hn()}let hn=()=>{if(U)return;let t=tn(e.backoff,Ne);Ne++,Ae=setTimeout(pn,t)},yn=R.applyAll.bind(R),Jr=R.undo.bind(R),Yr=R.previewAll.bind(R);R.previewAll=(t,r)=>Yr(t,{...e.principal?{author:e.principal}:{},...r});let Ie=i.refusals,Ge=[],et=t=>({reason:"invalid",sentence:t}),tt=i.conflicts,Pt=!1,gn,kt=async(t,r)=>{if(r instanceof je||ce)return;let s=r instanceof qe?r.refusal:Sn(r),a=s.sentence,u=r instanceof pe?gn?.yoursOf(R,re.get(t)?.calls??[]):void 0;te(t);try{G([],[t])}catch{}let y=re.get(t);re.delete(t);let b=y?.calls[0];if(b&&!(r instanceof pe)){let m=R.allMutations().find(fe=>fe.name===b.name)?.subject?.arg,ae=m&&R.graph.getNode(b.args[m])?.kind;En(R,{type:"refused",act:b.name,code:s.reason,...ae?{kind:ae}:{}},e.principal)}if(r instanceof pe&&k.conflicts++,r instanceof pe&&!Y()&&await Pe().catch(()=>[]),r instanceof pe&&J&&await J,r instanceof pe&&tt.size>0){let m=!1,ae={sentence:a,conflicts:u?r.conflicts.map(fe=>fe.node===u.node&&fe.field===u.field?{...fe,yours:u.yours}:fe):r.conflicts,keepTheirs(){m=!0},useMine(){if(!(m||!y)){m=!0,Pt=!0;try{R.applyAll(u?[u.over(O)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...xe(y)})}finally{Pt=!1}}}};for(let fe of tt)fe(ae);return}for(let m of Ie)m(a,s)},Qr=(t,r)=>t.flatMap(s=>s.mutation?.name===bn?[]: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:O}]:[]));R.applyAll=(t,r)=>{let s=Pn(R.log.all().filter(b=>ee.has(b.batch))),a=yn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,m)=>{let ae=a.minted?.[m];return ae===void 0||b.args?.id!==void 0?b:{...b,mintedHint:ae}});M.push(a.batch),ee.add(a.batch),re.set(a.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...xe(r)});let y=Pt?[]:[...C.baseFor(a.ops,s,(b,m)=>R.collaborative(b,m)),...Qr(a.ops,s)];return Ce.set(a.batch,ke(Xe({calls:u,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...xe(r)},a.batch).catch(b=>kt(a.batch,b)))),a},R.apply=(t,r)=>R.applyAll([t],r),R.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=Jr(s.map(y=>A.get(y)??y),{...e.principal?{author:e.principal}:{},...r});M.push(a.batch),ee.add(a.batch);let u=Promise.allSettled(s.map(y=>Ce.get(y)));return Ce.set(a.batch,ke(u.then(()=>{let y=s.filter(b=>!Le.has(b));if(y.length===0){te(a.batch),re.delete(a.batch),G([],[a.batch]);return}return Xe({undo:y.map(b=>A.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...xe(r)},a.batch)}).catch(y=>kt(a.batch,y)))),a};let Zr=async(t,r={})=>{At++;try{return(await ke(Xe({calls:t,...r}))).ops}finally{At--}},At=0,wn={here(t){H=t,Q()},onWho(t){return ye.add(t),q.size>0&&t([...q.values()]),()=>{ye.delete(t)}},leave(){if(!H)return;let t=JSON.stringify({participant:X??H.participant});if(H=null,h({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):c(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},Et=e.pollMs??800,nt=Et>0&&typeof setInterval=="function"?setInterval(()=>{Y()||Pe().catch(()=>{})},Et):null;if(p){pn();let t;await Promise.race([We,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!ce){let t=[],r=new Set(R.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{R.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...xe(s)})}catch(a){t.push(Ho(s,a))}t.length>0&&Ge.push(et(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let vn=new Map,Xr=()=>({store:R,author:e.principal,appliedAll:yn,pending:M,provisional:ee,asked:re,answers:Ce,letGo:Le,sent:(t,r)=>ke(Xe({calls:r,batch:t},t).catch(s=>kt(t,s))),settle:te,land:G,seen:()=>O,gone:()=>U||ce});return{remote:{store:R,typing(t,r){let s=`${t}\0${r}`,a=vn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.PQMMISCQ.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4OP4IEEY.js")).then(u=>(gn=u,u.typingOf(t,r,u.wireOf(Xr())))),vn.set(s,a)),a},version:x.version,migrated:x.migrated??[],send:Zr,pull:Pe,onRefusal(t){Ie.add(t);let r=Ge;Ge=[];for(let s of r)t(s.sentence,s);return()=>Ie.delete(t)},onDeclaration(t){return vt.add(t),()=>vt.delete(t)},onBuild(t){return bt.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>bt.delete(t)},onConflict(t){return tt.add(t),()=>tt.delete(t)},revision:(t,r)=>C.of(t,r),seq:()=>O,participant:()=>X,transport:()=>Y()?"socket":"poll",status:de,onStatus(t){return P.add(t),()=>P.delete(t)},held:()=>v,onHeld(t){return i.helds.add(t),v!==void 0&&t(v),()=>i.helds.delete(t)},counters:()=>({...k}),who:()=>[...q.values()],pending:()=>M.length+At,async settled(){for(;Me.size>0;)await Promise.allSettled([...Me])},presence:wn,close(){nt&&clearInterval(nt),L(),wn.leave(),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let r of F.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of _.splice(0))r();let t=W;W=void 0,ge=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ge;return Ge=[],t}};function eo(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",u=e.subprotocol?[en]:[];if(!a)try{return new s(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let y=new URL(t);for(let[b,m]of Object.entries(S))y.searchParams.set(b,m);return u.length>0?new s(y.toString(),u):new s(y.toString())}}function _o(e,n,o=Date.now()){let i,c=e?.trim();if(c)if(/^\d+(\.\d+)?$/.test(c))i=Number(c)*1e3;else{let p=Date.parse(c);Number.isFinite(p)&&(i=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&i!==void 0&&Math.abs(l*1e3-i)<1e3;return l!==void 0&&!S?l:i??1e3}function jo(){globalThis.location?.reload?.()}function qo(){return globalThis.document?.visibilityState!=="hidden"}function tn(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:c=2}=e??{};return Math.min(i,o*c**n)*(.75+Math.random()*.5)}function gt(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 qr="/graview/views";function nn(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),i={"content-type":"application/json",...e.principal?gt(e.principal):{},...e.headers??{}},c=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??at.may}:at,l=new Set,S=P=>{if(JSON.stringify(P)!==JSON.stringify(c)){c=P;for(let k of l)k()}},p=async(P,k)=>{let F=await n(`${o}${e.path??qr}`,{method:P,headers:i,...k!==void 0?{body:JSON.stringify(k)}:{}}),v=await F.json();if(!F.ok)throw new Error(v.error??`The store answered ${F.status}.`);S({hidden:v.hidden??[],removed:v.removed??[],may:v.may??at.may})},w=()=>p("GET"),E=e.state?Promise.resolve():w().catch(()=>{}),T=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:E,refresh:w,close:()=>clearInterval(T),current:()=>c,onChange(P){return l.add(P),()=>void l.delete(P)},hide:P=>p("POST",{hide:P}),show:P=>p("POST",{show:P}),remove:(P,k)=>p("POST",{remove:P,...k?{about:k}:{}}),async restore(P){let k=c.removed.find(F=>F.name===P)?.lens;await p("POST",{restore:P}),k&&await e.onDeclaration?.()},async lens(P){await p("POST",{lens:P}),await e.onDeclaration?.()}}}var on=document.getElementById("graview-app"),rn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),zr=rn?(__graviewPreload(import.meta.url,["./chunk.4JDHBNEA.js","./chunk.I2NI7CT7.js","./chunk.XOZU4OFA.js","./chunk.5NZDFT6R.js","./chunk.NF72Z2HG.js","./chunk.KPIDJYIU.js","./chunk.RQX4CQJN.js","./chunk.LUIRQ5UF.js","./chunk.N33WUCAN.js","./chunk.LKJ6FD6Y.js","./chunk.DBMZ3AQB.js","./chunk.SDO3U72B.js","./chunk.DIFR37EZ.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BUSFJM6P.js")):Ve("pages");try{rn?await zo(decodeURIComponent(rn[1])):await Go()}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),on.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 lt(o);if(!i.ok)throw new Error(it(i.findings));let c=i.app,l=o.principal,S=await yt({app:c,url:location.origin,principal:l,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=c.forms?.[e]?.title??c.name;let{mount:p}=await zr;window.__graview=p(on,{app:c,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Go(){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 w=>{if(typeof w.module=="string")return(await import(w.module)).app;let E=await lt(w);if(!E.ok)throw new Error(it(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 c=n.principal,l=await yt({app:i,url:location.origin,principal:c,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let S,p=nn({url:location.origin,principal:c,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let E=await lt(w);E.ok&&S?.setApp(E.app,l)}});await Promise.all([zr,p.ready]),S=Zt(on,{app:i,remote:l,principal:c,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.drawn().then(()=>{window.__graviewReady=!0})}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graview",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.57",
|
|
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/guest": "0.1.57",
|
|
33
|
+
"@graview/skills": "0.1.57",
|
|
34
|
+
"@graview/core": "0.1.57",
|
|
35
|
+
"@graview/tools": "0.1.57",
|
|
36
|
+
"@graview/ship": "0.1.57"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=22"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as f}from"./chunk.GNQW4JOG.js";import"./chunk.USB6B6L3.js";import"./chunk.AZUTYY2S.js";import"./chunk.45VIF2SX.js";import{l as g}from"./chunk.IUQOSPQX.js";import"./chunk.UGFDSE37.js";import"./chunk.PXQVXBNG.js";import"./chunk.VYW7DSUW.js";import"./chunk.LKK7VQBA.js";import"./chunk.RR2IFETZ.js";import"./chunk.ONGZ3YQF.js";import"./chunk.XGCOWCA2.js";import"./chunk.MORMTKVR.js";import"./chunk.CU2NQ5WF.js";import"./chunk.E33EJU3Q.js";import"./chunk.PJCVFYFU.js";import"./chunk.7RJGEU3Y.js";import"./chunk.22MIRLL6.js";import"./chunk.NFU4UM6F.js";import"./chunk.DH7M57SE.js";import"./chunk.AIK3Z25Y.js";import"./chunk.CKV2QCH5.js";import"./chunk.BT7RLFPO.js";import"./chunk.TAJ2R44N.js";import"./chunk.VLBY66PB.js";import"./chunk.BJUUSIQY.js";import"./chunk.RDL6652E.js";import"./chunk.V3NPUAPB.js";import"./chunk.XOZU4OFA.js";import"./chunk.IT763BYH.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.T2RME6XF.js";import"./chunk.SOTB6C5A.js";import"./chunk.TQCRFZ53.js";import"./chunk.6HLKAUWF.js";import"./chunk.FCUDBMGC.js";import"./chunk.KMEKMCKG.js";import"./chunk.GZHZLJBF.js";import"./chunk.E5XNQTEU.js";import"./chunk.OJGHDWI6.js";import"./chunk.K5YLQAFW.js";import"./chunk.XJFAUOJS.js";import"./chunk.DPPT6WAJ.js";import"./chunk.7U2JO7ET.js";import"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import{G as b,T as h}from"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import{Vd as n}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as t}from"./chunk.AJZBJBMO.js";var m=t(b(),1),a=t(h(),1);function P({store:c,auto:y,brand:i,views:u,presence:s,steering:r,overview:o,scope:d,titleLevel:w=2,quickAsk:l,props:e}){let v=(0,m.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:y?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:v}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(f,{context:{store:c,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...o?{overview:o}:{},titleLevel:w,views:u,settings:e.app.settings??[],app:e.app,...s?{presence:s}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.timeZone?{timeZone:e.timeZone}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},dismissals:e.dismissals,whileAway:e.whileAway,...e.signIn?{signIn:e.signIn}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...r?{steering:r}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.hrefOf?{hrefOf:e.hrefOf}:e.routing==="address"?{}:{hrefOf:!1},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{P as PagesContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk.WPJVMVAL.js";import"./chunk.VYW7DSUW.js";import"./chunk.LKK7VQBA.js";import"./chunk.EC5IWN74.js";import"./chunk.RR2IFETZ.js";import"./chunk.ONGZ3YQF.js";import"./chunk.XGCOWCA2.js";import"./chunk.MORMTKVR.js";import"./chunk.CU2NQ5WF.js";import"./chunk.E33EJU3Q.js";import"./chunk.PJCVFYFU.js";import"./chunk.7RJGEU3Y.js";import"./chunk.HJCQ6I3S.js";import"./chunk.7O6Z3BFR.js";import"./chunk.I2C5LPB5.js";import"./chunk.6Q6BW4QT.js";import"./chunk.AIK3Z25Y.js";import"./chunk.CKV2QCH5.js";import"./chunk.BT7RLFPO.js";import"./chunk.TAJ2R44N.js";import"./chunk.VLBY66PB.js";import"./chunk.64IKLRUS.js";import"./chunk.DTSTUC2W.js";import"./chunk.RDL6652E.js";import"./chunk.V3NPUAPB.js";import"./chunk.IT763BYH.js";import"./chunk.UQQAGT3R.js";import"./chunk.WVUJXDXZ.js";import"./chunk.T2RME6XF.js";import"./chunk.SOTB6C5A.js";import"./chunk.TQCRFZ53.js";import"./chunk.6HLKAUWF.js";import"./chunk.FCUDBMGC.js";import"./chunk.KMEKMCKG.js";import"./chunk.GZHZLJBF.js";import"./chunk.E5XNQTEU.js";import"./chunk.OJGHDWI6.js";import"./chunk.K5YLQAFW.js";import"./chunk.XJFAUOJS.js";import"./chunk.DPPT6WAJ.js";import"./chunk.7U2JO7ET.js";import"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{b as declaredLensView,a as formatFor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk.65Q5MKDW.js";import"./chunk.JZDKHWRL.js";import"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Ee,b as Le,c as Ve,d as ue,e as R,f as me,h as Be}from"./chunk.K4MO22RM.js";import{h as Ze,i as We,j as Ye}from"./chunk.TQCRFZ53.js";import{a as ie,b as re,c as H,d as Ue,e as J,g as te,h as He}from"./chunk.FCUDBMGC.js";import{c as Ne,h as y,i as qe,j as fe}from"./chunk.KMEKMCKG.js";import{A as De,Ca as Ke,Db as hn,Ja as Me,Ka as ne,La as de,Ub as Pe,Vb as pe,Wb as Te,Xb as Ge,Yb as Ce,b as W,c as B,e as le,f as Re,g as P,h as j,k as I,l as Q,m as _,n as Fe,nc as _e,o as U,oc as Ie,p as K,r as $,s as ee,t as x,u as A,v as q,w as T,x as n,y as M,z as Y}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var ge=e=>Object.entries(e).map(([s,i])=>[s,Object.keys(ne(i?.edges))]),ze=(e,s)=>Te(e,ge(s));function Je(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Pe(s)),...Ge(ge(e.kinds))]}var L=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Xe(e){if(!L(e)||!L(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([z,r])=>[z,L(r)&&L(r.edges)?{edges:r.edges}:{}]));s=Je({acts:L(e.acts)?e.acts:{},kinds:f})}catch{return e}let i=new Set(s),t=!1,a=f=>{if(typeof f!="string"||i.has(f))return f;let z=_e(f,s);return z===void 0?f:(t=!0,z)},l=L(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>L(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(a)}:f)}:void 0,u=L(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,z])=>[f,L(z)&&Array.isArray(z.repairs)?{...z,repairs:z.repairs.map(r=>L(r)?{...r,act:a(r.act)}:r)}:z])):void 0;return t?{...e,...l?{policy:l}:{},...u?{rules:u}:{}}:e}function ye(e,s){let i=Ie(e,Je(s));return i&&i!==e?`did you mean "${i}"?`:void 0}var ke="graview-document",$e=1,we=256*1024,oe=64*1024,he=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,be=/^[a-z][A-Za-z0-9]*$/,bn=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,Qe=12,kn=new Set(["id","kind"]),$n=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,wn=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function Sn(){let e=k=>k in Object.prototype,s=Y(k=>!e(k),"every object already has this name \u2014 choose another"),i=(k,N)=>[...k===void 0?[]:[Re(k)],...N===void 0?[]:[le(N)]],t=(k,N)=>j().check(...i(k,N)),a=(k,N,X)=>K(k).check(...i(N,X)),l=k=>j().check(P(he,`${k} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=j().check(P($n,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=j().check(P(be,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Y(k=>!kn.has(k),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),z=t(1,500),r=j().check(le(40),P(bn,'an alias is up to three lower-case words, like "supplier"')),o=t(1,2e3),d=t(1,300),w=$({type:q(wn),required:n(_()),description:n(z),label:n(t(1,60)),aliases:n(a(r,1,Qe)),options:n(a(t(1,80),1,100)),optionLabels:n(A(t(1,80),t(1,80))),of:n(q(["string","number","date","image","video","file"])),default:n(U()),unit:n(t(void 0,12)),format:n(q(["money","percent","duration","markdown"])),min:n(I()),max:n(I()),step:n(I()),renamedFrom:n(j().check(P(be))),repeats:n(_()),collaborative:n(_())}).check(De((k,N)=>{k.type==="enum"&&!k.options&&N.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),k.type!=="enum"&&k.options&&N.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]});for(let X of Object.keys(k.optionLabels??{}))k.options?.includes(X)||N.addIssue({code:"custom",message:`"${X}" is labeled, and is none of the field's options`,path:["optionLabels",X]});k.type!=="list"&&k.of&&N.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),k.repeats&&k.type!=="date"&&k.type!=="datetime"&&N.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=j().check(P(new RegExp(`${he.source}|${Ke.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),p=$({to:x([a(m,1),T("*")]),cardinality:n(q(["one","many"])),description:n(z),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(j()),tidying:n(T("never"))}),c=x([o,$({expr:o,label:n(t(1,60)),description:n(z)})]),O=$({noun:n(t(1,40)),plural:n(t(1,40)),aliases:n(a(r,1,Qe)),description:n(z),fields:A(f,w).check(Y(k=>Object.keys(k).length>0,"a kind has at least one field")),label:n(d),describe:n(d),lifecycle:n($({field:f,retired:a(x([j(),I(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(a(f,1,20)),page:n($({fields:n(a(f,1,40)),groups:n(a($({title:t(1,60),fields:a(f,1,40)}),1,12))})),edges:n(A(u,p)),computed:n(A(j(),c).check(Y(k=>Object.keys(k).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(A(j(),j())),renamedFrom:n(j().check(P(he))),people:n(_()),archives:n(T(!1)),tidying:n(q(["never","no-links"]))}),h=x([j(),I(),_(),Fe(),K(U()),$({expr:o})]),S=j().check(P(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),E=x([$({create:l("kind"),as:n(j().check(P(be))),set:n(A(f,h))}),$({set:A(f,h),target:n(S)}),$({connect:u,from:S,to:S}),$({sever:u,from:S,to:S}),$({remove:S})]),b=$({title:n(t(1,80)),description:n(z),fromTheOtherEnd:n(t(1,80)),on:n(x([l("kind"),a(l("kind"),1)])),creates:n(l("kind")),sets:n(A(f,h)),writes:n(a(f,1)),connects:n(u),severs:n(u),setsOther:n(A(f,h)),replaces:n(x([T(!0),a(u,1,10)])),removes:n(T(!0)),args:n(A(f,w)),effects:n(a(E,1,20)),allowedWhen:n(o),refusal:n(d),destructive:n(_())}),C=$({act:l("act"),label:n(t(1,80)),args:n(A(j(),h))}),F=$({title:n(t(1,120)),description:n(z),over:x([T("graph"),l("kind")]),when:n(o),require:o,says:n(d),repairs:n(a(C,void 0,10))}),g=$({roles:x([a(l("role"),1),T("*")]),mutations:x([a(l("act"),1),T("*")]),kinds:n(x([K(l("kind")),T("*")])),describe:n(z),self:n(_()),ownEnd:n(_())}),v=n(a(l("field"),1)),D=$({roles:x([a(l("role"),1),T("*")]),kinds:a(l("kind"),1),own:n(_()),via:n(u),fields:v,hide:v}),se=$({grants:K(g),sees:n(K(D))}),Z=$({accent:n(j().check(P(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:n(x([j().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),$({light:n(j().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:n(j().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:n(t(1,60)),currency:n(j().check(P(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(x([t(1,oe),$({src:t(1,oe),alt:n(t(1,120))}),$({light:t(1,oe),dark:n(t(1,oe)),alt:n(t(1,120)),darkFallback:n(T("invert"))})])),favicon:n(x([t(1,oe),$({emoji:j()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(I().check(B(0),W(32))),density:n(I().check(B(.75),W(1.5)))})),accents:n(A(j(),I().check(B(0),W(360)))),scheme:n(q(["light","dark","auto"])),subtitle:n(T(!1))}),V=A(j(),U()),ve=x([t(1,120),$({by:t(1,120),direction:n(q(["asc","desc"]))})]),xe=I().check(Q(),B(1),W(9999)),fn=ee({create:n(_()),options:n(ee({sort:n(ve),columnSort:n(ve),search:n(a(t(1,120),void 0,40)),filters:n(a(t(1,120),void 0,40)),horizon:n(x([I().check(Q(),B(1),W(200)),ee({years:I().check(Q(),B(1),W(200)),title:t(1,80),from:n(xe),to:n(xe)})]))}))}),un=$({card:n(K(U())),row:n(K(U())),page:n(K(U()))}),mn=()=>{let k=n(q(["asc","desc"]));return x([t(1,120),$({by:t(1,120),direction:k,then:n(x([t(1,120),$({by:t(1,120),direction:k})]))})])},gn=()=>x([t(1,120),$({by:t(1,120),order:n(a(t(1,80),void 0,40)),closed:n(a(t(1,80),void 0,40))})]),Ae=ee({order:n(K(j())),hide:n(K(j())),first:n(j()),primary:n(a(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(A(j(),$({filters:n(a(t(1,120),void 0,40)),sort:n(mn()),group:n(gn()),export:n(_())})))}),zn=$({act:l("act"),title:n(t(1,80)),intro:n(z),fields:n(a(f,1,40)),say:n(z),submit:n(t(1,80)),role:n(l("role"))}),yn=$({$schema:n(j()),format:T(ke),formatVersion:T($e),name:t(1,80),description:n(z),version:n(I().check(Q(),B(1))),kinds:A(l("kind"),O).check(Y(k=>Object.keys(k).length>0,"a document declares at least one kind"),Y(k=>Object.keys(k).length<=40,"a document declares at most 40 kinds")),computed:n(A(j(),c)),acts:n(A(l("act"),b)),rules:n(A(l("rule"),F)),roles:n(K(l("role"))),policy:n(se),modules:n(V),lenses:n(K(fn)),pages:n(Ae),views:n(A(j(),x([un,K(U())]))),brand:n(Z),settings:n(K(V)),migrations:n(K(V)),connections:n(A(l("connection"),V)),purpose:n(V),forms:n(A(l("form"),zn)),publishing:n($({mode:q(["live","on-publish"]),working:a(l("role"),void 0,40),publishers:n(a(l("role"),1,40))}))});return{FieldSpec:w,EdgeSpec:p,ComputedSpec:c,KindSpec:O,ValueSpec:h,EffectSpec:E,ActSpec:b,RepairSpec:C,RuleSpec:F,GrantSpec:g,SightSpec:D,PolicySpec:se,BrandSpec:Z,PagesSpec:Ae,DocumentSpec:yn}}var jn,G=()=>jn??=Sn(),Ln=M(()=>G().FieldSpec),Vn=M(()=>G().EdgeSpec),Bn=M(()=>G().ComputedSpec),Un=M(()=>G().KindSpec),Zn=M(()=>G().ValueSpec),Wn=M(()=>G().EffectSpec),Yn=M(()=>G().ActSpec),Hn=M(()=>G().RepairSpec),Jn=M(()=>G().RuleSpec),Xn=M(()=>G().GrantSpec),Qn=M(()=>G().SightSpec),et=M(()=>G().PolicySpec),nt=M(()=>G().BrandSpec),tt=M(()=>G().PagesSpec),en=M(()=>G().DocumentSpec);var On={};function nn(e,s=On,i=$e){let{document:t,respelled:a}=Ee(e),l=a.length>0?{respelled:a}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==ke||typeof u.formatVersion!="number"||u.formatVersion>=i)return{document:t,...l};let f=u.formatVersion,z=structuredClone(u);for(let r=f;r<i;r++){let o=s[r];if(!o)throw new Error(`there is no upgrade from format ${r} to ${r+1}`);z={...o(z),formatVersion:r+1}}return{document:z,from:f,...l}}function tn(e,s,i){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let a=t.map(f=>e[f].edges[s].to),l=a.some(f=>f==="*")?"*":[...new Set(a.flatMap(f=>f))];if(i.length===0||i.some(f=>t.includes(f)))return{reversed:!1,kinds:l};let u=t.filter(f=>{let z=e[f].edges[s].to;return z==="*"||i.every(r=>z.includes(r))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:l}}var rn=(e,s)=>{let i=e?.fields[s];return i!==void 0&&(i.type==="duration"||(i.type==="number"||i.type==="integer")&&i.format==="duration")};function on(e,s,i,t){if(t==="out"){let a=e[s]?.edges?.[i]?.to;return a===void 0?[]:a==="*"?Object.keys(e):a}return Object.entries(e).filter(([,a])=>{let l=a.edges?.[i]?.to;return l!==void 0&&(l==="*"||l.includes(s))}).map(([a])=>a)}function Se(e,s,i){if(i.t==="ident")return e[s]?.edges?.[i.name]?on(e,s,i.name,"out"):void 0;if(i.t==="where")return Se(e,s,i.set);if(i.t==="call"&&(i.fn==="out"||i.fn==="in")&&i.args[0]?.t==="lit"&&typeof i.args[0].value=="string")return on(e,s,i.args[0].value,i.fn)}var sn=(e,s,i)=>{let t=s.filter(a=>e[a]?.fields[i]!==void 0);return t.length>0&&t.every(a=>rn(e[a],i))};function an(e,s,i){let t=e.kinds,a=t[s],l=new Map(i),u=new Map,f=(r,o)=>{if(o>8)return!1;switch(r.t){case"ident":return rn(a,r.name)||z(r.name,o+1);case"member":{let d=Se(t,s,r.object);return d!==void 0&&sn(t,d,r.name)}case"call":{if(r.fn!=="sum"&&r.fn!=="min"&&r.fn!=="max")return!1;let[d,w]=r.args,m=d&&Se(t,s,d);return m!==void 0&&w?.t==="ident"&&sn(t,m,w.name)}case"binary":return(r.op==="+"||r.op==="-")&&f(r.left,o)&&f(r.right,o);case"unary":return r.op==="-"&&f(r.operand,o);default:return!1}},z=(r,o)=>{if(a?.computed?.[r]===void 0)return!1;if(u.has(r))return u.get(r);u.set(r,!1);let d=l.get(r),w=d!==void 0&&f(d,o);return u.set(r,w),w};return i.map(([r])=>r).filter(r=>z(r,0))}function cn(e,s,i=`kinds.${e}.page`){let t=s.page;if(!t)return[];let a=[],l=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(r,o)=>{l.includes(r)?u.has(r)&&a.push(y("page-field-twice",o,`"${r}" is on ${e}'s page twice; name each field once`)):a.push(y("page-field",o,`${e}'s page is to show "${r}", and ${e} has no field or computed field called that`,`use one of: ${l.join(", ")}`)),u.add(r)};(t.fields??[]).forEach((r,o)=>f(r,`${i}.fields.${o}`));let z=new Set;return(t.groups??[]).forEach((r,o)=>{let d=r.title.trim().toLowerCase();z.has(d)&&a.push(y("page-group-twice",`${i}.groups.${o}.title`,`${e}'s page has two groups called "${r.title}"; give each its own title`)),z.add(d),r.fields.forEach((w,m)=>f(w,`${i}.groups.${o}.fields.${m}`))}),a}function ln(e,s=[]){return Ce({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(i=>i.fields)],must:i=>!!e.fields[i].required&&e.fields[i].default===void 0,naming:s})}var vn=new Set(["subject","now","today","me"]);function xn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>we)return{findings:[y("too-large","",`a document may be at most ${we/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[y("not-json","",`this is not JSON: ${t.message}`)]}}try{e=nn(e).document}catch(t){return{findings:[y("format","formatVersion",t.message)]}}e=Xe(e);let s=en.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let a=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return y("unknown-key",a,`${t.keys.map(l=>`"${l}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(a))return y("effect-shape",a,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let l=t.issues?.[0]?.message;return y("shape",a,`the name "${String(t.path.at(-1))}" is not allowed here${l?`: ${l}`:""}`)}return y("shape",a,t.message)})};let i=s.data;return{document:i,findings:An(i)}}var ce=e=>[e??[]].flat();function dn(e){let s=new Map;for(let[i,t]of Object.entries(e.kinds))for(let[a,l]of Object.entries(ne(t.edges))){let u=s.get(a);s.set(a,{name:a,from:[...u?.from??[],i],to:l.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...l.to])],cardinality:l.cardinality??"many"})}return s}function Ft(e){let s=new Map;for(let[t,a]of Object.entries(e.kinds)){let l=te(a),u=de(a.edges);s.set(t,{fields:new Set([...Object.keys(a.fields),...u.keys()]),edges:new Map(Object.entries(ne(a.edges)).map(([f,z])=>[f,z.cardinality??"many"])),...l?{computed:l}:{},...u.size>0?{linked:u}:{}})}let i=te(e);return i&&s.set(Ne,{computed:i}),s}function pn(e,s){let i=[],t=ce(e.on),a=(l,u)=>{let f=tn(s.kinds,l,t)?.reversed===!0,[z,r]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:l,from:z,to:r}:{sever:l,from:z,to:r}};if(e.creates){let l=s.kinds[e.creates],u={};for(let f of Object.keys(l?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&R(f.target)==="new"&&Object.assign(u,f.set);i.push({create:e.creates,as:"new",set:u})}return e.sets&&i.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&i.push({set:Object.fromEntries(e.writes.map(l=>[l,`$${l}`]))}),e.connects&&(e.replaces&&i.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),i.push(a(e.connects,"connect"))),e.severs&&i.push(a(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&i.push({set:e.setsOther,target:"$to"}),e.removes&&i.push({remove:"$subject"}),e.effects&&i.push(...e.effects.filter(l=>!(e.creates&&"set"in l&&!("create"in l)&&R(l.target)==="new"))),i}function je(e,s,i){try{let t=H(e),a=ie(t);for(let l of a.unknownFunctions)i.push(y("unknown-function",s,`"${l}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return t}catch(t){if(t instanceof re){i.push(y("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Oe(e,s,i){try{return J(e)}catch(t){if(t instanceof Ue||t instanceof re){i.push(y("template",s,(t instanceof re,t.sentence)));return}throw t}}function An(e){let s=[],i=new Set(Object.keys(e.kinds)),t=dn(e),a=e.acts??{},l=new Set(e.roles??[]),u=(r,o)=>de(e.kinds[r]?.edges).has(o),f=r=>Object.keys(e.kinds).some(o=>u(o,r));for(let[r,o]of Object.entries(e.kinds)){let d=`kinds.${r}`;for(let[m,p]of Object.entries(o.edges??{})){if(!Me(p)&&p.to!=="*")for(let c of p.to)i.has(c)||s.push(y("edge-target",`${d}.edges.${m}.to`,`"${c}" is not a kind this document declares`));o.fields[m]&&s.push(y("edge-field-clash",`${d}.edges.${m}`,`"${m}" is both a field and a relation of ${r}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&s.push(y("lifecycle-field",`${d}.lifecycle.field`,`${r} has no field "${o.lifecycle.field}"`));let w=m=>o.computed!==void 0&&Object.hasOwn(o.computed,m);for(let m of o.glance??[])!o.fields[m]&&!w(m)&&s.push(y("glance-field",`${d}.glance`,`a glance at ${r} is to say "${m}", and ${r} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));s.push(...cn(r,o));for(let m of["label","describe"]){let p=o[m];if(!p)continue;let c=Oe(p,`${d}.${m}`,s);for(let O of c??[])if(O.expr){for(let h of ie(O.expr).names)if(!o.fields[h]){if(w(h)){He(o,h)||s.push(y("template-field",`${d}.${m}`,`${r}'s ${h} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${r}'s own fields`));continue}s.push(y("template-field",`${d}.${m}`,`${r} has no field "${h}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,p]of Object.entries(o.fields)){p.default!==void 0&&p.type==="enum"&&!p.options?.includes(String(p.default))&&s.push(y("default-option",`${d}.fields.${m}.default`,`"${String(p.default)}" is not one of ${m}'s options`));let c=`${m}Repeat`;p.repeats&&(o.fields[c]||o.edges?.[c]||o.computed?.[c])&&s.push(y("repeat-clash",`${d}.fields.${m}.repeats`,`${r} already has "${c}", where how ${m} repeats is kept`))}}for(let[r,o]of Object.entries(a)){let d=`acts.${r}`;for(let c of ce(o.on))i.has(c)||s.push(y("act-kind",`${d}.on`,`"${c}" is not a kind this document declares`));let w=ce(o.on),m=pn(o,e);if(o.creates&&o.on===void 0&&o.writes&&i.has(o.creates)){for(let c of o.writes)if(!e.kinds[o.creates].fields[c])if(e.kinds[o.creates].computed?.[c]!==void 0)s.push(y("computed-written",`${d}.writes`,`${o.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(o.creates,c))continue;s.push(y("act-field",`${d}.writes`,`${o.creates} has no field "${c}"`))}}m.length===0&&s.push(y("act-empty",d,`"${r}" does nothing`,"give it effects or a shorthand such as sets or creates"));let p=new Map;m.forEach((c,O)=>{let h=m.length-(o.effects?.length??0),S=o.effects&&O>=h?`${d}.effects.${O-h}`:d;if("create"in c){if(!i.has(c.create))s.push(y("act-kind",`${S}.create`,`"${c.create}" is not a kind this document declares`));else for(let b of Object.keys(c.set??{}))e.kinds[c.create].fields[b]||(e.kinds[c.create].computed?.[b]!==void 0?s.push(y("computed-written",`${S}.set.${b}`,`${c.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(y("act-field",`${S}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&p.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!t.has(b)&&!f(b)&&s.push(y("act-edge",`${S}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),R(c.from)==="subject"&&w.length===0&&s.push(y("act-subject",`${d}.on`,`"${r}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=R(c.target??"$subject"),C=b==="subject"?w:p.has(b??"")?[p.get(b)]:[];b==="subject"&&w.length===0&&s.push(y("act-subject",`${d}.on`,`"${r}" changes "$subject" but does not say which kinds it is "on"`));for(let F of Object.keys(c.set))for(let g of C)if(!(!i.has(g)||e.kinds[g].fields[F]))if(e.kinds[g].computed?.[F]!==void 0)s.push(y("computed-written",`${S}.set.${F}`,`${g}'s ${F} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(g,F))continue;s.push(y("act-field",`${S}.set.${F}`,`${g} has no field "${F}"`))}}else"remove"in c&&R(c.remove)==="subject"&&w.length===0&&s.push(y("act-subject",`${d}.on`,`"${r}" removes "$subject" but does not say which kinds it is "on"`));("set"in c&&c.set?Object.values(c.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&je(b.expr,`${S}.set`,s)})}),o.allowedWhen&&je(o.allowedWhen,`${d}.allowedWhen`,s),o.refusal&&Oe(o.refusal,`${d}.refusal`,s)}for(let[r,o]of Object.entries(e.rules??{})){let d=`rules.${r}`;o.over!=="graph"&&!i.has(o.over)&&s.push(y("rule-kind",`${d}.over`,`"${o.over}" is not a kind this document declares`));let w=o.over==="graph"?void 0:e.kinds[o.over];for(let m of["when","require"]){let p=o[m];if(!p)continue;let c=je(p,`${d}.${m}`,s);if(!c)continue;let O=ie(c);for(let h of O.names)if(o.over==="graph")s.push(y("rule-name",`${d}.${m}`,`"${h}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[h]&&!w.edges?.[h]&&w.computed?.[h]===void 0){let S=Object.keys(w.edges??{}).find(E=>E.includes("-")&&E.split("-").includes(h));s.push(y("rule-name",`${d}.${m}`,`${o.over} has no field or relation called "${h}"`,S?`"${S}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${S.replace(/-([a-z0-9])/g,(E,b)=>b.toUpperCase())}"`:void 0))}for(let h of O.edges)!t.has(h)&&!f(h)&&s.push(y("rule-edge",`${d}.${m}`,`"${h}" is not a relation any kind declares`));for(let h of O.sweeps)i.has(h)?o.over!=="graph"&&s.push(qe("rule-cost",`${d}.${m}`,`this rule looks at every ${h} for every ${o.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(y("rule-kind",`${d}.${m}`,`"${h}" is not a kind this document declares`))}o.says&&Oe(o.says,`${d}.says`,s),(o.repairs??[]).forEach((m,p)=>{!a[m.act]&&!pe(m.act)&&!ze(m.act,e.kinds)&&s.push(y("repair-act",`${d}.repairs.${p}.act`,`"${m.act}" is not an act this document declares`,ye(m.act,e)))})}let z=e.policy;return z&&(z.grants.forEach((r,o)=>{if(r.roles!=="*"&&l.size>0)for(let d of r.roles)l.has(d)||s.push(y("grant-role",`policy.grants.${o}.roles`,`"${d}" is not one of the document's roles`));if(r.mutations!=="*")for(let d of r.mutations)!a[d]&&!pe(d)&&!ze(d,e.kinds)&&s.push(y("grant-act",`policy.grants.${o}.mutations`,`"${d}" is not an act this document declares`,ye(d,e)))}),(z.sees??[]).forEach((r,o)=>{for(let d of r.kinds)i.has(d)||s.push(y("sight-kind",`policy.sees.${o}.kinds`,`"${d}" is not a kind this document declares`));if(r.roles!=="*"&&l.size>0)for(let d of r.roles)l.has(d)||s.push(y("sight-role",`policy.sees.${o}.roles`,`"${d}" is not one of the document's roles`))})),s.push(...Ye(e)),s}function En(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[me(e)??[]].flat()}function Rn(e,s,i,t){let a=new Map,l=ce(e.on),u=new Map,f=new Map;(l.length>0||s.some(p=>"remove"in p&&R(p.remove)==="subject"||"from"in p&&(R(p.from)==="subject"||R(p.to)==="subject")||"set"in p&&!("create"in p)&&R(p.target??"$subject")==="subject"))&&a.set(ue,{ref:l.length>0?l:"*",required:!0});let r=e.args??{},o=e.writes?.length===1,d=(p,c)=>c&&p.type===c.type&&p.min===void 0&&p.max===void 0&&p.step===void 0?{...p,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:p,w=(p,c)=>c&&p.type===c.type&&p.format===void 0&&p.unit===void 0?{...d(p,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:d(p,c),m=(p,c,O)=>{if(p===ue||vn.has(p)||u.has(p)||a.has(p))return;let h=r[p]?w(r[p],O):void 0;a.set(p,h?{field:h,optional:!h.required,required:!!h.required}:c())};for(let p of s)if("create"in p){let c=i.kinds[p.create],O=c?ln(c,En(c)):[],h=S=>O.includes(S)?O.indexOf(S):O.length;for(let[S,E]of Object.entries(p.set??{}).sort(([b],[C])=>h(b)-h(C))){let b=R(E),C=c?.fields[S];if(b&&C){let F=!!C.required&&C.default===void 0;m(b,()=>({field:C,optional:!F,required:F}),C)}}p.as&&u.set(p.as,p.create)}else if("connect"in p||"sever"in p){let c=t.get("connect"in p?p.connect:p.sever);for(let[O,h]of[["from",p.from],["to",p.to]]){let S=R(h);if(!S)continue;let E=O==="to"?c?.to??"*":c?.from??"*";E!=="*"&&!f.has(S)&&f.set(S,E),m(S,()=>({ref:E,required:!0}))}}else if("set"in p){let c=R(p.target??"$subject"),O=c==="subject"?l[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[h,S]of Object.entries(p.set)){let E=R(S);if(!E)continue;let b=O?i.kinds[O]?.fields[h]:void 0;m(E,()=>b?{field:b,optional:!o,required:o}:{any:!0,required:!1},b)}}else if("remove"in p){let c=R(p.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[p,c]of Object.entries(r))a.has(p)||a.set(p,{field:c,optional:!c.required,required:!!c.required});return a}function Dt(e,s={}){let i=xn(e);if(!i.document||fe(i.findings))return{ok:!1,findings:i.findings};let t=i.document,a=[...i.findings];s.previous&&a.push(...Dn(t,s.previous));let l=Fn(t,a);return fe(l.findings)?{ok:!1,findings:l.findings}:Be(l,s)}function ae(e,s){return e.map(i=>{let t=!i.format&&i.expr?.t==="ident"?s?.[i.expr.name]?.format:void 0;return t==="money"||t==="percent"?{...i,format:t}:i})}function Fn(e,s){let i=dn(e),t={};for(let[r,o]of Object.entries(e.kinds)){let d=me(o),w=o.label??(d?`{${d}}`:void 0),m=te(o),p=m?an(e,r,[...m]):[];t[r]={...w?{label:ae(J(w),o.fields)}:{},...o.describe?{describe:ae(J(o.describe),o.fields)}:{},...m?{computed:[...m]}:{},...p.length>0?{durations:p}:{}}}let a={};for(let[r,o]of Object.entries(e.acts??{})){let d=pn(o,e),w=Rn(o,d,e,i),m=o.destructive??d.some(g=>"remove"in g||"sever"in g||"replace"in g),p=[...new Set(d.flatMap(g=>"create"in g?[g.create]:[]))],c=[...new Set(d.flatMap(g=>"connect"in g?[g.connect]:[]))],O=[...new Set(d.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],h=[...new Set(d.flatMap(g=>"set"in g&&!("create"in g)&&R(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],S=new Map;for(let g of d){if(!("connect"in g)&&!("sever"in g))continue;let v=i.get("connect"in g?g.connect:g.sever);for(let[D,se]of[["from",g.from],["to",g.to]]){let Z=R(se),V=D==="to"?v?.to:v?.from;Z&&Z!=="subject"&&V&&V!=="*"&&S.set(Z,[...new Set([...S.get(Z)??[],...V])])}}let E={};for(let g of d){if(!("set"in g)||"create"in g)continue;let v=R(g.target??"$subject");for(let D of v&&v!=="subject"&&S.get(v)||[])E[D]=[...new Set([...E[D]??[],...Object.keys(g.set)])]}let b={};for(let g of d)if(!(!("set"in g)||"create"in g||R(g.target??"$subject")!=="subject"))for(let[v,D]of Object.entries(g.set??{}))typeof D=="string"&&R(D)===void 0||typeof D=="number"||typeof D=="boolean"?b[v]=typeof D=="string"&&D.startsWith("$$")?D.slice(1):D:delete b[v];let C=p.length===0&&d.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(v=>!(v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v))),F=new Map;for(let g of d)if(!(!("set"in g)||!g.set))for(let v of Object.values(g.set))v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&F.set(v.expr,H(v.expr));a[r]={title:o.title??r.replace(/-/g," "),effects:d,args:[...w],...o.allowedWhen?{guard:H(o.allowedWhen)}:{},...o.refusal?{refusal:ae(J(o.refusal),e.kinds[[o.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...F],destructive:m,idempotent:C,creates:p,connects:c,severs:O,writes:h,writesOther:E,sets:b}}let l={};for(let[r,o]of Object.entries(e.rules??{}))l[r]={title:o.title??r.replace(/-/g," "),require:H(o.require),...o.when?{when:H(o.when)}:{},...o.says?{says:ae(J(o.says),e.kinds[o.over]?.fields)}:{}};let u=Le(e,s),f=Ze(e),z=We(e);return{format:Ve,document:e,findings:s,kinds:t,...e.computed?{facts:[...te(e)??[]]}:{},edges:[...i].map(([r,{from:o,to:d,cardinality:w}])=>[r,{from:o,to:d,cardinality:w}]),acts:a,rules:l,brand:u,...Object.keys(f).length>0?{viewSpecs:f}:{},...z?{home:z}:{}}}function Kt(e,s,i){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],a=t?i.kinds[t]:void 0;if(!t||!a)return e;let l=Object.keys(a.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${l.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function Dn(e,s){let i=[],t=new Set(Object.values(s.kinds).flatMap(a=>Object.keys(a.edges??{})));for(let[a,l]of Object.entries(e.kinds)){let u=l.renamedFrom;u&&!s.kinds[u]&&i.push(y("renamed-from-nothing",`kinds.${a}.renamedFrom`,`${a} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??a];for(let[z,r]of Object.entries(l.fields)){let o=r.renamedFrom;o&&!f?.fields[o]&&i.push(y("renamed-from-nothing",`kinds.${a}.fields.${z}.renamedFrom`,`${z} says it was ${o}, and the previous ${u??a} has no field called ${o}`,"name the field it was, or drop renamedFrom"))}for(let[z,r]of Object.entries(l.edges??{})){let o=r.renamedFrom;o&&!t.has(o)&&i.push(y("renamed-from-nothing",`kinds.${a}.edges.${z}.renamedFrom`,`${z} says it was ${o}, and the previous version has no relation called ${o}`,"name the relation it was, or drop renamedFrom"))}}return i}export{hn as ActRefusal,Dt as compileDocumentWithoutCheck,pn as effectsOf,Kt as inDocumentWords,Ft as kindShapes,xn as readDocument};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as Ge}from"./chunk.DTSTUC2W.js";import{c as Me,d as Oe,f as Be}from"./chunk.IT763BYH.js";import{e as Pe,f as Ce,k as Re,l as re,n as Fe}from"./chunk.T2RME6XF.js";import{f as Se}from"./chunk.FCUDBMGC.js";import{d as _,e as je,k as ne}from"./chunk.DPPT6WAJ.js";import{b as De,e as Ae}from"./chunk.7U2JO7ET.js";import{$b as te,Ad as $e,Bc as he,C as Q,Dc as ye,Fc as we,Jb as fe,K as de,Kd as ke,Nc as U,Oc as be,Sd as xe,ac as ge,ba as ue,da as Z,fa as T,ga as K,ha as me,ia as ee,ja as pe,jd as ve,ma as q,oa as z}from"./chunk.YEJ4LNUP.js";function ze(r,e,t){let s=r.tryDefinition(e)?.fields.shape,n=Q(s?.[t]),a=!1,o=!1;for(;n&&(n.type==="optional"||n.type==="default"||n.type==="nullable"||n.type==="prefault");)(n.type==="optional"||n.type==="nullable")&&(a=!0),(n.type==="default"||n.type==="prefault")&&(o=!0),n=Q(n.innerType);if(n?.type!=="enum")return;let p=(n.entries?Object.values(n.entries):n.values??[]).filter(u=>typeof u=="string");return p.length>0?{values:p,empty:a&&!o}:void 0}function E(r,e,t){let s=ze(r,e,t);if(!s)return[];let n=r.tryDefinition(e),a=s.values.map(o=>({value:o,label:De(n,t,o)}));return s.empty&&a.push({value:null,label:`No ${q(n,t).toLowerCase()}`}),a}function X(r,e,t){let s=r[e];return typeof s=="string"&&t.some(n=>n.value===s)?s:null}function oe(r,e,t,s,n=E(r.schema,t.kind,s)){return Ie(r,e,t,s,n).flatMap(a=>a.move?[a.move]:[])}function Ie(r,e,t,s,n=E(r.schema,t.kind,s)){let a=Ne(r.schema,r.allMutations(),t.kind,s,n),o=X(t,s,n),p=z(r.schema.tryDefinition(t.kind),t.kind),u=[];for(let{value:A,label:R,by:F,acts:M}of a){if(A===o)continue;let x,G,I;for(let l of M){let w=F==="step"?{[l.subject.arg]:t.id}:{[l.subject.arg]:t.id,[s]:A},S={name:l.name,args:w};if(!l.input.safeParse(w).success){I??=`${l.title??l.name} asks for more than the ${p} itself.`;continue}let k=r.permits(S,e);if(!k.ok){G??=k.refusal?.message??`You may not ${l.title??l.name}.`;continue}try{fe(r.graph,l,w)}catch(f){G??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:l.title??l.name};break}u.push(x?{to:A,label:R,move:x}:{to:A,label:R,why:G??I??`Nothing in this app moves a ${p} to ${R}.`})}return u}function Ne(r,e,t,s,n=E(r,t,s)){let a=Ve(r,e,t,s),o=Ke(r,e,t,s);return n.flatMap(p=>{if(p.value===null)return[];let u=a.filter(A=>A.sets?.[s]===p.value);return[{value:p.value,label:p.label,by:u.length>0?"step":o.length>0?"value":"none",acts:u.length>0?u:o}]})}function Ve(r,e,t,s){return e.filter(n=>n.subject!==void 0&&n.derived===void 0&&typeof n.sets?.[s]=="string"&&te(r,n).includes(t))}function Ke(r,e,t,s){let n=r.tryDefinition(t);return n?e.filter(a=>{if(!a.subject||!te(r,a).includes(t)||!ge(a,n).includes(s))return!1;let o=a.input.shape;return o!==void 0&&s in o}).sort((a,o)=>+(a.derived!==void 0)-+(o.derived!==void 0)):[]}var se=(r,e)=>e&&r[e]!==void 0?String(r[e]):"";function Xe(r,e,t){let s=l=>r.tryDefinition(l)?e.nodesOfKind(l).filter(w=>T(r.tryDefinition(l),w)):[],n=s(t.rows),a=s(t.columns),o=new Set(n.map(l=>l.id)),p=new Set(a.map(l=>l.id)),u=e.allEdges(),A=[],R=t.link;if(typeof R=="string"){let l=f=>r.tryDefinition(f)?.edges?.[R]?.to,w=(l(t.columns)??[]).some(f=>f===t.rows||f==="*"),S=(l(t.rows)??[]).some(f=>f===t.columns||f==="*"),k=w||!S;for(let f of u){if(f.kind!==R)continue;let P=k?f.to:f.from,i=k?f.from:f.to;o.has(P)&&p.has(i)&&A.push({rowId:P,columnId:i,via:[]})}}else{let l=new Map(R.path.map(S=>[S,new Map]));for(let S of u){let k=l.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let P=k.get(S.to);P?P.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of R.path){let P=[],i=new Set;for(let $ of k)for(let b of l.get(f).get($.id)??[])i.has(`${$.id}|${b}`)||(i.add(`${$.id}|${b}`),P.push({id:b,via:[...$.via,$.id]}));k=P}for(let f of k){let P=`${f.id}|${S.id}`;!o.has(f.id)||w.has(P)||(w.add(P),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let F=t.groupOrder??[],M=l=>F.indexOf(l)===-1?F.length:F.indexOf(l),x=(l,w)=>w==="label"?K(r.tryDefinition(l.kind),l):l[w],G=U(n,t.sort,x).map(l=>{let w=l;return{node:l,label:K(r.tryDefinition(l.kind),l),group:se(w,t.rowGroup),ref:se(w,t.rowRef)}}).sort((l,w)=>M(l.group)-M(w.group)||(t.sort!==void 0?0:l.ref<w.ref?-1:l.ref>w.ref?1:0)),I=U(a,t.columnSort,x).map(l=>({node:l,label:K(r.tryDefinition(l.kind),l),group:se(l,t.columnGroup)})).sort((l,w)=>l.group<w.group?-1:l.group>w.group?1:t.columnSort!==void 0?0:l.node.id<w.node.id?-1:l.node.id>w.node.id?1:0);return{rows:G,columns:I,cells:A}}function We(r,e,t){let{rows:s,columns:n,cells:a}=Xe(r,e,t),o=(i,$)=>ee(r,i,$),p=i=>ee(r,i,1).replace(/^1 /,""),u=i=>({id:i.id,kind:i.kind,title:K(r.tryDefinition(i.kind),i),parts:[]}),A=i=>{let $=e.getNode(i);if(!$)return null;let b=r.tryDefinition($.kind),C=K(b,$),N=_($,b,{limit:3,said:[C],glance:!0}).map(V=>V.alone.startsWith(V.label)?`${V.label.toLowerCase()}${V.alone.slice(V.label.length)}`:V.alone);return[C,...N].join(", ")},R=typeof t.link=="string"?[]:t.link.path.slice(0,-1).flatMap((i,$,b)=>{let C=ve(r,t.columns,b.slice(0,$+1));return C.ok?[...C.reached]:[]}),F=be(r,t,{rows:s.length,columns:n.length,cells:a.length});if(F)return[{t:"text",text:`${o(t.rows,s.length)} against ${o(t.columns,n.length)}.`},{t:"text",text:F}];let M=[{t:"text",text:`${o(t.rows,s.length)} against ${o(t.columns,n.length)}${R.length>0?`, through ${[...new Set(R)].map(i=>o(i,2).replace(/^2 /,"")).join(" and ")}`:""}${n.length>0?`: ${n.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(n.map(i=>[i.node.id,i.label])),G=new Map(n.map((i,$)=>[i.node.id,$])),I=new Map,l=new Map;for(let i of a){let $=I.get(i.rowId);$?$.push(i):I.set(i.rowId,[i]);let b=l.get(i.columnId);b?b.add(i.rowId):l.set(i.columnId,new Set([i.rowId]))}for(let i of s){let b=[...I.get(i.node.id)??[]].sort((C,N)=>G.get(C.columnId)-G.get(N.columnId)).map(C=>{let N=C.via.map(A).filter(V=>V!==null);return`${x.get(C.columnId)}${N.length>0?` (${N.join("; ")})`:""}`});M.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}M.push({t:"list",as:"name",columns:1,groups:n.map(i=>{let $=l.get(i.node.id)??new Set,b=s.filter(C=>$.has(C.node.id)).map(C=>u(C.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=s.filter(i=>!w.has(i.node.id)),f=n.filter(i=>!S.has(i.node.id)),P=t.rows===t.columns;return k.length>0&&M.push({t:"text",text:`${P?`${k.length} with none across`:`${o(t.rows,k.length)} with no ${p(t.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&M.push({t:"text",text:`${P?`${f.length} with none down`:`${o(t.columns,f.length)} on no ${p(t.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),M}function ie(r,e,t,s={}){let{app:n,blocks:a=t?n?.viewSpecs?.[t.kind]?.[s.slot??"page"]:n?.home}=s;if(!a?.length)return[];let o=s.firstHeading??(t||s.blocks?void 0:1),p=Fe(r,e,t,{...s,money:s.money??n?.brand,firstHeading:o});return t&&!p.node?[]:Ce(typeof a[0]?.t=="string"?a:Pe(a),p)}function Y(r,e,t){let s=!(e.optional||e.control==="boolean"),n=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(o=>Z(z(r.tryDefinition(o),o))).join(" or "):t(e.name).label,a={name:e.name,label:n,required:s};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(o=>t(e.name).option(o))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${Y(r,e.item,t).input}`};case"group":return{...a,input:"group",fields:e.fields.map(o=>Y(r,o,t))};case"variant":return{...a,input:"one of",choices:e.options.map(o=>Z(o.value))};default:return{...a,input:"answer"}}}function Te(r,e,t){let s=Oe(r,e,t),n=r.schema,a=Me(n,t).filter(p=>p.name!==t.subject?.arg&&!s.has(p.name)),o=me(t);return{act:t.name,title:o,submit:o,fields:a.map(p=>Y(n,p,u=>ne(n,t,u)))}}function He(r,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(t=>Y(r,t,s=>ne(r,e.act,s)))}}function Ee(r,e,t){return r.permittedMutations(e).filter(s=>!s.derived&&!s.subject&&(s.creates??[]).includes(t))}function Le(r,e=""){let t=[`${e}Form "${r.title}" (${r.visitor?`the visitor form ${r.visitor}, running `:""}act ${r.act}), button "${r.submit}":`],s=(n,a)=>{for(let o of n){let p=o.choices?`${o.input}: ${o.choices.join(", ")}`:o.kinds?`${o.input} (${o.kinds.join(" or ")})`:o.input,u=o.min!==void 0||o.max!==void 0?`, ${o.min??"\u2026"} to ${o.max??"\u2026"}`:"";t.push(`${a}- ${o.label}${o.required?" *":""} (${o.name}) \u2014 ${p}${u}`),o.fields&&s(o.fields,`${a} `)}};return s(r.fields,`${e} `),r.fields.length===0&&t.push(`${e} (asks nothing)`),t}function Ue(r,e){let t=r.viewSpecs??{};return e.filter(s=>s.cardinality==="one"&&s.replaces==="page"&&(t[s.attach]?.page?.length??0)>0).map(s=>{let n=L(r.schema,s.attach,1);return{at:`views.${s.attach}.page`,says:`The view "${s.name}" replaces ${Ye(n)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Ye=r=>`${/^[aeiou]/i.test(r)?"an":"a"} ${r}`,Je=240,Ze=10,Qe=1160,et=40,_e=640,tt=3,nt=r=>Math.max(1,Math.floor((Math.min(r,Qe)-et+Ze)/(Je+Ze)));function rt(r,e,t,s){let{app:n}=s,a=s.width??1440,o=s.today??r.today()??de(n.brand?.timeZone),p=r.seenBy(e),u=p.schema,A=p.graph,R=Ge(n,s.views?{views:s.views}:{}),F=typeof t=="string"?t.trim():t.slug,M=typeof t=="string"?R.find(c=>c.slug===F||c.title===F||c.address===F):R.find(c=>c.slug===t.slug&&c.kind===t.kind)??t,x=!M&&typeof t=="string"?A.getNode(F):void 0,G=!M&&!x?/^\/?forms\/(.+)$/.exec(F)?.[1]:void 0,I=G!==void 0?Be(n,G):void 0;if(I)return{ok:!0,description:ot(u,I,a)};if(!M&&!x)return{ok:!1,error:`"${F}" is not a place this app has, nor a record this seat can see.`,places:[...R.map(c=>c.slug),...Object.keys(n.forms??{}).map(c=>`forms/${c}`)]};let l=[],w=n.viewSpecs??{},S=nt(a),k=(c,y)=>ie(p,null,c,{app:n,today:o,...y}),f=(c,y,g)=>{let m=u.tryDefinition(c.kind),D=K(m,c);if(y==="name")return{id:c.id,kind:c.kind,title:D,parts:[]};if(w[c.kind]?.[y]){let O=k(c,{slot:y}),[B,...h]=O,j=B?.t==="title"||y==="row"&&B?.t==="headline";return{id:c.id,kind:c.kind,title:j?B.text:D,parts:P(j?h:O,g,`views.${c.kind}.${y}`,` (${c.id})`,j?1:0)}}if(y==="row")return{id:c.id,kind:c.kind,title:D,parts:[]};let d=m?.computed?re(u,A,c):c,W=_(d,m,{limit:3,said:[D],glance:!0,locale:n.brand?.locale,timeZone:n.brand?.timeZone});return{id:c.id,kind:c.kind,title:D,parts:W.map(O=>({t:"text",text:O.alone}))}};function P(c,y,g,m="",D=0){let v=[];return c.forEach((d,W)=>{let O=`${g}.${W+D}`;switch("problem"in d&&d.problem&&l.push({at:`${O}${m}`,says:d.problem}),d.t){case"title":v.push({t:"heading",level:3,text:d.text});return;case"text":v.push({t:"text",text:d.markdown?Ae(d.text):d.runs?it(d.runs):d.text,...d.tone?{tone:d.tone}:{}});return;case"badge":v.push({t:"badge",text:d.text});return;case"field":case"image":v.push({t:"field",label:d.label,text:d.text});return;case"progress":v.push({t:"progress",label:d.label,text:d.text});return;case"group":v.push(...P(d.blocks,y,`${O}.group`,m));return;case"when":v.push(...P(d.blocks,y,`${O}.show`,m));return;case"divider":case"figure":return;case"headline":v.push({t:"heading",level:d.level,text:d.text});return;case"number":v.push({t:"figure",text:d.text,...d.label?{label:d.label}:{}});return;case"list":{if(d.failed){v.push({t:"text",text:"\u2014"});return}if(d.members.length===0){d.empty&&v.push({t:"list",as:d.as,columns:1,groups:[],empty:d.empty});return}let B=y+1,h=B>tt?"name":d.as,j=(d.groups??[{value:null,members:d.members}]).map(H=>({..."heading"in H&&H.heading?{heading:H.heading,count:(d.everyGroup?.find(J=>J.value===H.value)??H).members.length}:{},items:H.members.map(J=>f(J,h,B))}));v.push({t:"list",as:h,columns:h==="card"?S:1,groups:j,...d.more>0?{more:d.more}:{}});return}}}),v}let i=[],$,b,C,N=[];if(x){b="record";let c=u.tryDefinition(x.kind),y=K(c,x);C={slug:x.id,title:y,kind:x.kind,address:$e(u,x.kind,x.id)};let g=w[x.kind]?.page,m=s.views?.find(D=>D.attach===x.kind&&D.cardinality==="one");if(m&&i.push({t:"view",name:m.name,...m.title?{title:m.title}:{},...m.replaces==="page"?{replaces:!0}:{},...m.parts?{parts:m.parts}:{}}),m?.replaces==="page")b=`view:${m.name}`,l.push(...Ue(n,[m]));else{g&&i.push(...P(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let D=c?.computed?re(u,A,x):x;for(let v of je(c,_(D,c,{said:[y],locale:n.brand?.locale,timeZone:n.brand?.timeZone}))){v.title&&i.push({t:"heading",level:2,text:v.title});for(let d of v.fields)i.push({t:"field",label:d.label,text:d.value,...d.long?{long:!0}:{},...d.markdown?{markdown:!0}:{}})}}}else{let c=M;C={slug:c.slug,title:c.title,kind:c.kind,address:c.address};let y=c.lens?ke(n).drawn.find(g=>g.as===c.slug&&(c.kind===null||g.kinds.includes(c.kind))):void 0;if(c.kind!==null&&y?.create!==!1&&c.view===void 0&&(N=Ee(r,e,c.kind).map(g=>Te(r,e,g))),c.view!==void 0&&!y){let g=s.views?.find(m=>m.name===c.view);b=`view:${c.view}`,i.push({t:"view",name:c.view,title:g?.title??c.title,...typeof g?.flows=="boolean"?{flows:g.flows}:{},...g?.parts?{parts:g.parts}:{}})}else if(c.kind===null){let g=n.brand,m=g?.name??n.name,D=we(g)?.light,v=D&&ye(D)?D:void 0;if($={name:m,...g?.subtitle&&g.subtitleDrawn!==!1?{subtitle:g.subtitle}:{},...v?{logo:{alt:g?.logoAlt??m,...he(v)?{drawn:"inline SVG"}:{drawn:"image",src:v}}}:{}},n.home)b="blocks",i=P(k(null,{}),0,"views.home");else{b="derived";let d=r.kindsKeptFrom(e),W=new Set([...n.pages?.hide??[],...d,...r.modules.disabledKinds]),O=xe(u.kinds,n.pages?.order).filter(B=>!W.has(B));i.push({t:"heading",level:1,text:n.name??"Home"});for(let B of O){let h=A.nodesOfKind(B).filter(j=>T(u.tryDefinition(B),j)).length;h>0&&i.push({t:"text",text:`${h} ${L(u,B,h)}`})}}}else if(y?.lens==="blocks")b="lens:blocks",i=P(k(null,{blocks:y.options.blocks??[]}),0,`lenses.${y.index}.options.blocks`);else if(y?.lens==="columns"){b="lens:columns";let g=y.options.bindings??{};for(let m of Object.keys(g)){let D=g[m]?.column;if(!D)continue;let v=E(u,m,D),d=U(A.nodesOfKind(m).filter(h=>T(u.tryDefinition(m),h)),y.options.sort,(h,j)=>j==="label"?K(u.tryDefinition(h.kind),h):h[j]);Object.keys(g).length>1&&i.push({t:"heading",level:2,text:L(u,m,2).replace(/^./,h=>h.toUpperCase())}),i.push({t:"text",text:`${d.length} ${L(u,m,d.length)} in columns by ${q(u.tryDefinition(m),D).toLowerCase()}.`});let W=v.map(h=>({column:h,items:d.filter(j=>X(j,D,v)===h.value).map(j=>f(j,"card",1))})).filter(({column:h,items:j})=>h.value!==null||j.length>0).map(({column:h,items:j})=>({heading:`${h.label} (${j.length})`,items:j}));i.push({t:"list",as:"card",columns:1,groups:W});let O=new Map;for(let h of d)for(let j of oe(r,e,h,D,v))O.set(j.to,(O.get(j.to)??new Set).add(`"${j.title}"`));let B=v.filter(h=>h.value!==null&&O.has(h.value)).map(h=>`to ${h.label} by ${[...O.get(h.value)].join(" or ")}`);i.push({t:"text",text:B.length>0?`Moves: ${B.join("; ")}.`:"Moves: none for this seat."})}}else if(y?.lens==="coverage")b="lens:coverage",i=We(u,A,y.options);else if(y){b=`lens:${y.lens}`;let g=y.kinds.flatMap(m=>A.nodesOfKind(m).filter(D=>T(u.tryDefinition(m),D)));i.push({t:"text",text:`A ${y.lens} of ${g.length} ${y.kinds.map(m=>L(u,m,g.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:g.map(m=>f(m,"name",1))}]})}else{b="derived";let g=A.nodesOfKind(c.kind).filter(m=>T(u.tryDefinition(c.kind),m));i.push({t:"heading",level:1,text:c.title}),g.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(u,c.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:g.map(m=>f(m,"row",1))}]})}}let V=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,qe=a<_e?"phone":"wide",le=C.kind===null?st(u,A):[],ce={...$?{masthead:$}:{},...le.length>0?{facts:le}:{},place:C,seat:V,width:a,variant:qe,drawnBy:b,parts:i,...N.length>0?{forms:N}:{},problems:l};return{ok:!0,description:{...ce,text:ae(ce)}}}function ot(r,e,t){let s=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],n={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:t,variant:t<_e?"phone":"wide",drawnBy:"form",parts:s,forms:[He(r,e)],problems:[]};return{...n,text:ae(n)}}function st(r,e){let t=Re(r,e,null),s=n=>Array.isArray(n)?n.map(s).join(", "):n===null?"nothing":typeof n=="boolean"?n?"yes":"no":typeof n=="object"?n.label:String(n);return[...Se(r)].map(([n,a])=>{let o=a.label??Z(n);return Object.hasOwn(t.values,n)?{name:n,label:o,value:s(t.values[n])}:{name:n,label:o,refused:t.refused[n]??"it could not be worked out"}})}function L(r,e,t){let s=r.tryDefinition(e);if(t===1)return s?.noun??e;let n=pe(r,e);return ue(n)}function ae(r){let e=[`${r.place.title} (${r.place.address}) \u2014 as ${r.seat}, ${r.width} wide (${r.variant}).`],t=r.masthead;t&&e.push(`Masthead: ${t.logo?`the logo ("${t.logo.alt}", ${t.logo.drawn==="image"?t.logo.src:"inline SVG"}), `:""}${t.name}${t.subtitle?` \u2014 ${t.subtitle}`:""}`);let s=(n,a)=>{for(let o of n)switch(o.t){case"heading":e.push(`${a}${"#".repeat(o.level)} ${o.text}`);break;case"text":e.push(`${a}${o.text}`);break;case"badge":e.push(`${a}[${o.text}]`);break;case"field":case"progress":e.push(`${a}${o.label}: ${o.text}`);break;case"figure":e.push(`${a}${o.text}${o.label?` \u2014 ${o.label}`:""}`);break;case"list":if(o.groups.length===0){o.empty&&e.push(`${a}(${o.empty})`);break}for(let p of o.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let u of p.items)e.push(`${a}${p.heading?" ":""}- ${u.title}`),s(u.parts,`${a}${p.heading?" ":" "}`)}o.as==="card"&&o.columns>1&&e.push(`${a}(cards, ${o.columns} across)`),o.more&&e.push(`${a}and ${o.more} more`);break;case"view":e.push(`${a}[the view "${o.title??o.name}"${o.replaces?", in place of the page":""}${o.flows===!0?", flowing with the page":o.flows===!1?", in a frame of its own":""}]`),o.parts&&s(o.parts,`${a} `);break}};s(r.parts,"");for(let n of r.forms??[])e.push(...Le(n));if(r.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let n of r.facts)e.push(`- ${n.label} (${n.name}): ${n.value??`not worked out \u2014 ${n.refused}`}`)}if(r.problems.length>0){e.push("Problems:");for(let n of r.problems)e.push(`- ${n.at}: ${n.says}`)}return e.join(`
|
|
2
|
-
`)}function it(r){return r.map((e,t)=>(t===0?"":e.field===void 0&&r[t-1].field===void 0?" \xB7 ":" ")+e.text).join("")}export{E as a,X as b,oe as c,Ie as d,Ne as e,Ve as f,Ke as g,ie as h,Ue as i,rt as j,ae as k};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{C as y,N as h,Ob as $,Sb as x,W as g,da as m}from"./chunk.YEJ4LNUP.js";function B(n,e,t){let o=n?.display?.format?.[e];return o?o(t):typeof t=="string"?m(t):String(t)}function G(n,e,t,o){let s=n.tryDefinition(e)?.edges,i=s&&Object.hasOwn(s,t)?s[t]:void 0;return(o==="out"?i?.description:i?.inverse)??m(t).toLowerCase()}var O=Symbol.for("@graview/core:markdown");function S(n){let e=y(n);return!!e&&(e[O]===1||S(e.innerType))}var w=/^ {0,3}#{1,6}(?:[ \t]+|$)/,b=/^[ \t]*(?:[-*+•]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,k=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,R=/^ {0,3}(?:`{3,}|~{3,})/,F=/^ {0,3}(?:>[ \t]?)+/,A=/^\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?$/,_={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'",nbsp:" "};function E(n){return n.replace(/!?\[([^\]\n]{0,500})\]\([^)\n]{0,500}\)/g,"$1").replace(/<((?:https?:|mailto:)[^>\s]*)>/gi,"$1").replace(/<\/?[A-Za-z][^<>\n]*>/g,"").replace(/`+([^`\n]*)`+/g,"$1").replace(/(\*\*|__|~~)(?=\S)([^\n]{0,500}?\S)\1/g,"$2").replace(/(^|[^\w*])\*(?=\S)([^*\n]{0,500}?\S)\*(?![\w*])/g,"$1$2").replace(/(^|\W)_(?=\S)([^_\n]{0,500}?\S)_(?!\w)/g,"$1$2").replace(/\\([\\`*_{}[\]()#+\-.!>|~])/g,"$1").replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(e,t)=>_[t]??"")}function N(n,e,t){let o=n.replace(/\r\n?/g,`
|
|
2
|
-
`).split(`
|
|
3
|
-
`),s=[],i=[],c=0,d=!1,u=()=>{let r=i.join(" ").replace(/\s+/g," ").trim();r&&(s.push(r),c+=r.length),i=[]},a=0;for(;a<o.length&&c<=t;){let r=o[a++];if(e&&R.test(r)){d=!d,d||u();continue}if(!d&&(r.trim().length===0||e&&(k.test(r)||A.test(r.trim())))){u();continue}let f=!d&&e&&w.test(r),l=!d&&b.test(r);if((f||l)&&u(),e&&!d?(r=r.replace(F,""),f&&(r=r.replace(w,"").replace(/[ \t]+#+[ \t]*$/,"")),l&&(r=r.replace(b,"")),r.includes("|")&&(r=r.replace(/^[ \t]*\||\|[ \t]*$/g,"").split("|").map(p=>p.trim()).filter(Boolean).join(" \xB7 ")),r=E(Number.isFinite(t)?r.slice(0,t*2+200):r)):l&&(r=r.replace(b,"")),i.push(r),f&&u(),i.reduce((p,T)=>p+T.length,0)>t)break}return u(),{blocks:s,more:o.slice(a).some(r=>r.trim().length>0&&!(e&&(R.test(r)||k.test(r))))}}function M(n,e){return`${(n.slice(0,e+1).replace(/\s+\S*$/,"")||n.slice(0,e)).replace(/[\s,;:.—-]+$/,"")}\u2026`}function Z(n,e={}){let t=e.most??160,{blocks:o,more:s}=N(n,e.markdown===!0,t),i=o[0]??"";if(i.length<=t)return(s||o.length>1)&&i.length>0&&!/[.!?…:]$/.test(i)?`${i}\u2026`:i;let c=x(i);return c&&c.length<=t?c:M(i,t)}var J=n=>N(n,!0,Number.POSITIVE_INFINITY).blocks.join(" ");var j={d:1440,h:60,m:1};function ne(n){if(typeof n=="number")return Number.isFinite(n)&&n>=0?Math.round(n):void 0;if(typeof n!="string")return;let e=n.trim().toLowerCase();if(/^\d+$/.test(e))return Number(e);let t=/^(\d+):([0-5]\d)(?::([0-5]\d))?$/.exec(e);if(t)return Number(t[1])*60+Number(t[2])+Math.round(Number(t[3]??0)/60);let o=0,s=!1,i=e.replace(/(\d*[.,]?\d+) *(days?|d|hours?|hrs?|hr|h|minutes?|mins?|min|m)(?![a-z])/g,(c,d,u)=>(s=!0,o+=Number(d.replace(",","."))*j[u[0]]," "));return s&&/^[\s,+]*(?:and[\s,+]*)*$/.test(i)?Math.round(o):void 0}function I(n,e){if(!Number.isFinite(n))return String(n);let t=Math.round(Math.abs(n)),o=Math.floor(t/60),s=t%60,i=[o?`${g(o,e)} h`:"",s||!o?`${g(s,e)} min`:""].filter(Boolean).join(" ");return n<0?`\u2212${i}`:i}var D=/^(\+?1[ .-]?)?\(?([2-9]\d\d)\)?[ .-]?(\d{3})[ .-]?(\d{4})(?: *(?:ext\.?|x|#) *(\d+))?$/i;function W(n,e){let t=n.trim(),o=/[-_](US|CA)\b/i.test(h(e))?D.exec(t):null;if(!o)return t;let[,s,i,c,d,u]=o;return`${s?.startsWith("+")?"+1 ":""}(${i}) ${c}-${d}${u?` ext. ${u}`:""}`}function P(n){let[,e="",t]=/^(.*?)(?: *(?:ext\.?|x|#) *(\d+))?$/i.exec(n.trim())??[],o=e.replace(/\D/g,"");return o.length<3?void 0:`tel:${e.startsWith("+")?"+":""}${o}${t?`;ext=${t}`:""}`}var L=()=>/Mac|iPhone|iPad|iPod/.test(globalThis.navigator?.userAgent??"");function q(n,e=L()){let t=encodeURIComponent(n.trim());return e?`https://maps.apple.com/?q=${t}`:`https://www.google.com/maps/search/?api=1&query=${t}`}var C=n=>n?.fields?.shape??{},U=(n,e)=>{let t=C(n);return Object.hasOwn(t,e)?$(t[e]):void 0},H=(n,e)=>{let t=n.computed,o=t&&Object.hasOwn(t,e)?t[e]:void 0;return typeof o=="object"?o.as:void 0};function te(n,e){return U(n,e)??(n&&H(n,e)==="duration"?"duration":void 0)}function re(n,e,t){return n==="duration"?typeof e=="number"?I(e,t):void 0:n==="phone"?typeof e=="string"?W(e,t):void 0:n==="place"&&typeof e=="string"?e.trim():void 0}function oe(n,e){if(!(typeof e!="string"||!e.trim()))return n==="phone"?P(e):n==="place"?q(e):void 0}export{S as a,B as b,G as c,Z as d,J as e,ne as f,te as g,re as h,oe as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk.6Q6BW4QT.js";import"./chunk.DTSTUC2W.js";import"./chunk.IT763BYH.js";import"./chunk.T2RME6XF.js";import"./chunk.SOTB6C5A.js";import"./chunk.TQCRFZ53.js";import"./chunk.6HLKAUWF.js";import"./chunk.FCUDBMGC.js";import"./chunk.KMEKMCKG.js";import"./chunk.DPPT6WAJ.js";import"./chunk.7U2JO7ET.js";import"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{g as columnActs,d as columnChoices,c as columnMoves,b as columnOf,e as columnReach,f as columnSteps,j as describePlace,k as placeText,h as resolveFor,i as shadowedPageSlots,a as statusColumns};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as $,c as T,d as y}from"./chunk.FBR4HJ2Q.js";import{N as x,P as v}from"./chunk.YEJ4LNUP.js";var I=Symbol.for("@graview/core:file"),A=Symbol.for("@graview/core:node-ref"),f=e=>typeof e=="object"&&e!==null?e._zod?.def:void 0;function g(e){let t=f(e);return t?.[I]??(t?.innerType?g(t.innerType):void 0)}function j(e){let t=g(e);if(t)return{as:t,list:!1};let n=f(e);for(;n?.innerType;)n=f(n.innerType);let i=n?.type==="array"?g(n.element):void 0;return i?{as:i,list:!0}:void 0}function F(e){if(typeof e!="object"||e===null)return;let t=e[A];if(t)return t;let n=f(e);return n?.[A]??(n?.innerType?F(n.innerType):void 0)}function z(e){let t=e?.shape??{};return Object.entries(t).flatMap(([n,i])=>{let s=F(i);return s?[{name:n,kinds:s}]:[]})}var W=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.href=="string"&&typeof e.name=="string"&&typeof e.type=="string"&&typeof e.bytes=="number",C=e=>(Array.isArray(e)?e:[e]).filter(W);function R(e,t,n){let s=e.schema.tryDefinition(t)?.fields?.shape?.[n];return s===void 0?void 0:j(s)}function D(e,t){if(e===void 0)return[];if(!Array.isArray(e))return[`The view's accepts is a list of { "kind": <a kind>, "field": <its image, video or file field> }.`];let n=[],i=new Set(t.schema.kinds);for(let s of e){let{kind:d,field:a}=s??{};typeof d!="string"||typeof a!="string"?n.push(`Each of the view's accepts is { "kind": <a kind>, "field": <its image, video or file field> }.`):i.has(d)?R(t,d,a)?t.allMutations().some(o=>(o.creates??[]).includes(d)&&Object.hasOwn(o.input?.shape??{},a))||n.push(`No act of this app makes a "${d}" with its "${a}", so a file dropped could become nothing.`):n.push(`The view accepts files into ${d}'s "${a}", which holds no picture, video or file.`):n.push(`The view accepts files for "${d}", which is no kind of this app.`)}return n}function N(e){if(e===void 0||e===!0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's pictures is true, or { "width": <the widest it draws a picture, in pixels> }.`];let{width:t,...n}=e,i=[];return Object.keys(n).length>0&&i.push(`The view's pictures says ${Object.keys(n).map(s=>`"${s}"`).join(", ")}: only "width" is read.`),t!==void 0&&!(Number.isInteger(t)&&t>=16&&t<=4096)&&i.push("The view's pictures width is a whole number of pixels from 16 to 4096."),i}function H(e){if(e===void 0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's scene is { "maxHeight": <the tallest its preview on the Scene is drawn, in pixels> }.`];let{maxHeight:t,...n}=e,i=[];return Object.keys(n).length>0&&i.push(`The view's scene says ${Object.keys(n).map(s=>`"${s}"`).join(", ")}: only "maxHeight" is read.`),t!==void 0&&!(Number.isInteger(t)&&t>=80&&t<=4e3)&&i.push("The view's scene maxHeight is a whole number of pixels from 80 to 4000."),i}function O(e){return(e.acts??[]).map(t=>typeof t=="string"?{act:t}:t)}function J(e,t){let n=[],i=new Set(t.schema.kinds),s=new Set(t.schema.edgeKinds),d=new Set(t.allMutations().map(o=>o.name));(typeof e.name!="string"||!/^[a-z0-9][a-z0-9-]{0,62}$/.test(e.name))&&n.push(`The view's name "${String(e.name)}" is not lower-case letters, digits and hyphens.`),e.title!==void 0&&(typeof e.title!="string"||e.title.trim()===""||e.title.length>80)&&n.push("The view's title is empty or longer than 80 characters."),e.attach!=="home"&&!i.has(e.attach)&&n.push(`The view attaches to "${e.attach}", which is no kind of this app.`),e.cardinality!=="one"&&e.cardinality!=="many"&&n.push(`The view's cardinality is "${String(e.cardinality)}", not one or many.`),e.attach==="home"&&e.cardinality!=="many"&&n.push("A view of the home draws many records: its cardinality is many."),e.replaces!==void 0&&e.replaces!=="page"?n.push(`The view's replaces is "${String(e.replaces)}": the one thing a view replaces is "page", or leave it out to draw the view above the record's own fields.`):e.replaces==="page"&&(e.attach==="home"||e.cardinality!=="one")&&n.push('Only a view of one record replaces its page: replaces "page" needs cardinality one on a kind.'),e.gestures!==void 0&&typeof e.gestures!="boolean"&&n.push(`The view's gestures is "${String(e.gestures)}": it is true, or left out.`),e.bleed!==void 0&&typeof e.bleed!="boolean"&&n.push(`The view's bleed is "${String(e.bleed)}": it is true, or left out.`),e.heading!==void 0&&(e.heading!=="own"||e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push(`The view's heading is "${String(e.heading)}": it is "own" on a view that is a place (a title, cardinality many), or left out.`),e.flows!==void 0&&typeof e.flows!="boolean"?n.push(`The view's flows is "${String(e.flows)}": it is false for a view that keeps its place's frame, or left out.`):e.flows===!1&&(e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push("Only a view that is a place keeps a frame: flows false needs a title and cardinality many on a kind."),n.push(...H(e.scene)),e.scene!==void 0&&(e.attach==="home"||e.cardinality!=="many")&&n.push("Only a view of a kind's members is drawn on the Scene as a card: scene needs cardinality many on a kind."),n.push(...N(e.pictures)),n.push(...D(e.accepts,t));for(let o of e.reads?.kinds??[])i.has(o)||n.push(`The view reads "${o}", which is no kind of this app.`);for(let o of e.reads?.edges??[])s.has(o)||n.push(`The view reads the edge "${o}", which no kind of this app declares.`);let a=new Set;for(let o of O(e)){d.has(o.act)||n.push(`The view asks for the act "${o.act}", which this app does not declare.`);let l=o.as??o.act;a.has(l)&&n.push(`Two of the view's acts are called "${l}".`),a.add(l)}return n}function _(e,t,n){let i=[...new Set([...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]])];if(i.length<2)return[];let s=new Set(t.reads?.edges??[]),d=a=>new RegExp(`(["'\`])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\1`).test(n);return e.schema.edgeKinds.filter(a=>{let o=e.schema.edge(a);return!s.has(a)&&o!==void 0&&o.from.some(l=>i.includes(l))&&(o.to==="*"||o.to.some(l=>i.includes(l)))&&d(a)})}function Q(e,t,n){let i=_(e,t,n);if(i.length===0)return;let s=(d,a)=>d.length<2?d[0]??"":`${d.slice(0,-1).join(", ")} ${a} ${d[d.length-1]}`;return`"${t.name}" names ${s(i,"and")} but does not read ${i.length>1?"them":"it"}, so the view is handed no such links: add ${s(i.map(d=>`"${d}"`),"and")} to its manifest's reads.edges.`}function U(e,t){return[...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]].some(i=>Object.keys(e.schema.tryDefinition(i)?.computed??{}).length>0)}function X(e,t,n){let{manifest:i}=n,s=n.input??{},a=e.seenBy(t).graph,o=i.attach==="home"?void 0:i.attach,l=o&&i.cardinality==="one"&&s.node?a.getNode(s.node.id):void 0,u=l&&l.kind===o?[l]:[],w=o&&i.cardinality==="many"?s.nodes?s.nodes.flatMap(r=>{let c=a.getNode(r.id);return c&&c.kind===o?[c]:[]}):a.nodesOfKind(o):[],M=new Set([...u,...w].map(r=>r.id)),m=$(a,M,{kinds:(i.reads?.kinds??[]).filter(r=>r!==o||i.cardinality==="one"),edges:i.reads?.edges??[]}),p=new Map;for(let r of[...w,...m.nodes])u.some(c=>c.id===r.id)||p.set(r.id,r);let V=new Set([...u.map(r=>r.id),...p.keys()]),P=[...m.edges],G=new Set(O(i).map(r=>r.act)),K=e.permittedMutations(t).filter(r=>G.has(r.name)).map(r=>({name:r.name,title:r.title??r.name,...r.description!==void 0?{description:r.description}:{},...r.subject?{subject:{kinds:r.subject.kinds,arg:r.subject.arg}}:{}})),k=r=>r?.filter(c=>V.has(c)),b=n.computed,S=r=>b?{...y(e,r),...b(a,r)}:y(e,r);return{view:i.name,...u[0]?{node:S(u[0])}:{},nodes:[...p.values()].map(S),edges:P,...i.title!==void 0?{label:i.title}:s.label!==void 0?{label:s.label}:{},cardinality:i.cardinality,...s.fidelity!==void 0?{fidelity:s.fidelity}:{},...s.mode!==void 0?{mode:s.mode}:{},...s.selected!==void 0?{selected:s.selected}:{},...s.implicated?{implicated:k(s.implicated)}:{},...s.flagged?{flagged:k(s.flagged)}:{},acts:K,...n.theme?{theme:n.theme}:{},locale:x(),timeZone:v(),...T(e.schema,[...u,...p.values()]),...n.places?{places:n.places.filter((r,c,h)=>h.findIndex(E=>E.as===r.as)===c).map(({as:r,title:c,kind:h})=>({as:r,title:c,kind:h}))}:{}}}export{z as a,W as b,C as c,R as d,O as e,J as f,_ as g,Q as h,U as i,X as j};
|
|
@@ -1 +0,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 _,b as pe,e as ue,f as me,g as ce}from"./chunk.TAJ2R44N.js";import{b as G}from"./chunk.VLBY66PB.js";import{c as de}from"./chunk.T2RME6XF.js";import{n as P}from"./chunk.E5XNQTEU.js";import{b as x,c as ie,d as oe,j as se,k as le}from"./chunk.XJFAUOJS.js";import{d as ae,e as re}from"./chunk.DPPT6WAJ.js";import{b as te,f as ne}from"./chunk.7U2JO7ET.js";import{Fa as Z,G as he,Ga as ee,T as X,ba as O,ca as Y,ea as U}from"./chunk.NPAWTPLQ.js";import{a as Q}from"./chunk.SDO3U72B.js";import{da as W,ma as J}from"./chunk.YEJ4LNUP.js";import{b as D}from"./chunk.AJZBJBMO.js";var p=D(he(),1);var ve=ee(Q(()=>(__graviewPreload(import.meta.url,["./chunk.BT7RLFPO.js","./chunk.TAJ2R44N.js","./chunk.VLBY66PB.js","./chunk.WVUJXDXZ.js","./chunk.T2RME6XF.js","./chunk.SOTB6C5A.js","./chunk.TQCRFZ53.js","./chunk.6HLKAUWF.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.GZHZLJBF.js","./chunk.E5XNQTEU.js","./chunk.OJGHDWI6.js","./chunk.K5YLQAFW.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4KMY24YC.js")))),ye=ve.part((i,a)=>i.drawAppLink(a),{quiet:!0});var e=D(X(),1);function K({nodeId:i,field:a,value:l,stored:s=l,said:c}){let{fields:m,commit:o}=P(i),t=m.find(r=>r.field===a),{store:g,principal:I}=O(),u=g.graph.getNode(i)?.kind,f=g.schema.definitions.find(r=>r.kind===u),v=J(f,a),k=v.toLowerCase(),n=c??`${v.charAt(0).toUpperCase()}${v.slice(1)}: ${l}`,[w,E]=(0,p.useState)(!1),d=t?.shape.type==="number"?t.shape.amount:void 0,y=d&&s!==""&&Number.isFinite(Number(s))?ie(Number(s),d):s,[b,M]=(0,p.useState)(y),C=(0,p.useRef)(null),j=(0,p.useRef)(null),z=(0,p.useRef)(!1),S=r=>{z.current=r,E(!1)};(0,p.useEffect)(()=>M(y),[y,w]);let q=t?.shape.type==="date";if((0,p.useEffect)(()=>{if(q)return Z(()=>void ce())},[q]),(0,p.useEffect)(()=>{w?C.current?.focus():z.current&&(z.current=!1,j.current?.focus())},[w]),!t)return(0,e.jsx)("span",{"data-graview-field":a,"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${k}`,style:{color:"var(--graview-ink)",cursor:"default",overflowWrap:"anywhere"},children:l});if(!w)return(0,e.jsx)("button",{ref:j,type:"button","data-graview-field":a,"data-graview-editable":t.mutation,...n===l?{}:{"aria-label":n},title:`${t.title} \u2014 changes the ${k}, and can be undone`,onClick:()=>E(!0),style:{all:"unset",cursor:"text",display:"inline-flex",alignItems:"flex-end",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",paddingBottom:1,borderBottom:"1px dashed var(--graview-edge-bright)",color:"var(--graview-ink)"},children:l});let R=(r,{left:h=!1}={})=>{S(!h),!(r===s||r===""||r===void 0)&&(t.shape.type==="date"&&typeof r=="string"&&fe(r)||o(t,r))},fe=r=>{if(t.shape.type!=="date")return!1;let h=m.filter(L=>L.shape.type==="date"&&L.takesValue),T=le(h.map(L=>L.field),f?.fieldRoles??{}),A=T?.start===a?h.find(L=>L.field===T.end):void 0,F=g.graph.getNode(i)?.[T?.end??""];if(!A||typeof F!="string")return!1;let N=se(s===""?void 0:s,r,F,{time:t.shape.time===!0,instant:t.shape.instant===!0});if(N===void 0||N===F)return!1;let $=t.call(r),V=A.call(N);return g.applyAll($.name===V.name?[{name:$.name,args:{...$.args,...V.args}}]:[$,V],{author:I}),!0};if(!t.takesValue){let r=[t,...t.alternatives];return(0,e.jsx)("span",{role:"group","aria-label":`Change ${W(a).toLowerCase()}`,"data-graview-field":a,style:{display:"inline-flex",gap:6,alignItems:"center",flexWrap:"wrap"},onKeyDown:h=>{h.key==="Escape"&&S(!0)},children:r.map((h,T)=>(0,e.jsx)("button",{type:"button",ref:T===0?C:void 0,"data-graview-act":h.mutation,onClick:()=>{S(!0),o(h,void 0)},onBlur:A=>{let H=A.relatedTarget;(!H||!A.currentTarget.parentElement?.contains(H))&&S(!1)},style:{padding:"2px 9px",fontSize:"0.8125rem",borderRadius:999},children:h.title},h.mutation))})}return(0,e.jsxs)("form",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,maxWidth:"100%"},onSubmit:r=>{r.preventDefault(),R(ge(t,b))},children:[t.shape.type==="choice"?(0,e.jsx)("select",{ref:C,"aria-label":W(a),"data-graview-field":a,value:b,onChange:r=>R(r.target.value),onBlur:()=>S(!1),style:{font:"inherit",fontSize:"inherit"},children:t.shape.options.map(r=>(0,e.jsx)("option",{value:r,children:te(f,a,r)},r))}):t.shape.type==="date"?(0,e.jsx)(me,{inputRef:C,label:W(a),value:b===""?void 0:b,time:t.shape.time===!0,instant:t.shape.instant===!0,partial:t.shape.partial===!0,onChange:r=>M(r??""),onLeave:r=>R(r,{left:!0}),onCancel:()=>S(!0),autoSelect:!0,boxStyle:{fontSize:"inherit",minHeight:24,padding:"0 3px"}}):(0,e.jsxs)(e.Fragment,{children:[d&&x(d).prefix?(0,e.jsx)("span",{"aria-hidden":"true",children:x(d).prefix}):null,(0,e.jsx)("input",{ref:C,"aria-label":d?`${W(a)}, ${x(d).hint}`:W(a),"data-graview-field":a,...d?{inputMode:"decimal",placeholder:x(d).placeholder,"data-graview-amount":d.format??"unit"}:{},type:d?"text":t.shape.type==="number"&&!t.shape.duration?"number":"text",...t.shape.type==="number"&&t.shape.duration?{placeholder:"1h 30m"}:{},...t.shape.type==="text"&&t.shape.holds==="phone"?{inputMode:"tel",autoComplete:"tel"}:{},...t.shape.type==="number"&&t.shape.min!==void 0&&!d?{min:t.shape.min}:{},...t.shape.type==="number"&&t.shape.max!==void 0&&!d?{max:t.shape.max}:{},...t.shape.type==="number"&&t.shape.step!==void 0&&!d?{step:t.shape.step}:{},value:b,onChange:r=>M(r.target.value),onBlur:()=>R(ge(t,b),{left:!0}),onKeyDown:r=>{r.key==="Escape"&&S(!0)},style:{font:"inherit",fontSize:"inherit",width:`min(${Math.max(6,b.length+1)}ch, 100%)`,maxWidth:"100%",minWidth:0,boxSizing:"border-box",minHeight:24,display:"inline-flex",alignItems:"center",padding:"0 3px"}}),d&&x(d).suffix?(0,e.jsx)("span",{"aria-hidden":"true",children:x(d).suffix}):null]}),t.open.length>0?(0,e.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["also needs ",t.open.map(r=>r.name).join(", ")]}):null]})}function ge(i,a){return i.shape.type==="number"&&i.shape.amount?oe(a,i.shape.amount):i.shape.type==="number"?i.shape.duration?ne(a)??a:Number(a):i.shape.type==="text"&&i.shape.holds?a.trim():a}function be({href:i,field:a,value:l,stored:s,nodeId:c}){let m=i.startsWith("tel:"),o=(t,g)=>(0,e.jsx)("a",{href:i,"data-graview-link":a,...g?{"aria-label":g}:{},...m?{}:{target:"_blank",rel:"noopener noreferrer"},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",color:"var(--graview-accent)"},children:t});return c===void 0?o(l):(0,e.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"center",gap:"0 10px",maxWidth:"100%"},children:[(0,e.jsx)(K,{nodeId:c,field:a,value:l,...s===void 0?{}:{stored:s}}),o(m?"Call":"Map",m?`Call ${l}`:`Open ${l} in maps`)]})}function De({id:i,hide:a=[],limit:l=10,labels:s={},shown:c=[]}){let{store:m}=O(),o=U(i);if(!o)return null;let t=m.schema.tryDefinition(o.kind),g=ae(o,t,{limit:l,said:c}).filter(u=>!a.includes(u.key)),I=de(t).length>0;return g.length===0&&!I?null:(0,e.jsxs)("div",{"data-graview-fields":o.id,style:{display:"grid",gap:14,alignContent:"start",minWidth:0,fontSize:"0.875rem"},children:[re(t,g).map((u,f)=>{let v=(0,e.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto 1fr",gap:"5px 16px",alignContent:"start",minWidth:0},children:u.fields.map(n=>n.files?(0,e.jsx)(_,{as:"field",nodeId:o.id,field:n.key,label:s[n.key]??n.label,files:n.files,labelStyle:B,style:{marginTop:6}},n.key):n.long?(0,e.jsx)(we,{nodeId:o.id,field:n.key,label:s[n.key]??n.label,value:n.value,markdown:n.markdown,labelStyle:B,style:{gridColumn:"1 / -1",marginTop:6}},n.key):(0,e.jsxs)("div",{style:{display:"contents"},children:[(0,e.jsx)("dt",{style:{...B,whiteSpace:"nowrap"},children:s[n.key]??n.label}),(0,e.jsxs)("dd",{style:{margin:0,minWidth:0},children:[n.linked?(0,e.jsx)(pe,{relation:n.linked.relation,refs:n.linked.refs,nodeId:o.id,field:n.key}):n.app?(0,e.jsx)(ye,{address:n.app,as:"record",nodeId:o.id,field:n.key}):n.href?(0,e.jsx)(be,{href:n.href,field:n.key,value:n.value,stored:n.stored,nodeId:o.id}):(0,e.jsx)(K,{nodeId:o.id,field:n.key,value:n.value,stored:n.stored}),n.repeats?(0,e.jsx)(ue,{nodeId:o.id,field:n.key,start:o[n.key],value:o[`${n.key}Repeat`],label:`${s[n.key]??n.label} repeats`}):null]})]},n.key))});if(!u.title)return(0,e.jsx)("div",{children:v},f);let k=`graview-field-group-${o.id}-${f}`;return(0,e.jsxs)("div",{role:"group","aria-labelledby":k,style:{display:"grid",gap:6,minWidth:0},children:[(0,e.jsx)("p",{id:k,"data-graview-field-group":u.title,style:ke,children:u.title}),v]},f)}),I?(0,e.jsx)(_,{as:"unfilled",nodeId:o.id,skip:a,labels:s,labelStyle:B}):null]})}var B={color:"var(--graview-ink-faint)",fontSize:"0.8125rem"},ke={margin:0,fontSize:"0.75rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)",fontWeight:560};function we(i){return Y()?(0,e.jsx)(xe,{...i}):(0,e.jsx)(Se,{...i})}function Se({field:i,label:a,value:l,labelStyle:s,valueStyle:c,style:m,markdown:o}){return(0,e.jsxs)("div",{"data-graview-long":i,style:{display:"grid",gap:6,minWidth:0,...m},children:[(0,e.jsx)("dt",{style:s,children:a}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...c},children:(0,e.jsx)("div",{"data-graview-field":i,children:(0,e.jsx)(G,{text:l,markdown:o})})})]})}function xe({nodeId:i,field:a,label:l,value:s,labelStyle:c,valueStyle:m,style:o,markdown:t}){let{fields:g,commit:I}=P(i),u=g.find(y=>y.field===a&&y.takesValue),[f,v]=(0,p.useState)(!1),k=(0,p.useRef)(null),n=(0,p.useRef)(!1);(0,p.useEffect)(()=>{!f&&n.current&&(n.current=!1,k.current?.focus())},[f]);let w=y=>{n.current=y,v(!1)},E=l.toLowerCase(),d=(0,e.jsx)(G,{text:s,markdown:t});return(0,e.jsxs)("div",{"data-graview-long":a,style:{display:"grid",gap:6,minWidth:0,...o},children:[(0,e.jsxs)("dt",{style:{display:"flex",alignItems:"baseline",gap:10,...c},children:[(0,e.jsx)("span",{children:l}),u&&!f?(0,e.jsx)("button",{ref:k,type:"button","data-graview-editable":u.mutation,"aria-label":`Edit the ${E}`,title:`${u.title} \u2014 changes the ${E}, and can be undone`,onClick:()=>v(!0),style:Ee,children:"Edit"}):null]}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...m},children:f&&u?(0,e.jsx)(p.Suspense,{fallback:d,children:(0,e.jsx)(Ie,{nodeId:i,field:a,label:l,value:s,...t?{markdown:!0}:{},onCancel:()=>w(!0),onDone:y=>w(!y),onSave:(y,b)=>{w(!b),y!==s&&I(u,y)}})}):(0,e.jsx)("div",{"data-graview-field":a,...u?{}:{"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${E}`},...u?{onClick:()=>v(!0)}:{},style:{cursor:u?"text":"default",minWidth:0},children:d})})]})}var Ie=(0,p.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.VLBY66PB.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.N3Q5CPVA.js"))),Ee={all:"unset",cursor:"pointer",fontSize:"0.75rem",letterSpacing:"normal",textTransform:"none",color:"var(--graview-accent)",borderBottom:"1px dashed currentColor",minHeight:24,minWidth:24,display:"inline-flex",alignItems:"flex-end"};function Oe({nodeId:i,children:a}){let{fields:l}=P(i),s=U(i);if(!s)return(0,e.jsx)(e.Fragment,{children:a});let c=l.find(m=>{let o=s[m.field];return typeof o=="string"&&o===a});return c?(0,e.jsx)(K,{nodeId:i,field:c.field,value:a,said:a}):(0,e.jsx)(e.Fragment,{children:a})}export{ye as a,K as b,be as c,De as d,we as e,Oe as f};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as le,b as U,d as ue,g as ye,h as pe,i as me}from"./chunk.7U2JO7ET.js";import{Aa as oe,C as j,Fa as re,Fb as fe,H as _,Ha as ie,I as M,J as Z,K as B,Lb as S,Nb as ce,Ob as I,Pa as C,Q as x,T as X,Ta as se,U as H,Va as de,Xa as ae,Y as L,_ as Y,ba as q,da as W,ga as O,ma as v,oa as J,ua as Q,va as ee,wa as ne,xa as te}from"./chunk.YEJ4LNUP.js";var $e=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Re={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 _e(t,e,n){let o=e.interval??1,i=Re[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 M.test(t)&&(d+=` at ${H(t,n)}`),e.until&&(d+=`, until ${x(e.until,n)}`),e.count&&(d+=`, ${e.count===1?"once":`${e.count} times`}`),d}function ge(t,e,n={}){if(!de(e)||typeof t!="string")return;let o=n.today??B(),i=ae(t,e,o),s=_e(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 rn(t,e){let n=new Map,o=new Map;for(let i of t){let s=O(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(f=>new Map(Se(f,e(f.kind)).map(p=>[p.key,p.alone]))),r=[...new Set(y.flatMap(f=>[...f.keys()]))],u=f=>y.every(p=>!/\d/.test(p.get(f)??"")),h=[...r.filter(u),...r.filter(f=>!u(f))],b=(f,p)=>p.map(m=>y[f].get(m)??"").filter(Boolean).join(" \xB7 "),E=f=>new Set(d.map((p,m)=>b(m,f))).size===d.length&&d.every((p,m)=>b(m,f)!==""),c=h.find(f=>E([f])),a=c?void 0:h.flatMap((f,p)=>h.slice(p+1).map(m=>[f,m])).find(f=>E(f));d.forEach((f,p)=>{if(c||a)return void n.set(f.id,b(p,c?[c]: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(f.id,m?y[p].get(m):`${p+1} of ${d.length}`)})}}return n}function sn(t,e){return t?.describe?t.describe(e):`${e.kind} ${O(t,e)}`}var xe=new Set(["id","kind","label"]);function ve(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Se(t,e,n={}){let o=e?.display,i=new Set([...xe,...o?.hide??[]]);typeof t.label=="string"&&e?.label&&!O(e,t).includes(t.label)&&i.delete("label");let s=(n.said??[]).filter(c=>!!c),l=s.filter(c=>c.endsWith("\u2026")).map(c=>c.replace(/…$/,"").trim()).filter(c=>c.length>12),d=[],y=e?.fields?.shape,r=e?.fieldRoles,u=n.glance?o?.glance??[r?.who,r?.when].filter(c=>!!c):he(o?.page),h=n.glance&&o?.glance!==void 0,E=[...new Set(h?u:[...u,...Ne(e),...Object.keys(t)])].filter(c=>Object.hasOwn(t,c)).map(c=>[c,t[c]]);for(let[c,a]of E){if(i.has(c)||a===void 0||a===null)continue;let f=o?.format?.[c],p=f?[]:ne(a);if(p[0]&&n.glance)continue;let m=e?.fields?.shape?.[c],$=!f&&typeof a=="string"&&oe(m)?a:void 0,w=!f&&typeof a=="string"&&le(m);if($&&n.glance)continue;let R=f?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))&&f===void 0)continue;let V=typeof a=="string"&&!f?ge(a,t[`${c}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=f?void 0:ye(e,c),G=me(z,a),K=!f&&!z&&typeof a=="number"?S(e?.fields?.shape?.[c]):void 0,D=k?k.refs.length>1?`${k.refs.length} linked records`:"linked record":f?f(a):K?ce(a,K):pe(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||Oe(e,c))?x(a,n.locale):typeof a=="string"&&M.test(a)?X(a,n.locale,n.timeZone):typeof a=="string"&&Fe(e,c)?U(e,c,a):N),P=typeof a=="string"&&je(e,c,D),A=(n.glance||n.excerpt)&&!f&&(P||w)?ue(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=>ve(g,A)))continue;let T=v(e,c),Ae=typeof a=="number"?`${T} ${A}`:typeof a=="boolean"&&!f?`${T}: ${A.toLowerCase()}`:A;if(d.push({key:c,label:T,value:A,stored:N,alone:Ae,long:P,...w?{markdown:!0}:{},...p[0]?{files:p}:{},...$?{app:$}:{},...k?{linked:k}:{},...G?{href:G}:{},...se(y?.[`${c}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&d.length>=n.limit)break}return Ee(d,e)}function Ee(t,e){let n=new Map;for(let o of t){let i=Me(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 Me(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 Oe(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 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"}function Ne(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function he(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var ze=500,De=160;function Te(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 je(t,e,n){return Te(t?.fields?.shape?.[e])?.checks?.some(i=>i._zod?.def?.check==="max_length"&&(i._zod.def.maximum??0)>ze)?!0:typeof n=="string"&&(n.includes(`
|
|
2
|
-
`)||n.length>De)}function dn(t,e){let n=t?.display?.page,o=n?.groups??[],i=new Map(e.map(r=>[r.key,r])),s=new Set(he(n)),l=r=>r.flatMap(u=>i.has(u)?[i.get(u)]:[]),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 Le(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 un(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?Le(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 We=t=>/^[A-Z]{3}$/.test(t??"");function ke(t){let{format:e,unit:n,currency:o,locale:i}=t,s=We(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 pn(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 be(t){let e=j(t)?.innerType;return e===void 0?t:be(e)}var Ce={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]},Ie=t=>(t?._zod?.def?.checks??[]).map(e=>e._zod?.def).filter(e=>e!==void 0);function we(t){let e=be(t),n=j(e),o=n?.type,i=Ie(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=we(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 u=r.check==="number_format"&&r.format?Ce[r.format]:void 0,h=u?u[0]:r.check==="greater_than"&&r.inclusive&&typeof r.value=="number"?r.value:void 0,b=u?u[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}:{},...S(t)?{amount:ke(S(t))}:{}}}if(o==="string"){if(i.some(u=>u.fn===Z||u.format==="datetime")||n?.format==="datetime")return{type:"date",time:!0,instant:!0};let d=[n?.pattern,...i.map(u=>u.pattern)].filter(u=>u instanceof RegExp).map(u=>u.source);if(d.some(u=>u.includes("\\d{4}")))return d.some(u=>u.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:d.includes(_.source)?{type:"date",partial:!0}:{type:"date"};let y=i.some(u=>u.check==="max_length"&&typeof u.maximum=="number"&&u.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"}:we(n[e])}export{_e as a,rn as b,sn as c,Se as d,dn as e,ke as f,pn as g,be as h,we as i,$n as j,Le as k,un as l};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk.AJZBJBMO.js";var Y=1200,q="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",K=100,Q=4e7,A=e=>/^image\//i.test(e.type)&&!/^image\/svg/i.test(e.type);function P(e,n={}){let u={name:e.name,type:e.type,bytes:e.bytes};return/^video\//i.test(e.type)?{...u,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.caption!==void 0?{caption:e.caption}:{},...e.duration!==void 0?{duration:e.duration}:{}}:A(e)?{...u,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.caption!==void 0?{caption:e.caption}:{},...n.src!==void 0?{src:n.src}:{},...n.left!==void 0?{left:n.left}:{}}:u}var D=new Set(["id","kind","label"]),C=e=>{let n=e;return typeof n=="object"&&n!==null&&typeof n.href=="string"&&typeof n.name=="string"&&typeof n.type=="string"&&typeof n.bytes=="number"};function $(e,n){let u=o=>{let d;for(let[h,c]of Object.entries(o)){if(D.has(h))continue;let l=C(c)?n(c,o):Array.isArray(c)&&c.length>0&&c.every(C)?c.map(i=>n(i,o)):void 0;l!==void 0&&((d??={...o})[h]=l)}return d??o};return{...e,...e.node?{node:u(e.node)}:{},...e.nodes?{nodes:e.nodes.map(u)}:{}}}var T=e=>e.toLocaleString("en-US"),k=(e,n)=>`The picture "${e.name}" on ${n.label?`"${n.label}"`:"a record"}`;function V(e,n,u){let o=e===!0?1200:e.width??1200,d=n?.pictureBytes??15e5,h=n?.picturesBytes??12e6,c=Math.round(o*Math.min(2,Math.max(1,u||1)));return{width:o,perFile:d,perView:h,need:c,reckon:i=>Math.min(d,Math.ceil(i.bytes*(i.width&&i.width>c?(c/i.width)**2:1)))}}var M=(e,n)=>`${k(e,n)} is left out: at ${T(e.bytes)} bytes it is more than the host fetches for a view.`,N=(e,n,u,o)=>`${k(e,n)} is left out: the view ${u} is handed at most ${T(o)} bytes of pictures, and the pictures before it took them.`;function J(e,n){let{perView:u,reckon:o}=V(n.pictures,n.limits,2),d=[],h=0;return{props:$(e,(l,i)=>{if(!A(l))return P(l);let m=g=>(d.includes(g)||d.push(g),P(l,{left:g}));if(l.bytes>4e7)return m(M(l,i));let v=o(l);return h+v>u?m(N(l,i,n.view,u)):(h+=v,P(l,{src:n.standIn}))}),left:d}}function X(e,n){let{width:u,perFile:o,perView:d,need:h,reckon:c}=V(n.pictures,n.limits,e.devicePixelRatio),l=n.shrink??((t,r,s)=>W(e,t,r,s)),i=new Map,m=new Map,v=new Set,g=!1,y,G=-1/0,E=()=>{if(y!==void 0||g)return;let t=()=>{y=void 0,!g&&(G=e.performance.now(),n.moved())},r=G+100-e.performance.now();r<=0?(y=!0,queueMicrotask(t)):y=e.setTimeout(t,r)},B=t=>{v.has(t)||(v.add(t),n.onLeft?.(t))},F=t=>{t?.state==="ready"&&(m.delete(t.url),t.url.startsWith("blob:")&&e.URL.revokeObjectURL(t.url))},I=k,x,H=t=>new Promise(r=>{let s=new e.Image;s.onload=()=>r(!0),s.onerror=()=>r(!1),e.setTimeout(()=>r(!1),2e3),s.src=t}),S=t=>new Promise((r,s)=>{let w=new e.FileReader;w.onload=()=>r(String(w.result)),w.onerror=s,w.readAsDataURL(t)}),O=async t=>{if(n.as==="blob"){let s=e.URL.createObjectURL(t);return x??=H(s),await x?{url:s,drawn:s}:{url:s,drawn:await S(t)}}let r=await S(t);return{url:r,drawn:r}},_=(t,r,s)=>({state:"left",said:`${I(t,r)} could not be loaded for the view ${n.view}${s?`: the host answered ${s}.`:"."}${s&&!n.file?" A host that serves the app under a base says where a record's files are (file, on the view's definition).":""}`}),j=async(t,r)=>{let s=_(t,r),w=n.file?n.file(t.href):t.href;if(w===void 0)return s;let a=new e.URL(w,e.document.baseURI);if(a.origin!==e.location.origin||!/^https?:$/.test(a.protocol))return s;let b=await e.fetch(a.href,{credentials:"same-origin"}),f=(b.headers.get("content-type")??"").split(";")[0].trim();if(!b.ok)return _(t,r,String(b.status));if(!A({type:f}))return _(t,r,`${f||"no type"}, not a picture`);let p=new e.Blob([await b.arrayBuffer()],{type:f});if(p.size>4e7)return s;if(!(t.width!==void 0&&t.width<=h)||p.size>o){let L=await l(p,h,o).catch(()=>{});if(L)p=L;else if(p.size>o)return s}return p.size>o?{state:"left",said:`${I(t,r)} is left out: made as small as the ${T(u)} pixels across the view ${n.view} draws a picture at, it is still more than the ${T(o)} bytes one picture is handed.`}:{state:"ready",...await O(p),bytes:p.size}},z=(t,r)=>{i.set(t.href,{state:"pending",bytes:c(t)}),j(t,r).then(s=>U(t.href,s),()=>U(t.href,{state:"left",said:`${I(t,r)} could not be loaded for the view ${n.view}.`}))},U=(t,r)=>{if(g||i.get(t)?.state!=="pending")return F(r);i.set(t,r),r.state==="ready"&&m.set(r.url,r.drawn),r.state==="left"&&B(r.said),E()};return{hand(t){if(g)return $(t,a=>P(a));let r=0,s=new Set,w=$(t,(a,b)=>{if(!A(a))return P(a);s.add(a.href);let f=i.get(a.href);if(f?.state==="left")return P(a,{left:f.said});if(!f&&a.bytes>4e7)return f={state:"left",said:M(a,b)},i.set(a.href,f),B(f.said),P(a,{left:f.said});let p=f?f.bytes:c(a);if(r+p>d){let R=N(a,b,n.view,d);return B(R),P(a,{left:R})}return r+=p,f||z(a,b),P(a,f?.state==="ready"?{src:f.url}:{})});for(let[a,b]of i)s.has(a)||(F(b),i.delete(a));return w},drawn:t=>m.get(t),waiting:()=>y!==void 0||[...i.values()].some(t=>t.state==="pending"),dispose(){g=!0,y!==void 0&&y!==!0&&e.clearTimeout(y);for(let t of i.values())F(t);i.clear(),m.clear()}}}async function W(e,n,u,o){if(typeof e.createImageBitmap!="function")return;let d=await e.createImageBitmap(n);try{if(d.width<=u&&n.size<=o)return n;let h=Math.min(1,u/d.width),c=Math.max(1,Math.round(d.width*h)),l=Math.max(1,Math.round(d.height*h)),i=e.document.createElement("canvas");i.width=c,i.height=l;let m=i.getContext("2d");if(!m)return;m.drawImage(d,0,0,c,l);let v=G=>new Promise(E=>i.toBlob(E,G,.85)),g=/^image\/(jpeg|webp|png)$/i.test(n.type)?n.type:"image/png",y=await v(g);return y&&y.size<=o?y:await v("image/jpeg")??y??void 0}finally{d.close()}}export{K as PICTURES_SETTLE_MS,Q as PICTURE_FETCH_BYTES,q as PICTURE_STAND_IN,Y as PICTURE_WIDTH,X as createGuestPictures,P as guestFileOf,$ as handFiles,A as isGuestPicture,V as pictureBudget,J as standInPictures};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk.GNQW4JOG.js";import"./chunk.USB6B6L3.js";import"./chunk.AZUTYY2S.js";import"./chunk.45VIF2SX.js";import{l as s}from"./chunk.IUQOSPQX.js";import"./chunk.UGFDSE37.js";import"./chunk.PXQVXBNG.js";import"./chunk.VYW7DSUW.js";import"./chunk.LKK7VQBA.js";import"./chunk.RR2IFETZ.js";import"./chunk.ONGZ3YQF.js";import"./chunk.XGCOWCA2.js";import"./chunk.MORMTKVR.js";import"./chunk.CU2NQ5WF.js";import"./chunk.E33EJU3Q.js";import"./chunk.PJCVFYFU.js";import"./chunk.7RJGEU3Y.js";import"./chunk.22MIRLL6.js";import"./chunk.NFU4UM6F.js";import"./chunk.DH7M57SE.js";import"./chunk.AIK3Z25Y.js";import"./chunk.CKV2QCH5.js";import"./chunk.BT7RLFPO.js";import"./chunk.TAJ2R44N.js";import"./chunk.VLBY66PB.js";import"./chunk.BJUUSIQY.js";import"./chunk.RDL6652E.js";import"./chunk.V3NPUAPB.js";import"./chunk.XOZU4OFA.js";import"./chunk.IT763BYH.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.T2RME6XF.js";import"./chunk.SOTB6C5A.js";import"./chunk.TQCRFZ53.js";import"./chunk.6HLKAUWF.js";import"./chunk.FCUDBMGC.js";import"./chunk.KMEKMCKG.js";import"./chunk.GZHZLJBF.js";import"./chunk.E5XNQTEU.js";import"./chunk.OJGHDWI6.js";import"./chunk.K5YLQAFW.js";import"./chunk.XJFAUOJS.js";import"./chunk.DPPT6WAJ.js";import"./chunk.7U2JO7ET.js";import"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import{G as y,T as i}from"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as r}from"./chunk.AJZBJBMO.js";var c=r(y(),1),e=r(i(),1);function v({store:d,views:t,as:a,scope:o}){let l=(0,c.useMemo)(()=>s({scope:`.${o}`}),[o]);return(0,e.jsxs)("div",{"data-testid":"embed-picture","data-embed-content":"",tabIndex:0,"aria-label":t.places().find(m=>m.as===a)?.title??"The picture",style:{flex:"1 1 auto",minHeight:0,display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)"},children:[(0,e.jsx)("style",{children:l}),(0,e.jsx)(n,{store:d,views:t,as:a})]})}export{v as PictureFace};
|